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

"use strict";
var __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 __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);

// node_modules/js-logger/src/logger.js
var require_logger = __commonJS({
  "node_modules/js-logger/src/logger.js"(exports, module2) {
    (function(global2) {
      "use strict";
      var Logger25 = {};
      Logger25.VERSION = "1.6.1";
      var logHandler;
      var contextualLoggersByNameMap = {};
      var bind = function(scope, func) {
        return function() {
          return func.apply(scope, arguments);
        };
      };
      var merge2 = function() {
        var args = arguments, target = args[0], key, i2;
        for (i2 = 1; i2 < args.length; i2++) {
          for (key in args[i2]) {
            if (!(key in target) && args[i2].hasOwnProperty(key)) {
              target[key] = args[i2][key];
            }
          }
        }
        return target;
      };
      var defineLogLevel = function(value, name) {
        return { value, name };
      };
      Logger25.TRACE = defineLogLevel(1, "TRACE");
      Logger25.DEBUG = defineLogLevel(2, "DEBUG");
      Logger25.INFO = defineLogLevel(3, "INFO");
      Logger25.TIME = defineLogLevel(4, "TIME");
      Logger25.WARN = defineLogLevel(5, "WARN");
      Logger25.ERROR = defineLogLevel(8, "ERROR");
      Logger25.OFF = defineLogLevel(99, "OFF");
      var ContextualLogger = function(defaultContext) {
        this.context = defaultContext;
        this.setLevel(defaultContext.filterLevel);
        this.log = this.info;
      };
      ContextualLogger.prototype = {
        // Changes the current logging level for the logging instance.
        setLevel: function(newLevel) {
          if (newLevel && "value" in newLevel) {
            this.context.filterLevel = newLevel;
          }
        },
        // Gets the current logging level for the logging instance
        getLevel: function() {
          return this.context.filterLevel;
        },
        // Is the logger configured to output messages at the supplied level?
        enabledFor: function(lvl) {
          var filterLevel = this.context.filterLevel;
          return lvl.value >= filterLevel.value;
        },
        trace: function() {
          this.invoke(Logger25.TRACE, arguments);
        },
        debug: function() {
          this.invoke(Logger25.DEBUG, arguments);
        },
        info: function() {
          this.invoke(Logger25.INFO, arguments);
        },
        warn: function() {
          this.invoke(Logger25.WARN, arguments);
        },
        error: function() {
          this.invoke(Logger25.ERROR, arguments);
        },
        time: function(label) {
          if (typeof label === "string" && label.length > 0) {
            this.invoke(Logger25.TIME, [label, "start"]);
          }
        },
        timeEnd: function(label) {
          if (typeof label === "string" && label.length > 0) {
            this.invoke(Logger25.TIME, [label, "end"]);
          }
        },
        // Invokes the logger callback if it's not being filtered.
        invoke: function(level, msgArgs) {
          if (logHandler && this.enabledFor(level)) {
            logHandler(msgArgs, merge2({ level }, this.context));
          }
        }
      };
      var globalLogger = new ContextualLogger({ filterLevel: Logger25.OFF });
      (function() {
        var L2 = Logger25;
        L2.enabledFor = bind(globalLogger, globalLogger.enabledFor);
        L2.trace = bind(globalLogger, globalLogger.trace);
        L2.debug = bind(globalLogger, globalLogger.debug);
        L2.time = bind(globalLogger, globalLogger.time);
        L2.timeEnd = bind(globalLogger, globalLogger.timeEnd);
        L2.info = bind(globalLogger, globalLogger.info);
        L2.warn = bind(globalLogger, globalLogger.warn);
        L2.error = bind(globalLogger, globalLogger.error);
        L2.log = L2.info;
      })();
      Logger25.setHandler = function(func) {
        logHandler = func;
      };
      Logger25.setLevel = function(level) {
        globalLogger.setLevel(level);
        for (var key in contextualLoggersByNameMap) {
          if (contextualLoggersByNameMap.hasOwnProperty(key)) {
            contextualLoggersByNameMap[key].setLevel(level);
          }
        }
      };
      Logger25.getLevel = function() {
        return globalLogger.getLevel();
      };
      Logger25.get = function(name) {
        return contextualLoggersByNameMap[name] || (contextualLoggersByNameMap[name] = new ContextualLogger(merge2({ name }, globalLogger.context)));
      };
      Logger25.createDefaultHandler = function(options) {
        options = options || {};
        options.formatter = options.formatter || function defaultMessageFormatter(messages, context) {
          if (context.name) {
            messages.unshift("[" + context.name + "]");
          }
        };
        var timerStartTimeByLabelMap = {};
        var invokeConsoleMethod = function(hdlr, messages) {
          Function.prototype.apply.call(hdlr, console, messages);
        };
        if (typeof console === "undefined") {
          return function() {
          };
        }
        return function(messages, context) {
          messages = Array.prototype.slice.call(messages);
          var hdlr = console.log;
          var timerLabel;
          if (context.level === Logger25.TIME) {
            timerLabel = (context.name ? "[" + context.name + "] " : "") + messages[0];
            if (messages[1] === "start") {
              if (console.time) {
                console.time(timerLabel);
              } else {
                timerStartTimeByLabelMap[timerLabel] = (/* @__PURE__ */ new Date()).getTime();
              }
            } else {
              if (console.timeEnd) {
                console.timeEnd(timerLabel);
              } else {
                invokeConsoleMethod(hdlr, [timerLabel + ": " + ((/* @__PURE__ */ new Date()).getTime() - timerStartTimeByLabelMap[timerLabel]) + "ms"]);
              }
            }
          } else {
            if (context.level === Logger25.WARN && console.warn) {
              hdlr = console.warn;
            } else if (context.level === Logger25.ERROR && console.error) {
              hdlr = console.error;
            } else if (context.level === Logger25.INFO && console.info) {
              hdlr = console.info;
            } else if (context.level === Logger25.DEBUG && console.debug) {
              hdlr = console.debug;
            } else if (context.level === Logger25.TRACE && console.trace) {
              hdlr = console.trace;
            }
            options.formatter(messages, context);
            invokeConsoleMethod(hdlr, messages);
          }
        };
      };
      Logger25.useDefaults = function(options) {
        Logger25.setLevel(options && options.defaultLevel || Logger25.DEBUG);
        Logger25.setHandler(Logger25.createDefaultHandler(options));
      };
      Logger25.setDefaults = Logger25.useDefaults;
      if (typeof define === "function" && define.amd) {
        define(Logger25);
      } else if (typeof module2 !== "undefined" && module2.exports) {
        module2.exports = Logger25;
      } else {
        Logger25._prevLogger = global2.Logger;
        Logger25.noConflict = function() {
          global2.Logger = Logger25._prevLogger;
          return Logger25;
        };
        global2.Logger = Logger25;
      }
    })(exports);
  }
});

// node_modules/react/cjs/react.development.js
var require_react_development = __commonJS({
  "node_modules/react/cjs/react.development.js"(exports, module2) {
    "use strict";
    if (true) {
      (function() {
        "use strict";
        if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
          __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
        }
        var ReactVersion = "18.3.1";
        var REACT_ELEMENT_TYPE = Symbol.for("react.element");
        var REACT_PORTAL_TYPE = Symbol.for("react.portal");
        var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
        var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
        var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
        var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
        var REACT_CONTEXT_TYPE = Symbol.for("react.context");
        var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
        var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
        var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
        var REACT_MEMO_TYPE = Symbol.for("react.memo");
        var REACT_LAZY_TYPE = Symbol.for("react.lazy");
        var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
        var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
        var FAUX_ITERATOR_SYMBOL = "@@iterator";
        function getIteratorFn(maybeIterable) {
          if (maybeIterable === null || typeof maybeIterable !== "object") {
            return null;
          }
          var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
          if (typeof maybeIterator === "function") {
            return maybeIterator;
          }
          return null;
        }
        var ReactCurrentDispatcher = {
          /**
           * @internal
           * @type {ReactComponent}
           */
          current: null
        };
        var ReactCurrentBatchConfig = {
          transition: null
        };
        var ReactCurrentActQueue = {
          current: null,
          // Used to reproduce behavior of `batchedUpdates` in legacy mode.
          isBatchingLegacy: false,
          didScheduleLegacyUpdate: false
        };
        var ReactCurrentOwner = {
          /**
           * @internal
           * @type {ReactComponent}
           */
          current: null
        };
        var ReactDebugCurrentFrame = {};
        var currentExtraStackFrame = null;
        function setExtraStackFrame(stack) {
          {
            currentExtraStackFrame = stack;
          }
        }
        {
          ReactDebugCurrentFrame.setExtraStackFrame = function(stack) {
            {
              currentExtraStackFrame = stack;
            }
          };
          ReactDebugCurrentFrame.getCurrentStack = null;
          ReactDebugCurrentFrame.getStackAddendum = function() {
            var stack = "";
            if (currentExtraStackFrame) {
              stack += currentExtraStackFrame;
            }
            var impl = ReactDebugCurrentFrame.getCurrentStack;
            if (impl) {
              stack += impl() || "";
            }
            return stack;
          };
        }
        var enableScopeAPI = false;
        var enableCacheElement = false;
        var enableTransitionTracing = false;
        var enableLegacyHidden = false;
        var enableDebugTracing = false;
        var ReactSharedInternals = {
          ReactCurrentDispatcher,
          ReactCurrentBatchConfig,
          ReactCurrentOwner
        };
        {
          ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
          ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue;
        }
        function warn(format) {
          {
            {
              for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
                args[_key - 1] = arguments[_key];
              }
              printWarning("warn", format, args);
            }
          }
        }
        function error(format) {
          {
            {
              for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
                args[_key2 - 1] = arguments[_key2];
              }
              printWarning("error", format, args);
            }
          }
        }
        function printWarning(level, format, args) {
          {
            var ReactDebugCurrentFrame2 = ReactSharedInternals.ReactDebugCurrentFrame;
            var stack = ReactDebugCurrentFrame2.getStackAddendum();
            if (stack !== "") {
              format += "%s";
              args = args.concat([stack]);
            }
            var argsWithFormat = args.map(function(item) {
              return String(item);
            });
            argsWithFormat.unshift("Warning: " + format);
            Function.prototype.apply.call(console[level], console, argsWithFormat);
          }
        }
        var didWarnStateUpdateForUnmountedComponent = {};
        function warnNoop(publicInstance, callerName) {
          {
            var _constructor = publicInstance.constructor;
            var componentName = _constructor && (_constructor.displayName || _constructor.name) || "ReactClass";
            var warningKey = componentName + "." + callerName;
            if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
              return;
            }
            error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.", callerName, componentName);
            didWarnStateUpdateForUnmountedComponent[warningKey] = true;
          }
        }
        var ReactNoopUpdateQueue = {
          /**
           * Checks whether or not this composite component is mounted.
           * @param {ReactClass} publicInstance The instance we want to test.
           * @return {boolean} True if mounted, false otherwise.
           * @protected
           * @final
           */
          isMounted: function(publicInstance) {
            return false;
          },
          /**
           * Forces an update. This should only be invoked when it is known with
           * certainty that we are **not** in a DOM transaction.
           *
           * You may want to call this when you know that some deeper aspect of the
           * component's state has changed but `setState` was not called.
           *
           * This will not invoke `shouldComponentUpdate`, but it will invoke
           * `componentWillUpdate` and `componentDidUpdate`.
           *
           * @param {ReactClass} publicInstance The instance that should rerender.
           * @param {?function} callback Called after component is updated.
           * @param {?string} callerName name of the calling function in the public API.
           * @internal
           */
          enqueueForceUpdate: function(publicInstance, callback, callerName) {
            warnNoop(publicInstance, "forceUpdate");
          },
          /**
           * Replaces all of the state. Always use this or `setState` to mutate state.
           * You should treat `this.state` as immutable.
           *
           * There is no guarantee that `this.state` will be immediately updated, so
           * accessing `this.state` after calling this method may return the old value.
           *
           * @param {ReactClass} publicInstance The instance that should rerender.
           * @param {object} completeState Next state.
           * @param {?function} callback Called after component is updated.
           * @param {?string} callerName name of the calling function in the public API.
           * @internal
           */
          enqueueReplaceState: function(publicInstance, completeState, callback, callerName) {
            warnNoop(publicInstance, "replaceState");
          },
          /**
           * Sets a subset of the state. This only exists because _pendingState is
           * internal. This provides a merging strategy that is not available to deep
           * properties which is confusing. TODO: Expose pendingState or don't use it
           * during the merge.
           *
           * @param {ReactClass} publicInstance The instance that should rerender.
           * @param {object} partialState Next partial state to be merged with state.
           * @param {?function} callback Called after component is updated.
           * @param {?string} Name of the calling function in the public API.
           * @internal
           */
          enqueueSetState: function(publicInstance, partialState, callback, callerName) {
            warnNoop(publicInstance, "setState");
          }
        };
        var assign = Object.assign;
        var emptyObject = {};
        {
          Object.freeze(emptyObject);
        }
        function Component(props, context, updater) {
          this.props = props;
          this.context = context;
          this.refs = emptyObject;
          this.updater = updater || ReactNoopUpdateQueue;
        }
        Component.prototype.isReactComponent = {};
        Component.prototype.setState = function(partialState, callback) {
          if (typeof partialState !== "object" && typeof partialState !== "function" && partialState != null) {
            throw new Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
          }
          this.updater.enqueueSetState(this, partialState, callback, "setState");
        };
        Component.prototype.forceUpdate = function(callback) {
          this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
        };
        {
          var deprecatedAPIs = {
            isMounted: ["isMounted", "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],
            replaceState: ["replaceState", "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]
          };
          var defineDeprecationWarning = function(methodName, info) {
            Object.defineProperty(Component.prototype, methodName, {
              get: function() {
                warn("%s(...) is deprecated in plain JavaScript React classes. %s", info[0], info[1]);
                return void 0;
              }
            });
          };
          for (var fnName in deprecatedAPIs) {
            if (deprecatedAPIs.hasOwnProperty(fnName)) {
              defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
            }
          }
        }
        function ComponentDummy() {
        }
        ComponentDummy.prototype = Component.prototype;
        function PureComponent(props, context, updater) {
          this.props = props;
          this.context = context;
          this.refs = emptyObject;
          this.updater = updater || ReactNoopUpdateQueue;
        }
        var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
        pureComponentPrototype.constructor = PureComponent;
        assign(pureComponentPrototype, Component.prototype);
        pureComponentPrototype.isPureReactComponent = true;
        function createRef() {
          var refObject = {
            current: null
          };
          {
            Object.seal(refObject);
          }
          return refObject;
        }
        var isArrayImpl = Array.isArray;
        function isArray(a2) {
          return isArrayImpl(a2);
        }
        function typeName(value) {
          {
            var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag;
            var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
            return type;
          }
        }
        function willCoercionThrow(value) {
          {
            try {
              testStringCoercion(value);
              return false;
            } catch (e) {
              return true;
            }
          }
        }
        function testStringCoercion(value) {
          return "" + value;
        }
        function checkKeyStringCoercion(value) {
          {
            if (willCoercionThrow(value)) {
              error("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", typeName(value));
              return testStringCoercion(value);
            }
          }
        }
        function getWrappedName(outerType, innerType, wrapperName) {
          var displayName = outerType.displayName;
          if (displayName) {
            return displayName;
          }
          var functionName = innerType.displayName || innerType.name || "";
          return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName;
        }
        function getContextName(type) {
          return type.displayName || "Context";
        }
        function getComponentNameFromType(type) {
          if (type == null) {
            return null;
          }
          {
            if (typeof type.tag === "number") {
              error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.");
            }
          }
          if (typeof type === "function") {
            return type.displayName || type.name || null;
          }
          if (typeof type === "string") {
            return type;
          }
          switch (type) {
            case REACT_FRAGMENT_TYPE:
              return "Fragment";
            case REACT_PORTAL_TYPE:
              return "Portal";
            case REACT_PROFILER_TYPE:
              return "Profiler";
            case REACT_STRICT_MODE_TYPE:
              return "StrictMode";
            case REACT_SUSPENSE_TYPE:
              return "Suspense";
            case REACT_SUSPENSE_LIST_TYPE:
              return "SuspenseList";
          }
          if (typeof type === "object") {
            switch (type.$$typeof) {
              case REACT_CONTEXT_TYPE:
                var context = type;
                return getContextName(context) + ".Consumer";
              case REACT_PROVIDER_TYPE:
                var provider = type;
                return getContextName(provider._context) + ".Provider";
              case REACT_FORWARD_REF_TYPE:
                return getWrappedName(type, type.render, "ForwardRef");
              case REACT_MEMO_TYPE:
                var outerName = type.displayName || null;
                if (outerName !== null) {
                  return outerName;
                }
                return getComponentNameFromType(type.type) || "Memo";
              case REACT_LAZY_TYPE: {
                var lazyComponent = type;
                var payload = lazyComponent._payload;
                var init2 = lazyComponent._init;
                try {
                  return getComponentNameFromType(init2(payload));
                } catch (x2) {
                  return null;
                }
              }
            }
          }
          return null;
        }
        var hasOwnProperty = Object.prototype.hasOwnProperty;
        var RESERVED_PROPS = {
          key: true,
          ref: true,
          __self: true,
          __source: true
        };
        var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
        {
          didWarnAboutStringRefs = {};
        }
        function hasValidRef(config) {
          {
            if (hasOwnProperty.call(config, "ref")) {
              var getter = Object.getOwnPropertyDescriptor(config, "ref").get;
              if (getter && getter.isReactWarning) {
                return false;
              }
            }
          }
          return config.ref !== void 0;
        }
        function hasValidKey(config) {
          {
            if (hasOwnProperty.call(config, "key")) {
              var getter = Object.getOwnPropertyDescriptor(config, "key").get;
              if (getter && getter.isReactWarning) {
                return false;
              }
            }
          }
          return config.key !== void 0;
        }
        function defineKeyPropWarningGetter(props, displayName) {
          var warnAboutAccessingKey = function() {
            {
              if (!specialPropKeyWarningShown) {
                specialPropKeyWarningShown = true;
                error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName);
              }
            }
          };
          warnAboutAccessingKey.isReactWarning = true;
          Object.defineProperty(props, "key", {
            get: warnAboutAccessingKey,
            configurable: true
          });
        }
        function defineRefPropWarningGetter(props, displayName) {
          var warnAboutAccessingRef = function() {
            {
              if (!specialPropRefWarningShown) {
                specialPropRefWarningShown = true;
                error("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName);
              }
            }
          };
          warnAboutAccessingRef.isReactWarning = true;
          Object.defineProperty(props, "ref", {
            get: warnAboutAccessingRef,
            configurable: true
          });
        }
        function warnIfStringRefCannotBeAutoConverted(config) {
          {
            if (typeof config.ref === "string" && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
              var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
              if (!didWarnAboutStringRefs[componentName]) {
                error('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', componentName, config.ref);
                didWarnAboutStringRefs[componentName] = true;
              }
            }
          }
        }
        var ReactElement = function(type, key, ref, self2, source, owner, props) {
          var element = {
            // This tag allows us to uniquely identify this as a React Element
            $$typeof: REACT_ELEMENT_TYPE,
            // Built-in properties that belong on the element
            type,
            key,
            ref,
            props,
            // Record the component responsible for creating this element.
            _owner: owner
          };
          {
            element._store = {};
            Object.defineProperty(element._store, "validated", {
              configurable: false,
              enumerable: false,
              writable: true,
              value: false
            });
            Object.defineProperty(element, "_self", {
              configurable: false,
              enumerable: false,
              writable: false,
              value: self2
            });
            Object.defineProperty(element, "_source", {
              configurable: false,
              enumerable: false,
              writable: false,
              value: source
            });
            if (Object.freeze) {
              Object.freeze(element.props);
              Object.freeze(element);
            }
          }
          return element;
        };
        function createElement3(type, config, children) {
          var propName;
          var props = {};
          var key = null;
          var ref = null;
          var self2 = null;
          var source = null;
          if (config != null) {
            if (hasValidRef(config)) {
              ref = config.ref;
              {
                warnIfStringRefCannotBeAutoConverted(config);
              }
            }
            if (hasValidKey(config)) {
              {
                checkKeyStringCoercion(config.key);
              }
              key = "" + config.key;
            }
            self2 = config.__self === void 0 ? null : config.__self;
            source = config.__source === void 0 ? null : config.__source;
            for (propName in config) {
              if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
                props[propName] = config[propName];
              }
            }
          }
          var childrenLength = arguments.length - 2;
          if (childrenLength === 1) {
            props.children = children;
          } else if (childrenLength > 1) {
            var childArray = Array(childrenLength);
            for (var i2 = 0; i2 < childrenLength; i2++) {
              childArray[i2] = arguments[i2 + 2];
            }
            {
              if (Object.freeze) {
                Object.freeze(childArray);
              }
            }
            props.children = childArray;
          }
          if (type && type.defaultProps) {
            var defaultProps = type.defaultProps;
            for (propName in defaultProps) {
              if (props[propName] === void 0) {
                props[propName] = defaultProps[propName];
              }
            }
          }
          {
            if (key || ref) {
              var displayName = typeof type === "function" ? type.displayName || type.name || "Unknown" : type;
              if (key) {
                defineKeyPropWarningGetter(props, displayName);
              }
              if (ref) {
                defineRefPropWarningGetter(props, displayName);
              }
            }
          }
          return ReactElement(type, key, ref, self2, source, ReactCurrentOwner.current, props);
        }
        function cloneAndReplaceKey(oldElement, newKey) {
          var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
          return newElement;
        }
        function cloneElement(element, config, children) {
          if (element === null || element === void 0) {
            throw new Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + ".");
          }
          var propName;
          var props = assign({}, element.props);
          var key = element.key;
          var ref = element.ref;
          var self2 = element._self;
          var source = element._source;
          var owner = element._owner;
          if (config != null) {
            if (hasValidRef(config)) {
              ref = config.ref;
              owner = ReactCurrentOwner.current;
            }
            if (hasValidKey(config)) {
              {
                checkKeyStringCoercion(config.key);
              }
              key = "" + config.key;
            }
            var defaultProps;
            if (element.type && element.type.defaultProps) {
              defaultProps = element.type.defaultProps;
            }
            for (propName in config) {
              if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
                if (config[propName] === void 0 && defaultProps !== void 0) {
                  props[propName] = defaultProps[propName];
                } else {
                  props[propName] = config[propName];
                }
              }
            }
          }
          var childrenLength = arguments.length - 2;
          if (childrenLength === 1) {
            props.children = children;
          } else if (childrenLength > 1) {
            var childArray = Array(childrenLength);
            for (var i2 = 0; i2 < childrenLength; i2++) {
              childArray[i2] = arguments[i2 + 2];
            }
            props.children = childArray;
          }
          return ReactElement(element.type, key, ref, self2, source, owner, props);
        }
        function isValidElement(object) {
          return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
        }
        var SEPARATOR = ".";
        var SUBSEPARATOR = ":";
        function escape2(key) {
          var escapeRegex = /[=:]/g;
          var escaperLookup = {
            "=": "=0",
            ":": "=2"
          };
          var escapedString = key.replace(escapeRegex, function(match) {
            return escaperLookup[match];
          });
          return "$" + escapedString;
        }
        var didWarnAboutMaps = false;
        var userProvidedKeyEscapeRegex = /\/+/g;
        function escapeUserProvidedKey(text) {
          return text.replace(userProvidedKeyEscapeRegex, "$&/");
        }
        function getElementKey(element, index) {
          if (typeof element === "object" && element !== null && element.key != null) {
            {
              checkKeyStringCoercion(element.key);
            }
            return escape2("" + element.key);
          }
          return index.toString(36);
        }
        function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
          var type = typeof children;
          if (type === "undefined" || type === "boolean") {
            children = null;
          }
          var invokeCallback = false;
          if (children === null) {
            invokeCallback = true;
          } else {
            switch (type) {
              case "string":
              case "number":
                invokeCallback = true;
                break;
              case "object":
                switch (children.$$typeof) {
                  case REACT_ELEMENT_TYPE:
                  case REACT_PORTAL_TYPE:
                    invokeCallback = true;
                }
            }
          }
          if (invokeCallback) {
            var _child = children;
            var mappedChild = callback(_child);
            var childKey = nameSoFar === "" ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
            if (isArray(mappedChild)) {
              var escapedChildKey = "";
              if (childKey != null) {
                escapedChildKey = escapeUserProvidedKey(childKey) + "/";
              }
              mapIntoArray(mappedChild, array, escapedChildKey, "", function(c2) {
                return c2;
              });
            } else if (mappedChild != null) {
              if (isValidElement(mappedChild)) {
                {
                  if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) {
                    checkKeyStringCoercion(mappedChild.key);
                  }
                }
                mappedChild = cloneAndReplaceKey(
                  mappedChild,
                  // Keep both the (mapped) and old keys if they differ, just as
                  // traverseAllChildren used to do for objects as children
                  escapedPrefix + // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
                  (mappedChild.key && (!_child || _child.key !== mappedChild.key) ? (
                    // $FlowFixMe Flow incorrectly thinks existing element's key can be a number
                    // eslint-disable-next-line react-internal/safe-string-coercion
                    escapeUserProvidedKey("" + mappedChild.key) + "/"
                  ) : "") + childKey
                );
              }
              array.push(mappedChild);
            }
            return 1;
          }
          var child;
          var nextName;
          var subtreeCount = 0;
          var nextNamePrefix = nameSoFar === "" ? SEPARATOR : nameSoFar + SUBSEPARATOR;
          if (isArray(children)) {
            for (var i2 = 0; i2 < children.length; i2++) {
              child = children[i2];
              nextName = nextNamePrefix + getElementKey(child, i2);
              subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
            }
          } else {
            var iteratorFn = getIteratorFn(children);
            if (typeof iteratorFn === "function") {
              var iterableChildren = children;
              {
                if (iteratorFn === iterableChildren.entries) {
                  if (!didWarnAboutMaps) {
                    warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead.");
                  }
                  didWarnAboutMaps = true;
                }
              }
              var iterator = iteratorFn.call(iterableChildren);
              var step;
              var ii = 0;
              while (!(step = iterator.next()).done) {
                child = step.value;
                nextName = nextNamePrefix + getElementKey(child, ii++);
                subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
              }
            } else if (type === "object") {
              var childrenString = String(children);
              throw new Error("Objects are not valid as a React child (found: " + (childrenString === "[object Object]" ? "object with keys {" + Object.keys(children).join(", ") + "}" : childrenString) + "). If you meant to render a collection of children, use an array instead.");
            }
          }
          return subtreeCount;
        }
        function mapChildren(children, func, context) {
          if (children == null) {
            return children;
          }
          var result = [];
          var count = 0;
          mapIntoArray(children, result, "", "", function(child) {
            return func.call(context, child, count++);
          });
          return result;
        }
        function countChildren(children) {
          var n2 = 0;
          mapChildren(children, function() {
            n2++;
          });
          return n2;
        }
        function forEachChildren(children, forEachFunc, forEachContext) {
          mapChildren(children, function() {
            forEachFunc.apply(this, arguments);
          }, forEachContext);
        }
        function toArray(children) {
          return mapChildren(children, function(child) {
            return child;
          }) || [];
        }
        function onlyChild(children) {
          if (!isValidElement(children)) {
            throw new Error("React.Children.only expected to receive a single React element child.");
          }
          return children;
        }
        function createContext2(defaultValue) {
          var context = {
            $$typeof: REACT_CONTEXT_TYPE,
            // As a workaround to support multiple concurrent renderers, we categorize
            // some renderers as primary and others as secondary. We only expect
            // there to be two concurrent renderers at most: React Native (primary) and
            // Fabric (secondary); React DOM (primary) and React ART (secondary).
            // Secondary renderers store their context values on separate fields.
            _currentValue: defaultValue,
            _currentValue2: defaultValue,
            // Used to track how many concurrent renderers this context currently
            // supports within in a single renderer. Such as parallel server rendering.
            _threadCount: 0,
            // These are circular
            Provider: null,
            Consumer: null,
            // Add these to use same hidden class in VM as ServerContext
            _defaultValue: null,
            _globalName: null
          };
          context.Provider = {
            $$typeof: REACT_PROVIDER_TYPE,
            _context: context
          };
          var hasWarnedAboutUsingNestedContextConsumers = false;
          var hasWarnedAboutUsingConsumerProvider = false;
          var hasWarnedAboutDisplayNameOnConsumer = false;
          {
            var Consumer = {
              $$typeof: REACT_CONTEXT_TYPE,
              _context: context
            };
            Object.defineProperties(Consumer, {
              Provider: {
                get: function() {
                  if (!hasWarnedAboutUsingConsumerProvider) {
                    hasWarnedAboutUsingConsumerProvider = true;
                    error("Rendering <Context.Consumer.Provider> is not supported and will be removed in a future major release. Did you mean to render <Context.Provider> instead?");
                  }
                  return context.Provider;
                },
                set: function(_Provider) {
                  context.Provider = _Provider;
                }
              },
              _currentValue: {
                get: function() {
                  return context._currentValue;
                },
                set: function(_currentValue) {
                  context._currentValue = _currentValue;
                }
              },
              _currentValue2: {
                get: function() {
                  return context._currentValue2;
                },
                set: function(_currentValue2) {
                  context._currentValue2 = _currentValue2;
                }
              },
              _threadCount: {
                get: function() {
                  return context._threadCount;
                },
                set: function(_threadCount) {
                  context._threadCount = _threadCount;
                }
              },
              Consumer: {
                get: function() {
                  if (!hasWarnedAboutUsingNestedContextConsumers) {
                    hasWarnedAboutUsingNestedContextConsumers = true;
                    error("Rendering <Context.Consumer.Consumer> is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?");
                  }
                  return context.Consumer;
                }
              },
              displayName: {
                get: function() {
                  return context.displayName;
                },
                set: function(displayName) {
                  if (!hasWarnedAboutDisplayNameOnConsumer) {
                    warn("Setting `displayName` on Context.Consumer has no effect. You should set it directly on the context with Context.displayName = '%s'.", displayName);
                    hasWarnedAboutDisplayNameOnConsumer = true;
                  }
                }
              }
            });
            context.Consumer = Consumer;
          }
          {
            context._currentRenderer = null;
            context._currentRenderer2 = null;
          }
          return context;
        }
        var Uninitialized = -1;
        var Pending = 0;
        var Resolved = 1;
        var Rejected = 2;
        function lazyInitializer(payload) {
          if (payload._status === Uninitialized) {
            var ctor = payload._result;
            var thenable = ctor();
            thenable.then(function(moduleObject2) {
              if (payload._status === Pending || payload._status === Uninitialized) {
                var resolved = payload;
                resolved._status = Resolved;
                resolved._result = moduleObject2;
              }
            }, function(error2) {
              if (payload._status === Pending || payload._status === Uninitialized) {
                var rejected = payload;
                rejected._status = Rejected;
                rejected._result = error2;
              }
            });
            if (payload._status === Uninitialized) {
              var pending = payload;
              pending._status = Pending;
              pending._result = thenable;
            }
          }
          if (payload._status === Resolved) {
            var moduleObject = payload._result;
            {
              if (moduleObject === void 0) {
                error("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n  const MyComponent = lazy(() => import('./MyComponent'))\n\nDid you accidentally put curly braces around the import?", moduleObject);
              }
            }
            {
              if (!("default" in moduleObject)) {
                error("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n  const MyComponent = lazy(() => import('./MyComponent'))", moduleObject);
              }
            }
            return moduleObject.default;
          } else {
            throw payload._result;
          }
        }
        function lazy(ctor) {
          var payload = {
            // We use these fields to store the result.
            _status: Uninitialized,
            _result: ctor
          };
          var lazyType = {
            $$typeof: REACT_LAZY_TYPE,
            _payload: payload,
            _init: lazyInitializer
          };
          {
            var defaultProps;
            var propTypes;
            Object.defineProperties(lazyType, {
              defaultProps: {
                configurable: true,
                get: function() {
                  return defaultProps;
                },
                set: function(newDefaultProps) {
                  error("React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it.");
                  defaultProps = newDefaultProps;
                  Object.defineProperty(lazyType, "defaultProps", {
                    enumerable: true
                  });
                }
              },
              propTypes: {
                configurable: true,
                get: function() {
                  return propTypes;
                },
                set: function(newPropTypes) {
                  error("React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it.");
                  propTypes = newPropTypes;
                  Object.defineProperty(lazyType, "propTypes", {
                    enumerable: true
                  });
                }
              }
            });
          }
          return lazyType;
        }
        function forwardRef2(render2) {
          {
            if (render2 != null && render2.$$typeof === REACT_MEMO_TYPE) {
              error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...)).");
            } else if (typeof render2 !== "function") {
              error("forwardRef requires a render function but was given %s.", render2 === null ? "null" : typeof render2);
            } else {
              if (render2.length !== 0 && render2.length !== 2) {
                error("forwardRef render functions accept exactly two parameters: props and ref. %s", render2.length === 1 ? "Did you forget to use the ref parameter?" : "Any additional parameter will be undefined.");
              }
            }
            if (render2 != null) {
              if (render2.defaultProps != null || render2.propTypes != null) {
                error("forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?");
              }
            }
          }
          var elementType = {
            $$typeof: REACT_FORWARD_REF_TYPE,
            render: render2
          };
          {
            var ownName;
            Object.defineProperty(elementType, "displayName", {
              enumerable: false,
              configurable: true,
              get: function() {
                return ownName;
              },
              set: function(name) {
                ownName = name;
                if (!render2.name && !render2.displayName) {
                  render2.displayName = name;
                }
              }
            });
          }
          return elementType;
        }
        var REACT_MODULE_REFERENCE;
        {
          REACT_MODULE_REFERENCE = Symbol.for("react.module.reference");
        }
        function isValidElementType2(type) {
          if (typeof type === "string" || typeof type === "function") {
            return true;
          }
          if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) {
            return true;
          }
          if (typeof type === "object" && type !== null) {
            if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
            // types supported by any Flight configuration anywhere since
            // we don't know which Flight build this will end up being used
            // with.
            type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) {
              return true;
            }
          }
          return false;
        }
        function memo2(type, compare) {
          {
            if (!isValidElementType2(type)) {
              error("memo: The first argument must be a component. Instead received: %s", type === null ? "null" : typeof type);
            }
          }
          var elementType = {
            $$typeof: REACT_MEMO_TYPE,
            type,
            compare: compare === void 0 ? null : compare
          };
          {
            var ownName;
            Object.defineProperty(elementType, "displayName", {
              enumerable: false,
              configurable: true,
              get: function() {
                return ownName;
              },
              set: function(name) {
                ownName = name;
                if (!type.name && !type.displayName) {
                  type.displayName = name;
                }
              }
            });
          }
          return elementType;
        }
        function resolveDispatcher() {
          var dispatcher = ReactCurrentDispatcher.current;
          {
            if (dispatcher === null) {
              error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.");
            }
          }
          return dispatcher;
        }
        function useContext3(Context) {
          var dispatcher = resolveDispatcher();
          {
            if (Context._context !== void 0) {
              var realContext = Context._context;
              if (realContext.Consumer === Context) {
                error("Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?");
              } else if (realContext.Provider === Context) {
                error("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?");
              }
            }
          }
          return dispatcher.useContext(Context);
        }
        function useState(initialState2) {
          var dispatcher = resolveDispatcher();
          return dispatcher.useState(initialState2);
        }
        function useReducer(reducer, initialArg, init2) {
          var dispatcher = resolveDispatcher();
          return dispatcher.useReducer(reducer, initialArg, init2);
        }
        function useRef4(initialValue) {
          var dispatcher = resolveDispatcher();
          return dispatcher.useRef(initialValue);
        }
        function useEffect2(create, deps) {
          var dispatcher = resolveDispatcher();
          return dispatcher.useEffect(create, deps);
        }
        function useInsertionEffect(create, deps) {
          var dispatcher = resolveDispatcher();
          return dispatcher.useInsertionEffect(create, deps);
        }
        function useLayoutEffect2(create, deps) {
          var dispatcher = resolveDispatcher();
          return dispatcher.useLayoutEffect(create, deps);
        }
        function useCallback2(callback, deps) {
          var dispatcher = resolveDispatcher();
          return dispatcher.useCallback(callback, deps);
        }
        function useMemo3(create, deps) {
          var dispatcher = resolveDispatcher();
          return dispatcher.useMemo(create, deps);
        }
        function useImperativeHandle(ref, create, deps) {
          var dispatcher = resolveDispatcher();
          return dispatcher.useImperativeHandle(ref, create, deps);
        }
        function useDebugValue2(value, formatterFn) {
          {
            var dispatcher = resolveDispatcher();
            return dispatcher.useDebugValue(value, formatterFn);
          }
        }
        function useTransition() {
          var dispatcher = resolveDispatcher();
          return dispatcher.useTransition();
        }
        function useDeferredValue(value) {
          var dispatcher = resolveDispatcher();
          return dispatcher.useDeferredValue(value);
        }
        function useId() {
          var dispatcher = resolveDispatcher();
          return dispatcher.useId();
        }
        function useSyncExternalStore3(subscribe2, getSnapshot, getServerSnapshot) {
          var dispatcher = resolveDispatcher();
          return dispatcher.useSyncExternalStore(subscribe2, getSnapshot, getServerSnapshot);
        }
        var disabledDepth = 0;
        var prevLog;
        var prevInfo;
        var prevWarn;
        var prevError;
        var prevGroup;
        var prevGroupCollapsed;
        var prevGroupEnd;
        function disabledLog() {
        }
        disabledLog.__reactDisabledLog = true;
        function disableLogs() {
          {
            if (disabledDepth === 0) {
              prevLog = console.log;
              prevInfo = console.info;
              prevWarn = console.warn;
              prevError = console.error;
              prevGroup = console.group;
              prevGroupCollapsed = console.groupCollapsed;
              prevGroupEnd = console.groupEnd;
              var props = {
                configurable: true,
                enumerable: true,
                value: disabledLog,
                writable: true
              };
              Object.defineProperties(console, {
                info: props,
                log: props,
                warn: props,
                error: props,
                group: props,
                groupCollapsed: props,
                groupEnd: props
              });
            }
            disabledDepth++;
          }
        }
        function reenableLogs() {
          {
            disabledDepth--;
            if (disabledDepth === 0) {
              var props = {
                configurable: true,
                enumerable: true,
                writable: true
              };
              Object.defineProperties(console, {
                log: assign({}, props, {
                  value: prevLog
                }),
                info: assign({}, props, {
                  value: prevInfo
                }),
                warn: assign({}, props, {
                  value: prevWarn
                }),
                error: assign({}, props, {
                  value: prevError
                }),
                group: assign({}, props, {
                  value: prevGroup
                }),
                groupCollapsed: assign({}, props, {
                  value: prevGroupCollapsed
                }),
                groupEnd: assign({}, props, {
                  value: prevGroupEnd
                })
              });
            }
            if (disabledDepth < 0) {
              error("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
            }
          }
        }
        var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
        var prefix2;
        function describeBuiltInComponentFrame(name, source, ownerFn) {
          {
            if (prefix2 === void 0) {
              try {
                throw Error();
              } catch (x2) {
                var match = x2.stack.trim().match(/\n( *(at )?)/);
                prefix2 = match && match[1] || "";
              }
            }
            return "\n" + prefix2 + name;
          }
        }
        var reentry = false;
        var componentFrameCache;
        {
          var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map;
          componentFrameCache = new PossiblyWeakMap();
        }
        function describeNativeComponentFrame(fn2, construct) {
          if (!fn2 || reentry) {
            return "";
          }
          {
            var frame = componentFrameCache.get(fn2);
            if (frame !== void 0) {
              return frame;
            }
          }
          var control;
          reentry = true;
          var previousPrepareStackTrace = Error.prepareStackTrace;
          Error.prepareStackTrace = void 0;
          var previousDispatcher;
          {
            previousDispatcher = ReactCurrentDispatcher$1.current;
            ReactCurrentDispatcher$1.current = null;
            disableLogs();
          }
          try {
            if (construct) {
              var Fake = function() {
                throw Error();
              };
              Object.defineProperty(Fake.prototype, "props", {
                set: function() {
                  throw Error();
                }
              });
              if (typeof Reflect === "object" && Reflect.construct) {
                try {
                  Reflect.construct(Fake, []);
                } catch (x2) {
                  control = x2;
                }
                Reflect.construct(fn2, [], Fake);
              } else {
                try {
                  Fake.call();
                } catch (x2) {
                  control = x2;
                }
                fn2.call(Fake.prototype);
              }
            } else {
              try {
                throw Error();
              } catch (x2) {
                control = x2;
              }
              fn2();
            }
          } catch (sample) {
            if (sample && control && typeof sample.stack === "string") {
              var sampleLines = sample.stack.split("\n");
              var controlLines = control.stack.split("\n");
              var s2 = sampleLines.length - 1;
              var c2 = controlLines.length - 1;
              while (s2 >= 1 && c2 >= 0 && sampleLines[s2] !== controlLines[c2]) {
                c2--;
              }
              for (; s2 >= 1 && c2 >= 0; s2--, c2--) {
                if (sampleLines[s2] !== controlLines[c2]) {
                  if (s2 !== 1 || c2 !== 1) {
                    do {
                      s2--;
                      c2--;
                      if (c2 < 0 || sampleLines[s2] !== controlLines[c2]) {
                        var _frame = "\n" + sampleLines[s2].replace(" at new ", " at ");
                        if (fn2.displayName && _frame.includes("<anonymous>")) {
                          _frame = _frame.replace("<anonymous>", fn2.displayName);
                        }
                        {
                          if (typeof fn2 === "function") {
                            componentFrameCache.set(fn2, _frame);
                          }
                        }
                        return _frame;
                      }
                    } while (s2 >= 1 && c2 >= 0);
                  }
                  break;
                }
              }
            }
          } finally {
            reentry = false;
            {
              ReactCurrentDispatcher$1.current = previousDispatcher;
              reenableLogs();
            }
            Error.prepareStackTrace = previousPrepareStackTrace;
          }
          var name = fn2 ? fn2.displayName || fn2.name : "";
          var syntheticFrame = name ? describeBuiltInComponentFrame(name) : "";
          {
            if (typeof fn2 === "function") {
              componentFrameCache.set(fn2, syntheticFrame);
            }
          }
          return syntheticFrame;
        }
        function describeFunctionComponentFrame(fn2, source, ownerFn) {
          {
            return describeNativeComponentFrame(fn2, false);
          }
        }
        function shouldConstruct(Component2) {
          var prototype = Component2.prototype;
          return !!(prototype && prototype.isReactComponent);
        }
        function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
          if (type == null) {
            return "";
          }
          if (typeof type === "function") {
            {
              return describeNativeComponentFrame(type, shouldConstruct(type));
            }
          }
          if (typeof type === "string") {
            return describeBuiltInComponentFrame(type);
          }
          switch (type) {
            case REACT_SUSPENSE_TYPE:
              return describeBuiltInComponentFrame("Suspense");
            case REACT_SUSPENSE_LIST_TYPE:
              return describeBuiltInComponentFrame("SuspenseList");
          }
          if (typeof type === "object") {
            switch (type.$$typeof) {
              case REACT_FORWARD_REF_TYPE:
                return describeFunctionComponentFrame(type.render);
              case REACT_MEMO_TYPE:
                return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
              case REACT_LAZY_TYPE: {
                var lazyComponent = type;
                var payload = lazyComponent._payload;
                var init2 = lazyComponent._init;
                try {
                  return describeUnknownElementTypeFrameInDEV(init2(payload), source, ownerFn);
                } catch (x2) {
                }
              }
            }
          }
          return "";
        }
        var loggedTypeFailures = {};
        var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
        function setCurrentlyValidatingElement(element) {
          {
            if (element) {
              var owner = element._owner;
              var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
              ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
            } else {
              ReactDebugCurrentFrame$1.setExtraStackFrame(null);
            }
          }
        }
        function checkPropTypes(typeSpecs, values, location, componentName, element) {
          {
            var has = Function.call.bind(hasOwnProperty);
            for (var typeSpecName in typeSpecs) {
              if (has(typeSpecs, typeSpecName)) {
                var error$1 = void 0;
                try {
                  if (typeof typeSpecs[typeSpecName] !== "function") {
                    var err = Error((componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
                    err.name = "Invariant Violation";
                    throw err;
                  }
                  error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
                } catch (ex) {
                  error$1 = ex;
                }
                if (error$1 && !(error$1 instanceof Error)) {
                  setCurrentlyValidatingElement(element);
                  error("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", componentName || "React class", location, typeSpecName, typeof error$1);
                  setCurrentlyValidatingElement(null);
                }
                if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
                  loggedTypeFailures[error$1.message] = true;
                  setCurrentlyValidatingElement(element);
                  error("Failed %s type: %s", location, error$1.message);
                  setCurrentlyValidatingElement(null);
                }
              }
            }
          }
        }
        function setCurrentlyValidatingElement$1(element) {
          {
            if (element) {
              var owner = element._owner;
              var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
              setExtraStackFrame(stack);
            } else {
              setExtraStackFrame(null);
            }
          }
        }
        var propTypesMisspellWarningShown;
        {
          propTypesMisspellWarningShown = false;
        }
        function getDeclarationErrorAddendum() {
          if (ReactCurrentOwner.current) {
            var name = getComponentNameFromType(ReactCurrentOwner.current.type);
            if (name) {
              return "\n\nCheck the render method of `" + name + "`.";
            }
          }
          return "";
        }
        function getSourceInfoErrorAddendum(source) {
          if (source !== void 0) {
            var fileName = source.fileName.replace(/^.*[\\\/]/, "");
            var lineNumber = source.lineNumber;
            return "\n\nCheck your code at " + fileName + ":" + lineNumber + ".";
          }
          return "";
        }
        function getSourceInfoErrorAddendumForProps(elementProps) {
          if (elementProps !== null && elementProps !== void 0) {
            return getSourceInfoErrorAddendum(elementProps.__source);
          }
          return "";
        }
        var ownerHasKeyUseWarning = {};
        function getCurrentComponentErrorInfo(parentType) {
          var info = getDeclarationErrorAddendum();
          if (!info) {
            var parentName = typeof parentType === "string" ? parentType : parentType.displayName || parentType.name;
            if (parentName) {
              info = "\n\nCheck the top-level render call using <" + parentName + ">.";
            }
          }
          return info;
        }
        function validateExplicitKey(element, parentType) {
          if (!element._store || element._store.validated || element.key != null) {
            return;
          }
          element._store.validated = true;
          var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
          if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
            return;
          }
          ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
          var childOwner = "";
          if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
            childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
          }
          {
            setCurrentlyValidatingElement$1(element);
            error('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
            setCurrentlyValidatingElement$1(null);
          }
        }
        function validateChildKeys(node, parentType) {
          if (typeof node !== "object") {
            return;
          }
          if (isArray(node)) {
            for (var i2 = 0; i2 < node.length; i2++) {
              var child = node[i2];
              if (isValidElement(child)) {
                validateExplicitKey(child, parentType);
              }
            }
          } else if (isValidElement(node)) {
            if (node._store) {
              node._store.validated = true;
            }
          } else if (node) {
            var iteratorFn = getIteratorFn(node);
            if (typeof iteratorFn === "function") {
              if (iteratorFn !== node.entries) {
                var iterator = iteratorFn.call(node);
                var step;
                while (!(step = iterator.next()).done) {
                  if (isValidElement(step.value)) {
                    validateExplicitKey(step.value, parentType);
                  }
                }
              }
            }
          }
        }
        function validatePropTypes(element) {
          {
            var type = element.type;
            if (type === null || type === void 0 || typeof type === "string") {
              return;
            }
            var propTypes;
            if (typeof type === "function") {
              propTypes = type.propTypes;
            } else if (typeof type === "object" && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
            // Inner props are checked in the reconciler.
            type.$$typeof === REACT_MEMO_TYPE)) {
              propTypes = type.propTypes;
            } else {
              return;
            }
            if (propTypes) {
              var name = getComponentNameFromType(type);
              checkPropTypes(propTypes, element.props, "prop", name, element);
            } else if (type.PropTypes !== void 0 && !propTypesMisspellWarningShown) {
              propTypesMisspellWarningShown = true;
              var _name = getComponentNameFromType(type);
              error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _name || "Unknown");
            }
            if (typeof type.getDefaultProps === "function" && !type.getDefaultProps.isReactClassApproved) {
              error("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
            }
          }
        }
        function validateFragmentProps(fragment) {
          {
            var keys = Object.keys(fragment.props);
            for (var i2 = 0; i2 < keys.length; i2++) {
              var key = keys[i2];
              if (key !== "children" && key !== "key") {
                setCurrentlyValidatingElement$1(fragment);
                error("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", key);
                setCurrentlyValidatingElement$1(null);
                break;
              }
            }
            if (fragment.ref !== null) {
              setCurrentlyValidatingElement$1(fragment);
              error("Invalid attribute `ref` supplied to `React.Fragment`.");
              setCurrentlyValidatingElement$1(null);
            }
          }
        }
        function createElementWithValidation(type, props, children) {
          var validType = isValidElementType2(type);
          if (!validType) {
            var info = "";
            if (type === void 0 || typeof type === "object" && type !== null && Object.keys(type).length === 0) {
              info += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.";
            }
            var sourceInfo = getSourceInfoErrorAddendumForProps(props);
            if (sourceInfo) {
              info += sourceInfo;
            } else {
              info += getDeclarationErrorAddendum();
            }
            var typeString;
            if (type === null) {
              typeString = "null";
            } else if (isArray(type)) {
              typeString = "array";
            } else if (type !== void 0 && type.$$typeof === REACT_ELEMENT_TYPE) {
              typeString = "<" + (getComponentNameFromType(type.type) || "Unknown") + " />";
              info = " Did you accidentally export a JSX literal instead of a component?";
            } else {
              typeString = typeof type;
            }
            {
              error("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", typeString, info);
            }
          }
          var element = createElement3.apply(this, arguments);
          if (element == null) {
            return element;
          }
          if (validType) {
            for (var i2 = 2; i2 < arguments.length; i2++) {
              validateChildKeys(arguments[i2], type);
            }
          }
          if (type === REACT_FRAGMENT_TYPE) {
            validateFragmentProps(element);
          } else {
            validatePropTypes(element);
          }
          return element;
        }
        var didWarnAboutDeprecatedCreateFactory = false;
        function createFactoryWithValidation(type) {
          var validatedFactory = createElementWithValidation.bind(null, type);
          validatedFactory.type = type;
          {
            if (!didWarnAboutDeprecatedCreateFactory) {
              didWarnAboutDeprecatedCreateFactory = true;
              warn("React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.");
            }
            Object.defineProperty(validatedFactory, "type", {
              enumerable: false,
              get: function() {
                warn("Factory.type is deprecated. Access the class directly before passing it to createFactory.");
                Object.defineProperty(this, "type", {
                  value: type
                });
                return type;
              }
            });
          }
          return validatedFactory;
        }
        function cloneElementWithValidation(element, props, children) {
          var newElement = cloneElement.apply(this, arguments);
          for (var i2 = 2; i2 < arguments.length; i2++) {
            validateChildKeys(arguments[i2], newElement.type);
          }
          validatePropTypes(newElement);
          return newElement;
        }
        function startTransition(scope, options) {
          var prevTransition = ReactCurrentBatchConfig.transition;
          ReactCurrentBatchConfig.transition = {};
          var currentTransition = ReactCurrentBatchConfig.transition;
          {
            ReactCurrentBatchConfig.transition._updatedFibers = /* @__PURE__ */ new Set();
          }
          try {
            scope();
          } finally {
            ReactCurrentBatchConfig.transition = prevTransition;
            {
              if (prevTransition === null && currentTransition._updatedFibers) {
                var updatedFibersCount = currentTransition._updatedFibers.size;
                if (updatedFibersCount > 10) {
                  warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.");
                }
                currentTransition._updatedFibers.clear();
              }
            }
          }
        }
        var didWarnAboutMessageChannel = false;
        var enqueueTaskImpl = null;
        function enqueueTask(task) {
          if (enqueueTaskImpl === null) {
            try {
              var requireString = ("require" + Math.random()).slice(0, 7);
              var nodeRequire = module2 && module2[requireString];
              enqueueTaskImpl = nodeRequire.call(module2, "timers").setImmediate;
            } catch (_err) {
              enqueueTaskImpl = function(callback) {
                {
                  if (didWarnAboutMessageChannel === false) {
                    didWarnAboutMessageChannel = true;
                    if (typeof MessageChannel === "undefined") {
                      error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning.");
                    }
                  }
                }
                var channel = new MessageChannel();
                channel.port1.onmessage = callback;
                channel.port2.postMessage(void 0);
              };
            }
          }
          return enqueueTaskImpl(task);
        }
        var actScopeDepth = 0;
        var didWarnNoAwaitAct = false;
        function act(callback) {
          {
            var prevActScopeDepth = actScopeDepth;
            actScopeDepth++;
            if (ReactCurrentActQueue.current === null) {
              ReactCurrentActQueue.current = [];
            }
            var prevIsBatchingLegacy = ReactCurrentActQueue.isBatchingLegacy;
            var result;
            try {
              ReactCurrentActQueue.isBatchingLegacy = true;
              result = callback();
              if (!prevIsBatchingLegacy && ReactCurrentActQueue.didScheduleLegacyUpdate) {
                var queue = ReactCurrentActQueue.current;
                if (queue !== null) {
                  ReactCurrentActQueue.didScheduleLegacyUpdate = false;
                  flushActQueue(queue);
                }
              }
            } catch (error2) {
              popActScope(prevActScopeDepth);
              throw error2;
            } finally {
              ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy;
            }
            if (result !== null && typeof result === "object" && typeof result.then === "function") {
              var thenableResult = result;
              var wasAwaited = false;
              var thenable = {
                then: function(resolve, reject) {
                  wasAwaited = true;
                  thenableResult.then(function(returnValue2) {
                    popActScope(prevActScopeDepth);
                    if (actScopeDepth === 0) {
                      recursivelyFlushAsyncActWork(returnValue2, resolve, reject);
                    } else {
                      resolve(returnValue2);
                    }
                  }, function(error2) {
                    popActScope(prevActScopeDepth);
                    reject(error2);
                  });
                }
              };
              {
                if (!didWarnNoAwaitAct && typeof Promise !== "undefined") {
                  Promise.resolve().then(function() {
                  }).then(function() {
                    if (!wasAwaited) {
                      didWarnNoAwaitAct = true;
                      error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);");
                    }
                  });
                }
              }
              return thenable;
            } else {
              var returnValue = result;
              popActScope(prevActScopeDepth);
              if (actScopeDepth === 0) {
                var _queue = ReactCurrentActQueue.current;
                if (_queue !== null) {
                  flushActQueue(_queue);
                  ReactCurrentActQueue.current = null;
                }
                var _thenable = {
                  then: function(resolve, reject) {
                    if (ReactCurrentActQueue.current === null) {
                      ReactCurrentActQueue.current = [];
                      recursivelyFlushAsyncActWork(returnValue, resolve, reject);
                    } else {
                      resolve(returnValue);
                    }
                  }
                };
                return _thenable;
              } else {
                var _thenable2 = {
                  then: function(resolve, reject) {
                    resolve(returnValue);
                  }
                };
                return _thenable2;
              }
            }
          }
        }
        function popActScope(prevActScopeDepth) {
          {
            if (prevActScopeDepth !== actScopeDepth - 1) {
              error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. ");
            }
            actScopeDepth = prevActScopeDepth;
          }
        }
        function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
          {
            var queue = ReactCurrentActQueue.current;
            if (queue !== null) {
              try {
                flushActQueue(queue);
                enqueueTask(function() {
                  if (queue.length === 0) {
                    ReactCurrentActQueue.current = null;
                    resolve(returnValue);
                  } else {
                    recursivelyFlushAsyncActWork(returnValue, resolve, reject);
                  }
                });
              } catch (error2) {
                reject(error2);
              }
            } else {
              resolve(returnValue);
            }
          }
        }
        var isFlushing = false;
        function flushActQueue(queue) {
          {
            if (!isFlushing) {
              isFlushing = true;
              var i2 = 0;
              try {
                for (; i2 < queue.length; i2++) {
                  var callback = queue[i2];
                  do {
                    callback = callback(true);
                  } while (callback !== null);
                }
                queue.length = 0;
              } catch (error2) {
                queue = queue.slice(i2 + 1);
                throw error2;
              } finally {
                isFlushing = false;
              }
            }
          }
        }
        var createElement$1 = createElementWithValidation;
        var cloneElement$1 = cloneElementWithValidation;
        var createFactory = createFactoryWithValidation;
        var Children = {
          map: mapChildren,
          forEach: forEachChildren,
          count: countChildren,
          toArray,
          only: onlyChild
        };
        exports.Children = Children;
        exports.Component = Component;
        exports.Fragment = REACT_FRAGMENT_TYPE;
        exports.Profiler = REACT_PROFILER_TYPE;
        exports.PureComponent = PureComponent;
        exports.StrictMode = REACT_STRICT_MODE_TYPE;
        exports.Suspense = REACT_SUSPENSE_TYPE;
        exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
        exports.act = act;
        exports.cloneElement = cloneElement$1;
        exports.createContext = createContext2;
        exports.createElement = createElement$1;
        exports.createFactory = createFactory;
        exports.createRef = createRef;
        exports.forwardRef = forwardRef2;
        exports.isValidElement = isValidElement;
        exports.lazy = lazy;
        exports.memo = memo2;
        exports.startTransition = startTransition;
        exports.unstable_act = act;
        exports.useCallback = useCallback2;
        exports.useContext = useContext3;
        exports.useDebugValue = useDebugValue2;
        exports.useDeferredValue = useDeferredValue;
        exports.useEffect = useEffect2;
        exports.useId = useId;
        exports.useImperativeHandle = useImperativeHandle;
        exports.useInsertionEffect = useInsertionEffect;
        exports.useLayoutEffect = useLayoutEffect2;
        exports.useMemo = useMemo3;
        exports.useReducer = useReducer;
        exports.useRef = useRef4;
        exports.useState = useState;
        exports.useSyncExternalStore = useSyncExternalStore3;
        exports.useTransition = useTransition;
        exports.version = ReactVersion;
        if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
          __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
        }
      })();
    }
  }
});

// node_modules/react/index.js
var require_react = __commonJS({
  "node_modules/react/index.js"(exports, module2) {
    "use strict";
    if (false) {
      module2.exports = null;
    } else {
      module2.exports = require_react_development();
    }
  }
});

// node_modules/scheduler/cjs/scheduler.development.js
var require_scheduler_development = __commonJS({
  "node_modules/scheduler/cjs/scheduler.development.js"(exports) {
    "use strict";
    if (true) {
      (function() {
        "use strict";
        if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
          __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
        }
        var enableSchedulerDebugging = false;
        var enableProfiling = false;
        var frameYieldMs = 5;
        function push(heap, node) {
          var index = heap.length;
          heap.push(node);
          siftUp(heap, node, index);
        }
        function peek(heap) {
          return heap.length === 0 ? null : heap[0];
        }
        function pop(heap) {
          if (heap.length === 0) {
            return null;
          }
          var first = heap[0];
          var last2 = heap.pop();
          if (last2 !== first) {
            heap[0] = last2;
            siftDown(heap, last2, 0);
          }
          return first;
        }
        function siftUp(heap, node, i2) {
          var index = i2;
          while (index > 0) {
            var parentIndex = index - 1 >>> 1;
            var parent = heap[parentIndex];
            if (compare(parent, node) > 0) {
              heap[parentIndex] = node;
              heap[index] = parent;
              index = parentIndex;
            } else {
              return;
            }
          }
        }
        function siftDown(heap, node, i2) {
          var index = i2;
          var length = heap.length;
          var halfLength = length >>> 1;
          while (index < halfLength) {
            var leftIndex = (index + 1) * 2 - 1;
            var left = heap[leftIndex];
            var rightIndex = leftIndex + 1;
            var right = heap[rightIndex];
            if (compare(left, node) < 0) {
              if (rightIndex < length && compare(right, left) < 0) {
                heap[index] = right;
                heap[rightIndex] = node;
                index = rightIndex;
              } else {
                heap[index] = left;
                heap[leftIndex] = node;
                index = leftIndex;
              }
            } else if (rightIndex < length && compare(right, node) < 0) {
              heap[index] = right;
              heap[rightIndex] = node;
              index = rightIndex;
            } else {
              return;
            }
          }
        }
        function compare(a2, b2) {
          var diff = a2.sortIndex - b2.sortIndex;
          return diff !== 0 ? diff : a2.id - b2.id;
        }
        var ImmediatePriority = 1;
        var UserBlockingPriority = 2;
        var NormalPriority = 3;
        var LowPriority = 4;
        var IdlePriority = 5;
        function markTaskErrored(task, ms) {
        }
        var hasPerformanceNow = typeof performance === "object" && typeof performance.now === "function";
        if (hasPerformanceNow) {
          var localPerformance = performance;
          exports.unstable_now = function() {
            return localPerformance.now();
          };
        } else {
          var localDate = Date;
          var initialTime = localDate.now();
          exports.unstable_now = function() {
            return localDate.now() - initialTime;
          };
        }
        var maxSigned31BitInt = 1073741823;
        var IMMEDIATE_PRIORITY_TIMEOUT = -1;
        var USER_BLOCKING_PRIORITY_TIMEOUT = 250;
        var NORMAL_PRIORITY_TIMEOUT = 5e3;
        var LOW_PRIORITY_TIMEOUT = 1e4;
        var IDLE_PRIORITY_TIMEOUT = maxSigned31BitInt;
        var taskQueue = [];
        var timerQueue = [];
        var taskIdCounter = 1;
        var currentTask = null;
        var currentPriorityLevel = NormalPriority;
        var isPerformingWork = false;
        var isHostCallbackScheduled = false;
        var isHostTimeoutScheduled = false;
        var localSetTimeout = typeof setTimeout === "function" ? setTimeout : null;
        var localClearTimeout = typeof clearTimeout === "function" ? clearTimeout : null;
        var localSetImmediate = typeof setImmediate !== "undefined" ? setImmediate : null;
        var isInputPending = typeof navigator !== "undefined" && navigator.scheduling !== void 0 && navigator.scheduling.isInputPending !== void 0 ? navigator.scheduling.isInputPending.bind(navigator.scheduling) : null;
        function advanceTimers(currentTime) {
          var timer = peek(timerQueue);
          while (timer !== null) {
            if (timer.callback === null) {
              pop(timerQueue);
            } else if (timer.startTime <= currentTime) {
              pop(timerQueue);
              timer.sortIndex = timer.expirationTime;
              push(taskQueue, timer);
            } else {
              return;
            }
            timer = peek(timerQueue);
          }
        }
        function handleTimeout(currentTime) {
          isHostTimeoutScheduled = false;
          advanceTimers(currentTime);
          if (!isHostCallbackScheduled) {
            if (peek(taskQueue) !== null) {
              isHostCallbackScheduled = true;
              requestHostCallback(flushWork);
            } else {
              var firstTimer = peek(timerQueue);
              if (firstTimer !== null) {
                requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);
              }
            }
          }
        }
        function flushWork(hasTimeRemaining, initialTime2) {
          isHostCallbackScheduled = false;
          if (isHostTimeoutScheduled) {
            isHostTimeoutScheduled = false;
            cancelHostTimeout();
          }
          isPerformingWork = true;
          var previousPriorityLevel = currentPriorityLevel;
          try {
            if (enableProfiling) {
              try {
                return workLoop(hasTimeRemaining, initialTime2);
              } catch (error) {
                if (currentTask !== null) {
                  var currentTime = exports.unstable_now();
                  markTaskErrored(currentTask, currentTime);
                  currentTask.isQueued = false;
                }
                throw error;
              }
            } else {
              return workLoop(hasTimeRemaining, initialTime2);
            }
          } finally {
            currentTask = null;
            currentPriorityLevel = previousPriorityLevel;
            isPerformingWork = false;
          }
        }
        function workLoop(hasTimeRemaining, initialTime2) {
          var currentTime = initialTime2;
          advanceTimers(currentTime);
          currentTask = peek(taskQueue);
          while (currentTask !== null && !enableSchedulerDebugging) {
            if (currentTask.expirationTime > currentTime && (!hasTimeRemaining || shouldYieldToHost())) {
              break;
            }
            var callback = currentTask.callback;
            if (typeof callback === "function") {
              currentTask.callback = null;
              currentPriorityLevel = currentTask.priorityLevel;
              var didUserCallbackTimeout = currentTask.expirationTime <= currentTime;
              var continuationCallback = callback(didUserCallbackTimeout);
              currentTime = exports.unstable_now();
              if (typeof continuationCallback === "function") {
                currentTask.callback = continuationCallback;
              } else {
                if (currentTask === peek(taskQueue)) {
                  pop(taskQueue);
                }
              }
              advanceTimers(currentTime);
            } else {
              pop(taskQueue);
            }
            currentTask = peek(taskQueue);
          }
          if (currentTask !== null) {
            return true;
          } else {
            var firstTimer = peek(timerQueue);
            if (firstTimer !== null) {
              requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);
            }
            return false;
          }
        }
        function unstable_runWithPriority(priorityLevel, eventHandler2) {
          switch (priorityLevel) {
            case ImmediatePriority:
            case UserBlockingPriority:
            case NormalPriority:
            case LowPriority:
            case IdlePriority:
              break;
            default:
              priorityLevel = NormalPriority;
          }
          var previousPriorityLevel = currentPriorityLevel;
          currentPriorityLevel = priorityLevel;
          try {
            return eventHandler2();
          } finally {
            currentPriorityLevel = previousPriorityLevel;
          }
        }
        function unstable_next(eventHandler2) {
          var priorityLevel;
          switch (currentPriorityLevel) {
            case ImmediatePriority:
            case UserBlockingPriority:
            case NormalPriority:
              priorityLevel = NormalPriority;
              break;
            default:
              priorityLevel = currentPriorityLevel;
              break;
          }
          var previousPriorityLevel = currentPriorityLevel;
          currentPriorityLevel = priorityLevel;
          try {
            return eventHandler2();
          } finally {
            currentPriorityLevel = previousPriorityLevel;
          }
        }
        function unstable_wrapCallback(callback) {
          var parentPriorityLevel = currentPriorityLevel;
          return function() {
            var previousPriorityLevel = currentPriorityLevel;
            currentPriorityLevel = parentPriorityLevel;
            try {
              return callback.apply(this, arguments);
            } finally {
              currentPriorityLevel = previousPriorityLevel;
            }
          };
        }
        function unstable_scheduleCallback(priorityLevel, callback, options) {
          var currentTime = exports.unstable_now();
          var startTime2;
          if (typeof options === "object" && options !== null) {
            var delay = options.delay;
            if (typeof delay === "number" && delay > 0) {
              startTime2 = currentTime + delay;
            } else {
              startTime2 = currentTime;
            }
          } else {
            startTime2 = currentTime;
          }
          var timeout;
          switch (priorityLevel) {
            case ImmediatePriority:
              timeout = IMMEDIATE_PRIORITY_TIMEOUT;
              break;
            case UserBlockingPriority:
              timeout = USER_BLOCKING_PRIORITY_TIMEOUT;
              break;
            case IdlePriority:
              timeout = IDLE_PRIORITY_TIMEOUT;
              break;
            case LowPriority:
              timeout = LOW_PRIORITY_TIMEOUT;
              break;
            case NormalPriority:
            default:
              timeout = NORMAL_PRIORITY_TIMEOUT;
              break;
          }
          var expirationTime = startTime2 + timeout;
          var newTask = {
            id: taskIdCounter++,
            callback,
            priorityLevel,
            startTime: startTime2,
            expirationTime,
            sortIndex: -1
          };
          if (startTime2 > currentTime) {
            newTask.sortIndex = startTime2;
            push(timerQueue, newTask);
            if (peek(taskQueue) === null && newTask === peek(timerQueue)) {
              if (isHostTimeoutScheduled) {
                cancelHostTimeout();
              } else {
                isHostTimeoutScheduled = true;
              }
              requestHostTimeout(handleTimeout, startTime2 - currentTime);
            }
          } else {
            newTask.sortIndex = expirationTime;
            push(taskQueue, newTask);
            if (!isHostCallbackScheduled && !isPerformingWork) {
              isHostCallbackScheduled = true;
              requestHostCallback(flushWork);
            }
          }
          return newTask;
        }
        function unstable_pauseExecution() {
        }
        function unstable_continueExecution() {
          if (!isHostCallbackScheduled && !isPerformingWork) {
            isHostCallbackScheduled = true;
            requestHostCallback(flushWork);
          }
        }
        function unstable_getFirstCallbackNode() {
          return peek(taskQueue);
        }
        function unstable_cancelCallback(task) {
          task.callback = null;
        }
        function unstable_getCurrentPriorityLevel() {
          return currentPriorityLevel;
        }
        var isMessageLoopRunning = false;
        var scheduledHostCallback = null;
        var taskTimeoutID = -1;
        var frameInterval = frameYieldMs;
        var startTime = -1;
        function shouldYieldToHost() {
          var timeElapsed = exports.unstable_now() - startTime;
          if (timeElapsed < frameInterval) {
            return false;
          }
          return true;
        }
        function requestPaint() {
        }
        function forceFrameRate(fps) {
          if (fps < 0 || fps > 125) {
            console["error"]("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported");
            return;
          }
          if (fps > 0) {
            frameInterval = Math.floor(1e3 / fps);
          } else {
            frameInterval = frameYieldMs;
          }
        }
        var performWorkUntilDeadline = function() {
          if (scheduledHostCallback !== null) {
            var currentTime = exports.unstable_now();
            startTime = currentTime;
            var hasTimeRemaining = true;
            var hasMoreWork = true;
            try {
              hasMoreWork = scheduledHostCallback(hasTimeRemaining, currentTime);
            } finally {
              if (hasMoreWork) {
                schedulePerformWorkUntilDeadline();
              } else {
                isMessageLoopRunning = false;
                scheduledHostCallback = null;
              }
            }
          } else {
            isMessageLoopRunning = false;
          }
        };
        var schedulePerformWorkUntilDeadline;
        if (typeof localSetImmediate === "function") {
          schedulePerformWorkUntilDeadline = function() {
            localSetImmediate(performWorkUntilDeadline);
          };
        } else if (typeof MessageChannel !== "undefined") {
          var channel = new MessageChannel();
          var port = channel.port2;
          channel.port1.onmessage = performWorkUntilDeadline;
          schedulePerformWorkUntilDeadline = function() {
            port.postMessage(null);
          };
        } else {
          schedulePerformWorkUntilDeadline = function() {
            localSetTimeout(performWorkUntilDeadline, 0);
          };
        }
        function requestHostCallback(callback) {
          scheduledHostCallback = callback;
          if (!isMessageLoopRunning) {
            isMessageLoopRunning = true;
            schedulePerformWorkUntilDeadline();
          }
        }
        function requestHostTimeout(callback, ms) {
          taskTimeoutID = localSetTimeout(function() {
            callback(exports.unstable_now());
          }, ms);
        }
        function cancelHostTimeout() {
          localClearTimeout(taskTimeoutID);
          taskTimeoutID = -1;
        }
        var unstable_requestPaint = requestPaint;
        var unstable_Profiling = null;
        exports.unstable_IdlePriority = IdlePriority;
        exports.unstable_ImmediatePriority = ImmediatePriority;
        exports.unstable_LowPriority = LowPriority;
        exports.unstable_NormalPriority = NormalPriority;
        exports.unstable_Profiling = unstable_Profiling;
        exports.unstable_UserBlockingPriority = UserBlockingPriority;
        exports.unstable_cancelCallback = unstable_cancelCallback;
        exports.unstable_continueExecution = unstable_continueExecution;
        exports.unstable_forceFrameRate = forceFrameRate;
        exports.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel;
        exports.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode;
        exports.unstable_next = unstable_next;
        exports.unstable_pauseExecution = unstable_pauseExecution;
        exports.unstable_requestPaint = unstable_requestPaint;
        exports.unstable_runWithPriority = unstable_runWithPriority;
        exports.unstable_scheduleCallback = unstable_scheduleCallback;
        exports.unstable_shouldYield = shouldYieldToHost;
        exports.unstable_wrapCallback = unstable_wrapCallback;
        if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
          __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
        }
      })();
    }
  }
});

// node_modules/scheduler/index.js
var require_scheduler = __commonJS({
  "node_modules/scheduler/index.js"(exports, module2) {
    "use strict";
    if (false) {
      module2.exports = null;
    } else {
      module2.exports = require_scheduler_development();
    }
  }
});

// node_modules/react-dom/cjs/react-dom.development.js
var require_react_dom_development = __commonJS({
  "node_modules/react-dom/cjs/react-dom.development.js"(exports) {
    "use strict";
    if (true) {
      (function() {
        "use strict";
        if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
          __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
        }
        var React66 = require_react();
        var Scheduler = require_scheduler();
        var ReactSharedInternals = React66.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
        var suppressWarning = false;
        function setSuppressWarning(newSuppressWarning) {
          {
            suppressWarning = newSuppressWarning;
          }
        }
        function warn(format) {
          {
            if (!suppressWarning) {
              for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
                args[_key - 1] = arguments[_key];
              }
              printWarning("warn", format, args);
            }
          }
        }
        function error(format) {
          {
            if (!suppressWarning) {
              for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
                args[_key2 - 1] = arguments[_key2];
              }
              printWarning("error", format, args);
            }
          }
        }
        function printWarning(level, format, args) {
          {
            var ReactDebugCurrentFrame2 = ReactSharedInternals.ReactDebugCurrentFrame;
            var stack = ReactDebugCurrentFrame2.getStackAddendum();
            if (stack !== "") {
              format += "%s";
              args = args.concat([stack]);
            }
            var argsWithFormat = args.map(function(item) {
              return String(item);
            });
            argsWithFormat.unshift("Warning: " + format);
            Function.prototype.apply.call(console[level], console, argsWithFormat);
          }
        }
        var FunctionComponent = 0;
        var ClassComponent = 1;
        var IndeterminateComponent = 2;
        var HostRoot = 3;
        var HostPortal = 4;
        var HostComponent = 5;
        var HostText = 6;
        var Fragment27 = 7;
        var Mode = 8;
        var ContextConsumer = 9;
        var ContextProvider = 10;
        var ForwardRef = 11;
        var Profiler = 12;
        var SuspenseComponent = 13;
        var MemoComponent = 14;
        var SimpleMemoComponent = 15;
        var LazyComponent = 16;
        var IncompleteClassComponent = 17;
        var DehydratedFragment = 18;
        var SuspenseListComponent = 19;
        var ScopeComponent = 21;
        var OffscreenComponent = 22;
        var LegacyHiddenComponent = 23;
        var CacheComponent = 24;
        var TracingMarkerComponent = 25;
        var enableClientRenderFallbackOnTextMismatch = true;
        var enableNewReconciler = false;
        var enableLazyContextPropagation = false;
        var enableLegacyHidden = false;
        var enableSuspenseAvoidThisFallback = false;
        var disableCommentsAsDOMContainers = true;
        var enableCustomElementPropertySupport = false;
        var warnAboutStringRefs = true;
        var enableSchedulingProfiler = true;
        var enableProfilerTimer = true;
        var enableProfilerCommitHooks = true;
        var allNativeEvents = /* @__PURE__ */ new Set();
        var registrationNameDependencies = {};
        var possibleRegistrationNames = {};
        function registerTwoPhaseEvent(registrationName, dependencies) {
          registerDirectEvent(registrationName, dependencies);
          registerDirectEvent(registrationName + "Capture", dependencies);
        }
        function registerDirectEvent(registrationName, dependencies) {
          {
            if (registrationNameDependencies[registrationName]) {
              error("EventRegistry: More than one plugin attempted to publish the same registration name, `%s`.", registrationName);
            }
          }
          registrationNameDependencies[registrationName] = dependencies;
          {
            var lowerCasedName = registrationName.toLowerCase();
            possibleRegistrationNames[lowerCasedName] = registrationName;
            if (registrationName === "onDoubleClick") {
              possibleRegistrationNames.ondblclick = registrationName;
            }
          }
          for (var i2 = 0; i2 < dependencies.length; i2++) {
            allNativeEvents.add(dependencies[i2]);
          }
        }
        var canUseDOM2 = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
        var hasOwnProperty = Object.prototype.hasOwnProperty;
        function typeName(value) {
          {
            var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag;
            var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
            return type;
          }
        }
        function willCoercionThrow(value) {
          {
            try {
              testStringCoercion(value);
              return false;
            } catch (e) {
              return true;
            }
          }
        }
        function testStringCoercion(value) {
          return "" + value;
        }
        function checkAttributeStringCoercion(value, attributeName) {
          {
            if (willCoercionThrow(value)) {
              error("The provided `%s` attribute is an unsupported type %s. This value must be coerced to a string before before using it here.", attributeName, typeName(value));
              return testStringCoercion(value);
            }
          }
        }
        function checkKeyStringCoercion(value) {
          {
            if (willCoercionThrow(value)) {
              error("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", typeName(value));
              return testStringCoercion(value);
            }
          }
        }
        function checkPropStringCoercion(value, propName) {
          {
            if (willCoercionThrow(value)) {
              error("The provided `%s` prop is an unsupported type %s. This value must be coerced to a string before before using it here.", propName, typeName(value));
              return testStringCoercion(value);
            }
          }
        }
        function checkCSSPropertyStringCoercion(value, propName) {
          {
            if (willCoercionThrow(value)) {
              error("The provided `%s` CSS property is an unsupported type %s. This value must be coerced to a string before before using it here.", propName, typeName(value));
              return testStringCoercion(value);
            }
          }
        }
        function checkHtmlStringCoercion(value) {
          {
            if (willCoercionThrow(value)) {
              error("The provided HTML markup uses a value of unsupported type %s. This value must be coerced to a string before before using it here.", typeName(value));
              return testStringCoercion(value);
            }
          }
        }
        function checkFormFieldValueStringCoercion(value) {
          {
            if (willCoercionThrow(value)) {
              error("Form field values (value, checked, defaultValue, or defaultChecked props) must be strings, not %s. This value must be coerced to a string before before using it here.", typeName(value));
              return testStringCoercion(value);
            }
          }
        }
        var RESERVED = 0;
        var STRING = 1;
        var BOOLEANISH_STRING = 2;
        var BOOLEAN = 3;
        var OVERLOADED_BOOLEAN = 4;
        var NUMERIC = 5;
        var POSITIVE_NUMERIC = 6;
        var ATTRIBUTE_NAME_START_CHAR = ":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
        var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
        var VALID_ATTRIBUTE_NAME_REGEX = new RegExp("^[" + ATTRIBUTE_NAME_START_CHAR + "][" + ATTRIBUTE_NAME_CHAR + "]*$");
        var illegalAttributeNameCache = {};
        var validatedAttributeNameCache = {};
        function isAttributeNameSafe(attributeName) {
          if (hasOwnProperty.call(validatedAttributeNameCache, attributeName)) {
            return true;
          }
          if (hasOwnProperty.call(illegalAttributeNameCache, attributeName)) {
            return false;
          }
          if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
            validatedAttributeNameCache[attributeName] = true;
            return true;
          }
          illegalAttributeNameCache[attributeName] = true;
          {
            error("Invalid attribute name: `%s`", attributeName);
          }
          return false;
        }
        function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) {
          if (propertyInfo !== null) {
            return propertyInfo.type === RESERVED;
          }
          if (isCustomComponentTag) {
            return false;
          }
          if (name.length > 2 && (name[0] === "o" || name[0] === "O") && (name[1] === "n" || name[1] === "N")) {
            return true;
          }
          return false;
        }
        function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) {
          if (propertyInfo !== null && propertyInfo.type === RESERVED) {
            return false;
          }
          switch (typeof value) {
            case "function":
            case "symbol":
              return true;
            case "boolean": {
              if (isCustomComponentTag) {
                return false;
              }
              if (propertyInfo !== null) {
                return !propertyInfo.acceptsBooleans;
              } else {
                var prefix3 = name.toLowerCase().slice(0, 5);
                return prefix3 !== "data-" && prefix3 !== "aria-";
              }
            }
            default:
              return false;
          }
        }
        function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag) {
          if (value === null || typeof value === "undefined") {
            return true;
          }
          if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) {
            return true;
          }
          if (isCustomComponentTag) {
            return false;
          }
          if (propertyInfo !== null) {
            switch (propertyInfo.type) {
              case BOOLEAN:
                return !value;
              case OVERLOADED_BOOLEAN:
                return value === false;
              case NUMERIC:
                return isNaN(value);
              case POSITIVE_NUMERIC:
                return isNaN(value) || value < 1;
            }
          }
          return false;
        }
        function getPropertyInfo(name) {
          return properties.hasOwnProperty(name) ? properties[name] : null;
        }
        function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL2, removeEmptyString) {
          this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
          this.attributeName = attributeName;
          this.attributeNamespace = attributeNamespace;
          this.mustUseProperty = mustUseProperty;
          this.propertyName = name;
          this.type = type;
          this.sanitizeURL = sanitizeURL2;
          this.removeEmptyString = removeEmptyString;
        }
        var properties = {};
        var reservedProps = [
          "children",
          "dangerouslySetInnerHTML",
          // TODO: This prevents the assignment of defaultValue to regular
          // elements (not just inputs). Now that ReactDOMInput assigns to the
          // defaultValue property -- do we need this?
          "defaultValue",
          "defaultChecked",
          "innerHTML",
          "suppressContentEditableWarning",
          "suppressHydrationWarning",
          "style"
        ];
        reservedProps.forEach(function(name) {
          properties[name] = new PropertyInfoRecord(
            name,
            RESERVED,
            false,
            // mustUseProperty
            name,
            // attributeName
            null,
            // attributeNamespace
            false,
            // sanitizeURL
            false
          );
        });
        [["acceptCharset", "accept-charset"], ["className", "class"], ["htmlFor", "for"], ["httpEquiv", "http-equiv"]].forEach(function(_ref) {
          var name = _ref[0], attributeName = _ref[1];
          properties[name] = new PropertyInfoRecord(
            name,
            STRING,
            false,
            // mustUseProperty
            attributeName,
            // attributeName
            null,
            // attributeNamespace
            false,
            // sanitizeURL
            false
          );
        });
        ["contentEditable", "draggable", "spellCheck", "value"].forEach(function(name) {
          properties[name] = new PropertyInfoRecord(
            name,
            BOOLEANISH_STRING,
            false,
            // mustUseProperty
            name.toLowerCase(),
            // attributeName
            null,
            // attributeNamespace
            false,
            // sanitizeURL
            false
          );
        });
        ["autoReverse", "externalResourcesRequired", "focusable", "preserveAlpha"].forEach(function(name) {
          properties[name] = new PropertyInfoRecord(
            name,
            BOOLEANISH_STRING,
            false,
            // mustUseProperty
            name,
            // attributeName
            null,
            // attributeNamespace
            false,
            // sanitizeURL
            false
          );
        });
        [
          "allowFullScreen",
          "async",
          // Note: there is a special case that prevents it from being written to the DOM
          // on the client side because the browsers are inconsistent. Instead we call focus().
          "autoFocus",
          "autoPlay",
          "controls",
          "default",
          "defer",
          "disabled",
          "disablePictureInPicture",
          "disableRemotePlayback",
          "formNoValidate",
          "hidden",
          "loop",
          "noModule",
          "noValidate",
          "open",
          "playsInline",
          "readOnly",
          "required",
          "reversed",
          "scoped",
          "seamless",
          // Microdata
          "itemScope"
        ].forEach(function(name) {
          properties[name] = new PropertyInfoRecord(
            name,
            BOOLEAN,
            false,
            // mustUseProperty
            name.toLowerCase(),
            // attributeName
            null,
            // attributeNamespace
            false,
            // sanitizeURL
            false
          );
        });
        [
          "checked",
          // Note: `option.selected` is not updated if `select.multiple` is
          // disabled with `removeAttribute`. We have special logic for handling this.
          "multiple",
          "muted",
          "selected"
          // NOTE: if you add a camelCased prop to this list,
          // you'll need to set attributeName to name.toLowerCase()
          // instead in the assignment below.
        ].forEach(function(name) {
          properties[name] = new PropertyInfoRecord(
            name,
            BOOLEAN,
            true,
            // mustUseProperty
            name,
            // attributeName
            null,
            // attributeNamespace
            false,
            // sanitizeURL
            false
          );
        });
        [
          "capture",
          "download"
          // NOTE: if you add a camelCased prop to this list,
          // you'll need to set attributeName to name.toLowerCase()
          // instead in the assignment below.
        ].forEach(function(name) {
          properties[name] = new PropertyInfoRecord(
            name,
            OVERLOADED_BOOLEAN,
            false,
            // mustUseProperty
            name,
            // attributeName
            null,
            // attributeNamespace
            false,
            // sanitizeURL
            false
          );
        });
        [
          "cols",
          "rows",
          "size",
          "span"
          // NOTE: if you add a camelCased prop to this list,
          // you'll need to set attributeName to name.toLowerCase()
          // instead in the assignment below.
        ].forEach(function(name) {
          properties[name] = new PropertyInfoRecord(
            name,
            POSITIVE_NUMERIC,
            false,
            // mustUseProperty
            name,
            // attributeName
            null,
            // attributeNamespace
            false,
            // sanitizeURL
            false
          );
        });
        ["rowSpan", "start"].forEach(function(name) {
          properties[name] = new PropertyInfoRecord(
            name,
            NUMERIC,
            false,
            // mustUseProperty
            name.toLowerCase(),
            // attributeName
            null,
            // attributeNamespace
            false,
            // sanitizeURL
            false
          );
        });
        var CAMELIZE = /[\-\:]([a-z])/g;
        var capitalize = function(token) {
          return token[1].toUpperCase();
        };
        [
          "accent-height",
          "alignment-baseline",
          "arabic-form",
          "baseline-shift",
          "cap-height",
          "clip-path",
          "clip-rule",
          "color-interpolation",
          "color-interpolation-filters",
          "color-profile",
          "color-rendering",
          "dominant-baseline",
          "enable-background",
          "fill-opacity",
          "fill-rule",
          "flood-color",
          "flood-opacity",
          "font-family",
          "font-size",
          "font-size-adjust",
          "font-stretch",
          "font-style",
          "font-variant",
          "font-weight",
          "glyph-name",
          "glyph-orientation-horizontal",
          "glyph-orientation-vertical",
          "horiz-adv-x",
          "horiz-origin-x",
          "image-rendering",
          "letter-spacing",
          "lighting-color",
          "marker-end",
          "marker-mid",
          "marker-start",
          "overline-position",
          "overline-thickness",
          "paint-order",
          "panose-1",
          "pointer-events",
          "rendering-intent",
          "shape-rendering",
          "stop-color",
          "stop-opacity",
          "strikethrough-position",
          "strikethrough-thickness",
          "stroke-dasharray",
          "stroke-dashoffset",
          "stroke-linecap",
          "stroke-linejoin",
          "stroke-miterlimit",
          "stroke-opacity",
          "stroke-width",
          "text-anchor",
          "text-decoration",
          "text-rendering",
          "underline-position",
          "underline-thickness",
          "unicode-bidi",
          "unicode-range",
          "units-per-em",
          "v-alphabetic",
          "v-hanging",
          "v-ideographic",
          "v-mathematical",
          "vector-effect",
          "vert-adv-y",
          "vert-origin-x",
          "vert-origin-y",
          "word-spacing",
          "writing-mode",
          "xmlns:xlink",
          "x-height"
          // NOTE: if you add a camelCased prop to this list,
          // you'll need to set attributeName to name.toLowerCase()
          // instead in the assignment below.
        ].forEach(function(attributeName) {
          var name = attributeName.replace(CAMELIZE, capitalize);
          properties[name] = new PropertyInfoRecord(
            name,
            STRING,
            false,
            // mustUseProperty
            attributeName,
            null,
            // attributeNamespace
            false,
            // sanitizeURL
            false
          );
        });
        [
          "xlink:actuate",
          "xlink:arcrole",
          "xlink:role",
          "xlink:show",
          "xlink:title",
          "xlink:type"
          // NOTE: if you add a camelCased prop to this list,
          // you'll need to set attributeName to name.toLowerCase()
          // instead in the assignment below.
        ].forEach(function(attributeName) {
          var name = attributeName.replace(CAMELIZE, capitalize);
          properties[name] = new PropertyInfoRecord(
            name,
            STRING,
            false,
            // mustUseProperty
            attributeName,
            "http://www.w3.org/1999/xlink",
            false,
            // sanitizeURL
            false
          );
        });
        [
          "xml:base",
          "xml:lang",
          "xml:space"
          // NOTE: if you add a camelCased prop to this list,
          // you'll need to set attributeName to name.toLowerCase()
          // instead in the assignment below.
        ].forEach(function(attributeName) {
          var name = attributeName.replace(CAMELIZE, capitalize);
          properties[name] = new PropertyInfoRecord(
            name,
            STRING,
            false,
            // mustUseProperty
            attributeName,
            "http://www.w3.org/XML/1998/namespace",
            false,
            // sanitizeURL
            false
          );
        });
        ["tabIndex", "crossOrigin"].forEach(function(attributeName) {
          properties[attributeName] = new PropertyInfoRecord(
            attributeName,
            STRING,
            false,
            // mustUseProperty
            attributeName.toLowerCase(),
            // attributeName
            null,
            // attributeNamespace
            false,
            // sanitizeURL
            false
          );
        });
        var xlinkHref = "xlinkHref";
        properties[xlinkHref] = new PropertyInfoRecord(
          "xlinkHref",
          STRING,
          false,
          // mustUseProperty
          "xlink:href",
          "http://www.w3.org/1999/xlink",
          true,
          // sanitizeURL
          false
        );
        ["src", "href", "action", "formAction"].forEach(function(attributeName) {
          properties[attributeName] = new PropertyInfoRecord(
            attributeName,
            STRING,
            false,
            // mustUseProperty
            attributeName.toLowerCase(),
            // attributeName
            null,
            // attributeNamespace
            true,
            // sanitizeURL
            true
          );
        });
        var isJavaScriptProtocol = /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i;
        var didWarn = false;
        function sanitizeURL(url) {
          {
            if (!didWarn && isJavaScriptProtocol.test(url)) {
              didWarn = true;
              error("A future version of React will block javascript: URLs as a security precaution. Use event handlers instead if you can. If you need to generate unsafe HTML try using dangerouslySetInnerHTML instead. React was passed %s.", JSON.stringify(url));
            }
          }
        }
        function getValueForProperty(node, name, expected, propertyInfo) {
          {
            if (propertyInfo.mustUseProperty) {
              var propertyName = propertyInfo.propertyName;
              return node[propertyName];
            } else {
              {
                checkAttributeStringCoercion(expected, name);
              }
              if (propertyInfo.sanitizeURL) {
                sanitizeURL("" + expected);
              }
              var attributeName = propertyInfo.attributeName;
              var stringValue = null;
              if (propertyInfo.type === OVERLOADED_BOOLEAN) {
                if (node.hasAttribute(attributeName)) {
                  var value = node.getAttribute(attributeName);
                  if (value === "") {
                    return true;
                  }
                  if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
                    return value;
                  }
                  if (value === "" + expected) {
                    return expected;
                  }
                  return value;
                }
              } else if (node.hasAttribute(attributeName)) {
                if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
                  return node.getAttribute(attributeName);
                }
                if (propertyInfo.type === BOOLEAN) {
                  return expected;
                }
                stringValue = node.getAttribute(attributeName);
              }
              if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
                return stringValue === null ? expected : stringValue;
              } else if (stringValue === "" + expected) {
                return expected;
              } else {
                return stringValue;
              }
            }
          }
        }
        function getValueForAttribute(node, name, expected, isCustomComponentTag) {
          {
            if (!isAttributeNameSafe(name)) {
              return;
            }
            if (!node.hasAttribute(name)) {
              return expected === void 0 ? void 0 : null;
            }
            var value = node.getAttribute(name);
            {
              checkAttributeStringCoercion(expected, name);
            }
            if (value === "" + expected) {
              return expected;
            }
            return value;
          }
        }
        function setValueForProperty(node, name, value, isCustomComponentTag) {
          var propertyInfo = getPropertyInfo(name);
          if (shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag)) {
            return;
          }
          if (shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag)) {
            value = null;
          }
          if (isCustomComponentTag || propertyInfo === null) {
            if (isAttributeNameSafe(name)) {
              var _attributeName = name;
              if (value === null) {
                node.removeAttribute(_attributeName);
              } else {
                {
                  checkAttributeStringCoercion(value, name);
                }
                node.setAttribute(_attributeName, "" + value);
              }
            }
            return;
          }
          var mustUseProperty = propertyInfo.mustUseProperty;
          if (mustUseProperty) {
            var propertyName = propertyInfo.propertyName;
            if (value === null) {
              var type = propertyInfo.type;
              node[propertyName] = type === BOOLEAN ? false : "";
            } else {
              node[propertyName] = value;
            }
            return;
          }
          var attributeName = propertyInfo.attributeName, attributeNamespace = propertyInfo.attributeNamespace;
          if (value === null) {
            node.removeAttribute(attributeName);
          } else {
            var _type = propertyInfo.type;
            var attributeValue;
            if (_type === BOOLEAN || _type === OVERLOADED_BOOLEAN && value === true) {
              attributeValue = "";
            } else {
              {
                {
                  checkAttributeStringCoercion(value, attributeName);
                }
                attributeValue = "" + value;
              }
              if (propertyInfo.sanitizeURL) {
                sanitizeURL(attributeValue.toString());
              }
            }
            if (attributeNamespace) {
              node.setAttributeNS(attributeNamespace, attributeName, attributeValue);
            } else {
              node.setAttribute(attributeName, attributeValue);
            }
          }
        }
        var REACT_ELEMENT_TYPE = Symbol.for("react.element");
        var REACT_PORTAL_TYPE = Symbol.for("react.portal");
        var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
        var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
        var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
        var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
        var REACT_CONTEXT_TYPE = Symbol.for("react.context");
        var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
        var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
        var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
        var REACT_MEMO_TYPE = Symbol.for("react.memo");
        var REACT_LAZY_TYPE = Symbol.for("react.lazy");
        var REACT_SCOPE_TYPE = Symbol.for("react.scope");
        var REACT_DEBUG_TRACING_MODE_TYPE = Symbol.for("react.debug_trace_mode");
        var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
        var REACT_LEGACY_HIDDEN_TYPE = Symbol.for("react.legacy_hidden");
        var REACT_CACHE_TYPE = Symbol.for("react.cache");
        var REACT_TRACING_MARKER_TYPE = Symbol.for("react.tracing_marker");
        var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
        var FAUX_ITERATOR_SYMBOL = "@@iterator";
        function getIteratorFn(maybeIterable) {
          if (maybeIterable === null || typeof maybeIterable !== "object") {
            return null;
          }
          var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
          if (typeof maybeIterator === "function") {
            return maybeIterator;
          }
          return null;
        }
        var assign = Object.assign;
        var disabledDepth = 0;
        var prevLog;
        var prevInfo;
        var prevWarn;
        var prevError;
        var prevGroup;
        var prevGroupCollapsed;
        var prevGroupEnd;
        function disabledLog() {
        }
        disabledLog.__reactDisabledLog = true;
        function disableLogs() {
          {
            if (disabledDepth === 0) {
              prevLog = console.log;
              prevInfo = console.info;
              prevWarn = console.warn;
              prevError = console.error;
              prevGroup = console.group;
              prevGroupCollapsed = console.groupCollapsed;
              prevGroupEnd = console.groupEnd;
              var props = {
                configurable: true,
                enumerable: true,
                value: disabledLog,
                writable: true
              };
              Object.defineProperties(console, {
                info: props,
                log: props,
                warn: props,
                error: props,
                group: props,
                groupCollapsed: props,
                groupEnd: props
              });
            }
            disabledDepth++;
          }
        }
        function reenableLogs() {
          {
            disabledDepth--;
            if (disabledDepth === 0) {
              var props = {
                configurable: true,
                enumerable: true,
                writable: true
              };
              Object.defineProperties(console, {
                log: assign({}, props, {
                  value: prevLog
                }),
                info: assign({}, props, {
                  value: prevInfo
                }),
                warn: assign({}, props, {
                  value: prevWarn
                }),
                error: assign({}, props, {
                  value: prevError
                }),
                group: assign({}, props, {
                  value: prevGroup
                }),
                groupCollapsed: assign({}, props, {
                  value: prevGroupCollapsed
                }),
                groupEnd: assign({}, props, {
                  value: prevGroupEnd
                })
              });
            }
            if (disabledDepth < 0) {
              error("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
            }
          }
        }
        var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
        var prefix2;
        function describeBuiltInComponentFrame(name, source, ownerFn) {
          {
            if (prefix2 === void 0) {
              try {
                throw Error();
              } catch (x2) {
                var match = x2.stack.trim().match(/\n( *(at )?)/);
                prefix2 = match && match[1] || "";
              }
            }
            return "\n" + prefix2 + name;
          }
        }
        var reentry = false;
        var componentFrameCache;
        {
          var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map;
          componentFrameCache = new PossiblyWeakMap();
        }
        function describeNativeComponentFrame(fn2, construct) {
          if (!fn2 || reentry) {
            return "";
          }
          {
            var frame = componentFrameCache.get(fn2);
            if (frame !== void 0) {
              return frame;
            }
          }
          var control;
          reentry = true;
          var previousPrepareStackTrace = Error.prepareStackTrace;
          Error.prepareStackTrace = void 0;
          var previousDispatcher;
          {
            previousDispatcher = ReactCurrentDispatcher.current;
            ReactCurrentDispatcher.current = null;
            disableLogs();
          }
          try {
            if (construct) {
              var Fake = function() {
                throw Error();
              };
              Object.defineProperty(Fake.prototype, "props", {
                set: function() {
                  throw Error();
                }
              });
              if (typeof Reflect === "object" && Reflect.construct) {
                try {
                  Reflect.construct(Fake, []);
                } catch (x2) {
                  control = x2;
                }
                Reflect.construct(fn2, [], Fake);
              } else {
                try {
                  Fake.call();
                } catch (x2) {
                  control = x2;
                }
                fn2.call(Fake.prototype);
              }
            } else {
              try {
                throw Error();
              } catch (x2) {
                control = x2;
              }
              fn2();
            }
          } catch (sample) {
            if (sample && control && typeof sample.stack === "string") {
              var sampleLines = sample.stack.split("\n");
              var controlLines = control.stack.split("\n");
              var s2 = sampleLines.length - 1;
              var c2 = controlLines.length - 1;
              while (s2 >= 1 && c2 >= 0 && sampleLines[s2] !== controlLines[c2]) {
                c2--;
              }
              for (; s2 >= 1 && c2 >= 0; s2--, c2--) {
                if (sampleLines[s2] !== controlLines[c2]) {
                  if (s2 !== 1 || c2 !== 1) {
                    do {
                      s2--;
                      c2--;
                      if (c2 < 0 || sampleLines[s2] !== controlLines[c2]) {
                        var _frame = "\n" + sampleLines[s2].replace(" at new ", " at ");
                        if (fn2.displayName && _frame.includes("<anonymous>")) {
                          _frame = _frame.replace("<anonymous>", fn2.displayName);
                        }
                        {
                          if (typeof fn2 === "function") {
                            componentFrameCache.set(fn2, _frame);
                          }
                        }
                        return _frame;
                      }
                    } while (s2 >= 1 && c2 >= 0);
                  }
                  break;
                }
              }
            }
          } finally {
            reentry = false;
            {
              ReactCurrentDispatcher.current = previousDispatcher;
              reenableLogs();
            }
            Error.prepareStackTrace = previousPrepareStackTrace;
          }
          var name = fn2 ? fn2.displayName || fn2.name : "";
          var syntheticFrame = name ? describeBuiltInComponentFrame(name) : "";
          {
            if (typeof fn2 === "function") {
              componentFrameCache.set(fn2, syntheticFrame);
            }
          }
          return syntheticFrame;
        }
        function describeClassComponentFrame(ctor, source, ownerFn) {
          {
            return describeNativeComponentFrame(ctor, true);
          }
        }
        function describeFunctionComponentFrame(fn2, source, ownerFn) {
          {
            return describeNativeComponentFrame(fn2, false);
          }
        }
        function shouldConstruct(Component) {
          var prototype = Component.prototype;
          return !!(prototype && prototype.isReactComponent);
        }
        function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
          if (type == null) {
            return "";
          }
          if (typeof type === "function") {
            {
              return describeNativeComponentFrame(type, shouldConstruct(type));
            }
          }
          if (typeof type === "string") {
            return describeBuiltInComponentFrame(type);
          }
          switch (type) {
            case REACT_SUSPENSE_TYPE:
              return describeBuiltInComponentFrame("Suspense");
            case REACT_SUSPENSE_LIST_TYPE:
              return describeBuiltInComponentFrame("SuspenseList");
          }
          if (typeof type === "object") {
            switch (type.$$typeof) {
              case REACT_FORWARD_REF_TYPE:
                return describeFunctionComponentFrame(type.render);
              case REACT_MEMO_TYPE:
                return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
              case REACT_LAZY_TYPE: {
                var lazyComponent = type;
                var payload = lazyComponent._payload;
                var init2 = lazyComponent._init;
                try {
                  return describeUnknownElementTypeFrameInDEV(init2(payload), source, ownerFn);
                } catch (x2) {
                }
              }
            }
          }
          return "";
        }
        function describeFiber(fiber) {
          var owner = fiber._debugOwner ? fiber._debugOwner.type : null;
          var source = fiber._debugSource;
          switch (fiber.tag) {
            case HostComponent:
              return describeBuiltInComponentFrame(fiber.type);
            case LazyComponent:
              return describeBuiltInComponentFrame("Lazy");
            case SuspenseComponent:
              return describeBuiltInComponentFrame("Suspense");
            case SuspenseListComponent:
              return describeBuiltInComponentFrame("SuspenseList");
            case FunctionComponent:
            case IndeterminateComponent:
            case SimpleMemoComponent:
              return describeFunctionComponentFrame(fiber.type);
            case ForwardRef:
              return describeFunctionComponentFrame(fiber.type.render);
            case ClassComponent:
              return describeClassComponentFrame(fiber.type);
            default:
              return "";
          }
        }
        function getStackByFiberInDevAndProd(workInProgress2) {
          try {
            var info = "";
            var node = workInProgress2;
            do {
              info += describeFiber(node);
              node = node.return;
            } while (node);
            return info;
          } catch (x2) {
            return "\nError generating stack: " + x2.message + "\n" + x2.stack;
          }
        }
        function getWrappedName(outerType, innerType, wrapperName) {
          var displayName = outerType.displayName;
          if (displayName) {
            return displayName;
          }
          var functionName = innerType.displayName || innerType.name || "";
          return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName;
        }
        function getContextName(type) {
          return type.displayName || "Context";
        }
        function getComponentNameFromType(type) {
          if (type == null) {
            return null;
          }
          {
            if (typeof type.tag === "number") {
              error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.");
            }
          }
          if (typeof type === "function") {
            return type.displayName || type.name || null;
          }
          if (typeof type === "string") {
            return type;
          }
          switch (type) {
            case REACT_FRAGMENT_TYPE:
              return "Fragment";
            case REACT_PORTAL_TYPE:
              return "Portal";
            case REACT_PROFILER_TYPE:
              return "Profiler";
            case REACT_STRICT_MODE_TYPE:
              return "StrictMode";
            case REACT_SUSPENSE_TYPE:
              return "Suspense";
            case REACT_SUSPENSE_LIST_TYPE:
              return "SuspenseList";
          }
          if (typeof type === "object") {
            switch (type.$$typeof) {
              case REACT_CONTEXT_TYPE:
                var context = type;
                return getContextName(context) + ".Consumer";
              case REACT_PROVIDER_TYPE:
                var provider = type;
                return getContextName(provider._context) + ".Provider";
              case REACT_FORWARD_REF_TYPE:
                return getWrappedName(type, type.render, "ForwardRef");
              case REACT_MEMO_TYPE:
                var outerName = type.displayName || null;
                if (outerName !== null) {
                  return outerName;
                }
                return getComponentNameFromType(type.type) || "Memo";
              case REACT_LAZY_TYPE: {
                var lazyComponent = type;
                var payload = lazyComponent._payload;
                var init2 = lazyComponent._init;
                try {
                  return getComponentNameFromType(init2(payload));
                } catch (x2) {
                  return null;
                }
              }
            }
          }
          return null;
        }
        function getWrappedName$1(outerType, innerType, wrapperName) {
          var functionName = innerType.displayName || innerType.name || "";
          return outerType.displayName || (functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName);
        }
        function getContextName$1(type) {
          return type.displayName || "Context";
        }
        function getComponentNameFromFiber(fiber) {
          var tag = fiber.tag, type = fiber.type;
          switch (tag) {
            case CacheComponent:
              return "Cache";
            case ContextConsumer:
              var context = type;
              return getContextName$1(context) + ".Consumer";
            case ContextProvider:
              var provider = type;
              return getContextName$1(provider._context) + ".Provider";
            case DehydratedFragment:
              return "DehydratedFragment";
            case ForwardRef:
              return getWrappedName$1(type, type.render, "ForwardRef");
            case Fragment27:
              return "Fragment";
            case HostComponent:
              return type;
            case HostPortal:
              return "Portal";
            case HostRoot:
              return "Root";
            case HostText:
              return "Text";
            case LazyComponent:
              return getComponentNameFromType(type);
            case Mode:
              if (type === REACT_STRICT_MODE_TYPE) {
                return "StrictMode";
              }
              return "Mode";
            case OffscreenComponent:
              return "Offscreen";
            case Profiler:
              return "Profiler";
            case ScopeComponent:
              return "Scope";
            case SuspenseComponent:
              return "Suspense";
            case SuspenseListComponent:
              return "SuspenseList";
            case TracingMarkerComponent:
              return "TracingMarker";
            case ClassComponent:
            case FunctionComponent:
            case IncompleteClassComponent:
            case IndeterminateComponent:
            case MemoComponent:
            case SimpleMemoComponent:
              if (typeof type === "function") {
                return type.displayName || type.name || null;
              }
              if (typeof type === "string") {
                return type;
              }
              break;
          }
          return null;
        }
        var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
        var current = null;
        var isRendering = false;
        function getCurrentFiberOwnerNameInDevOrNull() {
          {
            if (current === null) {
              return null;
            }
            var owner = current._debugOwner;
            if (owner !== null && typeof owner !== "undefined") {
              return getComponentNameFromFiber(owner);
            }
          }
          return null;
        }
        function getCurrentFiberStackInDev() {
          {
            if (current === null) {
              return "";
            }
            return getStackByFiberInDevAndProd(current);
          }
        }
        function resetCurrentFiber() {
          {
            ReactDebugCurrentFrame.getCurrentStack = null;
            current = null;
            isRendering = false;
          }
        }
        function setCurrentFiber(fiber) {
          {
            ReactDebugCurrentFrame.getCurrentStack = fiber === null ? null : getCurrentFiberStackInDev;
            current = fiber;
            isRendering = false;
          }
        }
        function getCurrentFiber() {
          {
            return current;
          }
        }
        function setIsRendering(rendering) {
          {
            isRendering = rendering;
          }
        }
        function toString(value) {
          return "" + value;
        }
        function getToStringValue(value) {
          switch (typeof value) {
            case "boolean":
            case "number":
            case "string":
            case "undefined":
              return value;
            case "object":
              {
                checkFormFieldValueStringCoercion(value);
              }
              return value;
            default:
              return "";
          }
        }
        var hasReadOnlyValue = {
          button: true,
          checkbox: true,
          image: true,
          hidden: true,
          radio: true,
          reset: true,
          submit: true
        };
        function checkControlledValueProps(tagName, props) {
          {
            if (!(hasReadOnlyValue[props.type] || props.onChange || props.onInput || props.readOnly || props.disabled || props.value == null)) {
              error("You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`.");
            }
            if (!(props.onChange || props.readOnly || props.disabled || props.checked == null)) {
              error("You provided a `checked` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultChecked`. Otherwise, set either `onChange` or `readOnly`.");
            }
          }
        }
        function isCheckable(elem) {
          var type = elem.type;
          var nodeName = elem.nodeName;
          return nodeName && nodeName.toLowerCase() === "input" && (type === "checkbox" || type === "radio");
        }
        function getTracker(node) {
          return node._valueTracker;
        }
        function detachTracker(node) {
          node._valueTracker = null;
        }
        function getValueFromNode(node) {
          var value = "";
          if (!node) {
            return value;
          }
          if (isCheckable(node)) {
            value = node.checked ? "true" : "false";
          } else {
            value = node.value;
          }
          return value;
        }
        function trackValueOnNode(node) {
          var valueField = isCheckable(node) ? "checked" : "value";
          var descriptor = Object.getOwnPropertyDescriptor(node.constructor.prototype, valueField);
          {
            checkFormFieldValueStringCoercion(node[valueField]);
          }
          var currentValue = "" + node[valueField];
          if (node.hasOwnProperty(valueField) || typeof descriptor === "undefined" || typeof descriptor.get !== "function" || typeof descriptor.set !== "function") {
            return;
          }
          var get2 = descriptor.get, set2 = descriptor.set;
          Object.defineProperty(node, valueField, {
            configurable: true,
            get: function() {
              return get2.call(this);
            },
            set: function(value) {
              {
                checkFormFieldValueStringCoercion(value);
              }
              currentValue = "" + value;
              set2.call(this, value);
            }
          });
          Object.defineProperty(node, valueField, {
            enumerable: descriptor.enumerable
          });
          var tracker = {
            getValue: function() {
              return currentValue;
            },
            setValue: function(value) {
              {
                checkFormFieldValueStringCoercion(value);
              }
              currentValue = "" + value;
            },
            stopTracking: function() {
              detachTracker(node);
              delete node[valueField];
            }
          };
          return tracker;
        }
        function track(node) {
          if (getTracker(node)) {
            return;
          }
          node._valueTracker = trackValueOnNode(node);
        }
        function updateValueIfChanged(node) {
          if (!node) {
            return false;
          }
          var tracker = getTracker(node);
          if (!tracker) {
            return true;
          }
          var lastValue = tracker.getValue();
          var nextValue = getValueFromNode(node);
          if (nextValue !== lastValue) {
            tracker.setValue(nextValue);
            return true;
          }
          return false;
        }
        function getActiveElement(doc) {
          doc = doc || (typeof document !== "undefined" ? document : void 0);
          if (typeof doc === "undefined") {
            return null;
          }
          try {
            return doc.activeElement || doc.body;
          } catch (e) {
            return doc.body;
          }
        }
        var didWarnValueDefaultValue = false;
        var didWarnCheckedDefaultChecked = false;
        var didWarnControlledToUncontrolled = false;
        var didWarnUncontrolledToControlled = false;
        function isControlled(props) {
          var usesChecked = props.type === "checkbox" || props.type === "radio";
          return usesChecked ? props.checked != null : props.value != null;
        }
        function getHostProps(element, props) {
          var node = element;
          var checked = props.checked;
          var hostProps = assign({}, props, {
            defaultChecked: void 0,
            defaultValue: void 0,
            value: void 0,
            checked: checked != null ? checked : node._wrapperState.initialChecked
          });
          return hostProps;
        }
        function initWrapperState(element, props) {
          {
            checkControlledValueProps("input", props);
            if (props.checked !== void 0 && props.defaultChecked !== void 0 && !didWarnCheckedDefaultChecked) {
              error("%s contains an input of type %s with both checked and defaultChecked props. Input elements must be either controlled or uncontrolled (specify either the checked prop, or the defaultChecked prop, but not both). Decide between using a controlled or uncontrolled input element and remove one of these props. More info: https://reactjs.org/link/controlled-components", getCurrentFiberOwnerNameInDevOrNull() || "A component", props.type);
              didWarnCheckedDefaultChecked = true;
            }
            if (props.value !== void 0 && props.defaultValue !== void 0 && !didWarnValueDefaultValue) {
              error("%s contains an input of type %s with both value and defaultValue props. Input elements must be either controlled or uncontrolled (specify either the value prop, or the defaultValue prop, but not both). Decide between using a controlled or uncontrolled input element and remove one of these props. More info: https://reactjs.org/link/controlled-components", getCurrentFiberOwnerNameInDevOrNull() || "A component", props.type);
              didWarnValueDefaultValue = true;
            }
          }
          var node = element;
          var defaultValue = props.defaultValue == null ? "" : props.defaultValue;
          node._wrapperState = {
            initialChecked: props.checked != null ? props.checked : props.defaultChecked,
            initialValue: getToStringValue(props.value != null ? props.value : defaultValue),
            controlled: isControlled(props)
          };
        }
        function updateChecked(element, props) {
          var node = element;
          var checked = props.checked;
          if (checked != null) {
            setValueForProperty(node, "checked", checked, false);
          }
        }
        function updateWrapper(element, props) {
          var node = element;
          {
            var controlled = isControlled(props);
            if (!node._wrapperState.controlled && controlled && !didWarnUncontrolledToControlled) {
              error("A component is changing an uncontrolled input to be controlled. This is likely caused by the value changing from undefined to a defined value, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://reactjs.org/link/controlled-components");
              didWarnUncontrolledToControlled = true;
            }
            if (node._wrapperState.controlled && !controlled && !didWarnControlledToUncontrolled) {
              error("A component is changing a controlled input to be uncontrolled. This is likely caused by the value changing from a defined to undefined, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://reactjs.org/link/controlled-components");
              didWarnControlledToUncontrolled = true;
            }
          }
          updateChecked(element, props);
          var value = getToStringValue(props.value);
          var type = props.type;
          if (value != null) {
            if (type === "number") {
              if (value === 0 && node.value === "" || // We explicitly want to coerce to number here if possible.
              // eslint-disable-next-line
              node.value != value) {
                node.value = toString(value);
              }
            } else if (node.value !== toString(value)) {
              node.value = toString(value);
            }
          } else if (type === "submit" || type === "reset") {
            node.removeAttribute("value");
            return;
          }
          {
            if (props.hasOwnProperty("value")) {
              setDefaultValue(node, props.type, value);
            } else if (props.hasOwnProperty("defaultValue")) {
              setDefaultValue(node, props.type, getToStringValue(props.defaultValue));
            }
          }
          {
            if (props.checked == null && props.defaultChecked != null) {
              node.defaultChecked = !!props.defaultChecked;
            }
          }
        }
        function postMountWrapper(element, props, isHydrating2) {
          var node = element;
          if (props.hasOwnProperty("value") || props.hasOwnProperty("defaultValue")) {
            var type = props.type;
            var isButton = type === "submit" || type === "reset";
            if (isButton && (props.value === void 0 || props.value === null)) {
              return;
            }
            var initialValue = toString(node._wrapperState.initialValue);
            if (!isHydrating2) {
              {
                if (initialValue !== node.value) {
                  node.value = initialValue;
                }
              }
            }
            {
              node.defaultValue = initialValue;
            }
          }
          var name = node.name;
          if (name !== "") {
            node.name = "";
          }
          {
            node.defaultChecked = !node.defaultChecked;
            node.defaultChecked = !!node._wrapperState.initialChecked;
          }
          if (name !== "") {
            node.name = name;
          }
        }
        function restoreControlledState(element, props) {
          var node = element;
          updateWrapper(node, props);
          updateNamedCousins(node, props);
        }
        function updateNamedCousins(rootNode, props) {
          var name = props.name;
          if (props.type === "radio" && name != null) {
            var queryRoot = rootNode;
            while (queryRoot.parentNode) {
              queryRoot = queryRoot.parentNode;
            }
            {
              checkAttributeStringCoercion(name, "name");
            }
            var group = queryRoot.querySelectorAll("input[name=" + JSON.stringify("" + name) + '][type="radio"]');
            for (var i2 = 0; i2 < group.length; i2++) {
              var otherNode = group[i2];
              if (otherNode === rootNode || otherNode.form !== rootNode.form) {
                continue;
              }
              var otherProps = getFiberCurrentPropsFromNode(otherNode);
              if (!otherProps) {
                throw new Error("ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported.");
              }
              updateValueIfChanged(otherNode);
              updateWrapper(otherNode, otherProps);
            }
          }
        }
        function setDefaultValue(node, type, value) {
          if (
            // Focused number inputs synchronize on blur. See ChangeEventPlugin.js
            type !== "number" || getActiveElement(node.ownerDocument) !== node
          ) {
            if (value == null) {
              node.defaultValue = toString(node._wrapperState.initialValue);
            } else if (node.defaultValue !== toString(value)) {
              node.defaultValue = toString(value);
            }
          }
        }
        var didWarnSelectedSetOnOption = false;
        var didWarnInvalidChild = false;
        var didWarnInvalidInnerHTML = false;
        function validateProps(element, props) {
          {
            if (props.value == null) {
              if (typeof props.children === "object" && props.children !== null) {
                React66.Children.forEach(props.children, function(child) {
                  if (child == null) {
                    return;
                  }
                  if (typeof child === "string" || typeof child === "number") {
                    return;
                  }
                  if (!didWarnInvalidChild) {
                    didWarnInvalidChild = true;
                    error("Cannot infer the option value of complex children. Pass a `value` prop or use a plain string as children to <option>.");
                  }
                });
              } else if (props.dangerouslySetInnerHTML != null) {
                if (!didWarnInvalidInnerHTML) {
                  didWarnInvalidInnerHTML = true;
                  error("Pass a `value` prop if you set dangerouslyInnerHTML so React knows which value should be selected.");
                }
              }
            }
            if (props.selected != null && !didWarnSelectedSetOnOption) {
              error("Use the `defaultValue` or `value` props on <select> instead of setting `selected` on <option>.");
              didWarnSelectedSetOnOption = true;
            }
          }
        }
        function postMountWrapper$1(element, props) {
          if (props.value != null) {
            element.setAttribute("value", toString(getToStringValue(props.value)));
          }
        }
        var isArrayImpl = Array.isArray;
        function isArray(a2) {
          return isArrayImpl(a2);
        }
        var didWarnValueDefaultValue$1;
        {
          didWarnValueDefaultValue$1 = false;
        }
        function getDeclarationErrorAddendum() {
          var ownerName = getCurrentFiberOwnerNameInDevOrNull();
          if (ownerName) {
            return "\n\nCheck the render method of `" + ownerName + "`.";
          }
          return "";
        }
        var valuePropNames = ["value", "defaultValue"];
        function checkSelectPropTypes(props) {
          {
            checkControlledValueProps("select", props);
            for (var i2 = 0; i2 < valuePropNames.length; i2++) {
              var propName = valuePropNames[i2];
              if (props[propName] == null) {
                continue;
              }
              var propNameIsArray = isArray(props[propName]);
              if (props.multiple && !propNameIsArray) {
                error("The `%s` prop supplied to <select> must be an array if `multiple` is true.%s", propName, getDeclarationErrorAddendum());
              } else if (!props.multiple && propNameIsArray) {
                error("The `%s` prop supplied to <select> must be a scalar value if `multiple` is false.%s", propName, getDeclarationErrorAddendum());
              }
            }
          }
        }
        function updateOptions(node, multiple, propValue, setDefaultSelected) {
          var options2 = node.options;
          if (multiple) {
            var selectedValues = propValue;
            var selectedValue = {};
            for (var i2 = 0; i2 < selectedValues.length; i2++) {
              selectedValue["$" + selectedValues[i2]] = true;
            }
            for (var _i = 0; _i < options2.length; _i++) {
              var selected = selectedValue.hasOwnProperty("$" + options2[_i].value);
              if (options2[_i].selected !== selected) {
                options2[_i].selected = selected;
              }
              if (selected && setDefaultSelected) {
                options2[_i].defaultSelected = true;
              }
            }
          } else {
            var _selectedValue = toString(getToStringValue(propValue));
            var defaultSelected = null;
            for (var _i2 = 0; _i2 < options2.length; _i2++) {
              if (options2[_i2].value === _selectedValue) {
                options2[_i2].selected = true;
                if (setDefaultSelected) {
                  options2[_i2].defaultSelected = true;
                }
                return;
              }
              if (defaultSelected === null && !options2[_i2].disabled) {
                defaultSelected = options2[_i2];
              }
            }
            if (defaultSelected !== null) {
              defaultSelected.selected = true;
            }
          }
        }
        function getHostProps$1(element, props) {
          return assign({}, props, {
            value: void 0
          });
        }
        function initWrapperState$1(element, props) {
          var node = element;
          {
            checkSelectPropTypes(props);
          }
          node._wrapperState = {
            wasMultiple: !!props.multiple
          };
          {
            if (props.value !== void 0 && props.defaultValue !== void 0 && !didWarnValueDefaultValue$1) {
              error("Select elements must be either controlled or uncontrolled (specify either the value prop, or the defaultValue prop, but not both). Decide between using a controlled or uncontrolled select element and remove one of these props. More info: https://reactjs.org/link/controlled-components");
              didWarnValueDefaultValue$1 = true;
            }
          }
        }
        function postMountWrapper$2(element, props) {
          var node = element;
          node.multiple = !!props.multiple;
          var value = props.value;
          if (value != null) {
            updateOptions(node, !!props.multiple, value, false);
          } else if (props.defaultValue != null) {
            updateOptions(node, !!props.multiple, props.defaultValue, true);
          }
        }
        function postUpdateWrapper(element, props) {
          var node = element;
          var wasMultiple = node._wrapperState.wasMultiple;
          node._wrapperState.wasMultiple = !!props.multiple;
          var value = props.value;
          if (value != null) {
            updateOptions(node, !!props.multiple, value, false);
          } else if (wasMultiple !== !!props.multiple) {
            if (props.defaultValue != null) {
              updateOptions(node, !!props.multiple, props.defaultValue, true);
            } else {
              updateOptions(node, !!props.multiple, props.multiple ? [] : "", false);
            }
          }
        }
        function restoreControlledState$1(element, props) {
          var node = element;
          var value = props.value;
          if (value != null) {
            updateOptions(node, !!props.multiple, value, false);
          }
        }
        var didWarnValDefaultVal = false;
        function getHostProps$2(element, props) {
          var node = element;
          if (props.dangerouslySetInnerHTML != null) {
            throw new Error("`dangerouslySetInnerHTML` does not make sense on <textarea>.");
          }
          var hostProps = assign({}, props, {
            value: void 0,
            defaultValue: void 0,
            children: toString(node._wrapperState.initialValue)
          });
          return hostProps;
        }
        function initWrapperState$2(element, props) {
          var node = element;
          {
            checkControlledValueProps("textarea", props);
            if (props.value !== void 0 && props.defaultValue !== void 0 && !didWarnValDefaultVal) {
              error("%s contains a textarea with both value and defaultValue props. Textarea elements must be either controlled or uncontrolled (specify either the value prop, or the defaultValue prop, but not both). Decide between using a controlled or uncontrolled textarea and remove one of these props. More info: https://reactjs.org/link/controlled-components", getCurrentFiberOwnerNameInDevOrNull() || "A component");
              didWarnValDefaultVal = true;
            }
          }
          var initialValue = props.value;
          if (initialValue == null) {
            var children = props.children, defaultValue = props.defaultValue;
            if (children != null) {
              {
                error("Use the `defaultValue` or `value` props instead of setting children on <textarea>.");
              }
              {
                if (defaultValue != null) {
                  throw new Error("If you supply `defaultValue` on a <textarea>, do not pass children.");
                }
                if (isArray(children)) {
                  if (children.length > 1) {
                    throw new Error("<textarea> can only have at most one child.");
                  }
                  children = children[0];
                }
                defaultValue = children;
              }
            }
            if (defaultValue == null) {
              defaultValue = "";
            }
            initialValue = defaultValue;
          }
          node._wrapperState = {
            initialValue: getToStringValue(initialValue)
          };
        }
        function updateWrapper$1(element, props) {
          var node = element;
          var value = getToStringValue(props.value);
          var defaultValue = getToStringValue(props.defaultValue);
          if (value != null) {
            var newValue = toString(value);
            if (newValue !== node.value) {
              node.value = newValue;
            }
            if (props.defaultValue == null && node.defaultValue !== newValue) {
              node.defaultValue = newValue;
            }
          }
          if (defaultValue != null) {
            node.defaultValue = toString(defaultValue);
          }
        }
        function postMountWrapper$3(element, props) {
          var node = element;
          var textContent2 = node.textContent;
          if (textContent2 === node._wrapperState.initialValue) {
            if (textContent2 !== "" && textContent2 !== null) {
              node.value = textContent2;
            }
          }
        }
        function restoreControlledState$2(element, props) {
          updateWrapper$1(element, props);
        }
        var HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
        var MATH_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
        var SVG_NAMESPACE = "http://www.w3.org/2000/svg";
        function getIntrinsicNamespace(type) {
          switch (type) {
            case "svg":
              return SVG_NAMESPACE;
            case "math":
              return MATH_NAMESPACE;
            default:
              return HTML_NAMESPACE;
          }
        }
        function getChildNamespace(parentNamespace, type) {
          if (parentNamespace == null || parentNamespace === HTML_NAMESPACE) {
            return getIntrinsicNamespace(type);
          }
          if (parentNamespace === SVG_NAMESPACE && type === "foreignObject") {
            return HTML_NAMESPACE;
          }
          return parentNamespace;
        }
        var createMicrosoftUnsafeLocalFunction = function(func) {
          if (typeof MSApp !== "undefined" && MSApp.execUnsafeLocalFunction) {
            return function(arg0, arg1, arg2, arg3) {
              MSApp.execUnsafeLocalFunction(function() {
                return func(arg0, arg1, arg2, arg3);
              });
            };
          } else {
            return func;
          }
        };
        var reusableSVGContainer;
        var setInnerHTML = createMicrosoftUnsafeLocalFunction(function(node, html) {
          if (node.namespaceURI === SVG_NAMESPACE) {
            if (!("innerHTML" in node)) {
              reusableSVGContainer = reusableSVGContainer || document.createElement("div");
              reusableSVGContainer.innerHTML = "<svg>" + html.valueOf().toString() + "</svg>";
              var svgNode = reusableSVGContainer.firstChild;
              while (node.firstChild) {
                node.removeChild(node.firstChild);
              }
              while (svgNode.firstChild) {
                node.appendChild(svgNode.firstChild);
              }
              return;
            }
          }
          node.innerHTML = html;
        });
        var ELEMENT_NODE = 1;
        var TEXT_NODE = 3;
        var COMMENT_NODE = 8;
        var DOCUMENT_NODE = 9;
        var DOCUMENT_FRAGMENT_NODE = 11;
        var setTextContent = function(node, text) {
          if (text) {
            var firstChild = node.firstChild;
            if (firstChild && firstChild === node.lastChild && firstChild.nodeType === TEXT_NODE) {
              firstChild.nodeValue = text;
              return;
            }
          }
          node.textContent = text;
        };
        var shorthandToLonghand = {
          animation: ["animationDelay", "animationDirection", "animationDuration", "animationFillMode", "animationIterationCount", "animationName", "animationPlayState", "animationTimingFunction"],
          background: ["backgroundAttachment", "backgroundClip", "backgroundColor", "backgroundImage", "backgroundOrigin", "backgroundPositionX", "backgroundPositionY", "backgroundRepeat", "backgroundSize"],
          backgroundPosition: ["backgroundPositionX", "backgroundPositionY"],
          border: ["borderBottomColor", "borderBottomStyle", "borderBottomWidth", "borderImageOutset", "borderImageRepeat", "borderImageSlice", "borderImageSource", "borderImageWidth", "borderLeftColor", "borderLeftStyle", "borderLeftWidth", "borderRightColor", "borderRightStyle", "borderRightWidth", "borderTopColor", "borderTopStyle", "borderTopWidth"],
          borderBlockEnd: ["borderBlockEndColor", "borderBlockEndStyle", "borderBlockEndWidth"],
          borderBlockStart: ["borderBlockStartColor", "borderBlockStartStyle", "borderBlockStartWidth"],
          borderBottom: ["borderBottomColor", "borderBottomStyle", "borderBottomWidth"],
          borderColor: ["borderBottomColor", "borderLeftColor", "borderRightColor", "borderTopColor"],
          borderImage: ["borderImageOutset", "borderImageRepeat", "borderImageSlice", "borderImageSource", "borderImageWidth"],
          borderInlineEnd: ["borderInlineEndColor", "borderInlineEndStyle", "borderInlineEndWidth"],
          borderInlineStart: ["borderInlineStartColor", "borderInlineStartStyle", "borderInlineStartWidth"],
          borderLeft: ["borderLeftColor", "borderLeftStyle", "borderLeftWidth"],
          borderRadius: ["borderBottomLeftRadius", "borderBottomRightRadius", "borderTopLeftRadius", "borderTopRightRadius"],
          borderRight: ["borderRightColor", "borderRightStyle", "borderRightWidth"],
          borderStyle: ["borderBottomStyle", "borderLeftStyle", "borderRightStyle", "borderTopStyle"],
          borderTop: ["borderTopColor", "borderTopStyle", "borderTopWidth"],
          borderWidth: ["borderBottomWidth", "borderLeftWidth", "borderRightWidth", "borderTopWidth"],
          columnRule: ["columnRuleColor", "columnRuleStyle", "columnRuleWidth"],
          columns: ["columnCount", "columnWidth"],
          flex: ["flexBasis", "flexGrow", "flexShrink"],
          flexFlow: ["flexDirection", "flexWrap"],
          font: ["fontFamily", "fontFeatureSettings", "fontKerning", "fontLanguageOverride", "fontSize", "fontSizeAdjust", "fontStretch", "fontStyle", "fontVariant", "fontVariantAlternates", "fontVariantCaps", "fontVariantEastAsian", "fontVariantLigatures", "fontVariantNumeric", "fontVariantPosition", "fontWeight", "lineHeight"],
          fontVariant: ["fontVariantAlternates", "fontVariantCaps", "fontVariantEastAsian", "fontVariantLigatures", "fontVariantNumeric", "fontVariantPosition"],
          gap: ["columnGap", "rowGap"],
          grid: ["gridAutoColumns", "gridAutoFlow", "gridAutoRows", "gridTemplateAreas", "gridTemplateColumns", "gridTemplateRows"],
          gridArea: ["gridColumnEnd", "gridColumnStart", "gridRowEnd", "gridRowStart"],
          gridColumn: ["gridColumnEnd", "gridColumnStart"],
          gridColumnGap: ["columnGap"],
          gridGap: ["columnGap", "rowGap"],
          gridRow: ["gridRowEnd", "gridRowStart"],
          gridRowGap: ["rowGap"],
          gridTemplate: ["gridTemplateAreas", "gridTemplateColumns", "gridTemplateRows"],
          listStyle: ["listStyleImage", "listStylePosition", "listStyleType"],
          margin: ["marginBottom", "marginLeft", "marginRight", "marginTop"],
          marker: ["markerEnd", "markerMid", "markerStart"],
          mask: ["maskClip", "maskComposite", "maskImage", "maskMode", "maskOrigin", "maskPositionX", "maskPositionY", "maskRepeat", "maskSize"],
          maskPosition: ["maskPositionX", "maskPositionY"],
          outline: ["outlineColor", "outlineStyle", "outlineWidth"],
          overflow: ["overflowX", "overflowY"],
          padding: ["paddingBottom", "paddingLeft", "paddingRight", "paddingTop"],
          placeContent: ["alignContent", "justifyContent"],
          placeItems: ["alignItems", "justifyItems"],
          placeSelf: ["alignSelf", "justifySelf"],
          textDecoration: ["textDecorationColor", "textDecorationLine", "textDecorationStyle"],
          textEmphasis: ["textEmphasisColor", "textEmphasisStyle"],
          transition: ["transitionDelay", "transitionDuration", "transitionProperty", "transitionTimingFunction"],
          wordWrap: ["overflowWrap"]
        };
        var isUnitlessNumber = {
          animationIterationCount: true,
          aspectRatio: true,
          borderImageOutset: true,
          borderImageSlice: true,
          borderImageWidth: true,
          boxFlex: true,
          boxFlexGroup: true,
          boxOrdinalGroup: true,
          columnCount: true,
          columns: true,
          flex: true,
          flexGrow: true,
          flexPositive: true,
          flexShrink: true,
          flexNegative: true,
          flexOrder: true,
          gridArea: true,
          gridRow: true,
          gridRowEnd: true,
          gridRowSpan: true,
          gridRowStart: true,
          gridColumn: true,
          gridColumnEnd: true,
          gridColumnSpan: true,
          gridColumnStart: true,
          fontWeight: true,
          lineClamp: true,
          lineHeight: true,
          opacity: true,
          order: true,
          orphans: true,
          tabSize: true,
          widows: true,
          zIndex: true,
          zoom: true,
          // SVG-related properties
          fillOpacity: true,
          floodOpacity: true,
          stopOpacity: true,
          strokeDasharray: true,
          strokeDashoffset: true,
          strokeMiterlimit: true,
          strokeOpacity: true,
          strokeWidth: true
        };
        function prefixKey(prefix3, key) {
          return prefix3 + key.charAt(0).toUpperCase() + key.substring(1);
        }
        var prefixes = ["Webkit", "ms", "Moz", "O"];
        Object.keys(isUnitlessNumber).forEach(function(prop) {
          prefixes.forEach(function(prefix3) {
            isUnitlessNumber[prefixKey(prefix3, prop)] = isUnitlessNumber[prop];
          });
        });
        function dangerousStyleValue(name, value, isCustomProperty) {
          var isEmpty = value == null || typeof value === "boolean" || value === "";
          if (isEmpty) {
            return "";
          }
          if (!isCustomProperty && typeof value === "number" && value !== 0 && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) {
            return value + "px";
          }
          {
            checkCSSPropertyStringCoercion(value, name);
          }
          return ("" + value).trim();
        }
        var uppercasePattern = /([A-Z])/g;
        var msPattern = /^ms-/;
        function hyphenateStyleName(name) {
          return name.replace(uppercasePattern, "-$1").toLowerCase().replace(msPattern, "-ms-");
        }
        var warnValidStyle = function() {
        };
        {
          var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
          var msPattern$1 = /^-ms-/;
          var hyphenPattern = /-(.)/g;
          var badStyleValueWithSemicolonPattern = /;\s*$/;
          var warnedStyleNames = {};
          var warnedStyleValues = {};
          var warnedForNaNValue = false;
          var warnedForInfinityValue = false;
          var camelize = function(string) {
            return string.replace(hyphenPattern, function(_7, character) {
              return character.toUpperCase();
            });
          };
          var warnHyphenatedStyleName = function(name) {
            if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
              return;
            }
            warnedStyleNames[name] = true;
            error(
              "Unsupported style property %s. Did you mean %s?",
              name,
              // As Andi Smith suggests
              // (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
              // is converted to lowercase `ms`.
              camelize(name.replace(msPattern$1, "ms-"))
            );
          };
          var warnBadVendoredStyleName = function(name) {
            if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
              return;
            }
            warnedStyleNames[name] = true;
            error("Unsupported vendor-prefixed style property %s. Did you mean %s?", name, name.charAt(0).toUpperCase() + name.slice(1));
          };
          var warnStyleValueWithSemicolon = function(name, value) {
            if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
              return;
            }
            warnedStyleValues[value] = true;
            error(`Style property values shouldn't contain a semicolon. Try "%s: %s" instead.`, name, value.replace(badStyleValueWithSemicolonPattern, ""));
          };
          var warnStyleValueIsNaN = function(name, value) {
            if (warnedForNaNValue) {
              return;
            }
            warnedForNaNValue = true;
            error("`NaN` is an invalid value for the `%s` css style property.", name);
          };
          var warnStyleValueIsInfinity = function(name, value) {
            if (warnedForInfinityValue) {
              return;
            }
            warnedForInfinityValue = true;
            error("`Infinity` is an invalid value for the `%s` css style property.", name);
          };
          warnValidStyle = function(name, value) {
            if (name.indexOf("-") > -1) {
              warnHyphenatedStyleName(name);
            } else if (badVendoredStyleNamePattern.test(name)) {
              warnBadVendoredStyleName(name);
            } else if (badStyleValueWithSemicolonPattern.test(value)) {
              warnStyleValueWithSemicolon(name, value);
            }
            if (typeof value === "number") {
              if (isNaN(value)) {
                warnStyleValueIsNaN(name, value);
              } else if (!isFinite(value)) {
                warnStyleValueIsInfinity(name, value);
              }
            }
          };
        }
        var warnValidStyle$1 = warnValidStyle;
        function createDangerousStringForStyles(styles) {
          {
            var serialized = "";
            var delimiter = "";
            for (var styleName in styles) {
              if (!styles.hasOwnProperty(styleName)) {
                continue;
              }
              var styleValue = styles[styleName];
              if (styleValue != null) {
                var isCustomProperty = styleName.indexOf("--") === 0;
                serialized += delimiter + (isCustomProperty ? styleName : hyphenateStyleName(styleName)) + ":";
                serialized += dangerousStyleValue(styleName, styleValue, isCustomProperty);
                delimiter = ";";
              }
            }
            return serialized || null;
          }
        }
        function setValueForStyles(node, styles) {
          var style2 = node.style;
          for (var styleName in styles) {
            if (!styles.hasOwnProperty(styleName)) {
              continue;
            }
            var isCustomProperty = styleName.indexOf("--") === 0;
            {
              if (!isCustomProperty) {
                warnValidStyle$1(styleName, styles[styleName]);
              }
            }
            var styleValue = dangerousStyleValue(styleName, styles[styleName], isCustomProperty);
            if (styleName === "float") {
              styleName = "cssFloat";
            }
            if (isCustomProperty) {
              style2.setProperty(styleName, styleValue);
            } else {
              style2[styleName] = styleValue;
            }
          }
        }
        function isValueEmpty(value) {
          return value == null || typeof value === "boolean" || value === "";
        }
        function expandShorthandMap(styles) {
          var expanded = {};
          for (var key in styles) {
            var longhands = shorthandToLonghand[key] || [key];
            for (var i2 = 0; i2 < longhands.length; i2++) {
              expanded[longhands[i2]] = key;
            }
          }
          return expanded;
        }
        function validateShorthandPropertyCollisionInDev(styleUpdates, nextStyles) {
          {
            if (!nextStyles) {
              return;
            }
            var expandedUpdates = expandShorthandMap(styleUpdates);
            var expandedStyles = expandShorthandMap(nextStyles);
            var warnedAbout = {};
            for (var key in expandedUpdates) {
              var originalKey = expandedUpdates[key];
              var correctOriginalKey = expandedStyles[key];
              if (correctOriginalKey && originalKey !== correctOriginalKey) {
                var warningKey = originalKey + "," + correctOriginalKey;
                if (warnedAbout[warningKey]) {
                  continue;
                }
                warnedAbout[warningKey] = true;
                error("%s a style property during rerender (%s) when a conflicting property is set (%s) can lead to styling bugs. To avoid this, don't mix shorthand and non-shorthand properties for the same value; instead, replace the shorthand with separate values.", isValueEmpty(styleUpdates[originalKey]) ? "Removing" : "Updating", originalKey, correctOriginalKey);
              }
            }
          }
        }
        var omittedCloseTags = {
          area: true,
          base: true,
          br: true,
          col: true,
          embed: true,
          hr: true,
          img: true,
          input: true,
          keygen: true,
          link: true,
          meta: true,
          param: true,
          source: true,
          track: true,
          wbr: true
          // NOTE: menuitem's close tag should be omitted, but that causes problems.
        };
        var voidElementTags = assign({
          menuitem: true
        }, omittedCloseTags);
        var HTML = "__html";
        function assertValidProps(tag, props) {
          if (!props) {
            return;
          }
          if (voidElementTags[tag]) {
            if (props.children != null || props.dangerouslySetInnerHTML != null) {
              throw new Error(tag + " is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.");
            }
          }
          if (props.dangerouslySetInnerHTML != null) {
            if (props.children != null) {
              throw new Error("Can only set one of `children` or `props.dangerouslySetInnerHTML`.");
            }
            if (typeof props.dangerouslySetInnerHTML !== "object" || !(HTML in props.dangerouslySetInnerHTML)) {
              throw new Error("`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://reactjs.org/link/dangerously-set-inner-html for more information.");
            }
          }
          {
            if (!props.suppressContentEditableWarning && props.contentEditable && props.children != null) {
              error("A component is `contentEditable` and contains `children` managed by React. It is now your responsibility to guarantee that none of those nodes are unexpectedly modified or duplicated. This is probably not intentional.");
            }
          }
          if (props.style != null && typeof props.style !== "object") {
            throw new Error("The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX.");
          }
        }
        function isCustomComponent(tagName, props) {
          if (tagName.indexOf("-") === -1) {
            return typeof props.is === "string";
          }
          switch (tagName) {
            case "annotation-xml":
            case "color-profile":
            case "font-face":
            case "font-face-src":
            case "font-face-uri":
            case "font-face-format":
            case "font-face-name":
            case "missing-glyph":
              return false;
            default:
              return true;
          }
        }
        var possibleStandardNames = {
          // HTML
          accept: "accept",
          acceptcharset: "acceptCharset",
          "accept-charset": "acceptCharset",
          accesskey: "accessKey",
          action: "action",
          allowfullscreen: "allowFullScreen",
          alt: "alt",
          as: "as",
          async: "async",
          autocapitalize: "autoCapitalize",
          autocomplete: "autoComplete",
          autocorrect: "autoCorrect",
          autofocus: "autoFocus",
          autoplay: "autoPlay",
          autosave: "autoSave",
          capture: "capture",
          cellpadding: "cellPadding",
          cellspacing: "cellSpacing",
          challenge: "challenge",
          charset: "charSet",
          checked: "checked",
          children: "children",
          cite: "cite",
          class: "className",
          classid: "classID",
          classname: "className",
          cols: "cols",
          colspan: "colSpan",
          content: "content",
          contenteditable: "contentEditable",
          contextmenu: "contextMenu",
          controls: "controls",
          controlslist: "controlsList",
          coords: "coords",
          crossorigin: "crossOrigin",
          dangerouslysetinnerhtml: "dangerouslySetInnerHTML",
          data: "data",
          datetime: "dateTime",
          default: "default",
          defaultchecked: "defaultChecked",
          defaultvalue: "defaultValue",
          defer: "defer",
          dir: "dir",
          disabled: "disabled",
          disablepictureinpicture: "disablePictureInPicture",
          disableremoteplayback: "disableRemotePlayback",
          download: "download",
          draggable: "draggable",
          enctype: "encType",
          enterkeyhint: "enterKeyHint",
          for: "htmlFor",
          form: "form",
          formmethod: "formMethod",
          formaction: "formAction",
          formenctype: "formEncType",
          formnovalidate: "formNoValidate",
          formtarget: "formTarget",
          frameborder: "frameBorder",
          headers: "headers",
          height: "height",
          hidden: "hidden",
          high: "high",
          href: "href",
          hreflang: "hrefLang",
          htmlfor: "htmlFor",
          httpequiv: "httpEquiv",
          "http-equiv": "httpEquiv",
          icon: "icon",
          id: "id",
          imagesizes: "imageSizes",
          imagesrcset: "imageSrcSet",
          innerhtml: "innerHTML",
          inputmode: "inputMode",
          integrity: "integrity",
          is: "is",
          itemid: "itemID",
          itemprop: "itemProp",
          itemref: "itemRef",
          itemscope: "itemScope",
          itemtype: "itemType",
          keyparams: "keyParams",
          keytype: "keyType",
          kind: "kind",
          label: "label",
          lang: "lang",
          list: "list",
          loop: "loop",
          low: "low",
          manifest: "manifest",
          marginwidth: "marginWidth",
          marginheight: "marginHeight",
          max: "max",
          maxlength: "maxLength",
          media: "media",
          mediagroup: "mediaGroup",
          method: "method",
          min: "min",
          minlength: "minLength",
          multiple: "multiple",
          muted: "muted",
          name: "name",
          nomodule: "noModule",
          nonce: "nonce",
          novalidate: "noValidate",
          open: "open",
          optimum: "optimum",
          pattern: "pattern",
          placeholder: "placeholder",
          playsinline: "playsInline",
          poster: "poster",
          preload: "preload",
          profile: "profile",
          radiogroup: "radioGroup",
          readonly: "readOnly",
          referrerpolicy: "referrerPolicy",
          rel: "rel",
          required: "required",
          reversed: "reversed",
          role: "role",
          rows: "rows",
          rowspan: "rowSpan",
          sandbox: "sandbox",
          scope: "scope",
          scoped: "scoped",
          scrolling: "scrolling",
          seamless: "seamless",
          selected: "selected",
          shape: "shape",
          size: "size",
          sizes: "sizes",
          span: "span",
          spellcheck: "spellCheck",
          src: "src",
          srcdoc: "srcDoc",
          srclang: "srcLang",
          srcset: "srcSet",
          start: "start",
          step: "step",
          style: "style",
          summary: "summary",
          tabindex: "tabIndex",
          target: "target",
          title: "title",
          type: "type",
          usemap: "useMap",
          value: "value",
          width: "width",
          wmode: "wmode",
          wrap: "wrap",
          // SVG
          about: "about",
          accentheight: "accentHeight",
          "accent-height": "accentHeight",
          accumulate: "accumulate",
          additive: "additive",
          alignmentbaseline: "alignmentBaseline",
          "alignment-baseline": "alignmentBaseline",
          allowreorder: "allowReorder",
          alphabetic: "alphabetic",
          amplitude: "amplitude",
          arabicform: "arabicForm",
          "arabic-form": "arabicForm",
          ascent: "ascent",
          attributename: "attributeName",
          attributetype: "attributeType",
          autoreverse: "autoReverse",
          azimuth: "azimuth",
          basefrequency: "baseFrequency",
          baselineshift: "baselineShift",
          "baseline-shift": "baselineShift",
          baseprofile: "baseProfile",
          bbox: "bbox",
          begin: "begin",
          bias: "bias",
          by: "by",
          calcmode: "calcMode",
          capheight: "capHeight",
          "cap-height": "capHeight",
          clip: "clip",
          clippath: "clipPath",
          "clip-path": "clipPath",
          clippathunits: "clipPathUnits",
          cliprule: "clipRule",
          "clip-rule": "clipRule",
          color: "color",
          colorinterpolation: "colorInterpolation",
          "color-interpolation": "colorInterpolation",
          colorinterpolationfilters: "colorInterpolationFilters",
          "color-interpolation-filters": "colorInterpolationFilters",
          colorprofile: "colorProfile",
          "color-profile": "colorProfile",
          colorrendering: "colorRendering",
          "color-rendering": "colorRendering",
          contentscripttype: "contentScriptType",
          contentstyletype: "contentStyleType",
          cursor: "cursor",
          cx: "cx",
          cy: "cy",
          d: "d",
          datatype: "datatype",
          decelerate: "decelerate",
          descent: "descent",
          diffuseconstant: "diffuseConstant",
          direction: "direction",
          display: "display",
          divisor: "divisor",
          dominantbaseline: "dominantBaseline",
          "dominant-baseline": "dominantBaseline",
          dur: "dur",
          dx: "dx",
          dy: "dy",
          edgemode: "edgeMode",
          elevation: "elevation",
          enablebackground: "enableBackground",
          "enable-background": "enableBackground",
          end: "end",
          exponent: "exponent",
          externalresourcesrequired: "externalResourcesRequired",
          fill: "fill",
          fillopacity: "fillOpacity",
          "fill-opacity": "fillOpacity",
          fillrule: "fillRule",
          "fill-rule": "fillRule",
          filter: "filter",
          filterres: "filterRes",
          filterunits: "filterUnits",
          floodopacity: "floodOpacity",
          "flood-opacity": "floodOpacity",
          floodcolor: "floodColor",
          "flood-color": "floodColor",
          focusable: "focusable",
          fontfamily: "fontFamily",
          "font-family": "fontFamily",
          fontsize: "fontSize",
          "font-size": "fontSize",
          fontsizeadjust: "fontSizeAdjust",
          "font-size-adjust": "fontSizeAdjust",
          fontstretch: "fontStretch",
          "font-stretch": "fontStretch",
          fontstyle: "fontStyle",
          "font-style": "fontStyle",
          fontvariant: "fontVariant",
          "font-variant": "fontVariant",
          fontweight: "fontWeight",
          "font-weight": "fontWeight",
          format: "format",
          from: "from",
          fx: "fx",
          fy: "fy",
          g1: "g1",
          g2: "g2",
          glyphname: "glyphName",
          "glyph-name": "glyphName",
          glyphorientationhorizontal: "glyphOrientationHorizontal",
          "glyph-orientation-horizontal": "glyphOrientationHorizontal",
          glyphorientationvertical: "glyphOrientationVertical",
          "glyph-orientation-vertical": "glyphOrientationVertical",
          glyphref: "glyphRef",
          gradienttransform: "gradientTransform",
          gradientunits: "gradientUnits",
          hanging: "hanging",
          horizadvx: "horizAdvX",
          "horiz-adv-x": "horizAdvX",
          horizoriginx: "horizOriginX",
          "horiz-origin-x": "horizOriginX",
          ideographic: "ideographic",
          imagerendering: "imageRendering",
          "image-rendering": "imageRendering",
          in2: "in2",
          in: "in",
          inlist: "inlist",
          intercept: "intercept",
          k1: "k1",
          k2: "k2",
          k3: "k3",
          k4: "k4",
          k: "k",
          kernelmatrix: "kernelMatrix",
          kernelunitlength: "kernelUnitLength",
          kerning: "kerning",
          keypoints: "keyPoints",
          keysplines: "keySplines",
          keytimes: "keyTimes",
          lengthadjust: "lengthAdjust",
          letterspacing: "letterSpacing",
          "letter-spacing": "letterSpacing",
          lightingcolor: "lightingColor",
          "lighting-color": "lightingColor",
          limitingconeangle: "limitingConeAngle",
          local: "local",
          markerend: "markerEnd",
          "marker-end": "markerEnd",
          markerheight: "markerHeight",
          markermid: "markerMid",
          "marker-mid": "markerMid",
          markerstart: "markerStart",
          "marker-start": "markerStart",
          markerunits: "markerUnits",
          markerwidth: "markerWidth",
          mask: "mask",
          maskcontentunits: "maskContentUnits",
          maskunits: "maskUnits",
          mathematical: "mathematical",
          mode: "mode",
          numoctaves: "numOctaves",
          offset: "offset",
          opacity: "opacity",
          operator: "operator",
          order: "order",
          orient: "orient",
          orientation: "orientation",
          origin: "origin",
          overflow: "overflow",
          overlineposition: "overlinePosition",
          "overline-position": "overlinePosition",
          overlinethickness: "overlineThickness",
          "overline-thickness": "overlineThickness",
          paintorder: "paintOrder",
          "paint-order": "paintOrder",
          panose1: "panose1",
          "panose-1": "panose1",
          pathlength: "pathLength",
          patterncontentunits: "patternContentUnits",
          patterntransform: "patternTransform",
          patternunits: "patternUnits",
          pointerevents: "pointerEvents",
          "pointer-events": "pointerEvents",
          points: "points",
          pointsatx: "pointsAtX",
          pointsaty: "pointsAtY",
          pointsatz: "pointsAtZ",
          prefix: "prefix",
          preservealpha: "preserveAlpha",
          preserveaspectratio: "preserveAspectRatio",
          primitiveunits: "primitiveUnits",
          property: "property",
          r: "r",
          radius: "radius",
          refx: "refX",
          refy: "refY",
          renderingintent: "renderingIntent",
          "rendering-intent": "renderingIntent",
          repeatcount: "repeatCount",
          repeatdur: "repeatDur",
          requiredextensions: "requiredExtensions",
          requiredfeatures: "requiredFeatures",
          resource: "resource",
          restart: "restart",
          result: "result",
          results: "results",
          rotate: "rotate",
          rx: "rx",
          ry: "ry",
          scale: "scale",
          security: "security",
          seed: "seed",
          shaperendering: "shapeRendering",
          "shape-rendering": "shapeRendering",
          slope: "slope",
          spacing: "spacing",
          specularconstant: "specularConstant",
          specularexponent: "specularExponent",
          speed: "speed",
          spreadmethod: "spreadMethod",
          startoffset: "startOffset",
          stddeviation: "stdDeviation",
          stemh: "stemh",
          stemv: "stemv",
          stitchtiles: "stitchTiles",
          stopcolor: "stopColor",
          "stop-color": "stopColor",
          stopopacity: "stopOpacity",
          "stop-opacity": "stopOpacity",
          strikethroughposition: "strikethroughPosition",
          "strikethrough-position": "strikethroughPosition",
          strikethroughthickness: "strikethroughThickness",
          "strikethrough-thickness": "strikethroughThickness",
          string: "string",
          stroke: "stroke",
          strokedasharray: "strokeDasharray",
          "stroke-dasharray": "strokeDasharray",
          strokedashoffset: "strokeDashoffset",
          "stroke-dashoffset": "strokeDashoffset",
          strokelinecap: "strokeLinecap",
          "stroke-linecap": "strokeLinecap",
          strokelinejoin: "strokeLinejoin",
          "stroke-linejoin": "strokeLinejoin",
          strokemiterlimit: "strokeMiterlimit",
          "stroke-miterlimit": "strokeMiterlimit",
          strokewidth: "strokeWidth",
          "stroke-width": "strokeWidth",
          strokeopacity: "strokeOpacity",
          "stroke-opacity": "strokeOpacity",
          suppresscontenteditablewarning: "suppressContentEditableWarning",
          suppresshydrationwarning: "suppressHydrationWarning",
          surfacescale: "surfaceScale",
          systemlanguage: "systemLanguage",
          tablevalues: "tableValues",
          targetx: "targetX",
          targety: "targetY",
          textanchor: "textAnchor",
          "text-anchor": "textAnchor",
          textdecoration: "textDecoration",
          "text-decoration": "textDecoration",
          textlength: "textLength",
          textrendering: "textRendering",
          "text-rendering": "textRendering",
          to: "to",
          transform: "transform",
          typeof: "typeof",
          u1: "u1",
          u2: "u2",
          underlineposition: "underlinePosition",
          "underline-position": "underlinePosition",
          underlinethickness: "underlineThickness",
          "underline-thickness": "underlineThickness",
          unicode: "unicode",
          unicodebidi: "unicodeBidi",
          "unicode-bidi": "unicodeBidi",
          unicoderange: "unicodeRange",
          "unicode-range": "unicodeRange",
          unitsperem: "unitsPerEm",
          "units-per-em": "unitsPerEm",
          unselectable: "unselectable",
          valphabetic: "vAlphabetic",
          "v-alphabetic": "vAlphabetic",
          values: "values",
          vectoreffect: "vectorEffect",
          "vector-effect": "vectorEffect",
          version: "version",
          vertadvy: "vertAdvY",
          "vert-adv-y": "vertAdvY",
          vertoriginx: "vertOriginX",
          "vert-origin-x": "vertOriginX",
          vertoriginy: "vertOriginY",
          "vert-origin-y": "vertOriginY",
          vhanging: "vHanging",
          "v-hanging": "vHanging",
          videographic: "vIdeographic",
          "v-ideographic": "vIdeographic",
          viewbox: "viewBox",
          viewtarget: "viewTarget",
          visibility: "visibility",
          vmathematical: "vMathematical",
          "v-mathematical": "vMathematical",
          vocab: "vocab",
          widths: "widths",
          wordspacing: "wordSpacing",
          "word-spacing": "wordSpacing",
          writingmode: "writingMode",
          "writing-mode": "writingMode",
          x1: "x1",
          x2: "x2",
          x: "x",
          xchannelselector: "xChannelSelector",
          xheight: "xHeight",
          "x-height": "xHeight",
          xlinkactuate: "xlinkActuate",
          "xlink:actuate": "xlinkActuate",
          xlinkarcrole: "xlinkArcrole",
          "xlink:arcrole": "xlinkArcrole",
          xlinkhref: "xlinkHref",
          "xlink:href": "xlinkHref",
          xlinkrole: "xlinkRole",
          "xlink:role": "xlinkRole",
          xlinkshow: "xlinkShow",
          "xlink:show": "xlinkShow",
          xlinktitle: "xlinkTitle",
          "xlink:title": "xlinkTitle",
          xlinktype: "xlinkType",
          "xlink:type": "xlinkType",
          xmlbase: "xmlBase",
          "xml:base": "xmlBase",
          xmllang: "xmlLang",
          "xml:lang": "xmlLang",
          xmlns: "xmlns",
          "xml:space": "xmlSpace",
          xmlnsxlink: "xmlnsXlink",
          "xmlns:xlink": "xmlnsXlink",
          xmlspace: "xmlSpace",
          y1: "y1",
          y2: "y2",
          y: "y",
          ychannelselector: "yChannelSelector",
          z: "z",
          zoomandpan: "zoomAndPan"
        };
        var ariaProperties = {
          "aria-current": 0,
          // state
          "aria-description": 0,
          "aria-details": 0,
          "aria-disabled": 0,
          // state
          "aria-hidden": 0,
          // state
          "aria-invalid": 0,
          // state
          "aria-keyshortcuts": 0,
          "aria-label": 0,
          "aria-roledescription": 0,
          // Widget Attributes
          "aria-autocomplete": 0,
          "aria-checked": 0,
          "aria-expanded": 0,
          "aria-haspopup": 0,
          "aria-level": 0,
          "aria-modal": 0,
          "aria-multiline": 0,
          "aria-multiselectable": 0,
          "aria-orientation": 0,
          "aria-placeholder": 0,
          "aria-pressed": 0,
          "aria-readonly": 0,
          "aria-required": 0,
          "aria-selected": 0,
          "aria-sort": 0,
          "aria-valuemax": 0,
          "aria-valuemin": 0,
          "aria-valuenow": 0,
          "aria-valuetext": 0,
          // Live Region Attributes
          "aria-atomic": 0,
          "aria-busy": 0,
          "aria-live": 0,
          "aria-relevant": 0,
          // Drag-and-Drop Attributes
          "aria-dropeffect": 0,
          "aria-grabbed": 0,
          // Relationship Attributes
          "aria-activedescendant": 0,
          "aria-colcount": 0,
          "aria-colindex": 0,
          "aria-colspan": 0,
          "aria-controls": 0,
          "aria-describedby": 0,
          "aria-errormessage": 0,
          "aria-flowto": 0,
          "aria-labelledby": 0,
          "aria-owns": 0,
          "aria-posinset": 0,
          "aria-rowcount": 0,
          "aria-rowindex": 0,
          "aria-rowspan": 0,
          "aria-setsize": 0
        };
        var warnedProperties = {};
        var rARIA = new RegExp("^(aria)-[" + ATTRIBUTE_NAME_CHAR + "]*$");
        var rARIACamel = new RegExp("^(aria)[A-Z][" + ATTRIBUTE_NAME_CHAR + "]*$");
        function validateProperty(tagName, name) {
          {
            if (hasOwnProperty.call(warnedProperties, name) && warnedProperties[name]) {
              return true;
            }
            if (rARIACamel.test(name)) {
              var ariaName = "aria-" + name.slice(4).toLowerCase();
              var correctName = ariaProperties.hasOwnProperty(ariaName) ? ariaName : null;
              if (correctName == null) {
                error("Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.", name);
                warnedProperties[name] = true;
                return true;
              }
              if (name !== correctName) {
                error("Invalid ARIA attribute `%s`. Did you mean `%s`?", name, correctName);
                warnedProperties[name] = true;
                return true;
              }
            }
            if (rARIA.test(name)) {
              var lowerCasedName = name.toLowerCase();
              var standardName = ariaProperties.hasOwnProperty(lowerCasedName) ? lowerCasedName : null;
              if (standardName == null) {
                warnedProperties[name] = true;
                return false;
              }
              if (name !== standardName) {
                error("Unknown ARIA attribute `%s`. Did you mean `%s`?", name, standardName);
                warnedProperties[name] = true;
                return true;
              }
            }
          }
          return true;
        }
        function warnInvalidARIAProps(type, props) {
          {
            var invalidProps = [];
            for (var key in props) {
              var isValid = validateProperty(type, key);
              if (!isValid) {
                invalidProps.push(key);
              }
            }
            var unknownPropString = invalidProps.map(function(prop) {
              return "`" + prop + "`";
            }).join(", ");
            if (invalidProps.length === 1) {
              error("Invalid aria prop %s on <%s> tag. For details, see https://reactjs.org/link/invalid-aria-props", unknownPropString, type);
            } else if (invalidProps.length > 1) {
              error("Invalid aria props %s on <%s> tag. For details, see https://reactjs.org/link/invalid-aria-props", unknownPropString, type);
            }
          }
        }
        function validateProperties(type, props) {
          if (isCustomComponent(type, props)) {
            return;
          }
          warnInvalidARIAProps(type, props);
        }
        var didWarnValueNull = false;
        function validateProperties$1(type, props) {
          {
            if (type !== "input" && type !== "textarea" && type !== "select") {
              return;
            }
            if (props != null && props.value === null && !didWarnValueNull) {
              didWarnValueNull = true;
              if (type === "select" && props.multiple) {
                error("`value` prop on `%s` should not be null. Consider using an empty array when `multiple` is set to `true` to clear the component or `undefined` for uncontrolled components.", type);
              } else {
                error("`value` prop on `%s` should not be null. Consider using an empty string to clear the component or `undefined` for uncontrolled components.", type);
              }
            }
          }
        }
        var validateProperty$1 = function() {
        };
        {
          var warnedProperties$1 = {};
          var EVENT_NAME_REGEX = /^on./;
          var INVALID_EVENT_NAME_REGEX = /^on[^A-Z]/;
          var rARIA$1 = new RegExp("^(aria)-[" + ATTRIBUTE_NAME_CHAR + "]*$");
          var rARIACamel$1 = new RegExp("^(aria)[A-Z][" + ATTRIBUTE_NAME_CHAR + "]*$");
          validateProperty$1 = function(tagName, name, value, eventRegistry) {
            if (hasOwnProperty.call(warnedProperties$1, name) && warnedProperties$1[name]) {
              return true;
            }
            var lowerCasedName = name.toLowerCase();
            if (lowerCasedName === "onfocusin" || lowerCasedName === "onfocusout") {
              error("React uses onFocus and onBlur instead of onFocusIn and onFocusOut. All React events are normalized to bubble, so onFocusIn and onFocusOut are not needed/supported by React.");
              warnedProperties$1[name] = true;
              return true;
            }
            if (eventRegistry != null) {
              var registrationNameDependencies2 = eventRegistry.registrationNameDependencies, possibleRegistrationNames2 = eventRegistry.possibleRegistrationNames;
              if (registrationNameDependencies2.hasOwnProperty(name)) {
                return true;
              }
              var registrationName = possibleRegistrationNames2.hasOwnProperty(lowerCasedName) ? possibleRegistrationNames2[lowerCasedName] : null;
              if (registrationName != null) {
                error("Invalid event handler property `%s`. Did you mean `%s`?", name, registrationName);
                warnedProperties$1[name] = true;
                return true;
              }
              if (EVENT_NAME_REGEX.test(name)) {
                error("Unknown event handler property `%s`. It will be ignored.", name);
                warnedProperties$1[name] = true;
                return true;
              }
            } else if (EVENT_NAME_REGEX.test(name)) {
              if (INVALID_EVENT_NAME_REGEX.test(name)) {
                error("Invalid event handler property `%s`. React events use the camelCase naming convention, for example `onClick`.", name);
              }
              warnedProperties$1[name] = true;
              return true;
            }
            if (rARIA$1.test(name) || rARIACamel$1.test(name)) {
              return true;
            }
            if (lowerCasedName === "innerhtml") {
              error("Directly setting property `innerHTML` is not permitted. For more information, lookup documentation on `dangerouslySetInnerHTML`.");
              warnedProperties$1[name] = true;
              return true;
            }
            if (lowerCasedName === "aria") {
              error("The `aria` attribute is reserved for future use in React. Pass individual `aria-` attributes instead.");
              warnedProperties$1[name] = true;
              return true;
            }
            if (lowerCasedName === "is" && value !== null && value !== void 0 && typeof value !== "string") {
              error("Received a `%s` for a string attribute `is`. If this is expected, cast the value to a string.", typeof value);
              warnedProperties$1[name] = true;
              return true;
            }
            if (typeof value === "number" && isNaN(value)) {
              error("Received NaN for the `%s` attribute. If this is expected, cast the value to a string.", name);
              warnedProperties$1[name] = true;
              return true;
            }
            var propertyInfo = getPropertyInfo(name);
            var isReserved = propertyInfo !== null && propertyInfo.type === RESERVED;
            if (possibleStandardNames.hasOwnProperty(lowerCasedName)) {
              var standardName = possibleStandardNames[lowerCasedName];
              if (standardName !== name) {
                error("Invalid DOM property `%s`. Did you mean `%s`?", name, standardName);
                warnedProperties$1[name] = true;
                return true;
              }
            } else if (!isReserved && name !== lowerCasedName) {
              error("React does not recognize the `%s` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `%s` instead. If you accidentally passed it from a parent component, remove it from the DOM element.", name, lowerCasedName);
              warnedProperties$1[name] = true;
              return true;
            }
            if (typeof value === "boolean" && shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
              if (value) {
                error('Received `%s` for a non-boolean attribute `%s`.\n\nIf you want to write it to the DOM, pass a string instead: %s="%s" or %s={value.toString()}.', value, name, name, value, name);
              } else {
                error('Received `%s` for a non-boolean attribute `%s`.\n\nIf you want to write it to the DOM, pass a string instead: %s="%s" or %s={value.toString()}.\n\nIf you used to conditionally omit it with %s={condition && value}, pass %s={condition ? value : undefined} instead.', value, name, name, value, name, name, name);
              }
              warnedProperties$1[name] = true;
              return true;
            }
            if (isReserved) {
              return true;
            }
            if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
              warnedProperties$1[name] = true;
              return false;
            }
            if ((value === "false" || value === "true") && propertyInfo !== null && propertyInfo.type === BOOLEAN) {
              error("Received the string `%s` for the boolean attribute `%s`. %s Did you mean %s={%s}?", value, name, value === "false" ? "The browser will interpret it as a truthy value." : 'Although this works, it will not work as expected if you pass the string "false".', name, value);
              warnedProperties$1[name] = true;
              return true;
            }
            return true;
          };
        }
        var warnUnknownProperties = function(type, props, eventRegistry) {
          {
            var unknownProps = [];
            for (var key in props) {
              var isValid = validateProperty$1(type, key, props[key], eventRegistry);
              if (!isValid) {
                unknownProps.push(key);
              }
            }
            var unknownPropString = unknownProps.map(function(prop) {
              return "`" + prop + "`";
            }).join(", ");
            if (unknownProps.length === 1) {
              error("Invalid value for prop %s on <%s> tag. Either remove it from the element, or pass a string or number value to keep it in the DOM. For details, see https://reactjs.org/link/attribute-behavior ", unknownPropString, type);
            } else if (unknownProps.length > 1) {
              error("Invalid values for props %s on <%s> tag. Either remove them from the element, or pass a string or number value to keep them in the DOM. For details, see https://reactjs.org/link/attribute-behavior ", unknownPropString, type);
            }
          }
        };
        function validateProperties$2(type, props, eventRegistry) {
          if (isCustomComponent(type, props)) {
            return;
          }
          warnUnknownProperties(type, props, eventRegistry);
        }
        var IS_EVENT_HANDLE_NON_MANAGED_NODE = 1;
        var IS_NON_DELEGATED = 1 << 1;
        var IS_CAPTURE_PHASE = 1 << 2;
        var SHOULD_NOT_PROCESS_POLYFILL_EVENT_PLUGINS = IS_EVENT_HANDLE_NON_MANAGED_NODE | IS_NON_DELEGATED | IS_CAPTURE_PHASE;
        var currentReplayingEvent = null;
        function setReplayingEvent(event) {
          {
            if (currentReplayingEvent !== null) {
              error("Expected currently replaying event to be null. This error is likely caused by a bug in React. Please file an issue.");
            }
          }
          currentReplayingEvent = event;
        }
        function resetReplayingEvent() {
          {
            if (currentReplayingEvent === null) {
              error("Expected currently replaying event to not be null. This error is likely caused by a bug in React. Please file an issue.");
            }
          }
          currentReplayingEvent = null;
        }
        function isReplayingEvent(event) {
          return event === currentReplayingEvent;
        }
        function getEventTarget(nativeEvent) {
          var target = nativeEvent.target || nativeEvent.srcElement || window;
          if (target.correspondingUseElement) {
            target = target.correspondingUseElement;
          }
          return target.nodeType === TEXT_NODE ? target.parentNode : target;
        }
        var restoreImpl = null;
        var restoreTarget = null;
        var restoreQueue = null;
        function restoreStateOfTarget(target) {
          var internalInstance = getInstanceFromNode(target);
          if (!internalInstance) {
            return;
          }
          if (typeof restoreImpl !== "function") {
            throw new Error("setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue.");
          }
          var stateNode = internalInstance.stateNode;
          if (stateNode) {
            var _props = getFiberCurrentPropsFromNode(stateNode);
            restoreImpl(internalInstance.stateNode, internalInstance.type, _props);
          }
        }
        function setRestoreImplementation(impl) {
          restoreImpl = impl;
        }
        function enqueueStateRestore(target) {
          if (restoreTarget) {
            if (restoreQueue) {
              restoreQueue.push(target);
            } else {
              restoreQueue = [target];
            }
          } else {
            restoreTarget = target;
          }
        }
        function needsStateRestore() {
          return restoreTarget !== null || restoreQueue !== null;
        }
        function restoreStateIfNeeded() {
          if (!restoreTarget) {
            return;
          }
          var target = restoreTarget;
          var queuedTargets = restoreQueue;
          restoreTarget = null;
          restoreQueue = null;
          restoreStateOfTarget(target);
          if (queuedTargets) {
            for (var i2 = 0; i2 < queuedTargets.length; i2++) {
              restoreStateOfTarget(queuedTargets[i2]);
            }
          }
        }
        var batchedUpdatesImpl = function(fn2, bookkeeping) {
          return fn2(bookkeeping);
        };
        var flushSyncImpl = function() {
        };
        var isInsideEventHandler = false;
        function finishEventHandler() {
          var controlledComponentsHavePendingUpdates = needsStateRestore();
          if (controlledComponentsHavePendingUpdates) {
            flushSyncImpl();
            restoreStateIfNeeded();
          }
        }
        function batchedUpdates(fn2, a2, b2) {
          if (isInsideEventHandler) {
            return fn2(a2, b2);
          }
          isInsideEventHandler = true;
          try {
            return batchedUpdatesImpl(fn2, a2, b2);
          } finally {
            isInsideEventHandler = false;
            finishEventHandler();
          }
        }
        function setBatchingImplementation(_batchedUpdatesImpl, _discreteUpdatesImpl, _flushSyncImpl) {
          batchedUpdatesImpl = _batchedUpdatesImpl;
          flushSyncImpl = _flushSyncImpl;
        }
        function isInteractive(tag) {
          return tag === "button" || tag === "input" || tag === "select" || tag === "textarea";
        }
        function shouldPreventMouseEvent(name, type, props) {
          switch (name) {
            case "onClick":
            case "onClickCapture":
            case "onDoubleClick":
            case "onDoubleClickCapture":
            case "onMouseDown":
            case "onMouseDownCapture":
            case "onMouseMove":
            case "onMouseMoveCapture":
            case "onMouseUp":
            case "onMouseUpCapture":
            case "onMouseEnter":
              return !!(props.disabled && isInteractive(type));
            default:
              return false;
          }
        }
        function getListener(inst, registrationName) {
          var stateNode = inst.stateNode;
          if (stateNode === null) {
            return null;
          }
          var props = getFiberCurrentPropsFromNode(stateNode);
          if (props === null) {
            return null;
          }
          var listener2 = props[registrationName];
          if (shouldPreventMouseEvent(registrationName, inst.type, props)) {
            return null;
          }
          if (listener2 && typeof listener2 !== "function") {
            throw new Error("Expected `" + registrationName + "` listener to be a function, instead got a value of `" + typeof listener2 + "` type.");
          }
          return listener2;
        }
        var passiveBrowserEventsSupported = false;
        if (canUseDOM2) {
          try {
            var options = {};
            Object.defineProperty(options, "passive", {
              get: function() {
                passiveBrowserEventsSupported = true;
              }
            });
            window.addEventListener("test", options, options);
            window.removeEventListener("test", options, options);
          } catch (e) {
            passiveBrowserEventsSupported = false;
          }
        }
        function invokeGuardedCallbackProd(name, func, context, a2, b2, c2, d2, e, f3) {
          var funcArgs = Array.prototype.slice.call(arguments, 3);
          try {
            func.apply(context, funcArgs);
          } catch (error2) {
            this.onError(error2);
          }
        }
        var invokeGuardedCallbackImpl = invokeGuardedCallbackProd;
        {
          if (typeof window !== "undefined" && typeof window.dispatchEvent === "function" && typeof document !== "undefined" && typeof document.createEvent === "function") {
            var fakeNode = document.createElement("react");
            invokeGuardedCallbackImpl = function invokeGuardedCallbackDev(name, func, context, a2, b2, c2, d2, e, f3) {
              if (typeof document === "undefined" || document === null) {
                throw new Error("The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous.");
              }
              var evt = document.createEvent("Event");
              var didCall = false;
              var didError = true;
              var windowEvent = window.event;
              var windowEventDescriptor = Object.getOwnPropertyDescriptor(window, "event");
              function restoreAfterDispatch() {
                fakeNode.removeEventListener(evtType, callCallback2, false);
                if (typeof window.event !== "undefined" && window.hasOwnProperty("event")) {
                  window.event = windowEvent;
                }
              }
              var funcArgs = Array.prototype.slice.call(arguments, 3);
              function callCallback2() {
                didCall = true;
                restoreAfterDispatch();
                func.apply(context, funcArgs);
                didError = false;
              }
              var error2;
              var didSetError = false;
              var isCrossOriginError = false;
              function handleWindowError(event) {
                error2 = event.error;
                didSetError = true;
                if (error2 === null && event.colno === 0 && event.lineno === 0) {
                  isCrossOriginError = true;
                }
                if (event.defaultPrevented) {
                  if (error2 != null && typeof error2 === "object") {
                    try {
                      error2._suppressLogging = true;
                    } catch (inner) {
                    }
                  }
                }
              }
              var evtType = "react-" + (name ? name : "invokeguardedcallback");
              window.addEventListener("error", handleWindowError);
              fakeNode.addEventListener(evtType, callCallback2, false);
              evt.initEvent(evtType, false, false);
              fakeNode.dispatchEvent(evt);
              if (windowEventDescriptor) {
                Object.defineProperty(window, "event", windowEventDescriptor);
              }
              if (didCall && didError) {
                if (!didSetError) {
                  error2 = new Error(`An error was thrown inside one of your components, but React doesn't know what it was. This is likely due to browser flakiness. React does its best to preserve the "Pause on exceptions" behavior of the DevTools, which requires some DEV-mode only tricks. It's possible that these don't work in your browser. Try triggering the error in production mode, or switching to a modern browser. If you suspect that this is actually an issue with React, please file an issue.`);
                } else if (isCrossOriginError) {
                  error2 = new Error("A cross-origin error was thrown. React doesn't have access to the actual error object in development. See https://reactjs.org/link/crossorigin-error for more information.");
                }
                this.onError(error2);
              }
              window.removeEventListener("error", handleWindowError);
              if (!didCall) {
                restoreAfterDispatch();
                return invokeGuardedCallbackProd.apply(this, arguments);
              }
            };
          }
        }
        var invokeGuardedCallbackImpl$1 = invokeGuardedCallbackImpl;
        var hasError = false;
        var caughtError = null;
        var hasRethrowError = false;
        var rethrowError = null;
        var reporter = {
          onError: function(error2) {
            hasError = true;
            caughtError = error2;
          }
        };
        function invokeGuardedCallback(name, func, context, a2, b2, c2, d2, e, f3) {
          hasError = false;
          caughtError = null;
          invokeGuardedCallbackImpl$1.apply(reporter, arguments);
        }
        function invokeGuardedCallbackAndCatchFirstError(name, func, context, a2, b2, c2, d2, e, f3) {
          invokeGuardedCallback.apply(this, arguments);
          if (hasError) {
            var error2 = clearCaughtError();
            if (!hasRethrowError) {
              hasRethrowError = true;
              rethrowError = error2;
            }
          }
        }
        function rethrowCaughtError() {
          if (hasRethrowError) {
            var error2 = rethrowError;
            hasRethrowError = false;
            rethrowError = null;
            throw error2;
          }
        }
        function hasCaughtError() {
          return hasError;
        }
        function clearCaughtError() {
          if (hasError) {
            var error2 = caughtError;
            hasError = false;
            caughtError = null;
            return error2;
          } else {
            throw new Error("clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.");
          }
        }
        function get(key) {
          return key._reactInternals;
        }
        function has(key) {
          return key._reactInternals !== void 0;
        }
        function set(key, value) {
          key._reactInternals = value;
        }
        var NoFlags = (
          /*                      */
          0
        );
        var PerformedWork = (
          /*                */
          1
        );
        var Placement = (
          /*                    */
          2
        );
        var Update = (
          /*                       */
          4
        );
        var ChildDeletion = (
          /*                */
          16
        );
        var ContentReset = (
          /*                 */
          32
        );
        var Callback = (
          /*                     */
          64
        );
        var DidCapture = (
          /*                   */
          128
        );
        var ForceClientRender = (
          /*            */
          256
        );
        var Ref = (
          /*                          */
          512
        );
        var Snapshot = (
          /*                     */
          1024
        );
        var Passive = (
          /*                      */
          2048
        );
        var Hydrating = (
          /*                    */
          4096
        );
        var Visibility = (
          /*                   */
          8192
        );
        var StoreConsistency = (
          /*             */
          16384
        );
        var LifecycleEffectMask = Passive | Update | Callback | Ref | Snapshot | StoreConsistency;
        var HostEffectMask = (
          /*               */
          32767
        );
        var Incomplete = (
          /*                   */
          32768
        );
        var ShouldCapture = (
          /*                */
          65536
        );
        var ForceUpdateForLegacySuspense = (
          /* */
          131072
        );
        var Forked = (
          /*                       */
          1048576
        );
        var RefStatic = (
          /*                    */
          2097152
        );
        var LayoutStatic = (
          /*                 */
          4194304
        );
        var PassiveStatic = (
          /*                */
          8388608
        );
        var MountLayoutDev = (
          /*               */
          16777216
        );
        var MountPassiveDev = (
          /*              */
          33554432
        );
        var BeforeMutationMask = (
          // TODO: Remove Update flag from before mutation phase by re-landing Visibility
          // flag logic (see #20043)
          Update | Snapshot | 0
        );
        var MutationMask = Placement | Update | ChildDeletion | ContentReset | Ref | Hydrating | Visibility;
        var LayoutMask = Update | Callback | Ref | Visibility;
        var PassiveMask = Passive | ChildDeletion;
        var StaticMask = LayoutStatic | PassiveStatic | RefStatic;
        var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
        function getNearestMountedFiber(fiber) {
          var node = fiber;
          var nearestMounted = fiber;
          if (!fiber.alternate) {
            var nextNode = node;
            do {
              node = nextNode;
              if ((node.flags & (Placement | Hydrating)) !== NoFlags) {
                nearestMounted = node.return;
              }
              nextNode = node.return;
            } while (nextNode);
          } else {
            while (node.return) {
              node = node.return;
            }
          }
          if (node.tag === HostRoot) {
            return nearestMounted;
          }
          return null;
        }
        function getSuspenseInstanceFromFiber(fiber) {
          if (fiber.tag === SuspenseComponent) {
            var suspenseState = fiber.memoizedState;
            if (suspenseState === null) {
              var current2 = fiber.alternate;
              if (current2 !== null) {
                suspenseState = current2.memoizedState;
              }
            }
            if (suspenseState !== null) {
              return suspenseState.dehydrated;
            }
          }
          return null;
        }
        function getContainerFromFiber(fiber) {
          return fiber.tag === HostRoot ? fiber.stateNode.containerInfo : null;
        }
        function isFiberMounted(fiber) {
          return getNearestMountedFiber(fiber) === fiber;
        }
        function isMounted(component) {
          {
            var owner = ReactCurrentOwner.current;
            if (owner !== null && owner.tag === ClassComponent) {
              var ownerFiber = owner;
              var instance = ownerFiber.stateNode;
              if (!instance._warnedAboutRefsInRender) {
                error("%s is accessing isMounted inside its render() function. render() should be a pure function of props and state. It should never access something that requires stale data from the previous render, such as refs. Move this logic to componentDidMount and componentDidUpdate instead.", getComponentNameFromFiber(ownerFiber) || "A component");
              }
              instance._warnedAboutRefsInRender = true;
            }
          }
          var fiber = get(component);
          if (!fiber) {
            return false;
          }
          return getNearestMountedFiber(fiber) === fiber;
        }
        function assertIsMounted(fiber) {
          if (getNearestMountedFiber(fiber) !== fiber) {
            throw new Error("Unable to find node on an unmounted component.");
          }
        }
        function findCurrentFiberUsingSlowPath(fiber) {
          var alternate = fiber.alternate;
          if (!alternate) {
            var nearestMounted = getNearestMountedFiber(fiber);
            if (nearestMounted === null) {
              throw new Error("Unable to find node on an unmounted component.");
            }
            if (nearestMounted !== fiber) {
              return null;
            }
            return fiber;
          }
          var a2 = fiber;
          var b2 = alternate;
          while (true) {
            var parentA = a2.return;
            if (parentA === null) {
              break;
            }
            var parentB = parentA.alternate;
            if (parentB === null) {
              var nextParent = parentA.return;
              if (nextParent !== null) {
                a2 = b2 = nextParent;
                continue;
              }
              break;
            }
            if (parentA.child === parentB.child) {
              var child = parentA.child;
              while (child) {
                if (child === a2) {
                  assertIsMounted(parentA);
                  return fiber;
                }
                if (child === b2) {
                  assertIsMounted(parentA);
                  return alternate;
                }
                child = child.sibling;
              }
              throw new Error("Unable to find node on an unmounted component.");
            }
            if (a2.return !== b2.return) {
              a2 = parentA;
              b2 = parentB;
            } else {
              var didFindChild = false;
              var _child = parentA.child;
              while (_child) {
                if (_child === a2) {
                  didFindChild = true;
                  a2 = parentA;
                  b2 = parentB;
                  break;
                }
                if (_child === b2) {
                  didFindChild = true;
                  b2 = parentA;
                  a2 = parentB;
                  break;
                }
                _child = _child.sibling;
              }
              if (!didFindChild) {
                _child = parentB.child;
                while (_child) {
                  if (_child === a2) {
                    didFindChild = true;
                    a2 = parentB;
                    b2 = parentA;
                    break;
                  }
                  if (_child === b2) {
                    didFindChild = true;
                    b2 = parentB;
                    a2 = parentA;
                    break;
                  }
                  _child = _child.sibling;
                }
                if (!didFindChild) {
                  throw new Error("Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.");
                }
              }
            }
            if (a2.alternate !== b2) {
              throw new Error("Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue.");
            }
          }
          if (a2.tag !== HostRoot) {
            throw new Error("Unable to find node on an unmounted component.");
          }
          if (a2.stateNode.current === a2) {
            return fiber;
          }
          return alternate;
        }
        function findCurrentHostFiber(parent) {
          var currentParent = findCurrentFiberUsingSlowPath(parent);
          return currentParent !== null ? findCurrentHostFiberImpl(currentParent) : null;
        }
        function findCurrentHostFiberImpl(node) {
          if (node.tag === HostComponent || node.tag === HostText) {
            return node;
          }
          var child = node.child;
          while (child !== null) {
            var match = findCurrentHostFiberImpl(child);
            if (match !== null) {
              return match;
            }
            child = child.sibling;
          }
          return null;
        }
        function findCurrentHostFiberWithNoPortals(parent) {
          var currentParent = findCurrentFiberUsingSlowPath(parent);
          return currentParent !== null ? findCurrentHostFiberWithNoPortalsImpl(currentParent) : null;
        }
        function findCurrentHostFiberWithNoPortalsImpl(node) {
          if (node.tag === HostComponent || node.tag === HostText) {
            return node;
          }
          var child = node.child;
          while (child !== null) {
            if (child.tag !== HostPortal) {
              var match = findCurrentHostFiberWithNoPortalsImpl(child);
              if (match !== null) {
                return match;
              }
            }
            child = child.sibling;
          }
          return null;
        }
        var scheduleCallback = Scheduler.unstable_scheduleCallback;
        var cancelCallback = Scheduler.unstable_cancelCallback;
        var shouldYield = Scheduler.unstable_shouldYield;
        var requestPaint = Scheduler.unstable_requestPaint;
        var now = Scheduler.unstable_now;
        var getCurrentPriorityLevel = Scheduler.unstable_getCurrentPriorityLevel;
        var ImmediatePriority = Scheduler.unstable_ImmediatePriority;
        var UserBlockingPriority = Scheduler.unstable_UserBlockingPriority;
        var NormalPriority = Scheduler.unstable_NormalPriority;
        var LowPriority = Scheduler.unstable_LowPriority;
        var IdlePriority = Scheduler.unstable_IdlePriority;
        var unstable_yieldValue = Scheduler.unstable_yieldValue;
        var unstable_setDisableYieldValue = Scheduler.unstable_setDisableYieldValue;
        var rendererID = null;
        var injectedHook = null;
        var injectedProfilingHooks = null;
        var hasLoggedError = false;
        var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined";
        function injectInternals(internals) {
          if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === "undefined") {
            return false;
          }
          var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__;
          if (hook.isDisabled) {
            return true;
          }
          if (!hook.supportsFiber) {
            {
              error("The installed version of React DevTools is too old and will not work with the current version of React. Please update React DevTools. https://reactjs.org/link/react-devtools");
            }
            return true;
          }
          try {
            if (enableSchedulingProfiler) {
              internals = assign({}, internals, {
                getLaneLabelMap,
                injectProfilingHooks
              });
            }
            rendererID = hook.inject(internals);
            injectedHook = hook;
          } catch (err) {
            {
              error("React instrumentation encountered an error: %s.", err);
            }
          }
          if (hook.checkDCE) {
            return true;
          } else {
            return false;
          }
        }
        function onScheduleRoot(root2, children) {
          {
            if (injectedHook && typeof injectedHook.onScheduleFiberRoot === "function") {
              try {
                injectedHook.onScheduleFiberRoot(rendererID, root2, children);
              } catch (err) {
                if (!hasLoggedError) {
                  hasLoggedError = true;
                  error("React instrumentation encountered an error: %s", err);
                }
              }
            }
          }
        }
        function onCommitRoot(root2, eventPriority) {
          if (injectedHook && typeof injectedHook.onCommitFiberRoot === "function") {
            try {
              var didError = (root2.current.flags & DidCapture) === DidCapture;
              if (enableProfilerTimer) {
                var schedulerPriority;
                switch (eventPriority) {
                  case DiscreteEventPriority:
                    schedulerPriority = ImmediatePriority;
                    break;
                  case ContinuousEventPriority:
                    schedulerPriority = UserBlockingPriority;
                    break;
                  case DefaultEventPriority:
                    schedulerPriority = NormalPriority;
                    break;
                  case IdleEventPriority:
                    schedulerPriority = IdlePriority;
                    break;
                  default:
                    schedulerPriority = NormalPriority;
                    break;
                }
                injectedHook.onCommitFiberRoot(rendererID, root2, schedulerPriority, didError);
              } else {
                injectedHook.onCommitFiberRoot(rendererID, root2, void 0, didError);
              }
            } catch (err) {
              {
                if (!hasLoggedError) {
                  hasLoggedError = true;
                  error("React instrumentation encountered an error: %s", err);
                }
              }
            }
          }
        }
        function onPostCommitRoot(root2) {
          if (injectedHook && typeof injectedHook.onPostCommitFiberRoot === "function") {
            try {
              injectedHook.onPostCommitFiberRoot(rendererID, root2);
            } catch (err) {
              {
                if (!hasLoggedError) {
                  hasLoggedError = true;
                  error("React instrumentation encountered an error: %s", err);
                }
              }
            }
          }
        }
        function onCommitUnmount(fiber) {
          if (injectedHook && typeof injectedHook.onCommitFiberUnmount === "function") {
            try {
              injectedHook.onCommitFiberUnmount(rendererID, fiber);
            } catch (err) {
              {
                if (!hasLoggedError) {
                  hasLoggedError = true;
                  error("React instrumentation encountered an error: %s", err);
                }
              }
            }
          }
        }
        function setIsStrictModeForDevtools(newIsStrictMode) {
          {
            if (typeof unstable_yieldValue === "function") {
              unstable_setDisableYieldValue(newIsStrictMode);
              setSuppressWarning(newIsStrictMode);
            }
            if (injectedHook && typeof injectedHook.setStrictMode === "function") {
              try {
                injectedHook.setStrictMode(rendererID, newIsStrictMode);
              } catch (err) {
                {
                  if (!hasLoggedError) {
                    hasLoggedError = true;
                    error("React instrumentation encountered an error: %s", err);
                  }
                }
              }
            }
          }
        }
        function injectProfilingHooks(profilingHooks) {
          injectedProfilingHooks = profilingHooks;
        }
        function getLaneLabelMap() {
          {
            var map2 = /* @__PURE__ */ new Map();
            var lane = 1;
            for (var index2 = 0; index2 < TotalLanes; index2++) {
              var label = getLabelForLane(lane);
              map2.set(lane, label);
              lane *= 2;
            }
            return map2;
          }
        }
        function markCommitStarted(lanes) {
          {
            if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markCommitStarted === "function") {
              injectedProfilingHooks.markCommitStarted(lanes);
            }
          }
        }
        function markCommitStopped() {
          {
            if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markCommitStopped === "function") {
              injectedProfilingHooks.markCommitStopped();
            }
          }
        }
        function markComponentRenderStarted(fiber) {
          {
            if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentRenderStarted === "function") {
              injectedProfilingHooks.markComponentRenderStarted(fiber);
            }
          }
        }
        function markComponentRenderStopped() {
          {
            if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentRenderStopped === "function") {
              injectedProfilingHooks.markComponentRenderStopped();
            }
          }
        }
        function markComponentPassiveEffectMountStarted(fiber) {
          {
            if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectMountStarted === "function") {
              injectedProfilingHooks.markComponentPassiveEffectMountStarted(fiber);
            }
          }
        }
        function markComponentPassiveEffectMountStopped() {
          {
            if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectMountStopped === "function") {
              injectedProfilingHooks.markComponentPassiveEffectMountStopped();
            }
          }
        }
        function markComponentPassiveEffectUnmountStarted(fiber) {
          {
            if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectUnmountStarted === "function") {
              injectedProfilingHooks.markComponentPassiveEffectUnmountStarted(fiber);
            }
          }
        }
        function markComponentPassiveEffectUnmountStopped() {
          {
            if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectUnmountStopped === "function") {
              injectedProfilingHooks.markComponentPassiveEffectUnmountStopped();
            }
          }
        }
        function markComponentLayoutEffectMountStarted(fiber) {
          {
            if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectMountStarted === "function") {
              injectedProfilingHooks.markComponentLayoutEffectMountStarted(fiber);
            }
          }
        }
        function markComponentLayoutEffectMountStopped() {
          {
            if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectMountStopped === "function") {
              injectedProfilingHooks.markComponentLayoutEffectMountStopped();
            }
          }
        }
        function markComponentLayoutEffectUnmountStarted(fiber) {
          {
            if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectUnmountStarted === "function") {
              injectedProfilingHooks.markComponentLayoutEffectUnmountStarted(fiber);
            }
          }
        }
        function markComponentLayoutEffectUnmountStopped() {
          {
            if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectUnmountStopped === "function") {
              injectedProfilingHooks.markComponentLayoutEffectUnmountStopped();
            }
          }
        }
        function markComponentErrored(fiber, thrownValue, lanes) {
          {
            if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentErrored === "function") {
              injectedProfilingHooks.markComponentErrored(fiber, thrownValue, lanes);
            }
          }
        }
        function markComponentSuspended(fiber, wakeable, lanes) {
          {
            if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentSuspended === "function") {
              injectedProfilingHooks.markComponentSuspended(fiber, wakeable, lanes);
            }
          }
        }
        function markLayoutEffectsStarted(lanes) {
          {
            if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markLayoutEffectsStarted === "function") {
              injectedProfilingHooks.markLayoutEffectsStarted(lanes);
            }
          }
        }
        function markLayoutEffectsStopped() {
          {
            if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markLayoutEffectsStopped === "function") {
              injectedProfilingHooks.markLayoutEffectsStopped();
            }
          }
        }
        function markPassiveEffectsStarted(lanes) {
          {
            if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markPassiveEffectsStarted === "function") {
              injectedProfilingHooks.markPassiveEffectsStarted(lanes);
            }
          }
        }
        function markPassiveEffectsStopped() {
          {
            if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markPassiveEffectsStopped === "function") {
              injectedProfilingHooks.markPassiveEffectsStopped();
            }
          }
        }
        function markRenderStarted(lanes) {
          {
            if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderStarted === "function") {
              injectedProfilingHooks.markRenderStarted(lanes);
            }
          }
        }
        function markRenderYielded() {
          {
            if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderYielded === "function") {
              injectedProfilingHooks.markRenderYielded();
            }
          }
        }
        function markRenderStopped() {
          {
            if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderStopped === "function") {
              injectedProfilingHooks.markRenderStopped();
            }
          }
        }
        function markRenderScheduled(lane) {
          {
            if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderScheduled === "function") {
              injectedProfilingHooks.markRenderScheduled(lane);
            }
          }
        }
        function markForceUpdateScheduled(fiber, lane) {
          {
            if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markForceUpdateScheduled === "function") {
              injectedProfilingHooks.markForceUpdateScheduled(fiber, lane);
            }
          }
        }
        function markStateUpdateScheduled(fiber, lane) {
          {
            if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markStateUpdateScheduled === "function") {
              injectedProfilingHooks.markStateUpdateScheduled(fiber, lane);
            }
          }
        }
        var NoMode = (
          /*                         */
          0
        );
        var ConcurrentMode = (
          /*                 */
          1
        );
        var ProfileMode = (
          /*                    */
          2
        );
        var StrictLegacyMode = (
          /*               */
          8
        );
        var StrictEffectsMode = (
          /*              */
          16
        );
        var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback;
        var log = Math.log;
        var LN2 = Math.LN2;
        function clz32Fallback(x2) {
          var asUint = x2 >>> 0;
          if (asUint === 0) {
            return 32;
          }
          return 31 - (log(asUint) / LN2 | 0) | 0;
        }
        var TotalLanes = 31;
        var NoLanes = (
          /*                        */
          0
        );
        var NoLane = (
          /*                          */
          0
        );
        var SyncLane = (
          /*                        */
          1
        );
        var InputContinuousHydrationLane = (
          /*    */
          2
        );
        var InputContinuousLane = (
          /*             */
          4
        );
        var DefaultHydrationLane = (
          /*            */
          8
        );
        var DefaultLane = (
          /*                     */
          16
        );
        var TransitionHydrationLane = (
          /*                */
          32
        );
        var TransitionLanes = (
          /*                       */
          4194240
        );
        var TransitionLane1 = (
          /*                        */
          64
        );
        var TransitionLane2 = (
          /*                        */
          128
        );
        var TransitionLane3 = (
          /*                        */
          256
        );
        var TransitionLane4 = (
          /*                        */
          512
        );
        var TransitionLane5 = (
          /*                        */
          1024
        );
        var TransitionLane6 = (
          /*                        */
          2048
        );
        var TransitionLane7 = (
          /*                        */
          4096
        );
        var TransitionLane8 = (
          /*                        */
          8192
        );
        var TransitionLane9 = (
          /*                        */
          16384
        );
        var TransitionLane10 = (
          /*                       */
          32768
        );
        var TransitionLane11 = (
          /*                       */
          65536
        );
        var TransitionLane12 = (
          /*                       */
          131072
        );
        var TransitionLane13 = (
          /*                       */
          262144
        );
        var TransitionLane14 = (
          /*                       */
          524288
        );
        var TransitionLane15 = (
          /*                       */
          1048576
        );
        var TransitionLane16 = (
          /*                       */
          2097152
        );
        var RetryLanes = (
          /*                            */
          130023424
        );
        var RetryLane1 = (
          /*                             */
          4194304
        );
        var RetryLane2 = (
          /*                             */
          8388608
        );
        var RetryLane3 = (
          /*                             */
          16777216
        );
        var RetryLane4 = (
          /*                             */
          33554432
        );
        var RetryLane5 = (
          /*                             */
          67108864
        );
        var SomeRetryLane = RetryLane1;
        var SelectiveHydrationLane = (
          /*          */
          134217728
        );
        var NonIdleLanes = (
          /*                          */
          268435455
        );
        var IdleHydrationLane = (
          /*               */
          268435456
        );
        var IdleLane = (
          /*                        */
          536870912
        );
        var OffscreenLane = (
          /*                   */
          1073741824
        );
        function getLabelForLane(lane) {
          {
            if (lane & SyncLane) {
              return "Sync";
            }
            if (lane & InputContinuousHydrationLane) {
              return "InputContinuousHydration";
            }
            if (lane & InputContinuousLane) {
              return "InputContinuous";
            }
            if (lane & DefaultHydrationLane) {
              return "DefaultHydration";
            }
            if (lane & DefaultLane) {
              return "Default";
            }
            if (lane & TransitionHydrationLane) {
              return "TransitionHydration";
            }
            if (lane & TransitionLanes) {
              return "Transition";
            }
            if (lane & RetryLanes) {
              return "Retry";
            }
            if (lane & SelectiveHydrationLane) {
              return "SelectiveHydration";
            }
            if (lane & IdleHydrationLane) {
              return "IdleHydration";
            }
            if (lane & IdleLane) {
              return "Idle";
            }
            if (lane & OffscreenLane) {
              return "Offscreen";
            }
          }
        }
        var NoTimestamp = -1;
        var nextTransitionLane = TransitionLane1;
        var nextRetryLane = RetryLane1;
        function getHighestPriorityLanes(lanes) {
          switch (getHighestPriorityLane(lanes)) {
            case SyncLane:
              return SyncLane;
            case InputContinuousHydrationLane:
              return InputContinuousHydrationLane;
            case InputContinuousLane:
              return InputContinuousLane;
            case DefaultHydrationLane:
              return DefaultHydrationLane;
            case DefaultLane:
              return DefaultLane;
            case TransitionHydrationLane:
              return TransitionHydrationLane;
            case TransitionLane1:
            case TransitionLane2:
            case TransitionLane3:
            case TransitionLane4:
            case TransitionLane5:
            case TransitionLane6:
            case TransitionLane7:
            case TransitionLane8:
            case TransitionLane9:
            case TransitionLane10:
            case TransitionLane11:
            case TransitionLane12:
            case TransitionLane13:
            case TransitionLane14:
            case TransitionLane15:
            case TransitionLane16:
              return lanes & TransitionLanes;
            case RetryLane1:
            case RetryLane2:
            case RetryLane3:
            case RetryLane4:
            case RetryLane5:
              return lanes & RetryLanes;
            case SelectiveHydrationLane:
              return SelectiveHydrationLane;
            case IdleHydrationLane:
              return IdleHydrationLane;
            case IdleLane:
              return IdleLane;
            case OffscreenLane:
              return OffscreenLane;
            default:
              {
                error("Should have found matching lanes. This is a bug in React.");
              }
              return lanes;
          }
        }
        function getNextLanes(root2, wipLanes) {
          var pendingLanes = root2.pendingLanes;
          if (pendingLanes === NoLanes) {
            return NoLanes;
          }
          var nextLanes = NoLanes;
          var suspendedLanes = root2.suspendedLanes;
          var pingedLanes = root2.pingedLanes;
          var nonIdlePendingLanes = pendingLanes & NonIdleLanes;
          if (nonIdlePendingLanes !== NoLanes) {
            var nonIdleUnblockedLanes = nonIdlePendingLanes & ~suspendedLanes;
            if (nonIdleUnblockedLanes !== NoLanes) {
              nextLanes = getHighestPriorityLanes(nonIdleUnblockedLanes);
            } else {
              var nonIdlePingedLanes = nonIdlePendingLanes & pingedLanes;
              if (nonIdlePingedLanes !== NoLanes) {
                nextLanes = getHighestPriorityLanes(nonIdlePingedLanes);
              }
            }
          } else {
            var unblockedLanes = pendingLanes & ~suspendedLanes;
            if (unblockedLanes !== NoLanes) {
              nextLanes = getHighestPriorityLanes(unblockedLanes);
            } else {
              if (pingedLanes !== NoLanes) {
                nextLanes = getHighestPriorityLanes(pingedLanes);
              }
            }
          }
          if (nextLanes === NoLanes) {
            return NoLanes;
          }
          if (wipLanes !== NoLanes && wipLanes !== nextLanes && // If we already suspended with a delay, then interrupting is fine. Don't
          // bother waiting until the root is complete.
          (wipLanes & suspendedLanes) === NoLanes) {
            var nextLane = getHighestPriorityLane(nextLanes);
            var wipLane = getHighestPriorityLane(wipLanes);
            if (
              // Tests whether the next lane is equal or lower priority than the wip
              // one. This works because the bits decrease in priority as you go left.
              nextLane >= wipLane || // Default priority updates should not interrupt transition updates. The
              // only difference between default updates and transition updates is that
              // default updates do not support refresh transitions.
              nextLane === DefaultLane && (wipLane & TransitionLanes) !== NoLanes
            ) {
              return wipLanes;
            }
          }
          if ((nextLanes & InputContinuousLane) !== NoLanes) {
            nextLanes |= pendingLanes & DefaultLane;
          }
          var entangledLanes = root2.entangledLanes;
          if (entangledLanes !== NoLanes) {
            var entanglements = root2.entanglements;
            var lanes = nextLanes & entangledLanes;
            while (lanes > 0) {
              var index2 = pickArbitraryLaneIndex(lanes);
              var lane = 1 << index2;
              nextLanes |= entanglements[index2];
              lanes &= ~lane;
            }
          }
          return nextLanes;
        }
        function getMostRecentEventTime(root2, lanes) {
          var eventTimes = root2.eventTimes;
          var mostRecentEventTime = NoTimestamp;
          while (lanes > 0) {
            var index2 = pickArbitraryLaneIndex(lanes);
            var lane = 1 << index2;
            var eventTime = eventTimes[index2];
            if (eventTime > mostRecentEventTime) {
              mostRecentEventTime = eventTime;
            }
            lanes &= ~lane;
          }
          return mostRecentEventTime;
        }
        function computeExpirationTime(lane, currentTime) {
          switch (lane) {
            case SyncLane:
            case InputContinuousHydrationLane:
            case InputContinuousLane:
              return currentTime + 250;
            case DefaultHydrationLane:
            case DefaultLane:
            case TransitionHydrationLane:
            case TransitionLane1:
            case TransitionLane2:
            case TransitionLane3:
            case TransitionLane4:
            case TransitionLane5:
            case TransitionLane6:
            case TransitionLane7:
            case TransitionLane8:
            case TransitionLane9:
            case TransitionLane10:
            case TransitionLane11:
            case TransitionLane12:
            case TransitionLane13:
            case TransitionLane14:
            case TransitionLane15:
            case TransitionLane16:
              return currentTime + 5e3;
            case RetryLane1:
            case RetryLane2:
            case RetryLane3:
            case RetryLane4:
            case RetryLane5:
              return NoTimestamp;
            case SelectiveHydrationLane:
            case IdleHydrationLane:
            case IdleLane:
            case OffscreenLane:
              return NoTimestamp;
            default:
              {
                error("Should have found matching lanes. This is a bug in React.");
              }
              return NoTimestamp;
          }
        }
        function markStarvedLanesAsExpired(root2, currentTime) {
          var pendingLanes = root2.pendingLanes;
          var suspendedLanes = root2.suspendedLanes;
          var pingedLanes = root2.pingedLanes;
          var expirationTimes = root2.expirationTimes;
          var lanes = pendingLanes;
          while (lanes > 0) {
            var index2 = pickArbitraryLaneIndex(lanes);
            var lane = 1 << index2;
            var expirationTime = expirationTimes[index2];
            if (expirationTime === NoTimestamp) {
              if ((lane & suspendedLanes) === NoLanes || (lane & pingedLanes) !== NoLanes) {
                expirationTimes[index2] = computeExpirationTime(lane, currentTime);
              }
            } else if (expirationTime <= currentTime) {
              root2.expiredLanes |= lane;
            }
            lanes &= ~lane;
          }
        }
        function getHighestPriorityPendingLanes(root2) {
          return getHighestPriorityLanes(root2.pendingLanes);
        }
        function getLanesToRetrySynchronouslyOnError(root2) {
          var everythingButOffscreen = root2.pendingLanes & ~OffscreenLane;
          if (everythingButOffscreen !== NoLanes) {
            return everythingButOffscreen;
          }
          if (everythingButOffscreen & OffscreenLane) {
            return OffscreenLane;
          }
          return NoLanes;
        }
        function includesSyncLane(lanes) {
          return (lanes & SyncLane) !== NoLanes;
        }
        function includesNonIdleWork(lanes) {
          return (lanes & NonIdleLanes) !== NoLanes;
        }
        function includesOnlyRetries(lanes) {
          return (lanes & RetryLanes) === lanes;
        }
        function includesOnlyNonUrgentLanes(lanes) {
          var UrgentLanes = SyncLane | InputContinuousLane | DefaultLane;
          return (lanes & UrgentLanes) === NoLanes;
        }
        function includesOnlyTransitions(lanes) {
          return (lanes & TransitionLanes) === lanes;
        }
        function includesBlockingLane(root2, lanes) {
          var SyncDefaultLanes = InputContinuousHydrationLane | InputContinuousLane | DefaultHydrationLane | DefaultLane;
          return (lanes & SyncDefaultLanes) !== NoLanes;
        }
        function includesExpiredLane(root2, lanes) {
          return (lanes & root2.expiredLanes) !== NoLanes;
        }
        function isTransitionLane(lane) {
          return (lane & TransitionLanes) !== NoLanes;
        }
        function claimNextTransitionLane() {
          var lane = nextTransitionLane;
          nextTransitionLane <<= 1;
          if ((nextTransitionLane & TransitionLanes) === NoLanes) {
            nextTransitionLane = TransitionLane1;
          }
          return lane;
        }
        function claimNextRetryLane() {
          var lane = nextRetryLane;
          nextRetryLane <<= 1;
          if ((nextRetryLane & RetryLanes) === NoLanes) {
            nextRetryLane = RetryLane1;
          }
          return lane;
        }
        function getHighestPriorityLane(lanes) {
          return lanes & -lanes;
        }
        function pickArbitraryLane(lanes) {
          return getHighestPriorityLane(lanes);
        }
        function pickArbitraryLaneIndex(lanes) {
          return 31 - clz32(lanes);
        }
        function laneToIndex(lane) {
          return pickArbitraryLaneIndex(lane);
        }
        function includesSomeLane(a2, b2) {
          return (a2 & b2) !== NoLanes;
        }
        function isSubsetOfLanes(set2, subset) {
          return (set2 & subset) === subset;
        }
        function mergeLanes(a2, b2) {
          return a2 | b2;
        }
        function removeLanes(set2, subset) {
          return set2 & ~subset;
        }
        function intersectLanes(a2, b2) {
          return a2 & b2;
        }
        function laneToLanes(lane) {
          return lane;
        }
        function higherPriorityLane(a2, b2) {
          return a2 !== NoLane && a2 < b2 ? a2 : b2;
        }
        function createLaneMap(initial) {
          var laneMap = [];
          for (var i2 = 0; i2 < TotalLanes; i2++) {
            laneMap.push(initial);
          }
          return laneMap;
        }
        function markRootUpdated(root2, updateLane, eventTime) {
          root2.pendingLanes |= updateLane;
          if (updateLane !== IdleLane) {
            root2.suspendedLanes = NoLanes;
            root2.pingedLanes = NoLanes;
          }
          var eventTimes = root2.eventTimes;
          var index2 = laneToIndex(updateLane);
          eventTimes[index2] = eventTime;
        }
        function markRootSuspended(root2, suspendedLanes) {
          root2.suspendedLanes |= suspendedLanes;
          root2.pingedLanes &= ~suspendedLanes;
          var expirationTimes = root2.expirationTimes;
          var lanes = suspendedLanes;
          while (lanes > 0) {
            var index2 = pickArbitraryLaneIndex(lanes);
            var lane = 1 << index2;
            expirationTimes[index2] = NoTimestamp;
            lanes &= ~lane;
          }
        }
        function markRootPinged(root2, pingedLanes, eventTime) {
          root2.pingedLanes |= root2.suspendedLanes & pingedLanes;
        }
        function markRootFinished(root2, remainingLanes) {
          var noLongerPendingLanes = root2.pendingLanes & ~remainingLanes;
          root2.pendingLanes = remainingLanes;
          root2.suspendedLanes = NoLanes;
          root2.pingedLanes = NoLanes;
          root2.expiredLanes &= remainingLanes;
          root2.mutableReadLanes &= remainingLanes;
          root2.entangledLanes &= remainingLanes;
          var entanglements = root2.entanglements;
          var eventTimes = root2.eventTimes;
          var expirationTimes = root2.expirationTimes;
          var lanes = noLongerPendingLanes;
          while (lanes > 0) {
            var index2 = pickArbitraryLaneIndex(lanes);
            var lane = 1 << index2;
            entanglements[index2] = NoLanes;
            eventTimes[index2] = NoTimestamp;
            expirationTimes[index2] = NoTimestamp;
            lanes &= ~lane;
          }
        }
        function markRootEntangled(root2, entangledLanes) {
          var rootEntangledLanes = root2.entangledLanes |= entangledLanes;
          var entanglements = root2.entanglements;
          var lanes = rootEntangledLanes;
          while (lanes) {
            var index2 = pickArbitraryLaneIndex(lanes);
            var lane = 1 << index2;
            if (
              // Is this one of the newly entangled lanes?
              lane & entangledLanes | // Is this lane transitively entangled with the newly entangled lanes?
              entanglements[index2] & entangledLanes
            ) {
              entanglements[index2] |= entangledLanes;
            }
            lanes &= ~lane;
          }
        }
        function getBumpedLaneForHydration(root2, renderLanes2) {
          var renderLane = getHighestPriorityLane(renderLanes2);
          var lane;
          switch (renderLane) {
            case InputContinuousLane:
              lane = InputContinuousHydrationLane;
              break;
            case DefaultLane:
              lane = DefaultHydrationLane;
              break;
            case TransitionLane1:
            case TransitionLane2:
            case TransitionLane3:
            case TransitionLane4:
            case TransitionLane5:
            case TransitionLane6:
            case TransitionLane7:
            case TransitionLane8:
            case TransitionLane9:
            case TransitionLane10:
            case TransitionLane11:
            case TransitionLane12:
            case TransitionLane13:
            case TransitionLane14:
            case TransitionLane15:
            case TransitionLane16:
            case RetryLane1:
            case RetryLane2:
            case RetryLane3:
            case RetryLane4:
            case RetryLane5:
              lane = TransitionHydrationLane;
              break;
            case IdleLane:
              lane = IdleHydrationLane;
              break;
            default:
              lane = NoLane;
              break;
          }
          if ((lane & (root2.suspendedLanes | renderLanes2)) !== NoLane) {
            return NoLane;
          }
          return lane;
        }
        function addFiberToLanesMap(root2, fiber, lanes) {
          if (!isDevToolsPresent) {
            return;
          }
          var pendingUpdatersLaneMap = root2.pendingUpdatersLaneMap;
          while (lanes > 0) {
            var index2 = laneToIndex(lanes);
            var lane = 1 << index2;
            var updaters = pendingUpdatersLaneMap[index2];
            updaters.add(fiber);
            lanes &= ~lane;
          }
        }
        function movePendingFibersToMemoized(root2, lanes) {
          if (!isDevToolsPresent) {
            return;
          }
          var pendingUpdatersLaneMap = root2.pendingUpdatersLaneMap;
          var memoizedUpdaters = root2.memoizedUpdaters;
          while (lanes > 0) {
            var index2 = laneToIndex(lanes);
            var lane = 1 << index2;
            var updaters = pendingUpdatersLaneMap[index2];
            if (updaters.size > 0) {
              updaters.forEach(function(fiber) {
                var alternate = fiber.alternate;
                if (alternate === null || !memoizedUpdaters.has(alternate)) {
                  memoizedUpdaters.add(fiber);
                }
              });
              updaters.clear();
            }
            lanes &= ~lane;
          }
        }
        function getTransitionsForLanes(root2, lanes) {
          {
            return null;
          }
        }
        var DiscreteEventPriority = SyncLane;
        var ContinuousEventPriority = InputContinuousLane;
        var DefaultEventPriority = DefaultLane;
        var IdleEventPriority = IdleLane;
        var currentUpdatePriority = NoLane;
        function getCurrentUpdatePriority() {
          return currentUpdatePriority;
        }
        function setCurrentUpdatePriority(newPriority) {
          currentUpdatePriority = newPriority;
        }
        function runWithPriority(priority, fn2) {
          var previousPriority = currentUpdatePriority;
          try {
            currentUpdatePriority = priority;
            return fn2();
          } finally {
            currentUpdatePriority = previousPriority;
          }
        }
        function higherEventPriority(a2, b2) {
          return a2 !== 0 && a2 < b2 ? a2 : b2;
        }
        function lowerEventPriority(a2, b2) {
          return a2 === 0 || a2 > b2 ? a2 : b2;
        }
        function isHigherEventPriority(a2, b2) {
          return a2 !== 0 && a2 < b2;
        }
        function lanesToEventPriority(lanes) {
          var lane = getHighestPriorityLane(lanes);
          if (!isHigherEventPriority(DiscreteEventPriority, lane)) {
            return DiscreteEventPriority;
          }
          if (!isHigherEventPriority(ContinuousEventPriority, lane)) {
            return ContinuousEventPriority;
          }
          if (includesNonIdleWork(lane)) {
            return DefaultEventPriority;
          }
          return IdleEventPriority;
        }
        function isRootDehydrated(root2) {
          var currentState = root2.current.memoizedState;
          return currentState.isDehydrated;
        }
        var _attemptSynchronousHydration;
        function setAttemptSynchronousHydration(fn2) {
          _attemptSynchronousHydration = fn2;
        }
        function attemptSynchronousHydration(fiber) {
          _attemptSynchronousHydration(fiber);
        }
        var attemptContinuousHydration;
        function setAttemptContinuousHydration(fn2) {
          attemptContinuousHydration = fn2;
        }
        var attemptHydrationAtCurrentPriority;
        function setAttemptHydrationAtCurrentPriority(fn2) {
          attemptHydrationAtCurrentPriority = fn2;
        }
        var getCurrentUpdatePriority$1;
        function setGetCurrentUpdatePriority(fn2) {
          getCurrentUpdatePriority$1 = fn2;
        }
        var attemptHydrationAtPriority;
        function setAttemptHydrationAtPriority(fn2) {
          attemptHydrationAtPriority = fn2;
        }
        var hasScheduledReplayAttempt = false;
        var queuedDiscreteEvents = [];
        var queuedFocus = null;
        var queuedDrag = null;
        var queuedMouse = null;
        var queuedPointers = /* @__PURE__ */ new Map();
        var queuedPointerCaptures = /* @__PURE__ */ new Map();
        var queuedExplicitHydrationTargets = [];
        var discreteReplayableEvents = [
          "mousedown",
          "mouseup",
          "touchcancel",
          "touchend",
          "touchstart",
          "auxclick",
          "dblclick",
          "pointercancel",
          "pointerdown",
          "pointerup",
          "dragend",
          "dragstart",
          "drop",
          "compositionend",
          "compositionstart",
          "keydown",
          "keypress",
          "keyup",
          "input",
          "textInput",
          // Intentionally camelCase
          "copy",
          "cut",
          "paste",
          "click",
          "change",
          "contextmenu",
          "reset",
          "submit"
        ];
        function isDiscreteEventThatRequiresHydration(eventType) {
          return discreteReplayableEvents.indexOf(eventType) > -1;
        }
        function createQueuedReplayableEvent(blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent) {
          return {
            blockedOn,
            domEventName,
            eventSystemFlags,
            nativeEvent,
            targetContainers: [targetContainer]
          };
        }
        function clearIfContinuousEvent(domEventName, nativeEvent) {
          switch (domEventName) {
            case "focusin":
            case "focusout":
              queuedFocus = null;
              break;
            case "dragenter":
            case "dragleave":
              queuedDrag = null;
              break;
            case "mouseover":
            case "mouseout":
              queuedMouse = null;
              break;
            case "pointerover":
            case "pointerout": {
              var pointerId = nativeEvent.pointerId;
              queuedPointers.delete(pointerId);
              break;
            }
            case "gotpointercapture":
            case "lostpointercapture": {
              var _pointerId = nativeEvent.pointerId;
              queuedPointerCaptures.delete(_pointerId);
              break;
            }
          }
        }
        function accumulateOrCreateContinuousQueuedReplayableEvent(existingQueuedEvent, blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent) {
          if (existingQueuedEvent === null || existingQueuedEvent.nativeEvent !== nativeEvent) {
            var queuedEvent = createQueuedReplayableEvent(blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent);
            if (blockedOn !== null) {
              var _fiber2 = getInstanceFromNode(blockedOn);
              if (_fiber2 !== null) {
                attemptContinuousHydration(_fiber2);
              }
            }
            return queuedEvent;
          }
          existingQueuedEvent.eventSystemFlags |= eventSystemFlags;
          var targetContainers = existingQueuedEvent.targetContainers;
          if (targetContainer !== null && targetContainers.indexOf(targetContainer) === -1) {
            targetContainers.push(targetContainer);
          }
          return existingQueuedEvent;
        }
        function queueIfContinuousEvent(blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent) {
          switch (domEventName) {
            case "focusin": {
              var focusEvent = nativeEvent;
              queuedFocus = accumulateOrCreateContinuousQueuedReplayableEvent(queuedFocus, blockedOn, domEventName, eventSystemFlags, targetContainer, focusEvent);
              return true;
            }
            case "dragenter": {
              var dragEvent = nativeEvent;
              queuedDrag = accumulateOrCreateContinuousQueuedReplayableEvent(queuedDrag, blockedOn, domEventName, eventSystemFlags, targetContainer, dragEvent);
              return true;
            }
            case "mouseover": {
              var mouseEvent = nativeEvent;
              queuedMouse = accumulateOrCreateContinuousQueuedReplayableEvent(queuedMouse, blockedOn, domEventName, eventSystemFlags, targetContainer, mouseEvent);
              return true;
            }
            case "pointerover": {
              var pointerEvent = nativeEvent;
              var pointerId = pointerEvent.pointerId;
              queuedPointers.set(pointerId, accumulateOrCreateContinuousQueuedReplayableEvent(queuedPointers.get(pointerId) || null, blockedOn, domEventName, eventSystemFlags, targetContainer, pointerEvent));
              return true;
            }
            case "gotpointercapture": {
              var _pointerEvent = nativeEvent;
              var _pointerId2 = _pointerEvent.pointerId;
              queuedPointerCaptures.set(_pointerId2, accumulateOrCreateContinuousQueuedReplayableEvent(queuedPointerCaptures.get(_pointerId2) || null, blockedOn, domEventName, eventSystemFlags, targetContainer, _pointerEvent));
              return true;
            }
          }
          return false;
        }
        function attemptExplicitHydrationTarget(queuedTarget) {
          var targetInst = getClosestInstanceFromNode(queuedTarget.target);
          if (targetInst !== null) {
            var nearestMounted = getNearestMountedFiber(targetInst);
            if (nearestMounted !== null) {
              var tag = nearestMounted.tag;
              if (tag === SuspenseComponent) {
                var instance = getSuspenseInstanceFromFiber(nearestMounted);
                if (instance !== null) {
                  queuedTarget.blockedOn = instance;
                  attemptHydrationAtPriority(queuedTarget.priority, function() {
                    attemptHydrationAtCurrentPriority(nearestMounted);
                  });
                  return;
                }
              } else if (tag === HostRoot) {
                var root2 = nearestMounted.stateNode;
                if (isRootDehydrated(root2)) {
                  queuedTarget.blockedOn = getContainerFromFiber(nearestMounted);
                  return;
                }
              }
            }
          }
          queuedTarget.blockedOn = null;
        }
        function queueExplicitHydrationTarget(target) {
          var updatePriority = getCurrentUpdatePriority$1();
          var queuedTarget = {
            blockedOn: null,
            target,
            priority: updatePriority
          };
          var i2 = 0;
          for (; i2 < queuedExplicitHydrationTargets.length; i2++) {
            if (!isHigherEventPriority(updatePriority, queuedExplicitHydrationTargets[i2].priority)) {
              break;
            }
          }
          queuedExplicitHydrationTargets.splice(i2, 0, queuedTarget);
          if (i2 === 0) {
            attemptExplicitHydrationTarget(queuedTarget);
          }
        }
        function attemptReplayContinuousQueuedEvent(queuedEvent) {
          if (queuedEvent.blockedOn !== null) {
            return false;
          }
          var targetContainers = queuedEvent.targetContainers;
          while (targetContainers.length > 0) {
            var targetContainer = targetContainers[0];
            var nextBlockedOn = findInstanceBlockingEvent(queuedEvent.domEventName, queuedEvent.eventSystemFlags, targetContainer, queuedEvent.nativeEvent);
            if (nextBlockedOn === null) {
              {
                var nativeEvent = queuedEvent.nativeEvent;
                var nativeEventClone = new nativeEvent.constructor(nativeEvent.type, nativeEvent);
                setReplayingEvent(nativeEventClone);
                nativeEvent.target.dispatchEvent(nativeEventClone);
                resetReplayingEvent();
              }
            } else {
              var _fiber3 = getInstanceFromNode(nextBlockedOn);
              if (_fiber3 !== null) {
                attemptContinuousHydration(_fiber3);
              }
              queuedEvent.blockedOn = nextBlockedOn;
              return false;
            }
            targetContainers.shift();
          }
          return true;
        }
        function attemptReplayContinuousQueuedEventInMap(queuedEvent, key, map2) {
          if (attemptReplayContinuousQueuedEvent(queuedEvent)) {
            map2.delete(key);
          }
        }
        function replayUnblockedEvents() {
          hasScheduledReplayAttempt = false;
          if (queuedFocus !== null && attemptReplayContinuousQueuedEvent(queuedFocus)) {
            queuedFocus = null;
          }
          if (queuedDrag !== null && attemptReplayContinuousQueuedEvent(queuedDrag)) {
            queuedDrag = null;
          }
          if (queuedMouse !== null && attemptReplayContinuousQueuedEvent(queuedMouse)) {
            queuedMouse = null;
          }
          queuedPointers.forEach(attemptReplayContinuousQueuedEventInMap);
          queuedPointerCaptures.forEach(attemptReplayContinuousQueuedEventInMap);
        }
        function scheduleCallbackIfUnblocked(queuedEvent, unblocked) {
          if (queuedEvent.blockedOn === unblocked) {
            queuedEvent.blockedOn = null;
            if (!hasScheduledReplayAttempt) {
              hasScheduledReplayAttempt = true;
              Scheduler.unstable_scheduleCallback(Scheduler.unstable_NormalPriority, replayUnblockedEvents);
            }
          }
        }
        function retryIfBlockedOn(unblocked) {
          if (queuedDiscreteEvents.length > 0) {
            scheduleCallbackIfUnblocked(queuedDiscreteEvents[0], unblocked);
            for (var i2 = 1; i2 < queuedDiscreteEvents.length; i2++) {
              var queuedEvent = queuedDiscreteEvents[i2];
              if (queuedEvent.blockedOn === unblocked) {
                queuedEvent.blockedOn = null;
              }
            }
          }
          if (queuedFocus !== null) {
            scheduleCallbackIfUnblocked(queuedFocus, unblocked);
          }
          if (queuedDrag !== null) {
            scheduleCallbackIfUnblocked(queuedDrag, unblocked);
          }
          if (queuedMouse !== null) {
            scheduleCallbackIfUnblocked(queuedMouse, unblocked);
          }
          var unblock = function(queuedEvent2) {
            return scheduleCallbackIfUnblocked(queuedEvent2, unblocked);
          };
          queuedPointers.forEach(unblock);
          queuedPointerCaptures.forEach(unblock);
          for (var _i = 0; _i < queuedExplicitHydrationTargets.length; _i++) {
            var queuedTarget = queuedExplicitHydrationTargets[_i];
            if (queuedTarget.blockedOn === unblocked) {
              queuedTarget.blockedOn = null;
            }
          }
          while (queuedExplicitHydrationTargets.length > 0) {
            var nextExplicitTarget = queuedExplicitHydrationTargets[0];
            if (nextExplicitTarget.blockedOn !== null) {
              break;
            } else {
              attemptExplicitHydrationTarget(nextExplicitTarget);
              if (nextExplicitTarget.blockedOn === null) {
                queuedExplicitHydrationTargets.shift();
              }
            }
          }
        }
        var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig;
        var _enabled = true;
        function setEnabled(enabled) {
          _enabled = !!enabled;
        }
        function isEnabled() {
          return _enabled;
        }
        function createEventListenerWrapperWithPriority(targetContainer, domEventName, eventSystemFlags) {
          var eventPriority = getEventPriority(domEventName);
          var listenerWrapper;
          switch (eventPriority) {
            case DiscreteEventPriority:
              listenerWrapper = dispatchDiscreteEvent;
              break;
            case ContinuousEventPriority:
              listenerWrapper = dispatchContinuousEvent;
              break;
            case DefaultEventPriority:
            default:
              listenerWrapper = dispatchEvent;
              break;
          }
          return listenerWrapper.bind(null, domEventName, eventSystemFlags, targetContainer);
        }
        function dispatchDiscreteEvent(domEventName, eventSystemFlags, container, nativeEvent) {
          var previousPriority = getCurrentUpdatePriority();
          var prevTransition = ReactCurrentBatchConfig.transition;
          ReactCurrentBatchConfig.transition = null;
          try {
            setCurrentUpdatePriority(DiscreteEventPriority);
            dispatchEvent(domEventName, eventSystemFlags, container, nativeEvent);
          } finally {
            setCurrentUpdatePriority(previousPriority);
            ReactCurrentBatchConfig.transition = prevTransition;
          }
        }
        function dispatchContinuousEvent(domEventName, eventSystemFlags, container, nativeEvent) {
          var previousPriority = getCurrentUpdatePriority();
          var prevTransition = ReactCurrentBatchConfig.transition;
          ReactCurrentBatchConfig.transition = null;
          try {
            setCurrentUpdatePriority(ContinuousEventPriority);
            dispatchEvent(domEventName, eventSystemFlags, container, nativeEvent);
          } finally {
            setCurrentUpdatePriority(previousPriority);
            ReactCurrentBatchConfig.transition = prevTransition;
          }
        }
        function dispatchEvent(domEventName, eventSystemFlags, targetContainer, nativeEvent) {
          if (!_enabled) {
            return;
          }
          {
            dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay(domEventName, eventSystemFlags, targetContainer, nativeEvent);
          }
        }
        function dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay(domEventName, eventSystemFlags, targetContainer, nativeEvent) {
          var blockedOn = findInstanceBlockingEvent(domEventName, eventSystemFlags, targetContainer, nativeEvent);
          if (blockedOn === null) {
            dispatchEventForPluginEventSystem(domEventName, eventSystemFlags, nativeEvent, return_targetInst, targetContainer);
            clearIfContinuousEvent(domEventName, nativeEvent);
            return;
          }
          if (queueIfContinuousEvent(blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent)) {
            nativeEvent.stopPropagation();
            return;
          }
          clearIfContinuousEvent(domEventName, nativeEvent);
          if (eventSystemFlags & IS_CAPTURE_PHASE && isDiscreteEventThatRequiresHydration(domEventName)) {
            while (blockedOn !== null) {
              var fiber = getInstanceFromNode(blockedOn);
              if (fiber !== null) {
                attemptSynchronousHydration(fiber);
              }
              var nextBlockedOn = findInstanceBlockingEvent(domEventName, eventSystemFlags, targetContainer, nativeEvent);
              if (nextBlockedOn === null) {
                dispatchEventForPluginEventSystem(domEventName, eventSystemFlags, nativeEvent, return_targetInst, targetContainer);
              }
              if (nextBlockedOn === blockedOn) {
                break;
              }
              blockedOn = nextBlockedOn;
            }
            if (blockedOn !== null) {
              nativeEvent.stopPropagation();
            }
            return;
          }
          dispatchEventForPluginEventSystem(domEventName, eventSystemFlags, nativeEvent, null, targetContainer);
        }
        var return_targetInst = null;
        function findInstanceBlockingEvent(domEventName, eventSystemFlags, targetContainer, nativeEvent) {
          return_targetInst = null;
          var nativeEventTarget = getEventTarget(nativeEvent);
          var targetInst = getClosestInstanceFromNode(nativeEventTarget);
          if (targetInst !== null) {
            var nearestMounted = getNearestMountedFiber(targetInst);
            if (nearestMounted === null) {
              targetInst = null;
            } else {
              var tag = nearestMounted.tag;
              if (tag === SuspenseComponent) {
                var instance = getSuspenseInstanceFromFiber(nearestMounted);
                if (instance !== null) {
                  return instance;
                }
                targetInst = null;
              } else if (tag === HostRoot) {
                var root2 = nearestMounted.stateNode;
                if (isRootDehydrated(root2)) {
                  return getContainerFromFiber(nearestMounted);
                }
                targetInst = null;
              } else if (nearestMounted !== targetInst) {
                targetInst = null;
              }
            }
          }
          return_targetInst = targetInst;
          return null;
        }
        function getEventPriority(domEventName) {
          switch (domEventName) {
            case "cancel":
            case "click":
            case "close":
            case "contextmenu":
            case "copy":
            case "cut":
            case "auxclick":
            case "dblclick":
            case "dragend":
            case "dragstart":
            case "drop":
            case "focusin":
            case "focusout":
            case "input":
            case "invalid":
            case "keydown":
            case "keypress":
            case "keyup":
            case "mousedown":
            case "mouseup":
            case "paste":
            case "pause":
            case "play":
            case "pointercancel":
            case "pointerdown":
            case "pointerup":
            case "ratechange":
            case "reset":
            case "resize":
            case "seeked":
            case "submit":
            case "touchcancel":
            case "touchend":
            case "touchstart":
            case "volumechange":
            case "change":
            case "selectionchange":
            case "textInput":
            case "compositionstart":
            case "compositionend":
            case "compositionupdate":
            case "beforeblur":
            case "afterblur":
            case "beforeinput":
            case "blur":
            case "fullscreenchange":
            case "focus":
            case "hashchange":
            case "popstate":
            case "select":
            case "selectstart":
              return DiscreteEventPriority;
            case "drag":
            case "dragenter":
            case "dragexit":
            case "dragleave":
            case "dragover":
            case "mousemove":
            case "mouseout":
            case "mouseover":
            case "pointermove":
            case "pointerout":
            case "pointerover":
            case "scroll":
            case "toggle":
            case "touchmove":
            case "wheel":
            case "mouseenter":
            case "mouseleave":
            case "pointerenter":
            case "pointerleave":
              return ContinuousEventPriority;
            case "message": {
              var schedulerPriority = getCurrentPriorityLevel();
              switch (schedulerPriority) {
                case ImmediatePriority:
                  return DiscreteEventPriority;
                case UserBlockingPriority:
                  return ContinuousEventPriority;
                case NormalPriority:
                case LowPriority:
                  return DefaultEventPriority;
                case IdlePriority:
                  return IdleEventPriority;
                default:
                  return DefaultEventPriority;
              }
            }
            default:
              return DefaultEventPriority;
          }
        }
        function addEventBubbleListener(target, eventType, listener2) {
          target.addEventListener(eventType, listener2, false);
          return listener2;
        }
        function addEventCaptureListener(target, eventType, listener2) {
          target.addEventListener(eventType, listener2, true);
          return listener2;
        }
        function addEventCaptureListenerWithPassiveFlag(target, eventType, listener2, passive) {
          target.addEventListener(eventType, listener2, {
            capture: true,
            passive
          });
          return listener2;
        }
        function addEventBubbleListenerWithPassiveFlag(target, eventType, listener2, passive) {
          target.addEventListener(eventType, listener2, {
            passive
          });
          return listener2;
        }
        var root = null;
        var startText = null;
        var fallbackText = null;
        function initialize(nativeEventTarget) {
          root = nativeEventTarget;
          startText = getText2();
          return true;
        }
        function reset2() {
          root = null;
          startText = null;
          fallbackText = null;
        }
        function getData() {
          if (fallbackText) {
            return fallbackText;
          }
          var start;
          var startValue = startText;
          var startLength = startValue.length;
          var end;
          var endValue = getText2();
          var endLength = endValue.length;
          for (start = 0; start < startLength; start++) {
            if (startValue[start] !== endValue[start]) {
              break;
            }
          }
          var minEnd = startLength - start;
          for (end = 1; end <= minEnd; end++) {
            if (startValue[startLength - end] !== endValue[endLength - end]) {
              break;
            }
          }
          var sliceTail = end > 1 ? 1 - end : void 0;
          fallbackText = endValue.slice(start, sliceTail);
          return fallbackText;
        }
        function getText2() {
          if ("value" in root) {
            return root.value;
          }
          return root.textContent;
        }
        function getEventCharCode(nativeEvent) {
          var charCode;
          var keyCode = nativeEvent.keyCode;
          if ("charCode" in nativeEvent) {
            charCode = nativeEvent.charCode;
            if (charCode === 0 && keyCode === 13) {
              charCode = 13;
            }
          } else {
            charCode = keyCode;
          }
          if (charCode === 10) {
            charCode = 13;
          }
          if (charCode >= 32 || charCode === 13) {
            return charCode;
          }
          return 0;
        }
        function functionThatReturnsTrue() {
          return true;
        }
        function functionThatReturnsFalse() {
          return false;
        }
        function createSyntheticEvent(Interface) {
          function SyntheticBaseEvent(reactName, reactEventType, targetInst, nativeEvent, nativeEventTarget) {
            this._reactName = reactName;
            this._targetInst = targetInst;
            this.type = reactEventType;
            this.nativeEvent = nativeEvent;
            this.target = nativeEventTarget;
            this.currentTarget = null;
            for (var _propName in Interface) {
              if (!Interface.hasOwnProperty(_propName)) {
                continue;
              }
              var normalize = Interface[_propName];
              if (normalize) {
                this[_propName] = normalize(nativeEvent);
              } else {
                this[_propName] = nativeEvent[_propName];
              }
            }
            var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
            if (defaultPrevented) {
              this.isDefaultPrevented = functionThatReturnsTrue;
            } else {
              this.isDefaultPrevented = functionThatReturnsFalse;
            }
            this.isPropagationStopped = functionThatReturnsFalse;
            return this;
          }
          assign(SyntheticBaseEvent.prototype, {
            preventDefault: function() {
              this.defaultPrevented = true;
              var event = this.nativeEvent;
              if (!event) {
                return;
              }
              if (event.preventDefault) {
                event.preventDefault();
              } else if (typeof event.returnValue !== "unknown") {
                event.returnValue = false;
              }
              this.isDefaultPrevented = functionThatReturnsTrue;
            },
            stopPropagation: function() {
              var event = this.nativeEvent;
              if (!event) {
                return;
              }
              if (event.stopPropagation) {
                event.stopPropagation();
              } else if (typeof event.cancelBubble !== "unknown") {
                event.cancelBubble = true;
              }
              this.isPropagationStopped = functionThatReturnsTrue;
            },
            /**
             * We release all dispatched `SyntheticEvent`s after each event loop, adding
             * them back into the pool. This allows a way to hold onto a reference that
             * won't be added back into the pool.
             */
            persist: function() {
            },
            /**
             * Checks if this event should be released back into the pool.
             *
             * @return {boolean} True if this should not be released, false otherwise.
             */
            isPersistent: functionThatReturnsTrue
          });
          return SyntheticBaseEvent;
        }
        var EventInterface = {
          eventPhase: 0,
          bubbles: 0,
          cancelable: 0,
          timeStamp: function(event) {
            return event.timeStamp || Date.now();
          },
          defaultPrevented: 0,
          isTrusted: 0
        };
        var SyntheticEvent = createSyntheticEvent(EventInterface);
        var UIEventInterface = assign({}, EventInterface, {
          view: 0,
          detail: 0
        });
        var SyntheticUIEvent = createSyntheticEvent(UIEventInterface);
        var lastMovementX;
        var lastMovementY;
        var lastMouseEvent;
        function updateMouseMovementPolyfillState(event) {
          if (event !== lastMouseEvent) {
            if (lastMouseEvent && event.type === "mousemove") {
              lastMovementX = event.screenX - lastMouseEvent.screenX;
              lastMovementY = event.screenY - lastMouseEvent.screenY;
            } else {
              lastMovementX = 0;
              lastMovementY = 0;
            }
            lastMouseEvent = event;
          }
        }
        var MouseEventInterface = assign({}, UIEventInterface, {
          screenX: 0,
          screenY: 0,
          clientX: 0,
          clientY: 0,
          pageX: 0,
          pageY: 0,
          ctrlKey: 0,
          shiftKey: 0,
          altKey: 0,
          metaKey: 0,
          getModifierState: getEventModifierState,
          button: 0,
          buttons: 0,
          relatedTarget: function(event) {
            if (event.relatedTarget === void 0)
              return event.fromElement === event.srcElement ? event.toElement : event.fromElement;
            return event.relatedTarget;
          },
          movementX: function(event) {
            if ("movementX" in event) {
              return event.movementX;
            }
            updateMouseMovementPolyfillState(event);
            return lastMovementX;
          },
          movementY: function(event) {
            if ("movementY" in event) {
              return event.movementY;
            }
            return lastMovementY;
          }
        });
        var SyntheticMouseEvent = createSyntheticEvent(MouseEventInterface);
        var DragEventInterface = assign({}, MouseEventInterface, {
          dataTransfer: 0
        });
        var SyntheticDragEvent = createSyntheticEvent(DragEventInterface);
        var FocusEventInterface = assign({}, UIEventInterface, {
          relatedTarget: 0
        });
        var SyntheticFocusEvent = createSyntheticEvent(FocusEventInterface);
        var AnimationEventInterface = assign({}, EventInterface, {
          animationName: 0,
          elapsedTime: 0,
          pseudoElement: 0
        });
        var SyntheticAnimationEvent = createSyntheticEvent(AnimationEventInterface);
        var ClipboardEventInterface = assign({}, EventInterface, {
          clipboardData: function(event) {
            return "clipboardData" in event ? event.clipboardData : window.clipboardData;
          }
        });
        var SyntheticClipboardEvent = createSyntheticEvent(ClipboardEventInterface);
        var CompositionEventInterface = assign({}, EventInterface, {
          data: 0
        });
        var SyntheticCompositionEvent = createSyntheticEvent(CompositionEventInterface);
        var SyntheticInputEvent = SyntheticCompositionEvent;
        var normalizeKey = {
          Esc: "Escape",
          Spacebar: " ",
          Left: "ArrowLeft",
          Up: "ArrowUp",
          Right: "ArrowRight",
          Down: "ArrowDown",
          Del: "Delete",
          Win: "OS",
          Menu: "ContextMenu",
          Apps: "ContextMenu",
          Scroll: "ScrollLock",
          MozPrintableKey: "Unidentified"
        };
        var translateToKey = {
          "8": "Backspace",
          "9": "Tab",
          "12": "Clear",
          "13": "Enter",
          "16": "Shift",
          "17": "Control",
          "18": "Alt",
          "19": "Pause",
          "20": "CapsLock",
          "27": "Escape",
          "32": " ",
          "33": "PageUp",
          "34": "PageDown",
          "35": "End",
          "36": "Home",
          "37": "ArrowLeft",
          "38": "ArrowUp",
          "39": "ArrowRight",
          "40": "ArrowDown",
          "45": "Insert",
          "46": "Delete",
          "112": "F1",
          "113": "F2",
          "114": "F3",
          "115": "F4",
          "116": "F5",
          "117": "F6",
          "118": "F7",
          "119": "F8",
          "120": "F9",
          "121": "F10",
          "122": "F11",
          "123": "F12",
          "144": "NumLock",
          "145": "ScrollLock",
          "224": "Meta"
        };
        function getEventKey(nativeEvent) {
          if (nativeEvent.key) {
            var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
            if (key !== "Unidentified") {
              return key;
            }
          }
          if (nativeEvent.type === "keypress") {
            var charCode = getEventCharCode(nativeEvent);
            return charCode === 13 ? "Enter" : String.fromCharCode(charCode);
          }
          if (nativeEvent.type === "keydown" || nativeEvent.type === "keyup") {
            return translateToKey[nativeEvent.keyCode] || "Unidentified";
          }
          return "";
        }
        var modifierKeyToProp = {
          Alt: "altKey",
          Control: "ctrlKey",
          Meta: "metaKey",
          Shift: "shiftKey"
        };
        function modifierStateGetter(keyArg) {
          var syntheticEvent = this;
          var nativeEvent = syntheticEvent.nativeEvent;
          if (nativeEvent.getModifierState) {
            return nativeEvent.getModifierState(keyArg);
          }
          var keyProp = modifierKeyToProp[keyArg];
          return keyProp ? !!nativeEvent[keyProp] : false;
        }
        function getEventModifierState(nativeEvent) {
          return modifierStateGetter;
        }
        var KeyboardEventInterface = assign({}, UIEventInterface, {
          key: getEventKey,
          code: 0,
          location: 0,
          ctrlKey: 0,
          shiftKey: 0,
          altKey: 0,
          metaKey: 0,
          repeat: 0,
          locale: 0,
          getModifierState: getEventModifierState,
          // Legacy Interface
          charCode: function(event) {
            if (event.type === "keypress") {
              return getEventCharCode(event);
            }
            return 0;
          },
          keyCode: function(event) {
            if (event.type === "keydown" || event.type === "keyup") {
              return event.keyCode;
            }
            return 0;
          },
          which: function(event) {
            if (event.type === "keypress") {
              return getEventCharCode(event);
            }
            if (event.type === "keydown" || event.type === "keyup") {
              return event.keyCode;
            }
            return 0;
          }
        });
        var SyntheticKeyboardEvent = createSyntheticEvent(KeyboardEventInterface);
        var PointerEventInterface = assign({}, MouseEventInterface, {
          pointerId: 0,
          width: 0,
          height: 0,
          pressure: 0,
          tangentialPressure: 0,
          tiltX: 0,
          tiltY: 0,
          twist: 0,
          pointerType: 0,
          isPrimary: 0
        });
        var SyntheticPointerEvent = createSyntheticEvent(PointerEventInterface);
        var TouchEventInterface = assign({}, UIEventInterface, {
          touches: 0,
          targetTouches: 0,
          changedTouches: 0,
          altKey: 0,
          metaKey: 0,
          ctrlKey: 0,
          shiftKey: 0,
          getModifierState: getEventModifierState
        });
        var SyntheticTouchEvent = createSyntheticEvent(TouchEventInterface);
        var TransitionEventInterface = assign({}, EventInterface, {
          propertyName: 0,
          elapsedTime: 0,
          pseudoElement: 0
        });
        var SyntheticTransitionEvent = createSyntheticEvent(TransitionEventInterface);
        var WheelEventInterface = assign({}, MouseEventInterface, {
          deltaX: function(event) {
            return "deltaX" in event ? event.deltaX : (
              // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
              "wheelDeltaX" in event ? -event.wheelDeltaX : 0
            );
          },
          deltaY: function(event) {
            return "deltaY" in event ? event.deltaY : (
              // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
              "wheelDeltaY" in event ? -event.wheelDeltaY : (
                // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
                "wheelDelta" in event ? -event.wheelDelta : 0
              )
            );
          },
          deltaZ: 0,
          // Browsers without "deltaMode" is reporting in raw wheel delta where one
          // notch on the scroll is always +/- 120, roughly equivalent to pixels.
          // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
          // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
          deltaMode: 0
        });
        var SyntheticWheelEvent = createSyntheticEvent(WheelEventInterface);
        var END_KEYCODES = [9, 13, 27, 32];
        var START_KEYCODE = 229;
        var canUseCompositionEvent = canUseDOM2 && "CompositionEvent" in window;
        var documentMode = null;
        if (canUseDOM2 && "documentMode" in document) {
          documentMode = document.documentMode;
        }
        var canUseTextInputEvent = canUseDOM2 && "TextEvent" in window && !documentMode;
        var useFallbackCompositionData = canUseDOM2 && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
        var SPACEBAR_CODE = 32;
        var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
        function registerEvents() {
          registerTwoPhaseEvent("onBeforeInput", ["compositionend", "keypress", "textInput", "paste"]);
          registerTwoPhaseEvent("onCompositionEnd", ["compositionend", "focusout", "keydown", "keypress", "keyup", "mousedown"]);
          registerTwoPhaseEvent("onCompositionStart", ["compositionstart", "focusout", "keydown", "keypress", "keyup", "mousedown"]);
          registerTwoPhaseEvent("onCompositionUpdate", ["compositionupdate", "focusout", "keydown", "keypress", "keyup", "mousedown"]);
        }
        var hasSpaceKeypress = false;
        function isKeypressCommand(nativeEvent) {
          return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) && // ctrlKey && altKey is equivalent to AltGr, and is not a command.
          !(nativeEvent.ctrlKey && nativeEvent.altKey);
        }
        function getCompositionEventType(domEventName) {
          switch (domEventName) {
            case "compositionstart":
              return "onCompositionStart";
            case "compositionend":
              return "onCompositionEnd";
            case "compositionupdate":
              return "onCompositionUpdate";
          }
        }
        function isFallbackCompositionStart(domEventName, nativeEvent) {
          return domEventName === "keydown" && nativeEvent.keyCode === START_KEYCODE;
        }
        function isFallbackCompositionEnd(domEventName, nativeEvent) {
          switch (domEventName) {
            case "keyup":
              return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
            case "keydown":
              return nativeEvent.keyCode !== START_KEYCODE;
            case "keypress":
            case "mousedown":
            case "focusout":
              return true;
            default:
              return false;
          }
        }
        function getDataFromCustomEvent(nativeEvent) {
          var detail = nativeEvent.detail;
          if (typeof detail === "object" && "data" in detail) {
            return detail.data;
          }
          return null;
        }
        function isUsingKoreanIME(nativeEvent) {
          return nativeEvent.locale === "ko";
        }
        var isComposing = false;
        function extractCompositionEvent(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget) {
          var eventType;
          var fallbackData;
          if (canUseCompositionEvent) {
            eventType = getCompositionEventType(domEventName);
          } else if (!isComposing) {
            if (isFallbackCompositionStart(domEventName, nativeEvent)) {
              eventType = "onCompositionStart";
            }
          } else if (isFallbackCompositionEnd(domEventName, nativeEvent)) {
            eventType = "onCompositionEnd";
          }
          if (!eventType) {
            return null;
          }
          if (useFallbackCompositionData && !isUsingKoreanIME(nativeEvent)) {
            if (!isComposing && eventType === "onCompositionStart") {
              isComposing = initialize(nativeEventTarget);
            } else if (eventType === "onCompositionEnd") {
              if (isComposing) {
                fallbackData = getData();
              }
            }
          }
          var listeners = accumulateTwoPhaseListeners(targetInst, eventType);
          if (listeners.length > 0) {
            var event = new SyntheticCompositionEvent(eventType, domEventName, null, nativeEvent, nativeEventTarget);
            dispatchQueue.push({
              event,
              listeners
            });
            if (fallbackData) {
              event.data = fallbackData;
            } else {
              var customData = getDataFromCustomEvent(nativeEvent);
              if (customData !== null) {
                event.data = customData;
              }
            }
          }
        }
        function getNativeBeforeInputChars(domEventName, nativeEvent) {
          switch (domEventName) {
            case "compositionend":
              return getDataFromCustomEvent(nativeEvent);
            case "keypress":
              var which = nativeEvent.which;
              if (which !== SPACEBAR_CODE) {
                return null;
              }
              hasSpaceKeypress = true;
              return SPACEBAR_CHAR;
            case "textInput":
              var chars = nativeEvent.data;
              if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
                return null;
              }
              return chars;
            default:
              return null;
          }
        }
        function getFallbackBeforeInputChars(domEventName, nativeEvent) {
          if (isComposing) {
            if (domEventName === "compositionend" || !canUseCompositionEvent && isFallbackCompositionEnd(domEventName, nativeEvent)) {
              var chars = getData();
              reset2();
              isComposing = false;
              return chars;
            }
            return null;
          }
          switch (domEventName) {
            case "paste":
              return null;
            case "keypress":
              if (!isKeypressCommand(nativeEvent)) {
                if (nativeEvent.char && nativeEvent.char.length > 1) {
                  return nativeEvent.char;
                } else if (nativeEvent.which) {
                  return String.fromCharCode(nativeEvent.which);
                }
              }
              return null;
            case "compositionend":
              return useFallbackCompositionData && !isUsingKoreanIME(nativeEvent) ? null : nativeEvent.data;
            default:
              return null;
          }
        }
        function extractBeforeInputEvent(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget) {
          var chars;
          if (canUseTextInputEvent) {
            chars = getNativeBeforeInputChars(domEventName, nativeEvent);
          } else {
            chars = getFallbackBeforeInputChars(domEventName, nativeEvent);
          }
          if (!chars) {
            return null;
          }
          var listeners = accumulateTwoPhaseListeners(targetInst, "onBeforeInput");
          if (listeners.length > 0) {
            var event = new SyntheticInputEvent("onBeforeInput", "beforeinput", null, nativeEvent, nativeEventTarget);
            dispatchQueue.push({
              event,
              listeners
            });
            event.data = chars;
          }
        }
        function extractEvents(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags, targetContainer) {
          extractCompositionEvent(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget);
          extractBeforeInputEvent(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget);
        }
        var supportedInputTypes = {
          color: true,
          date: true,
          datetime: true,
          "datetime-local": true,
          email: true,
          month: true,
          number: true,
          password: true,
          range: true,
          search: true,
          tel: true,
          text: true,
          time: true,
          url: true,
          week: true
        };
        function isTextInputElement(elem) {
          var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
          if (nodeName === "input") {
            return !!supportedInputTypes[elem.type];
          }
          if (nodeName === "textarea") {
            return true;
          }
          return false;
        }
        function isEventSupported(eventNameSuffix) {
          if (!canUseDOM2) {
            return false;
          }
          var eventName = "on" + eventNameSuffix;
          var isSupported = eventName in document;
          if (!isSupported) {
            var element = document.createElement("div");
            element.setAttribute(eventName, "return;");
            isSupported = typeof element[eventName] === "function";
          }
          return isSupported;
        }
        function registerEvents$1() {
          registerTwoPhaseEvent("onChange", ["change", "click", "focusin", "focusout", "input", "keydown", "keyup", "selectionchange"]);
        }
        function createAndAccumulateChangeEvent(dispatchQueue, inst, nativeEvent, target) {
          enqueueStateRestore(target);
          var listeners = accumulateTwoPhaseListeners(inst, "onChange");
          if (listeners.length > 0) {
            var event = new SyntheticEvent("onChange", "change", null, nativeEvent, target);
            dispatchQueue.push({
              event,
              listeners
            });
          }
        }
        var activeElement = null;
        var activeElementInst = null;
        function shouldUseChangeEvent(elem) {
          var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
          return nodeName === "select" || nodeName === "input" && elem.type === "file";
        }
        function manualDispatchChangeEvent(nativeEvent) {
          var dispatchQueue = [];
          createAndAccumulateChangeEvent(dispatchQueue, activeElementInst, nativeEvent, getEventTarget(nativeEvent));
          batchedUpdates(runEventInBatch, dispatchQueue);
        }
        function runEventInBatch(dispatchQueue) {
          processDispatchQueue(dispatchQueue, 0);
        }
        function getInstIfValueChanged(targetInst) {
          var targetNode = getNodeFromInstance(targetInst);
          if (updateValueIfChanged(targetNode)) {
            return targetInst;
          }
        }
        function getTargetInstForChangeEvent(domEventName, targetInst) {
          if (domEventName === "change") {
            return targetInst;
          }
        }
        var isInputEventSupported = false;
        if (canUseDOM2) {
          isInputEventSupported = isEventSupported("input") && (!document.documentMode || document.documentMode > 9);
        }
        function startWatchingForValueChange(target, targetInst) {
          activeElement = target;
          activeElementInst = targetInst;
          activeElement.attachEvent("onpropertychange", handlePropertyChange);
        }
        function stopWatchingForValueChange() {
          if (!activeElement) {
            return;
          }
          activeElement.detachEvent("onpropertychange", handlePropertyChange);
          activeElement = null;
          activeElementInst = null;
        }
        function handlePropertyChange(nativeEvent) {
          if (nativeEvent.propertyName !== "value") {
            return;
          }
          if (getInstIfValueChanged(activeElementInst)) {
            manualDispatchChangeEvent(nativeEvent);
          }
        }
        function handleEventsForInputEventPolyfill(domEventName, target, targetInst) {
          if (domEventName === "focusin") {
            stopWatchingForValueChange();
            startWatchingForValueChange(target, targetInst);
          } else if (domEventName === "focusout") {
            stopWatchingForValueChange();
          }
        }
        function getTargetInstForInputEventPolyfill(domEventName, targetInst) {
          if (domEventName === "selectionchange" || domEventName === "keyup" || domEventName === "keydown") {
            return getInstIfValueChanged(activeElementInst);
          }
        }
        function shouldUseClickEvent(elem) {
          var nodeName = elem.nodeName;
          return nodeName && nodeName.toLowerCase() === "input" && (elem.type === "checkbox" || elem.type === "radio");
        }
        function getTargetInstForClickEvent(domEventName, targetInst) {
          if (domEventName === "click") {
            return getInstIfValueChanged(targetInst);
          }
        }
        function getTargetInstForInputOrChangeEvent(domEventName, targetInst) {
          if (domEventName === "input" || domEventName === "change") {
            return getInstIfValueChanged(targetInst);
          }
        }
        function handleControlledInputBlur(node) {
          var state = node._wrapperState;
          if (!state || !state.controlled || node.type !== "number") {
            return;
          }
          {
            setDefaultValue(node, "number", node.value);
          }
        }
        function extractEvents$1(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags, targetContainer) {
          var targetNode = targetInst ? getNodeFromInstance(targetInst) : window;
          var getTargetInstFunc, handleEventFunc;
          if (shouldUseChangeEvent(targetNode)) {
            getTargetInstFunc = getTargetInstForChangeEvent;
          } else if (isTextInputElement(targetNode)) {
            if (isInputEventSupported) {
              getTargetInstFunc = getTargetInstForInputOrChangeEvent;
            } else {
              getTargetInstFunc = getTargetInstForInputEventPolyfill;
              handleEventFunc = handleEventsForInputEventPolyfill;
            }
          } else if (shouldUseClickEvent(targetNode)) {
            getTargetInstFunc = getTargetInstForClickEvent;
          }
          if (getTargetInstFunc) {
            var inst = getTargetInstFunc(domEventName, targetInst);
            if (inst) {
              createAndAccumulateChangeEvent(dispatchQueue, inst, nativeEvent, nativeEventTarget);
              return;
            }
          }
          if (handleEventFunc) {
            handleEventFunc(domEventName, targetNode, targetInst);
          }
          if (domEventName === "focusout") {
            handleControlledInputBlur(targetNode);
          }
        }
        function registerEvents$2() {
          registerDirectEvent("onMouseEnter", ["mouseout", "mouseover"]);
          registerDirectEvent("onMouseLeave", ["mouseout", "mouseover"]);
          registerDirectEvent("onPointerEnter", ["pointerout", "pointerover"]);
          registerDirectEvent("onPointerLeave", ["pointerout", "pointerover"]);
        }
        function extractEvents$2(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags, targetContainer) {
          var isOverEvent = domEventName === "mouseover" || domEventName === "pointerover";
          var isOutEvent = domEventName === "mouseout" || domEventName === "pointerout";
          if (isOverEvent && !isReplayingEvent(nativeEvent)) {
            var related = nativeEvent.relatedTarget || nativeEvent.fromElement;
            if (related) {
              if (getClosestInstanceFromNode(related) || isContainerMarkedAsRoot(related)) {
                return;
              }
            }
          }
          if (!isOutEvent && !isOverEvent) {
            return;
          }
          var win;
          if (nativeEventTarget.window === nativeEventTarget) {
            win = nativeEventTarget;
          } else {
            var doc = nativeEventTarget.ownerDocument;
            if (doc) {
              win = doc.defaultView || doc.parentWindow;
            } else {
              win = window;
            }
          }
          var from;
          var to;
          if (isOutEvent) {
            var _related = nativeEvent.relatedTarget || nativeEvent.toElement;
            from = targetInst;
            to = _related ? getClosestInstanceFromNode(_related) : null;
            if (to !== null) {
              var nearestMounted = getNearestMountedFiber(to);
              if (to !== nearestMounted || to.tag !== HostComponent && to.tag !== HostText) {
                to = null;
              }
            }
          } else {
            from = null;
            to = targetInst;
          }
          if (from === to) {
            return;
          }
          var SyntheticEventCtor = SyntheticMouseEvent;
          var leaveEventType = "onMouseLeave";
          var enterEventType = "onMouseEnter";
          var eventTypePrefix = "mouse";
          if (domEventName === "pointerout" || domEventName === "pointerover") {
            SyntheticEventCtor = SyntheticPointerEvent;
            leaveEventType = "onPointerLeave";
            enterEventType = "onPointerEnter";
            eventTypePrefix = "pointer";
          }
          var fromNode = from == null ? win : getNodeFromInstance(from);
          var toNode = to == null ? win : getNodeFromInstance(to);
          var leave = new SyntheticEventCtor(leaveEventType, eventTypePrefix + "leave", from, nativeEvent, nativeEventTarget);
          leave.target = fromNode;
          leave.relatedTarget = toNode;
          var enter = null;
          var nativeTargetInst = getClosestInstanceFromNode(nativeEventTarget);
          if (nativeTargetInst === targetInst) {
            var enterEvent = new SyntheticEventCtor(enterEventType, eventTypePrefix + "enter", to, nativeEvent, nativeEventTarget);
            enterEvent.target = toNode;
            enterEvent.relatedTarget = fromNode;
            enter = enterEvent;
          }
          accumulateEnterLeaveTwoPhaseListeners(dispatchQueue, leave, enter, from, to);
        }
        function is(x2, y2) {
          return x2 === y2 && (x2 !== 0 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2;
        }
        var objectIs = typeof Object.is === "function" ? Object.is : is;
        function shallowEqual2(objA, objB) {
          if (objectIs(objA, objB)) {
            return true;
          }
          if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null) {
            return false;
          }
          var keysA = Object.keys(objA);
          var keysB = Object.keys(objB);
          if (keysA.length !== keysB.length) {
            return false;
          }
          for (var i2 = 0; i2 < keysA.length; i2++) {
            var currentKey = keysA[i2];
            if (!hasOwnProperty.call(objB, currentKey) || !objectIs(objA[currentKey], objB[currentKey])) {
              return false;
            }
          }
          return true;
        }
        function getLeafNode(node) {
          while (node && node.firstChild) {
            node = node.firstChild;
          }
          return node;
        }
        function getSiblingNode(node) {
          while (node) {
            if (node.nextSibling) {
              return node.nextSibling;
            }
            node = node.parentNode;
          }
        }
        function getNodeForCharacterOffset(root2, offset) {
          var node = getLeafNode(root2);
          var nodeStart = 0;
          var nodeEnd = 0;
          while (node) {
            if (node.nodeType === TEXT_NODE) {
              nodeEnd = nodeStart + node.textContent.length;
              if (nodeStart <= offset && nodeEnd >= offset) {
                return {
                  node,
                  offset: offset - nodeStart
                };
              }
              nodeStart = nodeEnd;
            }
            node = getLeafNode(getSiblingNode(node));
          }
        }
        function getOffsets(outerNode) {
          var ownerDocument = outerNode.ownerDocument;
          var win = ownerDocument && ownerDocument.defaultView || window;
          var selection = win.getSelection && win.getSelection();
          if (!selection || selection.rangeCount === 0) {
            return null;
          }
          var anchorNode = selection.anchorNode, anchorOffset = selection.anchorOffset, focusNode = selection.focusNode, focusOffset = selection.focusOffset;
          try {
            anchorNode.nodeType;
            focusNode.nodeType;
          } catch (e) {
            return null;
          }
          return getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset);
        }
        function getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset) {
          var length = 0;
          var start = -1;
          var end = -1;
          var indexWithinAnchor = 0;
          var indexWithinFocus = 0;
          var node = outerNode;
          var parentNode = null;
          outer:
            while (true) {
              var next = null;
              while (true) {
                if (node === anchorNode && (anchorOffset === 0 || node.nodeType === TEXT_NODE)) {
                  start = length + anchorOffset;
                }
                if (node === focusNode && (focusOffset === 0 || node.nodeType === TEXT_NODE)) {
                  end = length + focusOffset;
                }
                if (node.nodeType === TEXT_NODE) {
                  length += node.nodeValue.length;
                }
                if ((next = node.firstChild) === null) {
                  break;
                }
                parentNode = node;
                node = next;
              }
              while (true) {
                if (node === outerNode) {
                  break outer;
                }
                if (parentNode === anchorNode && ++indexWithinAnchor === anchorOffset) {
                  start = length;
                }
                if (parentNode === focusNode && ++indexWithinFocus === focusOffset) {
                  end = length;
                }
                if ((next = node.nextSibling) !== null) {
                  break;
                }
                node = parentNode;
                parentNode = node.parentNode;
              }
              node = next;
            }
          if (start === -1 || end === -1) {
            return null;
          }
          return {
            start,
            end
          };
        }
        function setOffsets(node, offsets) {
          var doc = node.ownerDocument || document;
          var win = doc && doc.defaultView || window;
          if (!win.getSelection) {
            return;
          }
          var selection = win.getSelection();
          var length = node.textContent.length;
          var start = Math.min(offsets.start, length);
          var end = offsets.end === void 0 ? start : Math.min(offsets.end, length);
          if (!selection.extend && start > end) {
            var temp = end;
            end = start;
            start = temp;
          }
          var startMarker = getNodeForCharacterOffset(node, start);
          var endMarker = getNodeForCharacterOffset(node, end);
          if (startMarker && endMarker) {
            if (selection.rangeCount === 1 && selection.anchorNode === startMarker.node && selection.anchorOffset === startMarker.offset && selection.focusNode === endMarker.node && selection.focusOffset === endMarker.offset) {
              return;
            }
            var range = doc.createRange();
            range.setStart(startMarker.node, startMarker.offset);
            selection.removeAllRanges();
            if (start > end) {
              selection.addRange(range);
              selection.extend(endMarker.node, endMarker.offset);
            } else {
              range.setEnd(endMarker.node, endMarker.offset);
              selection.addRange(range);
            }
          }
        }
        function isTextNode(node) {
          return node && node.nodeType === TEXT_NODE;
        }
        function containsNode(outerNode, innerNode) {
          if (!outerNode || !innerNode) {
            return false;
          } else if (outerNode === innerNode) {
            return true;
          } else if (isTextNode(outerNode)) {
            return false;
          } else if (isTextNode(innerNode)) {
            return containsNode(outerNode, innerNode.parentNode);
          } else if ("contains" in outerNode) {
            return outerNode.contains(innerNode);
          } else if (outerNode.compareDocumentPosition) {
            return !!(outerNode.compareDocumentPosition(innerNode) & 16);
          } else {
            return false;
          }
        }
        function isInDocument(node) {
          return node && node.ownerDocument && containsNode(node.ownerDocument.documentElement, node);
        }
        function isSameOriginFrame(iframe) {
          try {
            return typeof iframe.contentWindow.location.href === "string";
          } catch (err) {
            return false;
          }
        }
        function getActiveElementDeep() {
          var win = window;
          var element = getActiveElement();
          while (element instanceof win.HTMLIFrameElement) {
            if (isSameOriginFrame(element)) {
              win = element.contentWindow;
            } else {
              return element;
            }
            element = getActiveElement(win.document);
          }
          return element;
        }
        function hasSelectionCapabilities(elem) {
          var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
          return nodeName && (nodeName === "input" && (elem.type === "text" || elem.type === "search" || elem.type === "tel" || elem.type === "url" || elem.type === "password") || nodeName === "textarea" || elem.contentEditable === "true");
        }
        function getSelectionInformation() {
          var focusedElem = getActiveElementDeep();
          return {
            focusedElem,
            selectionRange: hasSelectionCapabilities(focusedElem) ? getSelection(focusedElem) : null
          };
        }
        function restoreSelection(priorSelectionInformation) {
          var curFocusedElem = getActiveElementDeep();
          var priorFocusedElem = priorSelectionInformation.focusedElem;
          var priorSelectionRange = priorSelectionInformation.selectionRange;
          if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) {
            if (priorSelectionRange !== null && hasSelectionCapabilities(priorFocusedElem)) {
              setSelection(priorFocusedElem, priorSelectionRange);
            }
            var ancestors = [];
            var ancestor = priorFocusedElem;
            while (ancestor = ancestor.parentNode) {
              if (ancestor.nodeType === ELEMENT_NODE) {
                ancestors.push({
                  element: ancestor,
                  left: ancestor.scrollLeft,
                  top: ancestor.scrollTop
                });
              }
            }
            if (typeof priorFocusedElem.focus === "function") {
              priorFocusedElem.focus();
            }
            for (var i2 = 0; i2 < ancestors.length; i2++) {
              var info = ancestors[i2];
              info.element.scrollLeft = info.left;
              info.element.scrollTop = info.top;
            }
          }
        }
        function getSelection(input) {
          var selection;
          if ("selectionStart" in input) {
            selection = {
              start: input.selectionStart,
              end: input.selectionEnd
            };
          } else {
            selection = getOffsets(input);
          }
          return selection || {
            start: 0,
            end: 0
          };
        }
        function setSelection(input, offsets) {
          var start = offsets.start;
          var end = offsets.end;
          if (end === void 0) {
            end = start;
          }
          if ("selectionStart" in input) {
            input.selectionStart = start;
            input.selectionEnd = Math.min(end, input.value.length);
          } else {
            setOffsets(input, offsets);
          }
        }
        var skipSelectionChangeEvent = canUseDOM2 && "documentMode" in document && document.documentMode <= 11;
        function registerEvents$3() {
          registerTwoPhaseEvent("onSelect", ["focusout", "contextmenu", "dragend", "focusin", "keydown", "keyup", "mousedown", "mouseup", "selectionchange"]);
        }
        var activeElement$1 = null;
        var activeElementInst$1 = null;
        var lastSelection = null;
        var mouseDown = false;
        function getSelection$1(node) {
          if ("selectionStart" in node && hasSelectionCapabilities(node)) {
            return {
              start: node.selectionStart,
              end: node.selectionEnd
            };
          } else {
            var win = node.ownerDocument && node.ownerDocument.defaultView || window;
            var selection = win.getSelection();
            return {
              anchorNode: selection.anchorNode,
              anchorOffset: selection.anchorOffset,
              focusNode: selection.focusNode,
              focusOffset: selection.focusOffset
            };
          }
        }
        function getEventTargetDocument(eventTarget) {
          return eventTarget.window === eventTarget ? eventTarget.document : eventTarget.nodeType === DOCUMENT_NODE ? eventTarget : eventTarget.ownerDocument;
        }
        function constructSelectEvent(dispatchQueue, nativeEvent, nativeEventTarget) {
          var doc = getEventTargetDocument(nativeEventTarget);
          if (mouseDown || activeElement$1 == null || activeElement$1 !== getActiveElement(doc)) {
            return;
          }
          var currentSelection = getSelection$1(activeElement$1);
          if (!lastSelection || !shallowEqual2(lastSelection, currentSelection)) {
            lastSelection = currentSelection;
            var listeners = accumulateTwoPhaseListeners(activeElementInst$1, "onSelect");
            if (listeners.length > 0) {
              var event = new SyntheticEvent("onSelect", "select", null, nativeEvent, nativeEventTarget);
              dispatchQueue.push({
                event,
                listeners
              });
              event.target = activeElement$1;
            }
          }
        }
        function extractEvents$3(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags, targetContainer) {
          var targetNode = targetInst ? getNodeFromInstance(targetInst) : window;
          switch (domEventName) {
            case "focusin":
              if (isTextInputElement(targetNode) || targetNode.contentEditable === "true") {
                activeElement$1 = targetNode;
                activeElementInst$1 = targetInst;
                lastSelection = null;
              }
              break;
            case "focusout":
              activeElement$1 = null;
              activeElementInst$1 = null;
              lastSelection = null;
              break;
            case "mousedown":
              mouseDown = true;
              break;
            case "contextmenu":
            case "mouseup":
            case "dragend":
              mouseDown = false;
              constructSelectEvent(dispatchQueue, nativeEvent, nativeEventTarget);
              break;
            case "selectionchange":
              if (skipSelectionChangeEvent) {
                break;
              }
            case "keydown":
            case "keyup":
              constructSelectEvent(dispatchQueue, nativeEvent, nativeEventTarget);
          }
        }
        function makePrefixMap(styleProp, eventName) {
          var prefixes2 = {};
          prefixes2[styleProp.toLowerCase()] = eventName.toLowerCase();
          prefixes2["Webkit" + styleProp] = "webkit" + eventName;
          prefixes2["Moz" + styleProp] = "moz" + eventName;
          return prefixes2;
        }
        var vendorPrefixes = {
          animationend: makePrefixMap("Animation", "AnimationEnd"),
          animationiteration: makePrefixMap("Animation", "AnimationIteration"),
          animationstart: makePrefixMap("Animation", "AnimationStart"),
          transitionend: makePrefixMap("Transition", "TransitionEnd")
        };
        var prefixedEventNames = {};
        var style = {};
        if (canUseDOM2) {
          style = document.createElement("div").style;
          if (!("AnimationEvent" in window)) {
            delete vendorPrefixes.animationend.animation;
            delete vendorPrefixes.animationiteration.animation;
            delete vendorPrefixes.animationstart.animation;
          }
          if (!("TransitionEvent" in window)) {
            delete vendorPrefixes.transitionend.transition;
          }
        }
        function getVendorPrefixedEventName(eventName) {
          if (prefixedEventNames[eventName]) {
            return prefixedEventNames[eventName];
          } else if (!vendorPrefixes[eventName]) {
            return eventName;
          }
          var prefixMap = vendorPrefixes[eventName];
          for (var styleProp in prefixMap) {
            if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) {
              return prefixedEventNames[eventName] = prefixMap[styleProp];
            }
          }
          return eventName;
        }
        var ANIMATION_END = getVendorPrefixedEventName("animationend");
        var ANIMATION_ITERATION = getVendorPrefixedEventName("animationiteration");
        var ANIMATION_START = getVendorPrefixedEventName("animationstart");
        var TRANSITION_END = getVendorPrefixedEventName("transitionend");
        var topLevelEventsToReactNames = /* @__PURE__ */ new Map();
        var simpleEventPluginEvents = ["abort", "auxClick", "cancel", "canPlay", "canPlayThrough", "click", "close", "contextMenu", "copy", "cut", "drag", "dragEnd", "dragEnter", "dragExit", "dragLeave", "dragOver", "dragStart", "drop", "durationChange", "emptied", "encrypted", "ended", "error", "gotPointerCapture", "input", "invalid", "keyDown", "keyPress", "keyUp", "load", "loadedData", "loadedMetadata", "loadStart", "lostPointerCapture", "mouseDown", "mouseMove", "mouseOut", "mouseOver", "mouseUp", "paste", "pause", "play", "playing", "pointerCancel", "pointerDown", "pointerMove", "pointerOut", "pointerOver", "pointerUp", "progress", "rateChange", "reset", "resize", "seeked", "seeking", "stalled", "submit", "suspend", "timeUpdate", "touchCancel", "touchEnd", "touchStart", "volumeChange", "scroll", "toggle", "touchMove", "waiting", "wheel"];
        function registerSimpleEvent(domEventName, reactName) {
          topLevelEventsToReactNames.set(domEventName, reactName);
          registerTwoPhaseEvent(reactName, [domEventName]);
        }
        function registerSimpleEvents() {
          for (var i2 = 0; i2 < simpleEventPluginEvents.length; i2++) {
            var eventName = simpleEventPluginEvents[i2];
            var domEventName = eventName.toLowerCase();
            var capitalizedEvent = eventName[0].toUpperCase() + eventName.slice(1);
            registerSimpleEvent(domEventName, "on" + capitalizedEvent);
          }
          registerSimpleEvent(ANIMATION_END, "onAnimationEnd");
          registerSimpleEvent(ANIMATION_ITERATION, "onAnimationIteration");
          registerSimpleEvent(ANIMATION_START, "onAnimationStart");
          registerSimpleEvent("dblclick", "onDoubleClick");
          registerSimpleEvent("focusin", "onFocus");
          registerSimpleEvent("focusout", "onBlur");
          registerSimpleEvent(TRANSITION_END, "onTransitionEnd");
        }
        function extractEvents$4(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags, targetContainer) {
          var reactName = topLevelEventsToReactNames.get(domEventName);
          if (reactName === void 0) {
            return;
          }
          var SyntheticEventCtor = SyntheticEvent;
          var reactEventType = domEventName;
          switch (domEventName) {
            case "keypress":
              if (getEventCharCode(nativeEvent) === 0) {
                return;
              }
            case "keydown":
            case "keyup":
              SyntheticEventCtor = SyntheticKeyboardEvent;
              break;
            case "focusin":
              reactEventType = "focus";
              SyntheticEventCtor = SyntheticFocusEvent;
              break;
            case "focusout":
              reactEventType = "blur";
              SyntheticEventCtor = SyntheticFocusEvent;
              break;
            case "beforeblur":
            case "afterblur":
              SyntheticEventCtor = SyntheticFocusEvent;
              break;
            case "click":
              if (nativeEvent.button === 2) {
                return;
              }
            case "auxclick":
            case "dblclick":
            case "mousedown":
            case "mousemove":
            case "mouseup":
            case "mouseout":
            case "mouseover":
            case "contextmenu":
              SyntheticEventCtor = SyntheticMouseEvent;
              break;
            case "drag":
            case "dragend":
            case "dragenter":
            case "dragexit":
            case "dragleave":
            case "dragover":
            case "dragstart":
            case "drop":
              SyntheticEventCtor = SyntheticDragEvent;
              break;
            case "touchcancel":
            case "touchend":
            case "touchmove":
            case "touchstart":
              SyntheticEventCtor = SyntheticTouchEvent;
              break;
            case ANIMATION_END:
            case ANIMATION_ITERATION:
            case ANIMATION_START:
              SyntheticEventCtor = SyntheticAnimationEvent;
              break;
            case TRANSITION_END:
              SyntheticEventCtor = SyntheticTransitionEvent;
              break;
            case "scroll":
              SyntheticEventCtor = SyntheticUIEvent;
              break;
            case "wheel":
              SyntheticEventCtor = SyntheticWheelEvent;
              break;
            case "copy":
            case "cut":
            case "paste":
              SyntheticEventCtor = SyntheticClipboardEvent;
              break;
            case "gotpointercapture":
            case "lostpointercapture":
            case "pointercancel":
            case "pointerdown":
            case "pointermove":
            case "pointerout":
            case "pointerover":
            case "pointerup":
              SyntheticEventCtor = SyntheticPointerEvent;
              break;
          }
          var inCapturePhase = (eventSystemFlags & IS_CAPTURE_PHASE) !== 0;
          {
            var accumulateTargetOnly = !inCapturePhase && // TODO: ideally, we'd eventually add all events from
            // nonDelegatedEvents list in DOMPluginEventSystem.
            // Then we can remove this special list.
            // This is a breaking change that can wait until React 18.
            domEventName === "scroll";
            var _listeners = accumulateSinglePhaseListeners(targetInst, reactName, nativeEvent.type, inCapturePhase, accumulateTargetOnly);
            if (_listeners.length > 0) {
              var _event = new SyntheticEventCtor(reactName, reactEventType, null, nativeEvent, nativeEventTarget);
              dispatchQueue.push({
                event: _event,
                listeners: _listeners
              });
            }
          }
        }
        registerSimpleEvents();
        registerEvents$2();
        registerEvents$1();
        registerEvents$3();
        registerEvents();
        function extractEvents$5(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags, targetContainer) {
          extractEvents$4(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags);
          var shouldProcessPolyfillPlugins = (eventSystemFlags & SHOULD_NOT_PROCESS_POLYFILL_EVENT_PLUGINS) === 0;
          if (shouldProcessPolyfillPlugins) {
            extractEvents$2(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget);
            extractEvents$1(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget);
            extractEvents$3(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget);
            extractEvents(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget);
          }
        }
        var mediaEventTypes = ["abort", "canplay", "canplaythrough", "durationchange", "emptied", "encrypted", "ended", "error", "loadeddata", "loadedmetadata", "loadstart", "pause", "play", "playing", "progress", "ratechange", "resize", "seeked", "seeking", "stalled", "suspend", "timeupdate", "volumechange", "waiting"];
        var nonDelegatedEvents = new Set(["cancel", "close", "invalid", "load", "scroll", "toggle"].concat(mediaEventTypes));
        function executeDispatch(event, listener2, currentTarget) {
          var type = event.type || "unknown-event";
          event.currentTarget = currentTarget;
          invokeGuardedCallbackAndCatchFirstError(type, listener2, void 0, event);
          event.currentTarget = null;
        }
        function processDispatchQueueItemsInOrder(event, dispatchListeners, inCapturePhase) {
          var previousInstance;
          if (inCapturePhase) {
            for (var i2 = dispatchListeners.length - 1; i2 >= 0; i2--) {
              var _dispatchListeners$i = dispatchListeners[i2], instance = _dispatchListeners$i.instance, currentTarget = _dispatchListeners$i.currentTarget, listener2 = _dispatchListeners$i.listener;
              if (instance !== previousInstance && event.isPropagationStopped()) {
                return;
              }
              executeDispatch(event, listener2, currentTarget);
              previousInstance = instance;
            }
          } else {
            for (var _i = 0; _i < dispatchListeners.length; _i++) {
              var _dispatchListeners$_i = dispatchListeners[_i], _instance = _dispatchListeners$_i.instance, _currentTarget = _dispatchListeners$_i.currentTarget, _listener = _dispatchListeners$_i.listener;
              if (_instance !== previousInstance && event.isPropagationStopped()) {
                return;
              }
              executeDispatch(event, _listener, _currentTarget);
              previousInstance = _instance;
            }
          }
        }
        function processDispatchQueue(dispatchQueue, eventSystemFlags) {
          var inCapturePhase = (eventSystemFlags & IS_CAPTURE_PHASE) !== 0;
          for (var i2 = 0; i2 < dispatchQueue.length; i2++) {
            var _dispatchQueue$i = dispatchQueue[i2], event = _dispatchQueue$i.event, listeners = _dispatchQueue$i.listeners;
            processDispatchQueueItemsInOrder(event, listeners, inCapturePhase);
          }
          rethrowCaughtError();
        }
        function dispatchEventsForPlugins(domEventName, eventSystemFlags, nativeEvent, targetInst, targetContainer) {
          var nativeEventTarget = getEventTarget(nativeEvent);
          var dispatchQueue = [];
          extractEvents$5(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags);
          processDispatchQueue(dispatchQueue, eventSystemFlags);
        }
        function listenToNonDelegatedEvent(domEventName, targetElement) {
          {
            if (!nonDelegatedEvents.has(domEventName)) {
              error('Did not expect a listenToNonDelegatedEvent() call for "%s". This is a bug in React. Please file an issue.', domEventName);
            }
          }
          var isCapturePhaseListener = false;
          var listenerSet = getEventListenerSet(targetElement);
          var listenerSetKey = getListenerSetKey(domEventName, isCapturePhaseListener);
          if (!listenerSet.has(listenerSetKey)) {
            addTrappedEventListener(targetElement, domEventName, IS_NON_DELEGATED, isCapturePhaseListener);
            listenerSet.add(listenerSetKey);
          }
        }
        function listenToNativeEvent(domEventName, isCapturePhaseListener, target) {
          {
            if (nonDelegatedEvents.has(domEventName) && !isCapturePhaseListener) {
              error('Did not expect a listenToNativeEvent() call for "%s" in the bubble phase. This is a bug in React. Please file an issue.', domEventName);
            }
          }
          var eventSystemFlags = 0;
          if (isCapturePhaseListener) {
            eventSystemFlags |= IS_CAPTURE_PHASE;
          }
          addTrappedEventListener(target, domEventName, eventSystemFlags, isCapturePhaseListener);
        }
        var listeningMarker = "_reactListening" + Math.random().toString(36).slice(2);
        function listenToAllSupportedEvents(rootContainerElement) {
          if (!rootContainerElement[listeningMarker]) {
            rootContainerElement[listeningMarker] = true;
            allNativeEvents.forEach(function(domEventName) {
              if (domEventName !== "selectionchange") {
                if (!nonDelegatedEvents.has(domEventName)) {
                  listenToNativeEvent(domEventName, false, rootContainerElement);
                }
                listenToNativeEvent(domEventName, true, rootContainerElement);
              }
            });
            var ownerDocument = rootContainerElement.nodeType === DOCUMENT_NODE ? rootContainerElement : rootContainerElement.ownerDocument;
            if (ownerDocument !== null) {
              if (!ownerDocument[listeningMarker]) {
                ownerDocument[listeningMarker] = true;
                listenToNativeEvent("selectionchange", false, ownerDocument);
              }
            }
          }
        }
        function addTrappedEventListener(targetContainer, domEventName, eventSystemFlags, isCapturePhaseListener, isDeferredListenerForLegacyFBSupport) {
          var listener2 = createEventListenerWrapperWithPriority(targetContainer, domEventName, eventSystemFlags);
          var isPassiveListener = void 0;
          if (passiveBrowserEventsSupported) {
            if (domEventName === "touchstart" || domEventName === "touchmove" || domEventName === "wheel") {
              isPassiveListener = true;
            }
          }
          targetContainer = targetContainer;
          var unsubscribeListener;
          if (isCapturePhaseListener) {
            if (isPassiveListener !== void 0) {
              unsubscribeListener = addEventCaptureListenerWithPassiveFlag(targetContainer, domEventName, listener2, isPassiveListener);
            } else {
              unsubscribeListener = addEventCaptureListener(targetContainer, domEventName, listener2);
            }
          } else {
            if (isPassiveListener !== void 0) {
              unsubscribeListener = addEventBubbleListenerWithPassiveFlag(targetContainer, domEventName, listener2, isPassiveListener);
            } else {
              unsubscribeListener = addEventBubbleListener(targetContainer, domEventName, listener2);
            }
          }
        }
        function isMatchingRootContainer(grandContainer, targetContainer) {
          return grandContainer === targetContainer || grandContainer.nodeType === COMMENT_NODE && grandContainer.parentNode === targetContainer;
        }
        function dispatchEventForPluginEventSystem(domEventName, eventSystemFlags, nativeEvent, targetInst, targetContainer) {
          var ancestorInst = targetInst;
          if ((eventSystemFlags & IS_EVENT_HANDLE_NON_MANAGED_NODE) === 0 && (eventSystemFlags & IS_NON_DELEGATED) === 0) {
            var targetContainerNode = targetContainer;
            if (targetInst !== null) {
              var node = targetInst;
              mainLoop:
                while (true) {
                  if (node === null) {
                    return;
                  }
                  var nodeTag = node.tag;
                  if (nodeTag === HostRoot || nodeTag === HostPortal) {
                    var container = node.stateNode.containerInfo;
                    if (isMatchingRootContainer(container, targetContainerNode)) {
                      break;
                    }
                    if (nodeTag === HostPortal) {
                      var grandNode = node.return;
                      while (grandNode !== null) {
                        var grandTag = grandNode.tag;
                        if (grandTag === HostRoot || grandTag === HostPortal) {
                          var grandContainer = grandNode.stateNode.containerInfo;
                          if (isMatchingRootContainer(grandContainer, targetContainerNode)) {
                            return;
                          }
                        }
                        grandNode = grandNode.return;
                      }
                    }
                    while (container !== null) {
                      var parentNode = getClosestInstanceFromNode(container);
                      if (parentNode === null) {
                        return;
                      }
                      var parentTag = parentNode.tag;
                      if (parentTag === HostComponent || parentTag === HostText) {
                        node = ancestorInst = parentNode;
                        continue mainLoop;
                      }
                      container = container.parentNode;
                    }
                  }
                  node = node.return;
                }
            }
          }
          batchedUpdates(function() {
            return dispatchEventsForPlugins(domEventName, eventSystemFlags, nativeEvent, ancestorInst);
          });
        }
        function createDispatchListener(instance, listener2, currentTarget) {
          return {
            instance,
            listener: listener2,
            currentTarget
          };
        }
        function accumulateSinglePhaseListeners(targetFiber, reactName, nativeEventType, inCapturePhase, accumulateTargetOnly, nativeEvent) {
          var captureName = reactName !== null ? reactName + "Capture" : null;
          var reactEventName = inCapturePhase ? captureName : reactName;
          var listeners = [];
          var instance = targetFiber;
          var lastHostComponent = null;
          while (instance !== null) {
            var _instance2 = instance, stateNode = _instance2.stateNode, tag = _instance2.tag;
            if (tag === HostComponent && stateNode !== null) {
              lastHostComponent = stateNode;
              if (reactEventName !== null) {
                var listener2 = getListener(instance, reactEventName);
                if (listener2 != null) {
                  listeners.push(createDispatchListener(instance, listener2, lastHostComponent));
                }
              }
            }
            if (accumulateTargetOnly) {
              break;
            }
            instance = instance.return;
          }
          return listeners;
        }
        function accumulateTwoPhaseListeners(targetFiber, reactName) {
          var captureName = reactName + "Capture";
          var listeners = [];
          var instance = targetFiber;
          while (instance !== null) {
            var _instance3 = instance, stateNode = _instance3.stateNode, tag = _instance3.tag;
            if (tag === HostComponent && stateNode !== null) {
              var currentTarget = stateNode;
              var captureListener = getListener(instance, captureName);
              if (captureListener != null) {
                listeners.unshift(createDispatchListener(instance, captureListener, currentTarget));
              }
              var bubbleListener = getListener(instance, reactName);
              if (bubbleListener != null) {
                listeners.push(createDispatchListener(instance, bubbleListener, currentTarget));
              }
            }
            instance = instance.return;
          }
          return listeners;
        }
        function getParent2(inst) {
          if (inst === null) {
            return null;
          }
          do {
            inst = inst.return;
          } while (inst && inst.tag !== HostComponent);
          if (inst) {
            return inst;
          }
          return null;
        }
        function getLowestCommonAncestor(instA, instB) {
          var nodeA = instA;
          var nodeB = instB;
          var depthA = 0;
          for (var tempA = nodeA; tempA; tempA = getParent2(tempA)) {
            depthA++;
          }
          var depthB = 0;
          for (var tempB = nodeB; tempB; tempB = getParent2(tempB)) {
            depthB++;
          }
          while (depthA - depthB > 0) {
            nodeA = getParent2(nodeA);
            depthA--;
          }
          while (depthB - depthA > 0) {
            nodeB = getParent2(nodeB);
            depthB--;
          }
          var depth = depthA;
          while (depth--) {
            if (nodeA === nodeB || nodeB !== null && nodeA === nodeB.alternate) {
              return nodeA;
            }
            nodeA = getParent2(nodeA);
            nodeB = getParent2(nodeB);
          }
          return null;
        }
        function accumulateEnterLeaveListenersForEvent(dispatchQueue, event, target, common, inCapturePhase) {
          var registrationName = event._reactName;
          var listeners = [];
          var instance = target;
          while (instance !== null) {
            if (instance === common) {
              break;
            }
            var _instance4 = instance, alternate = _instance4.alternate, stateNode = _instance4.stateNode, tag = _instance4.tag;
            if (alternate !== null && alternate === common) {
              break;
            }
            if (tag === HostComponent && stateNode !== null) {
              var currentTarget = stateNode;
              if (inCapturePhase) {
                var captureListener = getListener(instance, registrationName);
                if (captureListener != null) {
                  listeners.unshift(createDispatchListener(instance, captureListener, currentTarget));
                }
              } else if (!inCapturePhase) {
                var bubbleListener = getListener(instance, registrationName);
                if (bubbleListener != null) {
                  listeners.push(createDispatchListener(instance, bubbleListener, currentTarget));
                }
              }
            }
            instance = instance.return;
          }
          if (listeners.length !== 0) {
            dispatchQueue.push({
              event,
              listeners
            });
          }
        }
        function accumulateEnterLeaveTwoPhaseListeners(dispatchQueue, leaveEvent, enterEvent, from, to) {
          var common = from && to ? getLowestCommonAncestor(from, to) : null;
          if (from !== null) {
            accumulateEnterLeaveListenersForEvent(dispatchQueue, leaveEvent, from, common, false);
          }
          if (to !== null && enterEvent !== null) {
            accumulateEnterLeaveListenersForEvent(dispatchQueue, enterEvent, to, common, true);
          }
        }
        function getListenerSetKey(domEventName, capture) {
          return domEventName + "__" + (capture ? "capture" : "bubble");
        }
        var didWarnInvalidHydration = false;
        var DANGEROUSLY_SET_INNER_HTML = "dangerouslySetInnerHTML";
        var SUPPRESS_CONTENT_EDITABLE_WARNING = "suppressContentEditableWarning";
        var SUPPRESS_HYDRATION_WARNING = "suppressHydrationWarning";
        var AUTOFOCUS = "autoFocus";
        var CHILDREN = "children";
        var STYLE = "style";
        var HTML$1 = "__html";
        var warnedUnknownTags;
        var validatePropertiesInDevelopment;
        var warnForPropDifference;
        var warnForExtraAttributes;
        var warnForInvalidEventListener;
        var canDiffStyleForHydrationWarning;
        var normalizeHTML;
        {
          warnedUnknownTags = {
            // There are working polyfills for <dialog>. Let people use it.
            dialog: true,
            // Electron ships a custom <webview> tag to display external web content in
            // an isolated frame and process.
            // This tag is not present in non Electron environments such as JSDom which
            // is often used for testing purposes.
            // @see https://electronjs.org/docs/api/webview-tag
            webview: true
          };
          validatePropertiesInDevelopment = function(type, props) {
            validateProperties(type, props);
            validateProperties$1(type, props);
            validateProperties$2(type, props, {
              registrationNameDependencies,
              possibleRegistrationNames
            });
          };
          canDiffStyleForHydrationWarning = canUseDOM2 && !document.documentMode;
          warnForPropDifference = function(propName, serverValue, clientValue) {
            if (didWarnInvalidHydration) {
              return;
            }
            var normalizedClientValue = normalizeMarkupForTextOrAttribute(clientValue);
            var normalizedServerValue = normalizeMarkupForTextOrAttribute(serverValue);
            if (normalizedServerValue === normalizedClientValue) {
              return;
            }
            didWarnInvalidHydration = true;
            error("Prop `%s` did not match. Server: %s Client: %s", propName, JSON.stringify(normalizedServerValue), JSON.stringify(normalizedClientValue));
          };
          warnForExtraAttributes = function(attributeNames2) {
            if (didWarnInvalidHydration) {
              return;
            }
            didWarnInvalidHydration = true;
            var names = [];
            attributeNames2.forEach(function(name) {
              names.push(name);
            });
            error("Extra attributes from the server: %s", names);
          };
          warnForInvalidEventListener = function(registrationName, listener2) {
            if (listener2 === false) {
              error("Expected `%s` listener to be a function, instead got `false`.\n\nIf you used to conditionally omit it with %s={condition && value}, pass %s={condition ? value : undefined} instead.", registrationName, registrationName, registrationName);
            } else {
              error("Expected `%s` listener to be a function, instead got a value of `%s` type.", registrationName, typeof listener2);
            }
          };
          normalizeHTML = function(parent, html) {
            var testElement2 = parent.namespaceURI === HTML_NAMESPACE ? parent.ownerDocument.createElement(parent.tagName) : parent.ownerDocument.createElementNS(parent.namespaceURI, parent.tagName);
            testElement2.innerHTML = html;
            return testElement2.innerHTML;
          };
        }
        var NORMALIZE_NEWLINES_REGEX = /\r\n?/g;
        var NORMALIZE_NULL_AND_REPLACEMENT_REGEX = /\u0000|\uFFFD/g;
        function normalizeMarkupForTextOrAttribute(markup) {
          {
            checkHtmlStringCoercion(markup);
          }
          var markupString = typeof markup === "string" ? markup : "" + markup;
          return markupString.replace(NORMALIZE_NEWLINES_REGEX, "\n").replace(NORMALIZE_NULL_AND_REPLACEMENT_REGEX, "");
        }
        function checkForUnmatchedText(serverText, clientText, isConcurrentMode, shouldWarnDev) {
          var normalizedClientText = normalizeMarkupForTextOrAttribute(clientText);
          var normalizedServerText = normalizeMarkupForTextOrAttribute(serverText);
          if (normalizedServerText === normalizedClientText) {
            return;
          }
          if (shouldWarnDev) {
            {
              if (!didWarnInvalidHydration) {
                didWarnInvalidHydration = true;
                error('Text content did not match. Server: "%s" Client: "%s"', normalizedServerText, normalizedClientText);
              }
            }
          }
          if (isConcurrentMode && enableClientRenderFallbackOnTextMismatch) {
            throw new Error("Text content does not match server-rendered HTML.");
          }
        }
        function getOwnerDocumentFromRootContainer(rootContainerElement) {
          return rootContainerElement.nodeType === DOCUMENT_NODE ? rootContainerElement : rootContainerElement.ownerDocument;
        }
        function noop2() {
        }
        function trapClickOnNonInteractiveElement(node) {
          node.onclick = noop2;
        }
        function setInitialDOMProperties(tag, domElement, rootContainerElement, nextProps, isCustomComponentTag) {
          for (var propKey in nextProps) {
            if (!nextProps.hasOwnProperty(propKey)) {
              continue;
            }
            var nextProp = nextProps[propKey];
            if (propKey === STYLE) {
              {
                if (nextProp) {
                  Object.freeze(nextProp);
                }
              }
              setValueForStyles(domElement, nextProp);
            } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
              var nextHtml = nextProp ? nextProp[HTML$1] : void 0;
              if (nextHtml != null) {
                setInnerHTML(domElement, nextHtml);
              }
            } else if (propKey === CHILDREN) {
              if (typeof nextProp === "string") {
                var canSetTextContent = tag !== "textarea" || nextProp !== "";
                if (canSetTextContent) {
                  setTextContent(domElement, nextProp);
                }
              } else if (typeof nextProp === "number") {
                setTextContent(domElement, "" + nextProp);
              }
            } else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING)
              ;
            else if (propKey === AUTOFOCUS)
              ;
            else if (registrationNameDependencies.hasOwnProperty(propKey)) {
              if (nextProp != null) {
                if (typeof nextProp !== "function") {
                  warnForInvalidEventListener(propKey, nextProp);
                }
                if (propKey === "onScroll") {
                  listenToNonDelegatedEvent("scroll", domElement);
                }
              }
            } else if (nextProp != null) {
              setValueForProperty(domElement, propKey, nextProp, isCustomComponentTag);
            }
          }
        }
        function updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, isCustomComponentTag) {
          for (var i2 = 0; i2 < updatePayload.length; i2 += 2) {
            var propKey = updatePayload[i2];
            var propValue = updatePayload[i2 + 1];
            if (propKey === STYLE) {
              setValueForStyles(domElement, propValue);
            } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
              setInnerHTML(domElement, propValue);
            } else if (propKey === CHILDREN) {
              setTextContent(domElement, propValue);
            } else {
              setValueForProperty(domElement, propKey, propValue, isCustomComponentTag);
            }
          }
        }
        function createElement3(type, props, rootContainerElement, parentNamespace) {
          var isCustomComponentTag;
          var ownerDocument = getOwnerDocumentFromRootContainer(rootContainerElement);
          var domElement;
          var namespaceURI = parentNamespace;
          if (namespaceURI === HTML_NAMESPACE) {
            namespaceURI = getIntrinsicNamespace(type);
          }
          if (namespaceURI === HTML_NAMESPACE) {
            {
              isCustomComponentTag = isCustomComponent(type, props);
              if (!isCustomComponentTag && type !== type.toLowerCase()) {
                error("<%s /> is using incorrect casing. Use PascalCase for React components, or lowercase for HTML elements.", type);
              }
            }
            if (type === "script") {
              var div = ownerDocument.createElement("div");
              div.innerHTML = "<script><\/script>";
              var firstChild = div.firstChild;
              domElement = div.removeChild(firstChild);
            } else if (typeof props.is === "string") {
              domElement = ownerDocument.createElement(type, {
                is: props.is
              });
            } else {
              domElement = ownerDocument.createElement(type);
              if (type === "select") {
                var node = domElement;
                if (props.multiple) {
                  node.multiple = true;
                } else if (props.size) {
                  node.size = props.size;
                }
              }
            }
          } else {
            domElement = ownerDocument.createElementNS(namespaceURI, type);
          }
          {
            if (namespaceURI === HTML_NAMESPACE) {
              if (!isCustomComponentTag && Object.prototype.toString.call(domElement) === "[object HTMLUnknownElement]" && !hasOwnProperty.call(warnedUnknownTags, type)) {
                warnedUnknownTags[type] = true;
                error("The tag <%s> is unrecognized in this browser. If you meant to render a React component, start its name with an uppercase letter.", type);
              }
            }
          }
          return domElement;
        }
        function createTextNode(text, rootContainerElement) {
          return getOwnerDocumentFromRootContainer(rootContainerElement).createTextNode(text);
        }
        function setInitialProperties(domElement, tag, rawProps, rootContainerElement) {
          var isCustomComponentTag = isCustomComponent(tag, rawProps);
          {
            validatePropertiesInDevelopment(tag, rawProps);
          }
          var props;
          switch (tag) {
            case "dialog":
              listenToNonDelegatedEvent("cancel", domElement);
              listenToNonDelegatedEvent("close", domElement);
              props = rawProps;
              break;
            case "iframe":
            case "object":
            case "embed":
              listenToNonDelegatedEvent("load", domElement);
              props = rawProps;
              break;
            case "video":
            case "audio":
              for (var i2 = 0; i2 < mediaEventTypes.length; i2++) {
                listenToNonDelegatedEvent(mediaEventTypes[i2], domElement);
              }
              props = rawProps;
              break;
            case "source":
              listenToNonDelegatedEvent("error", domElement);
              props = rawProps;
              break;
            case "img":
            case "image":
            case "link":
              listenToNonDelegatedEvent("error", domElement);
              listenToNonDelegatedEvent("load", domElement);
              props = rawProps;
              break;
            case "details":
              listenToNonDelegatedEvent("toggle", domElement);
              props = rawProps;
              break;
            case "input":
              initWrapperState(domElement, rawProps);
              props = getHostProps(domElement, rawProps);
              listenToNonDelegatedEvent("invalid", domElement);
              break;
            case "option":
              validateProps(domElement, rawProps);
              props = rawProps;
              break;
            case "select":
              initWrapperState$1(domElement, rawProps);
              props = getHostProps$1(domElement, rawProps);
              listenToNonDelegatedEvent("invalid", domElement);
              break;
            case "textarea":
              initWrapperState$2(domElement, rawProps);
              props = getHostProps$2(domElement, rawProps);
              listenToNonDelegatedEvent("invalid", domElement);
              break;
            default:
              props = rawProps;
          }
          assertValidProps(tag, props);
          setInitialDOMProperties(tag, domElement, rootContainerElement, props, isCustomComponentTag);
          switch (tag) {
            case "input":
              track(domElement);
              postMountWrapper(domElement, rawProps, false);
              break;
            case "textarea":
              track(domElement);
              postMountWrapper$3(domElement);
              break;
            case "option":
              postMountWrapper$1(domElement, rawProps);
              break;
            case "select":
              postMountWrapper$2(domElement, rawProps);
              break;
            default:
              if (typeof props.onClick === "function") {
                trapClickOnNonInteractiveElement(domElement);
              }
              break;
          }
        }
        function diffProperties(domElement, tag, lastRawProps, nextRawProps, rootContainerElement) {
          {
            validatePropertiesInDevelopment(tag, nextRawProps);
          }
          var updatePayload = null;
          var lastProps;
          var nextProps;
          switch (tag) {
            case "input":
              lastProps = getHostProps(domElement, lastRawProps);
              nextProps = getHostProps(domElement, nextRawProps);
              updatePayload = [];
              break;
            case "select":
              lastProps = getHostProps$1(domElement, lastRawProps);
              nextProps = getHostProps$1(domElement, nextRawProps);
              updatePayload = [];
              break;
            case "textarea":
              lastProps = getHostProps$2(domElement, lastRawProps);
              nextProps = getHostProps$2(domElement, nextRawProps);
              updatePayload = [];
              break;
            default:
              lastProps = lastRawProps;
              nextProps = nextRawProps;
              if (typeof lastProps.onClick !== "function" && typeof nextProps.onClick === "function") {
                trapClickOnNonInteractiveElement(domElement);
              }
              break;
          }
          assertValidProps(tag, nextProps);
          var propKey;
          var styleName;
          var styleUpdates = null;
          for (propKey in lastProps) {
            if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) {
              continue;
            }
            if (propKey === STYLE) {
              var lastStyle = lastProps[propKey];
              for (styleName in lastStyle) {
                if (lastStyle.hasOwnProperty(styleName)) {
                  if (!styleUpdates) {
                    styleUpdates = {};
                  }
                  styleUpdates[styleName] = "";
                }
              }
            } else if (propKey === DANGEROUSLY_SET_INNER_HTML || propKey === CHILDREN)
              ;
            else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING)
              ;
            else if (propKey === AUTOFOCUS)
              ;
            else if (registrationNameDependencies.hasOwnProperty(propKey)) {
              if (!updatePayload) {
                updatePayload = [];
              }
            } else {
              (updatePayload = updatePayload || []).push(propKey, null);
            }
          }
          for (propKey in nextProps) {
            var nextProp = nextProps[propKey];
            var lastProp = lastProps != null ? lastProps[propKey] : void 0;
            if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) {
              continue;
            }
            if (propKey === STYLE) {
              {
                if (nextProp) {
                  Object.freeze(nextProp);
                }
              }
              if (lastProp) {
                for (styleName in lastProp) {
                  if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) {
                    if (!styleUpdates) {
                      styleUpdates = {};
                    }
                    styleUpdates[styleName] = "";
                  }
                }
                for (styleName in nextProp) {
                  if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) {
                    if (!styleUpdates) {
                      styleUpdates = {};
                    }
                    styleUpdates[styleName] = nextProp[styleName];
                  }
                }
              } else {
                if (!styleUpdates) {
                  if (!updatePayload) {
                    updatePayload = [];
                  }
                  updatePayload.push(propKey, styleUpdates);
                }
                styleUpdates = nextProp;
              }
            } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
              var nextHtml = nextProp ? nextProp[HTML$1] : void 0;
              var lastHtml = lastProp ? lastProp[HTML$1] : void 0;
              if (nextHtml != null) {
                if (lastHtml !== nextHtml) {
                  (updatePayload = updatePayload || []).push(propKey, nextHtml);
                }
              }
            } else if (propKey === CHILDREN) {
              if (typeof nextProp === "string" || typeof nextProp === "number") {
                (updatePayload = updatePayload || []).push(propKey, "" + nextProp);
              }
            } else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING)
              ;
            else if (registrationNameDependencies.hasOwnProperty(propKey)) {
              if (nextProp != null) {
                if (typeof nextProp !== "function") {
                  warnForInvalidEventListener(propKey, nextProp);
                }
                if (propKey === "onScroll") {
                  listenToNonDelegatedEvent("scroll", domElement);
                }
              }
              if (!updatePayload && lastProp !== nextProp) {
                updatePayload = [];
              }
            } else {
              (updatePayload = updatePayload || []).push(propKey, nextProp);
            }
          }
          if (styleUpdates) {
            {
              validateShorthandPropertyCollisionInDev(styleUpdates, nextProps[STYLE]);
            }
            (updatePayload = updatePayload || []).push(STYLE, styleUpdates);
          }
          return updatePayload;
        }
        function updateProperties(domElement, updatePayload, tag, lastRawProps, nextRawProps) {
          if (tag === "input" && nextRawProps.type === "radio" && nextRawProps.name != null) {
            updateChecked(domElement, nextRawProps);
          }
          var wasCustomComponentTag = isCustomComponent(tag, lastRawProps);
          var isCustomComponentTag = isCustomComponent(tag, nextRawProps);
          updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, isCustomComponentTag);
          switch (tag) {
            case "input":
              updateWrapper(domElement, nextRawProps);
              break;
            case "textarea":
              updateWrapper$1(domElement, nextRawProps);
              break;
            case "select":
              postUpdateWrapper(domElement, nextRawProps);
              break;
          }
        }
        function getPossibleStandardName(propName) {
          {
            var lowerCasedName = propName.toLowerCase();
            if (!possibleStandardNames.hasOwnProperty(lowerCasedName)) {
              return null;
            }
            return possibleStandardNames[lowerCasedName] || null;
          }
        }
        function diffHydratedProperties(domElement, tag, rawProps, parentNamespace, rootContainerElement, isConcurrentMode, shouldWarnDev) {
          var isCustomComponentTag;
          var extraAttributeNames;
          {
            isCustomComponentTag = isCustomComponent(tag, rawProps);
            validatePropertiesInDevelopment(tag, rawProps);
          }
          switch (tag) {
            case "dialog":
              listenToNonDelegatedEvent("cancel", domElement);
              listenToNonDelegatedEvent("close", domElement);
              break;
            case "iframe":
            case "object":
            case "embed":
              listenToNonDelegatedEvent("load", domElement);
              break;
            case "video":
            case "audio":
              for (var i2 = 0; i2 < mediaEventTypes.length; i2++) {
                listenToNonDelegatedEvent(mediaEventTypes[i2], domElement);
              }
              break;
            case "source":
              listenToNonDelegatedEvent("error", domElement);
              break;
            case "img":
            case "image":
            case "link":
              listenToNonDelegatedEvent("error", domElement);
              listenToNonDelegatedEvent("load", domElement);
              break;
            case "details":
              listenToNonDelegatedEvent("toggle", domElement);
              break;
            case "input":
              initWrapperState(domElement, rawProps);
              listenToNonDelegatedEvent("invalid", domElement);
              break;
            case "option":
              validateProps(domElement, rawProps);
              break;
            case "select":
              initWrapperState$1(domElement, rawProps);
              listenToNonDelegatedEvent("invalid", domElement);
              break;
            case "textarea":
              initWrapperState$2(domElement, rawProps);
              listenToNonDelegatedEvent("invalid", domElement);
              break;
          }
          assertValidProps(tag, rawProps);
          {
            extraAttributeNames = /* @__PURE__ */ new Set();
            var attributes = domElement.attributes;
            for (var _i = 0; _i < attributes.length; _i++) {
              var name = attributes[_i].name.toLowerCase();
              switch (name) {
                case "value":
                  break;
                case "checked":
                  break;
                case "selected":
                  break;
                default:
                  extraAttributeNames.add(attributes[_i].name);
              }
            }
          }
          var updatePayload = null;
          for (var propKey in rawProps) {
            if (!rawProps.hasOwnProperty(propKey)) {
              continue;
            }
            var nextProp = rawProps[propKey];
            if (propKey === CHILDREN) {
              if (typeof nextProp === "string") {
                if (domElement.textContent !== nextProp) {
                  if (rawProps[SUPPRESS_HYDRATION_WARNING] !== true) {
                    checkForUnmatchedText(domElement.textContent, nextProp, isConcurrentMode, shouldWarnDev);
                  }
                  updatePayload = [CHILDREN, nextProp];
                }
              } else if (typeof nextProp === "number") {
                if (domElement.textContent !== "" + nextProp) {
                  if (rawProps[SUPPRESS_HYDRATION_WARNING] !== true) {
                    checkForUnmatchedText(domElement.textContent, nextProp, isConcurrentMode, shouldWarnDev);
                  }
                  updatePayload = [CHILDREN, "" + nextProp];
                }
              }
            } else if (registrationNameDependencies.hasOwnProperty(propKey)) {
              if (nextProp != null) {
                if (typeof nextProp !== "function") {
                  warnForInvalidEventListener(propKey, nextProp);
                }
                if (propKey === "onScroll") {
                  listenToNonDelegatedEvent("scroll", domElement);
                }
              }
            } else if (shouldWarnDev && true && // Convince Flow we've calculated it (it's DEV-only in this method.)
            typeof isCustomComponentTag === "boolean") {
              var serverValue = void 0;
              var propertyInfo = isCustomComponentTag && enableCustomElementPropertySupport ? null : getPropertyInfo(propKey);
              if (rawProps[SUPPRESS_HYDRATION_WARNING] === true)
                ;
              else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING || // Controlled attributes are not validated
              // TODO: Only ignore them on controlled tags.
              propKey === "value" || propKey === "checked" || propKey === "selected")
                ;
              else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
                var serverHTML = domElement.innerHTML;
                var nextHtml = nextProp ? nextProp[HTML$1] : void 0;
                if (nextHtml != null) {
                  var expectedHTML = normalizeHTML(domElement, nextHtml);
                  if (expectedHTML !== serverHTML) {
                    warnForPropDifference(propKey, serverHTML, expectedHTML);
                  }
                }
              } else if (propKey === STYLE) {
                extraAttributeNames.delete(propKey);
                if (canDiffStyleForHydrationWarning) {
                  var expectedStyle = createDangerousStringForStyles(nextProp);
                  serverValue = domElement.getAttribute("style");
                  if (expectedStyle !== serverValue) {
                    warnForPropDifference(propKey, serverValue, expectedStyle);
                  }
                }
              } else if (isCustomComponentTag && !enableCustomElementPropertySupport) {
                extraAttributeNames.delete(propKey.toLowerCase());
                serverValue = getValueForAttribute(domElement, propKey, nextProp);
                if (nextProp !== serverValue) {
                  warnForPropDifference(propKey, serverValue, nextProp);
                }
              } else if (!shouldIgnoreAttribute(propKey, propertyInfo, isCustomComponentTag) && !shouldRemoveAttribute(propKey, nextProp, propertyInfo, isCustomComponentTag)) {
                var isMismatchDueToBadCasing = false;
                if (propertyInfo !== null) {
                  extraAttributeNames.delete(propertyInfo.attributeName);
                  serverValue = getValueForProperty(domElement, propKey, nextProp, propertyInfo);
                } else {
                  var ownNamespace = parentNamespace;
                  if (ownNamespace === HTML_NAMESPACE) {
                    ownNamespace = getIntrinsicNamespace(tag);
                  }
                  if (ownNamespace === HTML_NAMESPACE) {
                    extraAttributeNames.delete(propKey.toLowerCase());
                  } else {
                    var standardName = getPossibleStandardName(propKey);
                    if (standardName !== null && standardName !== propKey) {
                      isMismatchDueToBadCasing = true;
                      extraAttributeNames.delete(standardName);
                    }
                    extraAttributeNames.delete(propKey);
                  }
                  serverValue = getValueForAttribute(domElement, propKey, nextProp);
                }
                var dontWarnCustomElement = enableCustomElementPropertySupport;
                if (!dontWarnCustomElement && nextProp !== serverValue && !isMismatchDueToBadCasing) {
                  warnForPropDifference(propKey, serverValue, nextProp);
                }
              }
            }
          }
          {
            if (shouldWarnDev) {
              if (
                // $FlowFixMe - Should be inferred as not undefined.
                extraAttributeNames.size > 0 && rawProps[SUPPRESS_HYDRATION_WARNING] !== true
              ) {
                warnForExtraAttributes(extraAttributeNames);
              }
            }
          }
          switch (tag) {
            case "input":
              track(domElement);
              postMountWrapper(domElement, rawProps, true);
              break;
            case "textarea":
              track(domElement);
              postMountWrapper$3(domElement);
              break;
            case "select":
            case "option":
              break;
            default:
              if (typeof rawProps.onClick === "function") {
                trapClickOnNonInteractiveElement(domElement);
              }
              break;
          }
          return updatePayload;
        }
        function diffHydratedText(textNode, text, isConcurrentMode) {
          var isDifferent = textNode.nodeValue !== text;
          return isDifferent;
        }
        function warnForDeletedHydratableElement(parentNode, child) {
          {
            if (didWarnInvalidHydration) {
              return;
            }
            didWarnInvalidHydration = true;
            error("Did not expect server HTML to contain a <%s> in <%s>.", child.nodeName.toLowerCase(), parentNode.nodeName.toLowerCase());
          }
        }
        function warnForDeletedHydratableText(parentNode, child) {
          {
            if (didWarnInvalidHydration) {
              return;
            }
            didWarnInvalidHydration = true;
            error('Did not expect server HTML to contain the text node "%s" in <%s>.', child.nodeValue, parentNode.nodeName.toLowerCase());
          }
        }
        function warnForInsertedHydratedElement(parentNode, tag, props) {
          {
            if (didWarnInvalidHydration) {
              return;
            }
            didWarnInvalidHydration = true;
            error("Expected server HTML to contain a matching <%s> in <%s>.", tag, parentNode.nodeName.toLowerCase());
          }
        }
        function warnForInsertedHydratedText(parentNode, text) {
          {
            if (text === "") {
              return;
            }
            if (didWarnInvalidHydration) {
              return;
            }
            didWarnInvalidHydration = true;
            error('Expected server HTML to contain a matching text node for "%s" in <%s>.', text, parentNode.nodeName.toLowerCase());
          }
        }
        function restoreControlledState$3(domElement, tag, props) {
          switch (tag) {
            case "input":
              restoreControlledState(domElement, props);
              return;
            case "textarea":
              restoreControlledState$2(domElement, props);
              return;
            case "select":
              restoreControlledState$1(domElement, props);
              return;
          }
        }
        var validateDOMNesting = function() {
        };
        var updatedAncestorInfo = function() {
        };
        {
          var specialTags = ["address", "applet", "area", "article", "aside", "base", "basefont", "bgsound", "blockquote", "body", "br", "button", "caption", "center", "col", "colgroup", "dd", "details", "dir", "div", "dl", "dt", "embed", "fieldset", "figcaption", "figure", "footer", "form", "frame", "frameset", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "iframe", "img", "input", "isindex", "li", "link", "listing", "main", "marquee", "menu", "menuitem", "meta", "nav", "noembed", "noframes", "noscript", "object", "ol", "p", "param", "plaintext", "pre", "script", "section", "select", "source", "style", "summary", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "title", "tr", "track", "ul", "wbr", "xmp"];
          var inScopeTags = [
            "applet",
            "caption",
            "html",
            "table",
            "td",
            "th",
            "marquee",
            "object",
            "template",
            // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point
            // TODO: Distinguish by namespace here -- for <title>, including it here
            // errs on the side of fewer warnings
            "foreignObject",
            "desc",
            "title"
          ];
          var buttonScopeTags = inScopeTags.concat(["button"]);
          var impliedEndTags = ["dd", "dt", "li", "option", "optgroup", "p", "rp", "rt"];
          var emptyAncestorInfo = {
            current: null,
            formTag: null,
            aTagInScope: null,
            buttonTagInScope: null,
            nobrTagInScope: null,
            pTagInButtonScope: null,
            listItemTagAutoclosing: null,
            dlItemTagAutoclosing: null
          };
          updatedAncestorInfo = function(oldInfo, tag) {
            var ancestorInfo = assign({}, oldInfo || emptyAncestorInfo);
            var info = {
              tag
            };
            if (inScopeTags.indexOf(tag) !== -1) {
              ancestorInfo.aTagInScope = null;
              ancestorInfo.buttonTagInScope = null;
              ancestorInfo.nobrTagInScope = null;
            }
            if (buttonScopeTags.indexOf(tag) !== -1) {
              ancestorInfo.pTagInButtonScope = null;
            }
            if (specialTags.indexOf(tag) !== -1 && tag !== "address" && tag !== "div" && tag !== "p") {
              ancestorInfo.listItemTagAutoclosing = null;
              ancestorInfo.dlItemTagAutoclosing = null;
            }
            ancestorInfo.current = info;
            if (tag === "form") {
              ancestorInfo.formTag = info;
            }
            if (tag === "a") {
              ancestorInfo.aTagInScope = info;
            }
            if (tag === "button") {
              ancestorInfo.buttonTagInScope = info;
            }
            if (tag === "nobr") {
              ancestorInfo.nobrTagInScope = info;
            }
            if (tag === "p") {
              ancestorInfo.pTagInButtonScope = info;
            }
            if (tag === "li") {
              ancestorInfo.listItemTagAutoclosing = info;
            }
            if (tag === "dd" || tag === "dt") {
              ancestorInfo.dlItemTagAutoclosing = info;
            }
            return ancestorInfo;
          };
          var isTagValidWithParent = function(tag, parentTag) {
            switch (parentTag) {
              case "select":
                return tag === "option" || tag === "optgroup" || tag === "#text";
              case "optgroup":
                return tag === "option" || tag === "#text";
              case "option":
                return tag === "#text";
              case "tr":
                return tag === "th" || tag === "td" || tag === "style" || tag === "script" || tag === "template";
              case "tbody":
              case "thead":
              case "tfoot":
                return tag === "tr" || tag === "style" || tag === "script" || tag === "template";
              case "colgroup":
                return tag === "col" || tag === "template";
              case "table":
                return tag === "caption" || tag === "colgroup" || tag === "tbody" || tag === "tfoot" || tag === "thead" || tag === "style" || tag === "script" || tag === "template";
              case "head":
                return tag === "base" || tag === "basefont" || tag === "bgsound" || tag === "link" || tag === "meta" || tag === "title" || tag === "noscript" || tag === "noframes" || tag === "style" || tag === "script" || tag === "template";
              case "html":
                return tag === "head" || tag === "body" || tag === "frameset";
              case "frameset":
                return tag === "frame";
              case "#document":
                return tag === "html";
            }
            switch (tag) {
              case "h1":
              case "h2":
              case "h3":
              case "h4":
              case "h5":
              case "h6":
                return parentTag !== "h1" && parentTag !== "h2" && parentTag !== "h3" && parentTag !== "h4" && parentTag !== "h5" && parentTag !== "h6";
              case "rp":
              case "rt":
                return impliedEndTags.indexOf(parentTag) === -1;
              case "body":
              case "caption":
              case "col":
              case "colgroup":
              case "frameset":
              case "frame":
              case "head":
              case "html":
              case "tbody":
              case "td":
              case "tfoot":
              case "th":
              case "thead":
              case "tr":
                return parentTag == null;
            }
            return true;
          };
          var findInvalidAncestorForTag = function(tag, ancestorInfo) {
            switch (tag) {
              case "address":
              case "article":
              case "aside":
              case "blockquote":
              case "center":
              case "details":
              case "dialog":
              case "dir":
              case "div":
              case "dl":
              case "fieldset":
              case "figcaption":
              case "figure":
              case "footer":
              case "header":
              case "hgroup":
              case "main":
              case "menu":
              case "nav":
              case "ol":
              case "p":
              case "section":
              case "summary":
              case "ul":
              case "pre":
              case "listing":
              case "table":
              case "hr":
              case "xmp":
              case "h1":
              case "h2":
              case "h3":
              case "h4":
              case "h5":
              case "h6":
                return ancestorInfo.pTagInButtonScope;
              case "form":
                return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope;
              case "li":
                return ancestorInfo.listItemTagAutoclosing;
              case "dd":
              case "dt":
                return ancestorInfo.dlItemTagAutoclosing;
              case "button":
                return ancestorInfo.buttonTagInScope;
              case "a":
                return ancestorInfo.aTagInScope;
              case "nobr":
                return ancestorInfo.nobrTagInScope;
            }
            return null;
          };
          var didWarn$1 = {};
          validateDOMNesting = function(childTag, childText, ancestorInfo) {
            ancestorInfo = ancestorInfo || emptyAncestorInfo;
            var parentInfo = ancestorInfo.current;
            var parentTag = parentInfo && parentInfo.tag;
            if (childText != null) {
              if (childTag != null) {
                error("validateDOMNesting: when childText is passed, childTag should be null");
              }
              childTag = "#text";
            }
            var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo;
            var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo);
            var invalidParentOrAncestor = invalidParent || invalidAncestor;
            if (!invalidParentOrAncestor) {
              return;
            }
            var ancestorTag = invalidParentOrAncestor.tag;
            var warnKey = !!invalidParent + "|" + childTag + "|" + ancestorTag;
            if (didWarn$1[warnKey]) {
              return;
            }
            didWarn$1[warnKey] = true;
            var tagDisplayName = childTag;
            var whitespaceInfo = "";
            if (childTag === "#text") {
              if (/\S/.test(childText)) {
                tagDisplayName = "Text nodes";
              } else {
                tagDisplayName = "Whitespace text nodes";
                whitespaceInfo = " Make sure you don't have any extra whitespace between tags on each line of your source code.";
              }
            } else {
              tagDisplayName = "<" + childTag + ">";
            }
            if (invalidParent) {
              var info = "";
              if (ancestorTag === "table" && childTag === "tr") {
                info += " Add a <tbody>, <thead> or <tfoot> to your code to match the DOM tree generated by the browser.";
              }
              error("validateDOMNesting(...): %s cannot appear as a child of <%s>.%s%s", tagDisplayName, ancestorTag, whitespaceInfo, info);
            } else {
              error("validateDOMNesting(...): %s cannot appear as a descendant of <%s>.", tagDisplayName, ancestorTag);
            }
          };
        }
        var SUPPRESS_HYDRATION_WARNING$1 = "suppressHydrationWarning";
        var SUSPENSE_START_DATA = "$";
        var SUSPENSE_END_DATA = "/$";
        var SUSPENSE_PENDING_START_DATA = "$?";
        var SUSPENSE_FALLBACK_START_DATA = "$!";
        var STYLE$1 = "style";
        var eventsEnabled = null;
        var selectionInformation = null;
        function getRootHostContext(rootContainerInstance) {
          var type;
          var namespace;
          var nodeType = rootContainerInstance.nodeType;
          switch (nodeType) {
            case DOCUMENT_NODE:
            case DOCUMENT_FRAGMENT_NODE: {
              type = nodeType === DOCUMENT_NODE ? "#document" : "#fragment";
              var root2 = rootContainerInstance.documentElement;
              namespace = root2 ? root2.namespaceURI : getChildNamespace(null, "");
              break;
            }
            default: {
              var container = nodeType === COMMENT_NODE ? rootContainerInstance.parentNode : rootContainerInstance;
              var ownNamespace = container.namespaceURI || null;
              type = container.tagName;
              namespace = getChildNamespace(ownNamespace, type);
              break;
            }
          }
          {
            var validatedTag = type.toLowerCase();
            var ancestorInfo = updatedAncestorInfo(null, validatedTag);
            return {
              namespace,
              ancestorInfo
            };
          }
        }
        function getChildHostContext(parentHostContext, type, rootContainerInstance) {
          {
            var parentHostContextDev = parentHostContext;
            var namespace = getChildNamespace(parentHostContextDev.namespace, type);
            var ancestorInfo = updatedAncestorInfo(parentHostContextDev.ancestorInfo, type);
            return {
              namespace,
              ancestorInfo
            };
          }
        }
        function getPublicInstance(instance) {
          return instance;
        }
        function prepareForCommit(containerInfo) {
          eventsEnabled = isEnabled();
          selectionInformation = getSelectionInformation();
          var activeInstance = null;
          setEnabled(false);
          return activeInstance;
        }
        function resetAfterCommit(containerInfo) {
          restoreSelection(selectionInformation);
          setEnabled(eventsEnabled);
          eventsEnabled = null;
          selectionInformation = null;
        }
        function createInstance(type, props, rootContainerInstance, hostContext, internalInstanceHandle) {
          var parentNamespace;
          {
            var hostContextDev = hostContext;
            validateDOMNesting(type, null, hostContextDev.ancestorInfo);
            if (typeof props.children === "string" || typeof props.children === "number") {
              var string = "" + props.children;
              var ownAncestorInfo = updatedAncestorInfo(hostContextDev.ancestorInfo, type);
              validateDOMNesting(null, string, ownAncestorInfo);
            }
            parentNamespace = hostContextDev.namespace;
          }
          var domElement = createElement3(type, props, rootContainerInstance, parentNamespace);
          precacheFiberNode(internalInstanceHandle, domElement);
          updateFiberProps(domElement, props);
          return domElement;
        }
        function appendInitialChild(parentInstance, child) {
          parentInstance.appendChild(child);
        }
        function finalizeInitialChildren(domElement, type, props, rootContainerInstance, hostContext) {
          setInitialProperties(domElement, type, props, rootContainerInstance);
          switch (type) {
            case "button":
            case "input":
            case "select":
            case "textarea":
              return !!props.autoFocus;
            case "img":
              return true;
            default:
              return false;
          }
        }
        function prepareUpdate(domElement, type, oldProps, newProps, rootContainerInstance, hostContext) {
          {
            var hostContextDev = hostContext;
            if (typeof newProps.children !== typeof oldProps.children && (typeof newProps.children === "string" || typeof newProps.children === "number")) {
              var string = "" + newProps.children;
              var ownAncestorInfo = updatedAncestorInfo(hostContextDev.ancestorInfo, type);
              validateDOMNesting(null, string, ownAncestorInfo);
            }
          }
          return diffProperties(domElement, type, oldProps, newProps);
        }
        function shouldSetTextContent(type, props) {
          return type === "textarea" || type === "noscript" || typeof props.children === "string" || typeof props.children === "number" || typeof props.dangerouslySetInnerHTML === "object" && props.dangerouslySetInnerHTML !== null && props.dangerouslySetInnerHTML.__html != null;
        }
        function createTextInstance(text, rootContainerInstance, hostContext, internalInstanceHandle) {
          {
            var hostContextDev = hostContext;
            validateDOMNesting(null, text, hostContextDev.ancestorInfo);
          }
          var textNode = createTextNode(text, rootContainerInstance);
          precacheFiberNode(internalInstanceHandle, textNode);
          return textNode;
        }
        function getCurrentEventPriority() {
          var currentEvent = window.event;
          if (currentEvent === void 0) {
            return DefaultEventPriority;
          }
          return getEventPriority(currentEvent.type);
        }
        var scheduleTimeout = typeof setTimeout === "function" ? setTimeout : void 0;
        var cancelTimeout = typeof clearTimeout === "function" ? clearTimeout : void 0;
        var noTimeout = -1;
        var localPromise = typeof Promise === "function" ? Promise : void 0;
        var scheduleMicrotask = typeof queueMicrotask === "function" ? queueMicrotask : typeof localPromise !== "undefined" ? function(callback) {
          return localPromise.resolve(null).then(callback).catch(handleErrorInNextTick);
        } : scheduleTimeout;
        function handleErrorInNextTick(error2) {
          setTimeout(function() {
            throw error2;
          });
        }
        function commitMount(domElement, type, newProps, internalInstanceHandle) {
          switch (type) {
            case "button":
            case "input":
            case "select":
            case "textarea":
              if (newProps.autoFocus) {
                domElement.focus();
              }
              return;
            case "img": {
              if (newProps.src) {
                domElement.src = newProps.src;
              }
              return;
            }
          }
        }
        function commitUpdate(domElement, updatePayload, type, oldProps, newProps, internalInstanceHandle) {
          updateProperties(domElement, updatePayload, type, oldProps, newProps);
          updateFiberProps(domElement, newProps);
        }
        function resetTextContent(domElement) {
          setTextContent(domElement, "");
        }
        function commitTextUpdate(textInstance, oldText, newText) {
          textInstance.nodeValue = newText;
        }
        function appendChild2(parentInstance, child) {
          parentInstance.appendChild(child);
        }
        function appendChildToContainer(container, child) {
          var parentNode;
          if (container.nodeType === COMMENT_NODE) {
            parentNode = container.parentNode;
            parentNode.insertBefore(child, container);
          } else {
            parentNode = container;
            parentNode.appendChild(child);
          }
          var reactRootContainer = container._reactRootContainer;
          if ((reactRootContainer === null || reactRootContainer === void 0) && parentNode.onclick === null) {
            trapClickOnNonInteractiveElement(parentNode);
          }
        }
        function insertBefore(parentInstance, child, beforeChild) {
          parentInstance.insertBefore(child, beforeChild);
        }
        function insertInContainerBefore(container, child, beforeChild) {
          if (container.nodeType === COMMENT_NODE) {
            container.parentNode.insertBefore(child, beforeChild);
          } else {
            container.insertBefore(child, beforeChild);
          }
        }
        function removeChild(parentInstance, child) {
          parentInstance.removeChild(child);
        }
        function removeChildFromContainer(container, child) {
          if (container.nodeType === COMMENT_NODE) {
            container.parentNode.removeChild(child);
          } else {
            container.removeChild(child);
          }
        }
        function clearSuspenseBoundary(parentInstance, suspenseInstance) {
          var node = suspenseInstance;
          var depth = 0;
          do {
            var nextNode = node.nextSibling;
            parentInstance.removeChild(node);
            if (nextNode && nextNode.nodeType === COMMENT_NODE) {
              var data = nextNode.data;
              if (data === SUSPENSE_END_DATA) {
                if (depth === 0) {
                  parentInstance.removeChild(nextNode);
                  retryIfBlockedOn(suspenseInstance);
                  return;
                } else {
                  depth--;
                }
              } else if (data === SUSPENSE_START_DATA || data === SUSPENSE_PENDING_START_DATA || data === SUSPENSE_FALLBACK_START_DATA) {
                depth++;
              }
            }
            node = nextNode;
          } while (node);
          retryIfBlockedOn(suspenseInstance);
        }
        function clearSuspenseBoundaryFromContainer(container, suspenseInstance) {
          if (container.nodeType === COMMENT_NODE) {
            clearSuspenseBoundary(container.parentNode, suspenseInstance);
          } else if (container.nodeType === ELEMENT_NODE) {
            clearSuspenseBoundary(container, suspenseInstance);
          }
          retryIfBlockedOn(container);
        }
        function hideInstance(instance) {
          instance = instance;
          var style2 = instance.style;
          if (typeof style2.setProperty === "function") {
            style2.setProperty("display", "none", "important");
          } else {
            style2.display = "none";
          }
        }
        function hideTextInstance(textInstance) {
          textInstance.nodeValue = "";
        }
        function unhideInstance(instance, props) {
          instance = instance;
          var styleProp = props[STYLE$1];
          var display = styleProp !== void 0 && styleProp !== null && styleProp.hasOwnProperty("display") ? styleProp.display : null;
          instance.style.display = dangerousStyleValue("display", display);
        }
        function unhideTextInstance(textInstance, text) {
          textInstance.nodeValue = text;
        }
        function clearContainer(container) {
          if (container.nodeType === ELEMENT_NODE) {
            container.textContent = "";
          } else if (container.nodeType === DOCUMENT_NODE) {
            if (container.documentElement) {
              container.removeChild(container.documentElement);
            }
          }
        }
        function canHydrateInstance(instance, type, props) {
          if (instance.nodeType !== ELEMENT_NODE || type.toLowerCase() !== instance.nodeName.toLowerCase()) {
            return null;
          }
          return instance;
        }
        function canHydrateTextInstance(instance, text) {
          if (text === "" || instance.nodeType !== TEXT_NODE) {
            return null;
          }
          return instance;
        }
        function canHydrateSuspenseInstance(instance) {
          if (instance.nodeType !== COMMENT_NODE) {
            return null;
          }
          return instance;
        }
        function isSuspenseInstancePending(instance) {
          return instance.data === SUSPENSE_PENDING_START_DATA;
        }
        function isSuspenseInstanceFallback(instance) {
          return instance.data === SUSPENSE_FALLBACK_START_DATA;
        }
        function getSuspenseInstanceFallbackErrorDetails(instance) {
          var dataset = instance.nextSibling && instance.nextSibling.dataset;
          var digest, message, stack;
          if (dataset) {
            digest = dataset.dgst;
            {
              message = dataset.msg;
              stack = dataset.stck;
            }
          }
          {
            return {
              message,
              digest,
              stack
            };
          }
        }
        function registerSuspenseInstanceRetry(instance, callback) {
          instance._reactRetry = callback;
        }
        function getNextHydratable(node) {
          for (; node != null; node = node.nextSibling) {
            var nodeType = node.nodeType;
            if (nodeType === ELEMENT_NODE || nodeType === TEXT_NODE) {
              break;
            }
            if (nodeType === COMMENT_NODE) {
              var nodeData = node.data;
              if (nodeData === SUSPENSE_START_DATA || nodeData === SUSPENSE_FALLBACK_START_DATA || nodeData === SUSPENSE_PENDING_START_DATA) {
                break;
              }
              if (nodeData === SUSPENSE_END_DATA) {
                return null;
              }
            }
          }
          return node;
        }
        function getNextHydratableSibling(instance) {
          return getNextHydratable(instance.nextSibling);
        }
        function getFirstHydratableChild(parentInstance) {
          return getNextHydratable(parentInstance.firstChild);
        }
        function getFirstHydratableChildWithinContainer(parentContainer) {
          return getNextHydratable(parentContainer.firstChild);
        }
        function getFirstHydratableChildWithinSuspenseInstance(parentInstance) {
          return getNextHydratable(parentInstance.nextSibling);
        }
        function hydrateInstance(instance, type, props, rootContainerInstance, hostContext, internalInstanceHandle, shouldWarnDev) {
          precacheFiberNode(internalInstanceHandle, instance);
          updateFiberProps(instance, props);
          var parentNamespace;
          {
            var hostContextDev = hostContext;
            parentNamespace = hostContextDev.namespace;
          }
          var isConcurrentMode = (internalInstanceHandle.mode & ConcurrentMode) !== NoMode;
          return diffHydratedProperties(instance, type, props, parentNamespace, rootContainerInstance, isConcurrentMode, shouldWarnDev);
        }
        function hydrateTextInstance(textInstance, text, internalInstanceHandle, shouldWarnDev) {
          precacheFiberNode(internalInstanceHandle, textInstance);
          var isConcurrentMode = (internalInstanceHandle.mode & ConcurrentMode) !== NoMode;
          return diffHydratedText(textInstance, text);
        }
        function hydrateSuspenseInstance(suspenseInstance, internalInstanceHandle) {
          precacheFiberNode(internalInstanceHandle, suspenseInstance);
        }
        function getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance) {
          var node = suspenseInstance.nextSibling;
          var depth = 0;
          while (node) {
            if (node.nodeType === COMMENT_NODE) {
              var data = node.data;
              if (data === SUSPENSE_END_DATA) {
                if (depth === 0) {
                  return getNextHydratableSibling(node);
                } else {
                  depth--;
                }
              } else if (data === SUSPENSE_START_DATA || data === SUSPENSE_FALLBACK_START_DATA || data === SUSPENSE_PENDING_START_DATA) {
                depth++;
              }
            }
            node = node.nextSibling;
          }
          return null;
        }
        function getParentSuspenseInstance(targetInstance) {
          var node = targetInstance.previousSibling;
          var depth = 0;
          while (node) {
            if (node.nodeType === COMMENT_NODE) {
              var data = node.data;
              if (data === SUSPENSE_START_DATA || data === SUSPENSE_FALLBACK_START_DATA || data === SUSPENSE_PENDING_START_DATA) {
                if (depth === 0) {
                  return node;
                } else {
                  depth--;
                }
              } else if (data === SUSPENSE_END_DATA) {
                depth++;
              }
            }
            node = node.previousSibling;
          }
          return null;
        }
        function commitHydratedContainer(container) {
          retryIfBlockedOn(container);
        }
        function commitHydratedSuspenseInstance(suspenseInstance) {
          retryIfBlockedOn(suspenseInstance);
        }
        function shouldDeleteUnhydratedTailInstances(parentType) {
          return parentType !== "head" && parentType !== "body";
        }
        function didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, text, isConcurrentMode) {
          var shouldWarnDev = true;
          checkForUnmatchedText(textInstance.nodeValue, text, isConcurrentMode, shouldWarnDev);
        }
        function didNotMatchHydratedTextInstance(parentType, parentProps, parentInstance, textInstance, text, isConcurrentMode) {
          if (parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) {
            var shouldWarnDev = true;
            checkForUnmatchedText(textInstance.nodeValue, text, isConcurrentMode, shouldWarnDev);
          }
        }
        function didNotHydrateInstanceWithinContainer(parentContainer, instance) {
          {
            if (instance.nodeType === ELEMENT_NODE) {
              warnForDeletedHydratableElement(parentContainer, instance);
            } else if (instance.nodeType === COMMENT_NODE)
              ;
            else {
              warnForDeletedHydratableText(parentContainer, instance);
            }
          }
        }
        function didNotHydrateInstanceWithinSuspenseInstance(parentInstance, instance) {
          {
            var parentNode = parentInstance.parentNode;
            if (parentNode !== null) {
              if (instance.nodeType === ELEMENT_NODE) {
                warnForDeletedHydratableElement(parentNode, instance);
              } else if (instance.nodeType === COMMENT_NODE)
                ;
              else {
                warnForDeletedHydratableText(parentNode, instance);
              }
            }
          }
        }
        function didNotHydrateInstance(parentType, parentProps, parentInstance, instance, isConcurrentMode) {
          {
            if (isConcurrentMode || parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) {
              if (instance.nodeType === ELEMENT_NODE) {
                warnForDeletedHydratableElement(parentInstance, instance);
              } else if (instance.nodeType === COMMENT_NODE)
                ;
              else {
                warnForDeletedHydratableText(parentInstance, instance);
              }
            }
          }
        }
        function didNotFindHydratableInstanceWithinContainer(parentContainer, type, props) {
          {
            warnForInsertedHydratedElement(parentContainer, type);
          }
        }
        function didNotFindHydratableTextInstanceWithinContainer(parentContainer, text) {
          {
            warnForInsertedHydratedText(parentContainer, text);
          }
        }
        function didNotFindHydratableInstanceWithinSuspenseInstance(parentInstance, type, props) {
          {
            var parentNode = parentInstance.parentNode;
            if (parentNode !== null)
              warnForInsertedHydratedElement(parentNode, type);
          }
        }
        function didNotFindHydratableTextInstanceWithinSuspenseInstance(parentInstance, text) {
          {
            var parentNode = parentInstance.parentNode;
            if (parentNode !== null)
              warnForInsertedHydratedText(parentNode, text);
          }
        }
        function didNotFindHydratableInstance(parentType, parentProps, parentInstance, type, props, isConcurrentMode) {
          {
            if (isConcurrentMode || parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) {
              warnForInsertedHydratedElement(parentInstance, type);
            }
          }
        }
        function didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, text, isConcurrentMode) {
          {
            if (isConcurrentMode || parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) {
              warnForInsertedHydratedText(parentInstance, text);
            }
          }
        }
        function errorHydratingContainer(parentContainer) {
          {
            error("An error occurred during hydration. The server HTML was replaced with client content in <%s>.", parentContainer.nodeName.toLowerCase());
          }
        }
        function preparePortalMount(portalInstance) {
          listenToAllSupportedEvents(portalInstance);
        }
        var randomKey = Math.random().toString(36).slice(2);
        var internalInstanceKey = "__reactFiber$" + randomKey;
        var internalPropsKey = "__reactProps$" + randomKey;
        var internalContainerInstanceKey = "__reactContainer$" + randomKey;
        var internalEventHandlersKey = "__reactEvents$" + randomKey;
        var internalEventHandlerListenersKey = "__reactListeners$" + randomKey;
        var internalEventHandlesSetKey = "__reactHandles$" + randomKey;
        function detachDeletedInstance(node) {
          delete node[internalInstanceKey];
          delete node[internalPropsKey];
          delete node[internalEventHandlersKey];
          delete node[internalEventHandlerListenersKey];
          delete node[internalEventHandlesSetKey];
        }
        function precacheFiberNode(hostInst, node) {
          node[internalInstanceKey] = hostInst;
        }
        function markContainerAsRoot(hostRoot, node) {
          node[internalContainerInstanceKey] = hostRoot;
        }
        function unmarkContainerAsRoot(node) {
          node[internalContainerInstanceKey] = null;
        }
        function isContainerMarkedAsRoot(node) {
          return !!node[internalContainerInstanceKey];
        }
        function getClosestInstanceFromNode(targetNode) {
          var targetInst = targetNode[internalInstanceKey];
          if (targetInst) {
            return targetInst;
          }
          var parentNode = targetNode.parentNode;
          while (parentNode) {
            targetInst = parentNode[internalContainerInstanceKey] || parentNode[internalInstanceKey];
            if (targetInst) {
              var alternate = targetInst.alternate;
              if (targetInst.child !== null || alternate !== null && alternate.child !== null) {
                var suspenseInstance = getParentSuspenseInstance(targetNode);
                while (suspenseInstance !== null) {
                  var targetSuspenseInst = suspenseInstance[internalInstanceKey];
                  if (targetSuspenseInst) {
                    return targetSuspenseInst;
                  }
                  suspenseInstance = getParentSuspenseInstance(suspenseInstance);
                }
              }
              return targetInst;
            }
            targetNode = parentNode;
            parentNode = targetNode.parentNode;
          }
          return null;
        }
        function getInstanceFromNode(node) {
          var inst = node[internalInstanceKey] || node[internalContainerInstanceKey];
          if (inst) {
            if (inst.tag === HostComponent || inst.tag === HostText || inst.tag === SuspenseComponent || inst.tag === HostRoot) {
              return inst;
            } else {
              return null;
            }
          }
          return null;
        }
        function getNodeFromInstance(inst) {
          if (inst.tag === HostComponent || inst.tag === HostText) {
            return inst.stateNode;
          }
          throw new Error("getNodeFromInstance: Invalid argument.");
        }
        function getFiberCurrentPropsFromNode(node) {
          return node[internalPropsKey] || null;
        }
        function updateFiberProps(node, props) {
          node[internalPropsKey] = props;
        }
        function getEventListenerSet(node) {
          var elementListenerSet = node[internalEventHandlersKey];
          if (elementListenerSet === void 0) {
            elementListenerSet = node[internalEventHandlersKey] = /* @__PURE__ */ new Set();
          }
          return elementListenerSet;
        }
        var loggedTypeFailures = {};
        var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
        function setCurrentlyValidatingElement(element) {
          {
            if (element) {
              var owner = element._owner;
              var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
              ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
            } else {
              ReactDebugCurrentFrame$1.setExtraStackFrame(null);
            }
          }
        }
        function checkPropTypes(typeSpecs, values, location, componentName, element) {
          {
            var has2 = Function.call.bind(hasOwnProperty);
            for (var typeSpecName in typeSpecs) {
              if (has2(typeSpecs, typeSpecName)) {
                var error$1 = void 0;
                try {
                  if (typeof typeSpecs[typeSpecName] !== "function") {
                    var err = Error((componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
                    err.name = "Invariant Violation";
                    throw err;
                  }
                  error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
                } catch (ex) {
                  error$1 = ex;
                }
                if (error$1 && !(error$1 instanceof Error)) {
                  setCurrentlyValidatingElement(element);
                  error("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", componentName || "React class", location, typeSpecName, typeof error$1);
                  setCurrentlyValidatingElement(null);
                }
                if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
                  loggedTypeFailures[error$1.message] = true;
                  setCurrentlyValidatingElement(element);
                  error("Failed %s type: %s", location, error$1.message);
                  setCurrentlyValidatingElement(null);
                }
              }
            }
          }
        }
        var valueStack = [];
        var fiberStack;
        {
          fiberStack = [];
        }
        var index = -1;
        function createCursor(defaultValue) {
          return {
            current: defaultValue
          };
        }
        function pop(cursor, fiber) {
          if (index < 0) {
            {
              error("Unexpected pop.");
            }
            return;
          }
          {
            if (fiber !== fiberStack[index]) {
              error("Unexpected Fiber popped.");
            }
          }
          cursor.current = valueStack[index];
          valueStack[index] = null;
          {
            fiberStack[index] = null;
          }
          index--;
        }
        function push(cursor, value, fiber) {
          index++;
          valueStack[index] = cursor.current;
          {
            fiberStack[index] = fiber;
          }
          cursor.current = value;
        }
        var warnedAboutMissingGetChildContext;
        {
          warnedAboutMissingGetChildContext = {};
        }
        var emptyContextObject = {};
        {
          Object.freeze(emptyContextObject);
        }
        var contextStackCursor = createCursor(emptyContextObject);
        var didPerformWorkStackCursor = createCursor(false);
        var previousContext = emptyContextObject;
        function getUnmaskedContext(workInProgress2, Component, didPushOwnContextIfProvider) {
          {
            if (didPushOwnContextIfProvider && isContextProvider(Component)) {
              return previousContext;
            }
            return contextStackCursor.current;
          }
        }
        function cacheContext(workInProgress2, unmaskedContext, maskedContext) {
          {
            var instance = workInProgress2.stateNode;
            instance.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext;
            instance.__reactInternalMemoizedMaskedChildContext = maskedContext;
          }
        }
        function getMaskedContext(workInProgress2, unmaskedContext) {
          {
            var type = workInProgress2.type;
            var contextTypes = type.contextTypes;
            if (!contextTypes) {
              return emptyContextObject;
            }
            var instance = workInProgress2.stateNode;
            if (instance && instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext) {
              return instance.__reactInternalMemoizedMaskedChildContext;
            }
            var context = {};
            for (var key in contextTypes) {
              context[key] = unmaskedContext[key];
            }
            {
              var name = getComponentNameFromFiber(workInProgress2) || "Unknown";
              checkPropTypes(contextTypes, context, "context", name);
            }
            if (instance) {
              cacheContext(workInProgress2, unmaskedContext, context);
            }
            return context;
          }
        }
        function hasContextChanged() {
          {
            return didPerformWorkStackCursor.current;
          }
        }
        function isContextProvider(type) {
          {
            var childContextTypes = type.childContextTypes;
            return childContextTypes !== null && childContextTypes !== void 0;
          }
        }
        function popContext(fiber) {
          {
            pop(didPerformWorkStackCursor, fiber);
            pop(contextStackCursor, fiber);
          }
        }
        function popTopLevelContextObject(fiber) {
          {
            pop(didPerformWorkStackCursor, fiber);
            pop(contextStackCursor, fiber);
          }
        }
        function pushTopLevelContextObject(fiber, context, didChange) {
          {
            if (contextStackCursor.current !== emptyContextObject) {
              throw new Error("Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue.");
            }
            push(contextStackCursor, context, fiber);
            push(didPerformWorkStackCursor, didChange, fiber);
          }
        }
        function processChildContext(fiber, type, parentContext) {
          {
            var instance = fiber.stateNode;
            var childContextTypes = type.childContextTypes;
            if (typeof instance.getChildContext !== "function") {
              {
                var componentName = getComponentNameFromFiber(fiber) || "Unknown";
                if (!warnedAboutMissingGetChildContext[componentName]) {
                  warnedAboutMissingGetChildContext[componentName] = true;
                  error("%s.childContextTypes is specified but there is no getChildContext() method on the instance. You can either define getChildContext() on %s or remove childContextTypes from it.", componentName, componentName);
                }
              }
              return parentContext;
            }
            var childContext = instance.getChildContext();
            for (var contextKey in childContext) {
              if (!(contextKey in childContextTypes)) {
                throw new Error((getComponentNameFromFiber(fiber) || "Unknown") + '.getChildContext(): key "' + contextKey + '" is not defined in childContextTypes.');
              }
            }
            {
              var name = getComponentNameFromFiber(fiber) || "Unknown";
              checkPropTypes(childContextTypes, childContext, "child context", name);
            }
            return assign({}, parentContext, childContext);
          }
        }
        function pushContextProvider(workInProgress2) {
          {
            var instance = workInProgress2.stateNode;
            var memoizedMergedChildContext = instance && instance.__reactInternalMemoizedMergedChildContext || emptyContextObject;
            previousContext = contextStackCursor.current;
            push(contextStackCursor, memoizedMergedChildContext, workInProgress2);
            push(didPerformWorkStackCursor, didPerformWorkStackCursor.current, workInProgress2);
            return true;
          }
        }
        function invalidateContextProvider(workInProgress2, type, didChange) {
          {
            var instance = workInProgress2.stateNode;
            if (!instance) {
              throw new Error("Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue.");
            }
            if (didChange) {
              var mergedContext = processChildContext(workInProgress2, type, previousContext);
              instance.__reactInternalMemoizedMergedChildContext = mergedContext;
              pop(didPerformWorkStackCursor, workInProgress2);
              pop(contextStackCursor, workInProgress2);
              push(contextStackCursor, mergedContext, workInProgress2);
              push(didPerformWorkStackCursor, didChange, workInProgress2);
            } else {
              pop(didPerformWorkStackCursor, workInProgress2);
              push(didPerformWorkStackCursor, didChange, workInProgress2);
            }
          }
        }
        function findCurrentUnmaskedContext(fiber) {
          {
            if (!isFiberMounted(fiber) || fiber.tag !== ClassComponent) {
              throw new Error("Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue.");
            }
            var node = fiber;
            do {
              switch (node.tag) {
                case HostRoot:
                  return node.stateNode.context;
                case ClassComponent: {
                  var Component = node.type;
                  if (isContextProvider(Component)) {
                    return node.stateNode.__reactInternalMemoizedMergedChildContext;
                  }
                  break;
                }
              }
              node = node.return;
            } while (node !== null);
            throw new Error("Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue.");
          }
        }
        var LegacyRoot = 0;
        var ConcurrentRoot = 1;
        var syncQueue = null;
        var includesLegacySyncCallbacks = false;
        var isFlushingSyncQueue = false;
        function scheduleSyncCallback(callback) {
          if (syncQueue === null) {
            syncQueue = [callback];
          } else {
            syncQueue.push(callback);
          }
        }
        function scheduleLegacySyncCallback(callback) {
          includesLegacySyncCallbacks = true;
          scheduleSyncCallback(callback);
        }
        function flushSyncCallbacksOnlyInLegacyMode() {
          if (includesLegacySyncCallbacks) {
            flushSyncCallbacks();
          }
        }
        function flushSyncCallbacks() {
          if (!isFlushingSyncQueue && syncQueue !== null) {
            isFlushingSyncQueue = true;
            var i2 = 0;
            var previousUpdatePriority = getCurrentUpdatePriority();
            try {
              var isSync = true;
              var queue = syncQueue;
              setCurrentUpdatePriority(DiscreteEventPriority);
              for (; i2 < queue.length; i2++) {
                var callback = queue[i2];
                do {
                  callback = callback(isSync);
                } while (callback !== null);
              }
              syncQueue = null;
              includesLegacySyncCallbacks = false;
            } catch (error2) {
              if (syncQueue !== null) {
                syncQueue = syncQueue.slice(i2 + 1);
              }
              scheduleCallback(ImmediatePriority, flushSyncCallbacks);
              throw error2;
            } finally {
              setCurrentUpdatePriority(previousUpdatePriority);
              isFlushingSyncQueue = false;
            }
          }
          return null;
        }
        var forkStack = [];
        var forkStackIndex = 0;
        var treeForkProvider = null;
        var treeForkCount = 0;
        var idStack = [];
        var idStackIndex = 0;
        var treeContextProvider = null;
        var treeContextId = 1;
        var treeContextOverflow = "";
        function isForkedChild(workInProgress2) {
          warnIfNotHydrating();
          return (workInProgress2.flags & Forked) !== NoFlags;
        }
        function getForksAtLevel(workInProgress2) {
          warnIfNotHydrating();
          return treeForkCount;
        }
        function getTreeId() {
          var overflow = treeContextOverflow;
          var idWithLeadingBit = treeContextId;
          var id2 = idWithLeadingBit & ~getLeadingBit(idWithLeadingBit);
          return id2.toString(32) + overflow;
        }
        function pushTreeFork(workInProgress2, totalChildren) {
          warnIfNotHydrating();
          forkStack[forkStackIndex++] = treeForkCount;
          forkStack[forkStackIndex++] = treeForkProvider;
          treeForkProvider = workInProgress2;
          treeForkCount = totalChildren;
        }
        function pushTreeId(workInProgress2, totalChildren, index2) {
          warnIfNotHydrating();
          idStack[idStackIndex++] = treeContextId;
          idStack[idStackIndex++] = treeContextOverflow;
          idStack[idStackIndex++] = treeContextProvider;
          treeContextProvider = workInProgress2;
          var baseIdWithLeadingBit = treeContextId;
          var baseOverflow = treeContextOverflow;
          var baseLength = getBitLength(baseIdWithLeadingBit) - 1;
          var baseId = baseIdWithLeadingBit & ~(1 << baseLength);
          var slot = index2 + 1;
          var length = getBitLength(totalChildren) + baseLength;
          if (length > 30) {
            var numberOfOverflowBits = baseLength - baseLength % 5;
            var newOverflowBits = (1 << numberOfOverflowBits) - 1;
            var newOverflow = (baseId & newOverflowBits).toString(32);
            var restOfBaseId = baseId >> numberOfOverflowBits;
            var restOfBaseLength = baseLength - numberOfOverflowBits;
            var restOfLength = getBitLength(totalChildren) + restOfBaseLength;
            var restOfNewBits = slot << restOfBaseLength;
            var id2 = restOfNewBits | restOfBaseId;
            var overflow = newOverflow + baseOverflow;
            treeContextId = 1 << restOfLength | id2;
            treeContextOverflow = overflow;
          } else {
            var newBits = slot << baseLength;
            var _id = newBits | baseId;
            var _overflow = baseOverflow;
            treeContextId = 1 << length | _id;
            treeContextOverflow = _overflow;
          }
        }
        function pushMaterializedTreeId(workInProgress2) {
          warnIfNotHydrating();
          var returnFiber = workInProgress2.return;
          if (returnFiber !== null) {
            var numberOfForks = 1;
            var slotIndex = 0;
            pushTreeFork(workInProgress2, numberOfForks);
            pushTreeId(workInProgress2, numberOfForks, slotIndex);
          }
        }
        function getBitLength(number) {
          return 32 - clz32(number);
        }
        function getLeadingBit(id2) {
          return 1 << getBitLength(id2) - 1;
        }
        function popTreeContext(workInProgress2) {
          while (workInProgress2 === treeForkProvider) {
            treeForkProvider = forkStack[--forkStackIndex];
            forkStack[forkStackIndex] = null;
            treeForkCount = forkStack[--forkStackIndex];
            forkStack[forkStackIndex] = null;
          }
          while (workInProgress2 === treeContextProvider) {
            treeContextProvider = idStack[--idStackIndex];
            idStack[idStackIndex] = null;
            treeContextOverflow = idStack[--idStackIndex];
            idStack[idStackIndex] = null;
            treeContextId = idStack[--idStackIndex];
            idStack[idStackIndex] = null;
          }
        }
        function getSuspendedTreeContext() {
          warnIfNotHydrating();
          if (treeContextProvider !== null) {
            return {
              id: treeContextId,
              overflow: treeContextOverflow
            };
          } else {
            return null;
          }
        }
        function restoreSuspendedTreeContext(workInProgress2, suspendedContext) {
          warnIfNotHydrating();
          idStack[idStackIndex++] = treeContextId;
          idStack[idStackIndex++] = treeContextOverflow;
          idStack[idStackIndex++] = treeContextProvider;
          treeContextId = suspendedContext.id;
          treeContextOverflow = suspendedContext.overflow;
          treeContextProvider = workInProgress2;
        }
        function warnIfNotHydrating() {
          {
            if (!getIsHydrating()) {
              error("Expected to be hydrating. This is a bug in React. Please file an issue.");
            }
          }
        }
        var hydrationParentFiber = null;
        var nextHydratableInstance = null;
        var isHydrating = false;
        var didSuspendOrErrorDEV = false;
        var hydrationErrors = null;
        function warnIfHydrating() {
          {
            if (isHydrating) {
              error("We should not be hydrating here. This is a bug in React. Please file a bug.");
            }
          }
        }
        function markDidThrowWhileHydratingDEV() {
          {
            didSuspendOrErrorDEV = true;
          }
        }
        function didSuspendOrErrorWhileHydratingDEV() {
          {
            return didSuspendOrErrorDEV;
          }
        }
        function enterHydrationState(fiber) {
          var parentInstance = fiber.stateNode.containerInfo;
          nextHydratableInstance = getFirstHydratableChildWithinContainer(parentInstance);
          hydrationParentFiber = fiber;
          isHydrating = true;
          hydrationErrors = null;
          didSuspendOrErrorDEV = false;
          return true;
        }
        function reenterHydrationStateFromDehydratedSuspenseInstance(fiber, suspenseInstance, treeContext) {
          nextHydratableInstance = getFirstHydratableChildWithinSuspenseInstance(suspenseInstance);
          hydrationParentFiber = fiber;
          isHydrating = true;
          hydrationErrors = null;
          didSuspendOrErrorDEV = false;
          if (treeContext !== null) {
            restoreSuspendedTreeContext(fiber, treeContext);
          }
          return true;
        }
        function warnUnhydratedInstance(returnFiber, instance) {
          {
            switch (returnFiber.tag) {
              case HostRoot: {
                didNotHydrateInstanceWithinContainer(returnFiber.stateNode.containerInfo, instance);
                break;
              }
              case HostComponent: {
                var isConcurrentMode = (returnFiber.mode & ConcurrentMode) !== NoMode;
                didNotHydrateInstance(
                  returnFiber.type,
                  returnFiber.memoizedProps,
                  returnFiber.stateNode,
                  instance,
                  // TODO: Delete this argument when we remove the legacy root API.
                  isConcurrentMode
                );
                break;
              }
              case SuspenseComponent: {
                var suspenseState = returnFiber.memoizedState;
                if (suspenseState.dehydrated !== null)
                  didNotHydrateInstanceWithinSuspenseInstance(suspenseState.dehydrated, instance);
                break;
              }
            }
          }
        }
        function deleteHydratableInstance(returnFiber, instance) {
          warnUnhydratedInstance(returnFiber, instance);
          var childToDelete = createFiberFromHostInstanceForDeletion();
          childToDelete.stateNode = instance;
          childToDelete.return = returnFiber;
          var deletions = returnFiber.deletions;
          if (deletions === null) {
            returnFiber.deletions = [childToDelete];
            returnFiber.flags |= ChildDeletion;
          } else {
            deletions.push(childToDelete);
          }
        }
        function warnNonhydratedInstance(returnFiber, fiber) {
          {
            if (didSuspendOrErrorDEV) {
              return;
            }
            switch (returnFiber.tag) {
              case HostRoot: {
                var parentContainer = returnFiber.stateNode.containerInfo;
                switch (fiber.tag) {
                  case HostComponent:
                    var type = fiber.type;
                    var props = fiber.pendingProps;
                    didNotFindHydratableInstanceWithinContainer(parentContainer, type);
                    break;
                  case HostText:
                    var text = fiber.pendingProps;
                    didNotFindHydratableTextInstanceWithinContainer(parentContainer, text);
                    break;
                }
                break;
              }
              case HostComponent: {
                var parentType = returnFiber.type;
                var parentProps = returnFiber.memoizedProps;
                var parentInstance = returnFiber.stateNode;
                switch (fiber.tag) {
                  case HostComponent: {
                    var _type = fiber.type;
                    var _props = fiber.pendingProps;
                    var isConcurrentMode = (returnFiber.mode & ConcurrentMode) !== NoMode;
                    didNotFindHydratableInstance(
                      parentType,
                      parentProps,
                      parentInstance,
                      _type,
                      _props,
                      // TODO: Delete this argument when we remove the legacy root API.
                      isConcurrentMode
                    );
                    break;
                  }
                  case HostText: {
                    var _text = fiber.pendingProps;
                    var _isConcurrentMode = (returnFiber.mode & ConcurrentMode) !== NoMode;
                    didNotFindHydratableTextInstance(
                      parentType,
                      parentProps,
                      parentInstance,
                      _text,
                      // TODO: Delete this argument when we remove the legacy root API.
                      _isConcurrentMode
                    );
                    break;
                  }
                }
                break;
              }
              case SuspenseComponent: {
                var suspenseState = returnFiber.memoizedState;
                var _parentInstance = suspenseState.dehydrated;
                if (_parentInstance !== null)
                  switch (fiber.tag) {
                    case HostComponent:
                      var _type2 = fiber.type;
                      var _props2 = fiber.pendingProps;
                      didNotFindHydratableInstanceWithinSuspenseInstance(_parentInstance, _type2);
                      break;
                    case HostText:
                      var _text2 = fiber.pendingProps;
                      didNotFindHydratableTextInstanceWithinSuspenseInstance(_parentInstance, _text2);
                      break;
                  }
                break;
              }
              default:
                return;
            }
          }
        }
        function insertNonHydratedInstance(returnFiber, fiber) {
          fiber.flags = fiber.flags & ~Hydrating | Placement;
          warnNonhydratedInstance(returnFiber, fiber);
        }
        function tryHydrate(fiber, nextInstance) {
          switch (fiber.tag) {
            case HostComponent: {
              var type = fiber.type;
              var props = fiber.pendingProps;
              var instance = canHydrateInstance(nextInstance, type);
              if (instance !== null) {
                fiber.stateNode = instance;
                hydrationParentFiber = fiber;
                nextHydratableInstance = getFirstHydratableChild(instance);
                return true;
              }
              return false;
            }
            case HostText: {
              var text = fiber.pendingProps;
              var textInstance = canHydrateTextInstance(nextInstance, text);
              if (textInstance !== null) {
                fiber.stateNode = textInstance;
                hydrationParentFiber = fiber;
                nextHydratableInstance = null;
                return true;
              }
              return false;
            }
            case SuspenseComponent: {
              var suspenseInstance = canHydrateSuspenseInstance(nextInstance);
              if (suspenseInstance !== null) {
                var suspenseState = {
                  dehydrated: suspenseInstance,
                  treeContext: getSuspendedTreeContext(),
                  retryLane: OffscreenLane
                };
                fiber.memoizedState = suspenseState;
                var dehydratedFragment = createFiberFromDehydratedFragment(suspenseInstance);
                dehydratedFragment.return = fiber;
                fiber.child = dehydratedFragment;
                hydrationParentFiber = fiber;
                nextHydratableInstance = null;
                return true;
              }
              return false;
            }
            default:
              return false;
          }
        }
        function shouldClientRenderOnMismatch(fiber) {
          return (fiber.mode & ConcurrentMode) !== NoMode && (fiber.flags & DidCapture) === NoFlags;
        }
        function throwOnHydrationMismatch(fiber) {
          throw new Error("Hydration failed because the initial UI does not match what was rendered on the server.");
        }
        function tryToClaimNextHydratableInstance(fiber) {
          if (!isHydrating) {
            return;
          }
          var nextInstance = nextHydratableInstance;
          if (!nextInstance) {
            if (shouldClientRenderOnMismatch(fiber)) {
              warnNonhydratedInstance(hydrationParentFiber, fiber);
              throwOnHydrationMismatch();
            }
            insertNonHydratedInstance(hydrationParentFiber, fiber);
            isHydrating = false;
            hydrationParentFiber = fiber;
            return;
          }
          var firstAttemptedInstance = nextInstance;
          if (!tryHydrate(fiber, nextInstance)) {
            if (shouldClientRenderOnMismatch(fiber)) {
              warnNonhydratedInstance(hydrationParentFiber, fiber);
              throwOnHydrationMismatch();
            }
            nextInstance = getNextHydratableSibling(firstAttemptedInstance);
            var prevHydrationParentFiber = hydrationParentFiber;
            if (!nextInstance || !tryHydrate(fiber, nextInstance)) {
              insertNonHydratedInstance(hydrationParentFiber, fiber);
              isHydrating = false;
              hydrationParentFiber = fiber;
              return;
            }
            deleteHydratableInstance(prevHydrationParentFiber, firstAttemptedInstance);
          }
        }
        function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext) {
          var instance = fiber.stateNode;
          var shouldWarnIfMismatchDev = !didSuspendOrErrorDEV;
          var updatePayload = hydrateInstance(instance, fiber.type, fiber.memoizedProps, rootContainerInstance, hostContext, fiber, shouldWarnIfMismatchDev);
          fiber.updateQueue = updatePayload;
          if (updatePayload !== null) {
            return true;
          }
          return false;
        }
        function prepareToHydrateHostTextInstance(fiber) {
          var textInstance = fiber.stateNode;
          var textContent2 = fiber.memoizedProps;
          var shouldUpdate = hydrateTextInstance(textInstance, textContent2, fiber);
          if (shouldUpdate) {
            var returnFiber = hydrationParentFiber;
            if (returnFiber !== null) {
              switch (returnFiber.tag) {
                case HostRoot: {
                  var parentContainer = returnFiber.stateNode.containerInfo;
                  var isConcurrentMode = (returnFiber.mode & ConcurrentMode) !== NoMode;
                  didNotMatchHydratedContainerTextInstance(
                    parentContainer,
                    textInstance,
                    textContent2,
                    // TODO: Delete this argument when we remove the legacy root API.
                    isConcurrentMode
                  );
                  break;
                }
                case HostComponent: {
                  var parentType = returnFiber.type;
                  var parentProps = returnFiber.memoizedProps;
                  var parentInstance = returnFiber.stateNode;
                  var _isConcurrentMode2 = (returnFiber.mode & ConcurrentMode) !== NoMode;
                  didNotMatchHydratedTextInstance(
                    parentType,
                    parentProps,
                    parentInstance,
                    textInstance,
                    textContent2,
                    // TODO: Delete this argument when we remove the legacy root API.
                    _isConcurrentMode2
                  );
                  break;
                }
              }
            }
          }
          return shouldUpdate;
        }
        function prepareToHydrateHostSuspenseInstance(fiber) {
          var suspenseState = fiber.memoizedState;
          var suspenseInstance = suspenseState !== null ? suspenseState.dehydrated : null;
          if (!suspenseInstance) {
            throw new Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue.");
          }
          hydrateSuspenseInstance(suspenseInstance, fiber);
        }
        function skipPastDehydratedSuspenseInstance(fiber) {
          var suspenseState = fiber.memoizedState;
          var suspenseInstance = suspenseState !== null ? suspenseState.dehydrated : null;
          if (!suspenseInstance) {
            throw new Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue.");
          }
          return getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance);
        }
        function popToNextHostParent(fiber) {
          var parent = fiber.return;
          while (parent !== null && parent.tag !== HostComponent && parent.tag !== HostRoot && parent.tag !== SuspenseComponent) {
            parent = parent.return;
          }
          hydrationParentFiber = parent;
        }
        function popHydrationState(fiber) {
          if (fiber !== hydrationParentFiber) {
            return false;
          }
          if (!isHydrating) {
            popToNextHostParent(fiber);
            isHydrating = true;
            return false;
          }
          if (fiber.tag !== HostRoot && (fiber.tag !== HostComponent || shouldDeleteUnhydratedTailInstances(fiber.type) && !shouldSetTextContent(fiber.type, fiber.memoizedProps))) {
            var nextInstance = nextHydratableInstance;
            if (nextInstance) {
              if (shouldClientRenderOnMismatch(fiber)) {
                warnIfUnhydratedTailNodes(fiber);
                throwOnHydrationMismatch();
              } else {
                while (nextInstance) {
                  deleteHydratableInstance(fiber, nextInstance);
                  nextInstance = getNextHydratableSibling(nextInstance);
                }
              }
            }
          }
          popToNextHostParent(fiber);
          if (fiber.tag === SuspenseComponent) {
            nextHydratableInstance = skipPastDehydratedSuspenseInstance(fiber);
          } else {
            nextHydratableInstance = hydrationParentFiber ? getNextHydratableSibling(fiber.stateNode) : null;
          }
          return true;
        }
        function hasUnhydratedTailNodes() {
          return isHydrating && nextHydratableInstance !== null;
        }
        function warnIfUnhydratedTailNodes(fiber) {
          var nextInstance = nextHydratableInstance;
          while (nextInstance) {
            warnUnhydratedInstance(fiber, nextInstance);
            nextInstance = getNextHydratableSibling(nextInstance);
          }
        }
        function resetHydrationState() {
          hydrationParentFiber = null;
          nextHydratableInstance = null;
          isHydrating = false;
          didSuspendOrErrorDEV = false;
        }
        function upgradeHydrationErrorsToRecoverable() {
          if (hydrationErrors !== null) {
            queueRecoverableErrors(hydrationErrors);
            hydrationErrors = null;
          }
        }
        function getIsHydrating() {
          return isHydrating;
        }
        function queueHydrationError(error2) {
          if (hydrationErrors === null) {
            hydrationErrors = [error2];
          } else {
            hydrationErrors.push(error2);
          }
        }
        var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig;
        var NoTransition = null;
        function requestCurrentTransition() {
          return ReactCurrentBatchConfig$1.transition;
        }
        var ReactStrictModeWarnings = {
          recordUnsafeLifecycleWarnings: function(fiber, instance) {
          },
          flushPendingUnsafeLifecycleWarnings: function() {
          },
          recordLegacyContextWarning: function(fiber, instance) {
          },
          flushLegacyContextWarning: function() {
          },
          discardPendingWarnings: function() {
          }
        };
        {
          var findStrictRoot = function(fiber) {
            var maybeStrictRoot = null;
            var node = fiber;
            while (node !== null) {
              if (node.mode & StrictLegacyMode) {
                maybeStrictRoot = node;
              }
              node = node.return;
            }
            return maybeStrictRoot;
          };
          var setToSortedString = function(set2) {
            var array = [];
            set2.forEach(function(value) {
              array.push(value);
            });
            return array.sort().join(", ");
          };
          var pendingComponentWillMountWarnings = [];
          var pendingUNSAFE_ComponentWillMountWarnings = [];
          var pendingComponentWillReceivePropsWarnings = [];
          var pendingUNSAFE_ComponentWillReceivePropsWarnings = [];
          var pendingComponentWillUpdateWarnings = [];
          var pendingUNSAFE_ComponentWillUpdateWarnings = [];
          var didWarnAboutUnsafeLifecycles = /* @__PURE__ */ new Set();
          ReactStrictModeWarnings.recordUnsafeLifecycleWarnings = function(fiber, instance) {
            if (didWarnAboutUnsafeLifecycles.has(fiber.type)) {
              return;
            }
            if (typeof instance.componentWillMount === "function" && // Don't warn about react-lifecycles-compat polyfilled components.
            instance.componentWillMount.__suppressDeprecationWarning !== true) {
              pendingComponentWillMountWarnings.push(fiber);
            }
            if (fiber.mode & StrictLegacyMode && typeof instance.UNSAFE_componentWillMount === "function") {
              pendingUNSAFE_ComponentWillMountWarnings.push(fiber);
            }
            if (typeof instance.componentWillReceiveProps === "function" && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) {
              pendingComponentWillReceivePropsWarnings.push(fiber);
            }
            if (fiber.mode & StrictLegacyMode && typeof instance.UNSAFE_componentWillReceiveProps === "function") {
              pendingUNSAFE_ComponentWillReceivePropsWarnings.push(fiber);
            }
            if (typeof instance.componentWillUpdate === "function" && instance.componentWillUpdate.__suppressDeprecationWarning !== true) {
              pendingComponentWillUpdateWarnings.push(fiber);
            }
            if (fiber.mode & StrictLegacyMode && typeof instance.UNSAFE_componentWillUpdate === "function") {
              pendingUNSAFE_ComponentWillUpdateWarnings.push(fiber);
            }
          };
          ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings = function() {
            var componentWillMountUniqueNames = /* @__PURE__ */ new Set();
            if (pendingComponentWillMountWarnings.length > 0) {
              pendingComponentWillMountWarnings.forEach(function(fiber) {
                componentWillMountUniqueNames.add(getComponentNameFromFiber(fiber) || "Component");
                didWarnAboutUnsafeLifecycles.add(fiber.type);
              });
              pendingComponentWillMountWarnings = [];
            }
            var UNSAFE_componentWillMountUniqueNames = /* @__PURE__ */ new Set();
            if (pendingUNSAFE_ComponentWillMountWarnings.length > 0) {
              pendingUNSAFE_ComponentWillMountWarnings.forEach(function(fiber) {
                UNSAFE_componentWillMountUniqueNames.add(getComponentNameFromFiber(fiber) || "Component");
                didWarnAboutUnsafeLifecycles.add(fiber.type);
              });
              pendingUNSAFE_ComponentWillMountWarnings = [];
            }
            var componentWillReceivePropsUniqueNames = /* @__PURE__ */ new Set();
            if (pendingComponentWillReceivePropsWarnings.length > 0) {
              pendingComponentWillReceivePropsWarnings.forEach(function(fiber) {
                componentWillReceivePropsUniqueNames.add(getComponentNameFromFiber(fiber) || "Component");
                didWarnAboutUnsafeLifecycles.add(fiber.type);
              });
              pendingComponentWillReceivePropsWarnings = [];
            }
            var UNSAFE_componentWillReceivePropsUniqueNames = /* @__PURE__ */ new Set();
            if (pendingUNSAFE_ComponentWillReceivePropsWarnings.length > 0) {
              pendingUNSAFE_ComponentWillReceivePropsWarnings.forEach(function(fiber) {
                UNSAFE_componentWillReceivePropsUniqueNames.add(getComponentNameFromFiber(fiber) || "Component");
                didWarnAboutUnsafeLifecycles.add(fiber.type);
              });
              pendingUNSAFE_ComponentWillReceivePropsWarnings = [];
            }
            var componentWillUpdateUniqueNames = /* @__PURE__ */ new Set();
            if (pendingComponentWillUpdateWarnings.length > 0) {
              pendingComponentWillUpdateWarnings.forEach(function(fiber) {
                componentWillUpdateUniqueNames.add(getComponentNameFromFiber(fiber) || "Component");
                didWarnAboutUnsafeLifecycles.add(fiber.type);
              });
              pendingComponentWillUpdateWarnings = [];
            }
            var UNSAFE_componentWillUpdateUniqueNames = /* @__PURE__ */ new Set();
            if (pendingUNSAFE_ComponentWillUpdateWarnings.length > 0) {
              pendingUNSAFE_ComponentWillUpdateWarnings.forEach(function(fiber) {
                UNSAFE_componentWillUpdateUniqueNames.add(getComponentNameFromFiber(fiber) || "Component");
                didWarnAboutUnsafeLifecycles.add(fiber.type);
              });
              pendingUNSAFE_ComponentWillUpdateWarnings = [];
            }
            if (UNSAFE_componentWillMountUniqueNames.size > 0) {
              var sortedNames = setToSortedString(UNSAFE_componentWillMountUniqueNames);
              error("Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n* Move code with side effects to componentDidMount, and set initial state in the constructor.\n\nPlease update the following components: %s", sortedNames);
            }
            if (UNSAFE_componentWillReceivePropsUniqueNames.size > 0) {
              var _sortedNames = setToSortedString(UNSAFE_componentWillReceivePropsUniqueNames);
              error("Using UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs in your code. See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n* Move data fetching code or side effects to componentDidUpdate.\n* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://reactjs.org/link/derived-state\n\nPlease update the following components: %s", _sortedNames);
            }
            if (UNSAFE_componentWillUpdateUniqueNames.size > 0) {
              var _sortedNames2 = setToSortedString(UNSAFE_componentWillUpdateUniqueNames);
              error("Using UNSAFE_componentWillUpdate in strict mode is not recommended and may indicate bugs in your code. See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n* Move data fetching code or side effects to componentDidUpdate.\n\nPlease update the following components: %s", _sortedNames2);
            }
            if (componentWillMountUniqueNames.size > 0) {
              var _sortedNames3 = setToSortedString(componentWillMountUniqueNames);
              warn("componentWillMount has been renamed, and is not recommended for use. See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n* Move code with side effects to componentDidMount, and set initial state in the constructor.\n* Rename componentWillMount to UNSAFE_componentWillMount to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n\nPlease update the following components: %s", _sortedNames3);
            }
            if (componentWillReceivePropsUniqueNames.size > 0) {
              var _sortedNames4 = setToSortedString(componentWillReceivePropsUniqueNames);
              warn("componentWillReceiveProps has been renamed, and is not recommended for use. See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n* Move data fetching code or side effects to componentDidUpdate.\n* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://reactjs.org/link/derived-state\n* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n\nPlease update the following components: %s", _sortedNames4);
            }
            if (componentWillUpdateUniqueNames.size > 0) {
              var _sortedNames5 = setToSortedString(componentWillUpdateUniqueNames);
              warn("componentWillUpdate has been renamed, and is not recommended for use. See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n* Move data fetching code or side effects to componentDidUpdate.\n* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n\nPlease update the following components: %s", _sortedNames5);
            }
          };
          var pendingLegacyContextWarning = /* @__PURE__ */ new Map();
          var didWarnAboutLegacyContext = /* @__PURE__ */ new Set();
          ReactStrictModeWarnings.recordLegacyContextWarning = function(fiber, instance) {
            var strictRoot = findStrictRoot(fiber);
            if (strictRoot === null) {
              error("Expected to find a StrictMode component in a strict mode tree. This error is likely caused by a bug in React. Please file an issue.");
              return;
            }
            if (didWarnAboutLegacyContext.has(fiber.type)) {
              return;
            }
            var warningsForRoot = pendingLegacyContextWarning.get(strictRoot);
            if (fiber.type.contextTypes != null || fiber.type.childContextTypes != null || instance !== null && typeof instance.getChildContext === "function") {
              if (warningsForRoot === void 0) {
                warningsForRoot = [];
                pendingLegacyContextWarning.set(strictRoot, warningsForRoot);
              }
              warningsForRoot.push(fiber);
            }
          };
          ReactStrictModeWarnings.flushLegacyContextWarning = function() {
            pendingLegacyContextWarning.forEach(function(fiberArray, strictRoot) {
              if (fiberArray.length === 0) {
                return;
              }
              var firstFiber = fiberArray[0];
              var uniqueNames = /* @__PURE__ */ new Set();
              fiberArray.forEach(function(fiber) {
                uniqueNames.add(getComponentNameFromFiber(fiber) || "Component");
                didWarnAboutLegacyContext.add(fiber.type);
              });
              var sortedNames = setToSortedString(uniqueNames);
              try {
                setCurrentFiber(firstFiber);
                error("Legacy context API has been detected within a strict-mode tree.\n\nThe old API will be supported in all 16.x releases, but applications using it should migrate to the new version.\n\nPlease update the following components: %s\n\nLearn more about this warning here: https://reactjs.org/link/legacy-context", sortedNames);
              } finally {
                resetCurrentFiber();
              }
            });
          };
          ReactStrictModeWarnings.discardPendingWarnings = function() {
            pendingComponentWillMountWarnings = [];
            pendingUNSAFE_ComponentWillMountWarnings = [];
            pendingComponentWillReceivePropsWarnings = [];
            pendingUNSAFE_ComponentWillReceivePropsWarnings = [];
            pendingComponentWillUpdateWarnings = [];
            pendingUNSAFE_ComponentWillUpdateWarnings = [];
            pendingLegacyContextWarning = /* @__PURE__ */ new Map();
          };
        }
        var didWarnAboutMaps;
        var didWarnAboutGenerators;
        var didWarnAboutStringRefs;
        var ownerHasKeyUseWarning;
        var ownerHasFunctionTypeWarning;
        var warnForMissingKey = function(child, returnFiber) {
        };
        {
          didWarnAboutMaps = false;
          didWarnAboutGenerators = false;
          didWarnAboutStringRefs = {};
          ownerHasKeyUseWarning = {};
          ownerHasFunctionTypeWarning = {};
          warnForMissingKey = function(child, returnFiber) {
            if (child === null || typeof child !== "object") {
              return;
            }
            if (!child._store || child._store.validated || child.key != null) {
              return;
            }
            if (typeof child._store !== "object") {
              throw new Error("React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue.");
            }
            child._store.validated = true;
            var componentName = getComponentNameFromFiber(returnFiber) || "Component";
            if (ownerHasKeyUseWarning[componentName]) {
              return;
            }
            ownerHasKeyUseWarning[componentName] = true;
            error('Each child in a list should have a unique "key" prop. See https://reactjs.org/link/warning-keys for more information.');
          };
        }
        function isReactClass(type) {
          return type.prototype && type.prototype.isReactComponent;
        }
        function coerceRef(returnFiber, current2, element) {
          var mixedRef = element.ref;
          if (mixedRef !== null && typeof mixedRef !== "function" && typeof mixedRef !== "object") {
            {
              if ((returnFiber.mode & StrictLegacyMode || warnAboutStringRefs) && // We warn in ReactElement.js if owner and self are equal for string refs
              // because these cannot be automatically converted to an arrow function
              // using a codemod. Therefore, we don't have to warn about string refs again.
              !(element._owner && element._self && element._owner.stateNode !== element._self) && // Will already throw with "Function components cannot have string refs"
              !(element._owner && element._owner.tag !== ClassComponent) && // Will already warn with "Function components cannot be given refs"
              !(typeof element.type === "function" && !isReactClass(element.type)) && // Will already throw with "Element ref was specified as a string (someStringRef) but no owner was set"
              element._owner) {
                var componentName = getComponentNameFromFiber(returnFiber) || "Component";
                if (!didWarnAboutStringRefs[componentName]) {
                  {
                    error('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. We recommend using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', componentName, mixedRef);
                  }
                  didWarnAboutStringRefs[componentName] = true;
                }
              }
            }
            if (element._owner) {
              var owner = element._owner;
              var inst;
              if (owner) {
                var ownerFiber = owner;
                if (ownerFiber.tag !== ClassComponent) {
                  throw new Error("Function components cannot have string refs. We recommend using useRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref");
                }
                inst = ownerFiber.stateNode;
              }
              if (!inst) {
                throw new Error("Missing owner for string ref " + mixedRef + ". This error is likely caused by a bug in React. Please file an issue.");
              }
              var resolvedInst = inst;
              {
                checkPropStringCoercion(mixedRef, "ref");
              }
              var stringRef = "" + mixedRef;
              if (current2 !== null && current2.ref !== null && typeof current2.ref === "function" && current2.ref._stringRef === stringRef) {
                return current2.ref;
              }
              var ref = function(value) {
                var refs = resolvedInst.refs;
                if (value === null) {
                  delete refs[stringRef];
                } else {
                  refs[stringRef] = value;
                }
              };
              ref._stringRef = stringRef;
              return ref;
            } else {
              if (typeof mixedRef !== "string") {
                throw new Error("Expected ref to be a function, a string, an object returned by React.createRef(), or null.");
              }
              if (!element._owner) {
                throw new Error("Element ref was specified as a string (" + mixedRef + ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://reactjs.org/link/refs-must-have-owner for more information.");
              }
            }
          }
          return mixedRef;
        }
        function throwOnInvalidObjectType(returnFiber, newChild) {
          var childString = Object.prototype.toString.call(newChild);
          throw new Error("Objects are not valid as a React child (found: " + (childString === "[object Object]" ? "object with keys {" + Object.keys(newChild).join(", ") + "}" : childString) + "). If you meant to render a collection of children, use an array instead.");
        }
        function warnOnFunctionType(returnFiber) {
          {
            var componentName = getComponentNameFromFiber(returnFiber) || "Component";
            if (ownerHasFunctionTypeWarning[componentName]) {
              return;
            }
            ownerHasFunctionTypeWarning[componentName] = true;
            error("Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it.");
          }
        }
        function resolveLazy(lazyType) {
          var payload = lazyType._payload;
          var init2 = lazyType._init;
          return init2(payload);
        }
        function ChildReconciler(shouldTrackSideEffects) {
          function deleteChild(returnFiber, childToDelete) {
            if (!shouldTrackSideEffects) {
              return;
            }
            var deletions = returnFiber.deletions;
            if (deletions === null) {
              returnFiber.deletions = [childToDelete];
              returnFiber.flags |= ChildDeletion;
            } else {
              deletions.push(childToDelete);
            }
          }
          function deleteRemainingChildren(returnFiber, currentFirstChild) {
            if (!shouldTrackSideEffects) {
              return null;
            }
            var childToDelete = currentFirstChild;
            while (childToDelete !== null) {
              deleteChild(returnFiber, childToDelete);
              childToDelete = childToDelete.sibling;
            }
            return null;
          }
          function mapRemainingChildren(returnFiber, currentFirstChild) {
            var existingChildren = /* @__PURE__ */ new Map();
            var existingChild = currentFirstChild;
            while (existingChild !== null) {
              if (existingChild.key !== null) {
                existingChildren.set(existingChild.key, existingChild);
              } else {
                existingChildren.set(existingChild.index, existingChild);
              }
              existingChild = existingChild.sibling;
            }
            return existingChildren;
          }
          function useFiber(fiber, pendingProps) {
            var clone2 = createWorkInProgress(fiber, pendingProps);
            clone2.index = 0;
            clone2.sibling = null;
            return clone2;
          }
          function placeChild(newFiber, lastPlacedIndex, newIndex) {
            newFiber.index = newIndex;
            if (!shouldTrackSideEffects) {
              newFiber.flags |= Forked;
              return lastPlacedIndex;
            }
            var current2 = newFiber.alternate;
            if (current2 !== null) {
              var oldIndex = current2.index;
              if (oldIndex < lastPlacedIndex) {
                newFiber.flags |= Placement;
                return lastPlacedIndex;
              } else {
                return oldIndex;
              }
            } else {
              newFiber.flags |= Placement;
              return lastPlacedIndex;
            }
          }
          function placeSingleChild(newFiber) {
            if (shouldTrackSideEffects && newFiber.alternate === null) {
              newFiber.flags |= Placement;
            }
            return newFiber;
          }
          function updateTextNode(returnFiber, current2, textContent2, lanes) {
            if (current2 === null || current2.tag !== HostText) {
              var created = createFiberFromText(textContent2, returnFiber.mode, lanes);
              created.return = returnFiber;
              return created;
            } else {
              var existing = useFiber(current2, textContent2);
              existing.return = returnFiber;
              return existing;
            }
          }
          function updateElement(returnFiber, current2, element, lanes) {
            var elementType = element.type;
            if (elementType === REACT_FRAGMENT_TYPE) {
              return updateFragment2(returnFiber, current2, element.props.children, lanes, element.key);
            }
            if (current2 !== null) {
              if (current2.elementType === elementType || // Keep this check inline so it only runs on the false path:
              isCompatibleFamilyForHotReloading(current2, element) || // Lazy types should reconcile their resolved type.
              // We need to do this after the Hot Reloading check above,
              // because hot reloading has different semantics than prod because
              // it doesn't resuspend. So we can't let the call below suspend.
              typeof elementType === "object" && elementType !== null && elementType.$$typeof === REACT_LAZY_TYPE && resolveLazy(elementType) === current2.type) {
                var existing = useFiber(current2, element.props);
                existing.ref = coerceRef(returnFiber, current2, element);
                existing.return = returnFiber;
                {
                  existing._debugSource = element._source;
                  existing._debugOwner = element._owner;
                }
                return existing;
              }
            }
            var created = createFiberFromElement(element, returnFiber.mode, lanes);
            created.ref = coerceRef(returnFiber, current2, element);
            created.return = returnFiber;
            return created;
          }
          function updatePortal(returnFiber, current2, portal, lanes) {
            if (current2 === null || current2.tag !== HostPortal || current2.stateNode.containerInfo !== portal.containerInfo || current2.stateNode.implementation !== portal.implementation) {
              var created = createFiberFromPortal(portal, returnFiber.mode, lanes);
              created.return = returnFiber;
              return created;
            } else {
              var existing = useFiber(current2, portal.children || []);
              existing.return = returnFiber;
              return existing;
            }
          }
          function updateFragment2(returnFiber, current2, fragment, lanes, key) {
            if (current2 === null || current2.tag !== Fragment27) {
              var created = createFiberFromFragment(fragment, returnFiber.mode, lanes, key);
              created.return = returnFiber;
              return created;
            } else {
              var existing = useFiber(current2, fragment);
              existing.return = returnFiber;
              return existing;
            }
          }
          function createChild(returnFiber, newChild, lanes) {
            if (typeof newChild === "string" && newChild !== "" || typeof newChild === "number") {
              var created = createFiberFromText("" + newChild, returnFiber.mode, lanes);
              created.return = returnFiber;
              return created;
            }
            if (typeof newChild === "object" && newChild !== null) {
              switch (newChild.$$typeof) {
                case REACT_ELEMENT_TYPE: {
                  var _created = createFiberFromElement(newChild, returnFiber.mode, lanes);
                  _created.ref = coerceRef(returnFiber, null, newChild);
                  _created.return = returnFiber;
                  return _created;
                }
                case REACT_PORTAL_TYPE: {
                  var _created2 = createFiberFromPortal(newChild, returnFiber.mode, lanes);
                  _created2.return = returnFiber;
                  return _created2;
                }
                case REACT_LAZY_TYPE: {
                  var payload = newChild._payload;
                  var init2 = newChild._init;
                  return createChild(returnFiber, init2(payload), lanes);
                }
              }
              if (isArray(newChild) || getIteratorFn(newChild)) {
                var _created3 = createFiberFromFragment(newChild, returnFiber.mode, lanes, null);
                _created3.return = returnFiber;
                return _created3;
              }
              throwOnInvalidObjectType(returnFiber, newChild);
            }
            {
              if (typeof newChild === "function") {
                warnOnFunctionType(returnFiber);
              }
            }
            return null;
          }
          function updateSlot(returnFiber, oldFiber, newChild, lanes) {
            var key = oldFiber !== null ? oldFiber.key : null;
            if (typeof newChild === "string" && newChild !== "" || typeof newChild === "number") {
              if (key !== null) {
                return null;
              }
              return updateTextNode(returnFiber, oldFiber, "" + newChild, lanes);
            }
            if (typeof newChild === "object" && newChild !== null) {
              switch (newChild.$$typeof) {
                case REACT_ELEMENT_TYPE: {
                  if (newChild.key === key) {
                    return updateElement(returnFiber, oldFiber, newChild, lanes);
                  } else {
                    return null;
                  }
                }
                case REACT_PORTAL_TYPE: {
                  if (newChild.key === key) {
                    return updatePortal(returnFiber, oldFiber, newChild, lanes);
                  } else {
                    return null;
                  }
                }
                case REACT_LAZY_TYPE: {
                  var payload = newChild._payload;
                  var init2 = newChild._init;
                  return updateSlot(returnFiber, oldFiber, init2(payload), lanes);
                }
              }
              if (isArray(newChild) || getIteratorFn(newChild)) {
                if (key !== null) {
                  return null;
                }
                return updateFragment2(returnFiber, oldFiber, newChild, lanes, null);
              }
              throwOnInvalidObjectType(returnFiber, newChild);
            }
            {
              if (typeof newChild === "function") {
                warnOnFunctionType(returnFiber);
              }
            }
            return null;
          }
          function updateFromMap(existingChildren, returnFiber, newIdx, newChild, lanes) {
            if (typeof newChild === "string" && newChild !== "" || typeof newChild === "number") {
              var matchedFiber = existingChildren.get(newIdx) || null;
              return updateTextNode(returnFiber, matchedFiber, "" + newChild, lanes);
            }
            if (typeof newChild === "object" && newChild !== null) {
              switch (newChild.$$typeof) {
                case REACT_ELEMENT_TYPE: {
                  var _matchedFiber = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
                  return updateElement(returnFiber, _matchedFiber, newChild, lanes);
                }
                case REACT_PORTAL_TYPE: {
                  var _matchedFiber2 = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
                  return updatePortal(returnFiber, _matchedFiber2, newChild, lanes);
                }
                case REACT_LAZY_TYPE:
                  var payload = newChild._payload;
                  var init2 = newChild._init;
                  return updateFromMap(existingChildren, returnFiber, newIdx, init2(payload), lanes);
              }
              if (isArray(newChild) || getIteratorFn(newChild)) {
                var _matchedFiber3 = existingChildren.get(newIdx) || null;
                return updateFragment2(returnFiber, _matchedFiber3, newChild, lanes, null);
              }
              throwOnInvalidObjectType(returnFiber, newChild);
            }
            {
              if (typeof newChild === "function") {
                warnOnFunctionType(returnFiber);
              }
            }
            return null;
          }
          function warnOnInvalidKey(child, knownKeys, returnFiber) {
            {
              if (typeof child !== "object" || child === null) {
                return knownKeys;
              }
              switch (child.$$typeof) {
                case REACT_ELEMENT_TYPE:
                case REACT_PORTAL_TYPE:
                  warnForMissingKey(child, returnFiber);
                  var key = child.key;
                  if (typeof key !== "string") {
                    break;
                  }
                  if (knownKeys === null) {
                    knownKeys = /* @__PURE__ */ new Set();
                    knownKeys.add(key);
                    break;
                  }
                  if (!knownKeys.has(key)) {
                    knownKeys.add(key);
                    break;
                  }
                  error("Encountered two children with the same key, `%s`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted \u2014 the behavior is unsupported and could change in a future version.", key);
                  break;
                case REACT_LAZY_TYPE:
                  var payload = child._payload;
                  var init2 = child._init;
                  warnOnInvalidKey(init2(payload), knownKeys, returnFiber);
                  break;
              }
            }
            return knownKeys;
          }
          function reconcileChildrenArray(returnFiber, currentFirstChild, newChildren, lanes) {
            {
              var knownKeys = null;
              for (var i2 = 0; i2 < newChildren.length; i2++) {
                var child = newChildren[i2];
                knownKeys = warnOnInvalidKey(child, knownKeys, returnFiber);
              }
            }
            var resultingFirstChild = null;
            var previousNewFiber = null;
            var oldFiber = currentFirstChild;
            var lastPlacedIndex = 0;
            var newIdx = 0;
            var nextOldFiber = null;
            for (; oldFiber !== null && newIdx < newChildren.length; newIdx++) {
              if (oldFiber.index > newIdx) {
                nextOldFiber = oldFiber;
                oldFiber = null;
              } else {
                nextOldFiber = oldFiber.sibling;
              }
              var newFiber = updateSlot(returnFiber, oldFiber, newChildren[newIdx], lanes);
              if (newFiber === null) {
                if (oldFiber === null) {
                  oldFiber = nextOldFiber;
                }
                break;
              }
              if (shouldTrackSideEffects) {
                if (oldFiber && newFiber.alternate === null) {
                  deleteChild(returnFiber, oldFiber);
                }
              }
              lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx);
              if (previousNewFiber === null) {
                resultingFirstChild = newFiber;
              } else {
                previousNewFiber.sibling = newFiber;
              }
              previousNewFiber = newFiber;
              oldFiber = nextOldFiber;
            }
            if (newIdx === newChildren.length) {
              deleteRemainingChildren(returnFiber, oldFiber);
              if (getIsHydrating()) {
                var numberOfForks = newIdx;
                pushTreeFork(returnFiber, numberOfForks);
              }
              return resultingFirstChild;
            }
            if (oldFiber === null) {
              for (; newIdx < newChildren.length; newIdx++) {
                var _newFiber = createChild(returnFiber, newChildren[newIdx], lanes);
                if (_newFiber === null) {
                  continue;
                }
                lastPlacedIndex = placeChild(_newFiber, lastPlacedIndex, newIdx);
                if (previousNewFiber === null) {
                  resultingFirstChild = _newFiber;
                } else {
                  previousNewFiber.sibling = _newFiber;
                }
                previousNewFiber = _newFiber;
              }
              if (getIsHydrating()) {
                var _numberOfForks = newIdx;
                pushTreeFork(returnFiber, _numberOfForks);
              }
              return resultingFirstChild;
            }
            var existingChildren = mapRemainingChildren(returnFiber, oldFiber);
            for (; newIdx < newChildren.length; newIdx++) {
              var _newFiber2 = updateFromMap(existingChildren, returnFiber, newIdx, newChildren[newIdx], lanes);
              if (_newFiber2 !== null) {
                if (shouldTrackSideEffects) {
                  if (_newFiber2.alternate !== null) {
                    existingChildren.delete(_newFiber2.key === null ? newIdx : _newFiber2.key);
                  }
                }
                lastPlacedIndex = placeChild(_newFiber2, lastPlacedIndex, newIdx);
                if (previousNewFiber === null) {
                  resultingFirstChild = _newFiber2;
                } else {
                  previousNewFiber.sibling = _newFiber2;
                }
                previousNewFiber = _newFiber2;
              }
            }
            if (shouldTrackSideEffects) {
              existingChildren.forEach(function(child2) {
                return deleteChild(returnFiber, child2);
              });
            }
            if (getIsHydrating()) {
              var _numberOfForks2 = newIdx;
              pushTreeFork(returnFiber, _numberOfForks2);
            }
            return resultingFirstChild;
          }
          function reconcileChildrenIterator(returnFiber, currentFirstChild, newChildrenIterable, lanes) {
            var iteratorFn = getIteratorFn(newChildrenIterable);
            if (typeof iteratorFn !== "function") {
              throw new Error("An object is not an iterable. This error is likely caused by a bug in React. Please file an issue.");
            }
            {
              if (typeof Symbol === "function" && // $FlowFixMe Flow doesn't know about toStringTag
              newChildrenIterable[Symbol.toStringTag] === "Generator") {
                if (!didWarnAboutGenerators) {
                  error("Using Generators as children is unsupported and will likely yield unexpected results because enumerating a generator mutates it. You may convert it to an array with `Array.from()` or the `[...spread]` operator before rendering. Keep in mind you might need to polyfill these features for older browsers.");
                }
                didWarnAboutGenerators = true;
              }
              if (newChildrenIterable.entries === iteratorFn) {
                if (!didWarnAboutMaps) {
                  error("Using Maps as children is not supported. Use an array of keyed ReactElements instead.");
                }
                didWarnAboutMaps = true;
              }
              var _newChildren = iteratorFn.call(newChildrenIterable);
              if (_newChildren) {
                var knownKeys = null;
                var _step = _newChildren.next();
                for (; !_step.done; _step = _newChildren.next()) {
                  var child = _step.value;
                  knownKeys = warnOnInvalidKey(child, knownKeys, returnFiber);
                }
              }
            }
            var newChildren = iteratorFn.call(newChildrenIterable);
            if (newChildren == null) {
              throw new Error("An iterable object provided no iterator.");
            }
            var resultingFirstChild = null;
            var previousNewFiber = null;
            var oldFiber = currentFirstChild;
            var lastPlacedIndex = 0;
            var newIdx = 0;
            var nextOldFiber = null;
            var step = newChildren.next();
            for (; oldFiber !== null && !step.done; newIdx++, step = newChildren.next()) {
              if (oldFiber.index > newIdx) {
                nextOldFiber = oldFiber;
                oldFiber = null;
              } else {
                nextOldFiber = oldFiber.sibling;
              }
              var newFiber = updateSlot(returnFiber, oldFiber, step.value, lanes);
              if (newFiber === null) {
                if (oldFiber === null) {
                  oldFiber = nextOldFiber;
                }
                break;
              }
              if (shouldTrackSideEffects) {
                if (oldFiber && newFiber.alternate === null) {
                  deleteChild(returnFiber, oldFiber);
                }
              }
              lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx);
              if (previousNewFiber === null) {
                resultingFirstChild = newFiber;
              } else {
                previousNewFiber.sibling = newFiber;
              }
              previousNewFiber = newFiber;
              oldFiber = nextOldFiber;
            }
            if (step.done) {
              deleteRemainingChildren(returnFiber, oldFiber);
              if (getIsHydrating()) {
                var numberOfForks = newIdx;
                pushTreeFork(returnFiber, numberOfForks);
              }
              return resultingFirstChild;
            }
            if (oldFiber === null) {
              for (; !step.done; newIdx++, step = newChildren.next()) {
                var _newFiber3 = createChild(returnFiber, step.value, lanes);
                if (_newFiber3 === null) {
                  continue;
                }
                lastPlacedIndex = placeChild(_newFiber3, lastPlacedIndex, newIdx);
                if (previousNewFiber === null) {
                  resultingFirstChild = _newFiber3;
                } else {
                  previousNewFiber.sibling = _newFiber3;
                }
                previousNewFiber = _newFiber3;
              }
              if (getIsHydrating()) {
                var _numberOfForks3 = newIdx;
                pushTreeFork(returnFiber, _numberOfForks3);
              }
              return resultingFirstChild;
            }
            var existingChildren = mapRemainingChildren(returnFiber, oldFiber);
            for (; !step.done; newIdx++, step = newChildren.next()) {
              var _newFiber4 = updateFromMap(existingChildren, returnFiber, newIdx, step.value, lanes);
              if (_newFiber4 !== null) {
                if (shouldTrackSideEffects) {
                  if (_newFiber4.alternate !== null) {
                    existingChildren.delete(_newFiber4.key === null ? newIdx : _newFiber4.key);
                  }
                }
                lastPlacedIndex = placeChild(_newFiber4, lastPlacedIndex, newIdx);
                if (previousNewFiber === null) {
                  resultingFirstChild = _newFiber4;
                } else {
                  previousNewFiber.sibling = _newFiber4;
                }
                previousNewFiber = _newFiber4;
              }
            }
            if (shouldTrackSideEffects) {
              existingChildren.forEach(function(child2) {
                return deleteChild(returnFiber, child2);
              });
            }
            if (getIsHydrating()) {
              var _numberOfForks4 = newIdx;
              pushTreeFork(returnFiber, _numberOfForks4);
            }
            return resultingFirstChild;
          }
          function reconcileSingleTextNode(returnFiber, currentFirstChild, textContent2, lanes) {
            if (currentFirstChild !== null && currentFirstChild.tag === HostText) {
              deleteRemainingChildren(returnFiber, currentFirstChild.sibling);
              var existing = useFiber(currentFirstChild, textContent2);
              existing.return = returnFiber;
              return existing;
            }
            deleteRemainingChildren(returnFiber, currentFirstChild);
            var created = createFiberFromText(textContent2, returnFiber.mode, lanes);
            created.return = returnFiber;
            return created;
          }
          function reconcileSingleElement(returnFiber, currentFirstChild, element, lanes) {
            var key = element.key;
            var child = currentFirstChild;
            while (child !== null) {
              if (child.key === key) {
                var elementType = element.type;
                if (elementType === REACT_FRAGMENT_TYPE) {
                  if (child.tag === Fragment27) {
                    deleteRemainingChildren(returnFiber, child.sibling);
                    var existing = useFiber(child, element.props.children);
                    existing.return = returnFiber;
                    {
                      existing._debugSource = element._source;
                      existing._debugOwner = element._owner;
                    }
                    return existing;
                  }
                } else {
                  if (child.elementType === elementType || // Keep this check inline so it only runs on the false path:
                  isCompatibleFamilyForHotReloading(child, element) || // Lazy types should reconcile their resolved type.
                  // We need to do this after the Hot Reloading check above,
                  // because hot reloading has different semantics than prod because
                  // it doesn't resuspend. So we can't let the call below suspend.
                  typeof elementType === "object" && elementType !== null && elementType.$$typeof === REACT_LAZY_TYPE && resolveLazy(elementType) === child.type) {
                    deleteRemainingChildren(returnFiber, child.sibling);
                    var _existing = useFiber(child, element.props);
                    _existing.ref = coerceRef(returnFiber, child, element);
                    _existing.return = returnFiber;
                    {
                      _existing._debugSource = element._source;
                      _existing._debugOwner = element._owner;
                    }
                    return _existing;
                  }
                }
                deleteRemainingChildren(returnFiber, child);
                break;
              } else {
                deleteChild(returnFiber, child);
              }
              child = child.sibling;
            }
            if (element.type === REACT_FRAGMENT_TYPE) {
              var created = createFiberFromFragment(element.props.children, returnFiber.mode, lanes, element.key);
              created.return = returnFiber;
              return created;
            } else {
              var _created4 = createFiberFromElement(element, returnFiber.mode, lanes);
              _created4.ref = coerceRef(returnFiber, currentFirstChild, element);
              _created4.return = returnFiber;
              return _created4;
            }
          }
          function reconcileSinglePortal(returnFiber, currentFirstChild, portal, lanes) {
            var key = portal.key;
            var child = currentFirstChild;
            while (child !== null) {
              if (child.key === key) {
                if (child.tag === HostPortal && child.stateNode.containerInfo === portal.containerInfo && child.stateNode.implementation === portal.implementation) {
                  deleteRemainingChildren(returnFiber, child.sibling);
                  var existing = useFiber(child, portal.children || []);
                  existing.return = returnFiber;
                  return existing;
                } else {
                  deleteRemainingChildren(returnFiber, child);
                  break;
                }
              } else {
                deleteChild(returnFiber, child);
              }
              child = child.sibling;
            }
            var created = createFiberFromPortal(portal, returnFiber.mode, lanes);
            created.return = returnFiber;
            return created;
          }
          function reconcileChildFibers2(returnFiber, currentFirstChild, newChild, lanes) {
            var isUnkeyedTopLevelFragment = typeof newChild === "object" && newChild !== null && newChild.type === REACT_FRAGMENT_TYPE && newChild.key === null;
            if (isUnkeyedTopLevelFragment) {
              newChild = newChild.props.children;
            }
            if (typeof newChild === "object" && newChild !== null) {
              switch (newChild.$$typeof) {
                case REACT_ELEMENT_TYPE:
                  return placeSingleChild(reconcileSingleElement(returnFiber, currentFirstChild, newChild, lanes));
                case REACT_PORTAL_TYPE:
                  return placeSingleChild(reconcileSinglePortal(returnFiber, currentFirstChild, newChild, lanes));
                case REACT_LAZY_TYPE:
                  var payload = newChild._payload;
                  var init2 = newChild._init;
                  return reconcileChildFibers2(returnFiber, currentFirstChild, init2(payload), lanes);
              }
              if (isArray(newChild)) {
                return reconcileChildrenArray(returnFiber, currentFirstChild, newChild, lanes);
              }
              if (getIteratorFn(newChild)) {
                return reconcileChildrenIterator(returnFiber, currentFirstChild, newChild, lanes);
              }
              throwOnInvalidObjectType(returnFiber, newChild);
            }
            if (typeof newChild === "string" && newChild !== "" || typeof newChild === "number") {
              return placeSingleChild(reconcileSingleTextNode(returnFiber, currentFirstChild, "" + newChild, lanes));
            }
            {
              if (typeof newChild === "function") {
                warnOnFunctionType(returnFiber);
              }
            }
            return deleteRemainingChildren(returnFiber, currentFirstChild);
          }
          return reconcileChildFibers2;
        }
        var reconcileChildFibers = ChildReconciler(true);
        var mountChildFibers = ChildReconciler(false);
        function cloneChildFibers(current2, workInProgress2) {
          if (current2 !== null && workInProgress2.child !== current2.child) {
            throw new Error("Resuming work not yet implemented.");
          }
          if (workInProgress2.child === null) {
            return;
          }
          var currentChild = workInProgress2.child;
          var newChild = createWorkInProgress(currentChild, currentChild.pendingProps);
          workInProgress2.child = newChild;
          newChild.return = workInProgress2;
          while (currentChild.sibling !== null) {
            currentChild = currentChild.sibling;
            newChild = newChild.sibling = createWorkInProgress(currentChild, currentChild.pendingProps);
            newChild.return = workInProgress2;
          }
          newChild.sibling = null;
        }
        function resetChildFibers(workInProgress2, lanes) {
          var child = workInProgress2.child;
          while (child !== null) {
            resetWorkInProgress(child, lanes);
            child = child.sibling;
          }
        }
        var valueCursor = createCursor(null);
        var rendererSigil;
        {
          rendererSigil = {};
        }
        var currentlyRenderingFiber = null;
        var lastContextDependency = null;
        var lastFullyObservedContext = null;
        var isDisallowedContextReadInDEV = false;
        function resetContextDependencies() {
          currentlyRenderingFiber = null;
          lastContextDependency = null;
          lastFullyObservedContext = null;
          {
            isDisallowedContextReadInDEV = false;
          }
        }
        function enterDisallowedContextReadInDEV() {
          {
            isDisallowedContextReadInDEV = true;
          }
        }
        function exitDisallowedContextReadInDEV() {
          {
            isDisallowedContextReadInDEV = false;
          }
        }
        function pushProvider(providerFiber, context, nextValue) {
          {
            push(valueCursor, context._currentValue, providerFiber);
            context._currentValue = nextValue;
            {
              if (context._currentRenderer !== void 0 && context._currentRenderer !== null && context._currentRenderer !== rendererSigil) {
                error("Detected multiple renderers concurrently rendering the same context provider. This is currently unsupported.");
              }
              context._currentRenderer = rendererSigil;
            }
          }
        }
        function popProvider(context, providerFiber) {
          var currentValue = valueCursor.current;
          pop(valueCursor, providerFiber);
          {
            {
              context._currentValue = currentValue;
            }
          }
        }
        function scheduleContextWorkOnParentPath(parent, renderLanes2, propagationRoot) {
          var node = parent;
          while (node !== null) {
            var alternate = node.alternate;
            if (!isSubsetOfLanes(node.childLanes, renderLanes2)) {
              node.childLanes = mergeLanes(node.childLanes, renderLanes2);
              if (alternate !== null) {
                alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes2);
              }
            } else if (alternate !== null && !isSubsetOfLanes(alternate.childLanes, renderLanes2)) {
              alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes2);
            }
            if (node === propagationRoot) {
              break;
            }
            node = node.return;
          }
          {
            if (node !== propagationRoot) {
              error("Expected to find the propagation root when scheduling context work. This error is likely caused by a bug in React. Please file an issue.");
            }
          }
        }
        function propagateContextChange(workInProgress2, context, renderLanes2) {
          {
            propagateContextChange_eager(workInProgress2, context, renderLanes2);
          }
        }
        function propagateContextChange_eager(workInProgress2, context, renderLanes2) {
          var fiber = workInProgress2.child;
          if (fiber !== null) {
            fiber.return = workInProgress2;
          }
          while (fiber !== null) {
            var nextFiber = void 0;
            var list = fiber.dependencies;
            if (list !== null) {
              nextFiber = fiber.child;
              var dependency = list.firstContext;
              while (dependency !== null) {
                if (dependency.context === context) {
                  if (fiber.tag === ClassComponent) {
                    var lane = pickArbitraryLane(renderLanes2);
                    var update = createUpdate(NoTimestamp, lane);
                    update.tag = ForceUpdate;
                    var updateQueue = fiber.updateQueue;
                    if (updateQueue === null)
                      ;
                    else {
                      var sharedQueue = updateQueue.shared;
                      var pending = sharedQueue.pending;
                      if (pending === null) {
                        update.next = update;
                      } else {
                        update.next = pending.next;
                        pending.next = update;
                      }
                      sharedQueue.pending = update;
                    }
                  }
                  fiber.lanes = mergeLanes(fiber.lanes, renderLanes2);
                  var alternate = fiber.alternate;
                  if (alternate !== null) {
                    alternate.lanes = mergeLanes(alternate.lanes, renderLanes2);
                  }
                  scheduleContextWorkOnParentPath(fiber.return, renderLanes2, workInProgress2);
                  list.lanes = mergeLanes(list.lanes, renderLanes2);
                  break;
                }
                dependency = dependency.next;
              }
            } else if (fiber.tag === ContextProvider) {
              nextFiber = fiber.type === workInProgress2.type ? null : fiber.child;
            } else if (fiber.tag === DehydratedFragment) {
              var parentSuspense = fiber.return;
              if (parentSuspense === null) {
                throw new Error("We just came from a parent so we must have had a parent. This is a bug in React.");
              }
              parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes2);
              var _alternate = parentSuspense.alternate;
              if (_alternate !== null) {
                _alternate.lanes = mergeLanes(_alternate.lanes, renderLanes2);
              }
              scheduleContextWorkOnParentPath(parentSuspense, renderLanes2, workInProgress2);
              nextFiber = fiber.sibling;
            } else {
              nextFiber = fiber.child;
            }
            if (nextFiber !== null) {
              nextFiber.return = fiber;
            } else {
              nextFiber = fiber;
              while (nextFiber !== null) {
                if (nextFiber === workInProgress2) {
                  nextFiber = null;
                  break;
                }
                var sibling = nextFiber.sibling;
                if (sibling !== null) {
                  sibling.return = nextFiber.return;
                  nextFiber = sibling;
                  break;
                }
                nextFiber = nextFiber.return;
              }
            }
            fiber = nextFiber;
          }
        }
        function prepareToReadContext(workInProgress2, renderLanes2) {
          currentlyRenderingFiber = workInProgress2;
          lastContextDependency = null;
          lastFullyObservedContext = null;
          var dependencies = workInProgress2.dependencies;
          if (dependencies !== null) {
            {
              var firstContext = dependencies.firstContext;
              if (firstContext !== null) {
                if (includesSomeLane(dependencies.lanes, renderLanes2)) {
                  markWorkInProgressReceivedUpdate();
                }
                dependencies.firstContext = null;
              }
            }
          }
        }
        function readContext(context) {
          {
            if (isDisallowedContextReadInDEV) {
              error("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().");
            }
          }
          var value = context._currentValue;
          if (lastFullyObservedContext === context)
            ;
          else {
            var contextItem = {
              context,
              memoizedValue: value,
              next: null
            };
            if (lastContextDependency === null) {
              if (currentlyRenderingFiber === null) {
                throw new Error("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().");
              }
              lastContextDependency = contextItem;
              currentlyRenderingFiber.dependencies = {
                lanes: NoLanes,
                firstContext: contextItem
              };
            } else {
              lastContextDependency = lastContextDependency.next = contextItem;
            }
          }
          return value;
        }
        var concurrentQueues = null;
        function pushConcurrentUpdateQueue(queue) {
          if (concurrentQueues === null) {
            concurrentQueues = [queue];
          } else {
            concurrentQueues.push(queue);
          }
        }
        function finishQueueingConcurrentUpdates() {
          if (concurrentQueues !== null) {
            for (var i2 = 0; i2 < concurrentQueues.length; i2++) {
              var queue = concurrentQueues[i2];
              var lastInterleavedUpdate = queue.interleaved;
              if (lastInterleavedUpdate !== null) {
                queue.interleaved = null;
                var firstInterleavedUpdate = lastInterleavedUpdate.next;
                var lastPendingUpdate = queue.pending;
                if (lastPendingUpdate !== null) {
                  var firstPendingUpdate = lastPendingUpdate.next;
                  lastPendingUpdate.next = firstInterleavedUpdate;
                  lastInterleavedUpdate.next = firstPendingUpdate;
                }
                queue.pending = lastInterleavedUpdate;
              }
            }
            concurrentQueues = null;
          }
        }
        function enqueueConcurrentHookUpdate(fiber, queue, update, lane) {
          var interleaved = queue.interleaved;
          if (interleaved === null) {
            update.next = update;
            pushConcurrentUpdateQueue(queue);
          } else {
            update.next = interleaved.next;
            interleaved.next = update;
          }
          queue.interleaved = update;
          return markUpdateLaneFromFiberToRoot(fiber, lane);
        }
        function enqueueConcurrentHookUpdateAndEagerlyBailout(fiber, queue, update, lane) {
          var interleaved = queue.interleaved;
          if (interleaved === null) {
            update.next = update;
            pushConcurrentUpdateQueue(queue);
          } else {
            update.next = interleaved.next;
            interleaved.next = update;
          }
          queue.interleaved = update;
        }
        function enqueueConcurrentClassUpdate(fiber, queue, update, lane) {
          var interleaved = queue.interleaved;
          if (interleaved === null) {
            update.next = update;
            pushConcurrentUpdateQueue(queue);
          } else {
            update.next = interleaved.next;
            interleaved.next = update;
          }
          queue.interleaved = update;
          return markUpdateLaneFromFiberToRoot(fiber, lane);
        }
        function enqueueConcurrentRenderForLane(fiber, lane) {
          return markUpdateLaneFromFiberToRoot(fiber, lane);
        }
        var unsafe_markUpdateLaneFromFiberToRoot = markUpdateLaneFromFiberToRoot;
        function markUpdateLaneFromFiberToRoot(sourceFiber, lane) {
          sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane);
          var alternate = sourceFiber.alternate;
          if (alternate !== null) {
            alternate.lanes = mergeLanes(alternate.lanes, lane);
          }
          {
            if (alternate === null && (sourceFiber.flags & (Placement | Hydrating)) !== NoFlags) {
              warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber);
            }
          }
          var node = sourceFiber;
          var parent = sourceFiber.return;
          while (parent !== null) {
            parent.childLanes = mergeLanes(parent.childLanes, lane);
            alternate = parent.alternate;
            if (alternate !== null) {
              alternate.childLanes = mergeLanes(alternate.childLanes, lane);
            } else {
              {
                if ((parent.flags & (Placement | Hydrating)) !== NoFlags) {
                  warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber);
                }
              }
            }
            node = parent;
            parent = parent.return;
          }
          if (node.tag === HostRoot) {
            var root2 = node.stateNode;
            return root2;
          } else {
            return null;
          }
        }
        var UpdateState = 0;
        var ReplaceState = 1;
        var ForceUpdate = 2;
        var CaptureUpdate = 3;
        var hasForceUpdate = false;
        var didWarnUpdateInsideUpdate;
        var currentlyProcessingQueue;
        {
          didWarnUpdateInsideUpdate = false;
          currentlyProcessingQueue = null;
        }
        function initializeUpdateQueue(fiber) {
          var queue = {
            baseState: fiber.memoizedState,
            firstBaseUpdate: null,
            lastBaseUpdate: null,
            shared: {
              pending: null,
              interleaved: null,
              lanes: NoLanes
            },
            effects: null
          };
          fiber.updateQueue = queue;
        }
        function cloneUpdateQueue(current2, workInProgress2) {
          var queue = workInProgress2.updateQueue;
          var currentQueue = current2.updateQueue;
          if (queue === currentQueue) {
            var clone2 = {
              baseState: currentQueue.baseState,
              firstBaseUpdate: currentQueue.firstBaseUpdate,
              lastBaseUpdate: currentQueue.lastBaseUpdate,
              shared: currentQueue.shared,
              effects: currentQueue.effects
            };
            workInProgress2.updateQueue = clone2;
          }
        }
        function createUpdate(eventTime, lane) {
          var update = {
            eventTime,
            lane,
            tag: UpdateState,
            payload: null,
            callback: null,
            next: null
          };
          return update;
        }
        function enqueueUpdate(fiber, update, lane) {
          var updateQueue = fiber.updateQueue;
          if (updateQueue === null) {
            return null;
          }
          var sharedQueue = updateQueue.shared;
          {
            if (currentlyProcessingQueue === sharedQueue && !didWarnUpdateInsideUpdate) {
              error("An update (setState, replaceState, or forceUpdate) was scheduled from inside an update function. Update functions should be pure, with zero side-effects. Consider using componentDidUpdate or a callback.");
              didWarnUpdateInsideUpdate = true;
            }
          }
          if (isUnsafeClassRenderPhaseUpdate()) {
            var pending = sharedQueue.pending;
            if (pending === null) {
              update.next = update;
            } else {
              update.next = pending.next;
              pending.next = update;
            }
            sharedQueue.pending = update;
            return unsafe_markUpdateLaneFromFiberToRoot(fiber, lane);
          } else {
            return enqueueConcurrentClassUpdate(fiber, sharedQueue, update, lane);
          }
        }
        function entangleTransitions(root2, fiber, lane) {
          var updateQueue = fiber.updateQueue;
          if (updateQueue === null) {
            return;
          }
          var sharedQueue = updateQueue.shared;
          if (isTransitionLane(lane)) {
            var queueLanes = sharedQueue.lanes;
            queueLanes = intersectLanes(queueLanes, root2.pendingLanes);
            var newQueueLanes = mergeLanes(queueLanes, lane);
            sharedQueue.lanes = newQueueLanes;
            markRootEntangled(root2, newQueueLanes);
          }
        }
        function enqueueCapturedUpdate(workInProgress2, capturedUpdate) {
          var queue = workInProgress2.updateQueue;
          var current2 = workInProgress2.alternate;
          if (current2 !== null) {
            var currentQueue = current2.updateQueue;
            if (queue === currentQueue) {
              var newFirst = null;
              var newLast = null;
              var firstBaseUpdate = queue.firstBaseUpdate;
              if (firstBaseUpdate !== null) {
                var update = firstBaseUpdate;
                do {
                  var clone2 = {
                    eventTime: update.eventTime,
                    lane: update.lane,
                    tag: update.tag,
                    payload: update.payload,
                    callback: update.callback,
                    next: null
                  };
                  if (newLast === null) {
                    newFirst = newLast = clone2;
                  } else {
                    newLast.next = clone2;
                    newLast = clone2;
                  }
                  update = update.next;
                } while (update !== null);
                if (newLast === null) {
                  newFirst = newLast = capturedUpdate;
                } else {
                  newLast.next = capturedUpdate;
                  newLast = capturedUpdate;
                }
              } else {
                newFirst = newLast = capturedUpdate;
              }
              queue = {
                baseState: currentQueue.baseState,
                firstBaseUpdate: newFirst,
                lastBaseUpdate: newLast,
                shared: currentQueue.shared,
                effects: currentQueue.effects
              };
              workInProgress2.updateQueue = queue;
              return;
            }
          }
          var lastBaseUpdate = queue.lastBaseUpdate;
          if (lastBaseUpdate === null) {
            queue.firstBaseUpdate = capturedUpdate;
          } else {
            lastBaseUpdate.next = capturedUpdate;
          }
          queue.lastBaseUpdate = capturedUpdate;
        }
        function getStateFromUpdate(workInProgress2, queue, update, prevState, nextProps, instance) {
          switch (update.tag) {
            case ReplaceState: {
              var payload = update.payload;
              if (typeof payload === "function") {
                {
                  enterDisallowedContextReadInDEV();
                }
                var nextState = payload.call(instance, prevState, nextProps);
                {
                  if (workInProgress2.mode & StrictLegacyMode) {
                    setIsStrictModeForDevtools(true);
                    try {
                      payload.call(instance, prevState, nextProps);
                    } finally {
                      setIsStrictModeForDevtools(false);
                    }
                  }
                  exitDisallowedContextReadInDEV();
                }
                return nextState;
              }
              return payload;
            }
            case CaptureUpdate: {
              workInProgress2.flags = workInProgress2.flags & ~ShouldCapture | DidCapture;
            }
            case UpdateState: {
              var _payload = update.payload;
              var partialState;
              if (typeof _payload === "function") {
                {
                  enterDisallowedContextReadInDEV();
                }
                partialState = _payload.call(instance, prevState, nextProps);
                {
                  if (workInProgress2.mode & StrictLegacyMode) {
                    setIsStrictModeForDevtools(true);
                    try {
                      _payload.call(instance, prevState, nextProps);
                    } finally {
                      setIsStrictModeForDevtools(false);
                    }
                  }
                  exitDisallowedContextReadInDEV();
                }
              } else {
                partialState = _payload;
              }
              if (partialState === null || partialState === void 0) {
                return prevState;
              }
              return assign({}, prevState, partialState);
            }
            case ForceUpdate: {
              hasForceUpdate = true;
              return prevState;
            }
          }
          return prevState;
        }
        function processUpdateQueue(workInProgress2, props, instance, renderLanes2) {
          var queue = workInProgress2.updateQueue;
          hasForceUpdate = false;
          {
            currentlyProcessingQueue = queue.shared;
          }
          var firstBaseUpdate = queue.firstBaseUpdate;
          var lastBaseUpdate = queue.lastBaseUpdate;
          var pendingQueue = queue.shared.pending;
          if (pendingQueue !== null) {
            queue.shared.pending = null;
            var lastPendingUpdate = pendingQueue;
            var firstPendingUpdate = lastPendingUpdate.next;
            lastPendingUpdate.next = null;
            if (lastBaseUpdate === null) {
              firstBaseUpdate = firstPendingUpdate;
            } else {
              lastBaseUpdate.next = firstPendingUpdate;
            }
            lastBaseUpdate = lastPendingUpdate;
            var current2 = workInProgress2.alternate;
            if (current2 !== null) {
              var currentQueue = current2.updateQueue;
              var currentLastBaseUpdate = currentQueue.lastBaseUpdate;
              if (currentLastBaseUpdate !== lastBaseUpdate) {
                if (currentLastBaseUpdate === null) {
                  currentQueue.firstBaseUpdate = firstPendingUpdate;
                } else {
                  currentLastBaseUpdate.next = firstPendingUpdate;
                }
                currentQueue.lastBaseUpdate = lastPendingUpdate;
              }
            }
          }
          if (firstBaseUpdate !== null) {
            var newState = queue.baseState;
            var newLanes = NoLanes;
            var newBaseState = null;
            var newFirstBaseUpdate = null;
            var newLastBaseUpdate = null;
            var update = firstBaseUpdate;
            do {
              var updateLane = update.lane;
              var updateEventTime = update.eventTime;
              if (!isSubsetOfLanes(renderLanes2, updateLane)) {
                var clone2 = {
                  eventTime: updateEventTime,
                  lane: updateLane,
                  tag: update.tag,
                  payload: update.payload,
                  callback: update.callback,
                  next: null
                };
                if (newLastBaseUpdate === null) {
                  newFirstBaseUpdate = newLastBaseUpdate = clone2;
                  newBaseState = newState;
                } else {
                  newLastBaseUpdate = newLastBaseUpdate.next = clone2;
                }
                newLanes = mergeLanes(newLanes, updateLane);
              } else {
                if (newLastBaseUpdate !== null) {
                  var _clone = {
                    eventTime: updateEventTime,
                    // This update is going to be committed so we never want uncommit
                    // it. Using NoLane works because 0 is a subset of all bitmasks, so
                    // this will never be skipped by the check above.
                    lane: NoLane,
                    tag: update.tag,
                    payload: update.payload,
                    callback: update.callback,
                    next: null
                  };
                  newLastBaseUpdate = newLastBaseUpdate.next = _clone;
                }
                newState = getStateFromUpdate(workInProgress2, queue, update, newState, props, instance);
                var callback = update.callback;
                if (callback !== null && // If the update was already committed, we should not queue its
                // callback again.
                update.lane !== NoLane) {
                  workInProgress2.flags |= Callback;
                  var effects = queue.effects;
                  if (effects === null) {
                    queue.effects = [update];
                  } else {
                    effects.push(update);
                  }
                }
              }
              update = update.next;
              if (update === null) {
                pendingQueue = queue.shared.pending;
                if (pendingQueue === null) {
                  break;
                } else {
                  var _lastPendingUpdate = pendingQueue;
                  var _firstPendingUpdate = _lastPendingUpdate.next;
                  _lastPendingUpdate.next = null;
                  update = _firstPendingUpdate;
                  queue.lastBaseUpdate = _lastPendingUpdate;
                  queue.shared.pending = null;
                }
              }
            } while (true);
            if (newLastBaseUpdate === null) {
              newBaseState = newState;
            }
            queue.baseState = newBaseState;
            queue.firstBaseUpdate = newFirstBaseUpdate;
            queue.lastBaseUpdate = newLastBaseUpdate;
            var lastInterleaved = queue.shared.interleaved;
            if (lastInterleaved !== null) {
              var interleaved = lastInterleaved;
              do {
                newLanes = mergeLanes(newLanes, interleaved.lane);
                interleaved = interleaved.next;
              } while (interleaved !== lastInterleaved);
            } else if (firstBaseUpdate === null) {
              queue.shared.lanes = NoLanes;
            }
            markSkippedUpdateLanes(newLanes);
            workInProgress2.lanes = newLanes;
            workInProgress2.memoizedState = newState;
          }
          {
            currentlyProcessingQueue = null;
          }
        }
        function callCallback(callback, context) {
          if (typeof callback !== "function") {
            throw new Error("Invalid argument passed as callback. Expected a function. Instead " + ("received: " + callback));
          }
          callback.call(context);
        }
        function resetHasForceUpdateBeforeProcessing() {
          hasForceUpdate = false;
        }
        function checkHasForceUpdateAfterProcessing() {
          return hasForceUpdate;
        }
        function commitUpdateQueue(finishedWork, finishedQueue, instance) {
          var effects = finishedQueue.effects;
          finishedQueue.effects = null;
          if (effects !== null) {
            for (var i2 = 0; i2 < effects.length; i2++) {
              var effect = effects[i2];
              var callback = effect.callback;
              if (callback !== null) {
                effect.callback = null;
                callCallback(callback, instance);
              }
            }
          }
        }
        var NO_CONTEXT = {};
        var contextStackCursor$1 = createCursor(NO_CONTEXT);
        var contextFiberStackCursor = createCursor(NO_CONTEXT);
        var rootInstanceStackCursor = createCursor(NO_CONTEXT);
        function requiredContext(c2) {
          if (c2 === NO_CONTEXT) {
            throw new Error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue.");
          }
          return c2;
        }
        function getRootHostContainer() {
          var rootInstance = requiredContext(rootInstanceStackCursor.current);
          return rootInstance;
        }
        function pushHostContainer(fiber, nextRootInstance) {
          push(rootInstanceStackCursor, nextRootInstance, fiber);
          push(contextFiberStackCursor, fiber, fiber);
          push(contextStackCursor$1, NO_CONTEXT, fiber);
          var nextRootContext = getRootHostContext(nextRootInstance);
          pop(contextStackCursor$1, fiber);
          push(contextStackCursor$1, nextRootContext, fiber);
        }
        function popHostContainer(fiber) {
          pop(contextStackCursor$1, fiber);
          pop(contextFiberStackCursor, fiber);
          pop(rootInstanceStackCursor, fiber);
        }
        function getHostContext() {
          var context = requiredContext(contextStackCursor$1.current);
          return context;
        }
        function pushHostContext(fiber) {
          var rootInstance = requiredContext(rootInstanceStackCursor.current);
          var context = requiredContext(contextStackCursor$1.current);
          var nextContext = getChildHostContext(context, fiber.type);
          if (context === nextContext) {
            return;
          }
          push(contextFiberStackCursor, fiber, fiber);
          push(contextStackCursor$1, nextContext, fiber);
        }
        function popHostContext(fiber) {
          if (contextFiberStackCursor.current !== fiber) {
            return;
          }
          pop(contextStackCursor$1, fiber);
          pop(contextFiberStackCursor, fiber);
        }
        var DefaultSuspenseContext = 0;
        var SubtreeSuspenseContextMask = 1;
        var InvisibleParentSuspenseContext = 1;
        var ForceSuspenseFallback = 2;
        var suspenseStackCursor = createCursor(DefaultSuspenseContext);
        function hasSuspenseContext(parentContext, flag) {
          return (parentContext & flag) !== 0;
        }
        function setDefaultShallowSuspenseContext(parentContext) {
          return parentContext & SubtreeSuspenseContextMask;
        }
        function setShallowSuspenseContext(parentContext, shallowContext) {
          return parentContext & SubtreeSuspenseContextMask | shallowContext;
        }
        function addSubtreeSuspenseContext(parentContext, subtreeContext) {
          return parentContext | subtreeContext;
        }
        function pushSuspenseContext(fiber, newContext) {
          push(suspenseStackCursor, newContext, fiber);
        }
        function popSuspenseContext(fiber) {
          pop(suspenseStackCursor, fiber);
        }
        function shouldCaptureSuspense(workInProgress2, hasInvisibleParent) {
          var nextState = workInProgress2.memoizedState;
          if (nextState !== null) {
            if (nextState.dehydrated !== null) {
              return true;
            }
            return false;
          }
          var props = workInProgress2.memoizedProps;
          {
            return true;
          }
        }
        function findFirstSuspended(row) {
          var node = row;
          while (node !== null) {
            if (node.tag === SuspenseComponent) {
              var state = node.memoizedState;
              if (state !== null) {
                var dehydrated = state.dehydrated;
                if (dehydrated === null || isSuspenseInstancePending(dehydrated) || isSuspenseInstanceFallback(dehydrated)) {
                  return node;
                }
              }
            } else if (node.tag === SuspenseListComponent && // revealOrder undefined can't be trusted because it don't
            // keep track of whether it suspended or not.
            node.memoizedProps.revealOrder !== void 0) {
              var didSuspend = (node.flags & DidCapture) !== NoFlags;
              if (didSuspend) {
                return node;
              }
            } else if (node.child !== null) {
              node.child.return = node;
              node = node.child;
              continue;
            }
            if (node === row) {
              return null;
            }
            while (node.sibling === null) {
              if (node.return === null || node.return === row) {
                return null;
              }
              node = node.return;
            }
            node.sibling.return = node.return;
            node = node.sibling;
          }
          return null;
        }
        var NoFlags$1 = (
          /*   */
          0
        );
        var HasEffect = (
          /* */
          1
        );
        var Insertion = (
          /*  */
          2
        );
        var Layout = (
          /*    */
          4
        );
        var Passive$1 = (
          /*   */
          8
        );
        var workInProgressSources = [];
        function resetWorkInProgressVersions() {
          for (var i2 = 0; i2 < workInProgressSources.length; i2++) {
            var mutableSource = workInProgressSources[i2];
            {
              mutableSource._workInProgressVersionPrimary = null;
            }
          }
          workInProgressSources.length = 0;
        }
        function registerMutableSourceForHydration(root2, mutableSource) {
          var getVersion = mutableSource._getVersion;
          var version = getVersion(mutableSource._source);
          if (root2.mutableSourceEagerHydrationData == null) {
            root2.mutableSourceEagerHydrationData = [mutableSource, version];
          } else {
            root2.mutableSourceEagerHydrationData.push(mutableSource, version);
          }
        }
        var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig;
        var didWarnAboutMismatchedHooksForComponent;
        var didWarnUncachedGetSnapshot;
        {
          didWarnAboutMismatchedHooksForComponent = /* @__PURE__ */ new Set();
        }
        var renderLanes = NoLanes;
        var currentlyRenderingFiber$1 = null;
        var currentHook = null;
        var workInProgressHook = null;
        var didScheduleRenderPhaseUpdate = false;
        var didScheduleRenderPhaseUpdateDuringThisPass = false;
        var localIdCounter = 0;
        var globalClientIdCounter = 0;
        var RE_RENDER_LIMIT = 25;
        var currentHookNameInDev = null;
        var hookTypesDev = null;
        var hookTypesUpdateIndexDev = -1;
        var ignorePreviousDependencies = false;
        function mountHookTypesDev() {
          {
            var hookName = currentHookNameInDev;
            if (hookTypesDev === null) {
              hookTypesDev = [hookName];
            } else {
              hookTypesDev.push(hookName);
            }
          }
        }
        function updateHookTypesDev() {
          {
            var hookName = currentHookNameInDev;
            if (hookTypesDev !== null) {
              hookTypesUpdateIndexDev++;
              if (hookTypesDev[hookTypesUpdateIndexDev] !== hookName) {
                warnOnHookMismatchInDev(hookName);
              }
            }
          }
        }
        function checkDepsAreArrayDev(deps) {
          {
            if (deps !== void 0 && deps !== null && !isArray(deps)) {
              error("%s received a final argument that is not an array (instead, received `%s`). When specified, the final argument must be an array.", currentHookNameInDev, typeof deps);
            }
          }
        }
        function warnOnHookMismatchInDev(currentHookName) {
          {
            var componentName = getComponentNameFromFiber(currentlyRenderingFiber$1);
            if (!didWarnAboutMismatchedHooksForComponent.has(componentName)) {
              didWarnAboutMismatchedHooksForComponent.add(componentName);
              if (hookTypesDev !== null) {
                var table = "";
                var secondColumnStart = 30;
                for (var i2 = 0; i2 <= hookTypesUpdateIndexDev; i2++) {
                  var oldHookName = hookTypesDev[i2];
                  var newHookName = i2 === hookTypesUpdateIndexDev ? currentHookName : oldHookName;
                  var row = i2 + 1 + ". " + oldHookName;
                  while (row.length < secondColumnStart) {
                    row += " ";
                  }
                  row += newHookName + "\n";
                  table += row;
                }
                error("React has detected a change in the order of Hooks called by %s. This will lead to bugs and errors if not fixed. For more information, read the Rules of Hooks: https://reactjs.org/link/rules-of-hooks\n\n   Previous render            Next render\n   ------------------------------------------------------\n%s   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", componentName, table);
              }
            }
          }
        }
        function throwInvalidHookError() {
          throw new Error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.");
        }
        function areHookInputsEqual(nextDeps, prevDeps) {
          {
            if (ignorePreviousDependencies) {
              return false;
            }
          }
          if (prevDeps === null) {
            {
              error("%s received a final argument during this render, but not during the previous render. Even though the final argument is optional, its type cannot change between renders.", currentHookNameInDev);
            }
            return false;
          }
          {
            if (nextDeps.length !== prevDeps.length) {
              error("The final argument passed to %s changed size between renders. The order and size of this array must remain constant.\n\nPrevious: %s\nIncoming: %s", currentHookNameInDev, "[" + prevDeps.join(", ") + "]", "[" + nextDeps.join(", ") + "]");
            }
          }
          for (var i2 = 0; i2 < prevDeps.length && i2 < nextDeps.length; i2++) {
            if (objectIs(nextDeps[i2], prevDeps[i2])) {
              continue;
            }
            return false;
          }
          return true;
        }
        function renderWithHooks(current2, workInProgress2, Component, props, secondArg, nextRenderLanes) {
          renderLanes = nextRenderLanes;
          currentlyRenderingFiber$1 = workInProgress2;
          {
            hookTypesDev = current2 !== null ? current2._debugHookTypes : null;
            hookTypesUpdateIndexDev = -1;
            ignorePreviousDependencies = current2 !== null && current2.type !== workInProgress2.type;
          }
          workInProgress2.memoizedState = null;
          workInProgress2.updateQueue = null;
          workInProgress2.lanes = NoLanes;
          {
            if (current2 !== null && current2.memoizedState !== null) {
              ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV;
            } else if (hookTypesDev !== null) {
              ReactCurrentDispatcher$1.current = HooksDispatcherOnMountWithHookTypesInDEV;
            } else {
              ReactCurrentDispatcher$1.current = HooksDispatcherOnMountInDEV;
            }
          }
          var children = Component(props, secondArg);
          if (didScheduleRenderPhaseUpdateDuringThisPass) {
            var numberOfReRenders = 0;
            do {
              didScheduleRenderPhaseUpdateDuringThisPass = false;
              localIdCounter = 0;
              if (numberOfReRenders >= RE_RENDER_LIMIT) {
                throw new Error("Too many re-renders. React limits the number of renders to prevent an infinite loop.");
              }
              numberOfReRenders += 1;
              {
                ignorePreviousDependencies = false;
              }
              currentHook = null;
              workInProgressHook = null;
              workInProgress2.updateQueue = null;
              {
                hookTypesUpdateIndexDev = -1;
              }
              ReactCurrentDispatcher$1.current = HooksDispatcherOnRerenderInDEV;
              children = Component(props, secondArg);
            } while (didScheduleRenderPhaseUpdateDuringThisPass);
          }
          ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
          {
            workInProgress2._debugHookTypes = hookTypesDev;
          }
          var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null;
          renderLanes = NoLanes;
          currentlyRenderingFiber$1 = null;
          currentHook = null;
          workInProgressHook = null;
          {
            currentHookNameInDev = null;
            hookTypesDev = null;
            hookTypesUpdateIndexDev = -1;
            if (current2 !== null && (current2.flags & StaticMask) !== (workInProgress2.flags & StaticMask) && // Disable this warning in legacy mode, because legacy Suspense is weird
            // and creates false positives. To make this work in legacy mode, we'd
            // need to mark fibers that commit in an incomplete state, somehow. For
            // now I'll disable the warning that most of the bugs that would trigger
            // it are either exclusive to concurrent mode or exist in both.
            (current2.mode & ConcurrentMode) !== NoMode) {
              error("Internal React error: Expected static flag was missing. Please notify the React team.");
            }
          }
          didScheduleRenderPhaseUpdate = false;
          if (didRenderTooFewHooks) {
            throw new Error("Rendered fewer hooks than expected. This may be caused by an accidental early return statement.");
          }
          return children;
        }
        function checkDidRenderIdHook() {
          var didRenderIdHook = localIdCounter !== 0;
          localIdCounter = 0;
          return didRenderIdHook;
        }
        function bailoutHooks(current2, workInProgress2, lanes) {
          workInProgress2.updateQueue = current2.updateQueue;
          if ((workInProgress2.mode & StrictEffectsMode) !== NoMode) {
            workInProgress2.flags &= ~(MountPassiveDev | MountLayoutDev | Passive | Update);
          } else {
            workInProgress2.flags &= ~(Passive | Update);
          }
          current2.lanes = removeLanes(current2.lanes, lanes);
        }
        function resetHooksAfterThrow() {
          ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
          if (didScheduleRenderPhaseUpdate) {
            var hook = currentlyRenderingFiber$1.memoizedState;
            while (hook !== null) {
              var queue = hook.queue;
              if (queue !== null) {
                queue.pending = null;
              }
              hook = hook.next;
            }
            didScheduleRenderPhaseUpdate = false;
          }
          renderLanes = NoLanes;
          currentlyRenderingFiber$1 = null;
          currentHook = null;
          workInProgressHook = null;
          {
            hookTypesDev = null;
            hookTypesUpdateIndexDev = -1;
            currentHookNameInDev = null;
            isUpdatingOpaqueValueInRenderPhase = false;
          }
          didScheduleRenderPhaseUpdateDuringThisPass = false;
          localIdCounter = 0;
        }
        function mountWorkInProgressHook() {
          var hook = {
            memoizedState: null,
            baseState: null,
            baseQueue: null,
            queue: null,
            next: null
          };
          if (workInProgressHook === null) {
            currentlyRenderingFiber$1.memoizedState = workInProgressHook = hook;
          } else {
            workInProgressHook = workInProgressHook.next = hook;
          }
          return workInProgressHook;
        }
        function updateWorkInProgressHook() {
          var nextCurrentHook;
          if (currentHook === null) {
            var current2 = currentlyRenderingFiber$1.alternate;
            if (current2 !== null) {
              nextCurrentHook = current2.memoizedState;
            } else {
              nextCurrentHook = null;
            }
          } else {
            nextCurrentHook = currentHook.next;
          }
          var nextWorkInProgressHook;
          if (workInProgressHook === null) {
            nextWorkInProgressHook = currentlyRenderingFiber$1.memoizedState;
          } else {
            nextWorkInProgressHook = workInProgressHook.next;
          }
          if (nextWorkInProgressHook !== null) {
            workInProgressHook = nextWorkInProgressHook;
            nextWorkInProgressHook = workInProgressHook.next;
            currentHook = nextCurrentHook;
          } else {
            if (nextCurrentHook === null) {
              throw new Error("Rendered more hooks than during the previous render.");
            }
            currentHook = nextCurrentHook;
            var newHook = {
              memoizedState: currentHook.memoizedState,
              baseState: currentHook.baseState,
              baseQueue: currentHook.baseQueue,
              queue: currentHook.queue,
              next: null
            };
            if (workInProgressHook === null) {
              currentlyRenderingFiber$1.memoizedState = workInProgressHook = newHook;
            } else {
              workInProgressHook = workInProgressHook.next = newHook;
            }
          }
          return workInProgressHook;
        }
        function createFunctionComponentUpdateQueue() {
          return {
            lastEffect: null,
            stores: null
          };
        }
        function basicStateReducer(state, action) {
          return typeof action === "function" ? action(state) : action;
        }
        function mountReducer(reducer, initialArg, init2) {
          var hook = mountWorkInProgressHook();
          var initialState2;
          if (init2 !== void 0) {
            initialState2 = init2(initialArg);
          } else {
            initialState2 = initialArg;
          }
          hook.memoizedState = hook.baseState = initialState2;
          var queue = {
            pending: null,
            interleaved: null,
            lanes: NoLanes,
            dispatch: null,
            lastRenderedReducer: reducer,
            lastRenderedState: initialState2
          };
          hook.queue = queue;
          var dispatch = queue.dispatch = dispatchReducerAction.bind(null, currentlyRenderingFiber$1, queue);
          return [hook.memoizedState, dispatch];
        }
        function updateReducer(reducer, initialArg, init2) {
          var hook = updateWorkInProgressHook();
          var queue = hook.queue;
          if (queue === null) {
            throw new Error("Should have a queue. This is likely a bug in React. Please file an issue.");
          }
          queue.lastRenderedReducer = reducer;
          var current2 = currentHook;
          var baseQueue = current2.baseQueue;
          var pendingQueue = queue.pending;
          if (pendingQueue !== null) {
            if (baseQueue !== null) {
              var baseFirst = baseQueue.next;
              var pendingFirst = pendingQueue.next;
              baseQueue.next = pendingFirst;
              pendingQueue.next = baseFirst;
            }
            {
              if (current2.baseQueue !== baseQueue) {
                error("Internal error: Expected work-in-progress queue to be a clone. This is a bug in React.");
              }
            }
            current2.baseQueue = baseQueue = pendingQueue;
            queue.pending = null;
          }
          if (baseQueue !== null) {
            var first = baseQueue.next;
            var newState = current2.baseState;
            var newBaseState = null;
            var newBaseQueueFirst = null;
            var newBaseQueueLast = null;
            var update = first;
            do {
              var updateLane = update.lane;
              if (!isSubsetOfLanes(renderLanes, updateLane)) {
                var clone2 = {
                  lane: updateLane,
                  action: update.action,
                  hasEagerState: update.hasEagerState,
                  eagerState: update.eagerState,
                  next: null
                };
                if (newBaseQueueLast === null) {
                  newBaseQueueFirst = newBaseQueueLast = clone2;
                  newBaseState = newState;
                } else {
                  newBaseQueueLast = newBaseQueueLast.next = clone2;
                }
                currentlyRenderingFiber$1.lanes = mergeLanes(currentlyRenderingFiber$1.lanes, updateLane);
                markSkippedUpdateLanes(updateLane);
              } else {
                if (newBaseQueueLast !== null) {
                  var _clone = {
                    // This update is going to be committed so we never want uncommit
                    // it. Using NoLane works because 0 is a subset of all bitmasks, so
                    // this will never be skipped by the check above.
                    lane: NoLane,
                    action: update.action,
                    hasEagerState: update.hasEagerState,
                    eagerState: update.eagerState,
                    next: null
                  };
                  newBaseQueueLast = newBaseQueueLast.next = _clone;
                }
                if (update.hasEagerState) {
                  newState = update.eagerState;
                } else {
                  var action = update.action;
                  newState = reducer(newState, action);
                }
              }
              update = update.next;
            } while (update !== null && update !== first);
            if (newBaseQueueLast === null) {
              newBaseState = newState;
            } else {
              newBaseQueueLast.next = newBaseQueueFirst;
            }
            if (!objectIs(newState, hook.memoizedState)) {
              markWorkInProgressReceivedUpdate();
            }
            hook.memoizedState = newState;
            hook.baseState = newBaseState;
            hook.baseQueue = newBaseQueueLast;
            queue.lastRenderedState = newState;
          }
          var lastInterleaved = queue.interleaved;
          if (lastInterleaved !== null) {
            var interleaved = lastInterleaved;
            do {
              var interleavedLane = interleaved.lane;
              currentlyRenderingFiber$1.lanes = mergeLanes(currentlyRenderingFiber$1.lanes, interleavedLane);
              markSkippedUpdateLanes(interleavedLane);
              interleaved = interleaved.next;
            } while (interleaved !== lastInterleaved);
          } else if (baseQueue === null) {
            queue.lanes = NoLanes;
          }
          var dispatch = queue.dispatch;
          return [hook.memoizedState, dispatch];
        }
        function rerenderReducer(reducer, initialArg, init2) {
          var hook = updateWorkInProgressHook();
          var queue = hook.queue;
          if (queue === null) {
            throw new Error("Should have a queue. This is likely a bug in React. Please file an issue.");
          }
          queue.lastRenderedReducer = reducer;
          var dispatch = queue.dispatch;
          var lastRenderPhaseUpdate = queue.pending;
          var newState = hook.memoizedState;
          if (lastRenderPhaseUpdate !== null) {
            queue.pending = null;
            var firstRenderPhaseUpdate = lastRenderPhaseUpdate.next;
            var update = firstRenderPhaseUpdate;
            do {
              var action = update.action;
              newState = reducer(newState, action);
              update = update.next;
            } while (update !== firstRenderPhaseUpdate);
            if (!objectIs(newState, hook.memoizedState)) {
              markWorkInProgressReceivedUpdate();
            }
            hook.memoizedState = newState;
            if (hook.baseQueue === null) {
              hook.baseState = newState;
            }
            queue.lastRenderedState = newState;
          }
          return [newState, dispatch];
        }
        function mountMutableSource(source, getSnapshot, subscribe2) {
          {
            return void 0;
          }
        }
        function updateMutableSource(source, getSnapshot, subscribe2) {
          {
            return void 0;
          }
        }
        function mountSyncExternalStore(subscribe2, getSnapshot, getServerSnapshot) {
          var fiber = currentlyRenderingFiber$1;
          var hook = mountWorkInProgressHook();
          var nextSnapshot;
          var isHydrating2 = getIsHydrating();
          if (isHydrating2) {
            if (getServerSnapshot === void 0) {
              throw new Error("Missing getServerSnapshot, which is required for server-rendered content. Will revert to client rendering.");
            }
            nextSnapshot = getServerSnapshot();
            {
              if (!didWarnUncachedGetSnapshot) {
                if (nextSnapshot !== getServerSnapshot()) {
                  error("The result of getServerSnapshot should be cached to avoid an infinite loop");
                  didWarnUncachedGetSnapshot = true;
                }
              }
            }
          } else {
            nextSnapshot = getSnapshot();
            {
              if (!didWarnUncachedGetSnapshot) {
                var cachedSnapshot = getSnapshot();
                if (!objectIs(nextSnapshot, cachedSnapshot)) {
                  error("The result of getSnapshot should be cached to avoid an infinite loop");
                  didWarnUncachedGetSnapshot = true;
                }
              }
            }
            var root2 = getWorkInProgressRoot();
            if (root2 === null) {
              throw new Error("Expected a work-in-progress root. This is a bug in React. Please file an issue.");
            }
            if (!includesBlockingLane(root2, renderLanes)) {
              pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
            }
          }
          hook.memoizedState = nextSnapshot;
          var inst = {
            value: nextSnapshot,
            getSnapshot
          };
          hook.queue = inst;
          mountEffect(subscribeToStore.bind(null, fiber, inst, subscribe2), [subscribe2]);
          fiber.flags |= Passive;
          pushEffect(HasEffect | Passive$1, updateStoreInstance.bind(null, fiber, inst, nextSnapshot, getSnapshot), void 0, null);
          return nextSnapshot;
        }
        function updateSyncExternalStore(subscribe2, getSnapshot, getServerSnapshot) {
          var fiber = currentlyRenderingFiber$1;
          var hook = updateWorkInProgressHook();
          var nextSnapshot = getSnapshot();
          {
            if (!didWarnUncachedGetSnapshot) {
              var cachedSnapshot = getSnapshot();
              if (!objectIs(nextSnapshot, cachedSnapshot)) {
                error("The result of getSnapshot should be cached to avoid an infinite loop");
                didWarnUncachedGetSnapshot = true;
              }
            }
          }
          var prevSnapshot = hook.memoizedState;
          var snapshotChanged = !objectIs(prevSnapshot, nextSnapshot);
          if (snapshotChanged) {
            hook.memoizedState = nextSnapshot;
            markWorkInProgressReceivedUpdate();
          }
          var inst = hook.queue;
          updateEffect(subscribeToStore.bind(null, fiber, inst, subscribe2), [subscribe2]);
          if (inst.getSnapshot !== getSnapshot || snapshotChanged || // Check if the susbcribe function changed. We can save some memory by
          // checking whether we scheduled a subscription effect above.
          workInProgressHook !== null && workInProgressHook.memoizedState.tag & HasEffect) {
            fiber.flags |= Passive;
            pushEffect(HasEffect | Passive$1, updateStoreInstance.bind(null, fiber, inst, nextSnapshot, getSnapshot), void 0, null);
            var root2 = getWorkInProgressRoot();
            if (root2 === null) {
              throw new Error("Expected a work-in-progress root. This is a bug in React. Please file an issue.");
            }
            if (!includesBlockingLane(root2, renderLanes)) {
              pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
            }
          }
          return nextSnapshot;
        }
        function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) {
          fiber.flags |= StoreConsistency;
          var check = {
            getSnapshot,
            value: renderedSnapshot
          };
          var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue;
          if (componentUpdateQueue === null) {
            componentUpdateQueue = createFunctionComponentUpdateQueue();
            currentlyRenderingFiber$1.updateQueue = componentUpdateQueue;
            componentUpdateQueue.stores = [check];
          } else {
            var stores = componentUpdateQueue.stores;
            if (stores === null) {
              componentUpdateQueue.stores = [check];
            } else {
              stores.push(check);
            }
          }
        }
        function updateStoreInstance(fiber, inst, nextSnapshot, getSnapshot) {
          inst.value = nextSnapshot;
          inst.getSnapshot = getSnapshot;
          if (checkIfSnapshotChanged(inst)) {
            forceStoreRerender(fiber);
          }
        }
        function subscribeToStore(fiber, inst, subscribe2) {
          var handleStoreChange = function() {
            if (checkIfSnapshotChanged(inst)) {
              forceStoreRerender(fiber);
            }
          };
          return subscribe2(handleStoreChange);
        }
        function checkIfSnapshotChanged(inst) {
          var latestGetSnapshot = inst.getSnapshot;
          var prevValue = inst.value;
          try {
            var nextValue = latestGetSnapshot();
            return !objectIs(prevValue, nextValue);
          } catch (error2) {
            return true;
          }
        }
        function forceStoreRerender(fiber) {
          var root2 = enqueueConcurrentRenderForLane(fiber, SyncLane);
          if (root2 !== null) {
            scheduleUpdateOnFiber(root2, fiber, SyncLane, NoTimestamp);
          }
        }
        function mountState(initialState2) {
          var hook = mountWorkInProgressHook();
          if (typeof initialState2 === "function") {
            initialState2 = initialState2();
          }
          hook.memoizedState = hook.baseState = initialState2;
          var queue = {
            pending: null,
            interleaved: null,
            lanes: NoLanes,
            dispatch: null,
            lastRenderedReducer: basicStateReducer,
            lastRenderedState: initialState2
          };
          hook.queue = queue;
          var dispatch = queue.dispatch = dispatchSetState.bind(null, currentlyRenderingFiber$1, queue);
          return [hook.memoizedState, dispatch];
        }
        function updateState(initialState2) {
          return updateReducer(basicStateReducer);
        }
        function rerenderState(initialState2) {
          return rerenderReducer(basicStateReducer);
        }
        function pushEffect(tag, create, destroy, deps) {
          var effect = {
            tag,
            create,
            destroy,
            deps,
            // Circular
            next: null
          };
          var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue;
          if (componentUpdateQueue === null) {
            componentUpdateQueue = createFunctionComponentUpdateQueue();
            currentlyRenderingFiber$1.updateQueue = componentUpdateQueue;
            componentUpdateQueue.lastEffect = effect.next = effect;
          } else {
            var lastEffect = componentUpdateQueue.lastEffect;
            if (lastEffect === null) {
              componentUpdateQueue.lastEffect = effect.next = effect;
            } else {
              var firstEffect = lastEffect.next;
              lastEffect.next = effect;
              effect.next = firstEffect;
              componentUpdateQueue.lastEffect = effect;
            }
          }
          return effect;
        }
        function mountRef(initialValue) {
          var hook = mountWorkInProgressHook();
          {
            var _ref2 = {
              current: initialValue
            };
            hook.memoizedState = _ref2;
            return _ref2;
          }
        }
        function updateRef(initialValue) {
          var hook = updateWorkInProgressHook();
          return hook.memoizedState;
        }
        function mountEffectImpl(fiberFlags, hookFlags, create, deps) {
          var hook = mountWorkInProgressHook();
          var nextDeps = deps === void 0 ? null : deps;
          currentlyRenderingFiber$1.flags |= fiberFlags;
          hook.memoizedState = pushEffect(HasEffect | hookFlags, create, void 0, nextDeps);
        }
        function updateEffectImpl(fiberFlags, hookFlags, create, deps) {
          var hook = updateWorkInProgressHook();
          var nextDeps = deps === void 0 ? null : deps;
          var destroy = void 0;
          if (currentHook !== null) {
            var prevEffect = currentHook.memoizedState;
            destroy = prevEffect.destroy;
            if (nextDeps !== null) {
              var prevDeps = prevEffect.deps;
              if (areHookInputsEqual(nextDeps, prevDeps)) {
                hook.memoizedState = pushEffect(hookFlags, create, destroy, nextDeps);
                return;
              }
            }
          }
          currentlyRenderingFiber$1.flags |= fiberFlags;
          hook.memoizedState = pushEffect(HasEffect | hookFlags, create, destroy, nextDeps);
        }
        function mountEffect(create, deps) {
          if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) {
            return mountEffectImpl(MountPassiveDev | Passive | PassiveStatic, Passive$1, create, deps);
          } else {
            return mountEffectImpl(Passive | PassiveStatic, Passive$1, create, deps);
          }
        }
        function updateEffect(create, deps) {
          return updateEffectImpl(Passive, Passive$1, create, deps);
        }
        function mountInsertionEffect(create, deps) {
          return mountEffectImpl(Update, Insertion, create, deps);
        }
        function updateInsertionEffect(create, deps) {
          return updateEffectImpl(Update, Insertion, create, deps);
        }
        function mountLayoutEffect(create, deps) {
          var fiberFlags = Update;
          {
            fiberFlags |= LayoutStatic;
          }
          if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) {
            fiberFlags |= MountLayoutDev;
          }
          return mountEffectImpl(fiberFlags, Layout, create, deps);
        }
        function updateLayoutEffect(create, deps) {
          return updateEffectImpl(Update, Layout, create, deps);
        }
        function imperativeHandleEffect(create, ref) {
          if (typeof ref === "function") {
            var refCallback = ref;
            var _inst = create();
            refCallback(_inst);
            return function() {
              refCallback(null);
            };
          } else if (ref !== null && ref !== void 0) {
            var refObject = ref;
            {
              if (!refObject.hasOwnProperty("current")) {
                error("Expected useImperativeHandle() first argument to either be a ref callback or React.createRef() object. Instead received: %s.", "an object with keys {" + Object.keys(refObject).join(", ") + "}");
              }
            }
            var _inst2 = create();
            refObject.current = _inst2;
            return function() {
              refObject.current = null;
            };
          }
        }
        function mountImperativeHandle(ref, create, deps) {
          {
            if (typeof create !== "function") {
              error("Expected useImperativeHandle() second argument to be a function that creates a handle. Instead received: %s.", create !== null ? typeof create : "null");
            }
          }
          var effectDeps = deps !== null && deps !== void 0 ? deps.concat([ref]) : null;
          var fiberFlags = Update;
          {
            fiberFlags |= LayoutStatic;
          }
          if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) {
            fiberFlags |= MountLayoutDev;
          }
          return mountEffectImpl(fiberFlags, Layout, imperativeHandleEffect.bind(null, create, ref), effectDeps);
        }
        function updateImperativeHandle(ref, create, deps) {
          {
            if (typeof create !== "function") {
              error("Expected useImperativeHandle() second argument to be a function that creates a handle. Instead received: %s.", create !== null ? typeof create : "null");
            }
          }
          var effectDeps = deps !== null && deps !== void 0 ? deps.concat([ref]) : null;
          return updateEffectImpl(Update, Layout, imperativeHandleEffect.bind(null, create, ref), effectDeps);
        }
        function mountDebugValue(value, formatterFn) {
        }
        var updateDebugValue = mountDebugValue;
        function mountCallback(callback, deps) {
          var hook = mountWorkInProgressHook();
          var nextDeps = deps === void 0 ? null : deps;
          hook.memoizedState = [callback, nextDeps];
          return callback;
        }
        function updateCallback(callback, deps) {
          var hook = updateWorkInProgressHook();
          var nextDeps = deps === void 0 ? null : deps;
          var prevState = hook.memoizedState;
          if (prevState !== null) {
            if (nextDeps !== null) {
              var prevDeps = prevState[1];
              if (areHookInputsEqual(nextDeps, prevDeps)) {
                return prevState[0];
              }
            }
          }
          hook.memoizedState = [callback, nextDeps];
          return callback;
        }
        function mountMemo(nextCreate, deps) {
          var hook = mountWorkInProgressHook();
          var nextDeps = deps === void 0 ? null : deps;
          var nextValue = nextCreate();
          hook.memoizedState = [nextValue, nextDeps];
          return nextValue;
        }
        function updateMemo(nextCreate, deps) {
          var hook = updateWorkInProgressHook();
          var nextDeps = deps === void 0 ? null : deps;
          var prevState = hook.memoizedState;
          if (prevState !== null) {
            if (nextDeps !== null) {
              var prevDeps = prevState[1];
              if (areHookInputsEqual(nextDeps, prevDeps)) {
                return prevState[0];
              }
            }
          }
          var nextValue = nextCreate();
          hook.memoizedState = [nextValue, nextDeps];
          return nextValue;
        }
        function mountDeferredValue(value) {
          var hook = mountWorkInProgressHook();
          hook.memoizedState = value;
          return value;
        }
        function updateDeferredValue(value) {
          var hook = updateWorkInProgressHook();
          var resolvedCurrentHook = currentHook;
          var prevValue = resolvedCurrentHook.memoizedState;
          return updateDeferredValueImpl(hook, prevValue, value);
        }
        function rerenderDeferredValue(value) {
          var hook = updateWorkInProgressHook();
          if (currentHook === null) {
            hook.memoizedState = value;
            return value;
          } else {
            var prevValue = currentHook.memoizedState;
            return updateDeferredValueImpl(hook, prevValue, value);
          }
        }
        function updateDeferredValueImpl(hook, prevValue, value) {
          var shouldDeferValue = !includesOnlyNonUrgentLanes(renderLanes);
          if (shouldDeferValue) {
            if (!objectIs(value, prevValue)) {
              var deferredLane = claimNextTransitionLane();
              currentlyRenderingFiber$1.lanes = mergeLanes(currentlyRenderingFiber$1.lanes, deferredLane);
              markSkippedUpdateLanes(deferredLane);
              hook.baseState = true;
            }
            return prevValue;
          } else {
            if (hook.baseState) {
              hook.baseState = false;
              markWorkInProgressReceivedUpdate();
            }
            hook.memoizedState = value;
            return value;
          }
        }
        function startTransition(setPending, callback, options2) {
          var previousPriority = getCurrentUpdatePriority();
          setCurrentUpdatePriority(higherEventPriority(previousPriority, ContinuousEventPriority));
          setPending(true);
          var prevTransition = ReactCurrentBatchConfig$2.transition;
          ReactCurrentBatchConfig$2.transition = {};
          var currentTransition = ReactCurrentBatchConfig$2.transition;
          {
            ReactCurrentBatchConfig$2.transition._updatedFibers = /* @__PURE__ */ new Set();
          }
          try {
            setPending(false);
            callback();
          } finally {
            setCurrentUpdatePriority(previousPriority);
            ReactCurrentBatchConfig$2.transition = prevTransition;
            {
              if (prevTransition === null && currentTransition._updatedFibers) {
                var updatedFibersCount = currentTransition._updatedFibers.size;
                if (updatedFibersCount > 10) {
                  warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.");
                }
                currentTransition._updatedFibers.clear();
              }
            }
          }
        }
        function mountTransition() {
          var _mountState = mountState(false), isPending = _mountState[0], setPending = _mountState[1];
          var start = startTransition.bind(null, setPending);
          var hook = mountWorkInProgressHook();
          hook.memoizedState = start;
          return [isPending, start];
        }
        function updateTransition() {
          var _updateState = updateState(), isPending = _updateState[0];
          var hook = updateWorkInProgressHook();
          var start = hook.memoizedState;
          return [isPending, start];
        }
        function rerenderTransition() {
          var _rerenderState = rerenderState(), isPending = _rerenderState[0];
          var hook = updateWorkInProgressHook();
          var start = hook.memoizedState;
          return [isPending, start];
        }
        var isUpdatingOpaqueValueInRenderPhase = false;
        function getIsUpdatingOpaqueValueInRenderPhaseInDEV() {
          {
            return isUpdatingOpaqueValueInRenderPhase;
          }
        }
        function mountId() {
          var hook = mountWorkInProgressHook();
          var root2 = getWorkInProgressRoot();
          var identifierPrefix = root2.identifierPrefix;
          var id2;
          if (getIsHydrating()) {
            var treeId = getTreeId();
            id2 = ":" + identifierPrefix + "R" + treeId;
            var localId = localIdCounter++;
            if (localId > 0) {
              id2 += "H" + localId.toString(32);
            }
            id2 += ":";
          } else {
            var globalClientId = globalClientIdCounter++;
            id2 = ":" + identifierPrefix + "r" + globalClientId.toString(32) + ":";
          }
          hook.memoizedState = id2;
          return id2;
        }
        function updateId() {
          var hook = updateWorkInProgressHook();
          var id2 = hook.memoizedState;
          return id2;
        }
        function dispatchReducerAction(fiber, queue, action) {
          {
            if (typeof arguments[3] === "function") {
              error("State updates from the useState() and useReducer() Hooks don't support the second callback argument. To execute a side effect after rendering, declare it in the component body with useEffect().");
            }
          }
          var lane = requestUpdateLane(fiber);
          var update = {
            lane,
            action,
            hasEagerState: false,
            eagerState: null,
            next: null
          };
          if (isRenderPhaseUpdate(fiber)) {
            enqueueRenderPhaseUpdate(queue, update);
          } else {
            var root2 = enqueueConcurrentHookUpdate(fiber, queue, update, lane);
            if (root2 !== null) {
              var eventTime = requestEventTime();
              scheduleUpdateOnFiber(root2, fiber, lane, eventTime);
              entangleTransitionUpdate(root2, queue, lane);
            }
          }
          markUpdateInDevTools(fiber, lane);
        }
        function dispatchSetState(fiber, queue, action) {
          {
            if (typeof arguments[3] === "function") {
              error("State updates from the useState() and useReducer() Hooks don't support the second callback argument. To execute a side effect after rendering, declare it in the component body with useEffect().");
            }
          }
          var lane = requestUpdateLane(fiber);
          var update = {
            lane,
            action,
            hasEagerState: false,
            eagerState: null,
            next: null
          };
          if (isRenderPhaseUpdate(fiber)) {
            enqueueRenderPhaseUpdate(queue, update);
          } else {
            var alternate = fiber.alternate;
            if (fiber.lanes === NoLanes && (alternate === null || alternate.lanes === NoLanes)) {
              var lastRenderedReducer = queue.lastRenderedReducer;
              if (lastRenderedReducer !== null) {
                var prevDispatcher;
                {
                  prevDispatcher = ReactCurrentDispatcher$1.current;
                  ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
                }
                try {
                  var currentState = queue.lastRenderedState;
                  var eagerState = lastRenderedReducer(currentState, action);
                  update.hasEagerState = true;
                  update.eagerState = eagerState;
                  if (objectIs(eagerState, currentState)) {
                    enqueueConcurrentHookUpdateAndEagerlyBailout(fiber, queue, update, lane);
                    return;
                  }
                } catch (error2) {
                } finally {
                  {
                    ReactCurrentDispatcher$1.current = prevDispatcher;
                  }
                }
              }
            }
            var root2 = enqueueConcurrentHookUpdate(fiber, queue, update, lane);
            if (root2 !== null) {
              var eventTime = requestEventTime();
              scheduleUpdateOnFiber(root2, fiber, lane, eventTime);
              entangleTransitionUpdate(root2, queue, lane);
            }
          }
          markUpdateInDevTools(fiber, lane);
        }
        function isRenderPhaseUpdate(fiber) {
          var alternate = fiber.alternate;
          return fiber === currentlyRenderingFiber$1 || alternate !== null && alternate === currentlyRenderingFiber$1;
        }
        function enqueueRenderPhaseUpdate(queue, update) {
          didScheduleRenderPhaseUpdateDuringThisPass = didScheduleRenderPhaseUpdate = true;
          var pending = queue.pending;
          if (pending === null) {
            update.next = update;
          } else {
            update.next = pending.next;
            pending.next = update;
          }
          queue.pending = update;
        }
        function entangleTransitionUpdate(root2, queue, lane) {
          if (isTransitionLane(lane)) {
            var queueLanes = queue.lanes;
            queueLanes = intersectLanes(queueLanes, root2.pendingLanes);
            var newQueueLanes = mergeLanes(queueLanes, lane);
            queue.lanes = newQueueLanes;
            markRootEntangled(root2, newQueueLanes);
          }
        }
        function markUpdateInDevTools(fiber, lane, action) {
          {
            markStateUpdateScheduled(fiber, lane);
          }
        }
        var ContextOnlyDispatcher = {
          readContext,
          useCallback: throwInvalidHookError,
          useContext: throwInvalidHookError,
          useEffect: throwInvalidHookError,
          useImperativeHandle: throwInvalidHookError,
          useInsertionEffect: throwInvalidHookError,
          useLayoutEffect: throwInvalidHookError,
          useMemo: throwInvalidHookError,
          useReducer: throwInvalidHookError,
          useRef: throwInvalidHookError,
          useState: throwInvalidHookError,
          useDebugValue: throwInvalidHookError,
          useDeferredValue: throwInvalidHookError,
          useTransition: throwInvalidHookError,
          useMutableSource: throwInvalidHookError,
          useSyncExternalStore: throwInvalidHookError,
          useId: throwInvalidHookError,
          unstable_isNewReconciler: enableNewReconciler
        };
        var HooksDispatcherOnMountInDEV = null;
        var HooksDispatcherOnMountWithHookTypesInDEV = null;
        var HooksDispatcherOnUpdateInDEV = null;
        var HooksDispatcherOnRerenderInDEV = null;
        var InvalidNestedHooksDispatcherOnMountInDEV = null;
        var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
        var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
        {
          var warnInvalidContextAccess = function() {
            error("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().");
          };
          var warnInvalidHookAccess = function() {
            error("Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. You can only call Hooks at the top level of your React function. For more information, see https://reactjs.org/link/rules-of-hooks");
          };
          HooksDispatcherOnMountInDEV = {
            readContext: function(context) {
              return readContext(context);
            },
            useCallback: function(callback, deps) {
              currentHookNameInDev = "useCallback";
              mountHookTypesDev();
              checkDepsAreArrayDev(deps);
              return mountCallback(callback, deps);
            },
            useContext: function(context) {
              currentHookNameInDev = "useContext";
              mountHookTypesDev();
              return readContext(context);
            },
            useEffect: function(create, deps) {
              currentHookNameInDev = "useEffect";
              mountHookTypesDev();
              checkDepsAreArrayDev(deps);
              return mountEffect(create, deps);
            },
            useImperativeHandle: function(ref, create, deps) {
              currentHookNameInDev = "useImperativeHandle";
              mountHookTypesDev();
              checkDepsAreArrayDev(deps);
              return mountImperativeHandle(ref, create, deps);
            },
            useInsertionEffect: function(create, deps) {
              currentHookNameInDev = "useInsertionEffect";
              mountHookTypesDev();
              checkDepsAreArrayDev(deps);
              return mountInsertionEffect(create, deps);
            },
            useLayoutEffect: function(create, deps) {
              currentHookNameInDev = "useLayoutEffect";
              mountHookTypesDev();
              checkDepsAreArrayDev(deps);
              return mountLayoutEffect(create, deps);
            },
            useMemo: function(create, deps) {
              currentHookNameInDev = "useMemo";
              mountHookTypesDev();
              checkDepsAreArrayDev(deps);
              var prevDispatcher = ReactCurrentDispatcher$1.current;
              ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
              try {
                return mountMemo(create, deps);
              } finally {
                ReactCurrentDispatcher$1.current = prevDispatcher;
              }
            },
            useReducer: function(reducer, initialArg, init2) {
              currentHookNameInDev = "useReducer";
              mountHookTypesDev();
              var prevDispatcher = ReactCurrentDispatcher$1.current;
              ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
              try {
                return mountReducer(reducer, initialArg, init2);
              } finally {
                ReactCurrentDispatcher$1.current = prevDispatcher;
              }
            },
            useRef: function(initialValue) {
              currentHookNameInDev = "useRef";
              mountHookTypesDev();
              return mountRef(initialValue);
            },
            useState: function(initialState2) {
              currentHookNameInDev = "useState";
              mountHookTypesDev();
              var prevDispatcher = ReactCurrentDispatcher$1.current;
              ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
              try {
                return mountState(initialState2);
              } finally {
                ReactCurrentDispatcher$1.current = prevDispatcher;
              }
            },
            useDebugValue: function(value, formatterFn) {
              currentHookNameInDev = "useDebugValue";
              mountHookTypesDev();
              return mountDebugValue();
            },
            useDeferredValue: function(value) {
              currentHookNameInDev = "useDeferredValue";
              mountHookTypesDev();
              return mountDeferredValue(value);
            },
            useTransition: function() {
              currentHookNameInDev = "useTransition";
              mountHookTypesDev();
              return mountTransition();
            },
            useMutableSource: function(source, getSnapshot, subscribe2) {
              currentHookNameInDev = "useMutableSource";
              mountHookTypesDev();
              return mountMutableSource();
            },
            useSyncExternalStore: function(subscribe2, getSnapshot, getServerSnapshot) {
              currentHookNameInDev = "useSyncExternalStore";
              mountHookTypesDev();
              return mountSyncExternalStore(subscribe2, getSnapshot, getServerSnapshot);
            },
            useId: function() {
              currentHookNameInDev = "useId";
              mountHookTypesDev();
              return mountId();
            },
            unstable_isNewReconciler: enableNewReconciler
          };
          HooksDispatcherOnMountWithHookTypesInDEV = {
            readContext: function(context) {
              return readContext(context);
            },
            useCallback: function(callback, deps) {
              currentHookNameInDev = "useCallback";
              updateHookTypesDev();
              return mountCallback(callback, deps);
            },
            useContext: function(context) {
              currentHookNameInDev = "useContext";
              updateHookTypesDev();
              return readContext(context);
            },
            useEffect: function(create, deps) {
              currentHookNameInDev = "useEffect";
              updateHookTypesDev();
              return mountEffect(create, deps);
            },
            useImperativeHandle: function(ref, create, deps) {
              currentHookNameInDev = "useImperativeHandle";
              updateHookTypesDev();
              return mountImperativeHandle(ref, create, deps);
            },
            useInsertionEffect: function(create, deps) {
              currentHookNameInDev = "useInsertionEffect";
              updateHookTypesDev();
              return mountInsertionEffect(create, deps);
            },
            useLayoutEffect: function(create, deps) {
              currentHookNameInDev = "useLayoutEffect";
              updateHookTypesDev();
              return mountLayoutEffect(create, deps);
            },
            useMemo: function(create, deps) {
              currentHookNameInDev = "useMemo";
              updateHookTypesDev();
              var prevDispatcher = ReactCurrentDispatcher$1.current;
              ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
              try {
                return mountMemo(create, deps);
              } finally {
                ReactCurrentDispatcher$1.current = prevDispatcher;
              }
            },
            useReducer: function(reducer, initialArg, init2) {
              currentHookNameInDev = "useReducer";
              updateHookTypesDev();
              var prevDispatcher = ReactCurrentDispatcher$1.current;
              ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
              try {
                return mountReducer(reducer, initialArg, init2);
              } finally {
                ReactCurrentDispatcher$1.current = prevDispatcher;
              }
            },
            useRef: function(initialValue) {
              currentHookNameInDev = "useRef";
              updateHookTypesDev();
              return mountRef(initialValue);
            },
            useState: function(initialState2) {
              currentHookNameInDev = "useState";
              updateHookTypesDev();
              var prevDispatcher = ReactCurrentDispatcher$1.current;
              ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
              try {
                return mountState(initialState2);
              } finally {
                ReactCurrentDispatcher$1.current = prevDispatcher;
              }
            },
            useDebugValue: function(value, formatterFn) {
              currentHookNameInDev = "useDebugValue";
              updateHookTypesDev();
              return mountDebugValue();
            },
            useDeferredValue: function(value) {
              currentHookNameInDev = "useDeferredValue";
              updateHookTypesDev();
              return mountDeferredValue(value);
            },
            useTransition: function() {
              currentHookNameInDev = "useTransition";
              updateHookTypesDev();
              return mountTransition();
            },
            useMutableSource: function(source, getSnapshot, subscribe2) {
              currentHookNameInDev = "useMutableSource";
              updateHookTypesDev();
              return mountMutableSource();
            },
            useSyncExternalStore: function(subscribe2, getSnapshot, getServerSnapshot) {
              currentHookNameInDev = "useSyncExternalStore";
              updateHookTypesDev();
              return mountSyncExternalStore(subscribe2, getSnapshot, getServerSnapshot);
            },
            useId: function() {
              currentHookNameInDev = "useId";
              updateHookTypesDev();
              return mountId();
            },
            unstable_isNewReconciler: enableNewReconciler
          };
          HooksDispatcherOnUpdateInDEV = {
            readContext: function(context) {
              return readContext(context);
            },
            useCallback: function(callback, deps) {
              currentHookNameInDev = "useCallback";
              updateHookTypesDev();
              return updateCallback(callback, deps);
            },
            useContext: function(context) {
              currentHookNameInDev = "useContext";
              updateHookTypesDev();
              return readContext(context);
            },
            useEffect: function(create, deps) {
              currentHookNameInDev = "useEffect";
              updateHookTypesDev();
              return updateEffect(create, deps);
            },
            useImperativeHandle: function(ref, create, deps) {
              currentHookNameInDev = "useImperativeHandle";
              updateHookTypesDev();
              return updateImperativeHandle(ref, create, deps);
            },
            useInsertionEffect: function(create, deps) {
              currentHookNameInDev = "useInsertionEffect";
              updateHookTypesDev();
              return updateInsertionEffect(create, deps);
            },
            useLayoutEffect: function(create, deps) {
              currentHookNameInDev = "useLayoutEffect";
              updateHookTypesDev();
              return updateLayoutEffect(create, deps);
            },
            useMemo: function(create, deps) {
              currentHookNameInDev = "useMemo";
              updateHookTypesDev();
              var prevDispatcher = ReactCurrentDispatcher$1.current;
              ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
              try {
                return updateMemo(create, deps);
              } finally {
                ReactCurrentDispatcher$1.current = prevDispatcher;
              }
            },
            useReducer: function(reducer, initialArg, init2) {
              currentHookNameInDev = "useReducer";
              updateHookTypesDev();
              var prevDispatcher = ReactCurrentDispatcher$1.current;
              ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
              try {
                return updateReducer(reducer, initialArg, init2);
              } finally {
                ReactCurrentDispatcher$1.current = prevDispatcher;
              }
            },
            useRef: function(initialValue) {
              currentHookNameInDev = "useRef";
              updateHookTypesDev();
              return updateRef();
            },
            useState: function(initialState2) {
              currentHookNameInDev = "useState";
              updateHookTypesDev();
              var prevDispatcher = ReactCurrentDispatcher$1.current;
              ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
              try {
                return updateState(initialState2);
              } finally {
                ReactCurrentDispatcher$1.current = prevDispatcher;
              }
            },
            useDebugValue: function(value, formatterFn) {
              currentHookNameInDev = "useDebugValue";
              updateHookTypesDev();
              return updateDebugValue();
            },
            useDeferredValue: function(value) {
              currentHookNameInDev = "useDeferredValue";
              updateHookTypesDev();
              return updateDeferredValue(value);
            },
            useTransition: function() {
              currentHookNameInDev = "useTransition";
              updateHookTypesDev();
              return updateTransition();
            },
            useMutableSource: function(source, getSnapshot, subscribe2) {
              currentHookNameInDev = "useMutableSource";
              updateHookTypesDev();
              return updateMutableSource();
            },
            useSyncExternalStore: function(subscribe2, getSnapshot, getServerSnapshot) {
              currentHookNameInDev = "useSyncExternalStore";
              updateHookTypesDev();
              return updateSyncExternalStore(subscribe2, getSnapshot);
            },
            useId: function() {
              currentHookNameInDev = "useId";
              updateHookTypesDev();
              return updateId();
            },
            unstable_isNewReconciler: enableNewReconciler
          };
          HooksDispatcherOnRerenderInDEV = {
            readContext: function(context) {
              return readContext(context);
            },
            useCallback: function(callback, deps) {
              currentHookNameInDev = "useCallback";
              updateHookTypesDev();
              return updateCallback(callback, deps);
            },
            useContext: function(context) {
              currentHookNameInDev = "useContext";
              updateHookTypesDev();
              return readContext(context);
            },
            useEffect: function(create, deps) {
              currentHookNameInDev = "useEffect";
              updateHookTypesDev();
              return updateEffect(create, deps);
            },
            useImperativeHandle: function(ref, create, deps) {
              currentHookNameInDev = "useImperativeHandle";
              updateHookTypesDev();
              return updateImperativeHandle(ref, create, deps);
            },
            useInsertionEffect: function(create, deps) {
              currentHookNameInDev = "useInsertionEffect";
              updateHookTypesDev();
              return updateInsertionEffect(create, deps);
            },
            useLayoutEffect: function(create, deps) {
              currentHookNameInDev = "useLayoutEffect";
              updateHookTypesDev();
              return updateLayoutEffect(create, deps);
            },
            useMemo: function(create, deps) {
              currentHookNameInDev = "useMemo";
              updateHookTypesDev();
              var prevDispatcher = ReactCurrentDispatcher$1.current;
              ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnRerenderInDEV;
              try {
                return updateMemo(create, deps);
              } finally {
                ReactCurrentDispatcher$1.current = prevDispatcher;
              }
            },
            useReducer: function(reducer, initialArg, init2) {
              currentHookNameInDev = "useReducer";
              updateHookTypesDev();
              var prevDispatcher = ReactCurrentDispatcher$1.current;
              ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnRerenderInDEV;
              try {
                return rerenderReducer(reducer, initialArg, init2);
              } finally {
                ReactCurrentDispatcher$1.current = prevDispatcher;
              }
            },
            useRef: function(initialValue) {
              currentHookNameInDev = "useRef";
              updateHookTypesDev();
              return updateRef();
            },
            useState: function(initialState2) {
              currentHookNameInDev = "useState";
              updateHookTypesDev();
              var prevDispatcher = ReactCurrentDispatcher$1.current;
              ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnRerenderInDEV;
              try {
                return rerenderState(initialState2);
              } finally {
                ReactCurrentDispatcher$1.current = prevDispatcher;
              }
            },
            useDebugValue: function(value, formatterFn) {
              currentHookNameInDev = "useDebugValue";
              updateHookTypesDev();
              return updateDebugValue();
            },
            useDeferredValue: function(value) {
              currentHookNameInDev = "useDeferredValue";
              updateHookTypesDev();
              return rerenderDeferredValue(value);
            },
            useTransition: function() {
              currentHookNameInDev = "useTransition";
              updateHookTypesDev();
              return rerenderTransition();
            },
            useMutableSource: function(source, getSnapshot, subscribe2) {
              currentHookNameInDev = "useMutableSource";
              updateHookTypesDev();
              return updateMutableSource();
            },
            useSyncExternalStore: function(subscribe2, getSnapshot, getServerSnapshot) {
              currentHookNameInDev = "useSyncExternalStore";
              updateHookTypesDev();
              return updateSyncExternalStore(subscribe2, getSnapshot);
            },
            useId: function() {
              currentHookNameInDev = "useId";
              updateHookTypesDev();
              return updateId();
            },
            unstable_isNewReconciler: enableNewReconciler
          };
          InvalidNestedHooksDispatcherOnMountInDEV = {
            readContext: function(context) {
              warnInvalidContextAccess();
              return readContext(context);
            },
            useCallback: function(callback, deps) {
              currentHookNameInDev = "useCallback";
              warnInvalidHookAccess();
              mountHookTypesDev();
              return mountCallback(callback, deps);
            },
            useContext: function(context) {
              currentHookNameInDev = "useContext";
              warnInvalidHookAccess();
              mountHookTypesDev();
              return readContext(context);
            },
            useEffect: function(create, deps) {
              currentHookNameInDev = "useEffect";
              warnInvalidHookAccess();
              mountHookTypesDev();
              return mountEffect(create, deps);
            },
            useImperativeHandle: function(ref, create, deps) {
              currentHookNameInDev = "useImperativeHandle";
              warnInvalidHookAccess();
              mountHookTypesDev();
              return mountImperativeHandle(ref, create, deps);
            },
            useInsertionEffect: function(create, deps) {
              currentHookNameInDev = "useInsertionEffect";
              warnInvalidHookAccess();
              mountHookTypesDev();
              return mountInsertionEffect(create, deps);
            },
            useLayoutEffect: function(create, deps) {
              currentHookNameInDev = "useLayoutEffect";
              warnInvalidHookAccess();
              mountHookTypesDev();
              return mountLayoutEffect(create, deps);
            },
            useMemo: function(create, deps) {
              currentHookNameInDev = "useMemo";
              warnInvalidHookAccess();
              mountHookTypesDev();
              var prevDispatcher = ReactCurrentDispatcher$1.current;
              ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
              try {
                return mountMemo(create, deps);
              } finally {
                ReactCurrentDispatcher$1.current = prevDispatcher;
              }
            },
            useReducer: function(reducer, initialArg, init2) {
              currentHookNameInDev = "useReducer";
              warnInvalidHookAccess();
              mountHookTypesDev();
              var prevDispatcher = ReactCurrentDispatcher$1.current;
              ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
              try {
                return mountReducer(reducer, initialArg, init2);
              } finally {
                ReactCurrentDispatcher$1.current = prevDispatcher;
              }
            },
            useRef: function(initialValue) {
              currentHookNameInDev = "useRef";
              warnInvalidHookAccess();
              mountHookTypesDev();
              return mountRef(initialValue);
            },
            useState: function(initialState2) {
              currentHookNameInDev = "useState";
              warnInvalidHookAccess();
              mountHookTypesDev();
              var prevDispatcher = ReactCurrentDispatcher$1.current;
              ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
              try {
                return mountState(initialState2);
              } finally {
                ReactCurrentDispatcher$1.current = prevDispatcher;
              }
            },
            useDebugValue: function(value, formatterFn) {
              currentHookNameInDev = "useDebugValue";
              warnInvalidHookAccess();
              mountHookTypesDev();
              return mountDebugValue();
            },
            useDeferredValue: function(value) {
              currentHookNameInDev = "useDeferredValue";
              warnInvalidHookAccess();
              mountHookTypesDev();
              return mountDeferredValue(value);
            },
            useTransition: function() {
              currentHookNameInDev = "useTransition";
              warnInvalidHookAccess();
              mountHookTypesDev();
              return mountTransition();
            },
            useMutableSource: function(source, getSnapshot, subscribe2) {
              currentHookNameInDev = "useMutableSource";
              warnInvalidHookAccess();
              mountHookTypesDev();
              return mountMutableSource();
            },
            useSyncExternalStore: function(subscribe2, getSnapshot, getServerSnapshot) {
              currentHookNameInDev = "useSyncExternalStore";
              warnInvalidHookAccess();
              mountHookTypesDev();
              return mountSyncExternalStore(subscribe2, getSnapshot, getServerSnapshot);
            },
            useId: function() {
              currentHookNameInDev = "useId";
              warnInvalidHookAccess();
              mountHookTypesDev();
              return mountId();
            },
            unstable_isNewReconciler: enableNewReconciler
          };
          InvalidNestedHooksDispatcherOnUpdateInDEV = {
            readContext: function(context) {
              warnInvalidContextAccess();
              return readContext(context);
            },
            useCallback: function(callback, deps) {
              currentHookNameInDev = "useCallback";
              warnInvalidHookAccess();
              updateHookTypesDev();
              return updateCallback(callback, deps);
            },
            useContext: function(context) {
              currentHookNameInDev = "useContext";
              warnInvalidHookAccess();
              updateHookTypesDev();
              return readContext(context);
            },
            useEffect: function(create, deps) {
              currentHookNameInDev = "useEffect";
              warnInvalidHookAccess();
              updateHookTypesDev();
              return updateEffect(create, deps);
            },
            useImperativeHandle: function(ref, create, deps) {
              currentHookNameInDev = "useImperativeHandle";
              warnInvalidHookAccess();
              updateHookTypesDev();
              return updateImperativeHandle(ref, create, deps);
            },
            useInsertionEffect: function(create, deps) {
              currentHookNameInDev = "useInsertionEffect";
              warnInvalidHookAccess();
              updateHookTypesDev();
              return updateInsertionEffect(create, deps);
            },
            useLayoutEffect: function(create, deps) {
              currentHookNameInDev = "useLayoutEffect";
              warnInvalidHookAccess();
              updateHookTypesDev();
              return updateLayoutEffect(create, deps);
            },
            useMemo: function(create, deps) {
              currentHookNameInDev = "useMemo";
              warnInvalidHookAccess();
              updateHookTypesDev();
              var prevDispatcher = ReactCurrentDispatcher$1.current;
              ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
              try {
                return updateMemo(create, deps);
              } finally {
                ReactCurrentDispatcher$1.current = prevDispatcher;
              }
            },
            useReducer: function(reducer, initialArg, init2) {
              currentHookNameInDev = "useReducer";
              warnInvalidHookAccess();
              updateHookTypesDev();
              var prevDispatcher = ReactCurrentDispatcher$1.current;
              ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
              try {
                return updateReducer(reducer, initialArg, init2);
              } finally {
                ReactCurrentDispatcher$1.current = prevDispatcher;
              }
            },
            useRef: function(initialValue) {
              currentHookNameInDev = "useRef";
              warnInvalidHookAccess();
              updateHookTypesDev();
              return updateRef();
            },
            useState: function(initialState2) {
              currentHookNameInDev = "useState";
              warnInvalidHookAccess();
              updateHookTypesDev();
              var prevDispatcher = ReactCurrentDispatcher$1.current;
              ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
              try {
                return updateState(initialState2);
              } finally {
                ReactCurrentDispatcher$1.current = prevDispatcher;
              }
            },
            useDebugValue: function(value, formatterFn) {
              currentHookNameInDev = "useDebugValue";
              warnInvalidHookAccess();
              updateHookTypesDev();
              return updateDebugValue();
            },
            useDeferredValue: function(value) {
              currentHookNameInDev = "useDeferredValue";
              warnInvalidHookAccess();
              updateHookTypesDev();
              return updateDeferredValue(value);
            },
            useTransition: function() {
              currentHookNameInDev = "useTransition";
              warnInvalidHookAccess();
              updateHookTypesDev();
              return updateTransition();
            },
            useMutableSource: function(source, getSnapshot, subscribe2) {
              currentHookNameInDev = "useMutableSource";
              warnInvalidHookAccess();
              updateHookTypesDev();
              return updateMutableSource();
            },
            useSyncExternalStore: function(subscribe2, getSnapshot, getServerSnapshot) {
              currentHookNameInDev = "useSyncExternalStore";
              warnInvalidHookAccess();
              updateHookTypesDev();
              return updateSyncExternalStore(subscribe2, getSnapshot);
            },
            useId: function() {
              currentHookNameInDev = "useId";
              warnInvalidHookAccess();
              updateHookTypesDev();
              return updateId();
            },
            unstable_isNewReconciler: enableNewReconciler
          };
          InvalidNestedHooksDispatcherOnRerenderInDEV = {
            readContext: function(context) {
              warnInvalidContextAccess();
              return readContext(context);
            },
            useCallback: function(callback, deps) {
              currentHookNameInDev = "useCallback";
              warnInvalidHookAccess();
              updateHookTypesDev();
              return updateCallback(callback, deps);
            },
            useContext: function(context) {
              currentHookNameInDev = "useContext";
              warnInvalidHookAccess();
              updateHookTypesDev();
              return readContext(context);
            },
            useEffect: function(create, deps) {
              currentHookNameInDev = "useEffect";
              warnInvalidHookAccess();
              updateHookTypesDev();
              return updateEffect(create, deps);
            },
            useImperativeHandle: function(ref, create, deps) {
              currentHookNameInDev = "useImperativeHandle";
              warnInvalidHookAccess();
              updateHookTypesDev();
              return updateImperativeHandle(ref, create, deps);
            },
            useInsertionEffect: function(create, deps) {
              currentHookNameInDev = "useInsertionEffect";
              warnInvalidHookAccess();
              updateHookTypesDev();
              return updateInsertionEffect(create, deps);
            },
            useLayoutEffect: function(create, deps) {
              currentHookNameInDev = "useLayoutEffect";
              warnInvalidHookAccess();
              updateHookTypesDev();
              return updateLayoutEffect(create, deps);
            },
            useMemo: function(create, deps) {
              currentHookNameInDev = "useMemo";
              warnInvalidHookAccess();
              updateHookTypesDev();
              var prevDispatcher = ReactCurrentDispatcher$1.current;
              ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
              try {
                return updateMemo(create, deps);
              } finally {
                ReactCurrentDispatcher$1.current = prevDispatcher;
              }
            },
            useReducer: function(reducer, initialArg, init2) {
              currentHookNameInDev = "useReducer";
              warnInvalidHookAccess();
              updateHookTypesDev();
              var prevDispatcher = ReactCurrentDispatcher$1.current;
              ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
              try {
                return rerenderReducer(reducer, initialArg, init2);
              } finally {
                ReactCurrentDispatcher$1.current = prevDispatcher;
              }
            },
            useRef: function(initialValue) {
              currentHookNameInDev = "useRef";
              warnInvalidHookAccess();
              updateHookTypesDev();
              return updateRef();
            },
            useState: function(initialState2) {
              currentHookNameInDev = "useState";
              warnInvalidHookAccess();
              updateHookTypesDev();
              var prevDispatcher = ReactCurrentDispatcher$1.current;
              ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
              try {
                return rerenderState(initialState2);
              } finally {
                ReactCurrentDispatcher$1.current = prevDispatcher;
              }
            },
            useDebugValue: function(value, formatterFn) {
              currentHookNameInDev = "useDebugValue";
              warnInvalidHookAccess();
              updateHookTypesDev();
              return updateDebugValue();
            },
            useDeferredValue: function(value) {
              currentHookNameInDev = "useDeferredValue";
              warnInvalidHookAccess();
              updateHookTypesDev();
              return rerenderDeferredValue(value);
            },
            useTransition: function() {
              currentHookNameInDev = "useTransition";
              warnInvalidHookAccess();
              updateHookTypesDev();
              return rerenderTransition();
            },
            useMutableSource: function(source, getSnapshot, subscribe2) {
              currentHookNameInDev = "useMutableSource";
              warnInvalidHookAccess();
              updateHookTypesDev();
              return updateMutableSource();
            },
            useSyncExternalStore: function(subscribe2, getSnapshot, getServerSnapshot) {
              currentHookNameInDev = "useSyncExternalStore";
              warnInvalidHookAccess();
              updateHookTypesDev();
              return updateSyncExternalStore(subscribe2, getSnapshot);
            },
            useId: function() {
              currentHookNameInDev = "useId";
              warnInvalidHookAccess();
              updateHookTypesDev();
              return updateId();
            },
            unstable_isNewReconciler: enableNewReconciler
          };
        }
        var now$1 = Scheduler.unstable_now;
        var commitTime = 0;
        var layoutEffectStartTime = -1;
        var profilerStartTime = -1;
        var passiveEffectStartTime = -1;
        var currentUpdateIsNested = false;
        var nestedUpdateScheduled = false;
        function isCurrentUpdateNested() {
          return currentUpdateIsNested;
        }
        function markNestedUpdateScheduled() {
          {
            nestedUpdateScheduled = true;
          }
        }
        function resetNestedUpdateFlag() {
          {
            currentUpdateIsNested = false;
            nestedUpdateScheduled = false;
          }
        }
        function syncNestedUpdateFlag() {
          {
            currentUpdateIsNested = nestedUpdateScheduled;
            nestedUpdateScheduled = false;
          }
        }
        function getCommitTime() {
          return commitTime;
        }
        function recordCommitTime() {
          commitTime = now$1();
        }
        function startProfilerTimer(fiber) {
          profilerStartTime = now$1();
          if (fiber.actualStartTime < 0) {
            fiber.actualStartTime = now$1();
          }
        }
        function stopProfilerTimerIfRunning(fiber) {
          profilerStartTime = -1;
        }
        function stopProfilerTimerIfRunningAndRecordDelta(fiber, overrideBaseTime) {
          if (profilerStartTime >= 0) {
            var elapsedTime = now$1() - profilerStartTime;
            fiber.actualDuration += elapsedTime;
            if (overrideBaseTime) {
              fiber.selfBaseDuration = elapsedTime;
            }
            profilerStartTime = -1;
          }
        }
        function recordLayoutEffectDuration(fiber) {
          if (layoutEffectStartTime >= 0) {
            var elapsedTime = now$1() - layoutEffectStartTime;
            layoutEffectStartTime = -1;
            var parentFiber = fiber.return;
            while (parentFiber !== null) {
              switch (parentFiber.tag) {
                case HostRoot:
                  var root2 = parentFiber.stateNode;
                  root2.effectDuration += elapsedTime;
                  return;
                case Profiler:
                  var parentStateNode = parentFiber.stateNode;
                  parentStateNode.effectDuration += elapsedTime;
                  return;
              }
              parentFiber = parentFiber.return;
            }
          }
        }
        function recordPassiveEffectDuration(fiber) {
          if (passiveEffectStartTime >= 0) {
            var elapsedTime = now$1() - passiveEffectStartTime;
            passiveEffectStartTime = -1;
            var parentFiber = fiber.return;
            while (parentFiber !== null) {
              switch (parentFiber.tag) {
                case HostRoot:
                  var root2 = parentFiber.stateNode;
                  if (root2 !== null) {
                    root2.passiveEffectDuration += elapsedTime;
                  }
                  return;
                case Profiler:
                  var parentStateNode = parentFiber.stateNode;
                  if (parentStateNode !== null) {
                    parentStateNode.passiveEffectDuration += elapsedTime;
                  }
                  return;
              }
              parentFiber = parentFiber.return;
            }
          }
        }
        function startLayoutEffectTimer() {
          layoutEffectStartTime = now$1();
        }
        function startPassiveEffectTimer() {
          passiveEffectStartTime = now$1();
        }
        function transferActualDuration(fiber) {
          var child = fiber.child;
          while (child) {
            fiber.actualDuration += child.actualDuration;
            child = child.sibling;
          }
        }
        function resolveDefaultProps(Component, baseProps) {
          if (Component && Component.defaultProps) {
            var props = assign({}, baseProps);
            var defaultProps = Component.defaultProps;
            for (var propName in defaultProps) {
              if (props[propName] === void 0) {
                props[propName] = defaultProps[propName];
              }
            }
            return props;
          }
          return baseProps;
        }
        var fakeInternalInstance = {};
        var didWarnAboutStateAssignmentForComponent;
        var didWarnAboutUninitializedState;
        var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate;
        var didWarnAboutLegacyLifecyclesAndDerivedState;
        var didWarnAboutUndefinedDerivedState;
        var warnOnUndefinedDerivedState;
        var warnOnInvalidCallback;
        var didWarnAboutDirectlyAssigningPropsToState;
        var didWarnAboutContextTypeAndContextTypes;
        var didWarnAboutInvalidateContextType;
        var didWarnAboutLegacyContext$1;
        {
          didWarnAboutStateAssignmentForComponent = /* @__PURE__ */ new Set();
          didWarnAboutUninitializedState = /* @__PURE__ */ new Set();
          didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = /* @__PURE__ */ new Set();
          didWarnAboutLegacyLifecyclesAndDerivedState = /* @__PURE__ */ new Set();
          didWarnAboutDirectlyAssigningPropsToState = /* @__PURE__ */ new Set();
          didWarnAboutUndefinedDerivedState = /* @__PURE__ */ new Set();
          didWarnAboutContextTypeAndContextTypes = /* @__PURE__ */ new Set();
          didWarnAboutInvalidateContextType = /* @__PURE__ */ new Set();
          didWarnAboutLegacyContext$1 = /* @__PURE__ */ new Set();
          var didWarnOnInvalidCallback = /* @__PURE__ */ new Set();
          warnOnInvalidCallback = function(callback, callerName) {
            if (callback === null || typeof callback === "function") {
              return;
            }
            var key = callerName + "_" + callback;
            if (!didWarnOnInvalidCallback.has(key)) {
              didWarnOnInvalidCallback.add(key);
              error("%s(...): Expected the last optional `callback` argument to be a function. Instead received: %s.", callerName, callback);
            }
          };
          warnOnUndefinedDerivedState = function(type, partialState) {
            if (partialState === void 0) {
              var componentName = getComponentNameFromType(type) || "Component";
              if (!didWarnAboutUndefinedDerivedState.has(componentName)) {
                didWarnAboutUndefinedDerivedState.add(componentName);
                error("%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. You have returned undefined.", componentName);
              }
            }
          };
          Object.defineProperty(fakeInternalInstance, "_processChildContext", {
            enumerable: false,
            value: function() {
              throw new Error("_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn't supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal).");
            }
          });
          Object.freeze(fakeInternalInstance);
        }
        function applyDerivedStateFromProps(workInProgress2, ctor, getDerivedStateFromProps, nextProps) {
          var prevState = workInProgress2.memoizedState;
          var partialState = getDerivedStateFromProps(nextProps, prevState);
          {
            if (workInProgress2.mode & StrictLegacyMode) {
              setIsStrictModeForDevtools(true);
              try {
                partialState = getDerivedStateFromProps(nextProps, prevState);
              } finally {
                setIsStrictModeForDevtools(false);
              }
            }
            warnOnUndefinedDerivedState(ctor, partialState);
          }
          var memoizedState = partialState === null || partialState === void 0 ? prevState : assign({}, prevState, partialState);
          workInProgress2.memoizedState = memoizedState;
          if (workInProgress2.lanes === NoLanes) {
            var updateQueue = workInProgress2.updateQueue;
            updateQueue.baseState = memoizedState;
          }
        }
        var classComponentUpdater = {
          isMounted,
          enqueueSetState: function(inst, payload, callback) {
            var fiber = get(inst);
            var eventTime = requestEventTime();
            var lane = requestUpdateLane(fiber);
            var update = createUpdate(eventTime, lane);
            update.payload = payload;
            if (callback !== void 0 && callback !== null) {
              {
                warnOnInvalidCallback(callback, "setState");
              }
              update.callback = callback;
            }
            var root2 = enqueueUpdate(fiber, update, lane);
            if (root2 !== null) {
              scheduleUpdateOnFiber(root2, fiber, lane, eventTime);
              entangleTransitions(root2, fiber, lane);
            }
            {
              markStateUpdateScheduled(fiber, lane);
            }
          },
          enqueueReplaceState: function(inst, payload, callback) {
            var fiber = get(inst);
            var eventTime = requestEventTime();
            var lane = requestUpdateLane(fiber);
            var update = createUpdate(eventTime, lane);
            update.tag = ReplaceState;
            update.payload = payload;
            if (callback !== void 0 && callback !== null) {
              {
                warnOnInvalidCallback(callback, "replaceState");
              }
              update.callback = callback;
            }
            var root2 = enqueueUpdate(fiber, update, lane);
            if (root2 !== null) {
              scheduleUpdateOnFiber(root2, fiber, lane, eventTime);
              entangleTransitions(root2, fiber, lane);
            }
            {
              markStateUpdateScheduled(fiber, lane);
            }
          },
          enqueueForceUpdate: function(inst, callback) {
            var fiber = get(inst);
            var eventTime = requestEventTime();
            var lane = requestUpdateLane(fiber);
            var update = createUpdate(eventTime, lane);
            update.tag = ForceUpdate;
            if (callback !== void 0 && callback !== null) {
              {
                warnOnInvalidCallback(callback, "forceUpdate");
              }
              update.callback = callback;
            }
            var root2 = enqueueUpdate(fiber, update, lane);
            if (root2 !== null) {
              scheduleUpdateOnFiber(root2, fiber, lane, eventTime);
              entangleTransitions(root2, fiber, lane);
            }
            {
              markForceUpdateScheduled(fiber, lane);
            }
          }
        };
        function checkShouldComponentUpdate(workInProgress2, ctor, oldProps, newProps, oldState, newState, nextContext) {
          var instance = workInProgress2.stateNode;
          if (typeof instance.shouldComponentUpdate === "function") {
            var shouldUpdate = instance.shouldComponentUpdate(newProps, newState, nextContext);
            {
              if (workInProgress2.mode & StrictLegacyMode) {
                setIsStrictModeForDevtools(true);
                try {
                  shouldUpdate = instance.shouldComponentUpdate(newProps, newState, nextContext);
                } finally {
                  setIsStrictModeForDevtools(false);
                }
              }
              if (shouldUpdate === void 0) {
                error("%s.shouldComponentUpdate(): Returned undefined instead of a boolean value. Make sure to return true or false.", getComponentNameFromType(ctor) || "Component");
              }
            }
            return shouldUpdate;
          }
          if (ctor.prototype && ctor.prototype.isPureReactComponent) {
            return !shallowEqual2(oldProps, newProps) || !shallowEqual2(oldState, newState);
          }
          return true;
        }
        function checkClassInstance(workInProgress2, ctor, newProps) {
          var instance = workInProgress2.stateNode;
          {
            var name = getComponentNameFromType(ctor) || "Component";
            var renderPresent = instance.render;
            if (!renderPresent) {
              if (ctor.prototype && typeof ctor.prototype.render === "function") {
                error("%s(...): No `render` method found on the returned component instance: did you accidentally return an object from the constructor?", name);
              } else {
                error("%s(...): No `render` method found on the returned component instance: you may have forgotten to define `render`.", name);
              }
            }
            if (instance.getInitialState && !instance.getInitialState.isReactClassApproved && !instance.state) {
              error("getInitialState was defined on %s, a plain JavaScript class. This is only supported for classes created using React.createClass. Did you mean to define a state property instead?", name);
            }
            if (instance.getDefaultProps && !instance.getDefaultProps.isReactClassApproved) {
              error("getDefaultProps was defined on %s, a plain JavaScript class. This is only supported for classes created using React.createClass. Use a static property to define defaultProps instead.", name);
            }
            if (instance.propTypes) {
              error("propTypes was defined as an instance property on %s. Use a static property to define propTypes instead.", name);
            }
            if (instance.contextType) {
              error("contextType was defined as an instance property on %s. Use a static property to define contextType instead.", name);
            }
            {
              if (ctor.childContextTypes && !didWarnAboutLegacyContext$1.has(ctor) && // Strict Mode has its own warning for legacy context, so we can skip
              // this one.
              (workInProgress2.mode & StrictLegacyMode) === NoMode) {
                didWarnAboutLegacyContext$1.add(ctor);
                error("%s uses the legacy childContextTypes API which is no longer supported and will be removed in the next major release. Use React.createContext() instead\n\n.Learn more about this warning here: https://reactjs.org/link/legacy-context", name);
              }
              if (ctor.contextTypes && !didWarnAboutLegacyContext$1.has(ctor) && // Strict Mode has its own warning for legacy context, so we can skip
              // this one.
              (workInProgress2.mode & StrictLegacyMode) === NoMode) {
                didWarnAboutLegacyContext$1.add(ctor);
                error("%s uses the legacy contextTypes API which is no longer supported and will be removed in the next major release. Use React.createContext() with static contextType instead.\n\nLearn more about this warning here: https://reactjs.org/link/legacy-context", name);
              }
              if (instance.contextTypes) {
                error("contextTypes was defined as an instance property on %s. Use a static property to define contextTypes instead.", name);
              }
              if (ctor.contextType && ctor.contextTypes && !didWarnAboutContextTypeAndContextTypes.has(ctor)) {
                didWarnAboutContextTypeAndContextTypes.add(ctor);
                error("%s declares both contextTypes and contextType static properties. The legacy contextTypes property will be ignored.", name);
              }
            }
            if (typeof instance.componentShouldUpdate === "function") {
              error("%s has a method called componentShouldUpdate(). Did you mean shouldComponentUpdate()? The name is phrased as a question because the function is expected to return a value.", name);
            }
            if (ctor.prototype && ctor.prototype.isPureReactComponent && typeof instance.shouldComponentUpdate !== "undefined") {
              error("%s has a method called shouldComponentUpdate(). shouldComponentUpdate should not be used when extending React.PureComponent. Please extend React.Component if shouldComponentUpdate is used.", getComponentNameFromType(ctor) || "A pure component");
            }
            if (typeof instance.componentDidUnmount === "function") {
              error("%s has a method called componentDidUnmount(). But there is no such lifecycle method. Did you mean componentWillUnmount()?", name);
            }
            if (typeof instance.componentDidReceiveProps === "function") {
              error("%s has a method called componentDidReceiveProps(). But there is no such lifecycle method. If you meant to update the state in response to changing props, use componentWillReceiveProps(). If you meant to fetch data or run side-effects or mutations after React has updated the UI, use componentDidUpdate().", name);
            }
            if (typeof instance.componentWillRecieveProps === "function") {
              error("%s has a method called componentWillRecieveProps(). Did you mean componentWillReceiveProps()?", name);
            }
            if (typeof instance.UNSAFE_componentWillRecieveProps === "function") {
              error("%s has a method called UNSAFE_componentWillRecieveProps(). Did you mean UNSAFE_componentWillReceiveProps()?", name);
            }
            var hasMutatedProps = instance.props !== newProps;
            if (instance.props !== void 0 && hasMutatedProps) {
              error("%s(...): When calling super() in `%s`, make sure to pass up the same props that your component's constructor was passed.", name, name);
            }
            if (instance.defaultProps) {
              error("Setting defaultProps as an instance property on %s is not supported and will be ignored. Instead, define defaultProps as a static property on %s.", name, name);
            }
            if (typeof instance.getSnapshotBeforeUpdate === "function" && typeof instance.componentDidUpdate !== "function" && !didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.has(ctor)) {
              didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.add(ctor);
              error("%s: getSnapshotBeforeUpdate() should be used with componentDidUpdate(). This component defines getSnapshotBeforeUpdate() only.", getComponentNameFromType(ctor));
            }
            if (typeof instance.getDerivedStateFromProps === "function") {
              error("%s: getDerivedStateFromProps() is defined as an instance method and will be ignored. Instead, declare it as a static method.", name);
            }
            if (typeof instance.getDerivedStateFromError === "function") {
              error("%s: getDerivedStateFromError() is defined as an instance method and will be ignored. Instead, declare it as a static method.", name);
            }
            if (typeof ctor.getSnapshotBeforeUpdate === "function") {
              error("%s: getSnapshotBeforeUpdate() is defined as a static method and will be ignored. Instead, declare it as an instance method.", name);
            }
            var _state = instance.state;
            if (_state && (typeof _state !== "object" || isArray(_state))) {
              error("%s.state: must be set to an object or null", name);
            }
            if (typeof instance.getChildContext === "function" && typeof ctor.childContextTypes !== "object") {
              error("%s.getChildContext(): childContextTypes must be defined in order to use getChildContext().", name);
            }
          }
        }
        function adoptClassInstance(workInProgress2, instance) {
          instance.updater = classComponentUpdater;
          workInProgress2.stateNode = instance;
          set(instance, workInProgress2);
          {
            instance._reactInternalInstance = fakeInternalInstance;
          }
        }
        function constructClassInstance(workInProgress2, ctor, props) {
          var isLegacyContextConsumer = false;
          var unmaskedContext = emptyContextObject;
          var context = emptyContextObject;
          var contextType = ctor.contextType;
          {
            if ("contextType" in ctor) {
              var isValid = (
                // Allow null for conditional declaration
                contextType === null || contextType !== void 0 && contextType.$$typeof === REACT_CONTEXT_TYPE && contextType._context === void 0
              );
              if (!isValid && !didWarnAboutInvalidateContextType.has(ctor)) {
                didWarnAboutInvalidateContextType.add(ctor);
                var addendum = "";
                if (contextType === void 0) {
                  addendum = " However, it is set to undefined. This can be caused by a typo or by mixing up named and default imports. This can also happen due to a circular dependency, so try moving the createContext() call to a separate file.";
                } else if (typeof contextType !== "object") {
                  addendum = " However, it is set to a " + typeof contextType + ".";
                } else if (contextType.$$typeof === REACT_PROVIDER_TYPE) {
                  addendum = " Did you accidentally pass the Context.Provider instead?";
                } else if (contextType._context !== void 0) {
                  addendum = " Did you accidentally pass the Context.Consumer instead?";
                } else {
                  addendum = " However, it is set to an object with keys {" + Object.keys(contextType).join(", ") + "}.";
                }
                error("%s defines an invalid contextType. contextType should point to the Context object returned by React.createContext().%s", getComponentNameFromType(ctor) || "Component", addendum);
              }
            }
          }
          if (typeof contextType === "object" && contextType !== null) {
            context = readContext(contextType);
          } else {
            unmaskedContext = getUnmaskedContext(workInProgress2, ctor, true);
            var contextTypes = ctor.contextTypes;
            isLegacyContextConsumer = contextTypes !== null && contextTypes !== void 0;
            context = isLegacyContextConsumer ? getMaskedContext(workInProgress2, unmaskedContext) : emptyContextObject;
          }
          var instance = new ctor(props, context);
          {
            if (workInProgress2.mode & StrictLegacyMode) {
              setIsStrictModeForDevtools(true);
              try {
                instance = new ctor(props, context);
              } finally {
                setIsStrictModeForDevtools(false);
              }
            }
          }
          var state = workInProgress2.memoizedState = instance.state !== null && instance.state !== void 0 ? instance.state : null;
          adoptClassInstance(workInProgress2, instance);
          {
            if (typeof ctor.getDerivedStateFromProps === "function" && state === null) {
              var componentName = getComponentNameFromType(ctor) || "Component";
              if (!didWarnAboutUninitializedState.has(componentName)) {
                didWarnAboutUninitializedState.add(componentName);
                error("`%s` uses `getDerivedStateFromProps` but its initial state is %s. This is not recommended. Instead, define the initial state by assigning an object to `this.state` in the constructor of `%s`. This ensures that `getDerivedStateFromProps` arguments have a consistent shape.", componentName, instance.state === null ? "null" : "undefined", componentName);
              }
            }
            if (typeof ctor.getDerivedStateFromProps === "function" || typeof instance.getSnapshotBeforeUpdate === "function") {
              var foundWillMountName = null;
              var foundWillReceivePropsName = null;
              var foundWillUpdateName = null;
              if (typeof instance.componentWillMount === "function" && instance.componentWillMount.__suppressDeprecationWarning !== true) {
                foundWillMountName = "componentWillMount";
              } else if (typeof instance.UNSAFE_componentWillMount === "function") {
                foundWillMountName = "UNSAFE_componentWillMount";
              }
              if (typeof instance.componentWillReceiveProps === "function" && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) {
                foundWillReceivePropsName = "componentWillReceiveProps";
              } else if (typeof instance.UNSAFE_componentWillReceiveProps === "function") {
                foundWillReceivePropsName = "UNSAFE_componentWillReceiveProps";
              }
              if (typeof instance.componentWillUpdate === "function" && instance.componentWillUpdate.__suppressDeprecationWarning !== true) {
                foundWillUpdateName = "componentWillUpdate";
              } else if (typeof instance.UNSAFE_componentWillUpdate === "function") {
                foundWillUpdateName = "UNSAFE_componentWillUpdate";
              }
              if (foundWillMountName !== null || foundWillReceivePropsName !== null || foundWillUpdateName !== null) {
                var _componentName = getComponentNameFromType(ctor) || "Component";
                var newApiName = typeof ctor.getDerivedStateFromProps === "function" ? "getDerivedStateFromProps()" : "getSnapshotBeforeUpdate()";
                if (!didWarnAboutLegacyLifecyclesAndDerivedState.has(_componentName)) {
                  didWarnAboutLegacyLifecyclesAndDerivedState.add(_componentName);
                  error("Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n%s uses %s but also contains the following legacy lifecycles:%s%s%s\n\nThe above lifecycles should be removed. Learn more about this warning here:\nhttps://reactjs.org/link/unsafe-component-lifecycles", _componentName, newApiName, foundWillMountName !== null ? "\n  " + foundWillMountName : "", foundWillReceivePropsName !== null ? "\n  " + foundWillReceivePropsName : "", foundWillUpdateName !== null ? "\n  " + foundWillUpdateName : "");
                }
              }
            }
          }
          if (isLegacyContextConsumer) {
            cacheContext(workInProgress2, unmaskedContext, context);
          }
          return instance;
        }
        function callComponentWillMount(workInProgress2, instance) {
          var oldState = instance.state;
          if (typeof instance.componentWillMount === "function") {
            instance.componentWillMount();
          }
          if (typeof instance.UNSAFE_componentWillMount === "function") {
            instance.UNSAFE_componentWillMount();
          }
          if (oldState !== instance.state) {
            {
              error("%s.componentWillMount(): Assigning directly to this.state is deprecated (except inside a component's constructor). Use setState instead.", getComponentNameFromFiber(workInProgress2) || "Component");
            }
            classComponentUpdater.enqueueReplaceState(instance, instance.state, null);
          }
        }
        function callComponentWillReceiveProps(workInProgress2, instance, newProps, nextContext) {
          var oldState = instance.state;
          if (typeof instance.componentWillReceiveProps === "function") {
            instance.componentWillReceiveProps(newProps, nextContext);
          }
          if (typeof instance.UNSAFE_componentWillReceiveProps === "function") {
            instance.UNSAFE_componentWillReceiveProps(newProps, nextContext);
          }
          if (instance.state !== oldState) {
            {
              var componentName = getComponentNameFromFiber(workInProgress2) || "Component";
              if (!didWarnAboutStateAssignmentForComponent.has(componentName)) {
                didWarnAboutStateAssignmentForComponent.add(componentName);
                error("%s.componentWillReceiveProps(): Assigning directly to this.state is deprecated (except inside a component's constructor). Use setState instead.", componentName);
              }
            }
            classComponentUpdater.enqueueReplaceState(instance, instance.state, null);
          }
        }
        function mountClassInstance(workInProgress2, ctor, newProps, renderLanes2) {
          {
            checkClassInstance(workInProgress2, ctor, newProps);
          }
          var instance = workInProgress2.stateNode;
          instance.props = newProps;
          instance.state = workInProgress2.memoizedState;
          instance.refs = {};
          initializeUpdateQueue(workInProgress2);
          var contextType = ctor.contextType;
          if (typeof contextType === "object" && contextType !== null) {
            instance.context = readContext(contextType);
          } else {
            var unmaskedContext = getUnmaskedContext(workInProgress2, ctor, true);
            instance.context = getMaskedContext(workInProgress2, unmaskedContext);
          }
          {
            if (instance.state === newProps) {
              var componentName = getComponentNameFromType(ctor) || "Component";
              if (!didWarnAboutDirectlyAssigningPropsToState.has(componentName)) {
                didWarnAboutDirectlyAssigningPropsToState.add(componentName);
                error("%s: It is not recommended to assign props directly to state because updates to props won't be reflected in state. In most cases, it is better to use props directly.", componentName);
              }
            }
            if (workInProgress2.mode & StrictLegacyMode) {
              ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress2, instance);
            }
            {
              ReactStrictModeWarnings.recordUnsafeLifecycleWarnings(workInProgress2, instance);
            }
          }
          instance.state = workInProgress2.memoizedState;
          var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
          if (typeof getDerivedStateFromProps === "function") {
            applyDerivedStateFromProps(workInProgress2, ctor, getDerivedStateFromProps, newProps);
            instance.state = workInProgress2.memoizedState;
          }
          if (typeof ctor.getDerivedStateFromProps !== "function" && typeof instance.getSnapshotBeforeUpdate !== "function" && (typeof instance.UNSAFE_componentWillMount === "function" || typeof instance.componentWillMount === "function")) {
            callComponentWillMount(workInProgress2, instance);
            processUpdateQueue(workInProgress2, newProps, instance, renderLanes2);
            instance.state = workInProgress2.memoizedState;
          }
          if (typeof instance.componentDidMount === "function") {
            var fiberFlags = Update;
            {
              fiberFlags |= LayoutStatic;
            }
            if ((workInProgress2.mode & StrictEffectsMode) !== NoMode) {
              fiberFlags |= MountLayoutDev;
            }
            workInProgress2.flags |= fiberFlags;
          }
        }
        function resumeMountClassInstance(workInProgress2, ctor, newProps, renderLanes2) {
          var instance = workInProgress2.stateNode;
          var oldProps = workInProgress2.memoizedProps;
          instance.props = oldProps;
          var oldContext = instance.context;
          var contextType = ctor.contextType;
          var nextContext = emptyContextObject;
          if (typeof contextType === "object" && contextType !== null) {
            nextContext = readContext(contextType);
          } else {
            var nextLegacyUnmaskedContext = getUnmaskedContext(workInProgress2, ctor, true);
            nextContext = getMaskedContext(workInProgress2, nextLegacyUnmaskedContext);
          }
          var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
          var hasNewLifecycles = typeof getDerivedStateFromProps === "function" || typeof instance.getSnapshotBeforeUpdate === "function";
          if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === "function" || typeof instance.componentWillReceiveProps === "function")) {
            if (oldProps !== newProps || oldContext !== nextContext) {
              callComponentWillReceiveProps(workInProgress2, instance, newProps, nextContext);
            }
          }
          resetHasForceUpdateBeforeProcessing();
          var oldState = workInProgress2.memoizedState;
          var newState = instance.state = oldState;
          processUpdateQueue(workInProgress2, newProps, instance, renderLanes2);
          newState = workInProgress2.memoizedState;
          if (oldProps === newProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) {
            if (typeof instance.componentDidMount === "function") {
              var fiberFlags = Update;
              {
                fiberFlags |= LayoutStatic;
              }
              if ((workInProgress2.mode & StrictEffectsMode) !== NoMode) {
                fiberFlags |= MountLayoutDev;
              }
              workInProgress2.flags |= fiberFlags;
            }
            return false;
          }
          if (typeof getDerivedStateFromProps === "function") {
            applyDerivedStateFromProps(workInProgress2, ctor, getDerivedStateFromProps, newProps);
            newState = workInProgress2.memoizedState;
          }
          var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress2, ctor, oldProps, newProps, oldState, newState, nextContext);
          if (shouldUpdate) {
            if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillMount === "function" || typeof instance.componentWillMount === "function")) {
              if (typeof instance.componentWillMount === "function") {
                instance.componentWillMount();
              }
              if (typeof instance.UNSAFE_componentWillMount === "function") {
                instance.UNSAFE_componentWillMount();
              }
            }
            if (typeof instance.componentDidMount === "function") {
              var _fiberFlags = Update;
              {
                _fiberFlags |= LayoutStatic;
              }
              if ((workInProgress2.mode & StrictEffectsMode) !== NoMode) {
                _fiberFlags |= MountLayoutDev;
              }
              workInProgress2.flags |= _fiberFlags;
            }
          } else {
            if (typeof instance.componentDidMount === "function") {
              var _fiberFlags2 = Update;
              {
                _fiberFlags2 |= LayoutStatic;
              }
              if ((workInProgress2.mode & StrictEffectsMode) !== NoMode) {
                _fiberFlags2 |= MountLayoutDev;
              }
              workInProgress2.flags |= _fiberFlags2;
            }
            workInProgress2.memoizedProps = newProps;
            workInProgress2.memoizedState = newState;
          }
          instance.props = newProps;
          instance.state = newState;
          instance.context = nextContext;
          return shouldUpdate;
        }
        function updateClassInstance(current2, workInProgress2, ctor, newProps, renderLanes2) {
          var instance = workInProgress2.stateNode;
          cloneUpdateQueue(current2, workInProgress2);
          var unresolvedOldProps = workInProgress2.memoizedProps;
          var oldProps = workInProgress2.type === workInProgress2.elementType ? unresolvedOldProps : resolveDefaultProps(workInProgress2.type, unresolvedOldProps);
          instance.props = oldProps;
          var unresolvedNewProps = workInProgress2.pendingProps;
          var oldContext = instance.context;
          var contextType = ctor.contextType;
          var nextContext = emptyContextObject;
          if (typeof contextType === "object" && contextType !== null) {
            nextContext = readContext(contextType);
          } else {
            var nextUnmaskedContext = getUnmaskedContext(workInProgress2, ctor, true);
            nextContext = getMaskedContext(workInProgress2, nextUnmaskedContext);
          }
          var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
          var hasNewLifecycles = typeof getDerivedStateFromProps === "function" || typeof instance.getSnapshotBeforeUpdate === "function";
          if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === "function" || typeof instance.componentWillReceiveProps === "function")) {
            if (unresolvedOldProps !== unresolvedNewProps || oldContext !== nextContext) {
              callComponentWillReceiveProps(workInProgress2, instance, newProps, nextContext);
            }
          }
          resetHasForceUpdateBeforeProcessing();
          var oldState = workInProgress2.memoizedState;
          var newState = instance.state = oldState;
          processUpdateQueue(workInProgress2, newProps, instance, renderLanes2);
          newState = workInProgress2.memoizedState;
          if (unresolvedOldProps === unresolvedNewProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing() && !enableLazyContextPropagation) {
            if (typeof instance.componentDidUpdate === "function") {
              if (unresolvedOldProps !== current2.memoizedProps || oldState !== current2.memoizedState) {
                workInProgress2.flags |= Update;
              }
            }
            if (typeof instance.getSnapshotBeforeUpdate === "function") {
              if (unresolvedOldProps !== current2.memoizedProps || oldState !== current2.memoizedState) {
                workInProgress2.flags |= Snapshot;
              }
            }
            return false;
          }
          if (typeof getDerivedStateFromProps === "function") {
            applyDerivedStateFromProps(workInProgress2, ctor, getDerivedStateFromProps, newProps);
            newState = workInProgress2.memoizedState;
          }
          var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress2, ctor, oldProps, newProps, oldState, newState, nextContext) || // TODO: In some cases, we'll end up checking if context has changed twice,
          // both before and after `shouldComponentUpdate` has been called. Not ideal,
          // but I'm loath to refactor this function. This only happens for memoized
          // components so it's not that common.
          enableLazyContextPropagation;
          if (shouldUpdate) {
            if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillUpdate === "function" || typeof instance.componentWillUpdate === "function")) {
              if (typeof instance.componentWillUpdate === "function") {
                instance.componentWillUpdate(newProps, newState, nextContext);
              }
              if (typeof instance.UNSAFE_componentWillUpdate === "function") {
                instance.UNSAFE_componentWillUpdate(newProps, newState, nextContext);
              }
            }
            if (typeof instance.componentDidUpdate === "function") {
              workInProgress2.flags |= Update;
            }
            if (typeof instance.getSnapshotBeforeUpdate === "function") {
              workInProgress2.flags |= Snapshot;
            }
          } else {
            if (typeof instance.componentDidUpdate === "function") {
              if (unresolvedOldProps !== current2.memoizedProps || oldState !== current2.memoizedState) {
                workInProgress2.flags |= Update;
              }
            }
            if (typeof instance.getSnapshotBeforeUpdate === "function") {
              if (unresolvedOldProps !== current2.memoizedProps || oldState !== current2.memoizedState) {
                workInProgress2.flags |= Snapshot;
              }
            }
            workInProgress2.memoizedProps = newProps;
            workInProgress2.memoizedState = newState;
          }
          instance.props = newProps;
          instance.state = newState;
          instance.context = nextContext;
          return shouldUpdate;
        }
        function createCapturedValueAtFiber(value, source) {
          return {
            value,
            source,
            stack: getStackByFiberInDevAndProd(source),
            digest: null
          };
        }
        function createCapturedValue(value, digest, stack) {
          return {
            value,
            source: null,
            stack: stack != null ? stack : null,
            digest: digest != null ? digest : null
          };
        }
        function showErrorDialog(boundary, errorInfo) {
          return true;
        }
        function logCapturedError(boundary, errorInfo) {
          try {
            var logError = showErrorDialog(boundary, errorInfo);
            if (logError === false) {
              return;
            }
            var error2 = errorInfo.value;
            if (true) {
              var source = errorInfo.source;
              var stack = errorInfo.stack;
              var componentStack = stack !== null ? stack : "";
              if (error2 != null && error2._suppressLogging) {
                if (boundary.tag === ClassComponent) {
                  return;
                }
                console["error"](error2);
              }
              var componentName = source ? getComponentNameFromFiber(source) : null;
              var componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component:" : "The above error occurred in one of your React components:";
              var errorBoundaryMessage;
              if (boundary.tag === HostRoot) {
                errorBoundaryMessage = "Consider adding an error boundary to your tree to customize error handling behavior.\nVisit https://reactjs.org/link/error-boundaries to learn more about error boundaries.";
              } else {
                var errorBoundaryName = getComponentNameFromFiber(boundary) || "Anonymous";
                errorBoundaryMessage = "React will try to recreate this component tree from scratch " + ("using the error boundary you provided, " + errorBoundaryName + ".");
              }
              var combinedMessage = componentNameMessage + "\n" + componentStack + "\n\n" + ("" + errorBoundaryMessage);
              console["error"](combinedMessage);
            } else {
              console["error"](error2);
            }
          } catch (e) {
            setTimeout(function() {
              throw e;
            });
          }
        }
        var PossiblyWeakMap$1 = typeof WeakMap === "function" ? WeakMap : Map;
        function createRootErrorUpdate(fiber, errorInfo, lane) {
          var update = createUpdate(NoTimestamp, lane);
          update.tag = CaptureUpdate;
          update.payload = {
            element: null
          };
          var error2 = errorInfo.value;
          update.callback = function() {
            onUncaughtError(error2);
            logCapturedError(fiber, errorInfo);
          };
          return update;
        }
        function createClassErrorUpdate(fiber, errorInfo, lane) {
          var update = createUpdate(NoTimestamp, lane);
          update.tag = CaptureUpdate;
          var getDerivedStateFromError = fiber.type.getDerivedStateFromError;
          if (typeof getDerivedStateFromError === "function") {
            var error$1 = errorInfo.value;
            update.payload = function() {
              return getDerivedStateFromError(error$1);
            };
            update.callback = function() {
              {
                markFailedErrorBoundaryForHotReloading(fiber);
              }
              logCapturedError(fiber, errorInfo);
            };
          }
          var inst = fiber.stateNode;
          if (inst !== null && typeof inst.componentDidCatch === "function") {
            update.callback = function callback() {
              {
                markFailedErrorBoundaryForHotReloading(fiber);
              }
              logCapturedError(fiber, errorInfo);
              if (typeof getDerivedStateFromError !== "function") {
                markLegacyErrorBoundaryAsFailed(this);
              }
              var error$12 = errorInfo.value;
              var stack = errorInfo.stack;
              this.componentDidCatch(error$12, {
                componentStack: stack !== null ? stack : ""
              });
              {
                if (typeof getDerivedStateFromError !== "function") {
                  if (!includesSomeLane(fiber.lanes, SyncLane)) {
                    error("%s: Error boundaries should implement getDerivedStateFromError(). In that method, return a state update to display an error message or fallback UI.", getComponentNameFromFiber(fiber) || "Unknown");
                  }
                }
              }
            };
          }
          return update;
        }
        function attachPingListener(root2, wakeable, lanes) {
          var pingCache = root2.pingCache;
          var threadIDs;
          if (pingCache === null) {
            pingCache = root2.pingCache = new PossiblyWeakMap$1();
            threadIDs = /* @__PURE__ */ new Set();
            pingCache.set(wakeable, threadIDs);
          } else {
            threadIDs = pingCache.get(wakeable);
            if (threadIDs === void 0) {
              threadIDs = /* @__PURE__ */ new Set();
              pingCache.set(wakeable, threadIDs);
            }
          }
          if (!threadIDs.has(lanes)) {
            threadIDs.add(lanes);
            var ping = pingSuspendedRoot.bind(null, root2, wakeable, lanes);
            {
              if (isDevToolsPresent) {
                restorePendingUpdaters(root2, lanes);
              }
            }
            wakeable.then(ping, ping);
          }
        }
        function attachRetryListener(suspenseBoundary, root2, wakeable, lanes) {
          var wakeables = suspenseBoundary.updateQueue;
          if (wakeables === null) {
            var updateQueue = /* @__PURE__ */ new Set();
            updateQueue.add(wakeable);
            suspenseBoundary.updateQueue = updateQueue;
          } else {
            wakeables.add(wakeable);
          }
        }
        function resetSuspendedComponent(sourceFiber, rootRenderLanes) {
          var tag = sourceFiber.tag;
          if ((sourceFiber.mode & ConcurrentMode) === NoMode && (tag === FunctionComponent || tag === ForwardRef || tag === SimpleMemoComponent)) {
            var currentSource = sourceFiber.alternate;
            if (currentSource) {
              sourceFiber.updateQueue = currentSource.updateQueue;
              sourceFiber.memoizedState = currentSource.memoizedState;
              sourceFiber.lanes = currentSource.lanes;
            } else {
              sourceFiber.updateQueue = null;
              sourceFiber.memoizedState = null;
            }
          }
        }
        function getNearestSuspenseBoundaryToCapture(returnFiber) {
          var node = returnFiber;
          do {
            if (node.tag === SuspenseComponent && shouldCaptureSuspense(node)) {
              return node;
            }
            node = node.return;
          } while (node !== null);
          return null;
        }
        function markSuspenseBoundaryShouldCapture(suspenseBoundary, returnFiber, sourceFiber, root2, rootRenderLanes) {
          if ((suspenseBoundary.mode & ConcurrentMode) === NoMode) {
            if (suspenseBoundary === returnFiber) {
              suspenseBoundary.flags |= ShouldCapture;
            } else {
              suspenseBoundary.flags |= DidCapture;
              sourceFiber.flags |= ForceUpdateForLegacySuspense;
              sourceFiber.flags &= ~(LifecycleEffectMask | Incomplete);
              if (sourceFiber.tag === ClassComponent) {
                var currentSourceFiber = sourceFiber.alternate;
                if (currentSourceFiber === null) {
                  sourceFiber.tag = IncompleteClassComponent;
                } else {
                  var update = createUpdate(NoTimestamp, SyncLane);
                  update.tag = ForceUpdate;
                  enqueueUpdate(sourceFiber, update, SyncLane);
                }
              }
              sourceFiber.lanes = mergeLanes(sourceFiber.lanes, SyncLane);
            }
            return suspenseBoundary;
          }
          suspenseBoundary.flags |= ShouldCapture;
          suspenseBoundary.lanes = rootRenderLanes;
          return suspenseBoundary;
        }
        function throwException(root2, returnFiber, sourceFiber, value, rootRenderLanes) {
          sourceFiber.flags |= Incomplete;
          {
            if (isDevToolsPresent) {
              restorePendingUpdaters(root2, rootRenderLanes);
            }
          }
          if (value !== null && typeof value === "object" && typeof value.then === "function") {
            var wakeable = value;
            resetSuspendedComponent(sourceFiber);
            {
              if (getIsHydrating() && sourceFiber.mode & ConcurrentMode) {
                markDidThrowWhileHydratingDEV();
              }
            }
            var suspenseBoundary = getNearestSuspenseBoundaryToCapture(returnFiber);
            if (suspenseBoundary !== null) {
              suspenseBoundary.flags &= ~ForceClientRender;
              markSuspenseBoundaryShouldCapture(suspenseBoundary, returnFiber, sourceFiber, root2, rootRenderLanes);
              if (suspenseBoundary.mode & ConcurrentMode) {
                attachPingListener(root2, wakeable, rootRenderLanes);
              }
              attachRetryListener(suspenseBoundary, root2, wakeable);
              return;
            } else {
              if (!includesSyncLane(rootRenderLanes)) {
                attachPingListener(root2, wakeable, rootRenderLanes);
                renderDidSuspendDelayIfPossible();
                return;
              }
              var uncaughtSuspenseError = new Error("A component suspended while responding to synchronous input. This will cause the UI to be replaced with a loading indicator. To fix, updates that suspend should be wrapped with startTransition.");
              value = uncaughtSuspenseError;
            }
          } else {
            if (getIsHydrating() && sourceFiber.mode & ConcurrentMode) {
              markDidThrowWhileHydratingDEV();
              var _suspenseBoundary = getNearestSuspenseBoundaryToCapture(returnFiber);
              if (_suspenseBoundary !== null) {
                if ((_suspenseBoundary.flags & ShouldCapture) === NoFlags) {
                  _suspenseBoundary.flags |= ForceClientRender;
                }
                markSuspenseBoundaryShouldCapture(_suspenseBoundary, returnFiber, sourceFiber, root2, rootRenderLanes);
                queueHydrationError(createCapturedValueAtFiber(value, sourceFiber));
                return;
              }
            }
          }
          value = createCapturedValueAtFiber(value, sourceFiber);
          renderDidError(value);
          var workInProgress2 = returnFiber;
          do {
            switch (workInProgress2.tag) {
              case HostRoot: {
                var _errorInfo = value;
                workInProgress2.flags |= ShouldCapture;
                var lane = pickArbitraryLane(rootRenderLanes);
                workInProgress2.lanes = mergeLanes(workInProgress2.lanes, lane);
                var update = createRootErrorUpdate(workInProgress2, _errorInfo, lane);
                enqueueCapturedUpdate(workInProgress2, update);
                return;
              }
              case ClassComponent:
                var errorInfo = value;
                var ctor = workInProgress2.type;
                var instance = workInProgress2.stateNode;
                if ((workInProgress2.flags & DidCapture) === NoFlags && (typeof ctor.getDerivedStateFromError === "function" || instance !== null && typeof instance.componentDidCatch === "function" && !isAlreadyFailedLegacyErrorBoundary(instance))) {
                  workInProgress2.flags |= ShouldCapture;
                  var _lane = pickArbitraryLane(rootRenderLanes);
                  workInProgress2.lanes = mergeLanes(workInProgress2.lanes, _lane);
                  var _update = createClassErrorUpdate(workInProgress2, errorInfo, _lane);
                  enqueueCapturedUpdate(workInProgress2, _update);
                  return;
                }
                break;
            }
            workInProgress2 = workInProgress2.return;
          } while (workInProgress2 !== null);
        }
        function getSuspendedCache() {
          {
            return null;
          }
        }
        var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
        var didReceiveUpdate = false;
        var didWarnAboutBadClass;
        var didWarnAboutModulePatternComponent;
        var didWarnAboutContextTypeOnFunctionComponent;
        var didWarnAboutGetDerivedStateOnFunctionComponent;
        var didWarnAboutFunctionRefs;
        var didWarnAboutReassigningProps;
        var didWarnAboutRevealOrder;
        var didWarnAboutTailOptions;
        var didWarnAboutDefaultPropsOnFunctionComponent;
        {
          didWarnAboutBadClass = {};
          didWarnAboutModulePatternComponent = {};
          didWarnAboutContextTypeOnFunctionComponent = {};
          didWarnAboutGetDerivedStateOnFunctionComponent = {};
          didWarnAboutFunctionRefs = {};
          didWarnAboutReassigningProps = false;
          didWarnAboutRevealOrder = {};
          didWarnAboutTailOptions = {};
          didWarnAboutDefaultPropsOnFunctionComponent = {};
        }
        function reconcileChildren(current2, workInProgress2, nextChildren, renderLanes2) {
          if (current2 === null) {
            workInProgress2.child = mountChildFibers(workInProgress2, null, nextChildren, renderLanes2);
          } else {
            workInProgress2.child = reconcileChildFibers(workInProgress2, current2.child, nextChildren, renderLanes2);
          }
        }
        function forceUnmountCurrentAndReconcile(current2, workInProgress2, nextChildren, renderLanes2) {
          workInProgress2.child = reconcileChildFibers(workInProgress2, current2.child, null, renderLanes2);
          workInProgress2.child = reconcileChildFibers(workInProgress2, null, nextChildren, renderLanes2);
        }
        function updateForwardRef(current2, workInProgress2, Component, nextProps, renderLanes2) {
          {
            if (workInProgress2.type !== workInProgress2.elementType) {
              var innerPropTypes = Component.propTypes;
              if (innerPropTypes) {
                checkPropTypes(
                  innerPropTypes,
                  nextProps,
                  // Resolved props
                  "prop",
                  getComponentNameFromType(Component)
                );
              }
            }
          }
          var render3 = Component.render;
          var ref = workInProgress2.ref;
          var nextChildren;
          var hasId;
          prepareToReadContext(workInProgress2, renderLanes2);
          {
            markComponentRenderStarted(workInProgress2);
          }
          {
            ReactCurrentOwner$1.current = workInProgress2;
            setIsRendering(true);
            nextChildren = renderWithHooks(current2, workInProgress2, render3, nextProps, ref, renderLanes2);
            hasId = checkDidRenderIdHook();
            if (workInProgress2.mode & StrictLegacyMode) {
              setIsStrictModeForDevtools(true);
              try {
                nextChildren = renderWithHooks(current2, workInProgress2, render3, nextProps, ref, renderLanes2);
                hasId = checkDidRenderIdHook();
              } finally {
                setIsStrictModeForDevtools(false);
              }
            }
            setIsRendering(false);
          }
          {
            markComponentRenderStopped();
          }
          if (current2 !== null && !didReceiveUpdate) {
            bailoutHooks(current2, workInProgress2, renderLanes2);
            return bailoutOnAlreadyFinishedWork(current2, workInProgress2, renderLanes2);
          }
          if (getIsHydrating() && hasId) {
            pushMaterializedTreeId(workInProgress2);
          }
          workInProgress2.flags |= PerformedWork;
          reconcileChildren(current2, workInProgress2, nextChildren, renderLanes2);
          return workInProgress2.child;
        }
        function updateMemoComponent(current2, workInProgress2, Component, nextProps, renderLanes2) {
          if (current2 === null) {
            var type = Component.type;
            if (isSimpleFunctionComponent(type) && Component.compare === null && // SimpleMemoComponent codepath doesn't resolve outer props either.
            Component.defaultProps === void 0) {
              var resolvedType = type;
              {
                resolvedType = resolveFunctionForHotReloading(type);
              }
              workInProgress2.tag = SimpleMemoComponent;
              workInProgress2.type = resolvedType;
              {
                validateFunctionComponentInDev(workInProgress2, type);
              }
              return updateSimpleMemoComponent(current2, workInProgress2, resolvedType, nextProps, renderLanes2);
            }
            {
              var innerPropTypes = type.propTypes;
              if (innerPropTypes) {
                checkPropTypes(
                  innerPropTypes,
                  nextProps,
                  // Resolved props
                  "prop",
                  getComponentNameFromType(type)
                );
              }
              if (Component.defaultProps !== void 0) {
                var componentName = getComponentNameFromType(type) || "Unknown";
                if (!didWarnAboutDefaultPropsOnFunctionComponent[componentName]) {
                  error("%s: Support for defaultProps will be removed from memo components in a future major release. Use JavaScript default parameters instead.", componentName);
                  didWarnAboutDefaultPropsOnFunctionComponent[componentName] = true;
                }
              }
            }
            var child = createFiberFromTypeAndProps(Component.type, null, nextProps, workInProgress2, workInProgress2.mode, renderLanes2);
            child.ref = workInProgress2.ref;
            child.return = workInProgress2;
            workInProgress2.child = child;
            return child;
          }
          {
            var _type = Component.type;
            var _innerPropTypes = _type.propTypes;
            if (_innerPropTypes) {
              checkPropTypes(
                _innerPropTypes,
                nextProps,
                // Resolved props
                "prop",
                getComponentNameFromType(_type)
              );
            }
          }
          var currentChild = current2.child;
          var hasScheduledUpdateOrContext = checkScheduledUpdateOrContext(current2, renderLanes2);
          if (!hasScheduledUpdateOrContext) {
            var prevProps = currentChild.memoizedProps;
            var compare = Component.compare;
            compare = compare !== null ? compare : shallowEqual2;
            if (compare(prevProps, nextProps) && current2.ref === workInProgress2.ref) {
              return bailoutOnAlreadyFinishedWork(current2, workInProgress2, renderLanes2);
            }
          }
          workInProgress2.flags |= PerformedWork;
          var newChild = createWorkInProgress(currentChild, nextProps);
          newChild.ref = workInProgress2.ref;
          newChild.return = workInProgress2;
          workInProgress2.child = newChild;
          return newChild;
        }
        function updateSimpleMemoComponent(current2, workInProgress2, Component, nextProps, renderLanes2) {
          {
            if (workInProgress2.type !== workInProgress2.elementType) {
              var outerMemoType = workInProgress2.elementType;
              if (outerMemoType.$$typeof === REACT_LAZY_TYPE) {
                var lazyComponent = outerMemoType;
                var payload = lazyComponent._payload;
                var init2 = lazyComponent._init;
                try {
                  outerMemoType = init2(payload);
                } catch (x2) {
                  outerMemoType = null;
                }
                var outerPropTypes = outerMemoType && outerMemoType.propTypes;
                if (outerPropTypes) {
                  checkPropTypes(
                    outerPropTypes,
                    nextProps,
                    // Resolved (SimpleMemoComponent has no defaultProps)
                    "prop",
                    getComponentNameFromType(outerMemoType)
                  );
                }
              }
            }
          }
          if (current2 !== null) {
            var prevProps = current2.memoizedProps;
            if (shallowEqual2(prevProps, nextProps) && current2.ref === workInProgress2.ref && // Prevent bailout if the implementation changed due to hot reload.
            workInProgress2.type === current2.type) {
              didReceiveUpdate = false;
              workInProgress2.pendingProps = nextProps = prevProps;
              if (!checkScheduledUpdateOrContext(current2, renderLanes2)) {
                workInProgress2.lanes = current2.lanes;
                return bailoutOnAlreadyFinishedWork(current2, workInProgress2, renderLanes2);
              } else if ((current2.flags & ForceUpdateForLegacySuspense) !== NoFlags) {
                didReceiveUpdate = true;
              }
            }
          }
          return updateFunctionComponent(current2, workInProgress2, Component, nextProps, renderLanes2);
        }
        function updateOffscreenComponent(current2, workInProgress2, renderLanes2) {
          var nextProps = workInProgress2.pendingProps;
          var nextChildren = nextProps.children;
          var prevState = current2 !== null ? current2.memoizedState : null;
          if (nextProps.mode === "hidden" || enableLegacyHidden) {
            if ((workInProgress2.mode & ConcurrentMode) === NoMode) {
              var nextState = {
                baseLanes: NoLanes,
                cachePool: null,
                transitions: null
              };
              workInProgress2.memoizedState = nextState;
              pushRenderLanes(workInProgress2, renderLanes2);
            } else if (!includesSomeLane(renderLanes2, OffscreenLane)) {
              var spawnedCachePool = null;
              var nextBaseLanes;
              if (prevState !== null) {
                var prevBaseLanes = prevState.baseLanes;
                nextBaseLanes = mergeLanes(prevBaseLanes, renderLanes2);
              } else {
                nextBaseLanes = renderLanes2;
              }
              workInProgress2.lanes = workInProgress2.childLanes = laneToLanes(OffscreenLane);
              var _nextState = {
                baseLanes: nextBaseLanes,
                cachePool: spawnedCachePool,
                transitions: null
              };
              workInProgress2.memoizedState = _nextState;
              workInProgress2.updateQueue = null;
              pushRenderLanes(workInProgress2, nextBaseLanes);
              return null;
            } else {
              var _nextState2 = {
                baseLanes: NoLanes,
                cachePool: null,
                transitions: null
              };
              workInProgress2.memoizedState = _nextState2;
              var subtreeRenderLanes2 = prevState !== null ? prevState.baseLanes : renderLanes2;
              pushRenderLanes(workInProgress2, subtreeRenderLanes2);
            }
          } else {
            var _subtreeRenderLanes;
            if (prevState !== null) {
              _subtreeRenderLanes = mergeLanes(prevState.baseLanes, renderLanes2);
              workInProgress2.memoizedState = null;
            } else {
              _subtreeRenderLanes = renderLanes2;
            }
            pushRenderLanes(workInProgress2, _subtreeRenderLanes);
          }
          reconcileChildren(current2, workInProgress2, nextChildren, renderLanes2);
          return workInProgress2.child;
        }
        function updateFragment(current2, workInProgress2, renderLanes2) {
          var nextChildren = workInProgress2.pendingProps;
          reconcileChildren(current2, workInProgress2, nextChildren, renderLanes2);
          return workInProgress2.child;
        }
        function updateMode(current2, workInProgress2, renderLanes2) {
          var nextChildren = workInProgress2.pendingProps.children;
          reconcileChildren(current2, workInProgress2, nextChildren, renderLanes2);
          return workInProgress2.child;
        }
        function updateProfiler(current2, workInProgress2, renderLanes2) {
          {
            workInProgress2.flags |= Update;
            {
              var stateNode = workInProgress2.stateNode;
              stateNode.effectDuration = 0;
              stateNode.passiveEffectDuration = 0;
            }
          }
          var nextProps = workInProgress2.pendingProps;
          var nextChildren = nextProps.children;
          reconcileChildren(current2, workInProgress2, nextChildren, renderLanes2);
          return workInProgress2.child;
        }
        function markRef(current2, workInProgress2) {
          var ref = workInProgress2.ref;
          if (current2 === null && ref !== null || current2 !== null && current2.ref !== ref) {
            workInProgress2.flags |= Ref;
            {
              workInProgress2.flags |= RefStatic;
            }
          }
        }
        function updateFunctionComponent(current2, workInProgress2, Component, nextProps, renderLanes2) {
          {
            if (workInProgress2.type !== workInProgress2.elementType) {
              var innerPropTypes = Component.propTypes;
              if (innerPropTypes) {
                checkPropTypes(
                  innerPropTypes,
                  nextProps,
                  // Resolved props
                  "prop",
                  getComponentNameFromType(Component)
                );
              }
            }
          }
          var context;
          {
            var unmaskedContext = getUnmaskedContext(workInProgress2, Component, true);
            context = getMaskedContext(workInProgress2, unmaskedContext);
          }
          var nextChildren;
          var hasId;
          prepareToReadContext(workInProgress2, renderLanes2);
          {
            markComponentRenderStarted(workInProgress2);
          }
          {
            ReactCurrentOwner$1.current = workInProgress2;
            setIsRendering(true);
            nextChildren = renderWithHooks(current2, workInProgress2, Component, nextProps, context, renderLanes2);
            hasId = checkDidRenderIdHook();
            if (workInProgress2.mode & StrictLegacyMode) {
              setIsStrictModeForDevtools(true);
              try {
                nextChildren = renderWithHooks(current2, workInProgress2, Component, nextProps, context, renderLanes2);
                hasId = checkDidRenderIdHook();
              } finally {
                setIsStrictModeForDevtools(false);
              }
            }
            setIsRendering(false);
          }
          {
            markComponentRenderStopped();
          }
          if (current2 !== null && !didReceiveUpdate) {
            bailoutHooks(current2, workInProgress2, renderLanes2);
            return bailoutOnAlreadyFinishedWork(current2, workInProgress2, renderLanes2);
          }
          if (getIsHydrating() && hasId) {
            pushMaterializedTreeId(workInProgress2);
          }
          workInProgress2.flags |= PerformedWork;
          reconcileChildren(current2, workInProgress2, nextChildren, renderLanes2);
          return workInProgress2.child;
        }
        function updateClassComponent(current2, workInProgress2, Component, nextProps, renderLanes2) {
          {
            switch (shouldError(workInProgress2)) {
              case false: {
                var _instance = workInProgress2.stateNode;
                var ctor = workInProgress2.type;
                var tempInstance = new ctor(workInProgress2.memoizedProps, _instance.context);
                var state = tempInstance.state;
                _instance.updater.enqueueSetState(_instance, state, null);
                break;
              }
              case true: {
                workInProgress2.flags |= DidCapture;
                workInProgress2.flags |= ShouldCapture;
                var error$1 = new Error("Simulated error coming from DevTools");
                var lane = pickArbitraryLane(renderLanes2);
                workInProgress2.lanes = mergeLanes(workInProgress2.lanes, lane);
                var update = createClassErrorUpdate(workInProgress2, createCapturedValueAtFiber(error$1, workInProgress2), lane);
                enqueueCapturedUpdate(workInProgress2, update);
                break;
              }
            }
            if (workInProgress2.type !== workInProgress2.elementType) {
              var innerPropTypes = Component.propTypes;
              if (innerPropTypes) {
                checkPropTypes(
                  innerPropTypes,
                  nextProps,
                  // Resolved props
                  "prop",
                  getComponentNameFromType(Component)
                );
              }
            }
          }
          var hasContext;
          if (isContextProvider(Component)) {
            hasContext = true;
            pushContextProvider(workInProgress2);
          } else {
            hasContext = false;
          }
          prepareToReadContext(workInProgress2, renderLanes2);
          var instance = workInProgress2.stateNode;
          var shouldUpdate;
          if (instance === null) {
            resetSuspendedCurrentOnMountInLegacyMode(current2, workInProgress2);
            constructClassInstance(workInProgress2, Component, nextProps);
            mountClassInstance(workInProgress2, Component, nextProps, renderLanes2);
            shouldUpdate = true;
          } else if (current2 === null) {
            shouldUpdate = resumeMountClassInstance(workInProgress2, Component, nextProps, renderLanes2);
          } else {
            shouldUpdate = updateClassInstance(current2, workInProgress2, Component, nextProps, renderLanes2);
          }
          var nextUnitOfWork = finishClassComponent(current2, workInProgress2, Component, shouldUpdate, hasContext, renderLanes2);
          {
            var inst = workInProgress2.stateNode;
            if (shouldUpdate && inst.props !== nextProps) {
              if (!didWarnAboutReassigningProps) {
                error("It looks like %s is reassigning its own `this.props` while rendering. This is not supported and can lead to confusing bugs.", getComponentNameFromFiber(workInProgress2) || "a component");
              }
              didWarnAboutReassigningProps = true;
            }
          }
          return nextUnitOfWork;
        }
        function finishClassComponent(current2, workInProgress2, Component, shouldUpdate, hasContext, renderLanes2) {
          markRef(current2, workInProgress2);
          var didCaptureError = (workInProgress2.flags & DidCapture) !== NoFlags;
          if (!shouldUpdate && !didCaptureError) {
            if (hasContext) {
              invalidateContextProvider(workInProgress2, Component, false);
            }
            return bailoutOnAlreadyFinishedWork(current2, workInProgress2, renderLanes2);
          }
          var instance = workInProgress2.stateNode;
          ReactCurrentOwner$1.current = workInProgress2;
          var nextChildren;
          if (didCaptureError && typeof Component.getDerivedStateFromError !== "function") {
            nextChildren = null;
            {
              stopProfilerTimerIfRunning();
            }
          } else {
            {
              markComponentRenderStarted(workInProgress2);
            }
            {
              setIsRendering(true);
              nextChildren = instance.render();
              if (workInProgress2.mode & StrictLegacyMode) {
                setIsStrictModeForDevtools(true);
                try {
                  instance.render();
                } finally {
                  setIsStrictModeForDevtools(false);
                }
              }
              setIsRendering(false);
            }
            {
              markComponentRenderStopped();
            }
          }
          workInProgress2.flags |= PerformedWork;
          if (current2 !== null && didCaptureError) {
            forceUnmountCurrentAndReconcile(current2, workInProgress2, nextChildren, renderLanes2);
          } else {
            reconcileChildren(current2, workInProgress2, nextChildren, renderLanes2);
          }
          workInProgress2.memoizedState = instance.state;
          if (hasContext) {
            invalidateContextProvider(workInProgress2, Component, true);
          }
          return workInProgress2.child;
        }
        function pushHostRootContext(workInProgress2) {
          var root2 = workInProgress2.stateNode;
          if (root2.pendingContext) {
            pushTopLevelContextObject(workInProgress2, root2.pendingContext, root2.pendingContext !== root2.context);
          } else if (root2.context) {
            pushTopLevelContextObject(workInProgress2, root2.context, false);
          }
          pushHostContainer(workInProgress2, root2.containerInfo);
        }
        function updateHostRoot(current2, workInProgress2, renderLanes2) {
          pushHostRootContext(workInProgress2);
          if (current2 === null) {
            throw new Error("Should have a current fiber. This is a bug in React.");
          }
          var nextProps = workInProgress2.pendingProps;
          var prevState = workInProgress2.memoizedState;
          var prevChildren = prevState.element;
          cloneUpdateQueue(current2, workInProgress2);
          processUpdateQueue(workInProgress2, nextProps, null, renderLanes2);
          var nextState = workInProgress2.memoizedState;
          var root2 = workInProgress2.stateNode;
          var nextChildren = nextState.element;
          if (prevState.isDehydrated) {
            var overrideState = {
              element: nextChildren,
              isDehydrated: false,
              cache: nextState.cache,
              pendingSuspenseBoundaries: nextState.pendingSuspenseBoundaries,
              transitions: nextState.transitions
            };
            var updateQueue = workInProgress2.updateQueue;
            updateQueue.baseState = overrideState;
            workInProgress2.memoizedState = overrideState;
            if (workInProgress2.flags & ForceClientRender) {
              var recoverableError = createCapturedValueAtFiber(new Error("There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering."), workInProgress2);
              return mountHostRootWithoutHydrating(current2, workInProgress2, nextChildren, renderLanes2, recoverableError);
            } else if (nextChildren !== prevChildren) {
              var _recoverableError = createCapturedValueAtFiber(new Error("This root received an early update, before anything was able hydrate. Switched the entire root to client rendering."), workInProgress2);
              return mountHostRootWithoutHydrating(current2, workInProgress2, nextChildren, renderLanes2, _recoverableError);
            } else {
              enterHydrationState(workInProgress2);
              var child = mountChildFibers(workInProgress2, null, nextChildren, renderLanes2);
              workInProgress2.child = child;
              var node = child;
              while (node) {
                node.flags = node.flags & ~Placement | Hydrating;
                node = node.sibling;
              }
            }
          } else {
            resetHydrationState();
            if (nextChildren === prevChildren) {
              return bailoutOnAlreadyFinishedWork(current2, workInProgress2, renderLanes2);
            }
            reconcileChildren(current2, workInProgress2, nextChildren, renderLanes2);
          }
          return workInProgress2.child;
        }
        function mountHostRootWithoutHydrating(current2, workInProgress2, nextChildren, renderLanes2, recoverableError) {
          resetHydrationState();
          queueHydrationError(recoverableError);
          workInProgress2.flags |= ForceClientRender;
          reconcileChildren(current2, workInProgress2, nextChildren, renderLanes2);
          return workInProgress2.child;
        }
        function updateHostComponent(current2, workInProgress2, renderLanes2) {
          pushHostContext(workInProgress2);
          if (current2 === null) {
            tryToClaimNextHydratableInstance(workInProgress2);
          }
          var type = workInProgress2.type;
          var nextProps = workInProgress2.pendingProps;
          var prevProps = current2 !== null ? current2.memoizedProps : null;
          var nextChildren = nextProps.children;
          var isDirectTextChild = shouldSetTextContent(type, nextProps);
          if (isDirectTextChild) {
            nextChildren = null;
          } else if (prevProps !== null && shouldSetTextContent(type, prevProps)) {
            workInProgress2.flags |= ContentReset;
          }
          markRef(current2, workInProgress2);
          reconcileChildren(current2, workInProgress2, nextChildren, renderLanes2);
          return workInProgress2.child;
        }
        function updateHostText(current2, workInProgress2) {
          if (current2 === null) {
            tryToClaimNextHydratableInstance(workInProgress2);
          }
          return null;
        }
        function mountLazyComponent(_current, workInProgress2, elementType, renderLanes2) {
          resetSuspendedCurrentOnMountInLegacyMode(_current, workInProgress2);
          var props = workInProgress2.pendingProps;
          var lazyComponent = elementType;
          var payload = lazyComponent._payload;
          var init2 = lazyComponent._init;
          var Component = init2(payload);
          workInProgress2.type = Component;
          var resolvedTag = workInProgress2.tag = resolveLazyComponentTag(Component);
          var resolvedProps = resolveDefaultProps(Component, props);
          var child;
          switch (resolvedTag) {
            case FunctionComponent: {
              {
                validateFunctionComponentInDev(workInProgress2, Component);
                workInProgress2.type = Component = resolveFunctionForHotReloading(Component);
              }
              child = updateFunctionComponent(null, workInProgress2, Component, resolvedProps, renderLanes2);
              return child;
            }
            case ClassComponent: {
              {
                workInProgress2.type = Component = resolveClassForHotReloading(Component);
              }
              child = updateClassComponent(null, workInProgress2, Component, resolvedProps, renderLanes2);
              return child;
            }
            case ForwardRef: {
              {
                workInProgress2.type = Component = resolveForwardRefForHotReloading(Component);
              }
              child = updateForwardRef(null, workInProgress2, Component, resolvedProps, renderLanes2);
              return child;
            }
            case MemoComponent: {
              {
                if (workInProgress2.type !== workInProgress2.elementType) {
                  var outerPropTypes = Component.propTypes;
                  if (outerPropTypes) {
                    checkPropTypes(
                      outerPropTypes,
                      resolvedProps,
                      // Resolved for outer only
                      "prop",
                      getComponentNameFromType(Component)
                    );
                  }
                }
              }
              child = updateMemoComponent(
                null,
                workInProgress2,
                Component,
                resolveDefaultProps(Component.type, resolvedProps),
                // The inner type can have defaults too
                renderLanes2
              );
              return child;
            }
          }
          var hint = "";
          {
            if (Component !== null && typeof Component === "object" && Component.$$typeof === REACT_LAZY_TYPE) {
              hint = " Did you wrap a component in React.lazy() more than once?";
            }
          }
          throw new Error("Element type is invalid. Received a promise that resolves to: " + Component + ". " + ("Lazy element type must resolve to a class or function." + hint));
        }
        function mountIncompleteClassComponent(_current, workInProgress2, Component, nextProps, renderLanes2) {
          resetSuspendedCurrentOnMountInLegacyMode(_current, workInProgress2);
          workInProgress2.tag = ClassComponent;
          var hasContext;
          if (isContextProvider(Component)) {
            hasContext = true;
            pushContextProvider(workInProgress2);
          } else {
            hasContext = false;
          }
          prepareToReadContext(workInProgress2, renderLanes2);
          constructClassInstance(workInProgress2, Component, nextProps);
          mountClassInstance(workInProgress2, Component, nextProps, renderLanes2);
          return finishClassComponent(null, workInProgress2, Component, true, hasContext, renderLanes2);
        }
        function mountIndeterminateComponent(_current, workInProgress2, Component, renderLanes2) {
          resetSuspendedCurrentOnMountInLegacyMode(_current, workInProgress2);
          var props = workInProgress2.pendingProps;
          var context;
          {
            var unmaskedContext = getUnmaskedContext(workInProgress2, Component, false);
            context = getMaskedContext(workInProgress2, unmaskedContext);
          }
          prepareToReadContext(workInProgress2, renderLanes2);
          var value;
          var hasId;
          {
            markComponentRenderStarted(workInProgress2);
          }
          {
            if (Component.prototype && typeof Component.prototype.render === "function") {
              var componentName = getComponentNameFromType(Component) || "Unknown";
              if (!didWarnAboutBadClass[componentName]) {
                error("The <%s /> component appears to have a render method, but doesn't extend React.Component. This is likely to cause errors. Change %s to extend React.Component instead.", componentName, componentName);
                didWarnAboutBadClass[componentName] = true;
              }
            }
            if (workInProgress2.mode & StrictLegacyMode) {
              ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress2, null);
            }
            setIsRendering(true);
            ReactCurrentOwner$1.current = workInProgress2;
            value = renderWithHooks(null, workInProgress2, Component, props, context, renderLanes2);
            hasId = checkDidRenderIdHook();
            setIsRendering(false);
          }
          {
            markComponentRenderStopped();
          }
          workInProgress2.flags |= PerformedWork;
          {
            if (typeof value === "object" && value !== null && typeof value.render === "function" && value.$$typeof === void 0) {
              var _componentName = getComponentNameFromType(Component) || "Unknown";
              if (!didWarnAboutModulePatternComponent[_componentName]) {
                error("The <%s /> component appears to be a function component that returns a class instance. Change %s to a class that extends React.Component instead. If you can't use a class try assigning the prototype on the function as a workaround. `%s.prototype = React.Component.prototype`. Don't use an arrow function since it cannot be called with `new` by React.", _componentName, _componentName, _componentName);
                didWarnAboutModulePatternComponent[_componentName] = true;
              }
            }
          }
          if (
            // Run these checks in production only if the flag is off.
            // Eventually we'll delete this branch altogether.
            typeof value === "object" && value !== null && typeof value.render === "function" && value.$$typeof === void 0
          ) {
            {
              var _componentName2 = getComponentNameFromType(Component) || "Unknown";
              if (!didWarnAboutModulePatternComponent[_componentName2]) {
                error("The <%s /> component appears to be a function component that returns a class instance. Change %s to a class that extends React.Component instead. If you can't use a class try assigning the prototype on the function as a workaround. `%s.prototype = React.Component.prototype`. Don't use an arrow function since it cannot be called with `new` by React.", _componentName2, _componentName2, _componentName2);
                didWarnAboutModulePatternComponent[_componentName2] = true;
              }
            }
            workInProgress2.tag = ClassComponent;
            workInProgress2.memoizedState = null;
            workInProgress2.updateQueue = null;
            var hasContext = false;
            if (isContextProvider(Component)) {
              hasContext = true;
              pushContextProvider(workInProgress2);
            } else {
              hasContext = false;
            }
            workInProgress2.memoizedState = value.state !== null && value.state !== void 0 ? value.state : null;
            initializeUpdateQueue(workInProgress2);
            adoptClassInstance(workInProgress2, value);
            mountClassInstance(workInProgress2, Component, props, renderLanes2);
            return finishClassComponent(null, workInProgress2, Component, true, hasContext, renderLanes2);
          } else {
            workInProgress2.tag = FunctionComponent;
            {
              if (workInProgress2.mode & StrictLegacyMode) {
                setIsStrictModeForDevtools(true);
                try {
                  value = renderWithHooks(null, workInProgress2, Component, props, context, renderLanes2);
                  hasId = checkDidRenderIdHook();
                } finally {
                  setIsStrictModeForDevtools(false);
                }
              }
            }
            if (getIsHydrating() && hasId) {
              pushMaterializedTreeId(workInProgress2);
            }
            reconcileChildren(null, workInProgress2, value, renderLanes2);
            {
              validateFunctionComponentInDev(workInProgress2, Component);
            }
            return workInProgress2.child;
          }
        }
        function validateFunctionComponentInDev(workInProgress2, Component) {
          {
            if (Component) {
              if (Component.childContextTypes) {
                error("%s(...): childContextTypes cannot be defined on a function component.", Component.displayName || Component.name || "Component");
              }
            }
            if (workInProgress2.ref !== null) {
              var info = "";
              var ownerName = getCurrentFiberOwnerNameInDevOrNull();
              if (ownerName) {
                info += "\n\nCheck the render method of `" + ownerName + "`.";
              }
              var warningKey = ownerName || "";
              var debugSource = workInProgress2._debugSource;
              if (debugSource) {
                warningKey = debugSource.fileName + ":" + debugSource.lineNumber;
              }
              if (!didWarnAboutFunctionRefs[warningKey]) {
                didWarnAboutFunctionRefs[warningKey] = true;
                error("Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s", info);
              }
            }
            if (Component.defaultProps !== void 0) {
              var componentName = getComponentNameFromType(Component) || "Unknown";
              if (!didWarnAboutDefaultPropsOnFunctionComponent[componentName]) {
                error("%s: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.", componentName);
                didWarnAboutDefaultPropsOnFunctionComponent[componentName] = true;
              }
            }
            if (typeof Component.getDerivedStateFromProps === "function") {
              var _componentName3 = getComponentNameFromType(Component) || "Unknown";
              if (!didWarnAboutGetDerivedStateOnFunctionComponent[_componentName3]) {
                error("%s: Function components do not support getDerivedStateFromProps.", _componentName3);
                didWarnAboutGetDerivedStateOnFunctionComponent[_componentName3] = true;
              }
            }
            if (typeof Component.contextType === "object" && Component.contextType !== null) {
              var _componentName4 = getComponentNameFromType(Component) || "Unknown";
              if (!didWarnAboutContextTypeOnFunctionComponent[_componentName4]) {
                error("%s: Function components do not support contextType.", _componentName4);
                didWarnAboutContextTypeOnFunctionComponent[_componentName4] = true;
              }
            }
          }
        }
        var SUSPENDED_MARKER = {
          dehydrated: null,
          treeContext: null,
          retryLane: NoLane
        };
        function mountSuspenseOffscreenState(renderLanes2) {
          return {
            baseLanes: renderLanes2,
            cachePool: getSuspendedCache(),
            transitions: null
          };
        }
        function updateSuspenseOffscreenState(prevOffscreenState, renderLanes2) {
          var cachePool = null;
          return {
            baseLanes: mergeLanes(prevOffscreenState.baseLanes, renderLanes2),
            cachePool,
            transitions: prevOffscreenState.transitions
          };
        }
        function shouldRemainOnFallback(suspenseContext, current2, workInProgress2, renderLanes2) {
          if (current2 !== null) {
            var suspenseState = current2.memoizedState;
            if (suspenseState === null) {
              return false;
            }
          }
          return hasSuspenseContext(suspenseContext, ForceSuspenseFallback);
        }
        function getRemainingWorkInPrimaryTree(current2, renderLanes2) {
          return removeLanes(current2.childLanes, renderLanes2);
        }
        function updateSuspenseComponent(current2, workInProgress2, renderLanes2) {
          var nextProps = workInProgress2.pendingProps;
          {
            if (shouldSuspend(workInProgress2)) {
              workInProgress2.flags |= DidCapture;
            }
          }
          var suspenseContext = suspenseStackCursor.current;
          var showFallback = false;
          var didSuspend = (workInProgress2.flags & DidCapture) !== NoFlags;
          if (didSuspend || shouldRemainOnFallback(suspenseContext, current2)) {
            showFallback = true;
            workInProgress2.flags &= ~DidCapture;
          } else {
            if (current2 === null || current2.memoizedState !== null) {
              {
                suspenseContext = addSubtreeSuspenseContext(suspenseContext, InvisibleParentSuspenseContext);
              }
            }
          }
          suspenseContext = setDefaultShallowSuspenseContext(suspenseContext);
          pushSuspenseContext(workInProgress2, suspenseContext);
          if (current2 === null) {
            tryToClaimNextHydratableInstance(workInProgress2);
            var suspenseState = workInProgress2.memoizedState;
            if (suspenseState !== null) {
              var dehydrated = suspenseState.dehydrated;
              if (dehydrated !== null) {
                return mountDehydratedSuspenseComponent(workInProgress2, dehydrated);
              }
            }
            var nextPrimaryChildren = nextProps.children;
            var nextFallbackChildren = nextProps.fallback;
            if (showFallback) {
              var fallbackFragment = mountSuspenseFallbackChildren(workInProgress2, nextPrimaryChildren, nextFallbackChildren, renderLanes2);
              var primaryChildFragment = workInProgress2.child;
              primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes2);
              workInProgress2.memoizedState = SUSPENDED_MARKER;
              return fallbackFragment;
            } else {
              return mountSuspensePrimaryChildren(workInProgress2, nextPrimaryChildren);
            }
          } else {
            var prevState = current2.memoizedState;
            if (prevState !== null) {
              var _dehydrated = prevState.dehydrated;
              if (_dehydrated !== null) {
                return updateDehydratedSuspenseComponent(current2, workInProgress2, didSuspend, nextProps, _dehydrated, prevState, renderLanes2);
              }
            }
            if (showFallback) {
              var _nextFallbackChildren = nextProps.fallback;
              var _nextPrimaryChildren = nextProps.children;
              var fallbackChildFragment = updateSuspenseFallbackChildren(current2, workInProgress2, _nextPrimaryChildren, _nextFallbackChildren, renderLanes2);
              var _primaryChildFragment2 = workInProgress2.child;
              var prevOffscreenState = current2.child.memoizedState;
              _primaryChildFragment2.memoizedState = prevOffscreenState === null ? mountSuspenseOffscreenState(renderLanes2) : updateSuspenseOffscreenState(prevOffscreenState, renderLanes2);
              _primaryChildFragment2.childLanes = getRemainingWorkInPrimaryTree(current2, renderLanes2);
              workInProgress2.memoizedState = SUSPENDED_MARKER;
              return fallbackChildFragment;
            } else {
              var _nextPrimaryChildren2 = nextProps.children;
              var _primaryChildFragment3 = updateSuspensePrimaryChildren(current2, workInProgress2, _nextPrimaryChildren2, renderLanes2);
              workInProgress2.memoizedState = null;
              return _primaryChildFragment3;
            }
          }
        }
        function mountSuspensePrimaryChildren(workInProgress2, primaryChildren, renderLanes2) {
          var mode = workInProgress2.mode;
          var primaryChildProps = {
            mode: "visible",
            children: primaryChildren
          };
          var primaryChildFragment = mountWorkInProgressOffscreenFiber(primaryChildProps, mode);
          primaryChildFragment.return = workInProgress2;
          workInProgress2.child = primaryChildFragment;
          return primaryChildFragment;
        }
        function mountSuspenseFallbackChildren(workInProgress2, primaryChildren, fallbackChildren, renderLanes2) {
          var mode = workInProgress2.mode;
          var progressedPrimaryFragment = workInProgress2.child;
          var primaryChildProps = {
            mode: "hidden",
            children: primaryChildren
          };
          var primaryChildFragment;
          var fallbackChildFragment;
          if ((mode & ConcurrentMode) === NoMode && progressedPrimaryFragment !== null) {
            primaryChildFragment = progressedPrimaryFragment;
            primaryChildFragment.childLanes = NoLanes;
            primaryChildFragment.pendingProps = primaryChildProps;
            if (workInProgress2.mode & ProfileMode) {
              primaryChildFragment.actualDuration = 0;
              primaryChildFragment.actualStartTime = -1;
              primaryChildFragment.selfBaseDuration = 0;
              primaryChildFragment.treeBaseDuration = 0;
            }
            fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes2, null);
          } else {
            primaryChildFragment = mountWorkInProgressOffscreenFiber(primaryChildProps, mode);
            fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes2, null);
          }
          primaryChildFragment.return = workInProgress2;
          fallbackChildFragment.return = workInProgress2;
          primaryChildFragment.sibling = fallbackChildFragment;
          workInProgress2.child = primaryChildFragment;
          return fallbackChildFragment;
        }
        function mountWorkInProgressOffscreenFiber(offscreenProps, mode, renderLanes2) {
          return createFiberFromOffscreen(offscreenProps, mode, NoLanes, null);
        }
        function updateWorkInProgressOffscreenFiber(current2, offscreenProps) {
          return createWorkInProgress(current2, offscreenProps);
        }
        function updateSuspensePrimaryChildren(current2, workInProgress2, primaryChildren, renderLanes2) {
          var currentPrimaryChildFragment = current2.child;
          var currentFallbackChildFragment = currentPrimaryChildFragment.sibling;
          var primaryChildFragment = updateWorkInProgressOffscreenFiber(currentPrimaryChildFragment, {
            mode: "visible",
            children: primaryChildren
          });
          if ((workInProgress2.mode & ConcurrentMode) === NoMode) {
            primaryChildFragment.lanes = renderLanes2;
          }
          primaryChildFragment.return = workInProgress2;
          primaryChildFragment.sibling = null;
          if (currentFallbackChildFragment !== null) {
            var deletions = workInProgress2.deletions;
            if (deletions === null) {
              workInProgress2.deletions = [currentFallbackChildFragment];
              workInProgress2.flags |= ChildDeletion;
            } else {
              deletions.push(currentFallbackChildFragment);
            }
          }
          workInProgress2.child = primaryChildFragment;
          return primaryChildFragment;
        }
        function updateSuspenseFallbackChildren(current2, workInProgress2, primaryChildren, fallbackChildren, renderLanes2) {
          var mode = workInProgress2.mode;
          var currentPrimaryChildFragment = current2.child;
          var currentFallbackChildFragment = currentPrimaryChildFragment.sibling;
          var primaryChildProps = {
            mode: "hidden",
            children: primaryChildren
          };
          var primaryChildFragment;
          if (
            // In legacy mode, we commit the primary tree as if it successfully
            // completed, even though it's in an inconsistent state.
            (mode & ConcurrentMode) === NoMode && // Make sure we're on the second pass, i.e. the primary child fragment was
            // already cloned. In legacy mode, the only case where this isn't true is
            // when DevTools forces us to display a fallback; we skip the first render
            // pass entirely and go straight to rendering the fallback. (In Concurrent
            // Mode, SuspenseList can also trigger this scenario, but this is a legacy-
            // only codepath.)
            workInProgress2.child !== currentPrimaryChildFragment
          ) {
            var progressedPrimaryFragment = workInProgress2.child;
            primaryChildFragment = progressedPrimaryFragment;
            primaryChildFragment.childLanes = NoLanes;
            primaryChildFragment.pendingProps = primaryChildProps;
            if (workInProgress2.mode & ProfileMode) {
              primaryChildFragment.actualDuration = 0;
              primaryChildFragment.actualStartTime = -1;
              primaryChildFragment.selfBaseDuration = currentPrimaryChildFragment.selfBaseDuration;
              primaryChildFragment.treeBaseDuration = currentPrimaryChildFragment.treeBaseDuration;
            }
            workInProgress2.deletions = null;
          } else {
            primaryChildFragment = updateWorkInProgressOffscreenFiber(currentPrimaryChildFragment, primaryChildProps);
            primaryChildFragment.subtreeFlags = currentPrimaryChildFragment.subtreeFlags & StaticMask;
          }
          var fallbackChildFragment;
          if (currentFallbackChildFragment !== null) {
            fallbackChildFragment = createWorkInProgress(currentFallbackChildFragment, fallbackChildren);
          } else {
            fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes2, null);
            fallbackChildFragment.flags |= Placement;
          }
          fallbackChildFragment.return = workInProgress2;
          primaryChildFragment.return = workInProgress2;
          primaryChildFragment.sibling = fallbackChildFragment;
          workInProgress2.child = primaryChildFragment;
          return fallbackChildFragment;
        }
        function retrySuspenseComponentWithoutHydrating(current2, workInProgress2, renderLanes2, recoverableError) {
          if (recoverableError !== null) {
            queueHydrationError(recoverableError);
          }
          reconcileChildFibers(workInProgress2, current2.child, null, renderLanes2);
          var nextProps = workInProgress2.pendingProps;
          var primaryChildren = nextProps.children;
          var primaryChildFragment = mountSuspensePrimaryChildren(workInProgress2, primaryChildren);
          primaryChildFragment.flags |= Placement;
          workInProgress2.memoizedState = null;
          return primaryChildFragment;
        }
        function mountSuspenseFallbackAfterRetryWithoutHydrating(current2, workInProgress2, primaryChildren, fallbackChildren, renderLanes2) {
          var fiberMode = workInProgress2.mode;
          var primaryChildProps = {
            mode: "visible",
            children: primaryChildren
          };
          var primaryChildFragment = mountWorkInProgressOffscreenFiber(primaryChildProps, fiberMode);
          var fallbackChildFragment = createFiberFromFragment(fallbackChildren, fiberMode, renderLanes2, null);
          fallbackChildFragment.flags |= Placement;
          primaryChildFragment.return = workInProgress2;
          fallbackChildFragment.return = workInProgress2;
          primaryChildFragment.sibling = fallbackChildFragment;
          workInProgress2.child = primaryChildFragment;
          if ((workInProgress2.mode & ConcurrentMode) !== NoMode) {
            reconcileChildFibers(workInProgress2, current2.child, null, renderLanes2);
          }
          return fallbackChildFragment;
        }
        function mountDehydratedSuspenseComponent(workInProgress2, suspenseInstance, renderLanes2) {
          if ((workInProgress2.mode & ConcurrentMode) === NoMode) {
            {
              error("Cannot hydrate Suspense in legacy mode. Switch from ReactDOM.hydrate(element, container) to ReactDOMClient.hydrateRoot(container, <App />).render(element) or remove the Suspense components from the server rendered components.");
            }
            workInProgress2.lanes = laneToLanes(SyncLane);
          } else if (isSuspenseInstanceFallback(suspenseInstance)) {
            workInProgress2.lanes = laneToLanes(DefaultHydrationLane);
          } else {
            workInProgress2.lanes = laneToLanes(OffscreenLane);
          }
          return null;
        }
        function updateDehydratedSuspenseComponent(current2, workInProgress2, didSuspend, nextProps, suspenseInstance, suspenseState, renderLanes2) {
          if (!didSuspend) {
            warnIfHydrating();
            if ((workInProgress2.mode & ConcurrentMode) === NoMode) {
              return retrySuspenseComponentWithoutHydrating(
                current2,
                workInProgress2,
                renderLanes2,
                // TODO: When we delete legacy mode, we should make this error argument
                // required — every concurrent mode path that causes hydration to
                // de-opt to client rendering should have an error message.
                null
              );
            }
            if (isSuspenseInstanceFallback(suspenseInstance)) {
              var digest, message, stack;
              {
                var _getSuspenseInstanceF = getSuspenseInstanceFallbackErrorDetails(suspenseInstance);
                digest = _getSuspenseInstanceF.digest;
                message = _getSuspenseInstanceF.message;
                stack = _getSuspenseInstanceF.stack;
              }
              var error2;
              if (message) {
                error2 = new Error(message);
              } else {
                error2 = new Error("The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering.");
              }
              var capturedValue = createCapturedValue(error2, digest, stack);
              return retrySuspenseComponentWithoutHydrating(current2, workInProgress2, renderLanes2, capturedValue);
            }
            var hasContextChanged2 = includesSomeLane(renderLanes2, current2.childLanes);
            if (didReceiveUpdate || hasContextChanged2) {
              var root2 = getWorkInProgressRoot();
              if (root2 !== null) {
                var attemptHydrationAtLane = getBumpedLaneForHydration(root2, renderLanes2);
                if (attemptHydrationAtLane !== NoLane && attemptHydrationAtLane !== suspenseState.retryLane) {
                  suspenseState.retryLane = attemptHydrationAtLane;
                  var eventTime = NoTimestamp;
                  enqueueConcurrentRenderForLane(current2, attemptHydrationAtLane);
                  scheduleUpdateOnFiber(root2, current2, attemptHydrationAtLane, eventTime);
                }
              }
              renderDidSuspendDelayIfPossible();
              var _capturedValue = createCapturedValue(new Error("This Suspense boundary received an update before it finished hydrating. This caused the boundary to switch to client rendering. The usual way to fix this is to wrap the original update in startTransition."));
              return retrySuspenseComponentWithoutHydrating(current2, workInProgress2, renderLanes2, _capturedValue);
            } else if (isSuspenseInstancePending(suspenseInstance)) {
              workInProgress2.flags |= DidCapture;
              workInProgress2.child = current2.child;
              var retry = retryDehydratedSuspenseBoundary.bind(null, current2);
              registerSuspenseInstanceRetry(suspenseInstance, retry);
              return null;
            } else {
              reenterHydrationStateFromDehydratedSuspenseInstance(workInProgress2, suspenseInstance, suspenseState.treeContext);
              var primaryChildren = nextProps.children;
              var primaryChildFragment = mountSuspensePrimaryChildren(workInProgress2, primaryChildren);
              primaryChildFragment.flags |= Hydrating;
              return primaryChildFragment;
            }
          } else {
            if (workInProgress2.flags & ForceClientRender) {
              workInProgress2.flags &= ~ForceClientRender;
              var _capturedValue2 = createCapturedValue(new Error("There was an error while hydrating this Suspense boundary. Switched to client rendering."));
              return retrySuspenseComponentWithoutHydrating(current2, workInProgress2, renderLanes2, _capturedValue2);
            } else if (workInProgress2.memoizedState !== null) {
              workInProgress2.child = current2.child;
              workInProgress2.flags |= DidCapture;
              return null;
            } else {
              var nextPrimaryChildren = nextProps.children;
              var nextFallbackChildren = nextProps.fallback;
              var fallbackChildFragment = mountSuspenseFallbackAfterRetryWithoutHydrating(current2, workInProgress2, nextPrimaryChildren, nextFallbackChildren, renderLanes2);
              var _primaryChildFragment4 = workInProgress2.child;
              _primaryChildFragment4.memoizedState = mountSuspenseOffscreenState(renderLanes2);
              workInProgress2.memoizedState = SUSPENDED_MARKER;
              return fallbackChildFragment;
            }
          }
        }
        function scheduleSuspenseWorkOnFiber(fiber, renderLanes2, propagationRoot) {
          fiber.lanes = mergeLanes(fiber.lanes, renderLanes2);
          var alternate = fiber.alternate;
          if (alternate !== null) {
            alternate.lanes = mergeLanes(alternate.lanes, renderLanes2);
          }
          scheduleContextWorkOnParentPath(fiber.return, renderLanes2, propagationRoot);
        }
        function propagateSuspenseContextChange(workInProgress2, firstChild, renderLanes2) {
          var node = firstChild;
          while (node !== null) {
            if (node.tag === SuspenseComponent) {
              var state = node.memoizedState;
              if (state !== null) {
                scheduleSuspenseWorkOnFiber(node, renderLanes2, workInProgress2);
              }
            } else if (node.tag === SuspenseListComponent) {
              scheduleSuspenseWorkOnFiber(node, renderLanes2, workInProgress2);
            } else if (node.child !== null) {
              node.child.return = node;
              node = node.child;
              continue;
            }
            if (node === workInProgress2) {
              return;
            }
            while (node.sibling === null) {
              if (node.return === null || node.return === workInProgress2) {
                return;
              }
              node = node.return;
            }
            node.sibling.return = node.return;
            node = node.sibling;
          }
        }
        function findLastContentRow(firstChild) {
          var row = firstChild;
          var lastContentRow = null;
          while (row !== null) {
            var currentRow = row.alternate;
            if (currentRow !== null && findFirstSuspended(currentRow) === null) {
              lastContentRow = row;
            }
            row = row.sibling;
          }
          return lastContentRow;
        }
        function validateRevealOrder(revealOrder) {
          {
            if (revealOrder !== void 0 && revealOrder !== "forwards" && revealOrder !== "backwards" && revealOrder !== "together" && !didWarnAboutRevealOrder[revealOrder]) {
              didWarnAboutRevealOrder[revealOrder] = true;
              if (typeof revealOrder === "string") {
                switch (revealOrder.toLowerCase()) {
                  case "together":
                  case "forwards":
                  case "backwards": {
                    error('"%s" is not a valid value for revealOrder on <SuspenseList />. Use lowercase "%s" instead.', revealOrder, revealOrder.toLowerCase());
                    break;
                  }
                  case "forward":
                  case "backward": {
                    error('"%s" is not a valid value for revealOrder on <SuspenseList />. React uses the -s suffix in the spelling. Use "%ss" instead.', revealOrder, revealOrder.toLowerCase());
                    break;
                  }
                  default:
                    error('"%s" is not a supported revealOrder on <SuspenseList />. Did you mean "together", "forwards" or "backwards"?', revealOrder);
                    break;
                }
              } else {
                error('%s is not a supported value for revealOrder on <SuspenseList />. Did you mean "together", "forwards" or "backwards"?', revealOrder);
              }
            }
          }
        }
        function validateTailOptions(tailMode, revealOrder) {
          {
            if (tailMode !== void 0 && !didWarnAboutTailOptions[tailMode]) {
              if (tailMode !== "collapsed" && tailMode !== "hidden") {
                didWarnAboutTailOptions[tailMode] = true;
                error('"%s" is not a supported value for tail on <SuspenseList />. Did you mean "collapsed" or "hidden"?', tailMode);
              } else if (revealOrder !== "forwards" && revealOrder !== "backwards") {
                didWarnAboutTailOptions[tailMode] = true;
                error('<SuspenseList tail="%s" /> is only valid if revealOrder is "forwards" or "backwards". Did you mean to specify revealOrder="forwards"?', tailMode);
              }
            }
          }
        }
        function validateSuspenseListNestedChild(childSlot, index2) {
          {
            var isAnArray = isArray(childSlot);
            var isIterable = !isAnArray && typeof getIteratorFn(childSlot) === "function";
            if (isAnArray || isIterable) {
              var type = isAnArray ? "array" : "iterable";
              error("A nested %s was passed to row #%s in <SuspenseList />. Wrap it in an additional SuspenseList to configure its revealOrder: <SuspenseList revealOrder=...> ... <SuspenseList revealOrder=...>{%s}</SuspenseList> ... </SuspenseList>", type, index2, type);
              return false;
            }
          }
          return true;
        }
        function validateSuspenseListChildren(children, revealOrder) {
          {
            if ((revealOrder === "forwards" || revealOrder === "backwards") && children !== void 0 && children !== null && children !== false) {
              if (isArray(children)) {
                for (var i2 = 0; i2 < children.length; i2++) {
                  if (!validateSuspenseListNestedChild(children[i2], i2)) {
                    return;
                  }
                }
              } else {
                var iteratorFn = getIteratorFn(children);
                if (typeof iteratorFn === "function") {
                  var childrenIterator = iteratorFn.call(children);
                  if (childrenIterator) {
                    var step = childrenIterator.next();
                    var _i = 0;
                    for (; !step.done; step = childrenIterator.next()) {
                      if (!validateSuspenseListNestedChild(step.value, _i)) {
                        return;
                      }
                      _i++;
                    }
                  }
                } else {
                  error('A single row was passed to a <SuspenseList revealOrder="%s" />. This is not useful since it needs multiple rows. Did you mean to pass multiple children or an array?', revealOrder);
                }
              }
            }
          }
        }
        function initSuspenseListRenderState(workInProgress2, isBackwards, tail, lastContentRow, tailMode) {
          var renderState = workInProgress2.memoizedState;
          if (renderState === null) {
            workInProgress2.memoizedState = {
              isBackwards,
              rendering: null,
              renderingStartTime: 0,
              last: lastContentRow,
              tail,
              tailMode
            };
          } else {
            renderState.isBackwards = isBackwards;
            renderState.rendering = null;
            renderState.renderingStartTime = 0;
            renderState.last = lastContentRow;
            renderState.tail = tail;
            renderState.tailMode = tailMode;
          }
        }
        function updateSuspenseListComponent(current2, workInProgress2, renderLanes2) {
          var nextProps = workInProgress2.pendingProps;
          var revealOrder = nextProps.revealOrder;
          var tailMode = nextProps.tail;
          var newChildren = nextProps.children;
          validateRevealOrder(revealOrder);
          validateTailOptions(tailMode, revealOrder);
          validateSuspenseListChildren(newChildren, revealOrder);
          reconcileChildren(current2, workInProgress2, newChildren, renderLanes2);
          var suspenseContext = suspenseStackCursor.current;
          var shouldForceFallback = hasSuspenseContext(suspenseContext, ForceSuspenseFallback);
          if (shouldForceFallback) {
            suspenseContext = setShallowSuspenseContext(suspenseContext, ForceSuspenseFallback);
            workInProgress2.flags |= DidCapture;
          } else {
            var didSuspendBefore = current2 !== null && (current2.flags & DidCapture) !== NoFlags;
            if (didSuspendBefore) {
              propagateSuspenseContextChange(workInProgress2, workInProgress2.child, renderLanes2);
            }
            suspenseContext = setDefaultShallowSuspenseContext(suspenseContext);
          }
          pushSuspenseContext(workInProgress2, suspenseContext);
          if ((workInProgress2.mode & ConcurrentMode) === NoMode) {
            workInProgress2.memoizedState = null;
          } else {
            switch (revealOrder) {
              case "forwards": {
                var lastContentRow = findLastContentRow(workInProgress2.child);
                var tail;
                if (lastContentRow === null) {
                  tail = workInProgress2.child;
                  workInProgress2.child = null;
                } else {
                  tail = lastContentRow.sibling;
                  lastContentRow.sibling = null;
                }
                initSuspenseListRenderState(
                  workInProgress2,
                  false,
                  // isBackwards
                  tail,
                  lastContentRow,
                  tailMode
                );
                break;
              }
              case "backwards": {
                var _tail = null;
                var row = workInProgress2.child;
                workInProgress2.child = null;
                while (row !== null) {
                  var currentRow = row.alternate;
                  if (currentRow !== null && findFirstSuspended(currentRow) === null) {
                    workInProgress2.child = row;
                    break;
                  }
                  var nextRow = row.sibling;
                  row.sibling = _tail;
                  _tail = row;
                  row = nextRow;
                }
                initSuspenseListRenderState(
                  workInProgress2,
                  true,
                  // isBackwards
                  _tail,
                  null,
                  // last
                  tailMode
                );
                break;
              }
              case "together": {
                initSuspenseListRenderState(
                  workInProgress2,
                  false,
                  // isBackwards
                  null,
                  // tail
                  null,
                  // last
                  void 0
                );
                break;
              }
              default: {
                workInProgress2.memoizedState = null;
              }
            }
          }
          return workInProgress2.child;
        }
        function updatePortalComponent(current2, workInProgress2, renderLanes2) {
          pushHostContainer(workInProgress2, workInProgress2.stateNode.containerInfo);
          var nextChildren = workInProgress2.pendingProps;
          if (current2 === null) {
            workInProgress2.child = reconcileChildFibers(workInProgress2, null, nextChildren, renderLanes2);
          } else {
            reconcileChildren(current2, workInProgress2, nextChildren, renderLanes2);
          }
          return workInProgress2.child;
        }
        var hasWarnedAboutUsingNoValuePropOnContextProvider = false;
        function updateContextProvider(current2, workInProgress2, renderLanes2) {
          var providerType = workInProgress2.type;
          var context = providerType._context;
          var newProps = workInProgress2.pendingProps;
          var oldProps = workInProgress2.memoizedProps;
          var newValue = newProps.value;
          {
            if (!("value" in newProps)) {
              if (!hasWarnedAboutUsingNoValuePropOnContextProvider) {
                hasWarnedAboutUsingNoValuePropOnContextProvider = true;
                error("The `value` prop is required for the `<Context.Provider>`. Did you misspell it or forget to pass it?");
              }
            }
            var providerPropTypes = workInProgress2.type.propTypes;
            if (providerPropTypes) {
              checkPropTypes(providerPropTypes, newProps, "prop", "Context.Provider");
            }
          }
          pushProvider(workInProgress2, context, newValue);
          {
            if (oldProps !== null) {
              var oldValue = oldProps.value;
              if (objectIs(oldValue, newValue)) {
                if (oldProps.children === newProps.children && !hasContextChanged()) {
                  return bailoutOnAlreadyFinishedWork(current2, workInProgress2, renderLanes2);
                }
              } else {
                propagateContextChange(workInProgress2, context, renderLanes2);
              }
            }
          }
          var newChildren = newProps.children;
          reconcileChildren(current2, workInProgress2, newChildren, renderLanes2);
          return workInProgress2.child;
        }
        var hasWarnedAboutUsingContextAsConsumer = false;
        function updateContextConsumer(current2, workInProgress2, renderLanes2) {
          var context = workInProgress2.type;
          {
            if (context._context === void 0) {
              if (context !== context.Consumer) {
                if (!hasWarnedAboutUsingContextAsConsumer) {
                  hasWarnedAboutUsingContextAsConsumer = true;
                  error("Rendering <Context> directly is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?");
                }
              }
            } else {
              context = context._context;
            }
          }
          var newProps = workInProgress2.pendingProps;
          var render3 = newProps.children;
          {
            if (typeof render3 !== "function") {
              error("A context consumer was rendered with multiple children, or a child that isn't a function. A context consumer expects a single child that is a function. If you did pass a function, make sure there is no trailing or leading whitespace around it.");
            }
          }
          prepareToReadContext(workInProgress2, renderLanes2);
          var newValue = readContext(context);
          {
            markComponentRenderStarted(workInProgress2);
          }
          var newChildren;
          {
            ReactCurrentOwner$1.current = workInProgress2;
            setIsRendering(true);
            newChildren = render3(newValue);
            setIsRendering(false);
          }
          {
            markComponentRenderStopped();
          }
          workInProgress2.flags |= PerformedWork;
          reconcileChildren(current2, workInProgress2, newChildren, renderLanes2);
          return workInProgress2.child;
        }
        function markWorkInProgressReceivedUpdate() {
          didReceiveUpdate = true;
        }
        function resetSuspendedCurrentOnMountInLegacyMode(current2, workInProgress2) {
          if ((workInProgress2.mode & ConcurrentMode) === NoMode) {
            if (current2 !== null) {
              current2.alternate = null;
              workInProgress2.alternate = null;
              workInProgress2.flags |= Placement;
            }
          }
        }
        function bailoutOnAlreadyFinishedWork(current2, workInProgress2, renderLanes2) {
          if (current2 !== null) {
            workInProgress2.dependencies = current2.dependencies;
          }
          {
            stopProfilerTimerIfRunning();
          }
          markSkippedUpdateLanes(workInProgress2.lanes);
          if (!includesSomeLane(renderLanes2, workInProgress2.childLanes)) {
            {
              return null;
            }
          }
          cloneChildFibers(current2, workInProgress2);
          return workInProgress2.child;
        }
        function remountFiber(current2, oldWorkInProgress, newWorkInProgress) {
          {
            var returnFiber = oldWorkInProgress.return;
            if (returnFiber === null) {
              throw new Error("Cannot swap the root fiber.");
            }
            current2.alternate = null;
            oldWorkInProgress.alternate = null;
            newWorkInProgress.index = oldWorkInProgress.index;
            newWorkInProgress.sibling = oldWorkInProgress.sibling;
            newWorkInProgress.return = oldWorkInProgress.return;
            newWorkInProgress.ref = oldWorkInProgress.ref;
            if (oldWorkInProgress === returnFiber.child) {
              returnFiber.child = newWorkInProgress;
            } else {
              var prevSibling = returnFiber.child;
              if (prevSibling === null) {
                throw new Error("Expected parent to have a child.");
              }
              while (prevSibling.sibling !== oldWorkInProgress) {
                prevSibling = prevSibling.sibling;
                if (prevSibling === null) {
                  throw new Error("Expected to find the previous sibling.");
                }
              }
              prevSibling.sibling = newWorkInProgress;
            }
            var deletions = returnFiber.deletions;
            if (deletions === null) {
              returnFiber.deletions = [current2];
              returnFiber.flags |= ChildDeletion;
            } else {
              deletions.push(current2);
            }
            newWorkInProgress.flags |= Placement;
            return newWorkInProgress;
          }
        }
        function checkScheduledUpdateOrContext(current2, renderLanes2) {
          var updateLanes = current2.lanes;
          if (includesSomeLane(updateLanes, renderLanes2)) {
            return true;
          }
          return false;
        }
        function attemptEarlyBailoutIfNoScheduledUpdate(current2, workInProgress2, renderLanes2) {
          switch (workInProgress2.tag) {
            case HostRoot:
              pushHostRootContext(workInProgress2);
              var root2 = workInProgress2.stateNode;
              resetHydrationState();
              break;
            case HostComponent:
              pushHostContext(workInProgress2);
              break;
            case ClassComponent: {
              var Component = workInProgress2.type;
              if (isContextProvider(Component)) {
                pushContextProvider(workInProgress2);
              }
              break;
            }
            case HostPortal:
              pushHostContainer(workInProgress2, workInProgress2.stateNode.containerInfo);
              break;
            case ContextProvider: {
              var newValue = workInProgress2.memoizedProps.value;
              var context = workInProgress2.type._context;
              pushProvider(workInProgress2, context, newValue);
              break;
            }
            case Profiler:
              {
                var hasChildWork = includesSomeLane(renderLanes2, workInProgress2.childLanes);
                if (hasChildWork) {
                  workInProgress2.flags |= Update;
                }
                {
                  var stateNode = workInProgress2.stateNode;
                  stateNode.effectDuration = 0;
                  stateNode.passiveEffectDuration = 0;
                }
              }
              break;
            case SuspenseComponent: {
              var state = workInProgress2.memoizedState;
              if (state !== null) {
                if (state.dehydrated !== null) {
                  pushSuspenseContext(workInProgress2, setDefaultShallowSuspenseContext(suspenseStackCursor.current));
                  workInProgress2.flags |= DidCapture;
                  return null;
                }
                var primaryChildFragment = workInProgress2.child;
                var primaryChildLanes = primaryChildFragment.childLanes;
                if (includesSomeLane(renderLanes2, primaryChildLanes)) {
                  return updateSuspenseComponent(current2, workInProgress2, renderLanes2);
                } else {
                  pushSuspenseContext(workInProgress2, setDefaultShallowSuspenseContext(suspenseStackCursor.current));
                  var child = bailoutOnAlreadyFinishedWork(current2, workInProgress2, renderLanes2);
                  if (child !== null) {
                    return child.sibling;
                  } else {
                    return null;
                  }
                }
              } else {
                pushSuspenseContext(workInProgress2, setDefaultShallowSuspenseContext(suspenseStackCursor.current));
              }
              break;
            }
            case SuspenseListComponent: {
              var didSuspendBefore = (current2.flags & DidCapture) !== NoFlags;
              var _hasChildWork = includesSomeLane(renderLanes2, workInProgress2.childLanes);
              if (didSuspendBefore) {
                if (_hasChildWork) {
                  return updateSuspenseListComponent(current2, workInProgress2, renderLanes2);
                }
                workInProgress2.flags |= DidCapture;
              }
              var renderState = workInProgress2.memoizedState;
              if (renderState !== null) {
                renderState.rendering = null;
                renderState.tail = null;
                renderState.lastEffect = null;
              }
              pushSuspenseContext(workInProgress2, suspenseStackCursor.current);
              if (_hasChildWork) {
                break;
              } else {
                return null;
              }
            }
            case OffscreenComponent:
            case LegacyHiddenComponent: {
              workInProgress2.lanes = NoLanes;
              return updateOffscreenComponent(current2, workInProgress2, renderLanes2);
            }
          }
          return bailoutOnAlreadyFinishedWork(current2, workInProgress2, renderLanes2);
        }
        function beginWork(current2, workInProgress2, renderLanes2) {
          {
            if (workInProgress2._debugNeedsRemount && current2 !== null) {
              return remountFiber(current2, workInProgress2, createFiberFromTypeAndProps(workInProgress2.type, workInProgress2.key, workInProgress2.pendingProps, workInProgress2._debugOwner || null, workInProgress2.mode, workInProgress2.lanes));
            }
          }
          if (current2 !== null) {
            var oldProps = current2.memoizedProps;
            var newProps = workInProgress2.pendingProps;
            if (oldProps !== newProps || hasContextChanged() || // Force a re-render if the implementation changed due to hot reload:
            workInProgress2.type !== current2.type) {
              didReceiveUpdate = true;
            } else {
              var hasScheduledUpdateOrContext = checkScheduledUpdateOrContext(current2, renderLanes2);
              if (!hasScheduledUpdateOrContext && // If this is the second pass of an error or suspense boundary, there
              // may not be work scheduled on `current`, so we check for this flag.
              (workInProgress2.flags & DidCapture) === NoFlags) {
                didReceiveUpdate = false;
                return attemptEarlyBailoutIfNoScheduledUpdate(current2, workInProgress2, renderLanes2);
              }
              if ((current2.flags & ForceUpdateForLegacySuspense) !== NoFlags) {
                didReceiveUpdate = true;
              } else {
                didReceiveUpdate = false;
              }
            }
          } else {
            didReceiveUpdate = false;
            if (getIsHydrating() && isForkedChild(workInProgress2)) {
              var slotIndex = workInProgress2.index;
              var numberOfForks = getForksAtLevel();
              pushTreeId(workInProgress2, numberOfForks, slotIndex);
            }
          }
          workInProgress2.lanes = NoLanes;
          switch (workInProgress2.tag) {
            case IndeterminateComponent: {
              return mountIndeterminateComponent(current2, workInProgress2, workInProgress2.type, renderLanes2);
            }
            case LazyComponent: {
              var elementType = workInProgress2.elementType;
              return mountLazyComponent(current2, workInProgress2, elementType, renderLanes2);
            }
            case FunctionComponent: {
              var Component = workInProgress2.type;
              var unresolvedProps = workInProgress2.pendingProps;
              var resolvedProps = workInProgress2.elementType === Component ? unresolvedProps : resolveDefaultProps(Component, unresolvedProps);
              return updateFunctionComponent(current2, workInProgress2, Component, resolvedProps, renderLanes2);
            }
            case ClassComponent: {
              var _Component = workInProgress2.type;
              var _unresolvedProps = workInProgress2.pendingProps;
              var _resolvedProps = workInProgress2.elementType === _Component ? _unresolvedProps : resolveDefaultProps(_Component, _unresolvedProps);
              return updateClassComponent(current2, workInProgress2, _Component, _resolvedProps, renderLanes2);
            }
            case HostRoot:
              return updateHostRoot(current2, workInProgress2, renderLanes2);
            case HostComponent:
              return updateHostComponent(current2, workInProgress2, renderLanes2);
            case HostText:
              return updateHostText(current2, workInProgress2);
            case SuspenseComponent:
              return updateSuspenseComponent(current2, workInProgress2, renderLanes2);
            case HostPortal:
              return updatePortalComponent(current2, workInProgress2, renderLanes2);
            case ForwardRef: {
              var type = workInProgress2.type;
              var _unresolvedProps2 = workInProgress2.pendingProps;
              var _resolvedProps2 = workInProgress2.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
              return updateForwardRef(current2, workInProgress2, type, _resolvedProps2, renderLanes2);
            }
            case Fragment27:
              return updateFragment(current2, workInProgress2, renderLanes2);
            case Mode:
              return updateMode(current2, workInProgress2, renderLanes2);
            case Profiler:
              return updateProfiler(current2, workInProgress2, renderLanes2);
            case ContextProvider:
              return updateContextProvider(current2, workInProgress2, renderLanes2);
            case ContextConsumer:
              return updateContextConsumer(current2, workInProgress2, renderLanes2);
            case MemoComponent: {
              var _type2 = workInProgress2.type;
              var _unresolvedProps3 = workInProgress2.pendingProps;
              var _resolvedProps3 = resolveDefaultProps(_type2, _unresolvedProps3);
              {
                if (workInProgress2.type !== workInProgress2.elementType) {
                  var outerPropTypes = _type2.propTypes;
                  if (outerPropTypes) {
                    checkPropTypes(
                      outerPropTypes,
                      _resolvedProps3,
                      // Resolved for outer only
                      "prop",
                      getComponentNameFromType(_type2)
                    );
                  }
                }
              }
              _resolvedProps3 = resolveDefaultProps(_type2.type, _resolvedProps3);
              return updateMemoComponent(current2, workInProgress2, _type2, _resolvedProps3, renderLanes2);
            }
            case SimpleMemoComponent: {
              return updateSimpleMemoComponent(current2, workInProgress2, workInProgress2.type, workInProgress2.pendingProps, renderLanes2);
            }
            case IncompleteClassComponent: {
              var _Component2 = workInProgress2.type;
              var _unresolvedProps4 = workInProgress2.pendingProps;
              var _resolvedProps4 = workInProgress2.elementType === _Component2 ? _unresolvedProps4 : resolveDefaultProps(_Component2, _unresolvedProps4);
              return mountIncompleteClassComponent(current2, workInProgress2, _Component2, _resolvedProps4, renderLanes2);
            }
            case SuspenseListComponent: {
              return updateSuspenseListComponent(current2, workInProgress2, renderLanes2);
            }
            case ScopeComponent: {
              break;
            }
            case OffscreenComponent: {
              return updateOffscreenComponent(current2, workInProgress2, renderLanes2);
            }
          }
          throw new Error("Unknown unit of work tag (" + workInProgress2.tag + "). This error is likely caused by a bug in React. Please file an issue.");
        }
        function markUpdate(workInProgress2) {
          workInProgress2.flags |= Update;
        }
        function markRef$1(workInProgress2) {
          workInProgress2.flags |= Ref;
          {
            workInProgress2.flags |= RefStatic;
          }
        }
        var appendAllChildren;
        var updateHostContainer;
        var updateHostComponent$1;
        var updateHostText$1;
        {
          appendAllChildren = function(parent, workInProgress2, needsVisibilityToggle, isHidden) {
            var node = workInProgress2.child;
            while (node !== null) {
              if (node.tag === HostComponent || node.tag === HostText) {
                appendInitialChild(parent, node.stateNode);
              } else if (node.tag === HostPortal)
                ;
              else if (node.child !== null) {
                node.child.return = node;
                node = node.child;
                continue;
              }
              if (node === workInProgress2) {
                return;
              }
              while (node.sibling === null) {
                if (node.return === null || node.return === workInProgress2) {
                  return;
                }
                node = node.return;
              }
              node.sibling.return = node.return;
              node = node.sibling;
            }
          };
          updateHostContainer = function(current2, workInProgress2) {
          };
          updateHostComponent$1 = function(current2, workInProgress2, type, newProps, rootContainerInstance) {
            var oldProps = current2.memoizedProps;
            if (oldProps === newProps) {
              return;
            }
            var instance = workInProgress2.stateNode;
            var currentHostContext = getHostContext();
            var updatePayload = prepareUpdate(instance, type, oldProps, newProps, rootContainerInstance, currentHostContext);
            workInProgress2.updateQueue = updatePayload;
            if (updatePayload) {
              markUpdate(workInProgress2);
            }
          };
          updateHostText$1 = function(current2, workInProgress2, oldText, newText) {
            if (oldText !== newText) {
              markUpdate(workInProgress2);
            }
          };
        }
        function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) {
          if (getIsHydrating()) {
            return;
          }
          switch (renderState.tailMode) {
            case "hidden": {
              var tailNode = renderState.tail;
              var lastTailNode = null;
              while (tailNode !== null) {
                if (tailNode.alternate !== null) {
                  lastTailNode = tailNode;
                }
                tailNode = tailNode.sibling;
              }
              if (lastTailNode === null) {
                renderState.tail = null;
              } else {
                lastTailNode.sibling = null;
              }
              break;
            }
            case "collapsed": {
              var _tailNode = renderState.tail;
              var _lastTailNode = null;
              while (_tailNode !== null) {
                if (_tailNode.alternate !== null) {
                  _lastTailNode = _tailNode;
                }
                _tailNode = _tailNode.sibling;
              }
              if (_lastTailNode === null) {
                if (!hasRenderedATailFallback && renderState.tail !== null) {
                  renderState.tail.sibling = null;
                } else {
                  renderState.tail = null;
                }
              } else {
                _lastTailNode.sibling = null;
              }
              break;
            }
          }
        }
        function bubbleProperties(completedWork) {
          var didBailout = completedWork.alternate !== null && completedWork.alternate.child === completedWork.child;
          var newChildLanes = NoLanes;
          var subtreeFlags = NoFlags;
          if (!didBailout) {
            if ((completedWork.mode & ProfileMode) !== NoMode) {
              var actualDuration = completedWork.actualDuration;
              var treeBaseDuration = completedWork.selfBaseDuration;
              var child = completedWork.child;
              while (child !== null) {
                newChildLanes = mergeLanes(newChildLanes, mergeLanes(child.lanes, child.childLanes));
                subtreeFlags |= child.subtreeFlags;
                subtreeFlags |= child.flags;
                actualDuration += child.actualDuration;
                treeBaseDuration += child.treeBaseDuration;
                child = child.sibling;
              }
              completedWork.actualDuration = actualDuration;
              completedWork.treeBaseDuration = treeBaseDuration;
            } else {
              var _child = completedWork.child;
              while (_child !== null) {
                newChildLanes = mergeLanes(newChildLanes, mergeLanes(_child.lanes, _child.childLanes));
                subtreeFlags |= _child.subtreeFlags;
                subtreeFlags |= _child.flags;
                _child.return = completedWork;
                _child = _child.sibling;
              }
            }
            completedWork.subtreeFlags |= subtreeFlags;
          } else {
            if ((completedWork.mode & ProfileMode) !== NoMode) {
              var _treeBaseDuration = completedWork.selfBaseDuration;
              var _child2 = completedWork.child;
              while (_child2 !== null) {
                newChildLanes = mergeLanes(newChildLanes, mergeLanes(_child2.lanes, _child2.childLanes));
                subtreeFlags |= _child2.subtreeFlags & StaticMask;
                subtreeFlags |= _child2.flags & StaticMask;
                _treeBaseDuration += _child2.treeBaseDuration;
                _child2 = _child2.sibling;
              }
              completedWork.treeBaseDuration = _treeBaseDuration;
            } else {
              var _child3 = completedWork.child;
              while (_child3 !== null) {
                newChildLanes = mergeLanes(newChildLanes, mergeLanes(_child3.lanes, _child3.childLanes));
                subtreeFlags |= _child3.subtreeFlags & StaticMask;
                subtreeFlags |= _child3.flags & StaticMask;
                _child3.return = completedWork;
                _child3 = _child3.sibling;
              }
            }
            completedWork.subtreeFlags |= subtreeFlags;
          }
          completedWork.childLanes = newChildLanes;
          return didBailout;
        }
        function completeDehydratedSuspenseBoundary(current2, workInProgress2, nextState) {
          if (hasUnhydratedTailNodes() && (workInProgress2.mode & ConcurrentMode) !== NoMode && (workInProgress2.flags & DidCapture) === NoFlags) {
            warnIfUnhydratedTailNodes(workInProgress2);
            resetHydrationState();
            workInProgress2.flags |= ForceClientRender | Incomplete | ShouldCapture;
            return false;
          }
          var wasHydrated = popHydrationState(workInProgress2);
          if (nextState !== null && nextState.dehydrated !== null) {
            if (current2 === null) {
              if (!wasHydrated) {
                throw new Error("A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React.");
              }
              prepareToHydrateHostSuspenseInstance(workInProgress2);
              bubbleProperties(workInProgress2);
              {
                if ((workInProgress2.mode & ProfileMode) !== NoMode) {
                  var isTimedOutSuspense = nextState !== null;
                  if (isTimedOutSuspense) {
                    var primaryChildFragment = workInProgress2.child;
                    if (primaryChildFragment !== null) {
                      workInProgress2.treeBaseDuration -= primaryChildFragment.treeBaseDuration;
                    }
                  }
                }
              }
              return false;
            } else {
              resetHydrationState();
              if ((workInProgress2.flags & DidCapture) === NoFlags) {
                workInProgress2.memoizedState = null;
              }
              workInProgress2.flags |= Update;
              bubbleProperties(workInProgress2);
              {
                if ((workInProgress2.mode & ProfileMode) !== NoMode) {
                  var _isTimedOutSuspense = nextState !== null;
                  if (_isTimedOutSuspense) {
                    var _primaryChildFragment = workInProgress2.child;
                    if (_primaryChildFragment !== null) {
                      workInProgress2.treeBaseDuration -= _primaryChildFragment.treeBaseDuration;
                    }
                  }
                }
              }
              return false;
            }
          } else {
            upgradeHydrationErrorsToRecoverable();
            return true;
          }
        }
        function completeWork(current2, workInProgress2, renderLanes2) {
          var newProps = workInProgress2.pendingProps;
          popTreeContext(workInProgress2);
          switch (workInProgress2.tag) {
            case IndeterminateComponent:
            case LazyComponent:
            case SimpleMemoComponent:
            case FunctionComponent:
            case ForwardRef:
            case Fragment27:
            case Mode:
            case Profiler:
            case ContextConsumer:
            case MemoComponent:
              bubbleProperties(workInProgress2);
              return null;
            case ClassComponent: {
              var Component = workInProgress2.type;
              if (isContextProvider(Component)) {
                popContext(workInProgress2);
              }
              bubbleProperties(workInProgress2);
              return null;
            }
            case HostRoot: {
              var fiberRoot = workInProgress2.stateNode;
              popHostContainer(workInProgress2);
              popTopLevelContextObject(workInProgress2);
              resetWorkInProgressVersions();
              if (fiberRoot.pendingContext) {
                fiberRoot.context = fiberRoot.pendingContext;
                fiberRoot.pendingContext = null;
              }
              if (current2 === null || current2.child === null) {
                var wasHydrated = popHydrationState(workInProgress2);
                if (wasHydrated) {
                  markUpdate(workInProgress2);
                } else {
                  if (current2 !== null) {
                    var prevState = current2.memoizedState;
                    if (
                      // Check if this is a client root
                      !prevState.isDehydrated || // Check if we reverted to client rendering (e.g. due to an error)
                      (workInProgress2.flags & ForceClientRender) !== NoFlags
                    ) {
                      workInProgress2.flags |= Snapshot;
                      upgradeHydrationErrorsToRecoverable();
                    }
                  }
                }
              }
              updateHostContainer(current2, workInProgress2);
              bubbleProperties(workInProgress2);
              return null;
            }
            case HostComponent: {
              popHostContext(workInProgress2);
              var rootContainerInstance = getRootHostContainer();
              var type = workInProgress2.type;
              if (current2 !== null && workInProgress2.stateNode != null) {
                updateHostComponent$1(current2, workInProgress2, type, newProps, rootContainerInstance);
                if (current2.ref !== workInProgress2.ref) {
                  markRef$1(workInProgress2);
                }
              } else {
                if (!newProps) {
                  if (workInProgress2.stateNode === null) {
                    throw new Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.");
                  }
                  bubbleProperties(workInProgress2);
                  return null;
                }
                var currentHostContext = getHostContext();
                var _wasHydrated = popHydrationState(workInProgress2);
                if (_wasHydrated) {
                  if (prepareToHydrateHostInstance(workInProgress2, rootContainerInstance, currentHostContext)) {
                    markUpdate(workInProgress2);
                  }
                } else {
                  var instance = createInstance(type, newProps, rootContainerInstance, currentHostContext, workInProgress2);
                  appendAllChildren(instance, workInProgress2, false, false);
                  workInProgress2.stateNode = instance;
                  if (finalizeInitialChildren(instance, type, newProps, rootContainerInstance)) {
                    markUpdate(workInProgress2);
                  }
                }
                if (workInProgress2.ref !== null) {
                  markRef$1(workInProgress2);
                }
              }
              bubbleProperties(workInProgress2);
              return null;
            }
            case HostText: {
              var newText = newProps;
              if (current2 && workInProgress2.stateNode != null) {
                var oldText = current2.memoizedProps;
                updateHostText$1(current2, workInProgress2, oldText, newText);
              } else {
                if (typeof newText !== "string") {
                  if (workInProgress2.stateNode === null) {
                    throw new Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.");
                  }
                }
                var _rootContainerInstance = getRootHostContainer();
                var _currentHostContext = getHostContext();
                var _wasHydrated2 = popHydrationState(workInProgress2);
                if (_wasHydrated2) {
                  if (prepareToHydrateHostTextInstance(workInProgress2)) {
                    markUpdate(workInProgress2);
                  }
                } else {
                  workInProgress2.stateNode = createTextInstance(newText, _rootContainerInstance, _currentHostContext, workInProgress2);
                }
              }
              bubbleProperties(workInProgress2);
              return null;
            }
            case SuspenseComponent: {
              popSuspenseContext(workInProgress2);
              var nextState = workInProgress2.memoizedState;
              if (current2 === null || current2.memoizedState !== null && current2.memoizedState.dehydrated !== null) {
                var fallthroughToNormalSuspensePath = completeDehydratedSuspenseBoundary(current2, workInProgress2, nextState);
                if (!fallthroughToNormalSuspensePath) {
                  if (workInProgress2.flags & ShouldCapture) {
                    return workInProgress2;
                  } else {
                    return null;
                  }
                }
              }
              if ((workInProgress2.flags & DidCapture) !== NoFlags) {
                workInProgress2.lanes = renderLanes2;
                if ((workInProgress2.mode & ProfileMode) !== NoMode) {
                  transferActualDuration(workInProgress2);
                }
                return workInProgress2;
              }
              var nextDidTimeout = nextState !== null;
              var prevDidTimeout = current2 !== null && current2.memoizedState !== null;
              if (nextDidTimeout !== prevDidTimeout) {
                if (nextDidTimeout) {
                  var _offscreenFiber2 = workInProgress2.child;
                  _offscreenFiber2.flags |= Visibility;
                  if ((workInProgress2.mode & ConcurrentMode) !== NoMode) {
                    var hasInvisibleChildContext = current2 === null && (workInProgress2.memoizedProps.unstable_avoidThisFallback !== true || !enableSuspenseAvoidThisFallback);
                    if (hasInvisibleChildContext || hasSuspenseContext(suspenseStackCursor.current, InvisibleParentSuspenseContext)) {
                      renderDidSuspend();
                    } else {
                      renderDidSuspendDelayIfPossible();
                    }
                  }
                }
              }
              var wakeables = workInProgress2.updateQueue;
              if (wakeables !== null) {
                workInProgress2.flags |= Update;
              }
              bubbleProperties(workInProgress2);
              {
                if ((workInProgress2.mode & ProfileMode) !== NoMode) {
                  if (nextDidTimeout) {
                    var primaryChildFragment = workInProgress2.child;
                    if (primaryChildFragment !== null) {
                      workInProgress2.treeBaseDuration -= primaryChildFragment.treeBaseDuration;
                    }
                  }
                }
              }
              return null;
            }
            case HostPortal:
              popHostContainer(workInProgress2);
              updateHostContainer(current2, workInProgress2);
              if (current2 === null) {
                preparePortalMount(workInProgress2.stateNode.containerInfo);
              }
              bubbleProperties(workInProgress2);
              return null;
            case ContextProvider:
              var context = workInProgress2.type._context;
              popProvider(context, workInProgress2);
              bubbleProperties(workInProgress2);
              return null;
            case IncompleteClassComponent: {
              var _Component = workInProgress2.type;
              if (isContextProvider(_Component)) {
                popContext(workInProgress2);
              }
              bubbleProperties(workInProgress2);
              return null;
            }
            case SuspenseListComponent: {
              popSuspenseContext(workInProgress2);
              var renderState = workInProgress2.memoizedState;
              if (renderState === null) {
                bubbleProperties(workInProgress2);
                return null;
              }
              var didSuspendAlready = (workInProgress2.flags & DidCapture) !== NoFlags;
              var renderedTail = renderState.rendering;
              if (renderedTail === null) {
                if (!didSuspendAlready) {
                  var cannotBeSuspended = renderHasNotSuspendedYet() && (current2 === null || (current2.flags & DidCapture) === NoFlags);
                  if (!cannotBeSuspended) {
                    var row = workInProgress2.child;
                    while (row !== null) {
                      var suspended = findFirstSuspended(row);
                      if (suspended !== null) {
                        didSuspendAlready = true;
                        workInProgress2.flags |= DidCapture;
                        cutOffTailIfNeeded(renderState, false);
                        var newThenables = suspended.updateQueue;
                        if (newThenables !== null) {
                          workInProgress2.updateQueue = newThenables;
                          workInProgress2.flags |= Update;
                        }
                        workInProgress2.subtreeFlags = NoFlags;
                        resetChildFibers(workInProgress2, renderLanes2);
                        pushSuspenseContext(workInProgress2, setShallowSuspenseContext(suspenseStackCursor.current, ForceSuspenseFallback));
                        return workInProgress2.child;
                      }
                      row = row.sibling;
                    }
                  }
                  if (renderState.tail !== null && now() > getRenderTargetTime()) {
                    workInProgress2.flags |= DidCapture;
                    didSuspendAlready = true;
                    cutOffTailIfNeeded(renderState, false);
                    workInProgress2.lanes = SomeRetryLane;
                  }
                } else {
                  cutOffTailIfNeeded(renderState, false);
                }
              } else {
                if (!didSuspendAlready) {
                  var _suspended = findFirstSuspended(renderedTail);
                  if (_suspended !== null) {
                    workInProgress2.flags |= DidCapture;
                    didSuspendAlready = true;
                    var _newThenables = _suspended.updateQueue;
                    if (_newThenables !== null) {
                      workInProgress2.updateQueue = _newThenables;
                      workInProgress2.flags |= Update;
                    }
                    cutOffTailIfNeeded(renderState, true);
                    if (renderState.tail === null && renderState.tailMode === "hidden" && !renderedTail.alternate && !getIsHydrating()) {
                      bubbleProperties(workInProgress2);
                      return null;
                    }
                  } else if (
                    // The time it took to render last row is greater than the remaining
                    // time we have to render. So rendering one more row would likely
                    // exceed it.
                    now() * 2 - renderState.renderingStartTime > getRenderTargetTime() && renderLanes2 !== OffscreenLane
                  ) {
                    workInProgress2.flags |= DidCapture;
                    didSuspendAlready = true;
                    cutOffTailIfNeeded(renderState, false);
                    workInProgress2.lanes = SomeRetryLane;
                  }
                }
                if (renderState.isBackwards) {
                  renderedTail.sibling = workInProgress2.child;
                  workInProgress2.child = renderedTail;
                } else {
                  var previousSibling = renderState.last;
                  if (previousSibling !== null) {
                    previousSibling.sibling = renderedTail;
                  } else {
                    workInProgress2.child = renderedTail;
                  }
                  renderState.last = renderedTail;
                }
              }
              if (renderState.tail !== null) {
                var next = renderState.tail;
                renderState.rendering = next;
                renderState.tail = next.sibling;
                renderState.renderingStartTime = now();
                next.sibling = null;
                var suspenseContext = suspenseStackCursor.current;
                if (didSuspendAlready) {
                  suspenseContext = setShallowSuspenseContext(suspenseContext, ForceSuspenseFallback);
                } else {
                  suspenseContext = setDefaultShallowSuspenseContext(suspenseContext);
                }
                pushSuspenseContext(workInProgress2, suspenseContext);
                return next;
              }
              bubbleProperties(workInProgress2);
              return null;
            }
            case ScopeComponent: {
              break;
            }
            case OffscreenComponent:
            case LegacyHiddenComponent: {
              popRenderLanes(workInProgress2);
              var _nextState = workInProgress2.memoizedState;
              var nextIsHidden = _nextState !== null;
              if (current2 !== null) {
                var _prevState = current2.memoizedState;
                var prevIsHidden = _prevState !== null;
                if (prevIsHidden !== nextIsHidden && // LegacyHidden doesn't do any hiding — it only pre-renders.
                !enableLegacyHidden) {
                  workInProgress2.flags |= Visibility;
                }
              }
              if (!nextIsHidden || (workInProgress2.mode & ConcurrentMode) === NoMode) {
                bubbleProperties(workInProgress2);
              } else {
                if (includesSomeLane(subtreeRenderLanes, OffscreenLane)) {
                  bubbleProperties(workInProgress2);
                  {
                    if (workInProgress2.subtreeFlags & (Placement | Update)) {
                      workInProgress2.flags |= Visibility;
                    }
                  }
                }
              }
              return null;
            }
            case CacheComponent: {
              return null;
            }
            case TracingMarkerComponent: {
              return null;
            }
          }
          throw new Error("Unknown unit of work tag (" + workInProgress2.tag + "). This error is likely caused by a bug in React. Please file an issue.");
        }
        function unwindWork(current2, workInProgress2, renderLanes2) {
          popTreeContext(workInProgress2);
          switch (workInProgress2.tag) {
            case ClassComponent: {
              var Component = workInProgress2.type;
              if (isContextProvider(Component)) {
                popContext(workInProgress2);
              }
              var flags = workInProgress2.flags;
              if (flags & ShouldCapture) {
                workInProgress2.flags = flags & ~ShouldCapture | DidCapture;
                if ((workInProgress2.mode & ProfileMode) !== NoMode) {
                  transferActualDuration(workInProgress2);
                }
                return workInProgress2;
              }
              return null;
            }
            case HostRoot: {
              var root2 = workInProgress2.stateNode;
              popHostContainer(workInProgress2);
              popTopLevelContextObject(workInProgress2);
              resetWorkInProgressVersions();
              var _flags = workInProgress2.flags;
              if ((_flags & ShouldCapture) !== NoFlags && (_flags & DidCapture) === NoFlags) {
                workInProgress2.flags = _flags & ~ShouldCapture | DidCapture;
                return workInProgress2;
              }
              return null;
            }
            case HostComponent: {
              popHostContext(workInProgress2);
              return null;
            }
            case SuspenseComponent: {
              popSuspenseContext(workInProgress2);
              var suspenseState = workInProgress2.memoizedState;
              if (suspenseState !== null && suspenseState.dehydrated !== null) {
                if (workInProgress2.alternate === null) {
                  throw new Error("Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue.");
                }
                resetHydrationState();
              }
              var _flags2 = workInProgress2.flags;
              if (_flags2 & ShouldCapture) {
                workInProgress2.flags = _flags2 & ~ShouldCapture | DidCapture;
                if ((workInProgress2.mode & ProfileMode) !== NoMode) {
                  transferActualDuration(workInProgress2);
                }
                return workInProgress2;
              }
              return null;
            }
            case SuspenseListComponent: {
              popSuspenseContext(workInProgress2);
              return null;
            }
            case HostPortal:
              popHostContainer(workInProgress2);
              return null;
            case ContextProvider:
              var context = workInProgress2.type._context;
              popProvider(context, workInProgress2);
              return null;
            case OffscreenComponent:
            case LegacyHiddenComponent:
              popRenderLanes(workInProgress2);
              return null;
            case CacheComponent:
              return null;
            default:
              return null;
          }
        }
        function unwindInterruptedWork(current2, interruptedWork, renderLanes2) {
          popTreeContext(interruptedWork);
          switch (interruptedWork.tag) {
            case ClassComponent: {
              var childContextTypes = interruptedWork.type.childContextTypes;
              if (childContextTypes !== null && childContextTypes !== void 0) {
                popContext(interruptedWork);
              }
              break;
            }
            case HostRoot: {
              var root2 = interruptedWork.stateNode;
              popHostContainer(interruptedWork);
              popTopLevelContextObject(interruptedWork);
              resetWorkInProgressVersions();
              break;
            }
            case HostComponent: {
              popHostContext(interruptedWork);
              break;
            }
            case HostPortal:
              popHostContainer(interruptedWork);
              break;
            case SuspenseComponent:
              popSuspenseContext(interruptedWork);
              break;
            case SuspenseListComponent:
              popSuspenseContext(interruptedWork);
              break;
            case ContextProvider:
              var context = interruptedWork.type._context;
              popProvider(context, interruptedWork);
              break;
            case OffscreenComponent:
            case LegacyHiddenComponent:
              popRenderLanes(interruptedWork);
              break;
          }
        }
        var didWarnAboutUndefinedSnapshotBeforeUpdate = null;
        {
          didWarnAboutUndefinedSnapshotBeforeUpdate = /* @__PURE__ */ new Set();
        }
        var offscreenSubtreeIsHidden = false;
        var offscreenSubtreeWasHidden = false;
        var PossiblyWeakSet = typeof WeakSet === "function" ? WeakSet : Set;
        var nextEffect = null;
        var inProgressLanes = null;
        var inProgressRoot = null;
        function reportUncaughtErrorInDEV(error2) {
          {
            invokeGuardedCallback(null, function() {
              throw error2;
            });
            clearCaughtError();
          }
        }
        var callComponentWillUnmountWithTimer = function(current2, instance) {
          instance.props = current2.memoizedProps;
          instance.state = current2.memoizedState;
          if (current2.mode & ProfileMode) {
            try {
              startLayoutEffectTimer();
              instance.componentWillUnmount();
            } finally {
              recordLayoutEffectDuration(current2);
            }
          } else {
            instance.componentWillUnmount();
          }
        };
        function safelyCallCommitHookLayoutEffectListMount(current2, nearestMountedAncestor) {
          try {
            commitHookEffectListMount(Layout, current2);
          } catch (error2) {
            captureCommitPhaseError(current2, nearestMountedAncestor, error2);
          }
        }
        function safelyCallComponentWillUnmount(current2, nearestMountedAncestor, instance) {
          try {
            callComponentWillUnmountWithTimer(current2, instance);
          } catch (error2) {
            captureCommitPhaseError(current2, nearestMountedAncestor, error2);
          }
        }
        function safelyCallComponentDidMount(current2, nearestMountedAncestor, instance) {
          try {
            instance.componentDidMount();
          } catch (error2) {
            captureCommitPhaseError(current2, nearestMountedAncestor, error2);
          }
        }
        function safelyAttachRef(current2, nearestMountedAncestor) {
          try {
            commitAttachRef(current2);
          } catch (error2) {
            captureCommitPhaseError(current2, nearestMountedAncestor, error2);
          }
        }
        function safelyDetachRef(current2, nearestMountedAncestor) {
          var ref = current2.ref;
          if (ref !== null) {
            if (typeof ref === "function") {
              var retVal;
              try {
                if (enableProfilerTimer && enableProfilerCommitHooks && current2.mode & ProfileMode) {
                  try {
                    startLayoutEffectTimer();
                    retVal = ref(null);
                  } finally {
                    recordLayoutEffectDuration(current2);
                  }
                } else {
                  retVal = ref(null);
                }
              } catch (error2) {
                captureCommitPhaseError(current2, nearestMountedAncestor, error2);
              }
              {
                if (typeof retVal === "function") {
                  error("Unexpected return value from a callback ref in %s. A callback ref should not return a function.", getComponentNameFromFiber(current2));
                }
              }
            } else {
              ref.current = null;
            }
          }
        }
        function safelyCallDestroy(current2, nearestMountedAncestor, destroy) {
          try {
            destroy();
          } catch (error2) {
            captureCommitPhaseError(current2, nearestMountedAncestor, error2);
          }
        }
        var focusedInstanceHandle = null;
        var shouldFireAfterActiveInstanceBlur = false;
        function commitBeforeMutationEffects(root2, firstChild) {
          focusedInstanceHandle = prepareForCommit(root2.containerInfo);
          nextEffect = firstChild;
          commitBeforeMutationEffects_begin();
          var shouldFire = shouldFireAfterActiveInstanceBlur;
          shouldFireAfterActiveInstanceBlur = false;
          focusedInstanceHandle = null;
          return shouldFire;
        }
        function commitBeforeMutationEffects_begin() {
          while (nextEffect !== null) {
            var fiber = nextEffect;
            var child = fiber.child;
            if ((fiber.subtreeFlags & BeforeMutationMask) !== NoFlags && child !== null) {
              child.return = fiber;
              nextEffect = child;
            } else {
              commitBeforeMutationEffects_complete();
            }
          }
        }
        function commitBeforeMutationEffects_complete() {
          while (nextEffect !== null) {
            var fiber = nextEffect;
            setCurrentFiber(fiber);
            try {
              commitBeforeMutationEffectsOnFiber(fiber);
            } catch (error2) {
              captureCommitPhaseError(fiber, fiber.return, error2);
            }
            resetCurrentFiber();
            var sibling = fiber.sibling;
            if (sibling !== null) {
              sibling.return = fiber.return;
              nextEffect = sibling;
              return;
            }
            nextEffect = fiber.return;
          }
        }
        function commitBeforeMutationEffectsOnFiber(finishedWork) {
          var current2 = finishedWork.alternate;
          var flags = finishedWork.flags;
          if ((flags & Snapshot) !== NoFlags) {
            setCurrentFiber(finishedWork);
            switch (finishedWork.tag) {
              case FunctionComponent:
              case ForwardRef:
              case SimpleMemoComponent: {
                break;
              }
              case ClassComponent: {
                if (current2 !== null) {
                  var prevProps = current2.memoizedProps;
                  var prevState = current2.memoizedState;
                  var instance = finishedWork.stateNode;
                  {
                    if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
                      if (instance.props !== finishedWork.memoizedProps) {
                        error("Expected %s props to match memoized props before getSnapshotBeforeUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.", getComponentNameFromFiber(finishedWork) || "instance");
                      }
                      if (instance.state !== finishedWork.memoizedState) {
                        error("Expected %s state to match memoized state before getSnapshotBeforeUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.", getComponentNameFromFiber(finishedWork) || "instance");
                      }
                    }
                  }
                  var snapshot = instance.getSnapshotBeforeUpdate(finishedWork.elementType === finishedWork.type ? prevProps : resolveDefaultProps(finishedWork.type, prevProps), prevState);
                  {
                    var didWarnSet = didWarnAboutUndefinedSnapshotBeforeUpdate;
                    if (snapshot === void 0 && !didWarnSet.has(finishedWork.type)) {
                      didWarnSet.add(finishedWork.type);
                      error("%s.getSnapshotBeforeUpdate(): A snapshot value (or null) must be returned. You have returned undefined.", getComponentNameFromFiber(finishedWork));
                    }
                  }
                  instance.__reactInternalSnapshotBeforeUpdate = snapshot;
                }
                break;
              }
              case HostRoot: {
                {
                  var root2 = finishedWork.stateNode;
                  clearContainer(root2.containerInfo);
                }
                break;
              }
              case HostComponent:
              case HostText:
              case HostPortal:
              case IncompleteClassComponent:
                break;
              default: {
                throw new Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.");
              }
            }
            resetCurrentFiber();
          }
        }
        function commitHookEffectListUnmount(flags, finishedWork, nearestMountedAncestor) {
          var updateQueue = finishedWork.updateQueue;
          var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null;
          if (lastEffect !== null) {
            var firstEffect = lastEffect.next;
            var effect = firstEffect;
            do {
              if ((effect.tag & flags) === flags) {
                var destroy = effect.destroy;
                effect.destroy = void 0;
                if (destroy !== void 0) {
                  {
                    if ((flags & Passive$1) !== NoFlags$1) {
                      markComponentPassiveEffectUnmountStarted(finishedWork);
                    } else if ((flags & Layout) !== NoFlags$1) {
                      markComponentLayoutEffectUnmountStarted(finishedWork);
                    }
                  }
                  {
                    if ((flags & Insertion) !== NoFlags$1) {
                      setIsRunningInsertionEffect(true);
                    }
                  }
                  safelyCallDestroy(finishedWork, nearestMountedAncestor, destroy);
                  {
                    if ((flags & Insertion) !== NoFlags$1) {
                      setIsRunningInsertionEffect(false);
                    }
                  }
                  {
                    if ((flags & Passive$1) !== NoFlags$1) {
                      markComponentPassiveEffectUnmountStopped();
                    } else if ((flags & Layout) !== NoFlags$1) {
                      markComponentLayoutEffectUnmountStopped();
                    }
                  }
                }
              }
              effect = effect.next;
            } while (effect !== firstEffect);
          }
        }
        function commitHookEffectListMount(flags, finishedWork) {
          var updateQueue = finishedWork.updateQueue;
          var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null;
          if (lastEffect !== null) {
            var firstEffect = lastEffect.next;
            var effect = firstEffect;
            do {
              if ((effect.tag & flags) === flags) {
                {
                  if ((flags & Passive$1) !== NoFlags$1) {
                    markComponentPassiveEffectMountStarted(finishedWork);
                  } else if ((flags & Layout) !== NoFlags$1) {
                    markComponentLayoutEffectMountStarted(finishedWork);
                  }
                }
                var create = effect.create;
                {
                  if ((flags & Insertion) !== NoFlags$1) {
                    setIsRunningInsertionEffect(true);
                  }
                }
                effect.destroy = create();
                {
                  if ((flags & Insertion) !== NoFlags$1) {
                    setIsRunningInsertionEffect(false);
                  }
                }
                {
                  if ((flags & Passive$1) !== NoFlags$1) {
                    markComponentPassiveEffectMountStopped();
                  } else if ((flags & Layout) !== NoFlags$1) {
                    markComponentLayoutEffectMountStopped();
                  }
                }
                {
                  var destroy = effect.destroy;
                  if (destroy !== void 0 && typeof destroy !== "function") {
                    var hookName = void 0;
                    if ((effect.tag & Layout) !== NoFlags) {
                      hookName = "useLayoutEffect";
                    } else if ((effect.tag & Insertion) !== NoFlags) {
                      hookName = "useInsertionEffect";
                    } else {
                      hookName = "useEffect";
                    }
                    var addendum = void 0;
                    if (destroy === null) {
                      addendum = " You returned null. If your effect does not require clean up, return undefined (or nothing).";
                    } else if (typeof destroy.then === "function") {
                      addendum = "\n\nIt looks like you wrote " + hookName + "(async () => ...) or returned a Promise. Instead, write the async function inside your effect and call it immediately:\n\n" + hookName + "(() => {\n  async function fetchData() {\n    // You can await here\n    const response = await MyAPI.getData(someId);\n    // ...\n  }\n  fetchData();\n}, [someId]); // Or [] if effect doesn't need props or state\n\nLearn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching";
                    } else {
                      addendum = " You returned: " + destroy;
                    }
                    error("%s must not return anything besides a function, which is used for clean-up.%s", hookName, addendum);
                  }
                }
              }
              effect = effect.next;
            } while (effect !== firstEffect);
          }
        }
        function commitPassiveEffectDurations(finishedRoot, finishedWork) {
          {
            if ((finishedWork.flags & Update) !== NoFlags) {
              switch (finishedWork.tag) {
                case Profiler: {
                  var passiveEffectDuration = finishedWork.stateNode.passiveEffectDuration;
                  var _finishedWork$memoize = finishedWork.memoizedProps, id2 = _finishedWork$memoize.id, onPostCommit = _finishedWork$memoize.onPostCommit;
                  var commitTime2 = getCommitTime();
                  var phase = finishedWork.alternate === null ? "mount" : "update";
                  {
                    if (isCurrentUpdateNested()) {
                      phase = "nested-update";
                    }
                  }
                  if (typeof onPostCommit === "function") {
                    onPostCommit(id2, phase, passiveEffectDuration, commitTime2);
                  }
                  var parentFiber = finishedWork.return;
                  outer:
                    while (parentFiber !== null) {
                      switch (parentFiber.tag) {
                        case HostRoot:
                          var root2 = parentFiber.stateNode;
                          root2.passiveEffectDuration += passiveEffectDuration;
                          break outer;
                        case Profiler:
                          var parentStateNode = parentFiber.stateNode;
                          parentStateNode.passiveEffectDuration += passiveEffectDuration;
                          break outer;
                      }
                      parentFiber = parentFiber.return;
                    }
                  break;
                }
              }
            }
          }
        }
        function commitLayoutEffectOnFiber(finishedRoot, current2, finishedWork, committedLanes) {
          if ((finishedWork.flags & LayoutMask) !== NoFlags) {
            switch (finishedWork.tag) {
              case FunctionComponent:
              case ForwardRef:
              case SimpleMemoComponent: {
                if (!offscreenSubtreeWasHidden) {
                  if (finishedWork.mode & ProfileMode) {
                    try {
                      startLayoutEffectTimer();
                      commitHookEffectListMount(Layout | HasEffect, finishedWork);
                    } finally {
                      recordLayoutEffectDuration(finishedWork);
                    }
                  } else {
                    commitHookEffectListMount(Layout | HasEffect, finishedWork);
                  }
                }
                break;
              }
              case ClassComponent: {
                var instance = finishedWork.stateNode;
                if (finishedWork.flags & Update) {
                  if (!offscreenSubtreeWasHidden) {
                    if (current2 === null) {
                      {
                        if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
                          if (instance.props !== finishedWork.memoizedProps) {
                            error("Expected %s props to match memoized props before componentDidMount. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.", getComponentNameFromFiber(finishedWork) || "instance");
                          }
                          if (instance.state !== finishedWork.memoizedState) {
                            error("Expected %s state to match memoized state before componentDidMount. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.", getComponentNameFromFiber(finishedWork) || "instance");
                          }
                        }
                      }
                      if (finishedWork.mode & ProfileMode) {
                        try {
                          startLayoutEffectTimer();
                          instance.componentDidMount();
                        } finally {
                          recordLayoutEffectDuration(finishedWork);
                        }
                      } else {
                        instance.componentDidMount();
                      }
                    } else {
                      var prevProps = finishedWork.elementType === finishedWork.type ? current2.memoizedProps : resolveDefaultProps(finishedWork.type, current2.memoizedProps);
                      var prevState = current2.memoizedState;
                      {
                        if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
                          if (instance.props !== finishedWork.memoizedProps) {
                            error("Expected %s props to match memoized props before componentDidUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.", getComponentNameFromFiber(finishedWork) || "instance");
                          }
                          if (instance.state !== finishedWork.memoizedState) {
                            error("Expected %s state to match memoized state before componentDidUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.", getComponentNameFromFiber(finishedWork) || "instance");
                          }
                        }
                      }
                      if (finishedWork.mode & ProfileMode) {
                        try {
                          startLayoutEffectTimer();
                          instance.componentDidUpdate(prevProps, prevState, instance.__reactInternalSnapshotBeforeUpdate);
                        } finally {
                          recordLayoutEffectDuration(finishedWork);
                        }
                      } else {
                        instance.componentDidUpdate(prevProps, prevState, instance.__reactInternalSnapshotBeforeUpdate);
                      }
                    }
                  }
                }
                var updateQueue = finishedWork.updateQueue;
                if (updateQueue !== null) {
                  {
                    if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
                      if (instance.props !== finishedWork.memoizedProps) {
                        error("Expected %s props to match memoized props before processing the update queue. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.", getComponentNameFromFiber(finishedWork) || "instance");
                      }
                      if (instance.state !== finishedWork.memoizedState) {
                        error("Expected %s state to match memoized state before processing the update queue. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.", getComponentNameFromFiber(finishedWork) || "instance");
                      }
                    }
                  }
                  commitUpdateQueue(finishedWork, updateQueue, instance);
                }
                break;
              }
              case HostRoot: {
                var _updateQueue = finishedWork.updateQueue;
                if (_updateQueue !== null) {
                  var _instance = null;
                  if (finishedWork.child !== null) {
                    switch (finishedWork.child.tag) {
                      case HostComponent:
                        _instance = getPublicInstance(finishedWork.child.stateNode);
                        break;
                      case ClassComponent:
                        _instance = finishedWork.child.stateNode;
                        break;
                    }
                  }
                  commitUpdateQueue(finishedWork, _updateQueue, _instance);
                }
                break;
              }
              case HostComponent: {
                var _instance2 = finishedWork.stateNode;
                if (current2 === null && finishedWork.flags & Update) {
                  var type = finishedWork.type;
                  var props = finishedWork.memoizedProps;
                  commitMount(_instance2, type, props);
                }
                break;
              }
              case HostText: {
                break;
              }
              case HostPortal: {
                break;
              }
              case Profiler: {
                {
                  var _finishedWork$memoize2 = finishedWork.memoizedProps, onCommit = _finishedWork$memoize2.onCommit, onRender = _finishedWork$memoize2.onRender;
                  var effectDuration = finishedWork.stateNode.effectDuration;
                  var commitTime2 = getCommitTime();
                  var phase = current2 === null ? "mount" : "update";
                  {
                    if (isCurrentUpdateNested()) {
                      phase = "nested-update";
                    }
                  }
                  if (typeof onRender === "function") {
                    onRender(finishedWork.memoizedProps.id, phase, finishedWork.actualDuration, finishedWork.treeBaseDuration, finishedWork.actualStartTime, commitTime2);
                  }
                  {
                    if (typeof onCommit === "function") {
                      onCommit(finishedWork.memoizedProps.id, phase, effectDuration, commitTime2);
                    }
                    enqueuePendingPassiveProfilerEffect(finishedWork);
                    var parentFiber = finishedWork.return;
                    outer:
                      while (parentFiber !== null) {
                        switch (parentFiber.tag) {
                          case HostRoot:
                            var root2 = parentFiber.stateNode;
                            root2.effectDuration += effectDuration;
                            break outer;
                          case Profiler:
                            var parentStateNode = parentFiber.stateNode;
                            parentStateNode.effectDuration += effectDuration;
                            break outer;
                        }
                        parentFiber = parentFiber.return;
                      }
                  }
                }
                break;
              }
              case SuspenseComponent: {
                commitSuspenseHydrationCallbacks(finishedRoot, finishedWork);
                break;
              }
              case SuspenseListComponent:
              case IncompleteClassComponent:
              case ScopeComponent:
              case OffscreenComponent:
              case LegacyHiddenComponent:
              case TracingMarkerComponent: {
                break;
              }
              default:
                throw new Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.");
            }
          }
          if (!offscreenSubtreeWasHidden) {
            {
              if (finishedWork.flags & Ref) {
                commitAttachRef(finishedWork);
              }
            }
          }
        }
        function reappearLayoutEffectsOnFiber(node) {
          switch (node.tag) {
            case FunctionComponent:
            case ForwardRef:
            case SimpleMemoComponent: {
              if (node.mode & ProfileMode) {
                try {
                  startLayoutEffectTimer();
                  safelyCallCommitHookLayoutEffectListMount(node, node.return);
                } finally {
                  recordLayoutEffectDuration(node);
                }
              } else {
                safelyCallCommitHookLayoutEffectListMount(node, node.return);
              }
              break;
            }
            case ClassComponent: {
              var instance = node.stateNode;
              if (typeof instance.componentDidMount === "function") {
                safelyCallComponentDidMount(node, node.return, instance);
              }
              safelyAttachRef(node, node.return);
              break;
            }
            case HostComponent: {
              safelyAttachRef(node, node.return);
              break;
            }
          }
        }
        function hideOrUnhideAllChildren(finishedWork, isHidden) {
          var hostSubtreeRoot = null;
          {
            var node = finishedWork;
            while (true) {
              if (node.tag === HostComponent) {
                if (hostSubtreeRoot === null) {
                  hostSubtreeRoot = node;
                  try {
                    var instance = node.stateNode;
                    if (isHidden) {
                      hideInstance(instance);
                    } else {
                      unhideInstance(node.stateNode, node.memoizedProps);
                    }
                  } catch (error2) {
                    captureCommitPhaseError(finishedWork, finishedWork.return, error2);
                  }
                }
              } else if (node.tag === HostText) {
                if (hostSubtreeRoot === null) {
                  try {
                    var _instance3 = node.stateNode;
                    if (isHidden) {
                      hideTextInstance(_instance3);
                    } else {
                      unhideTextInstance(_instance3, node.memoizedProps);
                    }
                  } catch (error2) {
                    captureCommitPhaseError(finishedWork, finishedWork.return, error2);
                  }
                }
              } else if ((node.tag === OffscreenComponent || node.tag === LegacyHiddenComponent) && node.memoizedState !== null && node !== finishedWork)
                ;
              else if (node.child !== null) {
                node.child.return = node;
                node = node.child;
                continue;
              }
              if (node === finishedWork) {
                return;
              }
              while (node.sibling === null) {
                if (node.return === null || node.return === finishedWork) {
                  return;
                }
                if (hostSubtreeRoot === node) {
                  hostSubtreeRoot = null;
                }
                node = node.return;
              }
              if (hostSubtreeRoot === node) {
                hostSubtreeRoot = null;
              }
              node.sibling.return = node.return;
              node = node.sibling;
            }
          }
        }
        function commitAttachRef(finishedWork) {
          var ref = finishedWork.ref;
          if (ref !== null) {
            var instance = finishedWork.stateNode;
            var instanceToUse;
            switch (finishedWork.tag) {
              case HostComponent:
                instanceToUse = getPublicInstance(instance);
                break;
              default:
                instanceToUse = instance;
            }
            if (typeof ref === "function") {
              var retVal;
              if (finishedWork.mode & ProfileMode) {
                try {
                  startLayoutEffectTimer();
                  retVal = ref(instanceToUse);
                } finally {
                  recordLayoutEffectDuration(finishedWork);
                }
              } else {
                retVal = ref(instanceToUse);
              }
              {
                if (typeof retVal === "function") {
                  error("Unexpected return value from a callback ref in %s. A callback ref should not return a function.", getComponentNameFromFiber(finishedWork));
                }
              }
            } else {
              {
                if (!ref.hasOwnProperty("current")) {
                  error("Unexpected ref object provided for %s. Use either a ref-setter function or React.createRef().", getComponentNameFromFiber(finishedWork));
                }
              }
              ref.current = instanceToUse;
            }
          }
        }
        function detachFiberMutation(fiber) {
          var alternate = fiber.alternate;
          if (alternate !== null) {
            alternate.return = null;
          }
          fiber.return = null;
        }
        function detachFiberAfterEffects(fiber) {
          var alternate = fiber.alternate;
          if (alternate !== null) {
            fiber.alternate = null;
            detachFiberAfterEffects(alternate);
          }
          {
            fiber.child = null;
            fiber.deletions = null;
            fiber.sibling = null;
            if (fiber.tag === HostComponent) {
              var hostInstance = fiber.stateNode;
              if (hostInstance !== null) {
                detachDeletedInstance(hostInstance);
              }
            }
            fiber.stateNode = null;
            {
              fiber._debugOwner = null;
            }
            {
              fiber.return = null;
              fiber.dependencies = null;
              fiber.memoizedProps = null;
              fiber.memoizedState = null;
              fiber.pendingProps = null;
              fiber.stateNode = null;
              fiber.updateQueue = null;
            }
          }
        }
        function getHostParentFiber(fiber) {
          var parent = fiber.return;
          while (parent !== null) {
            if (isHostParent(parent)) {
              return parent;
            }
            parent = parent.return;
          }
          throw new Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.");
        }
        function isHostParent(fiber) {
          return fiber.tag === HostComponent || fiber.tag === HostRoot || fiber.tag === HostPortal;
        }
        function getHostSibling(fiber) {
          var node = fiber;
          siblings:
            while (true) {
              while (node.sibling === null) {
                if (node.return === null || isHostParent(node.return)) {
                  return null;
                }
                node = node.return;
              }
              node.sibling.return = node.return;
              node = node.sibling;
              while (node.tag !== HostComponent && node.tag !== HostText && node.tag !== DehydratedFragment) {
                if (node.flags & Placement) {
                  continue siblings;
                }
                if (node.child === null || node.tag === HostPortal) {
                  continue siblings;
                } else {
                  node.child.return = node;
                  node = node.child;
                }
              }
              if (!(node.flags & Placement)) {
                return node.stateNode;
              }
            }
        }
        function commitPlacement(finishedWork) {
          var parentFiber = getHostParentFiber(finishedWork);
          switch (parentFiber.tag) {
            case HostComponent: {
              var parent = parentFiber.stateNode;
              if (parentFiber.flags & ContentReset) {
                resetTextContent(parent);
                parentFiber.flags &= ~ContentReset;
              }
              var before = getHostSibling(finishedWork);
              insertOrAppendPlacementNode(finishedWork, before, parent);
              break;
            }
            case HostRoot:
            case HostPortal: {
              var _parent = parentFiber.stateNode.containerInfo;
              var _before = getHostSibling(finishedWork);
              insertOrAppendPlacementNodeIntoContainer(finishedWork, _before, _parent);
              break;
            }
            default:
              throw new Error("Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue.");
          }
        }
        function insertOrAppendPlacementNodeIntoContainer(node, before, parent) {
          var tag = node.tag;
          var isHost = tag === HostComponent || tag === HostText;
          if (isHost) {
            var stateNode = node.stateNode;
            if (before) {
              insertInContainerBefore(parent, stateNode, before);
            } else {
              appendChildToContainer(parent, stateNode);
            }
          } else if (tag === HostPortal)
            ;
          else {
            var child = node.child;
            if (child !== null) {
              insertOrAppendPlacementNodeIntoContainer(child, before, parent);
              var sibling = child.sibling;
              while (sibling !== null) {
                insertOrAppendPlacementNodeIntoContainer(sibling, before, parent);
                sibling = sibling.sibling;
              }
            }
          }
        }
        function insertOrAppendPlacementNode(node, before, parent) {
          var tag = node.tag;
          var isHost = tag === HostComponent || tag === HostText;
          if (isHost) {
            var stateNode = node.stateNode;
            if (before) {
              insertBefore(parent, stateNode, before);
            } else {
              appendChild2(parent, stateNode);
            }
          } else if (tag === HostPortal)
            ;
          else {
            var child = node.child;
            if (child !== null) {
              insertOrAppendPlacementNode(child, before, parent);
              var sibling = child.sibling;
              while (sibling !== null) {
                insertOrAppendPlacementNode(sibling, before, parent);
                sibling = sibling.sibling;
              }
            }
          }
        }
        var hostParent = null;
        var hostParentIsContainer = false;
        function commitDeletionEffects(root2, returnFiber, deletedFiber) {
          {
            var parent = returnFiber;
            findParent:
              while (parent !== null) {
                switch (parent.tag) {
                  case HostComponent: {
                    hostParent = parent.stateNode;
                    hostParentIsContainer = false;
                    break findParent;
                  }
                  case HostRoot: {
                    hostParent = parent.stateNode.containerInfo;
                    hostParentIsContainer = true;
                    break findParent;
                  }
                  case HostPortal: {
                    hostParent = parent.stateNode.containerInfo;
                    hostParentIsContainer = true;
                    break findParent;
                  }
                }
                parent = parent.return;
              }
            if (hostParent === null) {
              throw new Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.");
            }
            commitDeletionEffectsOnFiber(root2, returnFiber, deletedFiber);
            hostParent = null;
            hostParentIsContainer = false;
          }
          detachFiberMutation(deletedFiber);
        }
        function recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, parent) {
          var child = parent.child;
          while (child !== null) {
            commitDeletionEffectsOnFiber(finishedRoot, nearestMountedAncestor, child);
            child = child.sibling;
          }
        }
        function commitDeletionEffectsOnFiber(finishedRoot, nearestMountedAncestor, deletedFiber) {
          onCommitUnmount(deletedFiber);
          switch (deletedFiber.tag) {
            case HostComponent: {
              if (!offscreenSubtreeWasHidden) {
                safelyDetachRef(deletedFiber, nearestMountedAncestor);
              }
            }
            case HostText: {
              {
                var prevHostParent = hostParent;
                var prevHostParentIsContainer = hostParentIsContainer;
                hostParent = null;
                recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber);
                hostParent = prevHostParent;
                hostParentIsContainer = prevHostParentIsContainer;
                if (hostParent !== null) {
                  if (hostParentIsContainer) {
                    removeChildFromContainer(hostParent, deletedFiber.stateNode);
                  } else {
                    removeChild(hostParent, deletedFiber.stateNode);
                  }
                }
              }
              return;
            }
            case DehydratedFragment: {
              {
                if (hostParent !== null) {
                  if (hostParentIsContainer) {
                    clearSuspenseBoundaryFromContainer(hostParent, deletedFiber.stateNode);
                  } else {
                    clearSuspenseBoundary(hostParent, deletedFiber.stateNode);
                  }
                }
              }
              return;
            }
            case HostPortal: {
              {
                var _prevHostParent = hostParent;
                var _prevHostParentIsContainer = hostParentIsContainer;
                hostParent = deletedFiber.stateNode.containerInfo;
                hostParentIsContainer = true;
                recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber);
                hostParent = _prevHostParent;
                hostParentIsContainer = _prevHostParentIsContainer;
              }
              return;
            }
            case FunctionComponent:
            case ForwardRef:
            case MemoComponent:
            case SimpleMemoComponent: {
              if (!offscreenSubtreeWasHidden) {
                var updateQueue = deletedFiber.updateQueue;
                if (updateQueue !== null) {
                  var lastEffect = updateQueue.lastEffect;
                  if (lastEffect !== null) {
                    var firstEffect = lastEffect.next;
                    var effect = firstEffect;
                    do {
                      var _effect = effect, destroy = _effect.destroy, tag = _effect.tag;
                      if (destroy !== void 0) {
                        if ((tag & Insertion) !== NoFlags$1) {
                          safelyCallDestroy(deletedFiber, nearestMountedAncestor, destroy);
                        } else if ((tag & Layout) !== NoFlags$1) {
                          {
                            markComponentLayoutEffectUnmountStarted(deletedFiber);
                          }
                          if (deletedFiber.mode & ProfileMode) {
                            startLayoutEffectTimer();
                            safelyCallDestroy(deletedFiber, nearestMountedAncestor, destroy);
                            recordLayoutEffectDuration(deletedFiber);
                          } else {
                            safelyCallDestroy(deletedFiber, nearestMountedAncestor, destroy);
                          }
                          {
                            markComponentLayoutEffectUnmountStopped();
                          }
                        }
                      }
                      effect = effect.next;
                    } while (effect !== firstEffect);
                  }
                }
              }
              recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber);
              return;
            }
            case ClassComponent: {
              if (!offscreenSubtreeWasHidden) {
                safelyDetachRef(deletedFiber, nearestMountedAncestor);
                var instance = deletedFiber.stateNode;
                if (typeof instance.componentWillUnmount === "function") {
                  safelyCallComponentWillUnmount(deletedFiber, nearestMountedAncestor, instance);
                }
              }
              recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber);
              return;
            }
            case ScopeComponent: {
              recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber);
              return;
            }
            case OffscreenComponent: {
              if (
                // TODO: Remove this dead flag
                deletedFiber.mode & ConcurrentMode
              ) {
                var prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden;
                offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden || deletedFiber.memoizedState !== null;
                recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber);
                offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden;
              } else {
                recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber);
              }
              break;
            }
            default: {
              recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber);
              return;
            }
          }
        }
        function commitSuspenseCallback(finishedWork) {
          var newState = finishedWork.memoizedState;
        }
        function commitSuspenseHydrationCallbacks(finishedRoot, finishedWork) {
          var newState = finishedWork.memoizedState;
          if (newState === null) {
            var current2 = finishedWork.alternate;
            if (current2 !== null) {
              var prevState = current2.memoizedState;
              if (prevState !== null) {
                var suspenseInstance = prevState.dehydrated;
                if (suspenseInstance !== null) {
                  commitHydratedSuspenseInstance(suspenseInstance);
                }
              }
            }
          }
        }
        function attachSuspenseRetryListeners(finishedWork) {
          var wakeables = finishedWork.updateQueue;
          if (wakeables !== null) {
            finishedWork.updateQueue = null;
            var retryCache = finishedWork.stateNode;
            if (retryCache === null) {
              retryCache = finishedWork.stateNode = new PossiblyWeakSet();
            }
            wakeables.forEach(function(wakeable) {
              var retry = resolveRetryWakeable.bind(null, finishedWork, wakeable);
              if (!retryCache.has(wakeable)) {
                retryCache.add(wakeable);
                {
                  if (isDevToolsPresent) {
                    if (inProgressLanes !== null && inProgressRoot !== null) {
                      restorePendingUpdaters(inProgressRoot, inProgressLanes);
                    } else {
                      throw Error("Expected finished root and lanes to be set. This is a bug in React.");
                    }
                  }
                }
                wakeable.then(retry, retry);
              }
            });
          }
        }
        function commitMutationEffects(root2, finishedWork, committedLanes) {
          inProgressLanes = committedLanes;
          inProgressRoot = root2;
          setCurrentFiber(finishedWork);
          commitMutationEffectsOnFiber(finishedWork, root2);
          setCurrentFiber(finishedWork);
          inProgressLanes = null;
          inProgressRoot = null;
        }
        function recursivelyTraverseMutationEffects(root2, parentFiber, lanes) {
          var deletions = parentFiber.deletions;
          if (deletions !== null) {
            for (var i2 = 0; i2 < deletions.length; i2++) {
              var childToDelete = deletions[i2];
              try {
                commitDeletionEffects(root2, parentFiber, childToDelete);
              } catch (error2) {
                captureCommitPhaseError(childToDelete, parentFiber, error2);
              }
            }
          }
          var prevDebugFiber = getCurrentFiber();
          if (parentFiber.subtreeFlags & MutationMask) {
            var child = parentFiber.child;
            while (child !== null) {
              setCurrentFiber(child);
              commitMutationEffectsOnFiber(child, root2);
              child = child.sibling;
            }
          }
          setCurrentFiber(prevDebugFiber);
        }
        function commitMutationEffectsOnFiber(finishedWork, root2, lanes) {
          var current2 = finishedWork.alternate;
          var flags = finishedWork.flags;
          switch (finishedWork.tag) {
            case FunctionComponent:
            case ForwardRef:
            case MemoComponent:
            case SimpleMemoComponent: {
              recursivelyTraverseMutationEffects(root2, finishedWork);
              commitReconciliationEffects(finishedWork);
              if (flags & Update) {
                try {
                  commitHookEffectListUnmount(Insertion | HasEffect, finishedWork, finishedWork.return);
                  commitHookEffectListMount(Insertion | HasEffect, finishedWork);
                } catch (error2) {
                  captureCommitPhaseError(finishedWork, finishedWork.return, error2);
                }
                if (finishedWork.mode & ProfileMode) {
                  try {
                    startLayoutEffectTimer();
                    commitHookEffectListUnmount(Layout | HasEffect, finishedWork, finishedWork.return);
                  } catch (error2) {
                    captureCommitPhaseError(finishedWork, finishedWork.return, error2);
                  }
                  recordLayoutEffectDuration(finishedWork);
                } else {
                  try {
                    commitHookEffectListUnmount(Layout | HasEffect, finishedWork, finishedWork.return);
                  } catch (error2) {
                    captureCommitPhaseError(finishedWork, finishedWork.return, error2);
                  }
                }
              }
              return;
            }
            case ClassComponent: {
              recursivelyTraverseMutationEffects(root2, finishedWork);
              commitReconciliationEffects(finishedWork);
              if (flags & Ref) {
                if (current2 !== null) {
                  safelyDetachRef(current2, current2.return);
                }
              }
              return;
            }
            case HostComponent: {
              recursivelyTraverseMutationEffects(root2, finishedWork);
              commitReconciliationEffects(finishedWork);
              if (flags & Ref) {
                if (current2 !== null) {
                  safelyDetachRef(current2, current2.return);
                }
              }
              {
                if (finishedWork.flags & ContentReset) {
                  var instance = finishedWork.stateNode;
                  try {
                    resetTextContent(instance);
                  } catch (error2) {
                    captureCommitPhaseError(finishedWork, finishedWork.return, error2);
                  }
                }
                if (flags & Update) {
                  var _instance4 = finishedWork.stateNode;
                  if (_instance4 != null) {
                    var newProps = finishedWork.memoizedProps;
                    var oldProps = current2 !== null ? current2.memoizedProps : newProps;
                    var type = finishedWork.type;
                    var updatePayload = finishedWork.updateQueue;
                    finishedWork.updateQueue = null;
                    if (updatePayload !== null) {
                      try {
                        commitUpdate(_instance4, updatePayload, type, oldProps, newProps, finishedWork);
                      } catch (error2) {
                        captureCommitPhaseError(finishedWork, finishedWork.return, error2);
                      }
                    }
                  }
                }
              }
              return;
            }
            case HostText: {
              recursivelyTraverseMutationEffects(root2, finishedWork);
              commitReconciliationEffects(finishedWork);
              if (flags & Update) {
                {
                  if (finishedWork.stateNode === null) {
                    throw new Error("This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue.");
                  }
                  var textInstance = finishedWork.stateNode;
                  var newText = finishedWork.memoizedProps;
                  var oldText = current2 !== null ? current2.memoizedProps : newText;
                  try {
                    commitTextUpdate(textInstance, oldText, newText);
                  } catch (error2) {
                    captureCommitPhaseError(finishedWork, finishedWork.return, error2);
                  }
                }
              }
              return;
            }
            case HostRoot: {
              recursivelyTraverseMutationEffects(root2, finishedWork);
              commitReconciliationEffects(finishedWork);
              if (flags & Update) {
                {
                  if (current2 !== null) {
                    var prevRootState = current2.memoizedState;
                    if (prevRootState.isDehydrated) {
                      try {
                        commitHydratedContainer(root2.containerInfo);
                      } catch (error2) {
                        captureCommitPhaseError(finishedWork, finishedWork.return, error2);
                      }
                    }
                  }
                }
              }
              return;
            }
            case HostPortal: {
              recursivelyTraverseMutationEffects(root2, finishedWork);
              commitReconciliationEffects(finishedWork);
              return;
            }
            case SuspenseComponent: {
              recursivelyTraverseMutationEffects(root2, finishedWork);
              commitReconciliationEffects(finishedWork);
              var offscreenFiber = finishedWork.child;
              if (offscreenFiber.flags & Visibility) {
                var offscreenInstance = offscreenFiber.stateNode;
                var newState = offscreenFiber.memoizedState;
                var isHidden = newState !== null;
                offscreenInstance.isHidden = isHidden;
                if (isHidden) {
                  var wasHidden = offscreenFiber.alternate !== null && offscreenFiber.alternate.memoizedState !== null;
                  if (!wasHidden) {
                    markCommitTimeOfFallback();
                  }
                }
              }
              if (flags & Update) {
                try {
                  commitSuspenseCallback(finishedWork);
                } catch (error2) {
                  captureCommitPhaseError(finishedWork, finishedWork.return, error2);
                }
                attachSuspenseRetryListeners(finishedWork);
              }
              return;
            }
            case OffscreenComponent: {
              var _wasHidden = current2 !== null && current2.memoizedState !== null;
              if (
                // TODO: Remove this dead flag
                finishedWork.mode & ConcurrentMode
              ) {
                var prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden;
                offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden || _wasHidden;
                recursivelyTraverseMutationEffects(root2, finishedWork);
                offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden;
              } else {
                recursivelyTraverseMutationEffects(root2, finishedWork);
              }
              commitReconciliationEffects(finishedWork);
              if (flags & Visibility) {
                var _offscreenInstance = finishedWork.stateNode;
                var _newState = finishedWork.memoizedState;
                var _isHidden = _newState !== null;
                var offscreenBoundary = finishedWork;
                _offscreenInstance.isHidden = _isHidden;
                {
                  if (_isHidden) {
                    if (!_wasHidden) {
                      if ((offscreenBoundary.mode & ConcurrentMode) !== NoMode) {
                        nextEffect = offscreenBoundary;
                        var offscreenChild = offscreenBoundary.child;
                        while (offscreenChild !== null) {
                          nextEffect = offscreenChild;
                          disappearLayoutEffects_begin(offscreenChild);
                          offscreenChild = offscreenChild.sibling;
                        }
                      }
                    }
                  }
                }
                {
                  hideOrUnhideAllChildren(offscreenBoundary, _isHidden);
                }
              }
              return;
            }
            case SuspenseListComponent: {
              recursivelyTraverseMutationEffects(root2, finishedWork);
              commitReconciliationEffects(finishedWork);
              if (flags & Update) {
                attachSuspenseRetryListeners(finishedWork);
              }
              return;
            }
            case ScopeComponent: {
              return;
            }
            default: {
              recursivelyTraverseMutationEffects(root2, finishedWork);
              commitReconciliationEffects(finishedWork);
              return;
            }
          }
        }
        function commitReconciliationEffects(finishedWork) {
          var flags = finishedWork.flags;
          if (flags & Placement) {
            try {
              commitPlacement(finishedWork);
            } catch (error2) {
              captureCommitPhaseError(finishedWork, finishedWork.return, error2);
            }
            finishedWork.flags &= ~Placement;
          }
          if (flags & Hydrating) {
            finishedWork.flags &= ~Hydrating;
          }
        }
        function commitLayoutEffects(finishedWork, root2, committedLanes) {
          inProgressLanes = committedLanes;
          inProgressRoot = root2;
          nextEffect = finishedWork;
          commitLayoutEffects_begin(finishedWork, root2, committedLanes);
          inProgressLanes = null;
          inProgressRoot = null;
        }
        function commitLayoutEffects_begin(subtreeRoot, root2, committedLanes) {
          var isModernRoot = (subtreeRoot.mode & ConcurrentMode) !== NoMode;
          while (nextEffect !== null) {
            var fiber = nextEffect;
            var firstChild = fiber.child;
            if (fiber.tag === OffscreenComponent && isModernRoot) {
              var isHidden = fiber.memoizedState !== null;
              var newOffscreenSubtreeIsHidden = isHidden || offscreenSubtreeIsHidden;
              if (newOffscreenSubtreeIsHidden) {
                commitLayoutMountEffects_complete(subtreeRoot, root2, committedLanes);
                continue;
              } else {
                var current2 = fiber.alternate;
                var wasHidden = current2 !== null && current2.memoizedState !== null;
                var newOffscreenSubtreeWasHidden = wasHidden || offscreenSubtreeWasHidden;
                var prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden;
                var prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden;
                offscreenSubtreeIsHidden = newOffscreenSubtreeIsHidden;
                offscreenSubtreeWasHidden = newOffscreenSubtreeWasHidden;
                if (offscreenSubtreeWasHidden && !prevOffscreenSubtreeWasHidden) {
                  nextEffect = fiber;
                  reappearLayoutEffects_begin(fiber);
                }
                var child = firstChild;
                while (child !== null) {
                  nextEffect = child;
                  commitLayoutEffects_begin(
                    child,
                    // New root; bubble back up to here and stop.
                    root2,
                    committedLanes
                  );
                  child = child.sibling;
                }
                nextEffect = fiber;
                offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden;
                offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden;
                commitLayoutMountEffects_complete(subtreeRoot, root2, committedLanes);
                continue;
              }
            }
            if ((fiber.subtreeFlags & LayoutMask) !== NoFlags && firstChild !== null) {
              firstChild.return = fiber;
              nextEffect = firstChild;
            } else {
              commitLayoutMountEffects_complete(subtreeRoot, root2, committedLanes);
            }
          }
        }
        function commitLayoutMountEffects_complete(subtreeRoot, root2, committedLanes) {
          while (nextEffect !== null) {
            var fiber = nextEffect;
            if ((fiber.flags & LayoutMask) !== NoFlags) {
              var current2 = fiber.alternate;
              setCurrentFiber(fiber);
              try {
                commitLayoutEffectOnFiber(root2, current2, fiber, committedLanes);
              } catch (error2) {
                captureCommitPhaseError(fiber, fiber.return, error2);
              }
              resetCurrentFiber();
            }
            if (fiber === subtreeRoot) {
              nextEffect = null;
              return;
            }
            var sibling = fiber.sibling;
            if (sibling !== null) {
              sibling.return = fiber.return;
              nextEffect = sibling;
              return;
            }
            nextEffect = fiber.return;
          }
        }
        function disappearLayoutEffects_begin(subtreeRoot) {
          while (nextEffect !== null) {
            var fiber = nextEffect;
            var firstChild = fiber.child;
            switch (fiber.tag) {
              case FunctionComponent:
              case ForwardRef:
              case MemoComponent:
              case SimpleMemoComponent: {
                if (fiber.mode & ProfileMode) {
                  try {
                    startLayoutEffectTimer();
                    commitHookEffectListUnmount(Layout, fiber, fiber.return);
                  } finally {
                    recordLayoutEffectDuration(fiber);
                  }
                } else {
                  commitHookEffectListUnmount(Layout, fiber, fiber.return);
                }
                break;
              }
              case ClassComponent: {
                safelyDetachRef(fiber, fiber.return);
                var instance = fiber.stateNode;
                if (typeof instance.componentWillUnmount === "function") {
                  safelyCallComponentWillUnmount(fiber, fiber.return, instance);
                }
                break;
              }
              case HostComponent: {
                safelyDetachRef(fiber, fiber.return);
                break;
              }
              case OffscreenComponent: {
                var isHidden = fiber.memoizedState !== null;
                if (isHidden) {
                  disappearLayoutEffects_complete(subtreeRoot);
                  continue;
                }
                break;
              }
            }
            if (firstChild !== null) {
              firstChild.return = fiber;
              nextEffect = firstChild;
            } else {
              disappearLayoutEffects_complete(subtreeRoot);
            }
          }
        }
        function disappearLayoutEffects_complete(subtreeRoot) {
          while (nextEffect !== null) {
            var fiber = nextEffect;
            if (fiber === subtreeRoot) {
              nextEffect = null;
              return;
            }
            var sibling = fiber.sibling;
            if (sibling !== null) {
              sibling.return = fiber.return;
              nextEffect = sibling;
              return;
            }
            nextEffect = fiber.return;
          }
        }
        function reappearLayoutEffects_begin(subtreeRoot) {
          while (nextEffect !== null) {
            var fiber = nextEffect;
            var firstChild = fiber.child;
            if (fiber.tag === OffscreenComponent) {
              var isHidden = fiber.memoizedState !== null;
              if (isHidden) {
                reappearLayoutEffects_complete(subtreeRoot);
                continue;
              }
            }
            if (firstChild !== null) {
              firstChild.return = fiber;
              nextEffect = firstChild;
            } else {
              reappearLayoutEffects_complete(subtreeRoot);
            }
          }
        }
        function reappearLayoutEffects_complete(subtreeRoot) {
          while (nextEffect !== null) {
            var fiber = nextEffect;
            setCurrentFiber(fiber);
            try {
              reappearLayoutEffectsOnFiber(fiber);
            } catch (error2) {
              captureCommitPhaseError(fiber, fiber.return, error2);
            }
            resetCurrentFiber();
            if (fiber === subtreeRoot) {
              nextEffect = null;
              return;
            }
            var sibling = fiber.sibling;
            if (sibling !== null) {
              sibling.return = fiber.return;
              nextEffect = sibling;
              return;
            }
            nextEffect = fiber.return;
          }
        }
        function commitPassiveMountEffects(root2, finishedWork, committedLanes, committedTransitions) {
          nextEffect = finishedWork;
          commitPassiveMountEffects_begin(finishedWork, root2, committedLanes, committedTransitions);
        }
        function commitPassiveMountEffects_begin(subtreeRoot, root2, committedLanes, committedTransitions) {
          while (nextEffect !== null) {
            var fiber = nextEffect;
            var firstChild = fiber.child;
            if ((fiber.subtreeFlags & PassiveMask) !== NoFlags && firstChild !== null) {
              firstChild.return = fiber;
              nextEffect = firstChild;
            } else {
              commitPassiveMountEffects_complete(subtreeRoot, root2, committedLanes, committedTransitions);
            }
          }
        }
        function commitPassiveMountEffects_complete(subtreeRoot, root2, committedLanes, committedTransitions) {
          while (nextEffect !== null) {
            var fiber = nextEffect;
            if ((fiber.flags & Passive) !== NoFlags) {
              setCurrentFiber(fiber);
              try {
                commitPassiveMountOnFiber(root2, fiber, committedLanes, committedTransitions);
              } catch (error2) {
                captureCommitPhaseError(fiber, fiber.return, error2);
              }
              resetCurrentFiber();
            }
            if (fiber === subtreeRoot) {
              nextEffect = null;
              return;
            }
            var sibling = fiber.sibling;
            if (sibling !== null) {
              sibling.return = fiber.return;
              nextEffect = sibling;
              return;
            }
            nextEffect = fiber.return;
          }
        }
        function commitPassiveMountOnFiber(finishedRoot, finishedWork, committedLanes, committedTransitions) {
          switch (finishedWork.tag) {
            case FunctionComponent:
            case ForwardRef:
            case SimpleMemoComponent: {
              if (finishedWork.mode & ProfileMode) {
                startPassiveEffectTimer();
                try {
                  commitHookEffectListMount(Passive$1 | HasEffect, finishedWork);
                } finally {
                  recordPassiveEffectDuration(finishedWork);
                }
              } else {
                commitHookEffectListMount(Passive$1 | HasEffect, finishedWork);
              }
              break;
            }
          }
        }
        function commitPassiveUnmountEffects(firstChild) {
          nextEffect = firstChild;
          commitPassiveUnmountEffects_begin();
        }
        function commitPassiveUnmountEffects_begin() {
          while (nextEffect !== null) {
            var fiber = nextEffect;
            var child = fiber.child;
            if ((nextEffect.flags & ChildDeletion) !== NoFlags) {
              var deletions = fiber.deletions;
              if (deletions !== null) {
                for (var i2 = 0; i2 < deletions.length; i2++) {
                  var fiberToDelete = deletions[i2];
                  nextEffect = fiberToDelete;
                  commitPassiveUnmountEffectsInsideOfDeletedTree_begin(fiberToDelete, fiber);
                }
                {
                  var previousFiber = fiber.alternate;
                  if (previousFiber !== null) {
                    var detachedChild = previousFiber.child;
                    if (detachedChild !== null) {
                      previousFiber.child = null;
                      do {
                        var detachedSibling = detachedChild.sibling;
                        detachedChild.sibling = null;
                        detachedChild = detachedSibling;
                      } while (detachedChild !== null);
                    }
                  }
                }
                nextEffect = fiber;
              }
            }
            if ((fiber.subtreeFlags & PassiveMask) !== NoFlags && child !== null) {
              child.return = fiber;
              nextEffect = child;
            } else {
              commitPassiveUnmountEffects_complete();
            }
          }
        }
        function commitPassiveUnmountEffects_complete() {
          while (nextEffect !== null) {
            var fiber = nextEffect;
            if ((fiber.flags & Passive) !== NoFlags) {
              setCurrentFiber(fiber);
              commitPassiveUnmountOnFiber(fiber);
              resetCurrentFiber();
            }
            var sibling = fiber.sibling;
            if (sibling !== null) {
              sibling.return = fiber.return;
              nextEffect = sibling;
              return;
            }
            nextEffect = fiber.return;
          }
        }
        function commitPassiveUnmountOnFiber(finishedWork) {
          switch (finishedWork.tag) {
            case FunctionComponent:
            case ForwardRef:
            case SimpleMemoComponent: {
              if (finishedWork.mode & ProfileMode) {
                startPassiveEffectTimer();
                commitHookEffectListUnmount(Passive$1 | HasEffect, finishedWork, finishedWork.return);
                recordPassiveEffectDuration(finishedWork);
              } else {
                commitHookEffectListUnmount(Passive$1 | HasEffect, finishedWork, finishedWork.return);
              }
              break;
            }
          }
        }
        function commitPassiveUnmountEffectsInsideOfDeletedTree_begin(deletedSubtreeRoot, nearestMountedAncestor) {
          while (nextEffect !== null) {
            var fiber = nextEffect;
            setCurrentFiber(fiber);
            commitPassiveUnmountInsideDeletedTreeOnFiber(fiber, nearestMountedAncestor);
            resetCurrentFiber();
            var child = fiber.child;
            if (child !== null) {
              child.return = fiber;
              nextEffect = child;
            } else {
              commitPassiveUnmountEffectsInsideOfDeletedTree_complete(deletedSubtreeRoot);
            }
          }
        }
        function commitPassiveUnmountEffectsInsideOfDeletedTree_complete(deletedSubtreeRoot) {
          while (nextEffect !== null) {
            var fiber = nextEffect;
            var sibling = fiber.sibling;
            var returnFiber = fiber.return;
            {
              detachFiberAfterEffects(fiber);
              if (fiber === deletedSubtreeRoot) {
                nextEffect = null;
                return;
              }
            }
            if (sibling !== null) {
              sibling.return = returnFiber;
              nextEffect = sibling;
              return;
            }
            nextEffect = returnFiber;
          }
        }
        function commitPassiveUnmountInsideDeletedTreeOnFiber(current2, nearestMountedAncestor) {
          switch (current2.tag) {
            case FunctionComponent:
            case ForwardRef:
            case SimpleMemoComponent: {
              if (current2.mode & ProfileMode) {
                startPassiveEffectTimer();
                commitHookEffectListUnmount(Passive$1, current2, nearestMountedAncestor);
                recordPassiveEffectDuration(current2);
              } else {
                commitHookEffectListUnmount(Passive$1, current2, nearestMountedAncestor);
              }
              break;
            }
          }
        }
        function invokeLayoutEffectMountInDEV(fiber) {
          {
            switch (fiber.tag) {
              case FunctionComponent:
              case ForwardRef:
              case SimpleMemoComponent: {
                try {
                  commitHookEffectListMount(Layout | HasEffect, fiber);
                } catch (error2) {
                  captureCommitPhaseError(fiber, fiber.return, error2);
                }
                break;
              }
              case ClassComponent: {
                var instance = fiber.stateNode;
                try {
                  instance.componentDidMount();
                } catch (error2) {
                  captureCommitPhaseError(fiber, fiber.return, error2);
                }
                break;
              }
            }
          }
        }
        function invokePassiveEffectMountInDEV(fiber) {
          {
            switch (fiber.tag) {
              case FunctionComponent:
              case ForwardRef:
              case SimpleMemoComponent: {
                try {
                  commitHookEffectListMount(Passive$1 | HasEffect, fiber);
                } catch (error2) {
                  captureCommitPhaseError(fiber, fiber.return, error2);
                }
                break;
              }
            }
          }
        }
        function invokeLayoutEffectUnmountInDEV(fiber) {
          {
            switch (fiber.tag) {
              case FunctionComponent:
              case ForwardRef:
              case SimpleMemoComponent: {
                try {
                  commitHookEffectListUnmount(Layout | HasEffect, fiber, fiber.return);
                } catch (error2) {
                  captureCommitPhaseError(fiber, fiber.return, error2);
                }
                break;
              }
              case ClassComponent: {
                var instance = fiber.stateNode;
                if (typeof instance.componentWillUnmount === "function") {
                  safelyCallComponentWillUnmount(fiber, fiber.return, instance);
                }
                break;
              }
            }
          }
        }
        function invokePassiveEffectUnmountInDEV(fiber) {
          {
            switch (fiber.tag) {
              case FunctionComponent:
              case ForwardRef:
              case SimpleMemoComponent: {
                try {
                  commitHookEffectListUnmount(Passive$1 | HasEffect, fiber, fiber.return);
                } catch (error2) {
                  captureCommitPhaseError(fiber, fiber.return, error2);
                }
              }
            }
          }
        }
        var COMPONENT_TYPE = 0;
        var HAS_PSEUDO_CLASS_TYPE = 1;
        var ROLE_TYPE = 2;
        var TEST_NAME_TYPE = 3;
        var TEXT_TYPE = 4;
        if (typeof Symbol === "function" && Symbol.for) {
          var symbolFor = Symbol.for;
          COMPONENT_TYPE = symbolFor("selector.component");
          HAS_PSEUDO_CLASS_TYPE = symbolFor("selector.has_pseudo_class");
          ROLE_TYPE = symbolFor("selector.role");
          TEST_NAME_TYPE = symbolFor("selector.test_id");
          TEXT_TYPE = symbolFor("selector.text");
        }
        var commitHooks = [];
        function onCommitRoot$1() {
          {
            commitHooks.forEach(function(commitHook) {
              return commitHook();
            });
          }
        }
        var ReactCurrentActQueue = ReactSharedInternals.ReactCurrentActQueue;
        function isLegacyActEnvironment(fiber) {
          {
            var isReactActEnvironmentGlobal = (
              // $FlowExpectedError – Flow doesn't know about IS_REACT_ACT_ENVIRONMENT global
              typeof IS_REACT_ACT_ENVIRONMENT !== "undefined" ? IS_REACT_ACT_ENVIRONMENT : void 0
            );
            var jestIsDefined = typeof jest !== "undefined";
            return jestIsDefined && isReactActEnvironmentGlobal !== false;
          }
        }
        function isConcurrentActEnvironment() {
          {
            var isReactActEnvironmentGlobal = (
              // $FlowExpectedError – Flow doesn't know about IS_REACT_ACT_ENVIRONMENT global
              typeof IS_REACT_ACT_ENVIRONMENT !== "undefined" ? IS_REACT_ACT_ENVIRONMENT : void 0
            );
            if (!isReactActEnvironmentGlobal && ReactCurrentActQueue.current !== null) {
              error("The current testing environment is not configured to support act(...)");
            }
            return isReactActEnvironmentGlobal;
          }
        }
        var ceil2 = Math.ceil;
        var ReactCurrentDispatcher$2 = ReactSharedInternals.ReactCurrentDispatcher, ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner, ReactCurrentBatchConfig$3 = ReactSharedInternals.ReactCurrentBatchConfig, ReactCurrentActQueue$1 = ReactSharedInternals.ReactCurrentActQueue;
        var NoContext = (
          /*             */
          0
        );
        var BatchedContext = (
          /*               */
          1
        );
        var RenderContext = (
          /*                */
          2
        );
        var CommitContext = (
          /*                */
          4
        );
        var RootInProgress = 0;
        var RootFatalErrored = 1;
        var RootErrored = 2;
        var RootSuspended = 3;
        var RootSuspendedWithDelay = 4;
        var RootCompleted = 5;
        var RootDidNotComplete = 6;
        var executionContext = NoContext;
        var workInProgressRoot = null;
        var workInProgress = null;
        var workInProgressRootRenderLanes = NoLanes;
        var subtreeRenderLanes = NoLanes;
        var subtreeRenderLanesCursor = createCursor(NoLanes);
        var workInProgressRootExitStatus = RootInProgress;
        var workInProgressRootFatalError = null;
        var workInProgressRootIncludedLanes = NoLanes;
        var workInProgressRootSkippedLanes = NoLanes;
        var workInProgressRootInterleavedUpdatedLanes = NoLanes;
        var workInProgressRootPingedLanes = NoLanes;
        var workInProgressRootConcurrentErrors = null;
        var workInProgressRootRecoverableErrors = null;
        var globalMostRecentFallbackTime = 0;
        var FALLBACK_THROTTLE_MS = 500;
        var workInProgressRootRenderTargetTime = Infinity;
        var RENDER_TIMEOUT_MS = 500;
        var workInProgressTransitions = null;
        function resetRenderTimer() {
          workInProgressRootRenderTargetTime = now() + RENDER_TIMEOUT_MS;
        }
        function getRenderTargetTime() {
          return workInProgressRootRenderTargetTime;
        }
        var hasUncaughtError = false;
        var firstUncaughtError = null;
        var legacyErrorBoundariesThatAlreadyFailed = null;
        var rootDoesHavePassiveEffects = false;
        var rootWithPendingPassiveEffects = null;
        var pendingPassiveEffectsLanes = NoLanes;
        var pendingPassiveProfilerEffects = [];
        var pendingPassiveTransitions = null;
        var NESTED_UPDATE_LIMIT = 50;
        var nestedUpdateCount = 0;
        var rootWithNestedUpdates = null;
        var isFlushingPassiveEffects = false;
        var didScheduleUpdateDuringPassiveEffects = false;
        var NESTED_PASSIVE_UPDATE_LIMIT = 50;
        var nestedPassiveUpdateCount = 0;
        var rootWithPassiveNestedUpdates = null;
        var currentEventTime = NoTimestamp;
        var currentEventTransitionLane = NoLanes;
        var isRunningInsertionEffect = false;
        function getWorkInProgressRoot() {
          return workInProgressRoot;
        }
        function requestEventTime() {
          if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
            return now();
          }
          if (currentEventTime !== NoTimestamp) {
            return currentEventTime;
          }
          currentEventTime = now();
          return currentEventTime;
        }
        function requestUpdateLane(fiber) {
          var mode = fiber.mode;
          if ((mode & ConcurrentMode) === NoMode) {
            return SyncLane;
          } else if ((executionContext & RenderContext) !== NoContext && workInProgressRootRenderLanes !== NoLanes) {
            return pickArbitraryLane(workInProgressRootRenderLanes);
          }
          var isTransition = requestCurrentTransition() !== NoTransition;
          if (isTransition) {
            if (ReactCurrentBatchConfig$3.transition !== null) {
              var transition = ReactCurrentBatchConfig$3.transition;
              if (!transition._updatedFibers) {
                transition._updatedFibers = /* @__PURE__ */ new Set();
              }
              transition._updatedFibers.add(fiber);
            }
            if (currentEventTransitionLane === NoLane) {
              currentEventTransitionLane = claimNextTransitionLane();
            }
            return currentEventTransitionLane;
          }
          var updateLane = getCurrentUpdatePriority();
          if (updateLane !== NoLane) {
            return updateLane;
          }
          var eventLane = getCurrentEventPriority();
          return eventLane;
        }
        function requestRetryLane(fiber) {
          var mode = fiber.mode;
          if ((mode & ConcurrentMode) === NoMode) {
            return SyncLane;
          }
          return claimNextRetryLane();
        }
        function scheduleUpdateOnFiber(root2, fiber, lane, eventTime) {
          checkForNestedUpdates();
          {
            if (isRunningInsertionEffect) {
              error("useInsertionEffect must not schedule updates.");
            }
          }
          {
            if (isFlushingPassiveEffects) {
              didScheduleUpdateDuringPassiveEffects = true;
            }
          }
          markRootUpdated(root2, lane, eventTime);
          if ((executionContext & RenderContext) !== NoLanes && root2 === workInProgressRoot) {
            warnAboutRenderPhaseUpdatesInDEV(fiber);
          } else {
            {
              if (isDevToolsPresent) {
                addFiberToLanesMap(root2, fiber, lane);
              }
            }
            warnIfUpdatesNotWrappedWithActDEV(fiber);
            if (root2 === workInProgressRoot) {
              if ((executionContext & RenderContext) === NoContext) {
                workInProgressRootInterleavedUpdatedLanes = mergeLanes(workInProgressRootInterleavedUpdatedLanes, lane);
              }
              if (workInProgressRootExitStatus === RootSuspendedWithDelay) {
                markRootSuspended$1(root2, workInProgressRootRenderLanes);
              }
            }
            ensureRootIsScheduled(root2, eventTime);
            if (lane === SyncLane && executionContext === NoContext && (fiber.mode & ConcurrentMode) === NoMode && // Treat `act` as if it's inside `batchedUpdates`, even in legacy mode.
            !ReactCurrentActQueue$1.isBatchingLegacy) {
              resetRenderTimer();
              flushSyncCallbacksOnlyInLegacyMode();
            }
          }
        }
        function scheduleInitialHydrationOnRoot(root2, lane, eventTime) {
          var current2 = root2.current;
          current2.lanes = lane;
          markRootUpdated(root2, lane, eventTime);
          ensureRootIsScheduled(root2, eventTime);
        }
        function isUnsafeClassRenderPhaseUpdate(fiber) {
          return (
            // TODO: Remove outdated deferRenderPhaseUpdateToNextBatch experiment. We
            // decided not to enable it.
            (executionContext & RenderContext) !== NoContext
          );
        }
        function ensureRootIsScheduled(root2, currentTime) {
          var existingCallbackNode = root2.callbackNode;
          markStarvedLanesAsExpired(root2, currentTime);
          var nextLanes = getNextLanes(root2, root2 === workInProgressRoot ? workInProgressRootRenderLanes : NoLanes);
          if (nextLanes === NoLanes) {
            if (existingCallbackNode !== null) {
              cancelCallback$1(existingCallbackNode);
            }
            root2.callbackNode = null;
            root2.callbackPriority = NoLane;
            return;
          }
          var newCallbackPriority = getHighestPriorityLane(nextLanes);
          var existingCallbackPriority = root2.callbackPriority;
          if (existingCallbackPriority === newCallbackPriority && // Special case related to `act`. If the currently scheduled task is a
          // Scheduler task, rather than an `act` task, cancel it and re-scheduled
          // on the `act` queue.
          !(ReactCurrentActQueue$1.current !== null && existingCallbackNode !== fakeActCallbackNode)) {
            {
              if (existingCallbackNode == null && existingCallbackPriority !== SyncLane) {
                error("Expected scheduled callback to exist. This error is likely caused by a bug in React. Please file an issue.");
              }
            }
            return;
          }
          if (existingCallbackNode != null) {
            cancelCallback$1(existingCallbackNode);
          }
          var newCallbackNode;
          if (newCallbackPriority === SyncLane) {
            if (root2.tag === LegacyRoot) {
              if (ReactCurrentActQueue$1.isBatchingLegacy !== null) {
                ReactCurrentActQueue$1.didScheduleLegacyUpdate = true;
              }
              scheduleLegacySyncCallback(performSyncWorkOnRoot.bind(null, root2));
            } else {
              scheduleSyncCallback(performSyncWorkOnRoot.bind(null, root2));
            }
            {
              if (ReactCurrentActQueue$1.current !== null) {
                ReactCurrentActQueue$1.current.push(flushSyncCallbacks);
              } else {
                scheduleMicrotask(function() {
                  if ((executionContext & (RenderContext | CommitContext)) === NoContext) {
                    flushSyncCallbacks();
                  }
                });
              }
            }
            newCallbackNode = null;
          } else {
            var schedulerPriorityLevel;
            switch (lanesToEventPriority(nextLanes)) {
              case DiscreteEventPriority:
                schedulerPriorityLevel = ImmediatePriority;
                break;
              case ContinuousEventPriority:
                schedulerPriorityLevel = UserBlockingPriority;
                break;
              case DefaultEventPriority:
                schedulerPriorityLevel = NormalPriority;
                break;
              case IdleEventPriority:
                schedulerPriorityLevel = IdlePriority;
                break;
              default:
                schedulerPriorityLevel = NormalPriority;
                break;
            }
            newCallbackNode = scheduleCallback$1(schedulerPriorityLevel, performConcurrentWorkOnRoot.bind(null, root2));
          }
          root2.callbackPriority = newCallbackPriority;
          root2.callbackNode = newCallbackNode;
        }
        function performConcurrentWorkOnRoot(root2, didTimeout) {
          {
            resetNestedUpdateFlag();
          }
          currentEventTime = NoTimestamp;
          currentEventTransitionLane = NoLanes;
          if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
            throw new Error("Should not already be working.");
          }
          var originalCallbackNode = root2.callbackNode;
          var didFlushPassiveEffects = flushPassiveEffects();
          if (didFlushPassiveEffects) {
            if (root2.callbackNode !== originalCallbackNode) {
              return null;
            }
          }
          var lanes = getNextLanes(root2, root2 === workInProgressRoot ? workInProgressRootRenderLanes : NoLanes);
          if (lanes === NoLanes) {
            return null;
          }
          var shouldTimeSlice = !includesBlockingLane(root2, lanes) && !includesExpiredLane(root2, lanes) && !didTimeout;
          var exitStatus = shouldTimeSlice ? renderRootConcurrent(root2, lanes) : renderRootSync(root2, lanes);
          if (exitStatus !== RootInProgress) {
            if (exitStatus === RootErrored) {
              var errorRetryLanes = getLanesToRetrySynchronouslyOnError(root2);
              if (errorRetryLanes !== NoLanes) {
                lanes = errorRetryLanes;
                exitStatus = recoverFromConcurrentError(root2, errorRetryLanes);
              }
            }
            if (exitStatus === RootFatalErrored) {
              var fatalError = workInProgressRootFatalError;
              prepareFreshStack(root2, NoLanes);
              markRootSuspended$1(root2, lanes);
              ensureRootIsScheduled(root2, now());
              throw fatalError;
            }
            if (exitStatus === RootDidNotComplete) {
              markRootSuspended$1(root2, lanes);
            } else {
              var renderWasConcurrent = !includesBlockingLane(root2, lanes);
              var finishedWork = root2.current.alternate;
              if (renderWasConcurrent && !isRenderConsistentWithExternalStores(finishedWork)) {
                exitStatus = renderRootSync(root2, lanes);
                if (exitStatus === RootErrored) {
                  var _errorRetryLanes = getLanesToRetrySynchronouslyOnError(root2);
                  if (_errorRetryLanes !== NoLanes) {
                    lanes = _errorRetryLanes;
                    exitStatus = recoverFromConcurrentError(root2, _errorRetryLanes);
                  }
                }
                if (exitStatus === RootFatalErrored) {
                  var _fatalError = workInProgressRootFatalError;
                  prepareFreshStack(root2, NoLanes);
                  markRootSuspended$1(root2, lanes);
                  ensureRootIsScheduled(root2, now());
                  throw _fatalError;
                }
              }
              root2.finishedWork = finishedWork;
              root2.finishedLanes = lanes;
              finishConcurrentRender(root2, exitStatus, lanes);
            }
          }
          ensureRootIsScheduled(root2, now());
          if (root2.callbackNode === originalCallbackNode) {
            return performConcurrentWorkOnRoot.bind(null, root2);
          }
          return null;
        }
        function recoverFromConcurrentError(root2, errorRetryLanes) {
          var errorsFromFirstAttempt = workInProgressRootConcurrentErrors;
          if (isRootDehydrated(root2)) {
            var rootWorkInProgress = prepareFreshStack(root2, errorRetryLanes);
            rootWorkInProgress.flags |= ForceClientRender;
            {
              errorHydratingContainer(root2.containerInfo);
            }
          }
          var exitStatus = renderRootSync(root2, errorRetryLanes);
          if (exitStatus !== RootErrored) {
            var errorsFromSecondAttempt = workInProgressRootRecoverableErrors;
            workInProgressRootRecoverableErrors = errorsFromFirstAttempt;
            if (errorsFromSecondAttempt !== null) {
              queueRecoverableErrors(errorsFromSecondAttempt);
            }
          }
          return exitStatus;
        }
        function queueRecoverableErrors(errors) {
          if (workInProgressRootRecoverableErrors === null) {
            workInProgressRootRecoverableErrors = errors;
          } else {
            workInProgressRootRecoverableErrors.push.apply(workInProgressRootRecoverableErrors, errors);
          }
        }
        function finishConcurrentRender(root2, exitStatus, lanes) {
          switch (exitStatus) {
            case RootInProgress:
            case RootFatalErrored: {
              throw new Error("Root did not complete. This is a bug in React.");
            }
            case RootErrored: {
              commitRoot(root2, workInProgressRootRecoverableErrors, workInProgressTransitions);
              break;
            }
            case RootSuspended: {
              markRootSuspended$1(root2, lanes);
              if (includesOnlyRetries(lanes) && // do not delay if we're inside an act() scope
              !shouldForceFlushFallbacksInDEV()) {
                var msUntilTimeout = globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now();
                if (msUntilTimeout > 10) {
                  var nextLanes = getNextLanes(root2, NoLanes);
                  if (nextLanes !== NoLanes) {
                    break;
                  }
                  var suspendedLanes = root2.suspendedLanes;
                  if (!isSubsetOfLanes(suspendedLanes, lanes)) {
                    var eventTime = requestEventTime();
                    markRootPinged(root2, suspendedLanes);
                    break;
                  }
                  root2.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root2, workInProgressRootRecoverableErrors, workInProgressTransitions), msUntilTimeout);
                  break;
                }
              }
              commitRoot(root2, workInProgressRootRecoverableErrors, workInProgressTransitions);
              break;
            }
            case RootSuspendedWithDelay: {
              markRootSuspended$1(root2, lanes);
              if (includesOnlyTransitions(lanes)) {
                break;
              }
              if (!shouldForceFlushFallbacksInDEV()) {
                var mostRecentEventTime = getMostRecentEventTime(root2, lanes);
                var eventTimeMs = mostRecentEventTime;
                var timeElapsedMs = now() - eventTimeMs;
                var _msUntilTimeout = jnd(timeElapsedMs) - timeElapsedMs;
                if (_msUntilTimeout > 10) {
                  root2.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root2, workInProgressRootRecoverableErrors, workInProgressTransitions), _msUntilTimeout);
                  break;
                }
              }
              commitRoot(root2, workInProgressRootRecoverableErrors, workInProgressTransitions);
              break;
            }
            case RootCompleted: {
              commitRoot(root2, workInProgressRootRecoverableErrors, workInProgressTransitions);
              break;
            }
            default: {
              throw new Error("Unknown root exit status.");
            }
          }
        }
        function isRenderConsistentWithExternalStores(finishedWork) {
          var node = finishedWork;
          while (true) {
            if (node.flags & StoreConsistency) {
              var updateQueue = node.updateQueue;
              if (updateQueue !== null) {
                var checks = updateQueue.stores;
                if (checks !== null) {
                  for (var i2 = 0; i2 < checks.length; i2++) {
                    var check = checks[i2];
                    var getSnapshot = check.getSnapshot;
                    var renderedValue = check.value;
                    try {
                      if (!objectIs(getSnapshot(), renderedValue)) {
                        return false;
                      }
                    } catch (error2) {
                      return false;
                    }
                  }
                }
              }
            }
            var child = node.child;
            if (node.subtreeFlags & StoreConsistency && child !== null) {
              child.return = node;
              node = child;
              continue;
            }
            if (node === finishedWork) {
              return true;
            }
            while (node.sibling === null) {
              if (node.return === null || node.return === finishedWork) {
                return true;
              }
              node = node.return;
            }
            node.sibling.return = node.return;
            node = node.sibling;
          }
          return true;
        }
        function markRootSuspended$1(root2, suspendedLanes) {
          suspendedLanes = removeLanes(suspendedLanes, workInProgressRootPingedLanes);
          suspendedLanes = removeLanes(suspendedLanes, workInProgressRootInterleavedUpdatedLanes);
          markRootSuspended(root2, suspendedLanes);
        }
        function performSyncWorkOnRoot(root2) {
          {
            syncNestedUpdateFlag();
          }
          if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
            throw new Error("Should not already be working.");
          }
          flushPassiveEffects();
          var lanes = getNextLanes(root2, NoLanes);
          if (!includesSomeLane(lanes, SyncLane)) {
            ensureRootIsScheduled(root2, now());
            return null;
          }
          var exitStatus = renderRootSync(root2, lanes);
          if (root2.tag !== LegacyRoot && exitStatus === RootErrored) {
            var errorRetryLanes = getLanesToRetrySynchronouslyOnError(root2);
            if (errorRetryLanes !== NoLanes) {
              lanes = errorRetryLanes;
              exitStatus = recoverFromConcurrentError(root2, errorRetryLanes);
            }
          }
          if (exitStatus === RootFatalErrored) {
            var fatalError = workInProgressRootFatalError;
            prepareFreshStack(root2, NoLanes);
            markRootSuspended$1(root2, lanes);
            ensureRootIsScheduled(root2, now());
            throw fatalError;
          }
          if (exitStatus === RootDidNotComplete) {
            throw new Error("Root did not complete. This is a bug in React.");
          }
          var finishedWork = root2.current.alternate;
          root2.finishedWork = finishedWork;
          root2.finishedLanes = lanes;
          commitRoot(root2, workInProgressRootRecoverableErrors, workInProgressTransitions);
          ensureRootIsScheduled(root2, now());
          return null;
        }
        function flushRoot(root2, lanes) {
          if (lanes !== NoLanes) {
            markRootEntangled(root2, mergeLanes(lanes, SyncLane));
            ensureRootIsScheduled(root2, now());
            if ((executionContext & (RenderContext | CommitContext)) === NoContext) {
              resetRenderTimer();
              flushSyncCallbacks();
            }
          }
        }
        function batchedUpdates$1(fn2, a2) {
          var prevExecutionContext = executionContext;
          executionContext |= BatchedContext;
          try {
            return fn2(a2);
          } finally {
            executionContext = prevExecutionContext;
            if (executionContext === NoContext && // Treat `act` as if it's inside `batchedUpdates`, even in legacy mode.
            !ReactCurrentActQueue$1.isBatchingLegacy) {
              resetRenderTimer();
              flushSyncCallbacksOnlyInLegacyMode();
            }
          }
        }
        function discreteUpdates(fn2, a2, b2, c2, d2) {
          var previousPriority = getCurrentUpdatePriority();
          var prevTransition = ReactCurrentBatchConfig$3.transition;
          try {
            ReactCurrentBatchConfig$3.transition = null;
            setCurrentUpdatePriority(DiscreteEventPriority);
            return fn2(a2, b2, c2, d2);
          } finally {
            setCurrentUpdatePriority(previousPriority);
            ReactCurrentBatchConfig$3.transition = prevTransition;
            if (executionContext === NoContext) {
              resetRenderTimer();
            }
          }
        }
        function flushSync(fn2) {
          if (rootWithPendingPassiveEffects !== null && rootWithPendingPassiveEffects.tag === LegacyRoot && (executionContext & (RenderContext | CommitContext)) === NoContext) {
            flushPassiveEffects();
          }
          var prevExecutionContext = executionContext;
          executionContext |= BatchedContext;
          var prevTransition = ReactCurrentBatchConfig$3.transition;
          var previousPriority = getCurrentUpdatePriority();
          try {
            ReactCurrentBatchConfig$3.transition = null;
            setCurrentUpdatePriority(DiscreteEventPriority);
            if (fn2) {
              return fn2();
            } else {
              return void 0;
            }
          } finally {
            setCurrentUpdatePriority(previousPriority);
            ReactCurrentBatchConfig$3.transition = prevTransition;
            executionContext = prevExecutionContext;
            if ((executionContext & (RenderContext | CommitContext)) === NoContext) {
              flushSyncCallbacks();
            }
          }
        }
        function isAlreadyRendering() {
          return (executionContext & (RenderContext | CommitContext)) !== NoContext;
        }
        function pushRenderLanes(fiber, lanes) {
          push(subtreeRenderLanesCursor, subtreeRenderLanes, fiber);
          subtreeRenderLanes = mergeLanes(subtreeRenderLanes, lanes);
          workInProgressRootIncludedLanes = mergeLanes(workInProgressRootIncludedLanes, lanes);
        }
        function popRenderLanes(fiber) {
          subtreeRenderLanes = subtreeRenderLanesCursor.current;
          pop(subtreeRenderLanesCursor, fiber);
        }
        function prepareFreshStack(root2, lanes) {
          root2.finishedWork = null;
          root2.finishedLanes = NoLanes;
          var timeoutHandle = root2.timeoutHandle;
          if (timeoutHandle !== noTimeout) {
            root2.timeoutHandle = noTimeout;
            cancelTimeout(timeoutHandle);
          }
          if (workInProgress !== null) {
            var interruptedWork = workInProgress.return;
            while (interruptedWork !== null) {
              var current2 = interruptedWork.alternate;
              unwindInterruptedWork(current2, interruptedWork);
              interruptedWork = interruptedWork.return;
            }
          }
          workInProgressRoot = root2;
          var rootWorkInProgress = createWorkInProgress(root2.current, null);
          workInProgress = rootWorkInProgress;
          workInProgressRootRenderLanes = subtreeRenderLanes = workInProgressRootIncludedLanes = lanes;
          workInProgressRootExitStatus = RootInProgress;
          workInProgressRootFatalError = null;
          workInProgressRootSkippedLanes = NoLanes;
          workInProgressRootInterleavedUpdatedLanes = NoLanes;
          workInProgressRootPingedLanes = NoLanes;
          workInProgressRootConcurrentErrors = null;
          workInProgressRootRecoverableErrors = null;
          finishQueueingConcurrentUpdates();
          {
            ReactStrictModeWarnings.discardPendingWarnings();
          }
          return rootWorkInProgress;
        }
        function handleError(root2, thrownValue) {
          do {
            var erroredWork = workInProgress;
            try {
              resetContextDependencies();
              resetHooksAfterThrow();
              resetCurrentFiber();
              ReactCurrentOwner$2.current = null;
              if (erroredWork === null || erroredWork.return === null) {
                workInProgressRootExitStatus = RootFatalErrored;
                workInProgressRootFatalError = thrownValue;
                workInProgress = null;
                return;
              }
              if (enableProfilerTimer && erroredWork.mode & ProfileMode) {
                stopProfilerTimerIfRunningAndRecordDelta(erroredWork, true);
              }
              if (enableSchedulingProfiler) {
                markComponentRenderStopped();
                if (thrownValue !== null && typeof thrownValue === "object" && typeof thrownValue.then === "function") {
                  var wakeable = thrownValue;
                  markComponentSuspended(erroredWork, wakeable, workInProgressRootRenderLanes);
                } else {
                  markComponentErrored(erroredWork, thrownValue, workInProgressRootRenderLanes);
                }
              }
              throwException(root2, erroredWork.return, erroredWork, thrownValue, workInProgressRootRenderLanes);
              completeUnitOfWork(erroredWork);
            } catch (yetAnotherThrownValue) {
              thrownValue = yetAnotherThrownValue;
              if (workInProgress === erroredWork && erroredWork !== null) {
                erroredWork = erroredWork.return;
                workInProgress = erroredWork;
              } else {
                erroredWork = workInProgress;
              }
              continue;
            }
            return;
          } while (true);
        }
        function pushDispatcher() {
          var prevDispatcher = ReactCurrentDispatcher$2.current;
          ReactCurrentDispatcher$2.current = ContextOnlyDispatcher;
          if (prevDispatcher === null) {
            return ContextOnlyDispatcher;
          } else {
            return prevDispatcher;
          }
        }
        function popDispatcher(prevDispatcher) {
          ReactCurrentDispatcher$2.current = prevDispatcher;
        }
        function markCommitTimeOfFallback() {
          globalMostRecentFallbackTime = now();
        }
        function markSkippedUpdateLanes(lane) {
          workInProgressRootSkippedLanes = mergeLanes(lane, workInProgressRootSkippedLanes);
        }
        function renderDidSuspend() {
          if (workInProgressRootExitStatus === RootInProgress) {
            workInProgressRootExitStatus = RootSuspended;
          }
        }
        function renderDidSuspendDelayIfPossible() {
          if (workInProgressRootExitStatus === RootInProgress || workInProgressRootExitStatus === RootSuspended || workInProgressRootExitStatus === RootErrored) {
            workInProgressRootExitStatus = RootSuspendedWithDelay;
          }
          if (workInProgressRoot !== null && (includesNonIdleWork(workInProgressRootSkippedLanes) || includesNonIdleWork(workInProgressRootInterleavedUpdatedLanes))) {
            markRootSuspended$1(workInProgressRoot, workInProgressRootRenderLanes);
          }
        }
        function renderDidError(error2) {
          if (workInProgressRootExitStatus !== RootSuspendedWithDelay) {
            workInProgressRootExitStatus = RootErrored;
          }
          if (workInProgressRootConcurrentErrors === null) {
            workInProgressRootConcurrentErrors = [error2];
          } else {
            workInProgressRootConcurrentErrors.push(error2);
          }
        }
        function renderHasNotSuspendedYet() {
          return workInProgressRootExitStatus === RootInProgress;
        }
        function renderRootSync(root2, lanes) {
          var prevExecutionContext = executionContext;
          executionContext |= RenderContext;
          var prevDispatcher = pushDispatcher();
          if (workInProgressRoot !== root2 || workInProgressRootRenderLanes !== lanes) {
            {
              if (isDevToolsPresent) {
                var memoizedUpdaters = root2.memoizedUpdaters;
                if (memoizedUpdaters.size > 0) {
                  restorePendingUpdaters(root2, workInProgressRootRenderLanes);
                  memoizedUpdaters.clear();
                }
                movePendingFibersToMemoized(root2, lanes);
              }
            }
            workInProgressTransitions = getTransitionsForLanes();
            prepareFreshStack(root2, lanes);
          }
          {
            markRenderStarted(lanes);
          }
          do {
            try {
              workLoopSync();
              break;
            } catch (thrownValue) {
              handleError(root2, thrownValue);
            }
          } while (true);
          resetContextDependencies();
          executionContext = prevExecutionContext;
          popDispatcher(prevDispatcher);
          if (workInProgress !== null) {
            throw new Error("Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue.");
          }
          {
            markRenderStopped();
          }
          workInProgressRoot = null;
          workInProgressRootRenderLanes = NoLanes;
          return workInProgressRootExitStatus;
        }
        function workLoopSync() {
          while (workInProgress !== null) {
            performUnitOfWork(workInProgress);
          }
        }
        function renderRootConcurrent(root2, lanes) {
          var prevExecutionContext = executionContext;
          executionContext |= RenderContext;
          var prevDispatcher = pushDispatcher();
          if (workInProgressRoot !== root2 || workInProgressRootRenderLanes !== lanes) {
            {
              if (isDevToolsPresent) {
                var memoizedUpdaters = root2.memoizedUpdaters;
                if (memoizedUpdaters.size > 0) {
                  restorePendingUpdaters(root2, workInProgressRootRenderLanes);
                  memoizedUpdaters.clear();
                }
                movePendingFibersToMemoized(root2, lanes);
              }
            }
            workInProgressTransitions = getTransitionsForLanes();
            resetRenderTimer();
            prepareFreshStack(root2, lanes);
          }
          {
            markRenderStarted(lanes);
          }
          do {
            try {
              workLoopConcurrent();
              break;
            } catch (thrownValue) {
              handleError(root2, thrownValue);
            }
          } while (true);
          resetContextDependencies();
          popDispatcher(prevDispatcher);
          executionContext = prevExecutionContext;
          if (workInProgress !== null) {
            {
              markRenderYielded();
            }
            return RootInProgress;
          } else {
            {
              markRenderStopped();
            }
            workInProgressRoot = null;
            workInProgressRootRenderLanes = NoLanes;
            return workInProgressRootExitStatus;
          }
        }
        function workLoopConcurrent() {
          while (workInProgress !== null && !shouldYield()) {
            performUnitOfWork(workInProgress);
          }
        }
        function performUnitOfWork(unitOfWork) {
          var current2 = unitOfWork.alternate;
          setCurrentFiber(unitOfWork);
          var next;
          if ((unitOfWork.mode & ProfileMode) !== NoMode) {
            startProfilerTimer(unitOfWork);
            next = beginWork$1(current2, unitOfWork, subtreeRenderLanes);
            stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, true);
          } else {
            next = beginWork$1(current2, unitOfWork, subtreeRenderLanes);
          }
          resetCurrentFiber();
          unitOfWork.memoizedProps = unitOfWork.pendingProps;
          if (next === null) {
            completeUnitOfWork(unitOfWork);
          } else {
            workInProgress = next;
          }
          ReactCurrentOwner$2.current = null;
        }
        function completeUnitOfWork(unitOfWork) {
          var completedWork = unitOfWork;
          do {
            var current2 = completedWork.alternate;
            var returnFiber = completedWork.return;
            if ((completedWork.flags & Incomplete) === NoFlags) {
              setCurrentFiber(completedWork);
              var next = void 0;
              if ((completedWork.mode & ProfileMode) === NoMode) {
                next = completeWork(current2, completedWork, subtreeRenderLanes);
              } else {
                startProfilerTimer(completedWork);
                next = completeWork(current2, completedWork, subtreeRenderLanes);
                stopProfilerTimerIfRunningAndRecordDelta(completedWork, false);
              }
              resetCurrentFiber();
              if (next !== null) {
                workInProgress = next;
                return;
              }
            } else {
              var _next = unwindWork(current2, completedWork);
              if (_next !== null) {
                _next.flags &= HostEffectMask;
                workInProgress = _next;
                return;
              }
              if ((completedWork.mode & ProfileMode) !== NoMode) {
                stopProfilerTimerIfRunningAndRecordDelta(completedWork, false);
                var actualDuration = completedWork.actualDuration;
                var child = completedWork.child;
                while (child !== null) {
                  actualDuration += child.actualDuration;
                  child = child.sibling;
                }
                completedWork.actualDuration = actualDuration;
              }
              if (returnFiber !== null) {
                returnFiber.flags |= Incomplete;
                returnFiber.subtreeFlags = NoFlags;
                returnFiber.deletions = null;
              } else {
                workInProgressRootExitStatus = RootDidNotComplete;
                workInProgress = null;
                return;
              }
            }
            var siblingFiber = completedWork.sibling;
            if (siblingFiber !== null) {
              workInProgress = siblingFiber;
              return;
            }
            completedWork = returnFiber;
            workInProgress = completedWork;
          } while (completedWork !== null);
          if (workInProgressRootExitStatus === RootInProgress) {
            workInProgressRootExitStatus = RootCompleted;
          }
        }
        function commitRoot(root2, recoverableErrors, transitions) {
          var previousUpdateLanePriority = getCurrentUpdatePriority();
          var prevTransition = ReactCurrentBatchConfig$3.transition;
          try {
            ReactCurrentBatchConfig$3.transition = null;
            setCurrentUpdatePriority(DiscreteEventPriority);
            commitRootImpl(root2, recoverableErrors, transitions, previousUpdateLanePriority);
          } finally {
            ReactCurrentBatchConfig$3.transition = prevTransition;
            setCurrentUpdatePriority(previousUpdateLanePriority);
          }
          return null;
        }
        function commitRootImpl(root2, recoverableErrors, transitions, renderPriorityLevel) {
          do {
            flushPassiveEffects();
          } while (rootWithPendingPassiveEffects !== null);
          flushRenderPhaseStrictModeWarningsInDEV();
          if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
            throw new Error("Should not already be working.");
          }
          var finishedWork = root2.finishedWork;
          var lanes = root2.finishedLanes;
          {
            markCommitStarted(lanes);
          }
          if (finishedWork === null) {
            {
              markCommitStopped();
            }
            return null;
          } else {
            {
              if (lanes === NoLanes) {
                error("root.finishedLanes should not be empty during a commit. This is a bug in React.");
              }
            }
          }
          root2.finishedWork = null;
          root2.finishedLanes = NoLanes;
          if (finishedWork === root2.current) {
            throw new Error("Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue.");
          }
          root2.callbackNode = null;
          root2.callbackPriority = NoLane;
          var remainingLanes = mergeLanes(finishedWork.lanes, finishedWork.childLanes);
          markRootFinished(root2, remainingLanes);
          if (root2 === workInProgressRoot) {
            workInProgressRoot = null;
            workInProgress = null;
            workInProgressRootRenderLanes = NoLanes;
          }
          if ((finishedWork.subtreeFlags & PassiveMask) !== NoFlags || (finishedWork.flags & PassiveMask) !== NoFlags) {
            if (!rootDoesHavePassiveEffects) {
              rootDoesHavePassiveEffects = true;
              pendingPassiveTransitions = transitions;
              scheduleCallback$1(NormalPriority, function() {
                flushPassiveEffects();
                return null;
              });
            }
          }
          var subtreeHasEffects = (finishedWork.subtreeFlags & (BeforeMutationMask | MutationMask | LayoutMask | PassiveMask)) !== NoFlags;
          var rootHasEffect = (finishedWork.flags & (BeforeMutationMask | MutationMask | LayoutMask | PassiveMask)) !== NoFlags;
          if (subtreeHasEffects || rootHasEffect) {
            var prevTransition = ReactCurrentBatchConfig$3.transition;
            ReactCurrentBatchConfig$3.transition = null;
            var previousPriority = getCurrentUpdatePriority();
            setCurrentUpdatePriority(DiscreteEventPriority);
            var prevExecutionContext = executionContext;
            executionContext |= CommitContext;
            ReactCurrentOwner$2.current = null;
            var shouldFireAfterActiveInstanceBlur2 = commitBeforeMutationEffects(root2, finishedWork);
            {
              recordCommitTime();
            }
            commitMutationEffects(root2, finishedWork, lanes);
            resetAfterCommit(root2.containerInfo);
            root2.current = finishedWork;
            {
              markLayoutEffectsStarted(lanes);
            }
            commitLayoutEffects(finishedWork, root2, lanes);
            {
              markLayoutEffectsStopped();
            }
            requestPaint();
            executionContext = prevExecutionContext;
            setCurrentUpdatePriority(previousPriority);
            ReactCurrentBatchConfig$3.transition = prevTransition;
          } else {
            root2.current = finishedWork;
            {
              recordCommitTime();
            }
          }
          var rootDidHavePassiveEffects = rootDoesHavePassiveEffects;
          if (rootDoesHavePassiveEffects) {
            rootDoesHavePassiveEffects = false;
            rootWithPendingPassiveEffects = root2;
            pendingPassiveEffectsLanes = lanes;
          } else {
            {
              nestedPassiveUpdateCount = 0;
              rootWithPassiveNestedUpdates = null;
            }
          }
          remainingLanes = root2.pendingLanes;
          if (remainingLanes === NoLanes) {
            legacyErrorBoundariesThatAlreadyFailed = null;
          }
          {
            if (!rootDidHavePassiveEffects) {
              commitDoubleInvokeEffectsInDEV(root2.current, false);
            }
          }
          onCommitRoot(finishedWork.stateNode, renderPriorityLevel);
          {
            if (isDevToolsPresent) {
              root2.memoizedUpdaters.clear();
            }
          }
          {
            onCommitRoot$1();
          }
          ensureRootIsScheduled(root2, now());
          if (recoverableErrors !== null) {
            var onRecoverableError = root2.onRecoverableError;
            for (var i2 = 0; i2 < recoverableErrors.length; i2++) {
              var recoverableError = recoverableErrors[i2];
              var componentStack = recoverableError.stack;
              var digest = recoverableError.digest;
              onRecoverableError(recoverableError.value, {
                componentStack,
                digest
              });
            }
          }
          if (hasUncaughtError) {
            hasUncaughtError = false;
            var error$1 = firstUncaughtError;
            firstUncaughtError = null;
            throw error$1;
          }
          if (includesSomeLane(pendingPassiveEffectsLanes, SyncLane) && root2.tag !== LegacyRoot) {
            flushPassiveEffects();
          }
          remainingLanes = root2.pendingLanes;
          if (includesSomeLane(remainingLanes, SyncLane)) {
            {
              markNestedUpdateScheduled();
            }
            if (root2 === rootWithNestedUpdates) {
              nestedUpdateCount++;
            } else {
              nestedUpdateCount = 0;
              rootWithNestedUpdates = root2;
            }
          } else {
            nestedUpdateCount = 0;
          }
          flushSyncCallbacks();
          {
            markCommitStopped();
          }
          return null;
        }
        function flushPassiveEffects() {
          if (rootWithPendingPassiveEffects !== null) {
            var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes);
            var priority = lowerEventPriority(DefaultEventPriority, renderPriority);
            var prevTransition = ReactCurrentBatchConfig$3.transition;
            var previousPriority = getCurrentUpdatePriority();
            try {
              ReactCurrentBatchConfig$3.transition = null;
              setCurrentUpdatePriority(priority);
              return flushPassiveEffectsImpl();
            } finally {
              setCurrentUpdatePriority(previousPriority);
              ReactCurrentBatchConfig$3.transition = prevTransition;
            }
          }
          return false;
        }
        function enqueuePendingPassiveProfilerEffect(fiber) {
          {
            pendingPassiveProfilerEffects.push(fiber);
            if (!rootDoesHavePassiveEffects) {
              rootDoesHavePassiveEffects = true;
              scheduleCallback$1(NormalPriority, function() {
                flushPassiveEffects();
                return null;
              });
            }
          }
        }
        function flushPassiveEffectsImpl() {
          if (rootWithPendingPassiveEffects === null) {
            return false;
          }
          var transitions = pendingPassiveTransitions;
          pendingPassiveTransitions = null;
          var root2 = rootWithPendingPassiveEffects;
          var lanes = pendingPassiveEffectsLanes;
          rootWithPendingPassiveEffects = null;
          pendingPassiveEffectsLanes = NoLanes;
          if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
            throw new Error("Cannot flush passive effects while already rendering.");
          }
          {
            isFlushingPassiveEffects = true;
            didScheduleUpdateDuringPassiveEffects = false;
          }
          {
            markPassiveEffectsStarted(lanes);
          }
          var prevExecutionContext = executionContext;
          executionContext |= CommitContext;
          commitPassiveUnmountEffects(root2.current);
          commitPassiveMountEffects(root2, root2.current, lanes, transitions);
          {
            var profilerEffects = pendingPassiveProfilerEffects;
            pendingPassiveProfilerEffects = [];
            for (var i2 = 0; i2 < profilerEffects.length; i2++) {
              var _fiber = profilerEffects[i2];
              commitPassiveEffectDurations(root2, _fiber);
            }
          }
          {
            markPassiveEffectsStopped();
          }
          {
            commitDoubleInvokeEffectsInDEV(root2.current, true);
          }
          executionContext = prevExecutionContext;
          flushSyncCallbacks();
          {
            if (didScheduleUpdateDuringPassiveEffects) {
              if (root2 === rootWithPassiveNestedUpdates) {
                nestedPassiveUpdateCount++;
              } else {
                nestedPassiveUpdateCount = 0;
                rootWithPassiveNestedUpdates = root2;
              }
            } else {
              nestedPassiveUpdateCount = 0;
            }
            isFlushingPassiveEffects = false;
            didScheduleUpdateDuringPassiveEffects = false;
          }
          onPostCommitRoot(root2);
          {
            var stateNode = root2.current.stateNode;
            stateNode.effectDuration = 0;
            stateNode.passiveEffectDuration = 0;
          }
          return true;
        }
        function isAlreadyFailedLegacyErrorBoundary(instance) {
          return legacyErrorBoundariesThatAlreadyFailed !== null && legacyErrorBoundariesThatAlreadyFailed.has(instance);
        }
        function markLegacyErrorBoundaryAsFailed(instance) {
          if (legacyErrorBoundariesThatAlreadyFailed === null) {
            legacyErrorBoundariesThatAlreadyFailed = /* @__PURE__ */ new Set([instance]);
          } else {
            legacyErrorBoundariesThatAlreadyFailed.add(instance);
          }
        }
        function prepareToThrowUncaughtError(error2) {
          if (!hasUncaughtError) {
            hasUncaughtError = true;
            firstUncaughtError = error2;
          }
        }
        var onUncaughtError = prepareToThrowUncaughtError;
        function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error2) {
          var errorInfo = createCapturedValueAtFiber(error2, sourceFiber);
          var update = createRootErrorUpdate(rootFiber, errorInfo, SyncLane);
          var root2 = enqueueUpdate(rootFiber, update, SyncLane);
          var eventTime = requestEventTime();
          if (root2 !== null) {
            markRootUpdated(root2, SyncLane, eventTime);
            ensureRootIsScheduled(root2, eventTime);
          }
        }
        function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error$1) {
          {
            reportUncaughtErrorInDEV(error$1);
            setIsRunningInsertionEffect(false);
          }
          if (sourceFiber.tag === HostRoot) {
            captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error$1);
            return;
          }
          var fiber = null;
          {
            fiber = nearestMountedAncestor;
          }
          while (fiber !== null) {
            if (fiber.tag === HostRoot) {
              captureCommitPhaseErrorOnRoot(fiber, sourceFiber, error$1);
              return;
            } else if (fiber.tag === ClassComponent) {
              var ctor = fiber.type;
              var instance = fiber.stateNode;
              if (typeof ctor.getDerivedStateFromError === "function" || typeof instance.componentDidCatch === "function" && !isAlreadyFailedLegacyErrorBoundary(instance)) {
                var errorInfo = createCapturedValueAtFiber(error$1, sourceFiber);
                var update = createClassErrorUpdate(fiber, errorInfo, SyncLane);
                var root2 = enqueueUpdate(fiber, update, SyncLane);
                var eventTime = requestEventTime();
                if (root2 !== null) {
                  markRootUpdated(root2, SyncLane, eventTime);
                  ensureRootIsScheduled(root2, eventTime);
                }
                return;
              }
            }
            fiber = fiber.return;
          }
          {
            error("Internal React error: Attempted to capture a commit phase error inside a detached tree. This indicates a bug in React. Likely causes include deleting the same fiber more than once, committing an already-finished tree, or an inconsistent return pointer.\n\nError message:\n\n%s", error$1);
          }
        }
        function pingSuspendedRoot(root2, wakeable, pingedLanes) {
          var pingCache = root2.pingCache;
          if (pingCache !== null) {
            pingCache.delete(wakeable);
          }
          var eventTime = requestEventTime();
          markRootPinged(root2, pingedLanes);
          warnIfSuspenseResolutionNotWrappedWithActDEV(root2);
          if (workInProgressRoot === root2 && isSubsetOfLanes(workInProgressRootRenderLanes, pingedLanes)) {
            if (workInProgressRootExitStatus === RootSuspendedWithDelay || workInProgressRootExitStatus === RootSuspended && includesOnlyRetries(workInProgressRootRenderLanes) && now() - globalMostRecentFallbackTime < FALLBACK_THROTTLE_MS) {
              prepareFreshStack(root2, NoLanes);
            } else {
              workInProgressRootPingedLanes = mergeLanes(workInProgressRootPingedLanes, pingedLanes);
            }
          }
          ensureRootIsScheduled(root2, eventTime);
        }
        function retryTimedOutBoundary(boundaryFiber, retryLane) {
          if (retryLane === NoLane) {
            retryLane = requestRetryLane(boundaryFiber);
          }
          var eventTime = requestEventTime();
          var root2 = enqueueConcurrentRenderForLane(boundaryFiber, retryLane);
          if (root2 !== null) {
            markRootUpdated(root2, retryLane, eventTime);
            ensureRootIsScheduled(root2, eventTime);
          }
        }
        function retryDehydratedSuspenseBoundary(boundaryFiber) {
          var suspenseState = boundaryFiber.memoizedState;
          var retryLane = NoLane;
          if (suspenseState !== null) {
            retryLane = suspenseState.retryLane;
          }
          retryTimedOutBoundary(boundaryFiber, retryLane);
        }
        function resolveRetryWakeable(boundaryFiber, wakeable) {
          var retryLane = NoLane;
          var retryCache;
          switch (boundaryFiber.tag) {
            case SuspenseComponent:
              retryCache = boundaryFiber.stateNode;
              var suspenseState = boundaryFiber.memoizedState;
              if (suspenseState !== null) {
                retryLane = suspenseState.retryLane;
              }
              break;
            case SuspenseListComponent:
              retryCache = boundaryFiber.stateNode;
              break;
            default:
              throw new Error("Pinged unknown suspense boundary type. This is probably a bug in React.");
          }
          if (retryCache !== null) {
            retryCache.delete(wakeable);
          }
          retryTimedOutBoundary(boundaryFiber, retryLane);
        }
        function jnd(timeElapsed) {
          return timeElapsed < 120 ? 120 : timeElapsed < 480 ? 480 : timeElapsed < 1080 ? 1080 : timeElapsed < 1920 ? 1920 : timeElapsed < 3e3 ? 3e3 : timeElapsed < 4320 ? 4320 : ceil2(timeElapsed / 1960) * 1960;
        }
        function checkForNestedUpdates() {
          if (nestedUpdateCount > NESTED_UPDATE_LIMIT) {
            nestedUpdateCount = 0;
            rootWithNestedUpdates = null;
            throw new Error("Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.");
          }
          {
            if (nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT) {
              nestedPassiveUpdateCount = 0;
              rootWithPassiveNestedUpdates = null;
              error("Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render.");
            }
          }
        }
        function flushRenderPhaseStrictModeWarningsInDEV() {
          {
            ReactStrictModeWarnings.flushLegacyContextWarning();
            {
              ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings();
            }
          }
        }
        function commitDoubleInvokeEffectsInDEV(fiber, hasPassiveEffects) {
          {
            setCurrentFiber(fiber);
            invokeEffectsInDev(fiber, MountLayoutDev, invokeLayoutEffectUnmountInDEV);
            if (hasPassiveEffects) {
              invokeEffectsInDev(fiber, MountPassiveDev, invokePassiveEffectUnmountInDEV);
            }
            invokeEffectsInDev(fiber, MountLayoutDev, invokeLayoutEffectMountInDEV);
            if (hasPassiveEffects) {
              invokeEffectsInDev(fiber, MountPassiveDev, invokePassiveEffectMountInDEV);
            }
            resetCurrentFiber();
          }
        }
        function invokeEffectsInDev(firstChild, fiberFlags, invokeEffectFn) {
          {
            var current2 = firstChild;
            var subtreeRoot = null;
            while (current2 !== null) {
              var primarySubtreeFlag = current2.subtreeFlags & fiberFlags;
              if (current2 !== subtreeRoot && current2.child !== null && primarySubtreeFlag !== NoFlags) {
                current2 = current2.child;
              } else {
                if ((current2.flags & fiberFlags) !== NoFlags) {
                  invokeEffectFn(current2);
                }
                if (current2.sibling !== null) {
                  current2 = current2.sibling;
                } else {
                  current2 = subtreeRoot = current2.return;
                }
              }
            }
          }
        }
        var didWarnStateUpdateForNotYetMountedComponent = null;
        function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) {
          {
            if ((executionContext & RenderContext) !== NoContext) {
              return;
            }
            if (!(fiber.mode & ConcurrentMode)) {
              return;
            }
            var tag = fiber.tag;
            if (tag !== IndeterminateComponent && tag !== HostRoot && tag !== ClassComponent && tag !== FunctionComponent && tag !== ForwardRef && tag !== MemoComponent && tag !== SimpleMemoComponent) {
              return;
            }
            var componentName = getComponentNameFromFiber(fiber) || "ReactComponent";
            if (didWarnStateUpdateForNotYetMountedComponent !== null) {
              if (didWarnStateUpdateForNotYetMountedComponent.has(componentName)) {
                return;
              }
              didWarnStateUpdateForNotYetMountedComponent.add(componentName);
            } else {
              didWarnStateUpdateForNotYetMountedComponent = /* @__PURE__ */ new Set([componentName]);
            }
            var previousFiber = current;
            try {
              setCurrentFiber(fiber);
              error("Can't perform a React state update on a component that hasn't mounted yet. This indicates that you have a side-effect in your render function that asynchronously later calls tries to update the component. Move this work to useEffect instead.");
            } finally {
              if (previousFiber) {
                setCurrentFiber(fiber);
              } else {
                resetCurrentFiber();
              }
            }
          }
        }
        var beginWork$1;
        {
          var dummyFiber = null;
          beginWork$1 = function(current2, unitOfWork, lanes) {
            var originalWorkInProgressCopy = assignFiberPropertiesInDEV(dummyFiber, unitOfWork);
            try {
              return beginWork(current2, unitOfWork, lanes);
            } catch (originalError) {
              if (didSuspendOrErrorWhileHydratingDEV() || originalError !== null && typeof originalError === "object" && typeof originalError.then === "function") {
                throw originalError;
              }
              resetContextDependencies();
              resetHooksAfterThrow();
              unwindInterruptedWork(current2, unitOfWork);
              assignFiberPropertiesInDEV(unitOfWork, originalWorkInProgressCopy);
              if (unitOfWork.mode & ProfileMode) {
                startProfilerTimer(unitOfWork);
              }
              invokeGuardedCallback(null, beginWork, null, current2, unitOfWork, lanes);
              if (hasCaughtError()) {
                var replayError = clearCaughtError();
                if (typeof replayError === "object" && replayError !== null && replayError._suppressLogging && typeof originalError === "object" && originalError !== null && !originalError._suppressLogging) {
                  originalError._suppressLogging = true;
                }
              }
              throw originalError;
            }
          };
        }
        var didWarnAboutUpdateInRender = false;
        var didWarnAboutUpdateInRenderForAnotherComponent;
        {
          didWarnAboutUpdateInRenderForAnotherComponent = /* @__PURE__ */ new Set();
        }
        function warnAboutRenderPhaseUpdatesInDEV(fiber) {
          {
            if (isRendering && !getIsUpdatingOpaqueValueInRenderPhaseInDEV()) {
              switch (fiber.tag) {
                case FunctionComponent:
                case ForwardRef:
                case SimpleMemoComponent: {
                  var renderingComponentName = workInProgress && getComponentNameFromFiber(workInProgress) || "Unknown";
                  var dedupeKey = renderingComponentName;
                  if (!didWarnAboutUpdateInRenderForAnotherComponent.has(dedupeKey)) {
                    didWarnAboutUpdateInRenderForAnotherComponent.add(dedupeKey);
                    var setStateComponentName = getComponentNameFromFiber(fiber) || "Unknown";
                    error("Cannot update a component (`%s`) while rendering a different component (`%s`). To locate the bad setState() call inside `%s`, follow the stack trace as described in https://reactjs.org/link/setstate-in-render", setStateComponentName, renderingComponentName, renderingComponentName);
                  }
                  break;
                }
                case ClassComponent: {
                  if (!didWarnAboutUpdateInRender) {
                    error("Cannot update during an existing state transition (such as within `render`). Render methods should be a pure function of props and state.");
                    didWarnAboutUpdateInRender = true;
                  }
                  break;
                }
              }
            }
          }
        }
        function restorePendingUpdaters(root2, lanes) {
          {
            if (isDevToolsPresent) {
              var memoizedUpdaters = root2.memoizedUpdaters;
              memoizedUpdaters.forEach(function(schedulingFiber) {
                addFiberToLanesMap(root2, schedulingFiber, lanes);
              });
            }
          }
        }
        var fakeActCallbackNode = {};
        function scheduleCallback$1(priorityLevel, callback) {
          {
            var actQueue = ReactCurrentActQueue$1.current;
            if (actQueue !== null) {
              actQueue.push(callback);
              return fakeActCallbackNode;
            } else {
              return scheduleCallback(priorityLevel, callback);
            }
          }
        }
        function cancelCallback$1(callbackNode) {
          if (callbackNode === fakeActCallbackNode) {
            return;
          }
          return cancelCallback(callbackNode);
        }
        function shouldForceFlushFallbacksInDEV() {
          return ReactCurrentActQueue$1.current !== null;
        }
        function warnIfUpdatesNotWrappedWithActDEV(fiber) {
          {
            if (fiber.mode & ConcurrentMode) {
              if (!isConcurrentActEnvironment()) {
                return;
              }
            } else {
              if (!isLegacyActEnvironment()) {
                return;
              }
              if (executionContext !== NoContext) {
                return;
              }
              if (fiber.tag !== FunctionComponent && fiber.tag !== ForwardRef && fiber.tag !== SimpleMemoComponent) {
                return;
              }
            }
            if (ReactCurrentActQueue$1.current === null) {
              var previousFiber = current;
              try {
                setCurrentFiber(fiber);
                error("An update to %s inside a test was not wrapped in act(...).\n\nWhen testing, code that causes React state updates should be wrapped into act(...):\n\nact(() => {\n  /* fire events that update state */\n});\n/* assert on the output */\n\nThis ensures that you're testing the behavior the user would see in the browser. Learn more at https://reactjs.org/link/wrap-tests-with-act", getComponentNameFromFiber(fiber));
              } finally {
                if (previousFiber) {
                  setCurrentFiber(fiber);
                } else {
                  resetCurrentFiber();
                }
              }
            }
          }
        }
        function warnIfSuspenseResolutionNotWrappedWithActDEV(root2) {
          {
            if (root2.tag !== LegacyRoot && isConcurrentActEnvironment() && ReactCurrentActQueue$1.current === null) {
              error("A suspended resource finished loading inside a test, but the event was not wrapped in act(...).\n\nWhen testing, code that resolves suspended data should be wrapped into act(...):\n\nact(() => {\n  /* finish loading suspended data */\n});\n/* assert on the output */\n\nThis ensures that you're testing the behavior the user would see in the browser. Learn more at https://reactjs.org/link/wrap-tests-with-act");
            }
          }
        }
        function setIsRunningInsertionEffect(isRunning) {
          {
            isRunningInsertionEffect = isRunning;
          }
        }
        var resolveFamily = null;
        var failedBoundaries = null;
        var setRefreshHandler = function(handler) {
          {
            resolveFamily = handler;
          }
        };
        function resolveFunctionForHotReloading(type) {
          {
            if (resolveFamily === null) {
              return type;
            }
            var family = resolveFamily(type);
            if (family === void 0) {
              return type;
            }
            return family.current;
          }
        }
        function resolveClassForHotReloading(type) {
          return resolveFunctionForHotReloading(type);
        }
        function resolveForwardRefForHotReloading(type) {
          {
            if (resolveFamily === null) {
              return type;
            }
            var family = resolveFamily(type);
            if (family === void 0) {
              if (type !== null && type !== void 0 && typeof type.render === "function") {
                var currentRender = resolveFunctionForHotReloading(type.render);
                if (type.render !== currentRender) {
                  var syntheticType = {
                    $$typeof: REACT_FORWARD_REF_TYPE,
                    render: currentRender
                  };
                  if (type.displayName !== void 0) {
                    syntheticType.displayName = type.displayName;
                  }
                  return syntheticType;
                }
              }
              return type;
            }
            return family.current;
          }
        }
        function isCompatibleFamilyForHotReloading(fiber, element) {
          {
            if (resolveFamily === null) {
              return false;
            }
            var prevType = fiber.elementType;
            var nextType = element.type;
            var needsCompareFamilies = false;
            var $$typeofNextType = typeof nextType === "object" && nextType !== null ? nextType.$$typeof : null;
            switch (fiber.tag) {
              case ClassComponent: {
                if (typeof nextType === "function") {
                  needsCompareFamilies = true;
                }
                break;
              }
              case FunctionComponent: {
                if (typeof nextType === "function") {
                  needsCompareFamilies = true;
                } else if ($$typeofNextType === REACT_LAZY_TYPE) {
                  needsCompareFamilies = true;
                }
                break;
              }
              case ForwardRef: {
                if ($$typeofNextType === REACT_FORWARD_REF_TYPE) {
                  needsCompareFamilies = true;
                } else if ($$typeofNextType === REACT_LAZY_TYPE) {
                  needsCompareFamilies = true;
                }
                break;
              }
              case MemoComponent:
              case SimpleMemoComponent: {
                if ($$typeofNextType === REACT_MEMO_TYPE) {
                  needsCompareFamilies = true;
                } else if ($$typeofNextType === REACT_LAZY_TYPE) {
                  needsCompareFamilies = true;
                }
                break;
              }
              default:
                return false;
            }
            if (needsCompareFamilies) {
              var prevFamily = resolveFamily(prevType);
              if (prevFamily !== void 0 && prevFamily === resolveFamily(nextType)) {
                return true;
              }
            }
            return false;
          }
        }
        function markFailedErrorBoundaryForHotReloading(fiber) {
          {
            if (resolveFamily === null) {
              return;
            }
            if (typeof WeakSet !== "function") {
              return;
            }
            if (failedBoundaries === null) {
              failedBoundaries = /* @__PURE__ */ new WeakSet();
            }
            failedBoundaries.add(fiber);
          }
        }
        var scheduleRefresh = function(root2, update) {
          {
            if (resolveFamily === null) {
              return;
            }
            var staleFamilies = update.staleFamilies, updatedFamilies = update.updatedFamilies;
            flushPassiveEffects();
            flushSync(function() {
              scheduleFibersWithFamiliesRecursively(root2.current, updatedFamilies, staleFamilies);
            });
          }
        };
        var scheduleRoot = function(root2, element) {
          {
            if (root2.context !== emptyContextObject) {
              return;
            }
            flushPassiveEffects();
            flushSync(function() {
              updateContainer(element, root2, null, null);
            });
          }
        };
        function scheduleFibersWithFamiliesRecursively(fiber, updatedFamilies, staleFamilies) {
          {
            var alternate = fiber.alternate, child = fiber.child, sibling = fiber.sibling, tag = fiber.tag, type = fiber.type;
            var candidateType = null;
            switch (tag) {
              case FunctionComponent:
              case SimpleMemoComponent:
              case ClassComponent:
                candidateType = type;
                break;
              case ForwardRef:
                candidateType = type.render;
                break;
            }
            if (resolveFamily === null) {
              throw new Error("Expected resolveFamily to be set during hot reload.");
            }
            var needsRender = false;
            var needsRemount = false;
            if (candidateType !== null) {
              var family = resolveFamily(candidateType);
              if (family !== void 0) {
                if (staleFamilies.has(family)) {
                  needsRemount = true;
                } else if (updatedFamilies.has(family)) {
                  if (tag === ClassComponent) {
                    needsRemount = true;
                  } else {
                    needsRender = true;
                  }
                }
              }
            }
            if (failedBoundaries !== null) {
              if (failedBoundaries.has(fiber) || alternate !== null && failedBoundaries.has(alternate)) {
                needsRemount = true;
              }
            }
            if (needsRemount) {
              fiber._debugNeedsRemount = true;
            }
            if (needsRemount || needsRender) {
              var _root = enqueueConcurrentRenderForLane(fiber, SyncLane);
              if (_root !== null) {
                scheduleUpdateOnFiber(_root, fiber, SyncLane, NoTimestamp);
              }
            }
            if (child !== null && !needsRemount) {
              scheduleFibersWithFamiliesRecursively(child, updatedFamilies, staleFamilies);
            }
            if (sibling !== null) {
              scheduleFibersWithFamiliesRecursively(sibling, updatedFamilies, staleFamilies);
            }
          }
        }
        var findHostInstancesForRefresh = function(root2, families) {
          {
            var hostInstances = /* @__PURE__ */ new Set();
            var types = new Set(families.map(function(family) {
              return family.current;
            }));
            findHostInstancesForMatchingFibersRecursively(root2.current, types, hostInstances);
            return hostInstances;
          }
        };
        function findHostInstancesForMatchingFibersRecursively(fiber, types, hostInstances) {
          {
            var child = fiber.child, sibling = fiber.sibling, tag = fiber.tag, type = fiber.type;
            var candidateType = null;
            switch (tag) {
              case FunctionComponent:
              case SimpleMemoComponent:
              case ClassComponent:
                candidateType = type;
                break;
              case ForwardRef:
                candidateType = type.render;
                break;
            }
            var didMatch = false;
            if (candidateType !== null) {
              if (types.has(candidateType)) {
                didMatch = true;
              }
            }
            if (didMatch) {
              findHostInstancesForFiberShallowly(fiber, hostInstances);
            } else {
              if (child !== null) {
                findHostInstancesForMatchingFibersRecursively(child, types, hostInstances);
              }
            }
            if (sibling !== null) {
              findHostInstancesForMatchingFibersRecursively(sibling, types, hostInstances);
            }
          }
        }
        function findHostInstancesForFiberShallowly(fiber, hostInstances) {
          {
            var foundHostInstances = findChildHostInstancesForFiberShallowly(fiber, hostInstances);
            if (foundHostInstances) {
              return;
            }
            var node = fiber;
            while (true) {
              switch (node.tag) {
                case HostComponent:
                  hostInstances.add(node.stateNode);
                  return;
                case HostPortal:
                  hostInstances.add(node.stateNode.containerInfo);
                  return;
                case HostRoot:
                  hostInstances.add(node.stateNode.containerInfo);
                  return;
              }
              if (node.return === null) {
                throw new Error("Expected to reach root first.");
              }
              node = node.return;
            }
          }
        }
        function findChildHostInstancesForFiberShallowly(fiber, hostInstances) {
          {
            var node = fiber;
            var foundHostInstances = false;
            while (true) {
              if (node.tag === HostComponent) {
                foundHostInstances = true;
                hostInstances.add(node.stateNode);
              } else if (node.child !== null) {
                node.child.return = node;
                node = node.child;
                continue;
              }
              if (node === fiber) {
                return foundHostInstances;
              }
              while (node.sibling === null) {
                if (node.return === null || node.return === fiber) {
                  return foundHostInstances;
                }
                node = node.return;
              }
              node.sibling.return = node.return;
              node = node.sibling;
            }
          }
          return false;
        }
        var hasBadMapPolyfill;
        {
          hasBadMapPolyfill = false;
          try {
            var nonExtensibleObject = Object.preventExtensions({});
            /* @__PURE__ */ new Map([[nonExtensibleObject, null]]);
            /* @__PURE__ */ new Set([nonExtensibleObject]);
          } catch (e) {
            hasBadMapPolyfill = true;
          }
        }
        function FiberNode(tag, pendingProps, key, mode) {
          this.tag = tag;
          this.key = key;
          this.elementType = null;
          this.type = null;
          this.stateNode = null;
          this.return = null;
          this.child = null;
          this.sibling = null;
          this.index = 0;
          this.ref = null;
          this.pendingProps = pendingProps;
          this.memoizedProps = null;
          this.updateQueue = null;
          this.memoizedState = null;
          this.dependencies = null;
          this.mode = mode;
          this.flags = NoFlags;
          this.subtreeFlags = NoFlags;
          this.deletions = null;
          this.lanes = NoLanes;
          this.childLanes = NoLanes;
          this.alternate = null;
          {
            this.actualDuration = Number.NaN;
            this.actualStartTime = Number.NaN;
            this.selfBaseDuration = Number.NaN;
            this.treeBaseDuration = Number.NaN;
            this.actualDuration = 0;
            this.actualStartTime = -1;
            this.selfBaseDuration = 0;
            this.treeBaseDuration = 0;
          }
          {
            this._debugSource = null;
            this._debugOwner = null;
            this._debugNeedsRemount = false;
            this._debugHookTypes = null;
            if (!hasBadMapPolyfill && typeof Object.preventExtensions === "function") {
              Object.preventExtensions(this);
            }
          }
        }
        var createFiber = function(tag, pendingProps, key, mode) {
          return new FiberNode(tag, pendingProps, key, mode);
        };
        function shouldConstruct$1(Component) {
          var prototype = Component.prototype;
          return !!(prototype && prototype.isReactComponent);
        }
        function isSimpleFunctionComponent(type) {
          return typeof type === "function" && !shouldConstruct$1(type) && type.defaultProps === void 0;
        }
        function resolveLazyComponentTag(Component) {
          if (typeof Component === "function") {
            return shouldConstruct$1(Component) ? ClassComponent : FunctionComponent;
          } else if (Component !== void 0 && Component !== null) {
            var $$typeof = Component.$$typeof;
            if ($$typeof === REACT_FORWARD_REF_TYPE) {
              return ForwardRef;
            }
            if ($$typeof === REACT_MEMO_TYPE) {
              return MemoComponent;
            }
          }
          return IndeterminateComponent;
        }
        function createWorkInProgress(current2, pendingProps) {
          var workInProgress2 = current2.alternate;
          if (workInProgress2 === null) {
            workInProgress2 = createFiber(current2.tag, pendingProps, current2.key, current2.mode);
            workInProgress2.elementType = current2.elementType;
            workInProgress2.type = current2.type;
            workInProgress2.stateNode = current2.stateNode;
            {
              workInProgress2._debugSource = current2._debugSource;
              workInProgress2._debugOwner = current2._debugOwner;
              workInProgress2._debugHookTypes = current2._debugHookTypes;
            }
            workInProgress2.alternate = current2;
            current2.alternate = workInProgress2;
          } else {
            workInProgress2.pendingProps = pendingProps;
            workInProgress2.type = current2.type;
            workInProgress2.flags = NoFlags;
            workInProgress2.subtreeFlags = NoFlags;
            workInProgress2.deletions = null;
            {
              workInProgress2.actualDuration = 0;
              workInProgress2.actualStartTime = -1;
            }
          }
          workInProgress2.flags = current2.flags & StaticMask;
          workInProgress2.childLanes = current2.childLanes;
          workInProgress2.lanes = current2.lanes;
          workInProgress2.child = current2.child;
          workInProgress2.memoizedProps = current2.memoizedProps;
          workInProgress2.memoizedState = current2.memoizedState;
          workInProgress2.updateQueue = current2.updateQueue;
          var currentDependencies = current2.dependencies;
          workInProgress2.dependencies = currentDependencies === null ? null : {
            lanes: currentDependencies.lanes,
            firstContext: currentDependencies.firstContext
          };
          workInProgress2.sibling = current2.sibling;
          workInProgress2.index = current2.index;
          workInProgress2.ref = current2.ref;
          {
            workInProgress2.selfBaseDuration = current2.selfBaseDuration;
            workInProgress2.treeBaseDuration = current2.treeBaseDuration;
          }
          {
            workInProgress2._debugNeedsRemount = current2._debugNeedsRemount;
            switch (workInProgress2.tag) {
              case IndeterminateComponent:
              case FunctionComponent:
              case SimpleMemoComponent:
                workInProgress2.type = resolveFunctionForHotReloading(current2.type);
                break;
              case ClassComponent:
                workInProgress2.type = resolveClassForHotReloading(current2.type);
                break;
              case ForwardRef:
                workInProgress2.type = resolveForwardRefForHotReloading(current2.type);
                break;
            }
          }
          return workInProgress2;
        }
        function resetWorkInProgress(workInProgress2, renderLanes2) {
          workInProgress2.flags &= StaticMask | Placement;
          var current2 = workInProgress2.alternate;
          if (current2 === null) {
            workInProgress2.childLanes = NoLanes;
            workInProgress2.lanes = renderLanes2;
            workInProgress2.child = null;
            workInProgress2.subtreeFlags = NoFlags;
            workInProgress2.memoizedProps = null;
            workInProgress2.memoizedState = null;
            workInProgress2.updateQueue = null;
            workInProgress2.dependencies = null;
            workInProgress2.stateNode = null;
            {
              workInProgress2.selfBaseDuration = 0;
              workInProgress2.treeBaseDuration = 0;
            }
          } else {
            workInProgress2.childLanes = current2.childLanes;
            workInProgress2.lanes = current2.lanes;
            workInProgress2.child = current2.child;
            workInProgress2.subtreeFlags = NoFlags;
            workInProgress2.deletions = null;
            workInProgress2.memoizedProps = current2.memoizedProps;
            workInProgress2.memoizedState = current2.memoizedState;
            workInProgress2.updateQueue = current2.updateQueue;
            workInProgress2.type = current2.type;
            var currentDependencies = current2.dependencies;
            workInProgress2.dependencies = currentDependencies === null ? null : {
              lanes: currentDependencies.lanes,
              firstContext: currentDependencies.firstContext
            };
            {
              workInProgress2.selfBaseDuration = current2.selfBaseDuration;
              workInProgress2.treeBaseDuration = current2.treeBaseDuration;
            }
          }
          return workInProgress2;
        }
        function createHostRootFiber(tag, isStrictMode, concurrentUpdatesByDefaultOverride) {
          var mode;
          if (tag === ConcurrentRoot) {
            mode = ConcurrentMode;
            if (isStrictMode === true) {
              mode |= StrictLegacyMode;
              {
                mode |= StrictEffectsMode;
              }
            }
          } else {
            mode = NoMode;
          }
          if (isDevToolsPresent) {
            mode |= ProfileMode;
          }
          return createFiber(HostRoot, null, null, mode);
        }
        function createFiberFromTypeAndProps(type, key, pendingProps, owner, mode, lanes) {
          var fiberTag = IndeterminateComponent;
          var resolvedType = type;
          if (typeof type === "function") {
            if (shouldConstruct$1(type)) {
              fiberTag = ClassComponent;
              {
                resolvedType = resolveClassForHotReloading(resolvedType);
              }
            } else {
              {
                resolvedType = resolveFunctionForHotReloading(resolvedType);
              }
            }
          } else if (typeof type === "string") {
            fiberTag = HostComponent;
          } else {
            getTag:
              switch (type) {
                case REACT_FRAGMENT_TYPE:
                  return createFiberFromFragment(pendingProps.children, mode, lanes, key);
                case REACT_STRICT_MODE_TYPE:
                  fiberTag = Mode;
                  mode |= StrictLegacyMode;
                  if ((mode & ConcurrentMode) !== NoMode) {
                    mode |= StrictEffectsMode;
                  }
                  break;
                case REACT_PROFILER_TYPE:
                  return createFiberFromProfiler(pendingProps, mode, lanes, key);
                case REACT_SUSPENSE_TYPE:
                  return createFiberFromSuspense(pendingProps, mode, lanes, key);
                case REACT_SUSPENSE_LIST_TYPE:
                  return createFiberFromSuspenseList(pendingProps, mode, lanes, key);
                case REACT_OFFSCREEN_TYPE:
                  return createFiberFromOffscreen(pendingProps, mode, lanes, key);
                case REACT_LEGACY_HIDDEN_TYPE:
                case REACT_SCOPE_TYPE:
                case REACT_CACHE_TYPE:
                case REACT_TRACING_MARKER_TYPE:
                case REACT_DEBUG_TRACING_MODE_TYPE:
                default: {
                  if (typeof type === "object" && type !== null) {
                    switch (type.$$typeof) {
                      case REACT_PROVIDER_TYPE:
                        fiberTag = ContextProvider;
                        break getTag;
                      case REACT_CONTEXT_TYPE:
                        fiberTag = ContextConsumer;
                        break getTag;
                      case REACT_FORWARD_REF_TYPE:
                        fiberTag = ForwardRef;
                        {
                          resolvedType = resolveForwardRefForHotReloading(resolvedType);
                        }
                        break getTag;
                      case REACT_MEMO_TYPE:
                        fiberTag = MemoComponent;
                        break getTag;
                      case REACT_LAZY_TYPE:
                        fiberTag = LazyComponent;
                        resolvedType = null;
                        break getTag;
                    }
                  }
                  var info = "";
                  {
                    if (type === void 0 || typeof type === "object" && type !== null && Object.keys(type).length === 0) {
                      info += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.";
                    }
                    var ownerName = owner ? getComponentNameFromFiber(owner) : null;
                    if (ownerName) {
                      info += "\n\nCheck the render method of `" + ownerName + "`.";
                    }
                  }
                  throw new Error("Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) " + ("but got: " + (type == null ? type : typeof type) + "." + info));
                }
              }
          }
          var fiber = createFiber(fiberTag, pendingProps, key, mode);
          fiber.elementType = type;
          fiber.type = resolvedType;
          fiber.lanes = lanes;
          {
            fiber._debugOwner = owner;
          }
          return fiber;
        }
        function createFiberFromElement(element, mode, lanes) {
          var owner = null;
          {
            owner = element._owner;
          }
          var type = element.type;
          var key = element.key;
          var pendingProps = element.props;
          var fiber = createFiberFromTypeAndProps(type, key, pendingProps, owner, mode, lanes);
          {
            fiber._debugSource = element._source;
            fiber._debugOwner = element._owner;
          }
          return fiber;
        }
        function createFiberFromFragment(elements, mode, lanes, key) {
          var fiber = createFiber(Fragment27, elements, key, mode);
          fiber.lanes = lanes;
          return fiber;
        }
        function createFiberFromProfiler(pendingProps, mode, lanes, key) {
          {
            if (typeof pendingProps.id !== "string") {
              error('Profiler must specify an "id" of type `string` as a prop. Received the type `%s` instead.', typeof pendingProps.id);
            }
          }
          var fiber = createFiber(Profiler, pendingProps, key, mode | ProfileMode);
          fiber.elementType = REACT_PROFILER_TYPE;
          fiber.lanes = lanes;
          {
            fiber.stateNode = {
              effectDuration: 0,
              passiveEffectDuration: 0
            };
          }
          return fiber;
        }
        function createFiberFromSuspense(pendingProps, mode, lanes, key) {
          var fiber = createFiber(SuspenseComponent, pendingProps, key, mode);
          fiber.elementType = REACT_SUSPENSE_TYPE;
          fiber.lanes = lanes;
          return fiber;
        }
        function createFiberFromSuspenseList(pendingProps, mode, lanes, key) {
          var fiber = createFiber(SuspenseListComponent, pendingProps, key, mode);
          fiber.elementType = REACT_SUSPENSE_LIST_TYPE;
          fiber.lanes = lanes;
          return fiber;
        }
        function createFiberFromOffscreen(pendingProps, mode, lanes, key) {
          var fiber = createFiber(OffscreenComponent, pendingProps, key, mode);
          fiber.elementType = REACT_OFFSCREEN_TYPE;
          fiber.lanes = lanes;
          var primaryChildInstance = {
            isHidden: false
          };
          fiber.stateNode = primaryChildInstance;
          return fiber;
        }
        function createFiberFromText(content, mode, lanes) {
          var fiber = createFiber(HostText, content, null, mode);
          fiber.lanes = lanes;
          return fiber;
        }
        function createFiberFromHostInstanceForDeletion() {
          var fiber = createFiber(HostComponent, null, null, NoMode);
          fiber.elementType = "DELETED";
          return fiber;
        }
        function createFiberFromDehydratedFragment(dehydratedNode) {
          var fiber = createFiber(DehydratedFragment, null, null, NoMode);
          fiber.stateNode = dehydratedNode;
          return fiber;
        }
        function createFiberFromPortal(portal, mode, lanes) {
          var pendingProps = portal.children !== null ? portal.children : [];
          var fiber = createFiber(HostPortal, pendingProps, portal.key, mode);
          fiber.lanes = lanes;
          fiber.stateNode = {
            containerInfo: portal.containerInfo,
            pendingChildren: null,
            // Used by persistent updates
            implementation: portal.implementation
          };
          return fiber;
        }
        function assignFiberPropertiesInDEV(target, source) {
          if (target === null) {
            target = createFiber(IndeterminateComponent, null, null, NoMode);
          }
          target.tag = source.tag;
          target.key = source.key;
          target.elementType = source.elementType;
          target.type = source.type;
          target.stateNode = source.stateNode;
          target.return = source.return;
          target.child = source.child;
          target.sibling = source.sibling;
          target.index = source.index;
          target.ref = source.ref;
          target.pendingProps = source.pendingProps;
          target.memoizedProps = source.memoizedProps;
          target.updateQueue = source.updateQueue;
          target.memoizedState = source.memoizedState;
          target.dependencies = source.dependencies;
          target.mode = source.mode;
          target.flags = source.flags;
          target.subtreeFlags = source.subtreeFlags;
          target.deletions = source.deletions;
          target.lanes = source.lanes;
          target.childLanes = source.childLanes;
          target.alternate = source.alternate;
          {
            target.actualDuration = source.actualDuration;
            target.actualStartTime = source.actualStartTime;
            target.selfBaseDuration = source.selfBaseDuration;
            target.treeBaseDuration = source.treeBaseDuration;
          }
          target._debugSource = source._debugSource;
          target._debugOwner = source._debugOwner;
          target._debugNeedsRemount = source._debugNeedsRemount;
          target._debugHookTypes = source._debugHookTypes;
          return target;
        }
        function FiberRootNode(containerInfo, tag, hydrate2, identifierPrefix, onRecoverableError) {
          this.tag = tag;
          this.containerInfo = containerInfo;
          this.pendingChildren = null;
          this.current = null;
          this.pingCache = null;
          this.finishedWork = null;
          this.timeoutHandle = noTimeout;
          this.context = null;
          this.pendingContext = null;
          this.callbackNode = null;
          this.callbackPriority = NoLane;
          this.eventTimes = createLaneMap(NoLanes);
          this.expirationTimes = createLaneMap(NoTimestamp);
          this.pendingLanes = NoLanes;
          this.suspendedLanes = NoLanes;
          this.pingedLanes = NoLanes;
          this.expiredLanes = NoLanes;
          this.mutableReadLanes = NoLanes;
          this.finishedLanes = NoLanes;
          this.entangledLanes = NoLanes;
          this.entanglements = createLaneMap(NoLanes);
          this.identifierPrefix = identifierPrefix;
          this.onRecoverableError = onRecoverableError;
          {
            this.mutableSourceEagerHydrationData = null;
          }
          {
            this.effectDuration = 0;
            this.passiveEffectDuration = 0;
          }
          {
            this.memoizedUpdaters = /* @__PURE__ */ new Set();
            var pendingUpdatersLaneMap = this.pendingUpdatersLaneMap = [];
            for (var _i = 0; _i < TotalLanes; _i++) {
              pendingUpdatersLaneMap.push(/* @__PURE__ */ new Set());
            }
          }
          {
            switch (tag) {
              case ConcurrentRoot:
                this._debugRootType = hydrate2 ? "hydrateRoot()" : "createRoot()";
                break;
              case LegacyRoot:
                this._debugRootType = hydrate2 ? "hydrate()" : "render()";
                break;
            }
          }
        }
        function createFiberRoot(containerInfo, tag, hydrate2, initialChildren, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError, transitionCallbacks) {
          var root2 = new FiberRootNode(containerInfo, tag, hydrate2, identifierPrefix, onRecoverableError);
          var uninitializedFiber = createHostRootFiber(tag, isStrictMode);
          root2.current = uninitializedFiber;
          uninitializedFiber.stateNode = root2;
          {
            var _initialState = {
              element: initialChildren,
              isDehydrated: hydrate2,
              cache: null,
              // not enabled yet
              transitions: null,
              pendingSuspenseBoundaries: null
            };
            uninitializedFiber.memoizedState = _initialState;
          }
          initializeUpdateQueue(uninitializedFiber);
          return root2;
        }
        var ReactVersion = "18.3.1";
        function createPortal(children, containerInfo, implementation) {
          var key = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null;
          {
            checkKeyStringCoercion(key);
          }
          return {
            // This tag allow us to uniquely identify this as a React Portal
            $$typeof: REACT_PORTAL_TYPE,
            key: key == null ? null : "" + key,
            children,
            containerInfo,
            implementation
          };
        }
        var didWarnAboutNestedUpdates;
        var didWarnAboutFindNodeInStrictMode;
        {
          didWarnAboutNestedUpdates = false;
          didWarnAboutFindNodeInStrictMode = {};
        }
        function getContextForSubtree(parentComponent) {
          if (!parentComponent) {
            return emptyContextObject;
          }
          var fiber = get(parentComponent);
          var parentContext = findCurrentUnmaskedContext(fiber);
          if (fiber.tag === ClassComponent) {
            var Component = fiber.type;
            if (isContextProvider(Component)) {
              return processChildContext(fiber, Component, parentContext);
            }
          }
          return parentContext;
        }
        function findHostInstanceWithWarning(component, methodName) {
          {
            var fiber = get(component);
            if (fiber === void 0) {
              if (typeof component.render === "function") {
                throw new Error("Unable to find node on an unmounted component.");
              } else {
                var keys = Object.keys(component).join(",");
                throw new Error("Argument appears to not be a ReactComponent. Keys: " + keys);
              }
            }
            var hostFiber = findCurrentHostFiber(fiber);
            if (hostFiber === null) {
              return null;
            }
            if (hostFiber.mode & StrictLegacyMode) {
              var componentName = getComponentNameFromFiber(fiber) || "Component";
              if (!didWarnAboutFindNodeInStrictMode[componentName]) {
                didWarnAboutFindNodeInStrictMode[componentName] = true;
                var previousFiber = current;
                try {
                  setCurrentFiber(hostFiber);
                  if (fiber.mode & StrictLegacyMode) {
                    error("%s is deprecated in StrictMode. %s was passed an instance of %s which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node", methodName, methodName, componentName);
                  } else {
                    error("%s is deprecated in StrictMode. %s was passed an instance of %s which renders StrictMode children. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node", methodName, methodName, componentName);
                  }
                } finally {
                  if (previousFiber) {
                    setCurrentFiber(previousFiber);
                  } else {
                    resetCurrentFiber();
                  }
                }
              }
            }
            return hostFiber.stateNode;
          }
        }
        function createContainer(containerInfo, tag, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError, transitionCallbacks) {
          var hydrate2 = false;
          var initialChildren = null;
          return createFiberRoot(containerInfo, tag, hydrate2, initialChildren, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError);
        }
        function createHydrationContainer(initialChildren, callback, containerInfo, tag, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError, transitionCallbacks) {
          var hydrate2 = true;
          var root2 = createFiberRoot(containerInfo, tag, hydrate2, initialChildren, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError);
          root2.context = getContextForSubtree(null);
          var current2 = root2.current;
          var eventTime = requestEventTime();
          var lane = requestUpdateLane(current2);
          var update = createUpdate(eventTime, lane);
          update.callback = callback !== void 0 && callback !== null ? callback : null;
          enqueueUpdate(current2, update, lane);
          scheduleInitialHydrationOnRoot(root2, lane, eventTime);
          return root2;
        }
        function updateContainer(element, container, parentComponent, callback) {
          {
            onScheduleRoot(container, element);
          }
          var current$1 = container.current;
          var eventTime = requestEventTime();
          var lane = requestUpdateLane(current$1);
          {
            markRenderScheduled(lane);
          }
          var context = getContextForSubtree(parentComponent);
          if (container.context === null) {
            container.context = context;
          } else {
            container.pendingContext = context;
          }
          {
            if (isRendering && current !== null && !didWarnAboutNestedUpdates) {
              didWarnAboutNestedUpdates = true;
              error("Render methods should be a pure function of props and state; triggering nested component updates from render is not allowed. If necessary, trigger nested updates in componentDidUpdate.\n\nCheck the render method of %s.", getComponentNameFromFiber(current) || "Unknown");
            }
          }
          var update = createUpdate(eventTime, lane);
          update.payload = {
            element
          };
          callback = callback === void 0 ? null : callback;
          if (callback !== null) {
            {
              if (typeof callback !== "function") {
                error("render(...): Expected the last optional `callback` argument to be a function. Instead received: %s.", callback);
              }
            }
            update.callback = callback;
          }
          var root2 = enqueueUpdate(current$1, update, lane);
          if (root2 !== null) {
            scheduleUpdateOnFiber(root2, current$1, lane, eventTime);
            entangleTransitions(root2, current$1, lane);
          }
          return lane;
        }
        function getPublicRootInstance(container) {
          var containerFiber = container.current;
          if (!containerFiber.child) {
            return null;
          }
          switch (containerFiber.child.tag) {
            case HostComponent:
              return getPublicInstance(containerFiber.child.stateNode);
            default:
              return containerFiber.child.stateNode;
          }
        }
        function attemptSynchronousHydration$1(fiber) {
          switch (fiber.tag) {
            case HostRoot: {
              var root2 = fiber.stateNode;
              if (isRootDehydrated(root2)) {
                var lanes = getHighestPriorityPendingLanes(root2);
                flushRoot(root2, lanes);
              }
              break;
            }
            case SuspenseComponent: {
              flushSync(function() {
                var root3 = enqueueConcurrentRenderForLane(fiber, SyncLane);
                if (root3 !== null) {
                  var eventTime = requestEventTime();
                  scheduleUpdateOnFiber(root3, fiber, SyncLane, eventTime);
                }
              });
              var retryLane = SyncLane;
              markRetryLaneIfNotHydrated(fiber, retryLane);
              break;
            }
          }
        }
        function markRetryLaneImpl(fiber, retryLane) {
          var suspenseState = fiber.memoizedState;
          if (suspenseState !== null && suspenseState.dehydrated !== null) {
            suspenseState.retryLane = higherPriorityLane(suspenseState.retryLane, retryLane);
          }
        }
        function markRetryLaneIfNotHydrated(fiber, retryLane) {
          markRetryLaneImpl(fiber, retryLane);
          var alternate = fiber.alternate;
          if (alternate) {
            markRetryLaneImpl(alternate, retryLane);
          }
        }
        function attemptContinuousHydration$1(fiber) {
          if (fiber.tag !== SuspenseComponent) {
            return;
          }
          var lane = SelectiveHydrationLane;
          var root2 = enqueueConcurrentRenderForLane(fiber, lane);
          if (root2 !== null) {
            var eventTime = requestEventTime();
            scheduleUpdateOnFiber(root2, fiber, lane, eventTime);
          }
          markRetryLaneIfNotHydrated(fiber, lane);
        }
        function attemptHydrationAtCurrentPriority$1(fiber) {
          if (fiber.tag !== SuspenseComponent) {
            return;
          }
          var lane = requestUpdateLane(fiber);
          var root2 = enqueueConcurrentRenderForLane(fiber, lane);
          if (root2 !== null) {
            var eventTime = requestEventTime();
            scheduleUpdateOnFiber(root2, fiber, lane, eventTime);
          }
          markRetryLaneIfNotHydrated(fiber, lane);
        }
        function findHostInstanceWithNoPortals(fiber) {
          var hostFiber = findCurrentHostFiberWithNoPortals(fiber);
          if (hostFiber === null) {
            return null;
          }
          return hostFiber.stateNode;
        }
        var shouldErrorImpl = function(fiber) {
          return null;
        };
        function shouldError(fiber) {
          return shouldErrorImpl(fiber);
        }
        var shouldSuspendImpl = function(fiber) {
          return false;
        };
        function shouldSuspend(fiber) {
          return shouldSuspendImpl(fiber);
        }
        var overrideHookState = null;
        var overrideHookStateDeletePath = null;
        var overrideHookStateRenamePath = null;
        var overrideProps = null;
        var overridePropsDeletePath = null;
        var overridePropsRenamePath = null;
        var scheduleUpdate = null;
        var setErrorHandler = null;
        var setSuspenseHandler = null;
        {
          var copyWithDeleteImpl = function(obj, path, index2) {
            var key = path[index2];
            var updated = isArray(obj) ? obj.slice() : assign({}, obj);
            if (index2 + 1 === path.length) {
              if (isArray(updated)) {
                updated.splice(key, 1);
              } else {
                delete updated[key];
              }
              return updated;
            }
            updated[key] = copyWithDeleteImpl(obj[key], path, index2 + 1);
            return updated;
          };
          var copyWithDelete = function(obj, path) {
            return copyWithDeleteImpl(obj, path, 0);
          };
          var copyWithRenameImpl = function(obj, oldPath, newPath, index2) {
            var oldKey = oldPath[index2];
            var updated = isArray(obj) ? obj.slice() : assign({}, obj);
            if (index2 + 1 === oldPath.length) {
              var newKey = newPath[index2];
              updated[newKey] = updated[oldKey];
              if (isArray(updated)) {
                updated.splice(oldKey, 1);
              } else {
                delete updated[oldKey];
              }
            } else {
              updated[oldKey] = copyWithRenameImpl(
                // $FlowFixMe number or string is fine here
                obj[oldKey],
                oldPath,
                newPath,
                index2 + 1
              );
            }
            return updated;
          };
          var copyWithRename = function(obj, oldPath, newPath) {
            if (oldPath.length !== newPath.length) {
              warn("copyWithRename() expects paths of the same length");
              return;
            } else {
              for (var i2 = 0; i2 < newPath.length - 1; i2++) {
                if (oldPath[i2] !== newPath[i2]) {
                  warn("copyWithRename() expects paths to be the same except for the deepest key");
                  return;
                }
              }
            }
            return copyWithRenameImpl(obj, oldPath, newPath, 0);
          };
          var copyWithSetImpl = function(obj, path, index2, value) {
            if (index2 >= path.length) {
              return value;
            }
            var key = path[index2];
            var updated = isArray(obj) ? obj.slice() : assign({}, obj);
            updated[key] = copyWithSetImpl(obj[key], path, index2 + 1, value);
            return updated;
          };
          var copyWithSet = function(obj, path, value) {
            return copyWithSetImpl(obj, path, 0, value);
          };
          var findHook = function(fiber, id2) {
            var currentHook2 = fiber.memoizedState;
            while (currentHook2 !== null && id2 > 0) {
              currentHook2 = currentHook2.next;
              id2--;
            }
            return currentHook2;
          };
          overrideHookState = function(fiber, id2, path, value) {
            var hook = findHook(fiber, id2);
            if (hook !== null) {
              var newState = copyWithSet(hook.memoizedState, path, value);
              hook.memoizedState = newState;
              hook.baseState = newState;
              fiber.memoizedProps = assign({}, fiber.memoizedProps);
              var root2 = enqueueConcurrentRenderForLane(fiber, SyncLane);
              if (root2 !== null) {
                scheduleUpdateOnFiber(root2, fiber, SyncLane, NoTimestamp);
              }
            }
          };
          overrideHookStateDeletePath = function(fiber, id2, path) {
            var hook = findHook(fiber, id2);
            if (hook !== null) {
              var newState = copyWithDelete(hook.memoizedState, path);
              hook.memoizedState = newState;
              hook.baseState = newState;
              fiber.memoizedProps = assign({}, fiber.memoizedProps);
              var root2 = enqueueConcurrentRenderForLane(fiber, SyncLane);
              if (root2 !== null) {
                scheduleUpdateOnFiber(root2, fiber, SyncLane, NoTimestamp);
              }
            }
          };
          overrideHookStateRenamePath = function(fiber, id2, oldPath, newPath) {
            var hook = findHook(fiber, id2);
            if (hook !== null) {
              var newState = copyWithRename(hook.memoizedState, oldPath, newPath);
              hook.memoizedState = newState;
              hook.baseState = newState;
              fiber.memoizedProps = assign({}, fiber.memoizedProps);
              var root2 = enqueueConcurrentRenderForLane(fiber, SyncLane);
              if (root2 !== null) {
                scheduleUpdateOnFiber(root2, fiber, SyncLane, NoTimestamp);
              }
            }
          };
          overrideProps = function(fiber, path, value) {
            fiber.pendingProps = copyWithSet(fiber.memoizedProps, path, value);
            if (fiber.alternate) {
              fiber.alternate.pendingProps = fiber.pendingProps;
            }
            var root2 = enqueueConcurrentRenderForLane(fiber, SyncLane);
            if (root2 !== null) {
              scheduleUpdateOnFiber(root2, fiber, SyncLane, NoTimestamp);
            }
          };
          overridePropsDeletePath = function(fiber, path) {
            fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path);
            if (fiber.alternate) {
              fiber.alternate.pendingProps = fiber.pendingProps;
            }
            var root2 = enqueueConcurrentRenderForLane(fiber, SyncLane);
            if (root2 !== null) {
              scheduleUpdateOnFiber(root2, fiber, SyncLane, NoTimestamp);
            }
          };
          overridePropsRenamePath = function(fiber, oldPath, newPath) {
            fiber.pendingProps = copyWithRename(fiber.memoizedProps, oldPath, newPath);
            if (fiber.alternate) {
              fiber.alternate.pendingProps = fiber.pendingProps;
            }
            var root2 = enqueueConcurrentRenderForLane(fiber, SyncLane);
            if (root2 !== null) {
              scheduleUpdateOnFiber(root2, fiber, SyncLane, NoTimestamp);
            }
          };
          scheduleUpdate = function(fiber) {
            var root2 = enqueueConcurrentRenderForLane(fiber, SyncLane);
            if (root2 !== null) {
              scheduleUpdateOnFiber(root2, fiber, SyncLane, NoTimestamp);
            }
          };
          setErrorHandler = function(newShouldErrorImpl) {
            shouldErrorImpl = newShouldErrorImpl;
          };
          setSuspenseHandler = function(newShouldSuspendImpl) {
            shouldSuspendImpl = newShouldSuspendImpl;
          };
        }
        function findHostInstanceByFiber(fiber) {
          var hostFiber = findCurrentHostFiber(fiber);
          if (hostFiber === null) {
            return null;
          }
          return hostFiber.stateNode;
        }
        function emptyFindFiberByHostInstance(instance) {
          return null;
        }
        function getCurrentFiberForDevTools() {
          return current;
        }
        function injectIntoDevTools(devToolsConfig) {
          var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance;
          var ReactCurrentDispatcher2 = ReactSharedInternals.ReactCurrentDispatcher;
          return injectInternals({
            bundleType: devToolsConfig.bundleType,
            version: devToolsConfig.version,
            rendererPackageName: devToolsConfig.rendererPackageName,
            rendererConfig: devToolsConfig.rendererConfig,
            overrideHookState,
            overrideHookStateDeletePath,
            overrideHookStateRenamePath,
            overrideProps,
            overridePropsDeletePath,
            overridePropsRenamePath,
            setErrorHandler,
            setSuspenseHandler,
            scheduleUpdate,
            currentDispatcherRef: ReactCurrentDispatcher2,
            findHostInstanceByFiber,
            findFiberByHostInstance: findFiberByHostInstance || emptyFindFiberByHostInstance,
            // React Refresh
            findHostInstancesForRefresh,
            scheduleRefresh,
            scheduleRoot,
            setRefreshHandler,
            // Enables DevTools to append owner stacks to error messages in DEV mode.
            getCurrentFiber: getCurrentFiberForDevTools,
            // Enables DevTools to detect reconciler version rather than renderer version
            // which may not match for third party renderers.
            reconcilerVersion: ReactVersion
          });
        }
        var defaultOnRecoverableError = typeof reportError === "function" ? (
          // In modern browsers, reportError will dispatch an error event,
          // emulating an uncaught JavaScript error.
          reportError
        ) : function(error2) {
          console["error"](error2);
        };
        function ReactDOMRoot(internalRoot) {
          this._internalRoot = internalRoot;
        }
        ReactDOMHydrationRoot.prototype.render = ReactDOMRoot.prototype.render = function(children) {
          var root2 = this._internalRoot;
          if (root2 === null) {
            throw new Error("Cannot update an unmounted root.");
          }
          {
            if (typeof arguments[1] === "function") {
              error("render(...): does not support the second callback argument. To execute a side effect after rendering, declare it in a component body with useEffect().");
            } else if (isValidContainer(arguments[1])) {
              error("You passed a container to the second argument of root.render(...). You don't need to pass it again since you already passed it to create the root.");
            } else if (typeof arguments[1] !== "undefined") {
              error("You passed a second argument to root.render(...) but it only accepts one argument.");
            }
            var container = root2.containerInfo;
            if (container.nodeType !== COMMENT_NODE) {
              var hostInstance = findHostInstanceWithNoPortals(root2.current);
              if (hostInstance) {
                if (hostInstance.parentNode !== container) {
                  error("render(...): It looks like the React-rendered content of the root container was removed without using React. This is not supported and will cause errors. Instead, call root.unmount() to empty a root's container.");
                }
              }
            }
          }
          updateContainer(children, root2, null, null);
        };
        ReactDOMHydrationRoot.prototype.unmount = ReactDOMRoot.prototype.unmount = function() {
          {
            if (typeof arguments[0] === "function") {
              error("unmount(...): does not support a callback argument. To execute a side effect after rendering, declare it in a component body with useEffect().");
            }
          }
          var root2 = this._internalRoot;
          if (root2 !== null) {
            this._internalRoot = null;
            var container = root2.containerInfo;
            {
              if (isAlreadyRendering()) {
                error("Attempted to synchronously unmount a root while React was already rendering. React cannot finish unmounting the root until the current render has completed, which may lead to a race condition.");
              }
            }
            flushSync(function() {
              updateContainer(null, root2, null, null);
            });
            unmarkContainerAsRoot(container);
          }
        };
        function createRoot5(container, options2) {
          if (!isValidContainer(container)) {
            throw new Error("createRoot(...): Target container is not a DOM element.");
          }
          warnIfReactDOMContainerInDEV(container);
          var isStrictMode = false;
          var concurrentUpdatesByDefaultOverride = false;
          var identifierPrefix = "";
          var onRecoverableError = defaultOnRecoverableError;
          var transitionCallbacks = null;
          if (options2 !== null && options2 !== void 0) {
            {
              if (options2.hydrate) {
                warn("hydrate through createRoot is deprecated. Use ReactDOMClient.hydrateRoot(container, <App />) instead.");
              } else {
                if (typeof options2 === "object" && options2 !== null && options2.$$typeof === REACT_ELEMENT_TYPE) {
                  error("You passed a JSX element to createRoot. You probably meant to call root.render instead. Example usage:\n\n  let root = createRoot(domContainer);\n  root.render(<App />);");
                }
              }
            }
            if (options2.unstable_strictMode === true) {
              isStrictMode = true;
            }
            if (options2.identifierPrefix !== void 0) {
              identifierPrefix = options2.identifierPrefix;
            }
            if (options2.onRecoverableError !== void 0) {
              onRecoverableError = options2.onRecoverableError;
            }
            if (options2.transitionCallbacks !== void 0) {
              transitionCallbacks = options2.transitionCallbacks;
            }
          }
          var root2 = createContainer(container, ConcurrentRoot, null, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError);
          markContainerAsRoot(root2.current, container);
          var rootContainerElement = container.nodeType === COMMENT_NODE ? container.parentNode : container;
          listenToAllSupportedEvents(rootContainerElement);
          return new ReactDOMRoot(root2);
        }
        function ReactDOMHydrationRoot(internalRoot) {
          this._internalRoot = internalRoot;
        }
        function scheduleHydration(target) {
          if (target) {
            queueExplicitHydrationTarget(target);
          }
        }
        ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = scheduleHydration;
        function hydrateRoot(container, initialChildren, options2) {
          if (!isValidContainer(container)) {
            throw new Error("hydrateRoot(...): Target container is not a DOM element.");
          }
          warnIfReactDOMContainerInDEV(container);
          {
            if (initialChildren === void 0) {
              error("Must provide initial children as second argument to hydrateRoot. Example usage: hydrateRoot(domContainer, <App />)");
            }
          }
          var hydrationCallbacks = options2 != null ? options2 : null;
          var mutableSources = options2 != null && options2.hydratedSources || null;
          var isStrictMode = false;
          var concurrentUpdatesByDefaultOverride = false;
          var identifierPrefix = "";
          var onRecoverableError = defaultOnRecoverableError;
          if (options2 !== null && options2 !== void 0) {
            if (options2.unstable_strictMode === true) {
              isStrictMode = true;
            }
            if (options2.identifierPrefix !== void 0) {
              identifierPrefix = options2.identifierPrefix;
            }
            if (options2.onRecoverableError !== void 0) {
              onRecoverableError = options2.onRecoverableError;
            }
          }
          var root2 = createHydrationContainer(initialChildren, null, container, ConcurrentRoot, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError);
          markContainerAsRoot(root2.current, container);
          listenToAllSupportedEvents(container);
          if (mutableSources) {
            for (var i2 = 0; i2 < mutableSources.length; i2++) {
              var mutableSource = mutableSources[i2];
              registerMutableSourceForHydration(root2, mutableSource);
            }
          }
          return new ReactDOMHydrationRoot(root2);
        }
        function isValidContainer(node) {
          return !!(node && (node.nodeType === ELEMENT_NODE || node.nodeType === DOCUMENT_NODE || node.nodeType === DOCUMENT_FRAGMENT_NODE || !disableCommentsAsDOMContainers));
        }
        function isValidContainerLegacy(node) {
          return !!(node && (node.nodeType === ELEMENT_NODE || node.nodeType === DOCUMENT_NODE || node.nodeType === DOCUMENT_FRAGMENT_NODE || node.nodeType === COMMENT_NODE && node.nodeValue === " react-mount-point-unstable "));
        }
        function warnIfReactDOMContainerInDEV(container) {
          {
            if (container.nodeType === ELEMENT_NODE && container.tagName && container.tagName.toUpperCase() === "BODY") {
              error("createRoot(): Creating roots directly with document.body is discouraged, since its children are often manipulated by third-party scripts and browser extensions. This may lead to subtle reconciliation issues. Try using a container element created for your app.");
            }
            if (isContainerMarkedAsRoot(container)) {
              if (container._reactRootContainer) {
                error("You are calling ReactDOMClient.createRoot() on a container that was previously passed to ReactDOM.render(). This is not supported.");
              } else {
                error("You are calling ReactDOMClient.createRoot() on a container that has already been passed to createRoot() before. Instead, call root.render() on the existing root instead if you want to update it.");
              }
            }
          }
        }
        var ReactCurrentOwner$3 = ReactSharedInternals.ReactCurrentOwner;
        var topLevelUpdateWarnings;
        {
          topLevelUpdateWarnings = function(container) {
            if (container._reactRootContainer && container.nodeType !== COMMENT_NODE) {
              var hostInstance = findHostInstanceWithNoPortals(container._reactRootContainer.current);
              if (hostInstance) {
                if (hostInstance.parentNode !== container) {
                  error("render(...): It looks like the React-rendered content of this container was removed without using React. This is not supported and will cause errors. Instead, call ReactDOM.unmountComponentAtNode to empty a container.");
                }
              }
            }
            var isRootRenderedBySomeReact = !!container._reactRootContainer;
            var rootEl = getReactRootElementInContainer(container);
            var hasNonRootReactChild = !!(rootEl && getInstanceFromNode(rootEl));
            if (hasNonRootReactChild && !isRootRenderedBySomeReact) {
              error("render(...): Replacing React-rendered children with a new root component. If you intended to update the children of this node, you should instead have the existing children update their state and render the new components instead of calling ReactDOM.render.");
            }
            if (container.nodeType === ELEMENT_NODE && container.tagName && container.tagName.toUpperCase() === "BODY") {
              error("render(): Rendering components directly into document.body is discouraged, since its children are often manipulated by third-party scripts and browser extensions. This may lead to subtle reconciliation issues. Try rendering into a container element created for your app.");
            }
          };
        }
        function getReactRootElementInContainer(container) {
          if (!container) {
            return null;
          }
          if (container.nodeType === DOCUMENT_NODE) {
            return container.documentElement;
          } else {
            return container.firstChild;
          }
        }
        function noopOnRecoverableError() {
        }
        function legacyCreateRootFromDOMContainer(container, initialChildren, parentComponent, callback, isHydrationContainer) {
          if (isHydrationContainer) {
            if (typeof callback === "function") {
              var originalCallback = callback;
              callback = function() {
                var instance = getPublicRootInstance(root2);
                originalCallback.call(instance);
              };
            }
            var root2 = createHydrationContainer(
              initialChildren,
              callback,
              container,
              LegacyRoot,
              null,
              // hydrationCallbacks
              false,
              // isStrictMode
              false,
              // concurrentUpdatesByDefaultOverride,
              "",
              // identifierPrefix
              noopOnRecoverableError
            );
            container._reactRootContainer = root2;
            markContainerAsRoot(root2.current, container);
            var rootContainerElement = container.nodeType === COMMENT_NODE ? container.parentNode : container;
            listenToAllSupportedEvents(rootContainerElement);
            flushSync();
            return root2;
          } else {
            var rootSibling;
            while (rootSibling = container.lastChild) {
              container.removeChild(rootSibling);
            }
            if (typeof callback === "function") {
              var _originalCallback = callback;
              callback = function() {
                var instance = getPublicRootInstance(_root);
                _originalCallback.call(instance);
              };
            }
            var _root = createContainer(
              container,
              LegacyRoot,
              null,
              // hydrationCallbacks
              false,
              // isStrictMode
              false,
              // concurrentUpdatesByDefaultOverride,
              "",
              // identifierPrefix
              noopOnRecoverableError
            );
            container._reactRootContainer = _root;
            markContainerAsRoot(_root.current, container);
            var _rootContainerElement = container.nodeType === COMMENT_NODE ? container.parentNode : container;
            listenToAllSupportedEvents(_rootContainerElement);
            flushSync(function() {
              updateContainer(initialChildren, _root, parentComponent, callback);
            });
            return _root;
          }
        }
        function warnOnInvalidCallback$1(callback, callerName) {
          {
            if (callback !== null && typeof callback !== "function") {
              error("%s(...): Expected the last optional `callback` argument to be a function. Instead received: %s.", callerName, callback);
            }
          }
        }
        function legacyRenderSubtreeIntoContainer(parentComponent, children, container, forceHydrate, callback) {
          {
            topLevelUpdateWarnings(container);
            warnOnInvalidCallback$1(callback === void 0 ? null : callback, "render");
          }
          var maybeRoot = container._reactRootContainer;
          var root2;
          if (!maybeRoot) {
            root2 = legacyCreateRootFromDOMContainer(container, children, parentComponent, callback, forceHydrate);
          } else {
            root2 = maybeRoot;
            if (typeof callback === "function") {
              var originalCallback = callback;
              callback = function() {
                var instance = getPublicRootInstance(root2);
                originalCallback.call(instance);
              };
            }
            updateContainer(children, root2, parentComponent, callback);
          }
          return getPublicRootInstance(root2);
        }
        var didWarnAboutFindDOMNode = false;
        function findDOMNode(componentOrElement) {
          {
            if (!didWarnAboutFindDOMNode) {
              didWarnAboutFindDOMNode = true;
              error("findDOMNode is deprecated and will be removed in the next major release. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node");
            }
            var owner = ReactCurrentOwner$3.current;
            if (owner !== null && owner.stateNode !== null) {
              var warnedAboutRefsInRender = owner.stateNode._warnedAboutRefsInRender;
              if (!warnedAboutRefsInRender) {
                error("%s is accessing findDOMNode inside its render(). render() should be a pure function of props and state. It should never access something that requires stale data from the previous render, such as refs. Move this logic to componentDidMount and componentDidUpdate instead.", getComponentNameFromType(owner.type) || "A component");
              }
              owner.stateNode._warnedAboutRefsInRender = true;
            }
          }
          if (componentOrElement == null) {
            return null;
          }
          if (componentOrElement.nodeType === ELEMENT_NODE) {
            return componentOrElement;
          }
          {
            return findHostInstanceWithWarning(componentOrElement, "findDOMNode");
          }
        }
        function hydrate(element, container, callback) {
          {
            error("ReactDOM.hydrate is no longer supported in React 18. Use hydrateRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot");
          }
          if (!isValidContainerLegacy(container)) {
            throw new Error("Target container is not a DOM element.");
          }
          {
            var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === void 0;
            if (isModernRoot) {
              error("You are calling ReactDOM.hydrate() on a container that was previously passed to ReactDOMClient.createRoot(). This is not supported. Did you mean to call hydrateRoot(container, element)?");
            }
          }
          return legacyRenderSubtreeIntoContainer(null, element, container, true, callback);
        }
        function render2(element, container, callback) {
          {
            error("ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot");
          }
          if (!isValidContainerLegacy(container)) {
            throw new Error("Target container is not a DOM element.");
          }
          {
            var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === void 0;
            if (isModernRoot) {
              error("You are calling ReactDOM.render() on a container that was previously passed to ReactDOMClient.createRoot(). This is not supported. Did you mean to call root.render(element)?");
            }
          }
          return legacyRenderSubtreeIntoContainer(null, element, container, false, callback);
        }
        function unstable_renderSubtreeIntoContainer(parentComponent, element, containerNode, callback) {
          {
            error("ReactDOM.unstable_renderSubtreeIntoContainer() is no longer supported in React 18. Consider using a portal instead. Until you switch to the createRoot API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot");
          }
          if (!isValidContainerLegacy(containerNode)) {
            throw new Error("Target container is not a DOM element.");
          }
          if (parentComponent == null || !has(parentComponent)) {
            throw new Error("parentComponent must be a valid React Component");
          }
          return legacyRenderSubtreeIntoContainer(parentComponent, element, containerNode, false, callback);
        }
        var didWarnAboutUnmountComponentAtNode = false;
        function unmountComponentAtNode(container) {
          {
            if (!didWarnAboutUnmountComponentAtNode) {
              didWarnAboutUnmountComponentAtNode = true;
              error("unmountComponentAtNode is deprecated and will be removed in the next major release. Switch to the createRoot API. Learn more: https://reactjs.org/link/switch-to-createroot");
            }
          }
          if (!isValidContainerLegacy(container)) {
            throw new Error("unmountComponentAtNode(...): Target container is not a DOM element.");
          }
          {
            var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === void 0;
            if (isModernRoot) {
              error("You are calling ReactDOM.unmountComponentAtNode() on a container that was previously passed to ReactDOMClient.createRoot(). This is not supported. Did you mean to call root.unmount()?");
            }
          }
          if (container._reactRootContainer) {
            {
              var rootEl = getReactRootElementInContainer(container);
              var renderedByDifferentReact = rootEl && !getInstanceFromNode(rootEl);
              if (renderedByDifferentReact) {
                error("unmountComponentAtNode(): The node you're attempting to unmount was rendered by another copy of React.");
              }
            }
            flushSync(function() {
              legacyRenderSubtreeIntoContainer(null, null, container, false, function() {
                container._reactRootContainer = null;
                unmarkContainerAsRoot(container);
              });
            });
            return true;
          } else {
            {
              var _rootEl = getReactRootElementInContainer(container);
              var hasNonRootReactChild = !!(_rootEl && getInstanceFromNode(_rootEl));
              var isContainerReactRoot = container.nodeType === ELEMENT_NODE && isValidContainerLegacy(container.parentNode) && !!container.parentNode._reactRootContainer;
              if (hasNonRootReactChild) {
                error("unmountComponentAtNode(): The node you're attempting to unmount was rendered by React and is not a top-level container. %s", isContainerReactRoot ? "You may have accidentally passed in a React root node instead of its container." : "Instead, have the parent component update its state and rerender in order to remove this component.");
              }
            }
            return false;
          }
        }
        setAttemptSynchronousHydration(attemptSynchronousHydration$1);
        setAttemptContinuousHydration(attemptContinuousHydration$1);
        setAttemptHydrationAtCurrentPriority(attemptHydrationAtCurrentPriority$1);
        setGetCurrentUpdatePriority(getCurrentUpdatePriority);
        setAttemptHydrationAtPriority(runWithPriority);
        {
          if (typeof Map !== "function" || // $FlowIssue Flow incorrectly thinks Map has no prototype
          Map.prototype == null || typeof Map.prototype.forEach !== "function" || typeof Set !== "function" || // $FlowIssue Flow incorrectly thinks Set has no prototype
          Set.prototype == null || typeof Set.prototype.clear !== "function" || typeof Set.prototype.forEach !== "function") {
            error("React depends on Map and Set built-in types. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills");
          }
        }
        setRestoreImplementation(restoreControlledState$3);
        setBatchingImplementation(batchedUpdates$1, discreteUpdates, flushSync);
        function createPortal$1(children, container) {
          var key = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null;
          if (!isValidContainer(container)) {
            throw new Error("Target container is not a DOM element.");
          }
          return createPortal(children, container, null, key);
        }
        function renderSubtreeIntoContainer(parentComponent, element, containerNode, callback) {
          return unstable_renderSubtreeIntoContainer(parentComponent, element, containerNode, callback);
        }
        var Internals = {
          usingClientEntryPoint: false,
          // Keep in sync with ReactTestUtils.js.
          // This is an array for better minification.
          Events: [getInstanceFromNode, getNodeFromInstance, getFiberCurrentPropsFromNode, enqueueStateRestore, restoreStateIfNeeded, batchedUpdates$1]
        };
        function createRoot$1(container, options2) {
          {
            if (!Internals.usingClientEntryPoint && true) {
              error('You are importing createRoot from "react-dom" which is not supported. You should instead import it from "react-dom/client".');
            }
          }
          return createRoot5(container, options2);
        }
        function hydrateRoot$1(container, initialChildren, options2) {
          {
            if (!Internals.usingClientEntryPoint && true) {
              error('You are importing hydrateRoot from "react-dom" which is not supported. You should instead import it from "react-dom/client".');
            }
          }
          return hydrateRoot(container, initialChildren, options2);
        }
        function flushSync$1(fn2) {
          {
            if (isAlreadyRendering()) {
              error("flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. Consider moving this call to a scheduler task or micro task.");
            }
          }
          return flushSync(fn2);
        }
        var foundDevTools = injectIntoDevTools({
          findFiberByHostInstance: getClosestInstanceFromNode,
          bundleType: 1,
          version: ReactVersion,
          rendererPackageName: "react-dom"
        });
        {
          if (!foundDevTools && canUseDOM2 && window.top === window.self) {
            if (navigator.userAgent.indexOf("Chrome") > -1 && navigator.userAgent.indexOf("Edge") === -1 || navigator.userAgent.indexOf("Firefox") > -1) {
              var protocol = window.location.protocol;
              if (/^(https?|file):$/.test(protocol)) {
                console.info("%cDownload the React DevTools for a better development experience: https://reactjs.org/link/react-devtools" + (protocol === "file:" ? "\nYou might need to use a local HTTP server (instead of file://): https://reactjs.org/link/react-devtools-faq" : ""), "font-weight:bold");
              }
            }
          }
        }
        exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals;
        exports.createPortal = createPortal$1;
        exports.createRoot = createRoot$1;
        exports.findDOMNode = findDOMNode;
        exports.flushSync = flushSync$1;
        exports.hydrate = hydrate;
        exports.hydrateRoot = hydrateRoot$1;
        exports.render = render2;
        exports.unmountComponentAtNode = unmountComponentAtNode;
        exports.unstable_batchedUpdates = batchedUpdates$1;
        exports.unstable_renderSubtreeIntoContainer = renderSubtreeIntoContainer;
        exports.version = ReactVersion;
        if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
          __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
        }
      })();
    }
  }
});

// node_modules/react-dom/index.js
var require_react_dom = __commonJS({
  "node_modules/react-dom/index.js"(exports, module2) {
    "use strict";
    if (false) {
      checkDCE();
      module2.exports = null;
    } else {
      module2.exports = require_react_dom_development();
    }
  }
});

// node_modules/react-dom/client.js
var require_client = __commonJS({
  "node_modules/react-dom/client.js"(exports) {
    "use strict";
    var m2 = require_react_dom();
    if (false) {
      exports.createRoot = m2.createRoot;
      exports.hydrateRoot = m2.hydrateRoot;
    } else {
      i2 = m2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
      exports.createRoot = function(c2, o2) {
        i2.usingClientEntryPoint = true;
        try {
          return m2.createRoot(c2, o2);
        } finally {
          i2.usingClientEntryPoint = false;
        }
      };
      exports.hydrateRoot = function(c2, h2, o2) {
        i2.usingClientEntryPoint = true;
        try {
          return m2.hydrateRoot(c2, h2, o2);
        } finally {
          i2.usingClientEntryPoint = false;
        }
      };
    }
    var i2;
  }
});

// node_modules/lodash/lodash.js
var require_lodash = __commonJS({
  "node_modules/lodash/lodash.js"(exports, module2) {
    (function() {
      var undefined2;
      var VERSION = "4.17.21";
      var LARGE_ARRAY_SIZE = 200;
      var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", FUNC_ERROR_TEXT = "Expected a function", INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`";
      var HASH_UNDEFINED = "__lodash_hash_undefined__";
      var MAX_MEMOIZE_SIZE = 500;
      var PLACEHOLDER = "__lodash_placeholder__";
      var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4;
      var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2;
      var WRAP_BIND_FLAG = 1, WRAP_BIND_KEY_FLAG = 2, WRAP_CURRY_BOUND_FLAG = 4, WRAP_CURRY_FLAG = 8, WRAP_CURRY_RIGHT_FLAG = 16, WRAP_PARTIAL_FLAG = 32, WRAP_PARTIAL_RIGHT_FLAG = 64, WRAP_ARY_FLAG = 128, WRAP_REARG_FLAG = 256, WRAP_FLIP_FLAG = 512;
      var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = "...";
      var HOT_COUNT = 800, HOT_SPAN = 16;
      var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3;
      var INFINITY = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991, MAX_INTEGER = 17976931348623157e292, NAN = 0 / 0;
      var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
      var wrapFlags = [
        ["ary", WRAP_ARY_FLAG],
        ["bind", WRAP_BIND_FLAG],
        ["bindKey", WRAP_BIND_KEY_FLAG],
        ["curry", WRAP_CURRY_FLAG],
        ["curryRight", WRAP_CURRY_RIGHT_FLAG],
        ["flip", WRAP_FLIP_FLAG],
        ["partial", WRAP_PARTIAL_FLAG],
        ["partialRight", WRAP_PARTIAL_RIGHT_FLAG],
        ["rearg", WRAP_REARG_FLAG]
      ];
      var argsTag = "[object Arguments]", arrayTag = "[object Array]", asyncTag = "[object AsyncFunction]", boolTag = "[object Boolean]", dateTag = "[object Date]", domExcTag = "[object DOMException]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", nullTag = "[object Null]", objectTag = "[object Object]", promiseTag = "[object Promise]", proxyTag = "[object Proxy]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]", undefinedTag = "[object Undefined]", weakMapTag = "[object WeakMap]", weakSetTag = "[object WeakSet]";
      var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
      var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
      var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml = /[&<>"']/g, reHasEscapedHtml = RegExp(reEscapedHtml.source), reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
      var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g;
      var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
      var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar.source);
      var reTrimStart = /^\s+/;
      var reWhitespace = /\s/;
      var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /;
      var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
      var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
      var reEscapeChar = /\\(\\)?/g;
      var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
      var reFlags = /\w*$/;
      var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
      var reIsBinary = /^0b[01]+$/i;
      var reIsHostCtor = /^\[object .+?Constructor\]$/;
      var reIsOctal = /^0o[0-7]+$/i;
      var reIsUint = /^(?:0|[1-9]\d*)$/;
      var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
      var reNoMatch = /($^)/;
      var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
      var rsAstralRange = "\\ud800-\\udfff", rsComboMarksRange = "\\u0300-\\u036f", reComboHalfMarksRange = "\\ufe20-\\ufe2f", rsComboSymbolsRange = "\\u20d0-\\u20ff", rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, rsDingbatRange = "\\u2700-\\u27bf", rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff", rsMathOpRange = "\\xac\\xb1\\xd7\\xf7", rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", rsPunctuationRange = "\\u2000-\\u206f", rsSpaceRange = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde", rsVarRange = "\\ufe0e\\ufe0f", rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
      var rsApos = "['\u2019]", rsAstral = "[" + rsAstralRange + "]", rsBreak = "[" + rsBreakRange + "]", rsCombo = "[" + rsComboRange + "]", rsDigits = "\\d+", rsDingbat = "[" + rsDingbatRange + "]", rsLower = "[" + rsLowerRange + "]", rsMisc = "[^" + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]", rsFitz = "\\ud83c[\\udffb-\\udfff]", rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")", rsNonAstral = "[^" + rsAstralRange + "]", rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}", rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]", rsUpper = "[" + rsUpperRange + "]", rsZWJ = "\\u200d";
      var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")", rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")", rsOptContrLower = "(?:" + rsApos + "(?:d|ll|m|re|s|t|ve))?", rsOptContrUpper = "(?:" + rsApos + "(?:D|LL|M|RE|S|T|VE))?", reOptMod = rsModifier + "?", rsOptVar = "[" + rsVarRange + "]?", rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*", rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", rsSeq = rsOptVar + reOptMod + rsOptJoin, rsEmoji = "(?:" + [rsDingbat, rsRegional, rsSurrPair].join("|") + ")" + rsSeq, rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")";
      var reApos = RegExp(rsApos, "g");
      var reComboMark = RegExp(rsCombo, "g");
      var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
      var reUnicodeWord = RegExp([
        rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
        rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
        rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
        rsUpper + "+" + rsOptContrUpper,
        rsOrdUpper,
        rsOrdLower,
        rsDigits,
        rsEmoji
      ].join("|"), "g");
      var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]");
      var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
      var contextProps = [
        "Array",
        "Buffer",
        "DataView",
        "Date",
        "Error",
        "Float32Array",
        "Float64Array",
        "Function",
        "Int8Array",
        "Int16Array",
        "Int32Array",
        "Map",
        "Math",
        "Object",
        "Promise",
        "RegExp",
        "Set",
        "String",
        "Symbol",
        "TypeError",
        "Uint8Array",
        "Uint8ClampedArray",
        "Uint16Array",
        "Uint32Array",
        "WeakMap",
        "_",
        "clearTimeout",
        "isFinite",
        "parseInt",
        "setTimeout"
      ];
      var templateCounter = -1;
      var typedArrayTags = {};
      typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
      typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
      var cloneableTags = {};
      cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
      cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
      var deburredLetters = {
        // Latin-1 Supplement block.
        "\xC0": "A",
        "\xC1": "A",
        "\xC2": "A",
        "\xC3": "A",
        "\xC4": "A",
        "\xC5": "A",
        "\xE0": "a",
        "\xE1": "a",
        "\xE2": "a",
        "\xE3": "a",
        "\xE4": "a",
        "\xE5": "a",
        "\xC7": "C",
        "\xE7": "c",
        "\xD0": "D",
        "\xF0": "d",
        "\xC8": "E",
        "\xC9": "E",
        "\xCA": "E",
        "\xCB": "E",
        "\xE8": "e",
        "\xE9": "e",
        "\xEA": "e",
        "\xEB": "e",
        "\xCC": "I",
        "\xCD": "I",
        "\xCE": "I",
        "\xCF": "I",
        "\xEC": "i",
        "\xED": "i",
        "\xEE": "i",
        "\xEF": "i",
        "\xD1": "N",
        "\xF1": "n",
        "\xD2": "O",
        "\xD3": "O",
        "\xD4": "O",
        "\xD5": "O",
        "\xD6": "O",
        "\xD8": "O",
        "\xF2": "o",
        "\xF3": "o",
        "\xF4": "o",
        "\xF5": "o",
        "\xF6": "o",
        "\xF8": "o",
        "\xD9": "U",
        "\xDA": "U",
        "\xDB": "U",
        "\xDC": "U",
        "\xF9": "u",
        "\xFA": "u",
        "\xFB": "u",
        "\xFC": "u",
        "\xDD": "Y",
        "\xFD": "y",
        "\xFF": "y",
        "\xC6": "Ae",
        "\xE6": "ae",
        "\xDE": "Th",
        "\xFE": "th",
        "\xDF": "ss",
        // Latin Extended-A block.
        "\u0100": "A",
        "\u0102": "A",
        "\u0104": "A",
        "\u0101": "a",
        "\u0103": "a",
        "\u0105": "a",
        "\u0106": "C",
        "\u0108": "C",
        "\u010A": "C",
        "\u010C": "C",
        "\u0107": "c",
        "\u0109": "c",
        "\u010B": "c",
        "\u010D": "c",
        "\u010E": "D",
        "\u0110": "D",
        "\u010F": "d",
        "\u0111": "d",
        "\u0112": "E",
        "\u0114": "E",
        "\u0116": "E",
        "\u0118": "E",
        "\u011A": "E",
        "\u0113": "e",
        "\u0115": "e",
        "\u0117": "e",
        "\u0119": "e",
        "\u011B": "e",
        "\u011C": "G",
        "\u011E": "G",
        "\u0120": "G",
        "\u0122": "G",
        "\u011D": "g",
        "\u011F": "g",
        "\u0121": "g",
        "\u0123": "g",
        "\u0124": "H",
        "\u0126": "H",
        "\u0125": "h",
        "\u0127": "h",
        "\u0128": "I",
        "\u012A": "I",
        "\u012C": "I",
        "\u012E": "I",
        "\u0130": "I",
        "\u0129": "i",
        "\u012B": "i",
        "\u012D": "i",
        "\u012F": "i",
        "\u0131": "i",
        "\u0134": "J",
        "\u0135": "j",
        "\u0136": "K",
        "\u0137": "k",
        "\u0138": "k",
        "\u0139": "L",
        "\u013B": "L",
        "\u013D": "L",
        "\u013F": "L",
        "\u0141": "L",
        "\u013A": "l",
        "\u013C": "l",
        "\u013E": "l",
        "\u0140": "l",
        "\u0142": "l",
        "\u0143": "N",
        "\u0145": "N",
        "\u0147": "N",
        "\u014A": "N",
        "\u0144": "n",
        "\u0146": "n",
        "\u0148": "n",
        "\u014B": "n",
        "\u014C": "O",
        "\u014E": "O",
        "\u0150": "O",
        "\u014D": "o",
        "\u014F": "o",
        "\u0151": "o",
        "\u0154": "R",
        "\u0156": "R",
        "\u0158": "R",
        "\u0155": "r",
        "\u0157": "r",
        "\u0159": "r",
        "\u015A": "S",
        "\u015C": "S",
        "\u015E": "S",
        "\u0160": "S",
        "\u015B": "s",
        "\u015D": "s",
        "\u015F": "s",
        "\u0161": "s",
        "\u0162": "T",
        "\u0164": "T",
        "\u0166": "T",
        "\u0163": "t",
        "\u0165": "t",
        "\u0167": "t",
        "\u0168": "U",
        "\u016A": "U",
        "\u016C": "U",
        "\u016E": "U",
        "\u0170": "U",
        "\u0172": "U",
        "\u0169": "u",
        "\u016B": "u",
        "\u016D": "u",
        "\u016F": "u",
        "\u0171": "u",
        "\u0173": "u",
        "\u0174": "W",
        "\u0175": "w",
        "\u0176": "Y",
        "\u0177": "y",
        "\u0178": "Y",
        "\u0179": "Z",
        "\u017B": "Z",
        "\u017D": "Z",
        "\u017A": "z",
        "\u017C": "z",
        "\u017E": "z",
        "\u0132": "IJ",
        "\u0133": "ij",
        "\u0152": "Oe",
        "\u0153": "oe",
        "\u0149": "'n",
        "\u017F": "s"
      };
      var htmlEscapes = {
        "&": "&amp;",
        "<": "&lt;",
        ">": "&gt;",
        '"': "&quot;",
        "'": "&#39;"
      };
      var htmlUnescapes = {
        "&amp;": "&",
        "&lt;": "<",
        "&gt;": ">",
        "&quot;": '"',
        "&#39;": "'"
      };
      var stringEscapes = {
        "\\": "\\",
        "'": "'",
        "\n": "n",
        "\r": "r",
        "\u2028": "u2028",
        "\u2029": "u2029"
      };
      var freeParseFloat = parseFloat, freeParseInt = parseInt;
      var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
      var freeSelf = typeof self == "object" && self && self.Object === Object && self;
      var root = freeGlobal || freeSelf || Function("return this")();
      var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
      var freeModule = freeExports && typeof module2 == "object" && module2 && !module2.nodeType && module2;
      var moduleExports = freeModule && freeModule.exports === freeExports;
      var freeProcess = moduleExports && freeGlobal.process;
      var nodeUtil = function() {
        try {
          var types = freeModule && freeModule.require && freeModule.require("util").types;
          if (types) {
            return types;
          }
          return freeProcess && freeProcess.binding && freeProcess.binding("util");
        } catch (e) {
        }
      }();
      var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, nodeIsDate = nodeUtil && nodeUtil.isDate, nodeIsMap = nodeUtil && nodeUtil.isMap, nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, nodeIsSet = nodeUtil && nodeUtil.isSet, nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
      function apply(func, thisArg, args) {
        switch (args.length) {
          case 0:
            return func.call(thisArg);
          case 1:
            return func.call(thisArg, args[0]);
          case 2:
            return func.call(thisArg, args[0], args[1]);
          case 3:
            return func.call(thisArg, args[0], args[1], args[2]);
        }
        return func.apply(thisArg, args);
      }
      function arrayAggregator(array, setter, iteratee, accumulator) {
        var index = -1, length = array == null ? 0 : array.length;
        while (++index < length) {
          var value = array[index];
          setter(accumulator, value, iteratee(value), array);
        }
        return accumulator;
      }
      function arrayEach(array, iteratee) {
        var index = -1, length = array == null ? 0 : array.length;
        while (++index < length) {
          if (iteratee(array[index], index, array) === false) {
            break;
          }
        }
        return array;
      }
      function arrayEachRight(array, iteratee) {
        var length = array == null ? 0 : array.length;
        while (length--) {
          if (iteratee(array[length], length, array) === false) {
            break;
          }
        }
        return array;
      }
      function arrayEvery(array, predicate) {
        var index = -1, length = array == null ? 0 : array.length;
        while (++index < length) {
          if (!predicate(array[index], index, array)) {
            return false;
          }
        }
        return true;
      }
      function arrayFilter(array, predicate) {
        var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
        while (++index < length) {
          var value = array[index];
          if (predicate(value, index, array)) {
            result[resIndex++] = value;
          }
        }
        return result;
      }
      function arrayIncludes(array, value) {
        var length = array == null ? 0 : array.length;
        return !!length && baseIndexOf(array, value, 0) > -1;
      }
      function arrayIncludesWith(array, value, comparator) {
        var index = -1, length = array == null ? 0 : array.length;
        while (++index < length) {
          if (comparator(value, array[index])) {
            return true;
          }
        }
        return false;
      }
      function arrayMap(array, iteratee) {
        var index = -1, length = array == null ? 0 : array.length, result = Array(length);
        while (++index < length) {
          result[index] = iteratee(array[index], index, array);
        }
        return result;
      }
      function arrayPush(array, values) {
        var index = -1, length = values.length, offset = array.length;
        while (++index < length) {
          array[offset + index] = values[index];
        }
        return array;
      }
      function arrayReduce(array, iteratee, accumulator, initAccum) {
        var index = -1, length = array == null ? 0 : array.length;
        if (initAccum && length) {
          accumulator = array[++index];
        }
        while (++index < length) {
          accumulator = iteratee(accumulator, array[index], index, array);
        }
        return accumulator;
      }
      function arrayReduceRight(array, iteratee, accumulator, initAccum) {
        var length = array == null ? 0 : array.length;
        if (initAccum && length) {
          accumulator = array[--length];
        }
        while (length--) {
          accumulator = iteratee(accumulator, array[length], length, array);
        }
        return accumulator;
      }
      function arraySome(array, predicate) {
        var index = -1, length = array == null ? 0 : array.length;
        while (++index < length) {
          if (predicate(array[index], index, array)) {
            return true;
          }
        }
        return false;
      }
      var asciiSize = baseProperty("length");
      function asciiToArray(string) {
        return string.split("");
      }
      function asciiWords(string) {
        return string.match(reAsciiWord) || [];
      }
      function baseFindKey(collection, predicate, eachFunc) {
        var result;
        eachFunc(collection, function(value, key, collection2) {
          if (predicate(value, key, collection2)) {
            result = key;
            return false;
          }
        });
        return result;
      }
      function baseFindIndex(array, predicate, fromIndex, fromRight) {
        var length = array.length, index = fromIndex + (fromRight ? 1 : -1);
        while (fromRight ? index-- : ++index < length) {
          if (predicate(array[index], index, array)) {
            return index;
          }
        }
        return -1;
      }
      function baseIndexOf(array, value, fromIndex) {
        return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex);
      }
      function baseIndexOfWith(array, value, fromIndex, comparator) {
        var index = fromIndex - 1, length = array.length;
        while (++index < length) {
          if (comparator(array[index], value)) {
            return index;
          }
        }
        return -1;
      }
      function baseIsNaN(value) {
        return value !== value;
      }
      function baseMean(array, iteratee) {
        var length = array == null ? 0 : array.length;
        return length ? baseSum(array, iteratee) / length : NAN;
      }
      function baseProperty(key) {
        return function(object) {
          return object == null ? undefined2 : object[key];
        };
      }
      function basePropertyOf(object) {
        return function(key) {
          return object == null ? undefined2 : object[key];
        };
      }
      function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
        eachFunc(collection, function(value, index, collection2) {
          accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2);
        });
        return accumulator;
      }
      function baseSortBy(array, comparer) {
        var length = array.length;
        array.sort(comparer);
        while (length--) {
          array[length] = array[length].value;
        }
        return array;
      }
      function baseSum(array, iteratee) {
        var result, index = -1, length = array.length;
        while (++index < length) {
          var current = iteratee(array[index]);
          if (current !== undefined2) {
            result = result === undefined2 ? current : result + current;
          }
        }
        return result;
      }
      function baseTimes(n2, iteratee) {
        var index = -1, result = Array(n2);
        while (++index < n2) {
          result[index] = iteratee(index);
        }
        return result;
      }
      function baseToPairs(object, props) {
        return arrayMap(props, function(key) {
          return [key, object[key]];
        });
      }
      function baseTrim(string) {
        return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
      }
      function baseUnary(func) {
        return function(value) {
          return func(value);
        };
      }
      function baseValues(object, props) {
        return arrayMap(props, function(key) {
          return object[key];
        });
      }
      function cacheHas(cache, key) {
        return cache.has(key);
      }
      function charsStartIndex(strSymbols, chrSymbols) {
        var index = -1, length = strSymbols.length;
        while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
        }
        return index;
      }
      function charsEndIndex(strSymbols, chrSymbols) {
        var index = strSymbols.length;
        while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
        }
        return index;
      }
      function countHolders(array, placeholder) {
        var length = array.length, result = 0;
        while (length--) {
          if (array[length] === placeholder) {
            ++result;
          }
        }
        return result;
      }
      var deburrLetter = basePropertyOf(deburredLetters);
      var escapeHtmlChar = basePropertyOf(htmlEscapes);
      function escapeStringChar(chr) {
        return "\\" + stringEscapes[chr];
      }
      function getValue2(object, key) {
        return object == null ? undefined2 : object[key];
      }
      function hasUnicode(string) {
        return reHasUnicode.test(string);
      }
      function hasUnicodeWord(string) {
        return reHasUnicodeWord.test(string);
      }
      function iteratorToArray(iterator) {
        var data, result = [];
        while (!(data = iterator.next()).done) {
          result.push(data.value);
        }
        return result;
      }
      function mapToArray(map2) {
        var index = -1, result = Array(map2.size);
        map2.forEach(function(value, key) {
          result[++index] = [key, value];
        });
        return result;
      }
      function overArg(func, transform) {
        return function(arg) {
          return func(transform(arg));
        };
      }
      function replaceHolders(array, placeholder) {
        var index = -1, length = array.length, resIndex = 0, result = [];
        while (++index < length) {
          var value = array[index];
          if (value === placeholder || value === PLACEHOLDER) {
            array[index] = PLACEHOLDER;
            result[resIndex++] = index;
          }
        }
        return result;
      }
      function setToArray(set) {
        var index = -1, result = Array(set.size);
        set.forEach(function(value) {
          result[++index] = value;
        });
        return result;
      }
      function setToPairs(set) {
        var index = -1, result = Array(set.size);
        set.forEach(function(value) {
          result[++index] = [value, value];
        });
        return result;
      }
      function strictIndexOf(array, value, fromIndex) {
        var index = fromIndex - 1, length = array.length;
        while (++index < length) {
          if (array[index] === value) {
            return index;
          }
        }
        return -1;
      }
      function strictLastIndexOf(array, value, fromIndex) {
        var index = fromIndex + 1;
        while (index--) {
          if (array[index] === value) {
            return index;
          }
        }
        return index;
      }
      function stringSize(string) {
        return hasUnicode(string) ? unicodeSize(string) : asciiSize(string);
      }
      function stringToArray(string) {
        return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string);
      }
      function trimmedEndIndex(string) {
        var index = string.length;
        while (index-- && reWhitespace.test(string.charAt(index))) {
        }
        return index;
      }
      var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
      function unicodeSize(string) {
        var result = reUnicode.lastIndex = 0;
        while (reUnicode.test(string)) {
          ++result;
        }
        return result;
      }
      function unicodeToArray(string) {
        return string.match(reUnicode) || [];
      }
      function unicodeWords(string) {
        return string.match(reUnicodeWord) || [];
      }
      var runInContext = function runInContext2(context) {
        context = context == null ? root : _7.defaults(root.Object(), context, _7.pick(root, contextProps));
        var Array3 = context.Array, Date2 = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String3 = context.String, TypeError2 = context.TypeError;
        var arrayProto = Array3.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype;
        var coreJsData = context["__core-js_shared__"];
        var funcToString = funcProto.toString;
        var hasOwnProperty = objectProto.hasOwnProperty;
        var idCounter = 0;
        var maskSrcKey = function() {
          var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
          return uid ? "Symbol(src)_1." + uid : "";
        }();
        var nativeObjectToString = objectProto.toString;
        var objectCtorString = funcToString.call(Object2);
        var oldDash = root._;
        var reIsNative = RegExp2(
          "^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
        );
        var Buffer2 = moduleExports ? context.Buffer : undefined2, Symbol2 = context.Symbol, Uint8Array2 = context.Uint8Array, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : undefined2, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined2, symIterator = Symbol2 ? Symbol2.iterator : undefined2, symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined2;
        var defineProperty = function() {
          try {
            var func = getNative(Object2, "defineProperty");
            func({}, "", {});
            return func;
          } catch (e) {
          }
        }();
        var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
        var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse;
        var DataView = getNative(context, "DataView"), Map2 = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set2 = getNative(context, "Set"), WeakMap2 = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create");
        var metaMap = WeakMap2 && new WeakMap2();
        var realNames = {};
        var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap2);
        var symbolProto = Symbol2 ? Symbol2.prototype : undefined2, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined2, symbolToString = symbolProto ? symbolProto.toString : undefined2;
        function lodash(value) {
          if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
            if (value instanceof LodashWrapper) {
              return value;
            }
            if (hasOwnProperty.call(value, "__wrapped__")) {
              return wrapperClone(value);
            }
          }
          return new LodashWrapper(value);
        }
        var baseCreate = /* @__PURE__ */ function() {
          function object() {
          }
          return function(proto) {
            if (!isObject(proto)) {
              return {};
            }
            if (objectCreate) {
              return objectCreate(proto);
            }
            object.prototype = proto;
            var result2 = new object();
            object.prototype = undefined2;
            return result2;
          };
        }();
        function baseLodash() {
        }
        function LodashWrapper(value, chainAll) {
          this.__wrapped__ = value;
          this.__actions__ = [];
          this.__chain__ = !!chainAll;
          this.__index__ = 0;
          this.__values__ = undefined2;
        }
        lodash.templateSettings = {
          /**
           * Used to detect `data` property values to be HTML-escaped.
           *
           * @memberOf _.templateSettings
           * @type {RegExp}
           */
          "escape": reEscape,
          /**
           * Used to detect code to be evaluated.
           *
           * @memberOf _.templateSettings
           * @type {RegExp}
           */
          "evaluate": reEvaluate,
          /**
           * Used to detect `data` property values to inject.
           *
           * @memberOf _.templateSettings
           * @type {RegExp}
           */
          "interpolate": reInterpolate,
          /**
           * Used to reference the data object in the template text.
           *
           * @memberOf _.templateSettings
           * @type {string}
           */
          "variable": "",
          /**
           * Used to import variables into the compiled template.
           *
           * @memberOf _.templateSettings
           * @type {Object}
           */
          "imports": {
            /**
             * A reference to the `lodash` function.
             *
             * @memberOf _.templateSettings.imports
             * @type {Function}
             */
            "_": lodash
          }
        };
        lodash.prototype = baseLodash.prototype;
        lodash.prototype.constructor = lodash;
        LodashWrapper.prototype = baseCreate(baseLodash.prototype);
        LodashWrapper.prototype.constructor = LodashWrapper;
        function LazyWrapper(value) {
          this.__wrapped__ = value;
          this.__actions__ = [];
          this.__dir__ = 1;
          this.__filtered__ = false;
          this.__iteratees__ = [];
          this.__takeCount__ = MAX_ARRAY_LENGTH;
          this.__views__ = [];
        }
        function lazyClone() {
          var result2 = new LazyWrapper(this.__wrapped__);
          result2.__actions__ = copyArray(this.__actions__);
          result2.__dir__ = this.__dir__;
          result2.__filtered__ = this.__filtered__;
          result2.__iteratees__ = copyArray(this.__iteratees__);
          result2.__takeCount__ = this.__takeCount__;
          result2.__views__ = copyArray(this.__views__);
          return result2;
        }
        function lazyReverse() {
          if (this.__filtered__) {
            var result2 = new LazyWrapper(this);
            result2.__dir__ = -1;
            result2.__filtered__ = true;
          } else {
            result2 = this.clone();
            result2.__dir__ *= -1;
          }
          return result2;
        }
        function lazyValue() {
          var array = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray(array), isRight = dir < 0, arrLength = isArr ? array.length : 0, view = getView(0, arrLength, this.__views__), start = view.start, end = view.end, length = end - start, index = isRight ? end : start - 1, iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin(length, this.__takeCount__);
          if (!isArr || !isRight && arrLength == length && takeCount == length) {
            return baseWrapperValue(array, this.__actions__);
          }
          var result2 = [];
          outer:
            while (length-- && resIndex < takeCount) {
              index += dir;
              var iterIndex = -1, value = array[index];
              while (++iterIndex < iterLength) {
                var data = iteratees[iterIndex], iteratee2 = data.iteratee, type = data.type, computed = iteratee2(value);
                if (type == LAZY_MAP_FLAG) {
                  value = computed;
                } else if (!computed) {
                  if (type == LAZY_FILTER_FLAG) {
                    continue outer;
                  } else {
                    break outer;
                  }
                }
              }
              result2[resIndex++] = value;
            }
          return result2;
        }
        LazyWrapper.prototype = baseCreate(baseLodash.prototype);
        LazyWrapper.prototype.constructor = LazyWrapper;
        function Hash(entries) {
          var index = -1, length = entries == null ? 0 : entries.length;
          this.clear();
          while (++index < length) {
            var entry = entries[index];
            this.set(entry[0], entry[1]);
          }
        }
        function hashClear() {
          this.__data__ = nativeCreate ? nativeCreate(null) : {};
          this.size = 0;
        }
        function hashDelete(key) {
          var result2 = this.has(key) && delete this.__data__[key];
          this.size -= result2 ? 1 : 0;
          return result2;
        }
        function hashGet(key) {
          var data = this.__data__;
          if (nativeCreate) {
            var result2 = data[key];
            return result2 === HASH_UNDEFINED ? undefined2 : result2;
          }
          return hasOwnProperty.call(data, key) ? data[key] : undefined2;
        }
        function hashHas(key) {
          var data = this.__data__;
          return nativeCreate ? data[key] !== undefined2 : hasOwnProperty.call(data, key);
        }
        function hashSet(key, value) {
          var data = this.__data__;
          this.size += this.has(key) ? 0 : 1;
          data[key] = nativeCreate && value === undefined2 ? HASH_UNDEFINED : value;
          return this;
        }
        Hash.prototype.clear = hashClear;
        Hash.prototype["delete"] = hashDelete;
        Hash.prototype.get = hashGet;
        Hash.prototype.has = hashHas;
        Hash.prototype.set = hashSet;
        function ListCache(entries) {
          var index = -1, length = entries == null ? 0 : entries.length;
          this.clear();
          while (++index < length) {
            var entry = entries[index];
            this.set(entry[0], entry[1]);
          }
        }
        function listCacheClear() {
          this.__data__ = [];
          this.size = 0;
        }
        function listCacheDelete(key) {
          var data = this.__data__, index = assocIndexOf(data, key);
          if (index < 0) {
            return false;
          }
          var lastIndex = data.length - 1;
          if (index == lastIndex) {
            data.pop();
          } else {
            splice.call(data, index, 1);
          }
          --this.size;
          return true;
        }
        function listCacheGet(key) {
          var data = this.__data__, index = assocIndexOf(data, key);
          return index < 0 ? undefined2 : data[index][1];
        }
        function listCacheHas(key) {
          return assocIndexOf(this.__data__, key) > -1;
        }
        function listCacheSet(key, value) {
          var data = this.__data__, index = assocIndexOf(data, key);
          if (index < 0) {
            ++this.size;
            data.push([key, value]);
          } else {
            data[index][1] = value;
          }
          return this;
        }
        ListCache.prototype.clear = listCacheClear;
        ListCache.prototype["delete"] = listCacheDelete;
        ListCache.prototype.get = listCacheGet;
        ListCache.prototype.has = listCacheHas;
        ListCache.prototype.set = listCacheSet;
        function MapCache(entries) {
          var index = -1, length = entries == null ? 0 : entries.length;
          this.clear();
          while (++index < length) {
            var entry = entries[index];
            this.set(entry[0], entry[1]);
          }
        }
        function mapCacheClear() {
          this.size = 0;
          this.__data__ = {
            "hash": new Hash(),
            "map": new (Map2 || ListCache)(),
            "string": new Hash()
          };
        }
        function mapCacheDelete(key) {
          var result2 = getMapData(this, key)["delete"](key);
          this.size -= result2 ? 1 : 0;
          return result2;
        }
        function mapCacheGet(key) {
          return getMapData(this, key).get(key);
        }
        function mapCacheHas(key) {
          return getMapData(this, key).has(key);
        }
        function mapCacheSet(key, value) {
          var data = getMapData(this, key), size2 = data.size;
          data.set(key, value);
          this.size += data.size == size2 ? 0 : 1;
          return this;
        }
        MapCache.prototype.clear = mapCacheClear;
        MapCache.prototype["delete"] = mapCacheDelete;
        MapCache.prototype.get = mapCacheGet;
        MapCache.prototype.has = mapCacheHas;
        MapCache.prototype.set = mapCacheSet;
        function SetCache(values2) {
          var index = -1, length = values2 == null ? 0 : values2.length;
          this.__data__ = new MapCache();
          while (++index < length) {
            this.add(values2[index]);
          }
        }
        function setCacheAdd(value) {
          this.__data__.set(value, HASH_UNDEFINED);
          return this;
        }
        function setCacheHas(value) {
          return this.__data__.has(value);
        }
        SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
        SetCache.prototype.has = setCacheHas;
        function Stack2(entries) {
          var data = this.__data__ = new ListCache(entries);
          this.size = data.size;
        }
        function stackClear() {
          this.__data__ = new ListCache();
          this.size = 0;
        }
        function stackDelete(key) {
          var data = this.__data__, result2 = data["delete"](key);
          this.size = data.size;
          return result2;
        }
        function stackGet(key) {
          return this.__data__.get(key);
        }
        function stackHas(key) {
          return this.__data__.has(key);
        }
        function stackSet(key, value) {
          var data = this.__data__;
          if (data instanceof ListCache) {
            var pairs = data.__data__;
            if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
              pairs.push([key, value]);
              this.size = ++data.size;
              return this;
            }
            data = this.__data__ = new MapCache(pairs);
          }
          data.set(key, value);
          this.size = data.size;
          return this;
        }
        Stack2.prototype.clear = stackClear;
        Stack2.prototype["delete"] = stackDelete;
        Stack2.prototype.get = stackGet;
        Stack2.prototype.has = stackHas;
        Stack2.prototype.set = stackSet;
        function arrayLikeKeys(value, inherited) {
          var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes(value.length, String3) : [], length = result2.length;
          for (var key in value) {
            if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
            (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
            isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
            isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
            isIndex(key, length)))) {
              result2.push(key);
            }
          }
          return result2;
        }
        function arraySample(array) {
          var length = array.length;
          return length ? array[baseRandom(0, length - 1)] : undefined2;
        }
        function arraySampleSize(array, n2) {
          return shuffleSelf(copyArray(array), baseClamp(n2, 0, array.length));
        }
        function arrayShuffle(array) {
          return shuffleSelf(copyArray(array));
        }
        function assignMergeValue(object, key, value) {
          if (value !== undefined2 && !eq(object[key], value) || value === undefined2 && !(key in object)) {
            baseAssignValue(object, key, value);
          }
        }
        function assignValue(object, key, value) {
          var objValue = object[key];
          if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || value === undefined2 && !(key in object)) {
            baseAssignValue(object, key, value);
          }
        }
        function assocIndexOf(array, key) {
          var length = array.length;
          while (length--) {
            if (eq(array[length][0], key)) {
              return length;
            }
          }
          return -1;
        }
        function baseAggregator(collection, setter, iteratee2, accumulator) {
          baseEach(collection, function(value, key, collection2) {
            setter(accumulator, value, iteratee2(value), collection2);
          });
          return accumulator;
        }
        function baseAssign(object, source) {
          return object && copyObject(source, keys(source), object);
        }
        function baseAssignIn(object, source) {
          return object && copyObject(source, keysIn(source), object);
        }
        function baseAssignValue(object, key, value) {
          if (key == "__proto__" && defineProperty) {
            defineProperty(object, key, {
              "configurable": true,
              "enumerable": true,
              "value": value,
              "writable": true
            });
          } else {
            object[key] = value;
          }
        }
        function baseAt(object, paths) {
          var index = -1, length = paths.length, result2 = Array3(length), skip2 = object == null;
          while (++index < length) {
            result2[index] = skip2 ? undefined2 : get(object, paths[index]);
          }
          return result2;
        }
        function baseClamp(number, lower, upper) {
          if (number === number) {
            if (upper !== undefined2) {
              number = number <= upper ? number : upper;
            }
            if (lower !== undefined2) {
              number = number >= lower ? number : lower;
            }
          }
          return number;
        }
        function baseClone(value, bitmask, customizer, key, object, stack) {
          var result2, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG;
          if (customizer) {
            result2 = object ? customizer(value, key, object, stack) : customizer(value);
          }
          if (result2 !== undefined2) {
            return result2;
          }
          if (!isObject(value)) {
            return value;
          }
          var isArr = isArray(value);
          if (isArr) {
            result2 = initCloneArray(value);
            if (!isDeep) {
              return copyArray(value, result2);
            }
          } else {
            var tag = getTag(value), isFunc = tag == funcTag || tag == genTag;
            if (isBuffer(value)) {
              return cloneBuffer(value, isDeep);
            }
            if (tag == objectTag || tag == argsTag || isFunc && !object) {
              result2 = isFlat || isFunc ? {} : initCloneObject(value);
              if (!isDeep) {
                return isFlat ? copySymbolsIn(value, baseAssignIn(result2, value)) : copySymbols(value, baseAssign(result2, value));
              }
            } else {
              if (!cloneableTags[tag]) {
                return object ? value : {};
              }
              result2 = initCloneByTag(value, tag, isDeep);
            }
          }
          stack || (stack = new Stack2());
          var stacked = stack.get(value);
          if (stacked) {
            return stacked;
          }
          stack.set(value, result2);
          if (isSet(value)) {
            value.forEach(function(subValue) {
              result2.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
            });
          } else if (isMap(value)) {
            value.forEach(function(subValue, key2) {
              result2.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
            });
          }
          var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
          var props = isArr ? undefined2 : keysFunc(value);
          arrayEach(props || value, function(subValue, key2) {
            if (props) {
              key2 = subValue;
              subValue = value[key2];
            }
            assignValue(result2, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
          });
          return result2;
        }
        function baseConforms(source) {
          var props = keys(source);
          return function(object) {
            return baseConformsTo(object, source, props);
          };
        }
        function baseConformsTo(object, source, props) {
          var length = props.length;
          if (object == null) {
            return !length;
          }
          object = Object2(object);
          while (length--) {
            var key = props[length], predicate = source[key], value = object[key];
            if (value === undefined2 && !(key in object) || !predicate(value)) {
              return false;
            }
          }
          return true;
        }
        function baseDelay(func, wait, args) {
          if (typeof func != "function") {
            throw new TypeError2(FUNC_ERROR_TEXT);
          }
          return setTimeout2(function() {
            func.apply(undefined2, args);
          }, wait);
        }
        function baseDifference(array, values2, iteratee2, comparator) {
          var index = -1, includes2 = arrayIncludes, isCommon = true, length = array.length, result2 = [], valuesLength = values2.length;
          if (!length) {
            return result2;
          }
          if (iteratee2) {
            values2 = arrayMap(values2, baseUnary(iteratee2));
          }
          if (comparator) {
            includes2 = arrayIncludesWith;
            isCommon = false;
          } else if (values2.length >= LARGE_ARRAY_SIZE) {
            includes2 = cacheHas;
            isCommon = false;
            values2 = new SetCache(values2);
          }
          outer:
            while (++index < length) {
              var value = array[index], computed = iteratee2 == null ? value : iteratee2(value);
              value = comparator || value !== 0 ? value : 0;
              if (isCommon && computed === computed) {
                var valuesIndex = valuesLength;
                while (valuesIndex--) {
                  if (values2[valuesIndex] === computed) {
                    continue outer;
                  }
                }
                result2.push(value);
              } else if (!includes2(values2, computed, comparator)) {
                result2.push(value);
              }
            }
          return result2;
        }
        var baseEach = createBaseEach(baseForOwn);
        var baseEachRight = createBaseEach(baseForOwnRight, true);
        function baseEvery(collection, predicate) {
          var result2 = true;
          baseEach(collection, function(value, index, collection2) {
            result2 = !!predicate(value, index, collection2);
            return result2;
          });
          return result2;
        }
        function baseExtremum(array, iteratee2, comparator) {
          var index = -1, length = array.length;
          while (++index < length) {
            var value = array[index], current = iteratee2(value);
            if (current != null && (computed === undefined2 ? current === current && !isSymbol(current) : comparator(current, computed))) {
              var computed = current, result2 = value;
            }
          }
          return result2;
        }
        function baseFill(array, value, start, end) {
          var length = array.length;
          start = toInteger(start);
          if (start < 0) {
            start = -start > length ? 0 : length + start;
          }
          end = end === undefined2 || end > length ? length : toInteger(end);
          if (end < 0) {
            end += length;
          }
          end = start > end ? 0 : toLength(end);
          while (start < end) {
            array[start++] = value;
          }
          return array;
        }
        function baseFilter(collection, predicate) {
          var result2 = [];
          baseEach(collection, function(value, index, collection2) {
            if (predicate(value, index, collection2)) {
              result2.push(value);
            }
          });
          return result2;
        }
        function baseFlatten(array, depth, predicate, isStrict, result2) {
          var index = -1, length = array.length;
          predicate || (predicate = isFlattenable);
          result2 || (result2 = []);
          while (++index < length) {
            var value = array[index];
            if (depth > 0 && predicate(value)) {
              if (depth > 1) {
                baseFlatten(value, depth - 1, predicate, isStrict, result2);
              } else {
                arrayPush(result2, value);
              }
            } else if (!isStrict) {
              result2[result2.length] = value;
            }
          }
          return result2;
        }
        var baseFor = createBaseFor();
        var baseForRight = createBaseFor(true);
        function baseForOwn(object, iteratee2) {
          return object && baseFor(object, iteratee2, keys);
        }
        function baseForOwnRight(object, iteratee2) {
          return object && baseForRight(object, iteratee2, keys);
        }
        function baseFunctions(object, props) {
          return arrayFilter(props, function(key) {
            return isFunction(object[key]);
          });
        }
        function baseGet(object, path) {
          path = castPath(path, object);
          var index = 0, length = path.length;
          while (object != null && index < length) {
            object = object[toKey(path[index++])];
          }
          return index && index == length ? object : undefined2;
        }
        function baseGetAllKeys(object, keysFunc, symbolsFunc) {
          var result2 = keysFunc(object);
          return isArray(object) ? result2 : arrayPush(result2, symbolsFunc(object));
        }
        function baseGetTag(value) {
          if (value == null) {
            return value === undefined2 ? undefinedTag : nullTag;
          }
          return symToStringTag && symToStringTag in Object2(value) ? getRawTag(value) : objectToString(value);
        }
        function baseGt(value, other) {
          return value > other;
        }
        function baseHas(object, key) {
          return object != null && hasOwnProperty.call(object, key);
        }
        function baseHasIn(object, key) {
          return object != null && key in Object2(object);
        }
        function baseInRange(number, start, end) {
          return number >= nativeMin(start, end) && number < nativeMax(start, end);
        }
        function baseIntersection(arrays, iteratee2, comparator) {
          var includes2 = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array3(othLength), maxLength = Infinity, result2 = [];
          while (othIndex--) {
            var array = arrays[othIndex];
            if (othIndex && iteratee2) {
              array = arrayMap(array, baseUnary(iteratee2));
            }
            maxLength = nativeMin(array.length, maxLength);
            caches[othIndex] = !comparator && (iteratee2 || length >= 120 && array.length >= 120) ? new SetCache(othIndex && array) : undefined2;
          }
          array = arrays[0];
          var index = -1, seen = caches[0];
          outer:
            while (++index < length && result2.length < maxLength) {
              var value = array[index], computed = iteratee2 ? iteratee2(value) : value;
              value = comparator || value !== 0 ? value : 0;
              if (!(seen ? cacheHas(seen, computed) : includes2(result2, computed, comparator))) {
                othIndex = othLength;
                while (--othIndex) {
                  var cache = caches[othIndex];
                  if (!(cache ? cacheHas(cache, computed) : includes2(arrays[othIndex], computed, comparator))) {
                    continue outer;
                  }
                }
                if (seen) {
                  seen.push(computed);
                }
                result2.push(value);
              }
            }
          return result2;
        }
        function baseInverter(object, setter, iteratee2, accumulator) {
          baseForOwn(object, function(value, key, object2) {
            setter(accumulator, iteratee2(value), key, object2);
          });
          return accumulator;
        }
        function baseInvoke(object, path, args) {
          path = castPath(path, object);
          object = parent(object, path);
          var func = object == null ? object : object[toKey(last2(path))];
          return func == null ? undefined2 : apply(func, object, args);
        }
        function baseIsArguments(value) {
          return isObjectLike(value) && baseGetTag(value) == argsTag;
        }
        function baseIsArrayBuffer(value) {
          return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
        }
        function baseIsDate(value) {
          return isObjectLike(value) && baseGetTag(value) == dateTag;
        }
        function baseIsEqual(value, other, bitmask, customizer, stack) {
          if (value === other) {
            return true;
          }
          if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
            return value !== value && other !== other;
          }
          return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
        }
        function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
          var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other);
          objTag = objTag == argsTag ? objectTag : objTag;
          othTag = othTag == argsTag ? objectTag : othTag;
          var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
          if (isSameTag && isBuffer(object)) {
            if (!isBuffer(other)) {
              return false;
            }
            objIsArr = true;
            objIsObj = false;
          }
          if (isSameTag && !objIsObj) {
            stack || (stack = new Stack2());
            return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
          }
          if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
            var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
            if (objIsWrapped || othIsWrapped) {
              var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
              stack || (stack = new Stack2());
              return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
            }
          }
          if (!isSameTag) {
            return false;
          }
          stack || (stack = new Stack2());
          return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
        }
        function baseIsMap(value) {
          return isObjectLike(value) && getTag(value) == mapTag;
        }
        function baseIsMatch(object, source, matchData, customizer) {
          var index = matchData.length, length = index, noCustomizer = !customizer;
          if (object == null) {
            return !length;
          }
          object = Object2(object);
          while (index--) {
            var data = matchData[index];
            if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
              return false;
            }
          }
          while (++index < length) {
            data = matchData[index];
            var key = data[0], objValue = object[key], srcValue = data[1];
            if (noCustomizer && data[2]) {
              if (objValue === undefined2 && !(key in object)) {
                return false;
              }
            } else {
              var stack = new Stack2();
              if (customizer) {
                var result2 = customizer(objValue, srcValue, key, object, source, stack);
              }
              if (!(result2 === undefined2 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) : result2)) {
                return false;
              }
            }
          }
          return true;
        }
        function baseIsNative(value) {
          if (!isObject(value) || isMasked(value)) {
            return false;
          }
          var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
          return pattern.test(toSource(value));
        }
        function baseIsRegExp(value) {
          return isObjectLike(value) && baseGetTag(value) == regexpTag;
        }
        function baseIsSet(value) {
          return isObjectLike(value) && getTag(value) == setTag;
        }
        function baseIsTypedArray(value) {
          return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
        }
        function baseIteratee(value) {
          if (typeof value == "function") {
            return value;
          }
          if (value == null) {
            return identity2;
          }
          if (typeof value == "object") {
            return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
          }
          return property(value);
        }
        function baseKeys(object) {
          if (!isPrototype(object)) {
            return nativeKeys(object);
          }
          var result2 = [];
          for (var key in Object2(object)) {
            if (hasOwnProperty.call(object, key) && key != "constructor") {
              result2.push(key);
            }
          }
          return result2;
        }
        function baseKeysIn(object) {
          if (!isObject(object)) {
            return nativeKeysIn(object);
          }
          var isProto = isPrototype(object), result2 = [];
          for (var key in object) {
            if (!(key == "constructor" && (isProto || !hasOwnProperty.call(object, key)))) {
              result2.push(key);
            }
          }
          return result2;
        }
        function baseLt(value, other) {
          return value < other;
        }
        function baseMap(collection, iteratee2) {
          var index = -1, result2 = isArrayLike(collection) ? Array3(collection.length) : [];
          baseEach(collection, function(value, key, collection2) {
            result2[++index] = iteratee2(value, key, collection2);
          });
          return result2;
        }
        function baseMatches(source) {
          var matchData = getMatchData(source);
          if (matchData.length == 1 && matchData[0][2]) {
            return matchesStrictComparable(matchData[0][0], matchData[0][1]);
          }
          return function(object) {
            return object === source || baseIsMatch(object, source, matchData);
          };
        }
        function baseMatchesProperty(path, srcValue) {
          if (isKey(path) && isStrictComparable(srcValue)) {
            return matchesStrictComparable(toKey(path), srcValue);
          }
          return function(object) {
            var objValue = get(object, path);
            return objValue === undefined2 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
          };
        }
        function baseMerge(object, source, srcIndex, customizer, stack) {
          if (object === source) {
            return;
          }
          baseFor(source, function(srcValue, key) {
            stack || (stack = new Stack2());
            if (isObject(srcValue)) {
              baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
            } else {
              var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : undefined2;
              if (newValue === undefined2) {
                newValue = srcValue;
              }
              assignMergeValue(object, key, newValue);
            }
          }, keysIn);
        }
        function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
          var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
          if (stacked) {
            assignMergeValue(object, key, stacked);
            return;
          }
          var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : undefined2;
          var isCommon = newValue === undefined2;
          if (isCommon) {
            var isArr = isArray(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue);
            newValue = srcValue;
            if (isArr || isBuff || isTyped) {
              if (isArray(objValue)) {
                newValue = objValue;
              } else if (isArrayLikeObject(objValue)) {
                newValue = copyArray(objValue);
              } else if (isBuff) {
                isCommon = false;
                newValue = cloneBuffer(srcValue, true);
              } else if (isTyped) {
                isCommon = false;
                newValue = cloneTypedArray(srcValue, true);
              } else {
                newValue = [];
              }
            } else if (isPlainObject4(srcValue) || isArguments(srcValue)) {
              newValue = objValue;
              if (isArguments(objValue)) {
                newValue = toPlainObject(objValue);
              } else if (!isObject(objValue) || isFunction(objValue)) {
                newValue = initCloneObject(srcValue);
              }
            } else {
              isCommon = false;
            }
          }
          if (isCommon) {
            stack.set(srcValue, newValue);
            mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
            stack["delete"](srcValue);
          }
          assignMergeValue(object, key, newValue);
        }
        function baseNth(array, n2) {
          var length = array.length;
          if (!length) {
            return;
          }
          n2 += n2 < 0 ? length : 0;
          return isIndex(n2, length) ? array[n2] : undefined2;
        }
        function baseOrderBy(collection, iteratees, orders) {
          if (iteratees.length) {
            iteratees = arrayMap(iteratees, function(iteratee2) {
              if (isArray(iteratee2)) {
                return function(value) {
                  return baseGet(value, iteratee2.length === 1 ? iteratee2[0] : iteratee2);
                };
              }
              return iteratee2;
            });
          } else {
            iteratees = [identity2];
          }
          var index = -1;
          iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
          var result2 = baseMap(collection, function(value, key, collection2) {
            var criteria = arrayMap(iteratees, function(iteratee2) {
              return iteratee2(value);
            });
            return { "criteria": criteria, "index": ++index, "value": value };
          });
          return baseSortBy(result2, function(object, other) {
            return compareMultiple(object, other, orders);
          });
        }
        function basePick(object, paths) {
          return basePickBy(object, paths, function(value, path) {
            return hasIn(object, path);
          });
        }
        function basePickBy(object, paths, predicate) {
          var index = -1, length = paths.length, result2 = {};
          while (++index < length) {
            var path = paths[index], value = baseGet(object, path);
            if (predicate(value, path)) {
              baseSet(result2, castPath(path, object), value);
            }
          }
          return result2;
        }
        function basePropertyDeep(path) {
          return function(object) {
            return baseGet(object, path);
          };
        }
        function basePullAll(array, values2, iteratee2, comparator) {
          var indexOf2 = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length = values2.length, seen = array;
          if (array === values2) {
            values2 = copyArray(values2);
          }
          if (iteratee2) {
            seen = arrayMap(array, baseUnary(iteratee2));
          }
          while (++index < length) {
            var fromIndex = 0, value = values2[index], computed = iteratee2 ? iteratee2(value) : value;
            while ((fromIndex = indexOf2(seen, computed, fromIndex, comparator)) > -1) {
              if (seen !== array) {
                splice.call(seen, fromIndex, 1);
              }
              splice.call(array, fromIndex, 1);
            }
          }
          return array;
        }
        function basePullAt(array, indexes) {
          var length = array ? indexes.length : 0, lastIndex = length - 1;
          while (length--) {
            var index = indexes[length];
            if (length == lastIndex || index !== previous) {
              var previous = index;
              if (isIndex(index)) {
                splice.call(array, index, 1);
              } else {
                baseUnset(array, index);
              }
            }
          }
          return array;
        }
        function baseRandom(lower, upper) {
          return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
        }
        function baseRange(start, end, step, fromRight) {
          var index = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result2 = Array3(length);
          while (length--) {
            result2[fromRight ? length : ++index] = start;
            start += step;
          }
          return result2;
        }
        function baseRepeat(string, n2) {
          var result2 = "";
          if (!string || n2 < 1 || n2 > MAX_SAFE_INTEGER) {
            return result2;
          }
          do {
            if (n2 % 2) {
              result2 += string;
            }
            n2 = nativeFloor(n2 / 2);
            if (n2) {
              string += string;
            }
          } while (n2);
          return result2;
        }
        function baseRest(func, start) {
          return setToString(overRest(func, start, identity2), func + "");
        }
        function baseSample(collection) {
          return arraySample(values(collection));
        }
        function baseSampleSize(collection, n2) {
          var array = values(collection);
          return shuffleSelf(array, baseClamp(n2, 0, array.length));
        }
        function baseSet(object, path, value, customizer) {
          if (!isObject(object)) {
            return object;
          }
          path = castPath(path, object);
          var index = -1, length = path.length, lastIndex = length - 1, nested = object;
          while (nested != null && ++index < length) {
            var key = toKey(path[index]), newValue = value;
            if (key === "__proto__" || key === "constructor" || key === "prototype") {
              return object;
            }
            if (index != lastIndex) {
              var objValue = nested[key];
              newValue = customizer ? customizer(objValue, key, nested) : undefined2;
              if (newValue === undefined2) {
                newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
              }
            }
            assignValue(nested, key, newValue);
            nested = nested[key];
          }
          return object;
        }
        var baseSetData = !metaMap ? identity2 : function(func, data) {
          metaMap.set(func, data);
          return func;
        };
        var baseSetToString = !defineProperty ? identity2 : function(func, string) {
          return defineProperty(func, "toString", {
            "configurable": true,
            "enumerable": false,
            "value": constant(string),
            "writable": true
          });
        };
        function baseShuffle(collection) {
          return shuffleSelf(values(collection));
        }
        function baseSlice(array, start, end) {
          var index = -1, length = array.length;
          if (start < 0) {
            start = -start > length ? 0 : length + start;
          }
          end = end > length ? length : end;
          if (end < 0) {
            end += length;
          }
          length = start > end ? 0 : end - start >>> 0;
          start >>>= 0;
          var result2 = Array3(length);
          while (++index < length) {
            result2[index] = array[index + start];
          }
          return result2;
        }
        function baseSome(collection, predicate) {
          var result2;
          baseEach(collection, function(value, index, collection2) {
            result2 = predicate(value, index, collection2);
            return !result2;
          });
          return !!result2;
        }
        function baseSortedIndex(array, value, retHighest) {
          var low = 0, high = array == null ? low : array.length;
          if (typeof value == "number" && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
            while (low < high) {
              var mid = low + high >>> 1, computed = array[mid];
              if (computed !== null && !isSymbol(computed) && (retHighest ? computed <= value : computed < value)) {
                low = mid + 1;
              } else {
                high = mid;
              }
            }
            return high;
          }
          return baseSortedIndexBy(array, value, identity2, retHighest);
        }
        function baseSortedIndexBy(array, value, iteratee2, retHighest) {
          var low = 0, high = array == null ? 0 : array.length;
          if (high === 0) {
            return 0;
          }
          value = iteratee2(value);
          var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol(value), valIsUndefined = value === undefined2;
          while (low < high) {
            var mid = nativeFloor((low + high) / 2), computed = iteratee2(array[mid]), othIsDefined = computed !== undefined2, othIsNull = computed === null, othIsReflexive = computed === computed, othIsSymbol = isSymbol(computed);
            if (valIsNaN) {
              var setLow = retHighest || othIsReflexive;
            } else if (valIsUndefined) {
              setLow = othIsReflexive && (retHighest || othIsDefined);
            } else if (valIsNull) {
              setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
            } else if (valIsSymbol) {
              setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
            } else if (othIsNull || othIsSymbol) {
              setLow = false;
            } else {
              setLow = retHighest ? computed <= value : computed < value;
            }
            if (setLow) {
              low = mid + 1;
            } else {
              high = mid;
            }
          }
          return nativeMin(high, MAX_ARRAY_INDEX);
        }
        function baseSortedUniq(array, iteratee2) {
          var index = -1, length = array.length, resIndex = 0, result2 = [];
          while (++index < length) {
            var value = array[index], computed = iteratee2 ? iteratee2(value) : value;
            if (!index || !eq(computed, seen)) {
              var seen = computed;
              result2[resIndex++] = value === 0 ? 0 : value;
            }
          }
          return result2;
        }
        function baseToNumber(value) {
          if (typeof value == "number") {
            return value;
          }
          if (isSymbol(value)) {
            return NAN;
          }
          return +value;
        }
        function baseToString(value) {
          if (typeof value == "string") {
            return value;
          }
          if (isArray(value)) {
            return arrayMap(value, baseToString) + "";
          }
          if (isSymbol(value)) {
            return symbolToString ? symbolToString.call(value) : "";
          }
          var result2 = value + "";
          return result2 == "0" && 1 / value == -INFINITY ? "-0" : result2;
        }
        function baseUniq(array, iteratee2, comparator) {
          var index = -1, includes2 = arrayIncludes, length = array.length, isCommon = true, result2 = [], seen = result2;
          if (comparator) {
            isCommon = false;
            includes2 = arrayIncludesWith;
          } else if (length >= LARGE_ARRAY_SIZE) {
            var set2 = iteratee2 ? null : createSet(array);
            if (set2) {
              return setToArray(set2);
            }
            isCommon = false;
            includes2 = cacheHas;
            seen = new SetCache();
          } else {
            seen = iteratee2 ? [] : result2;
          }
          outer:
            while (++index < length) {
              var value = array[index], computed = iteratee2 ? iteratee2(value) : value;
              value = comparator || value !== 0 ? value : 0;
              if (isCommon && computed === computed) {
                var seenIndex = seen.length;
                while (seenIndex--) {
                  if (seen[seenIndex] === computed) {
                    continue outer;
                  }
                }
                if (iteratee2) {
                  seen.push(computed);
                }
                result2.push(value);
              } else if (!includes2(seen, computed, comparator)) {
                if (seen !== result2) {
                  seen.push(computed);
                }
                result2.push(value);
              }
            }
          return result2;
        }
        function baseUnset(object, path) {
          path = castPath(path, object);
          object = parent(object, path);
          return object == null || delete object[toKey(last2(path))];
        }
        function baseUpdate(object, path, updater, customizer) {
          return baseSet(object, path, updater(baseGet(object, path)), customizer);
        }
        function baseWhile(array, predicate, isDrop, fromRight) {
          var length = array.length, index = fromRight ? length : -1;
          while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) {
          }
          return isDrop ? baseSlice(array, fromRight ? 0 : index, fromRight ? index + 1 : length) : baseSlice(array, fromRight ? index + 1 : 0, fromRight ? length : index);
        }
        function baseWrapperValue(value, actions) {
          var result2 = value;
          if (result2 instanceof LazyWrapper) {
            result2 = result2.value();
          }
          return arrayReduce(actions, function(result3, action) {
            return action.func.apply(action.thisArg, arrayPush([result3], action.args));
          }, result2);
        }
        function baseXor(arrays, iteratee2, comparator) {
          var length = arrays.length;
          if (length < 2) {
            return length ? baseUniq(arrays[0]) : [];
          }
          var index = -1, result2 = Array3(length);
          while (++index < length) {
            var array = arrays[index], othIndex = -1;
            while (++othIndex < length) {
              if (othIndex != index) {
                result2[index] = baseDifference(result2[index] || array, arrays[othIndex], iteratee2, comparator);
              }
            }
          }
          return baseUniq(baseFlatten(result2, 1), iteratee2, comparator);
        }
        function baseZipObject(props, values2, assignFunc) {
          var index = -1, length = props.length, valsLength = values2.length, result2 = {};
          while (++index < length) {
            var value = index < valsLength ? values2[index] : undefined2;
            assignFunc(result2, props[index], value);
          }
          return result2;
        }
        function castArrayLikeObject(value) {
          return isArrayLikeObject(value) ? value : [];
        }
        function castFunction(value) {
          return typeof value == "function" ? value : identity2;
        }
        function castPath(value, object) {
          if (isArray(value)) {
            return value;
          }
          return isKey(value, object) ? [value] : stringToPath(toString(value));
        }
        var castRest = baseRest;
        function castSlice(array, start, end) {
          var length = array.length;
          end = end === undefined2 ? length : end;
          return !start && end >= length ? array : baseSlice(array, start, end);
        }
        var clearTimeout2 = ctxClearTimeout || function(id2) {
          return root.clearTimeout(id2);
        };
        function cloneBuffer(buffer, isDeep) {
          if (isDeep) {
            return buffer.slice();
          }
          var length = buffer.length, result2 = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
          buffer.copy(result2);
          return result2;
        }
        function cloneArrayBuffer(arrayBuffer) {
          var result2 = new arrayBuffer.constructor(arrayBuffer.byteLength);
          new Uint8Array2(result2).set(new Uint8Array2(arrayBuffer));
          return result2;
        }
        function cloneDataView(dataView, isDeep) {
          var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
          return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
        }
        function cloneRegExp(regexp) {
          var result2 = new regexp.constructor(regexp.source, reFlags.exec(regexp));
          result2.lastIndex = regexp.lastIndex;
          return result2;
        }
        function cloneSymbol(symbol) {
          return symbolValueOf ? Object2(symbolValueOf.call(symbol)) : {};
        }
        function cloneTypedArray(typedArray, isDeep) {
          var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
          return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
        }
        function compareAscending(value, other) {
          if (value !== other) {
            var valIsDefined = value !== undefined2, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol(value);
            var othIsDefined = other !== undefined2, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol(other);
            if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) {
              return 1;
            }
            if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) {
              return -1;
            }
          }
          return 0;
        }
        function compareMultiple(object, other, orders) {
          var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length;
          while (++index < length) {
            var result2 = compareAscending(objCriteria[index], othCriteria[index]);
            if (result2) {
              if (index >= ordersLength) {
                return result2;
              }
              var order = orders[index];
              return result2 * (order == "desc" ? -1 : 1);
            }
          }
          return object.index - other.index;
        }
        function composeArgs(args, partials, holders, isCurried) {
          var argsIndex = -1, argsLength = args.length, holdersLength = holders.length, leftIndex = -1, leftLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result2 = Array3(leftLength + rangeLength), isUncurried = !isCurried;
          while (++leftIndex < leftLength) {
            result2[leftIndex] = partials[leftIndex];
          }
          while (++argsIndex < holdersLength) {
            if (isUncurried || argsIndex < argsLength) {
              result2[holders[argsIndex]] = args[argsIndex];
            }
          }
          while (rangeLength--) {
            result2[leftIndex++] = args[argsIndex++];
          }
          return result2;
        }
        function composeArgsRight(args, partials, holders, isCurried) {
          var argsIndex = -1, argsLength = args.length, holdersIndex = -1, holdersLength = holders.length, rightIndex = -1, rightLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result2 = Array3(rangeLength + rightLength), isUncurried = !isCurried;
          while (++argsIndex < rangeLength) {
            result2[argsIndex] = args[argsIndex];
          }
          var offset = argsIndex;
          while (++rightIndex < rightLength) {
            result2[offset + rightIndex] = partials[rightIndex];
          }
          while (++holdersIndex < holdersLength) {
            if (isUncurried || argsIndex < argsLength) {
              result2[offset + holders[holdersIndex]] = args[argsIndex++];
            }
          }
          return result2;
        }
        function copyArray(source, array) {
          var index = -1, length = source.length;
          array || (array = Array3(length));
          while (++index < length) {
            array[index] = source[index];
          }
          return array;
        }
        function copyObject(source, props, object, customizer) {
          var isNew = !object;
          object || (object = {});
          var index = -1, length = props.length;
          while (++index < length) {
            var key = props[index];
            var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined2;
            if (newValue === undefined2) {
              newValue = source[key];
            }
            if (isNew) {
              baseAssignValue(object, key, newValue);
            } else {
              assignValue(object, key, newValue);
            }
          }
          return object;
        }
        function copySymbols(source, object) {
          return copyObject(source, getSymbols(source), object);
        }
        function copySymbolsIn(source, object) {
          return copyObject(source, getSymbolsIn(source), object);
        }
        function createAggregator(setter, initializer) {
          return function(collection, iteratee2) {
            var func = isArray(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {};
            return func(collection, setter, getIteratee(iteratee2, 2), accumulator);
          };
        }
        function createAssigner(assigner) {
          return baseRest(function(object, sources) {
            var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined2, guard = length > 2 ? sources[2] : undefined2;
            customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : undefined2;
            if (guard && isIterateeCall(sources[0], sources[1], guard)) {
              customizer = length < 3 ? undefined2 : customizer;
              length = 1;
            }
            object = Object2(object);
            while (++index < length) {
              var source = sources[index];
              if (source) {
                assigner(object, source, index, customizer);
              }
            }
            return object;
          });
        }
        function createBaseEach(eachFunc, fromRight) {
          return function(collection, iteratee2) {
            if (collection == null) {
              return collection;
            }
            if (!isArrayLike(collection)) {
              return eachFunc(collection, iteratee2);
            }
            var length = collection.length, index = fromRight ? length : -1, iterable = Object2(collection);
            while (fromRight ? index-- : ++index < length) {
              if (iteratee2(iterable[index], index, iterable) === false) {
                break;
              }
            }
            return collection;
          };
        }
        function createBaseFor(fromRight) {
          return function(object, iteratee2, keysFunc) {
            var index = -1, iterable = Object2(object), props = keysFunc(object), length = props.length;
            while (length--) {
              var key = props[fromRight ? length : ++index];
              if (iteratee2(iterable[key], key, iterable) === false) {
                break;
              }
            }
            return object;
          };
        }
        function createBind(func, bitmask, thisArg) {
          var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
          function wrapper() {
            var fn2 = this && this !== root && this instanceof wrapper ? Ctor : func;
            return fn2.apply(isBind ? thisArg : this, arguments);
          }
          return wrapper;
        }
        function createCaseFirst(methodName) {
          return function(string) {
            string = toString(string);
            var strSymbols = hasUnicode(string) ? stringToArray(string) : undefined2;
            var chr = strSymbols ? strSymbols[0] : string.charAt(0);
            var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1);
            return chr[methodName]() + trailing;
          };
        }
        function createCompounder(callback) {
          return function(string) {
            return arrayReduce(words(deburr(string).replace(reApos, "")), callback, "");
          };
        }
        function createCtor(Ctor) {
          return function() {
            var args = arguments;
            switch (args.length) {
              case 0:
                return new Ctor();
              case 1:
                return new Ctor(args[0]);
              case 2:
                return new Ctor(args[0], args[1]);
              case 3:
                return new Ctor(args[0], args[1], args[2]);
              case 4:
                return new Ctor(args[0], args[1], args[2], args[3]);
              case 5:
                return new Ctor(args[0], args[1], args[2], args[3], args[4]);
              case 6:
                return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
              case 7:
                return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
            }
            var thisBinding = baseCreate(Ctor.prototype), result2 = Ctor.apply(thisBinding, args);
            return isObject(result2) ? result2 : thisBinding;
          };
        }
        function createCurry(func, bitmask, arity) {
          var Ctor = createCtor(func);
          function wrapper() {
            var length = arguments.length, args = Array3(length), index = length, placeholder = getHolder(wrapper);
            while (index--) {
              args[index] = arguments[index];
            }
            var holders = length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder ? [] : replaceHolders(args, placeholder);
            length -= holders.length;
            if (length < arity) {
              return createRecurry(
                func,
                bitmask,
                createHybrid,
                wrapper.placeholder,
                undefined2,
                args,
                holders,
                undefined2,
                undefined2,
                arity - length
              );
            }
            var fn2 = this && this !== root && this instanceof wrapper ? Ctor : func;
            return apply(fn2, this, args);
          }
          return wrapper;
        }
        function createFind(findIndexFunc) {
          return function(collection, predicate, fromIndex) {
            var iterable = Object2(collection);
            if (!isArrayLike(collection)) {
              var iteratee2 = getIteratee(predicate, 3);
              collection = keys(collection);
              predicate = function(key) {
                return iteratee2(iterable[key], key, iterable);
              };
            }
            var index = findIndexFunc(collection, predicate, fromIndex);
            return index > -1 ? iterable[iteratee2 ? collection[index] : index] : undefined2;
          };
        }
        function createFlow(fromRight) {
          return flatRest(function(funcs) {
            var length = funcs.length, index = length, prereq = LodashWrapper.prototype.thru;
            if (fromRight) {
              funcs.reverse();
            }
            while (index--) {
              var func = funcs[index];
              if (typeof func != "function") {
                throw new TypeError2(FUNC_ERROR_TEXT);
              }
              if (prereq && !wrapper && getFuncName(func) == "wrapper") {
                var wrapper = new LodashWrapper([], true);
              }
            }
            index = wrapper ? index : length;
            while (++index < length) {
              func = funcs[index];
              var funcName = getFuncName(func), data = funcName == "wrapper" ? getData(func) : undefined2;
              if (data && isLaziable(data[0]) && data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && !data[4].length && data[9] == 1) {
                wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
              } else {
                wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func);
              }
            }
            return function() {
              var args = arguments, value = args[0];
              if (wrapper && args.length == 1 && isArray(value)) {
                return wrapper.plant(value).value();
              }
              var index2 = 0, result2 = length ? funcs[index2].apply(this, args) : value;
              while (++index2 < length) {
                result2 = funcs[index2].call(this, result2);
              }
              return result2;
            };
          });
        }
        function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary2, arity) {
          var isAry = bitmask & WRAP_ARY_FLAG, isBind = bitmask & WRAP_BIND_FLAG, isBindKey = bitmask & WRAP_BIND_KEY_FLAG, isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), isFlip = bitmask & WRAP_FLIP_FLAG, Ctor = isBindKey ? undefined2 : createCtor(func);
          function wrapper() {
            var length = arguments.length, args = Array3(length), index = length;
            while (index--) {
              args[index] = arguments[index];
            }
            if (isCurried) {
              var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder);
            }
            if (partials) {
              args = composeArgs(args, partials, holders, isCurried);
            }
            if (partialsRight) {
              args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
            }
            length -= holdersCount;
            if (isCurried && length < arity) {
              var newHolders = replaceHolders(args, placeholder);
              return createRecurry(
                func,
                bitmask,
                createHybrid,
                wrapper.placeholder,
                thisArg,
                args,
                newHolders,
                argPos,
                ary2,
                arity - length
              );
            }
            var thisBinding = isBind ? thisArg : this, fn2 = isBindKey ? thisBinding[func] : func;
            length = args.length;
            if (argPos) {
              args = reorder(args, argPos);
            } else if (isFlip && length > 1) {
              args.reverse();
            }
            if (isAry && ary2 < length) {
              args.length = ary2;
            }
            if (this && this !== root && this instanceof wrapper) {
              fn2 = Ctor || createCtor(fn2);
            }
            return fn2.apply(thisBinding, args);
          }
          return wrapper;
        }
        function createInverter(setter, toIteratee) {
          return function(object, iteratee2) {
            return baseInverter(object, setter, toIteratee(iteratee2), {});
          };
        }
        function createMathOperation(operator, defaultValue) {
          return function(value, other) {
            var result2;
            if (value === undefined2 && other === undefined2) {
              return defaultValue;
            }
            if (value !== undefined2) {
              result2 = value;
            }
            if (other !== undefined2) {
              if (result2 === undefined2) {
                return other;
              }
              if (typeof value == "string" || typeof other == "string") {
                value = baseToString(value);
                other = baseToString(other);
              } else {
                value = baseToNumber(value);
                other = baseToNumber(other);
              }
              result2 = operator(value, other);
            }
            return result2;
          };
        }
        function createOver(arrayFunc) {
          return flatRest(function(iteratees) {
            iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
            return baseRest(function(args) {
              var thisArg = this;
              return arrayFunc(iteratees, function(iteratee2) {
                return apply(iteratee2, thisArg, args);
              });
            });
          });
        }
        function createPadding(length, chars) {
          chars = chars === undefined2 ? " " : baseToString(chars);
          var charsLength = chars.length;
          if (charsLength < 2) {
            return charsLength ? baseRepeat(chars, length) : chars;
          }
          var result2 = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
          return hasUnicode(chars) ? castSlice(stringToArray(result2), 0, length).join("") : result2.slice(0, length);
        }
        function createPartial(func, bitmask, thisArg, partials) {
          var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
          function wrapper() {
            var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array3(leftLength + argsLength), fn2 = this && this !== root && this instanceof wrapper ? Ctor : func;
            while (++leftIndex < leftLength) {
              args[leftIndex] = partials[leftIndex];
            }
            while (argsLength--) {
              args[leftIndex++] = arguments[++argsIndex];
            }
            return apply(fn2, isBind ? thisArg : this, args);
          }
          return wrapper;
        }
        function createRange(fromRight) {
          return function(start, end, step) {
            if (step && typeof step != "number" && isIterateeCall(start, end, step)) {
              end = step = undefined2;
            }
            start = toFinite(start);
            if (end === undefined2) {
              end = start;
              start = 0;
            } else {
              end = toFinite(end);
            }
            step = step === undefined2 ? start < end ? 1 : -1 : toFinite(step);
            return baseRange(start, end, step, fromRight);
          };
        }
        function createRelationalOperation(operator) {
          return function(value, other) {
            if (!(typeof value == "string" && typeof other == "string")) {
              value = toNumber(value);
              other = toNumber(other);
            }
            return operator(value, other);
          };
        }
        function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary2, arity) {
          var isCurry = bitmask & WRAP_CURRY_FLAG, newHolders = isCurry ? holders : undefined2, newHoldersRight = isCurry ? undefined2 : holders, newPartials = isCurry ? partials : undefined2, newPartialsRight = isCurry ? undefined2 : partials;
          bitmask |= isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG;
          bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
          if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
            bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
          }
          var newData = [
            func,
            bitmask,
            thisArg,
            newPartials,
            newHolders,
            newPartialsRight,
            newHoldersRight,
            argPos,
            ary2,
            arity
          ];
          var result2 = wrapFunc.apply(undefined2, newData);
          if (isLaziable(func)) {
            setData(result2, newData);
          }
          result2.placeholder = placeholder;
          return setWrapToString(result2, func, bitmask);
        }
        function createRound(methodName) {
          var func = Math2[methodName];
          return function(number, precision) {
            number = toNumber(number);
            precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
            if (precision && nativeIsFinite(number)) {
              var pair = (toString(number) + "e").split("e"), value = func(pair[0] + "e" + (+pair[1] + precision));
              pair = (toString(value) + "e").split("e");
              return +(pair[0] + "e" + (+pair[1] - precision));
            }
            return func(number);
          };
        }
        var createSet = !(Set2 && 1 / setToArray(new Set2([, -0]))[1] == INFINITY) ? noop2 : function(values2) {
          return new Set2(values2);
        };
        function createToPairs(keysFunc) {
          return function(object) {
            var tag = getTag(object);
            if (tag == mapTag) {
              return mapToArray(object);
            }
            if (tag == setTag) {
              return setToPairs(object);
            }
            return baseToPairs(object, keysFunc(object));
          };
        }
        function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary2, arity) {
          var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
          if (!isBindKey && typeof func != "function") {
            throw new TypeError2(FUNC_ERROR_TEXT);
          }
          var length = partials ? partials.length : 0;
          if (!length) {
            bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
            partials = holders = undefined2;
          }
          ary2 = ary2 === undefined2 ? ary2 : nativeMax(toInteger(ary2), 0);
          arity = arity === undefined2 ? arity : toInteger(arity);
          length -= holders ? holders.length : 0;
          if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
            var partialsRight = partials, holdersRight = holders;
            partials = holders = undefined2;
          }
          var data = isBindKey ? undefined2 : getData(func);
          var newData = [
            func,
            bitmask,
            thisArg,
            partials,
            holders,
            partialsRight,
            holdersRight,
            argPos,
            ary2,
            arity
          ];
          if (data) {
            mergeData(newData, data);
          }
          func = newData[0];
          bitmask = newData[1];
          thisArg = newData[2];
          partials = newData[3];
          holders = newData[4];
          arity = newData[9] = newData[9] === undefined2 ? isBindKey ? 0 : func.length : nativeMax(newData[9] - length, 0);
          if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
            bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
          }
          if (!bitmask || bitmask == WRAP_BIND_FLAG) {
            var result2 = createBind(func, bitmask, thisArg);
          } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
            result2 = createCurry(func, bitmask, arity);
          } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
            result2 = createPartial(func, bitmask, thisArg, partials);
          } else {
            result2 = createHybrid.apply(undefined2, newData);
          }
          var setter = data ? baseSetData : setData;
          return setWrapToString(setter(result2, newData), func, bitmask);
        }
        function customDefaultsAssignIn(objValue, srcValue, key, object) {
          if (objValue === undefined2 || eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key)) {
            return srcValue;
          }
          return objValue;
        }
        function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
          if (isObject(objValue) && isObject(srcValue)) {
            stack.set(srcValue, objValue);
            baseMerge(objValue, srcValue, undefined2, customDefaultsMerge, stack);
            stack["delete"](srcValue);
          }
          return objValue;
        }
        function customOmitClone(value) {
          return isPlainObject4(value) ? undefined2 : value;
        }
        function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
          var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length;
          if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
            return false;
          }
          var arrStacked = stack.get(array);
          var othStacked = stack.get(other);
          if (arrStacked && othStacked) {
            return arrStacked == other && othStacked == array;
          }
          var index = -1, result2 = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : undefined2;
          stack.set(array, other);
          stack.set(other, array);
          while (++index < arrLength) {
            var arrValue = array[index], othValue = other[index];
            if (customizer) {
              var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
            }
            if (compared !== undefined2) {
              if (compared) {
                continue;
              }
              result2 = false;
              break;
            }
            if (seen) {
              if (!arraySome(other, function(othValue2, othIndex) {
                if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
                  return seen.push(othIndex);
                }
              })) {
                result2 = false;
                break;
              }
            } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
              result2 = false;
              break;
            }
          }
          stack["delete"](array);
          stack["delete"](other);
          return result2;
        }
        function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
          switch (tag) {
            case dataViewTag:
              if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
                return false;
              }
              object = object.buffer;
              other = other.buffer;
            case arrayBufferTag:
              if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array2(object), new Uint8Array2(other))) {
                return false;
              }
              return true;
            case boolTag:
            case dateTag:
            case numberTag:
              return eq(+object, +other);
            case errorTag:
              return object.name == other.name && object.message == other.message;
            case regexpTag:
            case stringTag:
              return object == other + "";
            case mapTag:
              var convert = mapToArray;
            case setTag:
              var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
              convert || (convert = setToArray);
              if (object.size != other.size && !isPartial) {
                return false;
              }
              var stacked = stack.get(object);
              if (stacked) {
                return stacked == other;
              }
              bitmask |= COMPARE_UNORDERED_FLAG;
              stack.set(object, other);
              var result2 = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
              stack["delete"](object);
              return result2;
            case symbolTag:
              if (symbolValueOf) {
                return symbolValueOf.call(object) == symbolValueOf.call(other);
              }
          }
          return false;
        }
        function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
          var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
          if (objLength != othLength && !isPartial) {
            return false;
          }
          var index = objLength;
          while (index--) {
            var key = objProps[index];
            if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
              return false;
            }
          }
          var objStacked = stack.get(object);
          var othStacked = stack.get(other);
          if (objStacked && othStacked) {
            return objStacked == other && othStacked == object;
          }
          var result2 = true;
          stack.set(object, other);
          stack.set(other, object);
          var skipCtor = isPartial;
          while (++index < objLength) {
            key = objProps[index];
            var objValue = object[key], othValue = other[key];
            if (customizer) {
              var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
            }
            if (!(compared === undefined2 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
              result2 = false;
              break;
            }
            skipCtor || (skipCtor = key == "constructor");
          }
          if (result2 && !skipCtor) {
            var objCtor = object.constructor, othCtor = other.constructor;
            if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
              result2 = false;
            }
          }
          stack["delete"](object);
          stack["delete"](other);
          return result2;
        }
        function flatRest(func) {
          return setToString(overRest(func, undefined2, flatten), func + "");
        }
        function getAllKeys(object) {
          return baseGetAllKeys(object, keys, getSymbols);
        }
        function getAllKeysIn(object) {
          return baseGetAllKeys(object, keysIn, getSymbolsIn);
        }
        var getData = !metaMap ? noop2 : function(func) {
          return metaMap.get(func);
        };
        function getFuncName(func) {
          var result2 = func.name + "", array = realNames[result2], length = hasOwnProperty.call(realNames, result2) ? array.length : 0;
          while (length--) {
            var data = array[length], otherFunc = data.func;
            if (otherFunc == null || otherFunc == func) {
              return data.name;
            }
          }
          return result2;
        }
        function getHolder(func) {
          var object = hasOwnProperty.call(lodash, "placeholder") ? lodash : func;
          return object.placeholder;
        }
        function getIteratee() {
          var result2 = lodash.iteratee || iteratee;
          result2 = result2 === iteratee ? baseIteratee : result2;
          return arguments.length ? result2(arguments[0], arguments[1]) : result2;
        }
        function getMapData(map3, key) {
          var data = map3.__data__;
          return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
        }
        function getMatchData(object) {
          var result2 = keys(object), length = result2.length;
          while (length--) {
            var key = result2[length], value = object[key];
            result2[length] = [key, value, isStrictComparable(value)];
          }
          return result2;
        }
        function getNative(object, key) {
          var value = getValue2(object, key);
          return baseIsNative(value) ? value : undefined2;
        }
        function getRawTag(value) {
          var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
          try {
            value[symToStringTag] = undefined2;
            var unmasked = true;
          } catch (e) {
          }
          var result2 = nativeObjectToString.call(value);
          if (unmasked) {
            if (isOwn) {
              value[symToStringTag] = tag;
            } else {
              delete value[symToStringTag];
            }
          }
          return result2;
        }
        var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
          if (object == null) {
            return [];
          }
          object = Object2(object);
          return arrayFilter(nativeGetSymbols(object), function(symbol) {
            return propertyIsEnumerable.call(object, symbol);
          });
        };
        var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
          var result2 = [];
          while (object) {
            arrayPush(result2, getSymbols(object));
            object = getPrototype(object);
          }
          return result2;
        };
        var getTag = baseGetTag;
        if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap2 && getTag(new WeakMap2()) != weakMapTag) {
          getTag = function(value) {
            var result2 = baseGetTag(value), Ctor = result2 == objectTag ? value.constructor : undefined2, ctorString = Ctor ? toSource(Ctor) : "";
            if (ctorString) {
              switch (ctorString) {
                case dataViewCtorString:
                  return dataViewTag;
                case mapCtorString:
                  return mapTag;
                case promiseCtorString:
                  return promiseTag;
                case setCtorString:
                  return setTag;
                case weakMapCtorString:
                  return weakMapTag;
              }
            }
            return result2;
          };
        }
        function getView(start, end, transforms) {
          var index = -1, length = transforms.length;
          while (++index < length) {
            var data = transforms[index], size2 = data.size;
            switch (data.type) {
              case "drop":
                start += size2;
                break;
              case "dropRight":
                end -= size2;
                break;
              case "take":
                end = nativeMin(end, start + size2);
                break;
              case "takeRight":
                start = nativeMax(start, end - size2);
                break;
            }
          }
          return { "start": start, "end": end };
        }
        function getWrapDetails(source) {
          var match = source.match(reWrapDetails);
          return match ? match[1].split(reSplitDetails) : [];
        }
        function hasPath(object, path, hasFunc) {
          path = castPath(path, object);
          var index = -1, length = path.length, result2 = false;
          while (++index < length) {
            var key = toKey(path[index]);
            if (!(result2 = object != null && hasFunc(object, key))) {
              break;
            }
            object = object[key];
          }
          if (result2 || ++index != length) {
            return result2;
          }
          length = object == null ? 0 : object.length;
          return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object));
        }
        function initCloneArray(array) {
          var length = array.length, result2 = new array.constructor(length);
          if (length && typeof array[0] == "string" && hasOwnProperty.call(array, "index")) {
            result2.index = array.index;
            result2.input = array.input;
          }
          return result2;
        }
        function initCloneObject(object) {
          return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
        }
        function initCloneByTag(object, tag, isDeep) {
          var Ctor = object.constructor;
          switch (tag) {
            case arrayBufferTag:
              return cloneArrayBuffer(object);
            case boolTag:
            case dateTag:
              return new Ctor(+object);
            case dataViewTag:
              return cloneDataView(object, isDeep);
            case float32Tag:
            case float64Tag:
            case int8Tag:
            case int16Tag:
            case int32Tag:
            case uint8Tag:
            case uint8ClampedTag:
            case uint16Tag:
            case uint32Tag:
              return cloneTypedArray(object, isDeep);
            case mapTag:
              return new Ctor();
            case numberTag:
            case stringTag:
              return new Ctor(object);
            case regexpTag:
              return cloneRegExp(object);
            case setTag:
              return new Ctor();
            case symbolTag:
              return cloneSymbol(object);
          }
        }
        function insertWrapDetails(source, details) {
          var length = details.length;
          if (!length) {
            return source;
          }
          var lastIndex = length - 1;
          details[lastIndex] = (length > 1 ? "& " : "") + details[lastIndex];
          details = details.join(length > 2 ? ", " : " ");
          return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n");
        }
        function isFlattenable(value) {
          return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
        }
        function isIndex(value, length) {
          var type = typeof value;
          length = length == null ? MAX_SAFE_INTEGER : length;
          return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
        }
        function isIterateeCall(value, index, object) {
          if (!isObject(object)) {
            return false;
          }
          var type = typeof index;
          if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) {
            return eq(object[index], value);
          }
          return false;
        }
        function isKey(value, object) {
          if (isArray(value)) {
            return false;
          }
          var type = typeof value;
          if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) {
            return true;
          }
          return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object2(object);
        }
        function isKeyable(value) {
          var type = typeof value;
          return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
        }
        function isLaziable(func) {
          var funcName = getFuncName(func), other = lodash[funcName];
          if (typeof other != "function" || !(funcName in LazyWrapper.prototype)) {
            return false;
          }
          if (func === other) {
            return true;
          }
          var data = getData(other);
          return !!data && func === data[0];
        }
        function isMasked(func) {
          return !!maskSrcKey && maskSrcKey in func;
        }
        var isMaskable = coreJsData ? isFunction : stubFalse;
        function isPrototype(value) {
          var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
          return value === proto;
        }
        function isStrictComparable(value) {
          return value === value && !isObject(value);
        }
        function matchesStrictComparable(key, srcValue) {
          return function(object) {
            if (object == null) {
              return false;
            }
            return object[key] === srcValue && (srcValue !== undefined2 || key in Object2(object));
          };
        }
        function memoizeCapped(func) {
          var result2 = memoize(func, function(key) {
            if (cache.size === MAX_MEMOIZE_SIZE) {
              cache.clear();
            }
            return key;
          });
          var cache = result2.cache;
          return result2;
        }
        function mergeData(data, source) {
          var bitmask = data[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
          var isCombo = srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_CURRY_FLAG || srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_REARG_FLAG && data[7].length <= source[8] || srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG) && source[7].length <= source[8] && bitmask == WRAP_CURRY_FLAG;
          if (!(isCommon || isCombo)) {
            return data;
          }
          if (srcBitmask & WRAP_BIND_FLAG) {
            data[2] = source[2];
            newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
          }
          var value = source[3];
          if (value) {
            var partials = data[3];
            data[3] = partials ? composeArgs(partials, value, source[4]) : value;
            data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
          }
          value = source[5];
          if (value) {
            partials = data[5];
            data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
            data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
          }
          value = source[7];
          if (value) {
            data[7] = value;
          }
          if (srcBitmask & WRAP_ARY_FLAG) {
            data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
          }
          if (data[9] == null) {
            data[9] = source[9];
          }
          data[0] = source[0];
          data[1] = newBitmask;
          return data;
        }
        function nativeKeysIn(object) {
          var result2 = [];
          if (object != null) {
            for (var key in Object2(object)) {
              result2.push(key);
            }
          }
          return result2;
        }
        function objectToString(value) {
          return nativeObjectToString.call(value);
        }
        function overRest(func, start, transform2) {
          start = nativeMax(start === undefined2 ? func.length - 1 : start, 0);
          return function() {
            var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array3(length);
            while (++index < length) {
              array[index] = args[start + index];
            }
            index = -1;
            var otherArgs = Array3(start + 1);
            while (++index < start) {
              otherArgs[index] = args[index];
            }
            otherArgs[start] = transform2(array);
            return apply(func, this, otherArgs);
          };
        }
        function parent(object, path) {
          return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
        }
        function reorder(array, indexes) {
          var arrLength = array.length, length = nativeMin(indexes.length, arrLength), oldArray = copyArray(array);
          while (length--) {
            var index = indexes[length];
            array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined2;
          }
          return array;
        }
        function safeGet(object, key) {
          if (key === "constructor" && typeof object[key] === "function") {
            return;
          }
          if (key == "__proto__") {
            return;
          }
          return object[key];
        }
        var setData = shortOut(baseSetData);
        var setTimeout2 = ctxSetTimeout || function(func, wait) {
          return root.setTimeout(func, wait);
        };
        var setToString = shortOut(baseSetToString);
        function setWrapToString(wrapper, reference, bitmask) {
          var source = reference + "";
          return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
        }
        function shortOut(func) {
          var count = 0, lastCalled = 0;
          return function() {
            var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
            lastCalled = stamp;
            if (remaining > 0) {
              if (++count >= HOT_COUNT) {
                return arguments[0];
              }
            } else {
              count = 0;
            }
            return func.apply(undefined2, arguments);
          };
        }
        function shuffleSelf(array, size2) {
          var index = -1, length = array.length, lastIndex = length - 1;
          size2 = size2 === undefined2 ? length : size2;
          while (++index < size2) {
            var rand = baseRandom(index, lastIndex), value = array[rand];
            array[rand] = array[index];
            array[index] = value;
          }
          array.length = size2;
          return array;
        }
        var stringToPath = memoizeCapped(function(string) {
          var result2 = [];
          if (string.charCodeAt(0) === 46) {
            result2.push("");
          }
          string.replace(rePropName, function(match, number, quote, subString) {
            result2.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
          });
          return result2;
        });
        function toKey(value) {
          if (typeof value == "string" || isSymbol(value)) {
            return value;
          }
          var result2 = value + "";
          return result2 == "0" && 1 / value == -INFINITY ? "-0" : result2;
        }
        function toSource(func) {
          if (func != null) {
            try {
              return funcToString.call(func);
            } catch (e) {
            }
            try {
              return func + "";
            } catch (e) {
            }
          }
          return "";
        }
        function updateWrapDetails(details, bitmask) {
          arrayEach(wrapFlags, function(pair) {
            var value = "_." + pair[0];
            if (bitmask & pair[1] && !arrayIncludes(details, value)) {
              details.push(value);
            }
          });
          return details.sort();
        }
        function wrapperClone(wrapper) {
          if (wrapper instanceof LazyWrapper) {
            return wrapper.clone();
          }
          var result2 = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
          result2.__actions__ = copyArray(wrapper.__actions__);
          result2.__index__ = wrapper.__index__;
          result2.__values__ = wrapper.__values__;
          return result2;
        }
        function chunk(array, size2, guard) {
          if (guard ? isIterateeCall(array, size2, guard) : size2 === undefined2) {
            size2 = 1;
          } else {
            size2 = nativeMax(toInteger(size2), 0);
          }
          var length = array == null ? 0 : array.length;
          if (!length || size2 < 1) {
            return [];
          }
          var index = 0, resIndex = 0, result2 = Array3(nativeCeil(length / size2));
          while (index < length) {
            result2[resIndex++] = baseSlice(array, index, index += size2);
          }
          return result2;
        }
        function compact(array) {
          var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result2 = [];
          while (++index < length) {
            var value = array[index];
            if (value) {
              result2[resIndex++] = value;
            }
          }
          return result2;
        }
        function concat() {
          var length = arguments.length;
          if (!length) {
            return [];
          }
          var args = Array3(length - 1), array = arguments[0], index = length;
          while (index--) {
            args[index - 1] = arguments[index];
          }
          return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
        }
        var difference = baseRest(function(array, values2) {
          return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values2, 1, isArrayLikeObject, true)) : [];
        });
        var differenceBy = baseRest(function(array, values2) {
          var iteratee2 = last2(values2);
          if (isArrayLikeObject(iteratee2)) {
            iteratee2 = undefined2;
          }
          return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values2, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2)) : [];
        });
        var differenceWith = baseRest(function(array, values2) {
          var comparator = last2(values2);
          if (isArrayLikeObject(comparator)) {
            comparator = undefined2;
          }
          return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values2, 1, isArrayLikeObject, true), undefined2, comparator) : [];
        });
        function drop(array, n2, guard) {
          var length = array == null ? 0 : array.length;
          if (!length) {
            return [];
          }
          n2 = guard || n2 === undefined2 ? 1 : toInteger(n2);
          return baseSlice(array, n2 < 0 ? 0 : n2, length);
        }
        function dropRight(array, n2, guard) {
          var length = array == null ? 0 : array.length;
          if (!length) {
            return [];
          }
          n2 = guard || n2 === undefined2 ? 1 : toInteger(n2);
          n2 = length - n2;
          return baseSlice(array, 0, n2 < 0 ? 0 : n2);
        }
        function dropRightWhile(array, predicate) {
          return array && array.length ? baseWhile(array, getIteratee(predicate, 3), true, true) : [];
        }
        function dropWhile(array, predicate) {
          return array && array.length ? baseWhile(array, getIteratee(predicate, 3), true) : [];
        }
        function fill(array, value, start, end) {
          var length = array == null ? 0 : array.length;
          if (!length) {
            return [];
          }
          if (start && typeof start != "number" && isIterateeCall(array, value, start)) {
            start = 0;
            end = length;
          }
          return baseFill(array, value, start, end);
        }
        function findIndex(array, predicate, fromIndex) {
          var length = array == null ? 0 : array.length;
          if (!length) {
            return -1;
          }
          var index = fromIndex == null ? 0 : toInteger(fromIndex);
          if (index < 0) {
            index = nativeMax(length + index, 0);
          }
          return baseFindIndex(array, getIteratee(predicate, 3), index);
        }
        function findLastIndex(array, predicate, fromIndex) {
          var length = array == null ? 0 : array.length;
          if (!length) {
            return -1;
          }
          var index = length - 1;
          if (fromIndex !== undefined2) {
            index = toInteger(fromIndex);
            index = fromIndex < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
          }
          return baseFindIndex(array, getIteratee(predicate, 3), index, true);
        }
        function flatten(array) {
          var length = array == null ? 0 : array.length;
          return length ? baseFlatten(array, 1) : [];
        }
        function flattenDeep(array) {
          var length = array == null ? 0 : array.length;
          return length ? baseFlatten(array, INFINITY) : [];
        }
        function flattenDepth(array, depth) {
          var length = array == null ? 0 : array.length;
          if (!length) {
            return [];
          }
          depth = depth === undefined2 ? 1 : toInteger(depth);
          return baseFlatten(array, depth);
        }
        function fromPairs(pairs) {
          var index = -1, length = pairs == null ? 0 : pairs.length, result2 = {};
          while (++index < length) {
            var pair = pairs[index];
            result2[pair[0]] = pair[1];
          }
          return result2;
        }
        function head(array) {
          return array && array.length ? array[0] : undefined2;
        }
        function indexOf(array, value, fromIndex) {
          var length = array == null ? 0 : array.length;
          if (!length) {
            return -1;
          }
          var index = fromIndex == null ? 0 : toInteger(fromIndex);
          if (index < 0) {
            index = nativeMax(length + index, 0);
          }
          return baseIndexOf(array, value, index);
        }
        function initial(array) {
          var length = array == null ? 0 : array.length;
          return length ? baseSlice(array, 0, -1) : [];
        }
        var intersection = baseRest(function(arrays) {
          var mapped = arrayMap(arrays, castArrayLikeObject);
          return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : [];
        });
        var intersectionBy = baseRest(function(arrays) {
          var iteratee2 = last2(arrays), mapped = arrayMap(arrays, castArrayLikeObject);
          if (iteratee2 === last2(mapped)) {
            iteratee2 = undefined2;
          } else {
            mapped.pop();
          }
          return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, getIteratee(iteratee2, 2)) : [];
        });
        var intersectionWith = baseRest(function(arrays) {
          var comparator = last2(arrays), mapped = arrayMap(arrays, castArrayLikeObject);
          comparator = typeof comparator == "function" ? comparator : undefined2;
          if (comparator) {
            mapped.pop();
          }
          return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
        });
        function join(array, separator) {
          return array == null ? "" : nativeJoin.call(array, separator);
        }
        function last2(array) {
          var length = array == null ? 0 : array.length;
          return length ? array[length - 1] : undefined2;
        }
        function lastIndexOf(array, value, fromIndex) {
          var length = array == null ? 0 : array.length;
          if (!length) {
            return -1;
          }
          var index = length;
          if (fromIndex !== undefined2) {
            index = toInteger(fromIndex);
            index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
          }
          return value === value ? strictLastIndexOf(array, value, index) : baseFindIndex(array, baseIsNaN, index, true);
        }
        function nth(array, n2) {
          return array && array.length ? baseNth(array, toInteger(n2)) : undefined2;
        }
        var pull = baseRest(pullAll);
        function pullAll(array, values2) {
          return array && array.length && values2 && values2.length ? basePullAll(array, values2) : array;
        }
        function pullAllBy(array, values2, iteratee2) {
          return array && array.length && values2 && values2.length ? basePullAll(array, values2, getIteratee(iteratee2, 2)) : array;
        }
        function pullAllWith(array, values2, comparator) {
          return array && array.length && values2 && values2.length ? basePullAll(array, values2, undefined2, comparator) : array;
        }
        var pullAt = flatRest(function(array, indexes) {
          var length = array == null ? 0 : array.length, result2 = baseAt(array, indexes);
          basePullAt(array, arrayMap(indexes, function(index) {
            return isIndex(index, length) ? +index : index;
          }).sort(compareAscending));
          return result2;
        });
        function remove2(array, predicate) {
          var result2 = [];
          if (!(array && array.length)) {
            return result2;
          }
          var index = -1, indexes = [], length = array.length;
          predicate = getIteratee(predicate, 3);
          while (++index < length) {
            var value = array[index];
            if (predicate(value, index, array)) {
              result2.push(value);
              indexes.push(index);
            }
          }
          basePullAt(array, indexes);
          return result2;
        }
        function reverse(array) {
          return array == null ? array : nativeReverse.call(array);
        }
        function slice(array, start, end) {
          var length = array == null ? 0 : array.length;
          if (!length) {
            return [];
          }
          if (end && typeof end != "number" && isIterateeCall(array, start, end)) {
            start = 0;
            end = length;
          } else {
            start = start == null ? 0 : toInteger(start);
            end = end === undefined2 ? length : toInteger(end);
          }
          return baseSlice(array, start, end);
        }
        function sortedIndex(array, value) {
          return baseSortedIndex(array, value);
        }
        function sortedIndexBy(array, value, iteratee2) {
          return baseSortedIndexBy(array, value, getIteratee(iteratee2, 2));
        }
        function sortedIndexOf(array, value) {
          var length = array == null ? 0 : array.length;
          if (length) {
            var index = baseSortedIndex(array, value);
            if (index < length && eq(array[index], value)) {
              return index;
            }
          }
          return -1;
        }
        function sortedLastIndex(array, value) {
          return baseSortedIndex(array, value, true);
        }
        function sortedLastIndexBy(array, value, iteratee2) {
          return baseSortedIndexBy(array, value, getIteratee(iteratee2, 2), true);
        }
        function sortedLastIndexOf(array, value) {
          var length = array == null ? 0 : array.length;
          if (length) {
            var index = baseSortedIndex(array, value, true) - 1;
            if (eq(array[index], value)) {
              return index;
            }
          }
          return -1;
        }
        function sortedUniq(array) {
          return array && array.length ? baseSortedUniq(array) : [];
        }
        function sortedUniqBy(array, iteratee2) {
          return array && array.length ? baseSortedUniq(array, getIteratee(iteratee2, 2)) : [];
        }
        function tail(array) {
          var length = array == null ? 0 : array.length;
          return length ? baseSlice(array, 1, length) : [];
        }
        function take(array, n2, guard) {
          if (!(array && array.length)) {
            return [];
          }
          n2 = guard || n2 === undefined2 ? 1 : toInteger(n2);
          return baseSlice(array, 0, n2 < 0 ? 0 : n2);
        }
        function takeRight(array, n2, guard) {
          var length = array == null ? 0 : array.length;
          if (!length) {
            return [];
          }
          n2 = guard || n2 === undefined2 ? 1 : toInteger(n2);
          n2 = length - n2;
          return baseSlice(array, n2 < 0 ? 0 : n2, length);
        }
        function takeRightWhile(array, predicate) {
          return array && array.length ? baseWhile(array, getIteratee(predicate, 3), false, true) : [];
        }
        function takeWhile(array, predicate) {
          return array && array.length ? baseWhile(array, getIteratee(predicate, 3)) : [];
        }
        var union = baseRest(function(arrays) {
          return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
        });
        var unionBy = baseRest(function(arrays) {
          var iteratee2 = last2(arrays);
          if (isArrayLikeObject(iteratee2)) {
            iteratee2 = undefined2;
          }
          return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2));
        });
        var unionWith = baseRest(function(arrays) {
          var comparator = last2(arrays);
          comparator = typeof comparator == "function" ? comparator : undefined2;
          return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined2, comparator);
        });
        function uniq(array) {
          return array && array.length ? baseUniq(array) : [];
        }
        function uniqBy(array, iteratee2) {
          return array && array.length ? baseUniq(array, getIteratee(iteratee2, 2)) : [];
        }
        function uniqWith(array, comparator) {
          comparator = typeof comparator == "function" ? comparator : undefined2;
          return array && array.length ? baseUniq(array, undefined2, comparator) : [];
        }
        function unzip(array) {
          if (!(array && array.length)) {
            return [];
          }
          var length = 0;
          array = arrayFilter(array, function(group) {
            if (isArrayLikeObject(group)) {
              length = nativeMax(group.length, length);
              return true;
            }
          });
          return baseTimes(length, function(index) {
            return arrayMap(array, baseProperty(index));
          });
        }
        function unzipWith(array, iteratee2) {
          if (!(array && array.length)) {
            return [];
          }
          var result2 = unzip(array);
          if (iteratee2 == null) {
            return result2;
          }
          return arrayMap(result2, function(group) {
            return apply(iteratee2, undefined2, group);
          });
        }
        var without = baseRest(function(array, values2) {
          return isArrayLikeObject(array) ? baseDifference(array, values2) : [];
        });
        var xor = baseRest(function(arrays) {
          return baseXor(arrayFilter(arrays, isArrayLikeObject));
        });
        var xorBy = baseRest(function(arrays) {
          var iteratee2 = last2(arrays);
          if (isArrayLikeObject(iteratee2)) {
            iteratee2 = undefined2;
          }
          return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee2, 2));
        });
        var xorWith = baseRest(function(arrays) {
          var comparator = last2(arrays);
          comparator = typeof comparator == "function" ? comparator : undefined2;
          return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined2, comparator);
        });
        var zip = baseRest(unzip);
        function zipObject(props, values2) {
          return baseZipObject(props || [], values2 || [], assignValue);
        }
        function zipObjectDeep(props, values2) {
          return baseZipObject(props || [], values2 || [], baseSet);
        }
        var zipWith = baseRest(function(arrays) {
          var length = arrays.length, iteratee2 = length > 1 ? arrays[length - 1] : undefined2;
          iteratee2 = typeof iteratee2 == "function" ? (arrays.pop(), iteratee2) : undefined2;
          return unzipWith(arrays, iteratee2);
        });
        function chain(value) {
          var result2 = lodash(value);
          result2.__chain__ = true;
          return result2;
        }
        function tap2(value, interceptor) {
          interceptor(value);
          return value;
        }
        function thru(value, interceptor) {
          return interceptor(value);
        }
        var wrapperAt = flatRest(function(paths) {
          var length = paths.length, start = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) {
            return baseAt(object, paths);
          };
          if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start)) {
            return this.thru(interceptor);
          }
          value = value.slice(start, +start + (length ? 1 : 0));
          value.__actions__.push({
            "func": thru,
            "args": [interceptor],
            "thisArg": undefined2
          });
          return new LodashWrapper(value, this.__chain__).thru(function(array) {
            if (length && !array.length) {
              array.push(undefined2);
            }
            return array;
          });
        });
        function wrapperChain() {
          return chain(this);
        }
        function wrapperCommit() {
          return new LodashWrapper(this.value(), this.__chain__);
        }
        function wrapperNext() {
          if (this.__values__ === undefined2) {
            this.__values__ = toArray(this.value());
          }
          var done = this.__index__ >= this.__values__.length, value = done ? undefined2 : this.__values__[this.__index__++];
          return { "done": done, "value": value };
        }
        function wrapperToIterator() {
          return this;
        }
        function wrapperPlant(value) {
          var result2, parent2 = this;
          while (parent2 instanceof baseLodash) {
            var clone3 = wrapperClone(parent2);
            clone3.__index__ = 0;
            clone3.__values__ = undefined2;
            if (result2) {
              previous.__wrapped__ = clone3;
            } else {
              result2 = clone3;
            }
            var previous = clone3;
            parent2 = parent2.__wrapped__;
          }
          previous.__wrapped__ = value;
          return result2;
        }
        function wrapperReverse() {
          var value = this.__wrapped__;
          if (value instanceof LazyWrapper) {
            var wrapped = value;
            if (this.__actions__.length) {
              wrapped = new LazyWrapper(this);
            }
            wrapped = wrapped.reverse();
            wrapped.__actions__.push({
              "func": thru,
              "args": [reverse],
              "thisArg": undefined2
            });
            return new LodashWrapper(wrapped, this.__chain__);
          }
          return this.thru(reverse);
        }
        function wrapperValue() {
          return baseWrapperValue(this.__wrapped__, this.__actions__);
        }
        var countBy = createAggregator(function(result2, value, key) {
          if (hasOwnProperty.call(result2, key)) {
            ++result2[key];
          } else {
            baseAssignValue(result2, key, 1);
          }
        });
        function every(collection, predicate, guard) {
          var func = isArray(collection) ? arrayEvery : baseEvery;
          if (guard && isIterateeCall(collection, predicate, guard)) {
            predicate = undefined2;
          }
          return func(collection, getIteratee(predicate, 3));
        }
        function filter3(collection, predicate) {
          var func = isArray(collection) ? arrayFilter : baseFilter;
          return func(collection, getIteratee(predicate, 3));
        }
        var find3 = createFind(findIndex);
        var findLast = createFind(findLastIndex);
        function flatMap(collection, iteratee2) {
          return baseFlatten(map2(collection, iteratee2), 1);
        }
        function flatMapDeep(collection, iteratee2) {
          return baseFlatten(map2(collection, iteratee2), INFINITY);
        }
        function flatMapDepth(collection, iteratee2, depth) {
          depth = depth === undefined2 ? 1 : toInteger(depth);
          return baseFlatten(map2(collection, iteratee2), depth);
        }
        function forEach(collection, iteratee2) {
          var func = isArray(collection) ? arrayEach : baseEach;
          return func(collection, getIteratee(iteratee2, 3));
        }
        function forEachRight(collection, iteratee2) {
          var func = isArray(collection) ? arrayEachRight : baseEachRight;
          return func(collection, getIteratee(iteratee2, 3));
        }
        var groupBy = createAggregator(function(result2, value, key) {
          if (hasOwnProperty.call(result2, key)) {
            result2[key].push(value);
          } else {
            baseAssignValue(result2, key, [value]);
          }
        });
        function includes(collection, value, fromIndex, guard) {
          collection = isArrayLike(collection) ? collection : values(collection);
          fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0;
          var length = collection.length;
          if (fromIndex < 0) {
            fromIndex = nativeMax(length + fromIndex, 0);
          }
          return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
        }
        var invokeMap = baseRest(function(collection, path, args) {
          var index = -1, isFunc = typeof path == "function", result2 = isArrayLike(collection) ? Array3(collection.length) : [];
          baseEach(collection, function(value) {
            result2[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
          });
          return result2;
        });
        var keyBy = createAggregator(function(result2, value, key) {
          baseAssignValue(result2, key, value);
        });
        function map2(collection, iteratee2) {
          var func = isArray(collection) ? arrayMap : baseMap;
          return func(collection, getIteratee(iteratee2, 3));
        }
        function orderBy(collection, iteratees, orders, guard) {
          if (collection == null) {
            return [];
          }
          if (!isArray(iteratees)) {
            iteratees = iteratees == null ? [] : [iteratees];
          }
          orders = guard ? undefined2 : orders;
          if (!isArray(orders)) {
            orders = orders == null ? [] : [orders];
          }
          return baseOrderBy(collection, iteratees, orders);
        }
        var partition = createAggregator(function(result2, value, key) {
          result2[key ? 0 : 1].push(value);
        }, function() {
          return [[], []];
        });
        function reduce(collection, iteratee2, accumulator) {
          var func = isArray(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3;
          return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEach);
        }
        function reduceRight(collection, iteratee2, accumulator) {
          var func = isArray(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3;
          return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEachRight);
        }
        function reject(collection, predicate) {
          var func = isArray(collection) ? arrayFilter : baseFilter;
          return func(collection, negate(getIteratee(predicate, 3)));
        }
        function sample(collection) {
          var func = isArray(collection) ? arraySample : baseSample;
          return func(collection);
        }
        function sampleSize(collection, n2, guard) {
          if (guard ? isIterateeCall(collection, n2, guard) : n2 === undefined2) {
            n2 = 1;
          } else {
            n2 = toInteger(n2);
          }
          var func = isArray(collection) ? arraySampleSize : baseSampleSize;
          return func(collection, n2);
        }
        function shuffle(collection) {
          var func = isArray(collection) ? arrayShuffle : baseShuffle;
          return func(collection);
        }
        function size(collection) {
          if (collection == null) {
            return 0;
          }
          if (isArrayLike(collection)) {
            return isString(collection) ? stringSize(collection) : collection.length;
          }
          var tag = getTag(collection);
          if (tag == mapTag || tag == setTag) {
            return collection.size;
          }
          return baseKeys(collection).length;
        }
        function some(collection, predicate, guard) {
          var func = isArray(collection) ? arraySome : baseSome;
          if (guard && isIterateeCall(collection, predicate, guard)) {
            predicate = undefined2;
          }
          return func(collection, getIteratee(predicate, 3));
        }
        var sortBy = baseRest(function(collection, iteratees) {
          if (collection == null) {
            return [];
          }
          var length = iteratees.length;
          if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
            iteratees = [];
          } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
            iteratees = [iteratees[0]];
          }
          return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
        });
        var now = ctxNow || function() {
          return root.Date.now();
        };
        function after(n2, func) {
          if (typeof func != "function") {
            throw new TypeError2(FUNC_ERROR_TEXT);
          }
          n2 = toInteger(n2);
          return function() {
            if (--n2 < 1) {
              return func.apply(this, arguments);
            }
          };
        }
        function ary(func, n2, guard) {
          n2 = guard ? undefined2 : n2;
          n2 = func && n2 == null ? func.length : n2;
          return createWrap(func, WRAP_ARY_FLAG, undefined2, undefined2, undefined2, undefined2, n2);
        }
        function before(n2, func) {
          var result2;
          if (typeof func != "function") {
            throw new TypeError2(FUNC_ERROR_TEXT);
          }
          n2 = toInteger(n2);
          return function() {
            if (--n2 > 0) {
              result2 = func.apply(this, arguments);
            }
            if (n2 <= 1) {
              func = undefined2;
            }
            return result2;
          };
        }
        var bind = baseRest(function(func, thisArg, partials) {
          var bitmask = WRAP_BIND_FLAG;
          if (partials.length) {
            var holders = replaceHolders(partials, getHolder(bind));
            bitmask |= WRAP_PARTIAL_FLAG;
          }
          return createWrap(func, bitmask, thisArg, partials, holders);
        });
        var bindKey = baseRest(function(object, key, partials) {
          var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
          if (partials.length) {
            var holders = replaceHolders(partials, getHolder(bindKey));
            bitmask |= WRAP_PARTIAL_FLAG;
          }
          return createWrap(key, bitmask, object, partials, holders);
        });
        function curry(func, arity, guard) {
          arity = guard ? undefined2 : arity;
          var result2 = createWrap(func, WRAP_CURRY_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity);
          result2.placeholder = curry.placeholder;
          return result2;
        }
        function curryRight(func, arity, guard) {
          arity = guard ? undefined2 : arity;
          var result2 = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity);
          result2.placeholder = curryRight.placeholder;
          return result2;
        }
        function debounce(func, wait, options) {
          var lastArgs, lastThis, maxWait, result2, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
          if (typeof func != "function") {
            throw new TypeError2(FUNC_ERROR_TEXT);
          }
          wait = toNumber(wait) || 0;
          if (isObject(options)) {
            leading = !!options.leading;
            maxing = "maxWait" in options;
            maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
            trailing = "trailing" in options ? !!options.trailing : trailing;
          }
          function invokeFunc(time) {
            var args = lastArgs, thisArg = lastThis;
            lastArgs = lastThis = undefined2;
            lastInvokeTime = time;
            result2 = func.apply(thisArg, args);
            return result2;
          }
          function leadingEdge(time) {
            lastInvokeTime = time;
            timerId = setTimeout2(timerExpired, wait);
            return leading ? invokeFunc(time) : result2;
          }
          function remainingWait(time) {
            var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
            return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
          }
          function shouldInvoke(time) {
            var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
            return lastCallTime === undefined2 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
          }
          function timerExpired() {
            var time = now();
            if (shouldInvoke(time)) {
              return trailingEdge(time);
            }
            timerId = setTimeout2(timerExpired, remainingWait(time));
          }
          function trailingEdge(time) {
            timerId = undefined2;
            if (trailing && lastArgs) {
              return invokeFunc(time);
            }
            lastArgs = lastThis = undefined2;
            return result2;
          }
          function cancel() {
            if (timerId !== undefined2) {
              clearTimeout2(timerId);
            }
            lastInvokeTime = 0;
            lastArgs = lastCallTime = lastThis = timerId = undefined2;
          }
          function flush() {
            return timerId === undefined2 ? result2 : trailingEdge(now());
          }
          function debounced() {
            var time = now(), isInvoking = shouldInvoke(time);
            lastArgs = arguments;
            lastThis = this;
            lastCallTime = time;
            if (isInvoking) {
              if (timerId === undefined2) {
                return leadingEdge(lastCallTime);
              }
              if (maxing) {
                clearTimeout2(timerId);
                timerId = setTimeout2(timerExpired, wait);
                return invokeFunc(lastCallTime);
              }
            }
            if (timerId === undefined2) {
              timerId = setTimeout2(timerExpired, wait);
            }
            return result2;
          }
          debounced.cancel = cancel;
          debounced.flush = flush;
          return debounced;
        }
        var defer = baseRest(function(func, args) {
          return baseDelay(func, 1, args);
        });
        var delay = baseRest(function(func, wait, args) {
          return baseDelay(func, toNumber(wait) || 0, args);
        });
        function flip(func) {
          return createWrap(func, WRAP_FLIP_FLAG);
        }
        function memoize(func, resolver) {
          if (typeof func != "function" || resolver != null && typeof resolver != "function") {
            throw new TypeError2(FUNC_ERROR_TEXT);
          }
          var memoized = function() {
            var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
            if (cache.has(key)) {
              return cache.get(key);
            }
            var result2 = func.apply(this, args);
            memoized.cache = cache.set(key, result2) || cache;
            return result2;
          };
          memoized.cache = new (memoize.Cache || MapCache)();
          return memoized;
        }
        memoize.Cache = MapCache;
        function negate(predicate) {
          if (typeof predicate != "function") {
            throw new TypeError2(FUNC_ERROR_TEXT);
          }
          return function() {
            var args = arguments;
            switch (args.length) {
              case 0:
                return !predicate.call(this);
              case 1:
                return !predicate.call(this, args[0]);
              case 2:
                return !predicate.call(this, args[0], args[1]);
              case 3:
                return !predicate.call(this, args[0], args[1], args[2]);
            }
            return !predicate.apply(this, args);
          };
        }
        function once(func) {
          return before(2, func);
        }
        var overArgs = castRest(function(func, transforms) {
          transforms = transforms.length == 1 && isArray(transforms[0]) ? arrayMap(transforms[0], baseUnary(getIteratee())) : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
          var funcsLength = transforms.length;
          return baseRest(function(args) {
            var index = -1, length = nativeMin(args.length, funcsLength);
            while (++index < length) {
              args[index] = transforms[index].call(this, args[index]);
            }
            return apply(func, this, args);
          });
        });
        var partial = baseRest(function(func, partials) {
          var holders = replaceHolders(partials, getHolder(partial));
          return createWrap(func, WRAP_PARTIAL_FLAG, undefined2, partials, holders);
        });
        var partialRight = baseRest(function(func, partials) {
          var holders = replaceHolders(partials, getHolder(partialRight));
          return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined2, partials, holders);
        });
        var rearg = flatRest(function(func, indexes) {
          return createWrap(func, WRAP_REARG_FLAG, undefined2, undefined2, undefined2, indexes);
        });
        function rest(func, start) {
          if (typeof func != "function") {
            throw new TypeError2(FUNC_ERROR_TEXT);
          }
          start = start === undefined2 ? start : toInteger(start);
          return baseRest(func, start);
        }
        function spread(func, start) {
          if (typeof func != "function") {
            throw new TypeError2(FUNC_ERROR_TEXT);
          }
          start = start == null ? 0 : nativeMax(toInteger(start), 0);
          return baseRest(function(args) {
            var array = args[start], otherArgs = castSlice(args, 0, start);
            if (array) {
              arrayPush(otherArgs, array);
            }
            return apply(func, this, otherArgs);
          });
        }
        function throttle(func, wait, options) {
          var leading = true, trailing = true;
          if (typeof func != "function") {
            throw new TypeError2(FUNC_ERROR_TEXT);
          }
          if (isObject(options)) {
            leading = "leading" in options ? !!options.leading : leading;
            trailing = "trailing" in options ? !!options.trailing : trailing;
          }
          return debounce(func, wait, {
            "leading": leading,
            "maxWait": wait,
            "trailing": trailing
          });
        }
        function unary(func) {
          return ary(func, 1);
        }
        function wrap(value, wrapper) {
          return partial(castFunction(wrapper), value);
        }
        function castArray() {
          if (!arguments.length) {
            return [];
          }
          var value = arguments[0];
          return isArray(value) ? value : [value];
        }
        function clone2(value) {
          return baseClone(value, CLONE_SYMBOLS_FLAG);
        }
        function cloneWith(value, customizer) {
          customizer = typeof customizer == "function" ? customizer : undefined2;
          return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
        }
        function cloneDeep12(value) {
          return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
        }
        function cloneDeepWith(value, customizer) {
          customizer = typeof customizer == "function" ? customizer : undefined2;
          return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
        }
        function conformsTo(object, source) {
          return source == null || baseConformsTo(object, source, keys(source));
        }
        function eq(value, other) {
          return value === other || value !== value && other !== other;
        }
        var gt = createRelationalOperation(baseGt);
        var gte = createRelationalOperation(function(value, other) {
          return value >= other;
        });
        var isArguments = baseIsArguments(/* @__PURE__ */ function() {
          return arguments;
        }()) ? baseIsArguments : function(value) {
          return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
        };
        var isArray = Array3.isArray;
        var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
        function isArrayLike(value) {
          return value != null && isLength(value.length) && !isFunction(value);
        }
        function isArrayLikeObject(value) {
          return isObjectLike(value) && isArrayLike(value);
        }
        function isBoolean2(value) {
          return value === true || value === false || isObjectLike(value) && baseGetTag(value) == boolTag;
        }
        var isBuffer = nativeIsBuffer || stubFalse;
        var isDate2 = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
        function isElement(value) {
          return isObjectLike(value) && value.nodeType === 1 && !isPlainObject4(value);
        }
        function isEmpty(value) {
          if (value == null) {
            return true;
          }
          if (isArrayLike(value) && (isArray(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer(value) || isTypedArray(value) || isArguments(value))) {
            return !value.length;
          }
          var tag = getTag(value);
          if (tag == mapTag || tag == setTag) {
            return !value.size;
          }
          if (isPrototype(value)) {
            return !baseKeys(value).length;
          }
          for (var key in value) {
            if (hasOwnProperty.call(value, key)) {
              return false;
            }
          }
          return true;
        }
        function isEqual(value, other) {
          return baseIsEqual(value, other);
        }
        function isEqualWith(value, other, customizer) {
          customizer = typeof customizer == "function" ? customizer : undefined2;
          var result2 = customizer ? customizer(value, other) : undefined2;
          return result2 === undefined2 ? baseIsEqual(value, other, undefined2, customizer) : !!result2;
        }
        function isError2(value) {
          if (!isObjectLike(value)) {
            return false;
          }
          var tag = baseGetTag(value);
          return tag == errorTag || tag == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject4(value);
        }
        function isFinite2(value) {
          return typeof value == "number" && nativeIsFinite(value);
        }
        function isFunction(value) {
          if (!isObject(value)) {
            return false;
          }
          var tag = baseGetTag(value);
          return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
        }
        function isInteger(value) {
          return typeof value == "number" && value == toInteger(value);
        }
        function isLength(value) {
          return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
        }
        function isObject(value) {
          var type = typeof value;
          return value != null && (type == "object" || type == "function");
        }
        function isObjectLike(value) {
          return value != null && typeof value == "object";
        }
        var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
        function isMatch(object, source) {
          return object === source || baseIsMatch(object, source, getMatchData(source));
        }
        function isMatchWith(object, source, customizer) {
          customizer = typeof customizer == "function" ? customizer : undefined2;
          return baseIsMatch(object, source, getMatchData(source), customizer);
        }
        function isNaN2(value) {
          return isNumber3(value) && value != +value;
        }
        function isNative(value) {
          if (isMaskable(value)) {
            throw new Error2(CORE_ERROR_TEXT);
          }
          return baseIsNative(value);
        }
        function isNull(value) {
          return value === null;
        }
        function isNil(value) {
          return value == null;
        }
        function isNumber3(value) {
          return typeof value == "number" || isObjectLike(value) && baseGetTag(value) == numberTag;
        }
        function isPlainObject4(value) {
          if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
            return false;
          }
          var proto = getPrototype(value);
          if (proto === null) {
            return true;
          }
          var Ctor = hasOwnProperty.call(proto, "constructor") && proto.constructor;
          return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
        }
        var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
        function isSafeInteger(value) {
          return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
        }
        var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
        function isString(value) {
          return typeof value == "string" || !isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag;
        }
        function isSymbol(value) {
          return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
        }
        var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
        function isUndefined(value) {
          return value === undefined2;
        }
        function isWeakMap(value) {
          return isObjectLike(value) && getTag(value) == weakMapTag;
        }
        function isWeakSet(value) {
          return isObjectLike(value) && baseGetTag(value) == weakSetTag;
        }
        var lt = createRelationalOperation(baseLt);
        var lte = createRelationalOperation(function(value, other) {
          return value <= other;
        });
        function toArray(value) {
          if (!value) {
            return [];
          }
          if (isArrayLike(value)) {
            return isString(value) ? stringToArray(value) : copyArray(value);
          }
          if (symIterator && value[symIterator]) {
            return iteratorToArray(value[symIterator]());
          }
          var tag = getTag(value), func = tag == mapTag ? mapToArray : tag == setTag ? setToArray : values;
          return func(value);
        }
        function toFinite(value) {
          if (!value) {
            return value === 0 ? value : 0;
          }
          value = toNumber(value);
          if (value === INFINITY || value === -INFINITY) {
            var sign = value < 0 ? -1 : 1;
            return sign * MAX_INTEGER;
          }
          return value === value ? value : 0;
        }
        function toInteger(value) {
          var result2 = toFinite(value), remainder = result2 % 1;
          return result2 === result2 ? remainder ? result2 - remainder : result2 : 0;
        }
        function toLength(value) {
          return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
        }
        function toNumber(value) {
          if (typeof value == "number") {
            return value;
          }
          if (isSymbol(value)) {
            return NAN;
          }
          if (isObject(value)) {
            var other = typeof value.valueOf == "function" ? value.valueOf() : value;
            value = isObject(other) ? other + "" : other;
          }
          if (typeof value != "string") {
            return value === 0 ? value : +value;
          }
          value = baseTrim(value);
          var isBinary = reIsBinary.test(value);
          return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
        }
        function toPlainObject(value) {
          return copyObject(value, keysIn(value));
        }
        function toSafeInteger(value) {
          return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) : value === 0 ? value : 0;
        }
        function toString(value) {
          return value == null ? "" : baseToString(value);
        }
        var assign = createAssigner(function(object, source) {
          if (isPrototype(source) || isArrayLike(source)) {
            copyObject(source, keys(source), object);
            return;
          }
          for (var key in source) {
            if (hasOwnProperty.call(source, key)) {
              assignValue(object, key, source[key]);
            }
          }
        });
        var assignIn = createAssigner(function(object, source) {
          copyObject(source, keysIn(source), object);
        });
        var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
          copyObject(source, keysIn(source), object, customizer);
        });
        var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
          copyObject(source, keys(source), object, customizer);
        });
        var at = flatRest(baseAt);
        function create(prototype, properties) {
          var result2 = baseCreate(prototype);
          return properties == null ? result2 : baseAssign(result2, properties);
        }
        var defaults = baseRest(function(object, sources) {
          object = Object2(object);
          var index = -1;
          var length = sources.length;
          var guard = length > 2 ? sources[2] : undefined2;
          if (guard && isIterateeCall(sources[0], sources[1], guard)) {
            length = 1;
          }
          while (++index < length) {
            var source = sources[index];
            var props = keysIn(source);
            var propsIndex = -1;
            var propsLength = props.length;
            while (++propsIndex < propsLength) {
              var key = props[propsIndex];
              var value = object[key];
              if (value === undefined2 || eq(value, objectProto[key]) && !hasOwnProperty.call(object, key)) {
                object[key] = source[key];
              }
            }
          }
          return object;
        });
        var defaultsDeep = baseRest(function(args) {
          args.push(undefined2, customDefaultsMerge);
          return apply(mergeWith, undefined2, args);
        });
        function findKey(object, predicate) {
          return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
        }
        function findLastKey(object, predicate) {
          return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
        }
        function forIn(object, iteratee2) {
          return object == null ? object : baseFor(object, getIteratee(iteratee2, 3), keysIn);
        }
        function forInRight(object, iteratee2) {
          return object == null ? object : baseForRight(object, getIteratee(iteratee2, 3), keysIn);
        }
        function forOwn(object, iteratee2) {
          return object && baseForOwn(object, getIteratee(iteratee2, 3));
        }
        function forOwnRight(object, iteratee2) {
          return object && baseForOwnRight(object, getIteratee(iteratee2, 3));
        }
        function functions(object) {
          return object == null ? [] : baseFunctions(object, keys(object));
        }
        function functionsIn(object) {
          return object == null ? [] : baseFunctions(object, keysIn(object));
        }
        function get(object, path, defaultValue) {
          var result2 = object == null ? undefined2 : baseGet(object, path);
          return result2 === undefined2 ? defaultValue : result2;
        }
        function has(object, path) {
          return object != null && hasPath(object, path, baseHas);
        }
        function hasIn(object, path) {
          return object != null && hasPath(object, path, baseHasIn);
        }
        var invert = createInverter(function(result2, value, key) {
          if (value != null && typeof value.toString != "function") {
            value = nativeObjectToString.call(value);
          }
          result2[value] = key;
        }, constant(identity2));
        var invertBy = createInverter(function(result2, value, key) {
          if (value != null && typeof value.toString != "function") {
            value = nativeObjectToString.call(value);
          }
          if (hasOwnProperty.call(result2, value)) {
            result2[value].push(key);
          } else {
            result2[value] = [key];
          }
        }, getIteratee);
        var invoke = baseRest(baseInvoke);
        function keys(object) {
          return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
        }
        function keysIn(object) {
          return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
        }
        function mapKeys(object, iteratee2) {
          var result2 = {};
          iteratee2 = getIteratee(iteratee2, 3);
          baseForOwn(object, function(value, key, object2) {
            baseAssignValue(result2, iteratee2(value, key, object2), value);
          });
          return result2;
        }
        function mapValues(object, iteratee2) {
          var result2 = {};
          iteratee2 = getIteratee(iteratee2, 3);
          baseForOwn(object, function(value, key, object2) {
            baseAssignValue(result2, key, iteratee2(value, key, object2));
          });
          return result2;
        }
        var merge2 = createAssigner(function(object, source, srcIndex) {
          baseMerge(object, source, srcIndex);
        });
        var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
          baseMerge(object, source, srcIndex, customizer);
        });
        var omit2 = flatRest(function(object, paths) {
          var result2 = {};
          if (object == null) {
            return result2;
          }
          var isDeep = false;
          paths = arrayMap(paths, function(path) {
            path = castPath(path, object);
            isDeep || (isDeep = path.length > 1);
            return path;
          });
          copyObject(object, getAllKeysIn(object), result2);
          if (isDeep) {
            result2 = baseClone(result2, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
          }
          var length = paths.length;
          while (length--) {
            baseUnset(result2, paths[length]);
          }
          return result2;
        });
        function omitBy(object, predicate) {
          return pickBy(object, negate(getIteratee(predicate)));
        }
        var pick = flatRest(function(object, paths) {
          return object == null ? {} : basePick(object, paths);
        });
        function pickBy(object, predicate) {
          if (object == null) {
            return {};
          }
          var props = arrayMap(getAllKeysIn(object), function(prop) {
            return [prop];
          });
          predicate = getIteratee(predicate);
          return basePickBy(object, props, function(value, path) {
            return predicate(value, path[0]);
          });
        }
        function result(object, path, defaultValue) {
          path = castPath(path, object);
          var index = -1, length = path.length;
          if (!length) {
            length = 1;
            object = undefined2;
          }
          while (++index < length) {
            var value = object == null ? undefined2 : object[toKey(path[index])];
            if (value === undefined2) {
              index = length;
              value = defaultValue;
            }
            object = isFunction(value) ? value.call(object) : value;
          }
          return object;
        }
        function set(object, path, value) {
          return object == null ? object : baseSet(object, path, value);
        }
        function setWith(object, path, value, customizer) {
          customizer = typeof customizer == "function" ? customizer : undefined2;
          return object == null ? object : baseSet(object, path, value, customizer);
        }
        var toPairs = createToPairs(keys);
        var toPairsIn = createToPairs(keysIn);
        function transform(object, iteratee2, accumulator) {
          var isArr = isArray(object), isArrLike = isArr || isBuffer(object) || isTypedArray(object);
          iteratee2 = getIteratee(iteratee2, 4);
          if (accumulator == null) {
            var Ctor = object && object.constructor;
            if (isArrLike) {
              accumulator = isArr ? new Ctor() : [];
            } else if (isObject(object)) {
              accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
            } else {
              accumulator = {};
            }
          }
          (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object2) {
            return iteratee2(accumulator, value, index, object2);
          });
          return accumulator;
        }
        function unset(object, path) {
          return object == null ? true : baseUnset(object, path);
        }
        function update(object, path, updater) {
          return object == null ? object : baseUpdate(object, path, castFunction(updater));
        }
        function updateWith(object, path, updater, customizer) {
          customizer = typeof customizer == "function" ? customizer : undefined2;
          return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
        }
        function values(object) {
          return object == null ? [] : baseValues(object, keys(object));
        }
        function valuesIn(object) {
          return object == null ? [] : baseValues(object, keysIn(object));
        }
        function clamp(number, lower, upper) {
          if (upper === undefined2) {
            upper = lower;
            lower = undefined2;
          }
          if (upper !== undefined2) {
            upper = toNumber(upper);
            upper = upper === upper ? upper : 0;
          }
          if (lower !== undefined2) {
            lower = toNumber(lower);
            lower = lower === lower ? lower : 0;
          }
          return baseClamp(toNumber(number), lower, upper);
        }
        function inRange(number, start, end) {
          start = toFinite(start);
          if (end === undefined2) {
            end = start;
            start = 0;
          } else {
            end = toFinite(end);
          }
          number = toNumber(number);
          return baseInRange(number, start, end);
        }
        function random(lower, upper, floating) {
          if (floating && typeof floating != "boolean" && isIterateeCall(lower, upper, floating)) {
            upper = floating = undefined2;
          }
          if (floating === undefined2) {
            if (typeof upper == "boolean") {
              floating = upper;
              upper = undefined2;
            } else if (typeof lower == "boolean") {
              floating = lower;
              lower = undefined2;
            }
          }
          if (lower === undefined2 && upper === undefined2) {
            lower = 0;
            upper = 1;
          } else {
            lower = toFinite(lower);
            if (upper === undefined2) {
              upper = lower;
              lower = 0;
            } else {
              upper = toFinite(upper);
            }
          }
          if (lower > upper) {
            var temp = lower;
            lower = upper;
            upper = temp;
          }
          if (floating || lower % 1 || upper % 1) {
            var rand = nativeRandom();
            return nativeMin(lower + rand * (upper - lower + freeParseFloat("1e-" + ((rand + "").length - 1))), upper);
          }
          return baseRandom(lower, upper);
        }
        var camelCase = createCompounder(function(result2, word, index) {
          word = word.toLowerCase();
          return result2 + (index ? capitalize(word) : word);
        });
        function capitalize(string) {
          return upperFirst(toString(string).toLowerCase());
        }
        function deburr(string) {
          string = toString(string);
          return string && string.replace(reLatin, deburrLetter).replace(reComboMark, "");
        }
        function endsWith(string, target, position) {
          string = toString(string);
          target = baseToString(target);
          var length = string.length;
          position = position === undefined2 ? length : baseClamp(toInteger(position), 0, length);
          var end = position;
          position -= target.length;
          return position >= 0 && string.slice(position, end) == target;
        }
        function escape2(string) {
          string = toString(string);
          return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string;
        }
        function escapeRegExp(string) {
          string = toString(string);
          return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, "\\$&") : string;
        }
        var kebabCase = createCompounder(function(result2, word, index) {
          return result2 + (index ? "-" : "") + word.toLowerCase();
        });
        var lowerCase = createCompounder(function(result2, word, index) {
          return result2 + (index ? " " : "") + word.toLowerCase();
        });
        var lowerFirst = createCaseFirst("toLowerCase");
        function pad(string, length, chars) {
          string = toString(string);
          length = toInteger(length);
          var strLength = length ? stringSize(string) : 0;
          if (!length || strLength >= length) {
            return string;
          }
          var mid = (length - strLength) / 2;
          return createPadding(nativeFloor(mid), chars) + string + createPadding(nativeCeil(mid), chars);
        }
        function padEnd(string, length, chars) {
          string = toString(string);
          length = toInteger(length);
          var strLength = length ? stringSize(string) : 0;
          return length && strLength < length ? string + createPadding(length - strLength, chars) : string;
        }
        function padStart(string, length, chars) {
          string = toString(string);
          length = toInteger(length);
          var strLength = length ? stringSize(string) : 0;
          return length && strLength < length ? createPadding(length - strLength, chars) + string : string;
        }
        function parseInt2(string, radix, guard) {
          if (guard || radix == null) {
            radix = 0;
          } else if (radix) {
            radix = +radix;
          }
          return nativeParseInt(toString(string).replace(reTrimStart, ""), radix || 0);
        }
        function repeat(string, n2, guard) {
          if (guard ? isIterateeCall(string, n2, guard) : n2 === undefined2) {
            n2 = 1;
          } else {
            n2 = toInteger(n2);
          }
          return baseRepeat(toString(string), n2);
        }
        function replace() {
          var args = arguments, string = toString(args[0]);
          return args.length < 3 ? string : string.replace(args[1], args[2]);
        }
        var snakeCase = createCompounder(function(result2, word, index) {
          return result2 + (index ? "_" : "") + word.toLowerCase();
        });
        function split2(string, separator, limit) {
          if (limit && typeof limit != "number" && isIterateeCall(string, separator, limit)) {
            separator = limit = undefined2;
          }
          limit = limit === undefined2 ? MAX_ARRAY_LENGTH : limit >>> 0;
          if (!limit) {
            return [];
          }
          string = toString(string);
          if (string && (typeof separator == "string" || separator != null && !isRegExp(separator))) {
            separator = baseToString(separator);
            if (!separator && hasUnicode(string)) {
              return castSlice(stringToArray(string), 0, limit);
            }
          }
          return string.split(separator, limit);
        }
        var startCase = createCompounder(function(result2, word, index) {
          return result2 + (index ? " " : "") + upperFirst(word);
        });
        function startsWith(string, target, position) {
          string = toString(string);
          position = position == null ? 0 : baseClamp(toInteger(position), 0, string.length);
          target = baseToString(target);
          return string.slice(position, position + target.length) == target;
        }
        function template(string, options, guard) {
          var settings = lodash.templateSettings;
          if (guard && isIterateeCall(string, options, guard)) {
            options = undefined2;
          }
          string = toString(string);
          options = assignInWith({}, options, settings, customDefaultsAssignIn);
          var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys);
          var isEscaping, isEvaluating, index = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '";
          var reDelimiters = RegExp2(
            (options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$",
            "g"
          );
          var sourceURL = "//# sourceURL=" + (hasOwnProperty.call(options, "sourceURL") ? (options.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n";
          string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
            interpolateValue || (interpolateValue = esTemplateValue);
            source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
            if (escapeValue) {
              isEscaping = true;
              source += "' +\n__e(" + escapeValue + ") +\n'";
            }
            if (evaluateValue) {
              isEvaluating = true;
              source += "';\n" + evaluateValue + ";\n__p += '";
            }
            if (interpolateValue) {
              source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
            }
            index = offset + match.length;
            return match;
          });
          source += "';\n";
          var variable = hasOwnProperty.call(options, "variable") && options.variable;
          if (!variable) {
            source = "with (obj) {\n" + source + "\n}\n";
          } else if (reForbiddenIdentifierChars.test(variable)) {
            throw new Error2(INVALID_TEMPL_VAR_ERROR_TEXT);
          }
          source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;");
          source = "function(" + (variable || "obj") + ") {\n" + (variable ? "" : "obj || (obj = {});\n") + "var __t, __p = ''" + (isEscaping ? ", __e = _.escape" : "") + (isEvaluating ? ", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n" : ";\n") + source + "return __p\n}";
          var result2 = attempt(function() {
            return Function2(importsKeys, sourceURL + "return " + source).apply(undefined2, importsValues);
          });
          result2.source = source;
          if (isError2(result2)) {
            throw result2;
          }
          return result2;
        }
        function toLower(value) {
          return toString(value).toLowerCase();
        }
        function toUpper(value) {
          return toString(value).toUpperCase();
        }
        function trim(string, chars, guard) {
          string = toString(string);
          if (string && (guard || chars === undefined2)) {
            return baseTrim(string);
          }
          if (!string || !(chars = baseToString(chars))) {
            return string;
          }
          var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1;
          return castSlice(strSymbols, start, end).join("");
        }
        function trimEnd(string, chars, guard) {
          string = toString(string);
          if (string && (guard || chars === undefined2)) {
            return string.slice(0, trimmedEndIndex(string) + 1);
          }
          if (!string || !(chars = baseToString(chars))) {
            return string;
          }
          var strSymbols = stringToArray(string), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
          return castSlice(strSymbols, 0, end).join("");
        }
        function trimStart(string, chars, guard) {
          string = toString(string);
          if (string && (guard || chars === undefined2)) {
            return string.replace(reTrimStart, "");
          }
          if (!string || !(chars = baseToString(chars))) {
            return string;
          }
          var strSymbols = stringToArray(string), start = charsStartIndex(strSymbols, stringToArray(chars));
          return castSlice(strSymbols, start).join("");
        }
        function truncate(string, options) {
          var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
          if (isObject(options)) {
            var separator = "separator" in options ? options.separator : separator;
            length = "length" in options ? toInteger(options.length) : length;
            omission = "omission" in options ? baseToString(options.omission) : omission;
          }
          string = toString(string);
          var strLength = string.length;
          if (hasUnicode(string)) {
            var strSymbols = stringToArray(string);
            strLength = strSymbols.length;
          }
          if (length >= strLength) {
            return string;
          }
          var end = length - stringSize(omission);
          if (end < 1) {
            return omission;
          }
          var result2 = strSymbols ? castSlice(strSymbols, 0, end).join("") : string.slice(0, end);
          if (separator === undefined2) {
            return result2 + omission;
          }
          if (strSymbols) {
            end += result2.length - end;
          }
          if (isRegExp(separator)) {
            if (string.slice(end).search(separator)) {
              var match, substring = result2;
              if (!separator.global) {
                separator = RegExp2(separator.source, toString(reFlags.exec(separator)) + "g");
              }
              separator.lastIndex = 0;
              while (match = separator.exec(substring)) {
                var newEnd = match.index;
              }
              result2 = result2.slice(0, newEnd === undefined2 ? end : newEnd);
            }
          } else if (string.indexOf(baseToString(separator), end) != end) {
            var index = result2.lastIndexOf(separator);
            if (index > -1) {
              result2 = result2.slice(0, index);
            }
          }
          return result2 + omission;
        }
        function unescape2(string) {
          string = toString(string);
          return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string;
        }
        var upperCase = createCompounder(function(result2, word, index) {
          return result2 + (index ? " " : "") + word.toUpperCase();
        });
        var upperFirst = createCaseFirst("toUpperCase");
        function words(string, pattern, guard) {
          string = toString(string);
          pattern = guard ? undefined2 : pattern;
          if (pattern === undefined2) {
            return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
          }
          return string.match(pattern) || [];
        }
        var attempt = baseRest(function(func, args) {
          try {
            return apply(func, undefined2, args);
          } catch (e) {
            return isError2(e) ? e : new Error2(e);
          }
        });
        var bindAll = flatRest(function(object, methodNames) {
          arrayEach(methodNames, function(key) {
            key = toKey(key);
            baseAssignValue(object, key, bind(object[key], object));
          });
          return object;
        });
        function cond(pairs) {
          var length = pairs == null ? 0 : pairs.length, toIteratee = getIteratee();
          pairs = !length ? [] : arrayMap(pairs, function(pair) {
            if (typeof pair[1] != "function") {
              throw new TypeError2(FUNC_ERROR_TEXT);
            }
            return [toIteratee(pair[0]), pair[1]];
          });
          return baseRest(function(args) {
            var index = -1;
            while (++index < length) {
              var pair = pairs[index];
              if (apply(pair[0], this, args)) {
                return apply(pair[1], this, args);
              }
            }
          });
        }
        function conforms(source) {
          return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
        }
        function constant(value) {
          return function() {
            return value;
          };
        }
        function defaultTo(value, defaultValue) {
          return value == null || value !== value ? defaultValue : value;
        }
        var flow = createFlow();
        var flowRight = createFlow(true);
        function identity2(value) {
          return value;
        }
        function iteratee(func) {
          return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG));
        }
        function matches(source) {
          return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
        }
        function matchesProperty(path, srcValue) {
          return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
        }
        var method = baseRest(function(path, args) {
          return function(object) {
            return baseInvoke(object, path, args);
          };
        });
        var methodOf = baseRest(function(object, args) {
          return function(path) {
            return baseInvoke(object, path, args);
          };
        });
        function mixin(object, source, options) {
          var props = keys(source), methodNames = baseFunctions(source, props);
          if (options == null && !(isObject(source) && (methodNames.length || !props.length))) {
            options = source;
            source = object;
            object = this;
            methodNames = baseFunctions(source, keys(source));
          }
          var chain2 = !(isObject(options) && "chain" in options) || !!options.chain, isFunc = isFunction(object);
          arrayEach(methodNames, function(methodName) {
            var func = source[methodName];
            object[methodName] = func;
            if (isFunc) {
              object.prototype[methodName] = function() {
                var chainAll = this.__chain__;
                if (chain2 || chainAll) {
                  var result2 = object(this.__wrapped__), actions = result2.__actions__ = copyArray(this.__actions__);
                  actions.push({ "func": func, "args": arguments, "thisArg": object });
                  result2.__chain__ = chainAll;
                  return result2;
                }
                return func.apply(object, arrayPush([this.value()], arguments));
              };
            }
          });
          return object;
        }
        function noConflict() {
          if (root._ === this) {
            root._ = oldDash;
          }
          return this;
        }
        function noop2() {
        }
        function nthArg(n2) {
          n2 = toInteger(n2);
          return baseRest(function(args) {
            return baseNth(args, n2);
          });
        }
        var over = createOver(arrayMap);
        var overEvery = createOver(arrayEvery);
        var overSome = createOver(arraySome);
        function property(path) {
          return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
        }
        function propertyOf(object) {
          return function(path) {
            return object == null ? undefined2 : baseGet(object, path);
          };
        }
        var range = createRange();
        var rangeRight = createRange(true);
        function stubArray() {
          return [];
        }
        function stubFalse() {
          return false;
        }
        function stubObject() {
          return {};
        }
        function stubString() {
          return "";
        }
        function stubTrue() {
          return true;
        }
        function times(n2, iteratee2) {
          n2 = toInteger(n2);
          if (n2 < 1 || n2 > MAX_SAFE_INTEGER) {
            return [];
          }
          var index = MAX_ARRAY_LENGTH, length = nativeMin(n2, MAX_ARRAY_LENGTH);
          iteratee2 = getIteratee(iteratee2);
          n2 -= MAX_ARRAY_LENGTH;
          var result2 = baseTimes(length, iteratee2);
          while (++index < n2) {
            iteratee2(index);
          }
          return result2;
        }
        function toPath(value) {
          if (isArray(value)) {
            return arrayMap(value, toKey);
          }
          return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
        }
        function uniqueId(prefix2) {
          var id2 = ++idCounter;
          return toString(prefix2) + id2;
        }
        var add = createMathOperation(function(augend, addend) {
          return augend + addend;
        }, 0);
        var ceil2 = createRound("ceil");
        var divide = createMathOperation(function(dividend, divisor) {
          return dividend / divisor;
        }, 1);
        var floor2 = createRound("floor");
        function max2(array) {
          return array && array.length ? baseExtremum(array, identity2, baseGt) : undefined2;
        }
        function maxBy(array, iteratee2) {
          return array && array.length ? baseExtremum(array, getIteratee(iteratee2, 2), baseGt) : undefined2;
        }
        function mean(array) {
          return baseMean(array, identity2);
        }
        function meanBy(array, iteratee2) {
          return baseMean(array, getIteratee(iteratee2, 2));
        }
        function min2(array) {
          return array && array.length ? baseExtremum(array, identity2, baseLt) : undefined2;
        }
        function minBy(array, iteratee2) {
          return array && array.length ? baseExtremum(array, getIteratee(iteratee2, 2), baseLt) : undefined2;
        }
        var multiply = createMathOperation(function(multiplier, multiplicand) {
          return multiplier * multiplicand;
        }, 1);
        var round2 = createRound("round");
        var subtract = createMathOperation(function(minuend, subtrahend) {
          return minuend - subtrahend;
        }, 0);
        function sum(array) {
          return array && array.length ? baseSum(array, identity2) : 0;
        }
        function sumBy(array, iteratee2) {
          return array && array.length ? baseSum(array, getIteratee(iteratee2, 2)) : 0;
        }
        lodash.after = after;
        lodash.ary = ary;
        lodash.assign = assign;
        lodash.assignIn = assignIn;
        lodash.assignInWith = assignInWith;
        lodash.assignWith = assignWith;
        lodash.at = at;
        lodash.before = before;
        lodash.bind = bind;
        lodash.bindAll = bindAll;
        lodash.bindKey = bindKey;
        lodash.castArray = castArray;
        lodash.chain = chain;
        lodash.chunk = chunk;
        lodash.compact = compact;
        lodash.concat = concat;
        lodash.cond = cond;
        lodash.conforms = conforms;
        lodash.constant = constant;
        lodash.countBy = countBy;
        lodash.create = create;
        lodash.curry = curry;
        lodash.curryRight = curryRight;
        lodash.debounce = debounce;
        lodash.defaults = defaults;
        lodash.defaultsDeep = defaultsDeep;
        lodash.defer = defer;
        lodash.delay = delay;
        lodash.difference = difference;
        lodash.differenceBy = differenceBy;
        lodash.differenceWith = differenceWith;
        lodash.drop = drop;
        lodash.dropRight = dropRight;
        lodash.dropRightWhile = dropRightWhile;
        lodash.dropWhile = dropWhile;
        lodash.fill = fill;
        lodash.filter = filter3;
        lodash.flatMap = flatMap;
        lodash.flatMapDeep = flatMapDeep;
        lodash.flatMapDepth = flatMapDepth;
        lodash.flatten = flatten;
        lodash.flattenDeep = flattenDeep;
        lodash.flattenDepth = flattenDepth;
        lodash.flip = flip;
        lodash.flow = flow;
        lodash.flowRight = flowRight;
        lodash.fromPairs = fromPairs;
        lodash.functions = functions;
        lodash.functionsIn = functionsIn;
        lodash.groupBy = groupBy;
        lodash.initial = initial;
        lodash.intersection = intersection;
        lodash.intersectionBy = intersectionBy;
        lodash.intersectionWith = intersectionWith;
        lodash.invert = invert;
        lodash.invertBy = invertBy;
        lodash.invokeMap = invokeMap;
        lodash.iteratee = iteratee;
        lodash.keyBy = keyBy;
        lodash.keys = keys;
        lodash.keysIn = keysIn;
        lodash.map = map2;
        lodash.mapKeys = mapKeys;
        lodash.mapValues = mapValues;
        lodash.matches = matches;
        lodash.matchesProperty = matchesProperty;
        lodash.memoize = memoize;
        lodash.merge = merge2;
        lodash.mergeWith = mergeWith;
        lodash.method = method;
        lodash.methodOf = methodOf;
        lodash.mixin = mixin;
        lodash.negate = negate;
        lodash.nthArg = nthArg;
        lodash.omit = omit2;
        lodash.omitBy = omitBy;
        lodash.once = once;
        lodash.orderBy = orderBy;
        lodash.over = over;
        lodash.overArgs = overArgs;
        lodash.overEvery = overEvery;
        lodash.overSome = overSome;
        lodash.partial = partial;
        lodash.partialRight = partialRight;
        lodash.partition = partition;
        lodash.pick = pick;
        lodash.pickBy = pickBy;
        lodash.property = property;
        lodash.propertyOf = propertyOf;
        lodash.pull = pull;
        lodash.pullAll = pullAll;
        lodash.pullAllBy = pullAllBy;
        lodash.pullAllWith = pullAllWith;
        lodash.pullAt = pullAt;
        lodash.range = range;
        lodash.rangeRight = rangeRight;
        lodash.rearg = rearg;
        lodash.reject = reject;
        lodash.remove = remove2;
        lodash.rest = rest;
        lodash.reverse = reverse;
        lodash.sampleSize = sampleSize;
        lodash.set = set;
        lodash.setWith = setWith;
        lodash.shuffle = shuffle;
        lodash.slice = slice;
        lodash.sortBy = sortBy;
        lodash.sortedUniq = sortedUniq;
        lodash.sortedUniqBy = sortedUniqBy;
        lodash.split = split2;
        lodash.spread = spread;
        lodash.tail = tail;
        lodash.take = take;
        lodash.takeRight = takeRight;
        lodash.takeRightWhile = takeRightWhile;
        lodash.takeWhile = takeWhile;
        lodash.tap = tap2;
        lodash.throttle = throttle;
        lodash.thru = thru;
        lodash.toArray = toArray;
        lodash.toPairs = toPairs;
        lodash.toPairsIn = toPairsIn;
        lodash.toPath = toPath;
        lodash.toPlainObject = toPlainObject;
        lodash.transform = transform;
        lodash.unary = unary;
        lodash.union = union;
        lodash.unionBy = unionBy;
        lodash.unionWith = unionWith;
        lodash.uniq = uniq;
        lodash.uniqBy = uniqBy;
        lodash.uniqWith = uniqWith;
        lodash.unset = unset;
        lodash.unzip = unzip;
        lodash.unzipWith = unzipWith;
        lodash.update = update;
        lodash.updateWith = updateWith;
        lodash.values = values;
        lodash.valuesIn = valuesIn;
        lodash.without = without;
        lodash.words = words;
        lodash.wrap = wrap;
        lodash.xor = xor;
        lodash.xorBy = xorBy;
        lodash.xorWith = xorWith;
        lodash.zip = zip;
        lodash.zipObject = zipObject;
        lodash.zipObjectDeep = zipObjectDeep;
        lodash.zipWith = zipWith;
        lodash.entries = toPairs;
        lodash.entriesIn = toPairsIn;
        lodash.extend = assignIn;
        lodash.extendWith = assignInWith;
        mixin(lodash, lodash);
        lodash.add = add;
        lodash.attempt = attempt;
        lodash.camelCase = camelCase;
        lodash.capitalize = capitalize;
        lodash.ceil = ceil2;
        lodash.clamp = clamp;
        lodash.clone = clone2;
        lodash.cloneDeep = cloneDeep12;
        lodash.cloneDeepWith = cloneDeepWith;
        lodash.cloneWith = cloneWith;
        lodash.conformsTo = conformsTo;
        lodash.deburr = deburr;
        lodash.defaultTo = defaultTo;
        lodash.divide = divide;
        lodash.endsWith = endsWith;
        lodash.eq = eq;
        lodash.escape = escape2;
        lodash.escapeRegExp = escapeRegExp;
        lodash.every = every;
        lodash.find = find3;
        lodash.findIndex = findIndex;
        lodash.findKey = findKey;
        lodash.findLast = findLast;
        lodash.findLastIndex = findLastIndex;
        lodash.findLastKey = findLastKey;
        lodash.floor = floor2;
        lodash.forEach = forEach;
        lodash.forEachRight = forEachRight;
        lodash.forIn = forIn;
        lodash.forInRight = forInRight;
        lodash.forOwn = forOwn;
        lodash.forOwnRight = forOwnRight;
        lodash.get = get;
        lodash.gt = gt;
        lodash.gte = gte;
        lodash.has = has;
        lodash.hasIn = hasIn;
        lodash.head = head;
        lodash.identity = identity2;
        lodash.includes = includes;
        lodash.indexOf = indexOf;
        lodash.inRange = inRange;
        lodash.invoke = invoke;
        lodash.isArguments = isArguments;
        lodash.isArray = isArray;
        lodash.isArrayBuffer = isArrayBuffer;
        lodash.isArrayLike = isArrayLike;
        lodash.isArrayLikeObject = isArrayLikeObject;
        lodash.isBoolean = isBoolean2;
        lodash.isBuffer = isBuffer;
        lodash.isDate = isDate2;
        lodash.isElement = isElement;
        lodash.isEmpty = isEmpty;
        lodash.isEqual = isEqual;
        lodash.isEqualWith = isEqualWith;
        lodash.isError = isError2;
        lodash.isFinite = isFinite2;
        lodash.isFunction = isFunction;
        lodash.isInteger = isInteger;
        lodash.isLength = isLength;
        lodash.isMap = isMap;
        lodash.isMatch = isMatch;
        lodash.isMatchWith = isMatchWith;
        lodash.isNaN = isNaN2;
        lodash.isNative = isNative;
        lodash.isNil = isNil;
        lodash.isNull = isNull;
        lodash.isNumber = isNumber3;
        lodash.isObject = isObject;
        lodash.isObjectLike = isObjectLike;
        lodash.isPlainObject = isPlainObject4;
        lodash.isRegExp = isRegExp;
        lodash.isSafeInteger = isSafeInteger;
        lodash.isSet = isSet;
        lodash.isString = isString;
        lodash.isSymbol = isSymbol;
        lodash.isTypedArray = isTypedArray;
        lodash.isUndefined = isUndefined;
        lodash.isWeakMap = isWeakMap;
        lodash.isWeakSet = isWeakSet;
        lodash.join = join;
        lodash.kebabCase = kebabCase;
        lodash.last = last2;
        lodash.lastIndexOf = lastIndexOf;
        lodash.lowerCase = lowerCase;
        lodash.lowerFirst = lowerFirst;
        lodash.lt = lt;
        lodash.lte = lte;
        lodash.max = max2;
        lodash.maxBy = maxBy;
        lodash.mean = mean;
        lodash.meanBy = meanBy;
        lodash.min = min2;
        lodash.minBy = minBy;
        lodash.stubArray = stubArray;
        lodash.stubFalse = stubFalse;
        lodash.stubObject = stubObject;
        lodash.stubString = stubString;
        lodash.stubTrue = stubTrue;
        lodash.multiply = multiply;
        lodash.nth = nth;
        lodash.noConflict = noConflict;
        lodash.noop = noop2;
        lodash.now = now;
        lodash.pad = pad;
        lodash.padEnd = padEnd;
        lodash.padStart = padStart;
        lodash.parseInt = parseInt2;
        lodash.random = random;
        lodash.reduce = reduce;
        lodash.reduceRight = reduceRight;
        lodash.repeat = repeat;
        lodash.replace = replace;
        lodash.result = result;
        lodash.round = round2;
        lodash.runInContext = runInContext2;
        lodash.sample = sample;
        lodash.size = size;
        lodash.snakeCase = snakeCase;
        lodash.some = some;
        lodash.sortedIndex = sortedIndex;
        lodash.sortedIndexBy = sortedIndexBy;
        lodash.sortedIndexOf = sortedIndexOf;
        lodash.sortedLastIndex = sortedLastIndex;
        lodash.sortedLastIndexBy = sortedLastIndexBy;
        lodash.sortedLastIndexOf = sortedLastIndexOf;
        lodash.startCase = startCase;
        lodash.startsWith = startsWith;
        lodash.subtract = subtract;
        lodash.sum = sum;
        lodash.sumBy = sumBy;
        lodash.template = template;
        lodash.times = times;
        lodash.toFinite = toFinite;
        lodash.toInteger = toInteger;
        lodash.toLength = toLength;
        lodash.toLower = toLower;
        lodash.toNumber = toNumber;
        lodash.toSafeInteger = toSafeInteger;
        lodash.toString = toString;
        lodash.toUpper = toUpper;
        lodash.trim = trim;
        lodash.trimEnd = trimEnd;
        lodash.trimStart = trimStart;
        lodash.truncate = truncate;
        lodash.unescape = unescape2;
        lodash.uniqueId = uniqueId;
        lodash.upperCase = upperCase;
        lodash.upperFirst = upperFirst;
        lodash.each = forEach;
        lodash.eachRight = forEachRight;
        lodash.first = head;
        mixin(lodash, function() {
          var source = {};
          baseForOwn(lodash, function(func, methodName) {
            if (!hasOwnProperty.call(lodash.prototype, methodName)) {
              source[methodName] = func;
            }
          });
          return source;
        }(), { "chain": false });
        lodash.VERSION = VERSION;
        arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) {
          lodash[methodName].placeholder = lodash;
        });
        arrayEach(["drop", "take"], function(methodName, index) {
          LazyWrapper.prototype[methodName] = function(n2) {
            n2 = n2 === undefined2 ? 1 : nativeMax(toInteger(n2), 0);
            var result2 = this.__filtered__ && !index ? new LazyWrapper(this) : this.clone();
            if (result2.__filtered__) {
              result2.__takeCount__ = nativeMin(n2, result2.__takeCount__);
            } else {
              result2.__views__.push({
                "size": nativeMin(n2, MAX_ARRAY_LENGTH),
                "type": methodName + (result2.__dir__ < 0 ? "Right" : "")
              });
            }
            return result2;
          };
          LazyWrapper.prototype[methodName + "Right"] = function(n2) {
            return this.reverse()[methodName](n2).reverse();
          };
        });
        arrayEach(["filter", "map", "takeWhile"], function(methodName, index) {
          var type = index + 1, isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
          LazyWrapper.prototype[methodName] = function(iteratee2) {
            var result2 = this.clone();
            result2.__iteratees__.push({
              "iteratee": getIteratee(iteratee2, 3),
              "type": type
            });
            result2.__filtered__ = result2.__filtered__ || isFilter;
            return result2;
          };
        });
        arrayEach(["head", "last"], function(methodName, index) {
          var takeName = "take" + (index ? "Right" : "");
          LazyWrapper.prototype[methodName] = function() {
            return this[takeName](1).value()[0];
          };
        });
        arrayEach(["initial", "tail"], function(methodName, index) {
          var dropName = "drop" + (index ? "" : "Right");
          LazyWrapper.prototype[methodName] = function() {
            return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
          };
        });
        LazyWrapper.prototype.compact = function() {
          return this.filter(identity2);
        };
        LazyWrapper.prototype.find = function(predicate) {
          return this.filter(predicate).head();
        };
        LazyWrapper.prototype.findLast = function(predicate) {
          return this.reverse().find(predicate);
        };
        LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
          if (typeof path == "function") {
            return new LazyWrapper(this);
          }
          return this.map(function(value) {
            return baseInvoke(value, path, args);
          });
        });
        LazyWrapper.prototype.reject = function(predicate) {
          return this.filter(negate(getIteratee(predicate)));
        };
        LazyWrapper.prototype.slice = function(start, end) {
          start = toInteger(start);
          var result2 = this;
          if (result2.__filtered__ && (start > 0 || end < 0)) {
            return new LazyWrapper(result2);
          }
          if (start < 0) {
            result2 = result2.takeRight(-start);
          } else if (start) {
            result2 = result2.drop(start);
          }
          if (end !== undefined2) {
            end = toInteger(end);
            result2 = end < 0 ? result2.dropRight(-end) : result2.take(end - start);
          }
          return result2;
        };
        LazyWrapper.prototype.takeRightWhile = function(predicate) {
          return this.reverse().takeWhile(predicate).reverse();
        };
        LazyWrapper.prototype.toArray = function() {
          return this.take(MAX_ARRAY_LENGTH);
        };
        baseForOwn(LazyWrapper.prototype, function(func, methodName) {
          var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), isTaker = /^(?:head|last)$/.test(methodName), lodashFunc = lodash[isTaker ? "take" + (methodName == "last" ? "Right" : "") : methodName], retUnwrapped = isTaker || /^find/.test(methodName);
          if (!lodashFunc) {
            return;
          }
          lodash.prototype[methodName] = function() {
            var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee2 = args[0], useLazy = isLazy || isArray(value);
            var interceptor = function(value2) {
              var result3 = lodashFunc.apply(lodash, arrayPush([value2], args));
              return isTaker && chainAll ? result3[0] : result3;
            };
            if (useLazy && checkIteratee && typeof iteratee2 == "function" && iteratee2.length != 1) {
              isLazy = useLazy = false;
            }
            var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid;
            if (!retUnwrapped && useLazy) {
              value = onlyLazy ? value : new LazyWrapper(this);
              var result2 = func.apply(value, args);
              result2.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": undefined2 });
              return new LodashWrapper(result2, chainAll);
            }
            if (isUnwrapped && onlyLazy) {
              return func.apply(this, args);
            }
            result2 = this.thru(interceptor);
            return isUnwrapped ? isTaker ? result2.value()[0] : result2.value() : result2;
          };
        });
        arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) {
          var func = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName);
          lodash.prototype[methodName] = function() {
            var args = arguments;
            if (retUnwrapped && !this.__chain__) {
              var value = this.value();
              return func.apply(isArray(value) ? value : [], args);
            }
            return this[chainName](function(value2) {
              return func.apply(isArray(value2) ? value2 : [], args);
            });
          };
        });
        baseForOwn(LazyWrapper.prototype, function(func, methodName) {
          var lodashFunc = lodash[methodName];
          if (lodashFunc) {
            var key = lodashFunc.name + "";
            if (!hasOwnProperty.call(realNames, key)) {
              realNames[key] = [];
            }
            realNames[key].push({ "name": methodName, "func": lodashFunc });
          }
        });
        realNames[createHybrid(undefined2, WRAP_BIND_KEY_FLAG).name] = [{
          "name": "wrapper",
          "func": undefined2
        }];
        LazyWrapper.prototype.clone = lazyClone;
        LazyWrapper.prototype.reverse = lazyReverse;
        LazyWrapper.prototype.value = lazyValue;
        lodash.prototype.at = wrapperAt;
        lodash.prototype.chain = wrapperChain;
        lodash.prototype.commit = wrapperCommit;
        lodash.prototype.next = wrapperNext;
        lodash.prototype.plant = wrapperPlant;
        lodash.prototype.reverse = wrapperReverse;
        lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
        lodash.prototype.first = lodash.prototype.head;
        if (symIterator) {
          lodash.prototype[symIterator] = wrapperToIterator;
        }
        return lodash;
      };
      var _7 = runInContext();
      if (typeof define == "function" && typeof define.amd == "object" && define.amd) {
        root._ = _7;
        define(function() {
          return _7;
        });
      } else if (freeModule) {
        (freeModule.exports = _7)._ = _7;
        freeExports._ = _7;
      } else {
        root._ = _7;
      }
    }).call(exports);
  }
});

// node_modules/runtypes/lib/reflect.js
var require_reflect = __commonJS({
  "node_modules/runtypes/lib/reflect.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
  }
});

// node_modules/runtypes/lib/result.js
var require_result = __commonJS({
  "node_modules/runtypes/lib/result.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.Failcode = void 0;
    exports.Failcode = {
      /** The type of the received primitive value is incompatible with expected one. */
      TYPE_INCORRECT: "TYPE_INCORRECT",
      /** The received primitive value is incorrect. */
      VALUE_INCORRECT: "VALUE_INCORRECT",
      /** The key of the property is incorrect. */
      KEY_INCORRECT: "KEY_INCORRECT",
      /** One or more elements or properties of the received object are incorrect. */
      CONTENT_INCORRECT: "CONTENT_INCORRECT",
      /** One or more arguments passed to the function is incorrect. */
      ARGUMENT_INCORRECT: "ARGUMENT_INCORRECT",
      /** The value returned by the function is incorrect. */
      RETURN_INCORRECT: "RETURN_INCORRECT",
      /** The received value does not fulfill the constraint. */
      CONSTRAINT_FAILED: "CONSTRAINT_FAILED",
      /** The property must be present but missing. */
      PROPERTY_MISSING: "PROPERTY_MISSING",
      /** The property must not be present but present. */
      PROPERTY_PRESENT: "PROPERTY_PRESENT",
      /** The value must not be present but present. */
      NOTHING_EXPECTED: "NOTHING_EXPECTED"
    };
  }
});

// node_modules/runtypes/lib/errors.js
var require_errors = __commonJS({
  "node_modules/runtypes/lib/errors.js"(exports) {
    "use strict";
    var __extends2 = exports && exports.__extends || /* @__PURE__ */ function() {
      var extendStatics = function(d2, b2) {
        extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) {
          d3.__proto__ = b3;
        } || function(d3, b3) {
          for (var p2 in b3)
            if (Object.prototype.hasOwnProperty.call(b3, p2))
              d3[p2] = b3[p2];
        };
        return extendStatics(d2, b2);
      };
      return function(d2, b2) {
        if (typeof b2 !== "function" && b2 !== null)
          throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null");
        extendStatics(d2, b2);
        function __() {
          this.constructor = d2;
        }
        d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
      };
    }();
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.ValidationError = void 0;
    var ValidationError2 = (
      /** @class */
      function(_super) {
        __extends2(ValidationError3, _super);
        function ValidationError3(failure) {
          var _this = _super.call(this, failure.message) || this;
          _this.name = "ValidationError";
          _this.code = failure.code;
          if (failure.details !== void 0)
            _this.details = failure.details;
          Object.setPrototypeOf(_this, ValidationError3.prototype);
          return _this;
        }
        return ValidationError3;
      }(Error)
    );
    exports.ValidationError = ValidationError2;
  }
});

// node_modules/runtypes/lib/show.js
var require_show = __commonJS({
  "node_modules/runtypes/lib/show.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var showStringified = function(circular) {
      return function(refl) {
        switch (refl.tag) {
          case "literal":
            return '"'.concat(String(refl.value), '"');
          case "string":
            return "string";
          case "brand":
            return refl.brand;
          case "constraint":
            return refl.name || showStringified(circular)(refl.underlying);
          case "union":
            return refl.alternatives.map(showStringified(circular)).join(" | ");
          case "intersect":
            return refl.intersectees.map(showStringified(circular)).join(" & ");
          default:
            break;
        }
        return "`${".concat(show(false, circular)(refl), "}`");
      };
    };
    var showEmbedded = function(circular) {
      return function(refl) {
        switch (refl.tag) {
          case "literal":
            return String(refl.value);
          case "brand":
            return "${".concat(refl.brand, "}");
          case "constraint":
            return refl.name ? "${".concat(refl.name, "}") : showEmbedded(circular)(refl.underlying);
          case "union":
            if (refl.alternatives.length === 1) {
              var inner = refl.alternatives[0];
              return showEmbedded(circular)(inner.reflect);
            }
            break;
          case "intersect":
            if (refl.intersectees.length === 1) {
              var inner = refl.intersectees[0];
              return showEmbedded(circular)(inner.reflect);
            }
            break;
          default:
            break;
        }
        return "${".concat(show(false, circular)(refl), "}");
      };
    };
    var show = function(needsParens, circular) {
      return function(refl) {
        var parenthesize = function(s2) {
          return needsParens ? "(".concat(s2, ")") : s2;
        };
        if (circular.has(refl))
          return parenthesize("CIRCULAR ".concat(refl.tag));
        else
          circular.add(refl);
        try {
          switch (refl.tag) {
            case "unknown":
            case "never":
            case "void":
            case "boolean":
            case "number":
            case "bigint":
            case "string":
            case "symbol":
            case "function":
              return refl.tag;
            case "literal": {
              var value = refl.value;
              return typeof value === "string" ? '"'.concat(value, '"') : String(value);
            }
            case "template": {
              if (refl.strings.length === 0)
                return '""';
              else if (refl.strings.length === 1)
                return '"'.concat(refl.strings[0], '"');
              else if (refl.strings.length === 2) {
                if (refl.strings.every(function(string) {
                  return string === "";
                })) {
                  var runtype = refl.runtypes[0];
                  return showStringified(circular)(runtype.reflect);
                }
              }
              var backtick_1 = false;
              var inner = refl.strings.reduce(function(inner2, string, i2) {
                var prefix2 = inner2 + string;
                var runtype2 = refl.runtypes[i2];
                if (runtype2) {
                  var suffix = showEmbedded(circular)(runtype2.reflect);
                  if (!backtick_1 && suffix.startsWith("$"))
                    backtick_1 = true;
                  return prefix2 + suffix;
                } else
                  return prefix2;
              }, "");
              return backtick_1 ? "`".concat(inner, "`") : '"'.concat(inner, '"');
            }
            case "array":
              return "".concat(readonlyTag(refl)).concat(show(true, circular)(refl.element), "[]");
            case "dictionary":
              return "{ [_: ".concat(refl.key, "]: ").concat(show(false, circular)(refl.value), " }");
            case "record": {
              var keys = Object.keys(refl.fields);
              return keys.length ? "{ ".concat(keys.map(function(k2) {
                return "".concat(readonlyTag(refl)).concat(k2).concat(partialTag(refl, k2), ": ").concat(refl.fields[k2].tag === "optional" ? show(false, circular)(refl.fields[k2].underlying) : show(false, circular)(refl.fields[k2]), ";");
              }).join(" "), " }") : "{}";
            }
            case "tuple":
              return "[".concat(refl.components.map(show(false, circular)).join(", "), "]");
            case "union":
              return parenthesize("".concat(refl.alternatives.map(show(true, circular)).join(" | ")));
            case "intersect":
              return parenthesize("".concat(refl.intersectees.map(show(true, circular)).join(" & ")));
            case "optional":
              return show(needsParens, circular)(refl.underlying) + " | undefined";
            case "constraint":
              return refl.name || show(needsParens, circular)(refl.underlying);
            case "instanceof":
              return refl.ctor.name;
            case "brand":
              return show(needsParens, circular)(refl.entity);
          }
        } finally {
          circular.delete(refl);
        }
        throw Error("impossible");
      };
    };
    exports.default = show(false, /* @__PURE__ */ new Set());
    function partialTag(_a2, key) {
      var isPartial = _a2.isPartial, fields = _a2.fields;
      return isPartial || key !== void 0 && fields[key].tag === "optional" ? "?" : "";
    }
    function readonlyTag(_a2) {
      var isReadonly = _a2.isReadonly;
      return isReadonly ? "readonly " : "";
    }
  }
});

// node_modules/runtypes/lib/util.js
var require_util = __commonJS({
  "node_modules/runtypes/lib/util.js"(exports) {
    "use strict";
    var __assign = exports && exports.__assign || function() {
      __assign = Object.assign || function(t2) {
        for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) {
          s2 = arguments[i2];
          for (var p2 in s2)
            if (Object.prototype.hasOwnProperty.call(s2, p2))
              t2[p2] = s2[p2];
        }
        return t2;
      };
      return __assign.apply(this, arguments);
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.FAILURE = exports.SUCCESS = exports.enumerableKeysOf = exports.typeOf = exports.hasKey = void 0;
    var result_1 = require_result();
    var show_1 = require_show();
    function hasKey(key, object) {
      return typeof object === "object" && object !== null && key in object;
    }
    exports.hasKey = hasKey;
    var typeOf = function(value) {
      var _a2, _b, _c;
      return typeof value === "object" ? value === null ? "null" : Array.isArray(value) ? "array" : ((_a2 = value.constructor) === null || _a2 === void 0 ? void 0 : _a2.name) === "Object" ? "object" : (_c = (_b = value.constructor) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : typeof value : typeof value;
    };
    exports.typeOf = typeOf;
    var enumerableKeysOf = function(object) {
      return typeof object === "object" && object !== null ? (
        // Objects with a null prototype may not have `propertyIsEnumerable`
        Reflect.ownKeys(object).filter(function(key) {
          var _a2, _b;
          return (_b = (_a2 = object.propertyIsEnumerable) === null || _a2 === void 0 ? void 0 : _a2.call(object, key)) !== null && _b !== void 0 ? _b : true;
        })
      ) : [];
    };
    exports.enumerableKeysOf = enumerableKeysOf;
    function SUCCESS(value) {
      return { success: true, value };
    }
    exports.SUCCESS = SUCCESS;
    exports.FAILURE = Object.assign(function(code, message, details) {
      return __assign({ success: false, code, message }, details ? { details } : {});
    }, {
      TYPE_INCORRECT: function(self2, value) {
        var message = "Expected ".concat(self2.tag === "template" ? "string ".concat((0, show_1.default)(self2)) : (0, show_1.default)(self2), ", but was ").concat((0, exports.typeOf)(value));
        return (0, exports.FAILURE)(result_1.Failcode.TYPE_INCORRECT, message);
      },
      VALUE_INCORRECT: function(name, expected, received) {
        return (0, exports.FAILURE)(result_1.Failcode.VALUE_INCORRECT, "Expected ".concat(name, " ").concat(String(expected), ", but was ").concat(String(received)));
      },
      KEY_INCORRECT: function(self2, expected, value) {
        return (0, exports.FAILURE)(result_1.Failcode.KEY_INCORRECT, "Expected ".concat((0, show_1.default)(self2), " key to be ").concat((0, show_1.default)(expected), ", but was ").concat((0, exports.typeOf)(value)));
      },
      CONTENT_INCORRECT: function(self2, details) {
        var formattedDetails = JSON.stringify(details, null, 2).replace(/^ *null,\n/gm, "");
        var message = "Validation failed:\n".concat(formattedDetails, ".\nObject should match ").concat((0, show_1.default)(self2));
        return (0, exports.FAILURE)(result_1.Failcode.CONTENT_INCORRECT, message, details);
      },
      ARGUMENT_INCORRECT: function(message) {
        return (0, exports.FAILURE)(result_1.Failcode.ARGUMENT_INCORRECT, message);
      },
      RETURN_INCORRECT: function(message) {
        return (0, exports.FAILURE)(result_1.Failcode.RETURN_INCORRECT, message);
      },
      CONSTRAINT_FAILED: function(self2, message) {
        var info = message ? ": ".concat(message) : "";
        return (0, exports.FAILURE)(result_1.Failcode.CONSTRAINT_FAILED, "Failed constraint check for ".concat((0, show_1.default)(self2)).concat(info));
      },
      PROPERTY_MISSING: function(self2) {
        var message = "Expected ".concat((0, show_1.default)(self2), ", but was missing");
        return (0, exports.FAILURE)(result_1.Failcode.PROPERTY_MISSING, message);
      },
      PROPERTY_PRESENT: function(value) {
        var message = "Expected nothing, but was ".concat((0, exports.typeOf)(value));
        return (0, exports.FAILURE)(result_1.Failcode.PROPERTY_PRESENT, message);
      },
      NOTHING_EXPECTED: function(value) {
        var message = "Expected nothing, but was ".concat((0, exports.typeOf)(value));
        return (0, exports.FAILURE)(result_1.Failcode.NOTHING_EXPECTED, message);
      }
    });
  }
});

// node_modules/runtypes/lib/contract.js
var require_contract = __commonJS({
  "node_modules/runtypes/lib/contract.js"(exports) {
    "use strict";
    var __read = exports && exports.__read || function(o2, n2) {
      var m2 = typeof Symbol === "function" && o2[Symbol.iterator];
      if (!m2)
        return o2;
      var i2 = m2.call(o2), r2, ar = [], e;
      try {
        while ((n2 === void 0 || n2-- > 0) && !(r2 = i2.next()).done)
          ar.push(r2.value);
      } catch (error) {
        e = { error };
      } finally {
        try {
          if (r2 && !r2.done && (m2 = i2["return"]))
            m2.call(i2);
        } finally {
          if (e)
            throw e.error;
        }
      }
      return ar;
    };
    var __spreadArray2 = exports && exports.__spreadArray || function(to, from, pack) {
      if (pack || arguments.length === 2)
        for (var i2 = 0, l2 = from.length, ar; i2 < l2; i2++) {
          if (ar || !(i2 in from)) {
            if (!ar)
              ar = Array.prototype.slice.call(from, 0, i2);
            ar[i2] = from[i2];
          }
        }
      return to.concat(ar || Array.prototype.slice.call(from));
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.Contract = void 0;
    var errors_1 = require_errors();
    var util_1 = require_util();
    function Contract() {
      var runtypes = [];
      for (var _i = 0; _i < arguments.length; _i++) {
        runtypes[_i] = arguments[_i];
      }
      var lastIndex = runtypes.length - 1;
      var argRuntypes = runtypes.slice(0, lastIndex);
      var returnRuntype = runtypes[lastIndex];
      return {
        enforce: function(f3) {
          return function() {
            var args = [];
            for (var _i2 = 0; _i2 < arguments.length; _i2++) {
              args[_i2] = arguments[_i2];
            }
            if (args.length < argRuntypes.length) {
              var message = "Expected ".concat(argRuntypes.length, " arguments but only received ").concat(args.length);
              var failure = util_1.FAILURE.ARGUMENT_INCORRECT(message);
              throw new errors_1.ValidationError(failure);
            }
            for (var i2 = 0; i2 < argRuntypes.length; i2++)
              argRuntypes[i2].check(args[i2]);
            return returnRuntype.check(f3.apply(void 0, __spreadArray2([], __read(args), false)));
          };
        }
      };
    }
    exports.Contract = Contract;
  }
});

// node_modules/runtypes/lib/asynccontract.js
var require_asynccontract = __commonJS({
  "node_modules/runtypes/lib/asynccontract.js"(exports) {
    "use strict";
    var __read = exports && exports.__read || function(o2, n2) {
      var m2 = typeof Symbol === "function" && o2[Symbol.iterator];
      if (!m2)
        return o2;
      var i2 = m2.call(o2), r2, ar = [], e;
      try {
        while ((n2 === void 0 || n2-- > 0) && !(r2 = i2.next()).done)
          ar.push(r2.value);
      } catch (error) {
        e = { error };
      } finally {
        try {
          if (r2 && !r2.done && (m2 = i2["return"]))
            m2.call(i2);
        } finally {
          if (e)
            throw e.error;
        }
      }
      return ar;
    };
    var __spreadArray2 = exports && exports.__spreadArray || function(to, from, pack) {
      if (pack || arguments.length === 2)
        for (var i2 = 0, l2 = from.length, ar; i2 < l2; i2++) {
          if (ar || !(i2 in from)) {
            if (!ar)
              ar = Array.prototype.slice.call(from, 0, i2);
            ar[i2] = from[i2];
          }
        }
      return to.concat(ar || Array.prototype.slice.call(from));
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.AsyncContract = void 0;
    var errors_1 = require_errors();
    var util_1 = require_util();
    function AsyncContract() {
      var runtypes = [];
      for (var _i = 0; _i < arguments.length; _i++) {
        runtypes[_i] = arguments[_i];
      }
      var lastIndex = runtypes.length - 1;
      var argRuntypes = runtypes.slice(0, lastIndex);
      var returnRuntype = runtypes[lastIndex];
      return {
        enforce: function(f3) {
          return function() {
            var args = [];
            for (var _i2 = 0; _i2 < arguments.length; _i2++) {
              args[_i2] = arguments[_i2];
            }
            if (args.length < argRuntypes.length) {
              var message = "Expected ".concat(argRuntypes.length, " arguments but only received ").concat(args.length);
              var failure = util_1.FAILURE.ARGUMENT_INCORRECT(message);
              throw new errors_1.ValidationError(failure);
            }
            for (var i2 = 0; i2 < argRuntypes.length; i2++)
              argRuntypes[i2].check(args[i2]);
            var returnedPromise = f3.apply(void 0, __spreadArray2([], __read(args), false));
            if (!(returnedPromise instanceof Promise)) {
              var message = "Expected function to return a promise, but instead got ".concat(returnedPromise);
              var failure = util_1.FAILURE.RETURN_INCORRECT(message);
              throw new errors_1.ValidationError(failure);
            }
            return returnedPromise.then(returnRuntype.check);
          };
        }
      };
    }
    exports.AsyncContract = AsyncContract;
  }
});

// node_modules/runtypes/lib/match.js
var require_match = __commonJS({
  "node_modules/runtypes/lib/match.js"(exports) {
    "use strict";
    var __values = exports && exports.__values || function(o2) {
      var s2 = typeof Symbol === "function" && Symbol.iterator, m2 = s2 && o2[s2], i2 = 0;
      if (m2)
        return m2.call(o2);
      if (o2 && typeof o2.length === "number")
        return {
          next: function() {
            if (o2 && i2 >= o2.length)
              o2 = void 0;
            return { value: o2 && o2[i2++], done: !o2 };
          }
        };
      throw new TypeError(s2 ? "Object is not iterable." : "Symbol.iterator is not defined.");
    };
    var __read = exports && exports.__read || function(o2, n2) {
      var m2 = typeof Symbol === "function" && o2[Symbol.iterator];
      if (!m2)
        return o2;
      var i2 = m2.call(o2), r2, ar = [], e;
      try {
        while ((n2 === void 0 || n2-- > 0) && !(r2 = i2.next()).done)
          ar.push(r2.value);
      } catch (error) {
        e = { error };
      } finally {
        try {
          if (r2 && !r2.done && (m2 = i2["return"]))
            m2.call(i2);
        } finally {
          if (e)
            throw e.error;
        }
      }
      return ar;
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.when = exports.match = void 0;
    function match() {
      var cases = [];
      for (var _i = 0; _i < arguments.length; _i++) {
        cases[_i] = arguments[_i];
      }
      return function(x2) {
        var e_1, _a2;
        try {
          for (var cases_1 = __values(cases), cases_1_1 = cases_1.next(); !cases_1_1.done; cases_1_1 = cases_1.next()) {
            var _b = __read(cases_1_1.value, 2), T = _b[0], f3 = _b[1];
            if (T.guard(x2))
              return f3(x2);
          }
        } catch (e_1_1) {
          e_1 = { error: e_1_1 };
        } finally {
          try {
            if (cases_1_1 && !cases_1_1.done && (_a2 = cases_1.return))
              _a2.call(cases_1);
          } finally {
            if (e_1)
              throw e_1.error;
          }
        }
        throw new Error("No alternatives were matched");
      };
    }
    exports.match = match;
    function when(runtype, transformer) {
      return [runtype, transformer];
    }
    exports.when = when;
  }
});

// node_modules/runtypes/lib/runtype.js
var require_runtype = __commonJS({
  "node_modules/runtypes/lib/runtype.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.innerValidate = exports.create = exports.isRuntype = void 0;
    var index_1 = require_lib();
    var show_1 = require_show();
    var errors_1 = require_errors();
    var util_1 = require_util();
    var RuntypeSymbol = Symbol();
    var isRuntype = function(x2) {
      return (0, util_1.hasKey)(RuntypeSymbol, x2);
    };
    exports.isRuntype = isRuntype;
    function create(validate2, A2) {
      A2[RuntypeSymbol] = true;
      A2.check = check;
      A2.assert = check;
      A2._innerValidate = function(value, visited) {
        if (visited.has(value, A2))
          return (0, util_1.SUCCESS)(value);
        return validate2(value, visited);
      };
      A2.validate = function(value) {
        return A2._innerValidate(value, VisitedState());
      };
      A2.guard = guard;
      A2.Or = Or;
      A2.And = And;
      A2.optional = optional;
      A2.nullable = nullable;
      A2.withConstraint = withConstraint;
      A2.withGuard = withGuard;
      A2.withBrand = withBrand;
      A2.reflect = A2;
      A2.toString = function() {
        return "Runtype<".concat((0, show_1.default)(A2), ">");
      };
      return A2;
      function check(x2) {
        var result = A2.validate(x2);
        if (result.success)
          return result.value;
        else
          throw new errors_1.ValidationError(result);
      }
      function guard(x2) {
        return A2.validate(x2).success;
      }
      function Or(B2) {
        return (0, index_1.Union)(A2, B2);
      }
      function And(B2) {
        return (0, index_1.Intersect)(A2, B2);
      }
      function optional() {
        return (0, index_1.Optional)(A2);
      }
      function nullable() {
        return (0, index_1.Union)(A2, index_1.Null);
      }
      function withConstraint(constraint, options) {
        return (0, index_1.Constraint)(A2, constraint, options);
      }
      function withGuard(guard2, options) {
        return (0, index_1.Constraint)(A2, guard2, options);
      }
      function withBrand(B2) {
        return (0, index_1.Brand)(B2, A2);
      }
    }
    exports.create = create;
    function innerValidate(targetType, value, visited) {
      return targetType._innerValidate(value, visited);
    }
    exports.innerValidate = innerValidate;
    function VisitedState() {
      var members = /* @__PURE__ */ new WeakMap();
      var add = function(candidate, type) {
        if (candidate === null || !(typeof candidate === "object"))
          return;
        var typeSet = members.get(candidate);
        members.set(candidate, typeSet ? typeSet.set(type, true) : (/* @__PURE__ */ new WeakMap()).set(type, true));
      };
      var has = function(candidate, type) {
        var typeSet = members.get(candidate);
        var value = typeSet && typeSet.get(type) || false;
        add(candidate, type);
        return value;
      };
      return { has };
    }
  }
});

// node_modules/runtypes/lib/types/unknown.js
var require_unknown = __commonJS({
  "node_modules/runtypes/lib/types/unknown.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.Unknown = void 0;
    var runtype_1 = require_runtype();
    var util_1 = require_util();
    var self2 = { tag: "unknown" };
    exports.Unknown = (0, runtype_1.create)(function(value) {
      return (0, util_1.SUCCESS)(value);
    }, self2);
  }
});

// node_modules/runtypes/lib/types/never.js
var require_never = __commonJS({
  "node_modules/runtypes/lib/types/never.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.Never = void 0;
    var runtype_1 = require_runtype();
    var util_1 = require_util();
    var self2 = { tag: "never" };
    exports.Never = (0, runtype_1.create)(util_1.FAILURE.NOTHING_EXPECTED, self2);
  }
});

// node_modules/runtypes/lib/types/void.js
var require_void = __commonJS({
  "node_modules/runtypes/lib/types/void.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.Void = void 0;
    var unknown_1 = require_unknown();
    exports.Void = unknown_1.Unknown;
  }
});

// node_modules/runtypes/lib/types/union.js
var require_union = __commonJS({
  "node_modules/runtypes/lib/types/union.js"(exports) {
    "use strict";
    var __values = exports && exports.__values || function(o2) {
      var s2 = typeof Symbol === "function" && Symbol.iterator, m2 = s2 && o2[s2], i2 = 0;
      if (m2)
        return m2.call(o2);
      if (o2 && typeof o2.length === "number")
        return {
          next: function() {
            if (o2 && i2 >= o2.length)
              o2 = void 0;
            return { value: o2 && o2[i2++], done: !o2 };
          }
        };
      throw new TypeError(s2 ? "Object is not iterable." : "Symbol.iterator is not defined.");
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.Union = void 0;
    var runtype_1 = require_runtype();
    var util_1 = require_util();
    function Union2() {
      var alternatives = [];
      for (var _i = 0; _i < arguments.length; _i++) {
        alternatives[_i] = arguments[_i];
      }
      var match = function() {
        var cases = [];
        for (var _i2 = 0; _i2 < arguments.length; _i2++) {
          cases[_i2] = arguments[_i2];
        }
        return function(x2) {
          for (var i2 = 0; i2 < alternatives.length; i2++) {
            if (alternatives[i2].guard(x2)) {
              return cases[i2](x2);
            }
          }
        };
      };
      var self2 = { tag: "union", alternatives, match };
      return (0, runtype_1.create)(function(value, visited) {
        var e_1, _a2, e_2, _b, e_3, _c, e_4, _d;
        if (typeof value !== "object" || value === null) {
          try {
            for (var alternatives_1 = __values(alternatives), alternatives_1_1 = alternatives_1.next(); !alternatives_1_1.done; alternatives_1_1 = alternatives_1.next()) {
              var alternative = alternatives_1_1.value;
              if ((0, runtype_1.innerValidate)(alternative, value, visited).success)
                return (0, util_1.SUCCESS)(value);
            }
          } catch (e_1_1) {
            e_1 = { error: e_1_1 };
          } finally {
            try {
              if (alternatives_1_1 && !alternatives_1_1.done && (_a2 = alternatives_1.return))
                _a2.call(alternatives_1);
            } finally {
              if (e_1)
                throw e_1.error;
            }
          }
          return util_1.FAILURE.TYPE_INCORRECT(self2, value);
        }
        var commonLiteralFields = {};
        try {
          for (var alternatives_2 = __values(alternatives), alternatives_2_1 = alternatives_2.next(); !alternatives_2_1.done; alternatives_2_1 = alternatives_2.next()) {
            var alternative = alternatives_2_1.value;
            if (alternative.reflect.tag === "record") {
              var _loop_1 = function(fieldName2) {
                var field2 = alternative.reflect.fields[fieldName2];
                if (field2.tag === "literal") {
                  if (commonLiteralFields[fieldName2]) {
                    if (commonLiteralFields[fieldName2].every(function(value2) {
                      return value2 !== field2.value;
                    })) {
                      commonLiteralFields[fieldName2].push(field2.value);
                    }
                  } else {
                    commonLiteralFields[fieldName2] = [field2.value];
                  }
                }
              };
              for (var fieldName in alternative.reflect.fields) {
                _loop_1(fieldName);
              }
            }
          }
        } catch (e_2_1) {
          e_2 = { error: e_2_1 };
        } finally {
          try {
            if (alternatives_2_1 && !alternatives_2_1.done && (_b = alternatives_2.return))
              _b.call(alternatives_2);
          } finally {
            if (e_2)
              throw e_2.error;
          }
        }
        for (var fieldName in commonLiteralFields) {
          if (commonLiteralFields[fieldName].length === alternatives.length) {
            try {
              for (var alternatives_3 = (e_3 = void 0, __values(alternatives)), alternatives_3_1 = alternatives_3.next(); !alternatives_3_1.done; alternatives_3_1 = alternatives_3.next()) {
                var alternative = alternatives_3_1.value;
                if (alternative.reflect.tag === "record") {
                  var field = alternative.reflect.fields[fieldName];
                  if (field.tag === "literal" && (0, util_1.hasKey)(fieldName, value) && value[fieldName] === field.value) {
                    return (0, runtype_1.innerValidate)(alternative, value, visited);
                  }
                }
              }
            } catch (e_3_1) {
              e_3 = { error: e_3_1 };
            } finally {
              try {
                if (alternatives_3_1 && !alternatives_3_1.done && (_c = alternatives_3.return))
                  _c.call(alternatives_3);
              } finally {
                if (e_3)
                  throw e_3.error;
              }
            }
          }
        }
        try {
          for (var alternatives_4 = __values(alternatives), alternatives_4_1 = alternatives_4.next(); !alternatives_4_1.done; alternatives_4_1 = alternatives_4.next()) {
            var targetType = alternatives_4_1.value;
            if ((0, runtype_1.innerValidate)(targetType, value, visited).success)
              return (0, util_1.SUCCESS)(value);
          }
        } catch (e_4_1) {
          e_4 = { error: e_4_1 };
        } finally {
          try {
            if (alternatives_4_1 && !alternatives_4_1.done && (_d = alternatives_4.return))
              _d.call(alternatives_4);
          } finally {
            if (e_4)
              throw e_4.error;
          }
        }
        return util_1.FAILURE.TYPE_INCORRECT(self2, value);
      }, self2);
    }
    exports.Union = Union2;
  }
});

// node_modules/runtypes/lib/types/literal.js
var require_literal = __commonJS({
  "node_modules/runtypes/lib/types/literal.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.Nullish = exports.Null = exports.Undefined = exports.Literal = exports.literal = void 0;
    var runtype_1 = require_runtype();
    var util_1 = require_util();
    var union_1 = require_union();
    function literal(value) {
      return Array.isArray(value) ? String(value.map(String)) : typeof value === "bigint" ? String(value) + "n" : String(value);
    }
    exports.literal = literal;
    function Literal2(valueBase) {
      var self2 = { tag: "literal", value: valueBase };
      return (0, runtype_1.create)(function(value) {
        return value === valueBase ? (0, util_1.SUCCESS)(value) : util_1.FAILURE.VALUE_INCORRECT("literal", "`".concat(literal(valueBase), "`"), "`".concat(literal(value), "`"));
      }, self2);
    }
    exports.Literal = Literal2;
    exports.Undefined = Literal2(void 0);
    exports.Null = Literal2(null);
    exports.Nullish = (0, union_1.Union)(exports.Null, exports.Undefined);
  }
});

// node_modules/runtypes/lib/types/template.js
var require_template = __commonJS({
  "node_modules/runtypes/lib/types/template.js"(exports) {
    "use strict";
    var __read = exports && exports.__read || function(o2, n2) {
      var m2 = typeof Symbol === "function" && o2[Symbol.iterator];
      if (!m2)
        return o2;
      var i2 = m2.call(o2), r2, ar = [], e;
      try {
        while ((n2 === void 0 || n2-- > 0) && !(r2 = i2.next()).done)
          ar.push(r2.value);
      } catch (error) {
        e = { error };
      } finally {
        try {
          if (r2 && !r2.done && (m2 = i2["return"]))
            m2.call(i2);
        } finally {
          if (e)
            throw e.error;
        }
      }
      return ar;
    };
    var __spreadArray2 = exports && exports.__spreadArray || function(to, from, pack) {
      if (pack || arguments.length === 2)
        for (var i2 = 0, l2 = from.length, ar; i2 < l2; i2++) {
          if (ar || !(i2 in from)) {
            if (!ar)
              ar = Array.prototype.slice.call(from, 0, i2);
            ar[i2] = from[i2];
          }
        }
      return to.concat(ar || Array.prototype.slice.call(from));
    };
    var __values = exports && exports.__values || function(o2) {
      var s2 = typeof Symbol === "function" && Symbol.iterator, m2 = s2 && o2[s2], i2 = 0;
      if (m2)
        return m2.call(o2);
      if (o2 && typeof o2.length === "number")
        return {
          next: function() {
            if (o2 && i2 >= o2.length)
              o2 = void 0;
            return { value: o2 && o2[i2++], done: !o2 };
          }
        };
      throw new TypeError(s2 ? "Object is not iterable." : "Symbol.iterator is not defined.");
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.Template = void 0;
    var runtype_1 = require_runtype();
    var show_1 = require_show();
    var util_1 = require_util();
    var literal_1 = require_literal();
    var escapeRegExp = function(string) {
      return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
    };
    var parseArgs = function(args) {
      if (0 < args.length && Array.isArray(args[0])) {
        var _a2 = __read(args), strings = _a2[0], runtypes = _a2.slice(1);
        return [Array.from(strings), runtypes];
      } else {
        var convenient = args;
        var strings = convenient.reduce(function(strings2, arg) {
          if (!(0, runtype_1.isRuntype)(arg))
            strings2.push(strings2.pop() + String(arg));
          else
            strings2.push("");
          return strings2;
        }, [""]);
        var runtypes = convenient.filter(runtype_1.isRuntype);
        return [strings, runtypes];
      }
    };
    var flattenInnerRuntypes = function(strings, runtypes) {
      for (var i2 = 0; i2 < runtypes.length; ) {
        switch (runtypes[i2].reflect.tag) {
          case "literal": {
            var literal_2 = runtypes[i2];
            runtypes.splice(i2, 1);
            var string = String(literal_2.value);
            strings.splice(i2, 2, strings[i2] + string + strings[i2 + 1]);
            break;
          }
          case "template": {
            var template = runtypes[i2];
            runtypes.splice.apply(runtypes, __spreadArray2([i2, 1], __read(template.runtypes), false));
            var innerStrings = template.strings;
            if (innerStrings.length === 1) {
              strings.splice(i2, 2, strings[i2] + innerStrings[0] + strings[i2 + 1]);
            } else {
              var first = innerStrings[0];
              var rest = innerStrings.slice(1, -1);
              var last2 = innerStrings[innerStrings.length - 1];
              strings.splice.apply(strings, __spreadArray2(__spreadArray2([i2, 2, strings[i2] + first], __read(rest), false), [last2 + strings[i2 + 1]], false));
            }
            break;
          }
          case "union": {
            var union = runtypes[i2];
            if (union.alternatives.length === 1) {
              try {
                var literal_3 = getInnerLiteral(union);
                runtypes.splice(i2, 1);
                var string = String(literal_3.value);
                strings.splice(i2, 2, strings[i2] + string + strings[i2 + 1]);
                break;
              } catch (_7) {
                i2++;
                break;
              }
            } else {
              i2++;
              break;
            }
          }
          case "intersect": {
            var intersect = runtypes[i2];
            if (intersect.intersectees.length === 1) {
              try {
                var literal_4 = getInnerLiteral(intersect);
                runtypes.splice(i2, 1);
                var string = String(literal_4.value);
                strings.splice(i2, 2, strings[i2] + string + strings[i2 + 1]);
                break;
              } catch (_7) {
                i2++;
                break;
              }
            } else {
              i2++;
              break;
            }
          }
          default:
            i2++;
            break;
        }
      }
    };
    var normalizeArgs = function(args) {
      var _a2 = __read(parseArgs(args), 2), strings = _a2[0], runtypes = _a2[1];
      flattenInnerRuntypes(strings, runtypes);
      return [strings, runtypes];
    };
    var getInnerLiteral = function(runtype) {
      switch (runtype.reflect.tag) {
        case "literal":
          return runtype;
        case "brand":
          return getInnerLiteral(runtype.reflect.entity);
        case "union":
          if (runtype.reflect.alternatives.length === 1)
            return getInnerLiteral(runtype.reflect.alternatives[0]);
          break;
        case "intersect":
          if (runtype.reflect.intersectees.length === 1)
            return getInnerLiteral(runtype.reflect.intersectees[0]);
          break;
        default:
          break;
      }
      throw void 0;
    };
    var identity2 = function(s2) {
      return s2;
    };
    var revivers = {
      string: [function(s2) {
        return globalThis.String(s2);
      }, ".*"],
      number: [
        function(s2) {
          return globalThis.Number(s2);
        },
        "[+-]?(?:\\d*\\.\\d+|\\d+\\.\\d*|\\d+)(?:[Ee][+-]?\\d+)?",
        "0[Bb][01]+",
        "0[Oo][0-7]+",
        "0[Xx][0-9A-Fa-f]+"
        // Note: `"NaN"` isn't here, as TS doesn't allow `"NaN"` to be a `` `${number}` ``
      ],
      bigint: [function(s2) {
        return globalThis.BigInt(s2);
      }, "-?[1-9]d*"],
      boolean: [function(s2) {
        return s2 === "false" ? false : true;
      }, "true", "false"],
      null: [function() {
        return null;
      }, "null"],
      undefined: [function() {
        return void 0;
      }, "undefined"]
    };
    var getReviversFor = function(reflect) {
      switch (reflect.tag) {
        case "literal": {
          var _a2 = __read(revivers[(0, util_1.typeOf)(reflect.value)] || [identity2], 1), reviver_1 = _a2[0];
          return reviver_1;
        }
        case "brand":
          return getReviversFor(reflect.entity);
        case "constraint":
          return getReviversFor(reflect.underlying);
        case "union":
          return reflect.alternatives.map(getReviversFor);
        case "intersect":
          return reflect.intersectees.map(getReviversFor);
        default:
          var _b = __read(revivers[reflect.tag] || [identity2], 1), reviver = _b[0];
          return reviver;
      }
    };
    var reviveValidate = function(reflect, visited) {
      return function(value) {
        var e_1, _a2, e_2, _b;
        var revivers2 = getReviversFor(reflect);
        if (Array.isArray(revivers2)) {
          switch (reflect.tag) {
            case "union":
              try {
                for (var _c = __values(reflect.alternatives), _d = _c.next(); !_d.done; _d = _c.next()) {
                  var alternative = _d.value;
                  var validated = reviveValidate(alternative.reflect, visited)(value);
                  if (validated.success)
                    return validated;
                }
              } catch (e_1_1) {
                e_1 = { error: e_1_1 };
              } finally {
                try {
                  if (_d && !_d.done && (_a2 = _c.return))
                    _a2.call(_c);
                } finally {
                  if (e_1)
                    throw e_1.error;
                }
              }
              return util_1.FAILURE.TYPE_INCORRECT(reflect, value);
            case "intersect":
              try {
                for (var _e = __values(reflect.intersectees), _f = _e.next(); !_f.done; _f = _e.next()) {
                  var intersectee = _f.value;
                  var validated = reviveValidate(intersectee.reflect, visited)(value);
                  if (!validated.success)
                    return validated;
                }
              } catch (e_2_1) {
                e_2 = { error: e_2_1 };
              } finally {
                try {
                  if (_f && !_f.done && (_b = _e.return))
                    _b.call(_e);
                } finally {
                  if (e_2)
                    throw e_2.error;
                }
              }
              return (0, util_1.SUCCESS)(value);
            default:
              throw Error("impossible");
          }
        } else {
          var reviver = revivers2;
          var validated = (0, runtype_1.innerValidate)(reflect, reviver(value), visited);
          if (!validated.success && validated.code === "VALUE_INCORRECT" && reflect.tag === "literal")
            return util_1.FAILURE.VALUE_INCORRECT("literal", '"'.concat((0, literal_1.literal)(reflect.value), '"'), '"'.concat(value, '"'));
          return validated;
        }
      };
    };
    var getRegExpPatternFor = function(reflect) {
      switch (reflect.tag) {
        case "literal":
          return escapeRegExp(String(reflect.value));
        case "brand":
          return getRegExpPatternFor(reflect.entity);
        case "constraint":
          return getRegExpPatternFor(reflect.underlying);
        case "union":
          return reflect.alternatives.map(getRegExpPatternFor).join("|");
        case "template": {
          return reflect.strings.map(escapeRegExp).reduce(function(pattern, string, i2) {
            var prefix2 = pattern + string;
            var runtype = reflect.runtypes[i2];
            if (runtype)
              return prefix2 + "(?:".concat(getRegExpPatternFor(runtype.reflect), ")");
            else
              return prefix2;
          }, "");
        }
        default:
          var _a2 = __read(revivers[reflect.tag] || [void 0, ".*"]), patterns = _a2.slice(1);
          return patterns.join("|");
      }
    };
    var createRegExpForTemplate = function(reflect) {
      var pattern = reflect.strings.map(escapeRegExp).reduce(function(pattern2, string, i2) {
        var prefix2 = pattern2 + string;
        var runtype = reflect.runtypes[i2];
        if (runtype)
          return prefix2 + "(".concat(getRegExpPatternFor(runtype.reflect), ")");
        else
          return prefix2;
      }, "");
      return new RegExp("^".concat(pattern, "$"), "su");
    };
    function Template() {
      var args = [];
      for (var _i = 0; _i < arguments.length; _i++) {
        args[_i] = arguments[_i];
      }
      var _a2 = __read(normalizeArgs(args), 2), strings = _a2[0], runtypes = _a2[1];
      var self2 = { tag: "template", strings, runtypes };
      var regexp = createRegExpForTemplate(self2);
      var test = function(value, visited) {
        var matches = value.match(regexp);
        if (matches) {
          var values = matches.slice(1);
          for (var i2 = 0; i2 < runtypes.length; i2++) {
            var runtype = runtypes[i2];
            var value_1 = values[i2];
            var validated = reviveValidate(runtype.reflect, visited)(value_1);
            if (!validated.success)
              return validated;
          }
          return (0, util_1.SUCCESS)(value);
        } else {
          return util_1.FAILURE.VALUE_INCORRECT("string", "".concat((0, show_1.default)(self2)), '"'.concat((0, literal_1.literal)(value), '"'));
        }
      };
      return (0, runtype_1.create)(function(value, visited) {
        if (typeof value !== "string")
          return util_1.FAILURE.TYPE_INCORRECT(self2, value);
        else {
          var validated = test(value, visited);
          if (!validated.success) {
            var result = util_1.FAILURE.VALUE_INCORRECT("string", "".concat((0, show_1.default)(self2)), '"'.concat(value, '"'));
            if (result.message !== validated.message)
              result.message += " (inner: ".concat(validated.message, ")");
            return result;
          } else
            return (0, util_1.SUCCESS)(value);
        }
      }, self2);
    }
    exports.Template = Template;
  }
});

// node_modules/runtypes/lib/types/boolean.js
var require_boolean = __commonJS({
  "node_modules/runtypes/lib/types/boolean.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.Boolean = void 0;
    var runtype_1 = require_runtype();
    var util_1 = require_util();
    var self2 = { tag: "boolean" };
    exports.Boolean = (0, runtype_1.create)(function(value) {
      return typeof value === "boolean" ? (0, util_1.SUCCESS)(value) : util_1.FAILURE.TYPE_INCORRECT(self2, value);
    }, self2);
  }
});

// node_modules/runtypes/lib/types/number.js
var require_number = __commonJS({
  "node_modules/runtypes/lib/types/number.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.Number = void 0;
    var runtype_1 = require_runtype();
    var util_1 = require_util();
    var self2 = { tag: "number" };
    exports.Number = (0, runtype_1.create)(function(value) {
      return typeof value === "number" ? (0, util_1.SUCCESS)(value) : util_1.FAILURE.TYPE_INCORRECT(self2, value);
    }, self2);
  }
});

// node_modules/runtypes/lib/types/bigint.js
var require_bigint = __commonJS({
  "node_modules/runtypes/lib/types/bigint.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.BigInt = void 0;
    var runtype_1 = require_runtype();
    var util_1 = require_util();
    var self2 = { tag: "bigint" };
    exports.BigInt = (0, runtype_1.create)(function(value) {
      return typeof value === "bigint" ? (0, util_1.SUCCESS)(value) : util_1.FAILURE.TYPE_INCORRECT(self2, value);
    }, self2);
  }
});

// node_modules/runtypes/lib/types/string.js
var require_string = __commonJS({
  "node_modules/runtypes/lib/types/string.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.String = void 0;
    var runtype_1 = require_runtype();
    var util_1 = require_util();
    var self2 = { tag: "string" };
    exports.String = (0, runtype_1.create)(function(value) {
      return typeof value === "string" ? (0, util_1.SUCCESS)(value) : util_1.FAILURE.TYPE_INCORRECT(self2, value);
    }, self2);
  }
});

// node_modules/runtypes/lib/types/symbol.js
var require_symbol = __commonJS({
  "node_modules/runtypes/lib/types/symbol.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.Symbol = void 0;
    var runtype_1 = require_runtype();
    var util_1 = require_util();
    var f3 = function(key) {
      var self3 = { tag: "symbol", key };
      return (0, runtype_1.create)(function(value) {
        if (typeof value !== "symbol")
          return util_1.FAILURE.TYPE_INCORRECT(self3, value);
        else {
          var keyForValue = globalThis.Symbol.keyFor(value);
          if (keyForValue !== key)
            return util_1.FAILURE.VALUE_INCORRECT("symbol key", quoteIfPresent(key), quoteIfPresent(keyForValue));
          else
            return (0, util_1.SUCCESS)(value);
        }
      }, self3);
    };
    var self2 = { tag: "symbol" };
    exports.Symbol = (0, runtype_1.create)(function(value) {
      return typeof value === "symbol" ? (0, util_1.SUCCESS)(value) : util_1.FAILURE.TYPE_INCORRECT(self2, value);
    }, Object.assign(f3, self2));
    var quoteIfPresent = function(key) {
      return key === void 0 ? "undefined" : '"'.concat(key, '"');
    };
  }
});

// node_modules/runtypes/lib/types/array.js
var require_array = __commonJS({
  "node_modules/runtypes/lib/types/array.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.Array = void 0;
    var runtype_1 = require_runtype();
    var util_1 = require_util();
    function InternalArr(element, isReadonly) {
      var self2 = { tag: "array", isReadonly, element };
      return withExtraModifierFuncs((0, runtype_1.create)(function(xs, visited) {
        if (!Array.isArray(xs))
          return util_1.FAILURE.TYPE_INCORRECT(self2, xs);
        var keys = (0, util_1.enumerableKeysOf)(xs);
        var results = keys.map(function(key) {
          return (0, runtype_1.innerValidate)(element, xs[key], visited);
        });
        var details = keys.reduce(function(details2, key) {
          var result = results[key];
          if (!result.success)
            details2[key] = result.details || result.message;
          return details2;
        }, []);
        if ((0, util_1.enumerableKeysOf)(details).length !== 0)
          return util_1.FAILURE.CONTENT_INCORRECT(self2, details);
        else
          return (0, util_1.SUCCESS)(xs);
      }, self2));
    }
    function Arr(element) {
      return InternalArr(element, false);
    }
    exports.Array = Arr;
    function withExtraModifierFuncs(A2) {
      A2.asReadonly = asReadonly;
      return A2;
      function asReadonly() {
        return InternalArr(A2.element, true);
      }
    }
  }
});

// node_modules/runtypes/lib/types/tuple.js
var require_tuple = __commonJS({
  "node_modules/runtypes/lib/types/tuple.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.Tuple = void 0;
    var runtype_1 = require_runtype();
    var util_1 = require_util();
    function Tuple() {
      var components = [];
      for (var _i = 0; _i < arguments.length; _i++) {
        components[_i] = arguments[_i];
      }
      var self2 = { tag: "tuple", components };
      return (0, runtype_1.create)(function(xs, visited) {
        if (!Array.isArray(xs))
          return util_1.FAILURE.TYPE_INCORRECT(self2, xs);
        if (xs.length !== components.length)
          return util_1.FAILURE.CONSTRAINT_FAILED(self2, "Expected length ".concat(components.length, ", but was ").concat(xs.length));
        var keys = (0, util_1.enumerableKeysOf)(xs);
        var results = keys.map(function(key) {
          return (0, runtype_1.innerValidate)(components[key], xs[key], visited);
        });
        var details = keys.reduce(function(details2, key) {
          var result = results[key];
          if (!result.success)
            details2[key] = result.details || result.message;
          return details2;
        }, []);
        if ((0, util_1.enumerableKeysOf)(details).length !== 0)
          return util_1.FAILURE.CONTENT_INCORRECT(self2, details);
        else
          return (0, util_1.SUCCESS)(xs);
      }, self2);
    }
    exports.Tuple = Tuple;
  }
});

// node_modules/runtypes/lib/types/record.js
var require_record = __commonJS({
  "node_modules/runtypes/lib/types/record.js"(exports) {
    "use strict";
    var __read = exports && exports.__read || function(o2, n2) {
      var m2 = typeof Symbol === "function" && o2[Symbol.iterator];
      if (!m2)
        return o2;
      var i2 = m2.call(o2), r2, ar = [], e;
      try {
        while ((n2 === void 0 || n2-- > 0) && !(r2 = i2.next()).done)
          ar.push(r2.value);
      } catch (error) {
        e = { error };
      } finally {
        try {
          if (r2 && !r2.done && (m2 = i2["return"]))
            m2.call(i2);
        } finally {
          if (e)
            throw e.error;
        }
      }
      return ar;
    };
    var __spreadArray2 = exports && exports.__spreadArray || function(to, from, pack) {
      if (pack || arguments.length === 2)
        for (var i2 = 0, l2 = from.length, ar; i2 < l2; i2++) {
          if (ar || !(i2 in from)) {
            if (!ar)
              ar = Array.prototype.slice.call(from, 0, i2);
            ar[i2] = from[i2];
          }
        }
      return to.concat(ar || Array.prototype.slice.call(from));
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.Partial = exports.Record = exports.InternalRecord = void 0;
    var runtype_1 = require_runtype();
    var util_1 = require_util();
    function InternalRecord(fields, isPartial, isReadonly) {
      var self2 = { tag: "record", isPartial, isReadonly, fields };
      return withExtraModifierFuncs((0, runtype_1.create)(function(x2, visited) {
        if (x2 === null || x2 === void 0) {
          return util_1.FAILURE.TYPE_INCORRECT(self2, x2);
        }
        var keysOfFields = (0, util_1.enumerableKeysOf)(fields);
        if (keysOfFields.length !== 0 && typeof x2 !== "object")
          return util_1.FAILURE.TYPE_INCORRECT(self2, x2);
        var keys = __spreadArray2([], __read(new Set(__spreadArray2(__spreadArray2([], __read(keysOfFields), false), __read((0, util_1.enumerableKeysOf)(x2)), false))), false);
        var results = keys.reduce(function(results2, key) {
          var fieldsHasKey = (0, util_1.hasKey)(key, fields);
          var xHasKey = (0, util_1.hasKey)(key, x2);
          if (fieldsHasKey) {
            var runtype = fields[key];
            var isOptional = isPartial || runtype.reflect.tag === "optional";
            if (xHasKey) {
              var value = x2[key];
              if (isOptional && value === void 0)
                results2[key] = (0, util_1.SUCCESS)(value);
              else
                results2[key] = (0, runtype_1.innerValidate)(runtype, value, visited);
            } else {
              if (!isOptional)
                results2[key] = util_1.FAILURE.PROPERTY_MISSING(runtype.reflect);
              else
                results2[key] = (0, util_1.SUCCESS)(void 0);
            }
          } else if (xHasKey) {
            var value = x2[key];
            results2[key] = (0, util_1.SUCCESS)(value);
          } else {
            throw new Error("impossible");
          }
          return results2;
        }, {});
        var details = keys.reduce(function(details2, key) {
          var result = results[key];
          if (!result.success)
            details2[key] = result.details || result.message;
          return details2;
        }, {});
        if ((0, util_1.enumerableKeysOf)(details).length !== 0)
          return util_1.FAILURE.CONTENT_INCORRECT(self2, details);
        else
          return (0, util_1.SUCCESS)(x2);
      }, self2));
    }
    exports.InternalRecord = InternalRecord;
    function Record2(fields) {
      return InternalRecord(fields, false, false);
    }
    exports.Record = Record2;
    function Partial(fields) {
      return InternalRecord(fields, true, false);
    }
    exports.Partial = Partial;
    function withExtraModifierFuncs(A2) {
      A2.asPartial = asPartial;
      A2.asReadonly = asReadonly;
      A2.pick = pick;
      A2.omit = omit2;
      A2.extend = extend;
      return A2;
      function asPartial() {
        return InternalRecord(A2.fields, true, A2.isReadonly);
      }
      function asReadonly() {
        return InternalRecord(A2.fields, A2.isPartial, true);
      }
      function pick() {
        var keys = [];
        for (var _i = 0; _i < arguments.length; _i++) {
          keys[_i] = arguments[_i];
        }
        var result = {};
        keys.forEach(function(key) {
          result[key] = A2.fields[key];
        });
        return InternalRecord(result, A2.isPartial, A2.isReadonly);
      }
      function omit2() {
        var keys = [];
        for (var _i = 0; _i < arguments.length; _i++) {
          keys[_i] = arguments[_i];
        }
        var result = {};
        var existingKeys = (0, util_1.enumerableKeysOf)(A2.fields);
        existingKeys.forEach(function(key) {
          if (!keys.includes(key))
            result[key] = A2.fields[key];
        });
        return InternalRecord(result, A2.isPartial, A2.isReadonly);
      }
      function extend(fields) {
        return InternalRecord(Object.assign({}, A2.fields, fields), A2.isPartial, A2.isReadonly);
      }
    }
  }
});

// node_modules/runtypes/lib/types/constraint.js
var require_constraint = __commonJS({
  "node_modules/runtypes/lib/types/constraint.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.Guard = exports.Constraint = void 0;
    var runtype_1 = require_runtype();
    var util_1 = require_util();
    var unknown_1 = require_unknown();
    function Constraint(underlying, constraint, options) {
      var name = options && options.name;
      var args = options && options.args;
      var self2 = {
        tag: "constraint",
        underlying,
        constraint,
        name,
        args
      };
      return (0, runtype_1.create)(function(value) {
        var result = underlying.validate(value);
        if (!result.success)
          return result;
        var message = constraint(result.value);
        if (typeof message === "string")
          return util_1.FAILURE.CONSTRAINT_FAILED(self2, message);
        else if (!message)
          return util_1.FAILURE.CONSTRAINT_FAILED(self2);
        return (0, util_1.SUCCESS)(result.value);
      }, self2);
    }
    exports.Constraint = Constraint;
    var Guard = function(guard, options) {
      return unknown_1.Unknown.withGuard(guard, options);
    };
    exports.Guard = Guard;
  }
});

// node_modules/runtypes/lib/types/dictionary.js
var require_dictionary = __commonJS({
  "node_modules/runtypes/lib/types/dictionary.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.Dictionary = void 0;
    var runtype_1 = require_runtype();
    var string_1 = require_string();
    var constraint_1 = require_constraint();
    var show_1 = require_show();
    var util_1 = require_util();
    var NumberKey = (0, constraint_1.Constraint)(string_1.String, function(s2) {
      return !isNaN(+s2);
    }, { name: "number" });
    function Dictionary(value, key) {
      var keyRuntype = key === void 0 ? string_1.String : key === "string" ? string_1.String : key === "number" ? NumberKey : key;
      var keyString = (0, show_1.default)(keyRuntype);
      var self2 = { tag: "dictionary", key: keyString, value };
      return (0, runtype_1.create)(function(x2, visited) {
        if (x2 === null || x2 === void 0 || typeof x2 !== "object")
          return util_1.FAILURE.TYPE_INCORRECT(self2, x2);
        if (Object.getPrototypeOf(x2) !== Object.prototype) {
          if (!Array.isArray(x2) || keyString === "string")
            return util_1.FAILURE.TYPE_INCORRECT(self2, x2);
        }
        var numberString = /^(?:NaN|-?\d+(?:\.\d+)?)$/;
        var keys = (0, util_1.enumerableKeysOf)(x2);
        var results = keys.reduce(function(results2, key2) {
          var isNumberLikeKey = typeof key2 === "string" && numberString.test(key2);
          var keyInterop = isNumberLikeKey ? globalThis.Number(key2) : key2;
          if (isNumberLikeKey ? !keyRuntype.guard(keyInterop) && !keyRuntype.guard(key2) : !keyRuntype.guard(keyInterop)) {
            results2[key2] = util_1.FAILURE.KEY_INCORRECT(self2, keyRuntype.reflect, keyInterop);
          } else
            results2[key2] = (0, runtype_1.innerValidate)(value, x2[key2], visited);
          return results2;
        }, {});
        var details = keys.reduce(function(details2, key2) {
          var result = results[key2];
          if (!result.success)
            details2[key2] = result.details || result.message;
          return details2;
        }, {});
        if ((0, util_1.enumerableKeysOf)(details).length !== 0)
          return util_1.FAILURE.CONTENT_INCORRECT(self2, details);
        else
          return (0, util_1.SUCCESS)(x2);
      }, self2);
    }
    exports.Dictionary = Dictionary;
  }
});

// node_modules/runtypes/lib/types/intersect.js
var require_intersect = __commonJS({
  "node_modules/runtypes/lib/types/intersect.js"(exports) {
    "use strict";
    var __values = exports && exports.__values || function(o2) {
      var s2 = typeof Symbol === "function" && Symbol.iterator, m2 = s2 && o2[s2], i2 = 0;
      if (m2)
        return m2.call(o2);
      if (o2 && typeof o2.length === "number")
        return {
          next: function() {
            if (o2 && i2 >= o2.length)
              o2 = void 0;
            return { value: o2 && o2[i2++], done: !o2 };
          }
        };
      throw new TypeError(s2 ? "Object is not iterable." : "Symbol.iterator is not defined.");
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.Intersect = void 0;
    var runtype_1 = require_runtype();
    var util_1 = require_util();
    function Intersect() {
      var intersectees = [];
      for (var _i = 0; _i < arguments.length; _i++) {
        intersectees[_i] = arguments[_i];
      }
      var self2 = { tag: "intersect", intersectees };
      return (0, runtype_1.create)(function(value, visited) {
        var e_1, _a2;
        try {
          for (var intersectees_1 = __values(intersectees), intersectees_1_1 = intersectees_1.next(); !intersectees_1_1.done; intersectees_1_1 = intersectees_1.next()) {
            var targetType = intersectees_1_1.value;
            var result = (0, runtype_1.innerValidate)(targetType, value, visited);
            if (!result.success)
              return result;
          }
        } catch (e_1_1) {
          e_1 = { error: e_1_1 };
        } finally {
          try {
            if (intersectees_1_1 && !intersectees_1_1.done && (_a2 = intersectees_1.return))
              _a2.call(intersectees_1);
          } finally {
            if (e_1)
              throw e_1.error;
          }
        }
        return (0, util_1.SUCCESS)(value);
      }, self2);
    }
    exports.Intersect = Intersect;
  }
});

// node_modules/runtypes/lib/types/optional.js
var require_optional = __commonJS({
  "node_modules/runtypes/lib/types/optional.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.Optional = void 0;
    var runtype_1 = require_runtype();
    var util_1 = require_util();
    function Optional(runtype) {
      var self2 = { tag: "optional", underlying: runtype };
      return (0, runtype_1.create)(function(value) {
        return value === void 0 ? (0, util_1.SUCCESS)(value) : runtype.validate(value);
      }, self2);
    }
    exports.Optional = Optional;
  }
});

// node_modules/runtypes/lib/types/function.js
var require_function = __commonJS({
  "node_modules/runtypes/lib/types/function.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.Function = void 0;
    var runtype_1 = require_runtype();
    var util_1 = require_util();
    var self2 = { tag: "function" };
    exports.Function = (0, runtype_1.create)(function(value) {
      return typeof value === "function" ? (0, util_1.SUCCESS)(value) : util_1.FAILURE.TYPE_INCORRECT(self2, value);
    }, self2);
  }
});

// node_modules/runtypes/lib/types/instanceof.js
var require_instanceof = __commonJS({
  "node_modules/runtypes/lib/types/instanceof.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.InstanceOf = void 0;
    var runtype_1 = require_runtype();
    var util_1 = require_util();
    function InstanceOf(ctor) {
      var self2 = { tag: "instanceof", ctor };
      return (0, runtype_1.create)(function(value) {
        return value instanceof ctor ? (0, util_1.SUCCESS)(value) : util_1.FAILURE.TYPE_INCORRECT(self2, value);
      }, self2);
    }
    exports.InstanceOf = InstanceOf;
  }
});

// node_modules/runtypes/lib/types/lazy.js
var require_lazy = __commonJS({
  "node_modules/runtypes/lib/types/lazy.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.Lazy = void 0;
    var runtype_1 = require_runtype();
    function Lazy(delayed) {
      var data = {
        get tag() {
          return getWrapped()["tag"];
        }
      };
      var cached;
      function getWrapped() {
        if (!cached) {
          cached = delayed();
          for (var k2 in cached)
            if (k2 !== "tag")
              data[k2] = cached[k2];
        }
        return cached;
      }
      return (0, runtype_1.create)(function(x2) {
        return getWrapped().validate(x2);
      }, data);
    }
    exports.Lazy = Lazy;
  }
});

// node_modules/runtypes/lib/types/brand.js
var require_brand = __commonJS({
  "node_modules/runtypes/lib/types/brand.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.Brand = void 0;
    var runtype_1 = require_runtype();
    function Brand(brand, entity) {
      var self2 = { tag: "brand", brand, entity };
      return (0, runtype_1.create)(function(value) {
        return entity.validate(value);
      }, self2);
    }
    exports.Brand = Brand;
  }
});

// node_modules/runtypes/lib/decorator.js
var require_decorator = __commonJS({
  "node_modules/runtypes/lib/decorator.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.checked = exports.check = void 0;
    var errors_1 = require_errors();
    var util_1 = require_util();
    var prototypes = /* @__PURE__ */ new WeakMap();
    function check(target, propertyKey, parameterIndex) {
      var prototype = prototypes.get(target) || /* @__PURE__ */ new Map();
      prototypes.set(target, prototype);
      var validParameterIndices = prototype.get(propertyKey) || [];
      prototype.set(propertyKey, validParameterIndices);
      validParameterIndices.push(parameterIndex);
    }
    exports.check = check;
    function getValidParameterIndices(target, propertyKey, runtypeCount) {
      var prototype = prototypes.get(target);
      var validParameterIndices = prototype && prototype.get(propertyKey);
      if (validParameterIndices) {
        return validParameterIndices;
      }
      var indices = [];
      for (var i2 = 0; i2 < runtypeCount; i2++) {
        indices.push(i2);
      }
      return indices;
    }
    function checked() {
      var runtypes = [];
      for (var _i = 0; _i < arguments.length; _i++) {
        runtypes[_i] = arguments[_i];
      }
      if (runtypes.length === 0) {
        throw new Error("No runtype provided to `@checked`. Please remove the decorator.");
      }
      return function(target, propertyKey, descriptor) {
        var method = descriptor.value;
        var methodId = (target.name || target.constructor.name + ".prototype") + (typeof propertyKey === "string" ? '["'.concat(propertyKey, '"]') : "[".concat(String(propertyKey), "]"));
        var validParameterIndices = getValidParameterIndices(target, propertyKey, runtypes.length);
        if (validParameterIndices.length !== runtypes.length) {
          throw new Error("Number of `@checked` runtypes and @check parameters not matched.");
        }
        if (validParameterIndices.length > method.length) {
          throw new Error("Number of `@checked` runtypes exceeds actual parameter length.");
        }
        descriptor.value = function() {
          var args = [];
          for (var _i2 = 0; _i2 < arguments.length; _i2++) {
            args[_i2] = arguments[_i2];
          }
          runtypes.forEach(function(type, typeIndex) {
            var parameterIndex = validParameterIndices[typeIndex];
            var result = type.validate(args[parameterIndex]);
            if (!result.success) {
              var message = "".concat(methodId, ", argument #").concat(parameterIndex, ": ").concat(result.message);
              var failure = util_1.FAILURE.ARGUMENT_INCORRECT(message);
              throw new errors_1.ValidationError(failure);
            }
          });
          return method.apply(this, args);
        };
      };
    }
    exports.checked = checked;
  }
});

// node_modules/runtypes/lib/index.js
var require_lib = __commonJS({
  "node_modules/runtypes/lib/index.js"(exports) {
    "use strict";
    var __createBinding = exports && exports.__createBinding || (Object.create ? function(o2, m2, k2, k22) {
      if (k22 === void 0)
        k22 = k2;
      Object.defineProperty(o2, k22, { enumerable: true, get: function() {
        return m2[k2];
      } });
    } : function(o2, m2, k2, k22) {
      if (k22 === void 0)
        k22 = k2;
      o2[k22] = m2[k2];
    });
    var __exportStar = exports && exports.__exportStar || function(m2, exports2) {
      for (var p2 in m2)
        if (p2 !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p2))
          __createBinding(exports2, m2, p2);
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.InstanceOf = exports.Nullish = exports.Null = exports.Undefined = exports.Literal = void 0;
    __exportStar(require_reflect(), exports);
    __exportStar(require_result(), exports);
    __exportStar(require_contract(), exports);
    __exportStar(require_asynccontract(), exports);
    __exportStar(require_match(), exports);
    __exportStar(require_errors(), exports);
    __exportStar(require_unknown(), exports);
    __exportStar(require_never(), exports);
    __exportStar(require_void(), exports);
    var literal_1 = require_literal();
    Object.defineProperty(exports, "Literal", { enumerable: true, get: function() {
      return literal_1.Literal;
    } });
    Object.defineProperty(exports, "Undefined", { enumerable: true, get: function() {
      return literal_1.Undefined;
    } });
    Object.defineProperty(exports, "Null", { enumerable: true, get: function() {
      return literal_1.Null;
    } });
    Object.defineProperty(exports, "Nullish", { enumerable: true, get: function() {
      return literal_1.Nullish;
    } });
    __exportStar(require_template(), exports);
    __exportStar(require_boolean(), exports);
    __exportStar(require_number(), exports);
    __exportStar(require_bigint(), exports);
    __exportStar(require_string(), exports);
    __exportStar(require_symbol(), exports);
    __exportStar(require_array(), exports);
    __exportStar(require_tuple(), exports);
    __exportStar(require_record(), exports);
    __exportStar(require_dictionary(), exports);
    __exportStar(require_union(), exports);
    __exportStar(require_intersect(), exports);
    __exportStar(require_optional(), exports);
    __exportStar(require_function(), exports);
    var instanceof_1 = require_instanceof();
    Object.defineProperty(exports, "InstanceOf", { enumerable: true, get: function() {
      return instanceof_1.InstanceOf;
    } });
    __exportStar(require_lazy(), exports);
    __exportStar(require_constraint(), exports);
    __exportStar(require_brand(), exports);
    __exportStar(require_decorator(), exports);
  }
});

// node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js
var require_use_sync_external_store_shim_development = __commonJS({
  "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) {
    "use strict";
    if (true) {
      (function() {
        "use strict";
        if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
          __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
        }
        var React66 = require_react();
        var ReactSharedInternals = React66.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
        function error(format) {
          {
            {
              for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
                args[_key2 - 1] = arguments[_key2];
              }
              printWarning("error", format, args);
            }
          }
        }
        function printWarning(level, format, args) {
          {
            var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
            var stack = ReactDebugCurrentFrame.getStackAddendum();
            if (stack !== "") {
              format += "%s";
              args = args.concat([stack]);
            }
            var argsWithFormat = args.map(function(item) {
              return String(item);
            });
            argsWithFormat.unshift("Warning: " + format);
            Function.prototype.apply.call(console[level], console, argsWithFormat);
          }
        }
        function is(x2, y2) {
          return x2 === y2 && (x2 !== 0 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2;
        }
        var objectIs = typeof Object.is === "function" ? Object.is : is;
        var useState = React66.useState, useEffect2 = React66.useEffect, useLayoutEffect2 = React66.useLayoutEffect, useDebugValue2 = React66.useDebugValue;
        var didWarnOld18Alpha = false;
        var didWarnUncachedGetSnapshot = false;
        function useSyncExternalStore3(subscribe2, getSnapshot, getServerSnapshot) {
          {
            if (!didWarnOld18Alpha) {
              if (React66.startTransition !== void 0) {
                didWarnOld18Alpha = true;
                error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release.");
              }
            }
          }
          var value = getSnapshot();
          {
            if (!didWarnUncachedGetSnapshot) {
              var cachedValue = getSnapshot();
              if (!objectIs(value, cachedValue)) {
                error("The result of getSnapshot should be cached to avoid an infinite loop");
                didWarnUncachedGetSnapshot = true;
              }
            }
          }
          var _useState = useState({
            inst: {
              value,
              getSnapshot
            }
          }), inst = _useState[0].inst, forceUpdate = _useState[1];
          useLayoutEffect2(function() {
            inst.value = value;
            inst.getSnapshot = getSnapshot;
            if (checkIfSnapshotChanged(inst)) {
              forceUpdate({
                inst
              });
            }
          }, [subscribe2, value, getSnapshot]);
          useEffect2(function() {
            if (checkIfSnapshotChanged(inst)) {
              forceUpdate({
                inst
              });
            }
            var handleStoreChange = function() {
              if (checkIfSnapshotChanged(inst)) {
                forceUpdate({
                  inst
                });
              }
            };
            return subscribe2(handleStoreChange);
          }, [subscribe2]);
          useDebugValue2(value);
          return value;
        }
        function checkIfSnapshotChanged(inst) {
          var latestGetSnapshot = inst.getSnapshot;
          var prevValue = inst.value;
          try {
            var nextValue = latestGetSnapshot();
            return !objectIs(prevValue, nextValue);
          } catch (error2) {
            return true;
          }
        }
        function useSyncExternalStore$1(subscribe2, getSnapshot, getServerSnapshot) {
          return getSnapshot();
        }
        var canUseDOM2 = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
        var isServerEnvironment = !canUseDOM2;
        var shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore3;
        var useSyncExternalStore$2 = React66.useSyncExternalStore !== void 0 ? React66.useSyncExternalStore : shim;
        exports.useSyncExternalStore = useSyncExternalStore$2;
        if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
          __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
        }
      })();
    }
  }
});

// node_modules/use-sync-external-store/shim/index.js
var require_shim = __commonJS({
  "node_modules/use-sync-external-store/shim/index.js"(exports, module2) {
    "use strict";
    if (false) {
      module2.exports = null;
    } else {
      module2.exports = require_use_sync_external_store_shim_development();
    }
  }
});

// node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js
var require_with_selector_development = __commonJS({
  "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"(exports) {
    "use strict";
    if (true) {
      (function() {
        "use strict";
        if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
          __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
        }
        var React66 = require_react();
        var shim = require_shim();
        function is(x2, y2) {
          return x2 === y2 && (x2 !== 0 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2;
        }
        var objectIs = typeof Object.is === "function" ? Object.is : is;
        var useSyncExternalStore3 = shim.useSyncExternalStore;
        var useRef4 = React66.useRef, useEffect2 = React66.useEffect, useMemo3 = React66.useMemo, useDebugValue2 = React66.useDebugValue;
        function useSyncExternalStoreWithSelector3(subscribe2, getSnapshot, getServerSnapshot, selector, isEqual) {
          var instRef = useRef4(null);
          var inst;
          if (instRef.current === null) {
            inst = {
              hasValue: false,
              value: null
            };
            instRef.current = inst;
          } else {
            inst = instRef.current;
          }
          var _useMemo = useMemo3(function() {
            var hasMemo = false;
            var memoizedSnapshot;
            var memoizedSelection;
            var memoizedSelector = function(nextSnapshot) {
              if (!hasMemo) {
                hasMemo = true;
                memoizedSnapshot = nextSnapshot;
                var _nextSelection = selector(nextSnapshot);
                if (isEqual !== void 0) {
                  if (inst.hasValue) {
                    var currentSelection = inst.value;
                    if (isEqual(currentSelection, _nextSelection)) {
                      memoizedSelection = currentSelection;
                      return currentSelection;
                    }
                  }
                }
                memoizedSelection = _nextSelection;
                return _nextSelection;
              }
              var prevSnapshot = memoizedSnapshot;
              var prevSelection = memoizedSelection;
              if (objectIs(prevSnapshot, nextSnapshot)) {
                return prevSelection;
              }
              var nextSelection = selector(nextSnapshot);
              if (isEqual !== void 0 && isEqual(prevSelection, nextSelection)) {
                return prevSelection;
              }
              memoizedSnapshot = nextSnapshot;
              memoizedSelection = nextSelection;
              return nextSelection;
            };
            var maybeGetServerSnapshot = getServerSnapshot === void 0 ? null : getServerSnapshot;
            var getSnapshotWithSelector = function() {
              return memoizedSelector(getSnapshot());
            };
            var getServerSnapshotWithSelector = maybeGetServerSnapshot === null ? void 0 : function() {
              return memoizedSelector(maybeGetServerSnapshot());
            };
            return [getSnapshotWithSelector, getServerSnapshotWithSelector];
          }, [getSnapshot, getServerSnapshot, selector, isEqual]), getSelection = _useMemo[0], getServerSelection = _useMemo[1];
          var value = useSyncExternalStore3(subscribe2, getSelection, getServerSelection);
          useEffect2(function() {
            inst.hasValue = true;
            inst.value = value;
          }, [value]);
          useDebugValue2(value);
          return value;
        }
        exports.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector3;
        if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
          __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
        }
      })();
    }
  }
});

// node_modules/use-sync-external-store/shim/with-selector.js
var require_with_selector = __commonJS({
  "node_modules/use-sync-external-store/shim/with-selector.js"(exports, module2) {
    "use strict";
    if (false) {
      module2.exports = null;
    } else {
      module2.exports = require_with_selector_development();
    }
  }
});

// node_modules/hoist-non-react-statics/node_modules/react-is/cjs/react-is.development.js
var require_react_is_development = __commonJS({
  "node_modules/hoist-non-react-statics/node_modules/react-is/cjs/react-is.development.js"(exports) {
    "use strict";
    if (true) {
      (function() {
        "use strict";
        var hasSymbol = typeof Symbol === "function" && Symbol.for;
        var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 60103;
        var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 60106;
        var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 60107;
        var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for("react.strict_mode") : 60108;
        var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for("react.profiler") : 60114;
        var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for("react.provider") : 60109;
        var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for("react.context") : 60110;
        var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for("react.async_mode") : 60111;
        var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for("react.concurrent_mode") : 60111;
        var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for("react.forward_ref") : 60112;
        var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for("react.suspense") : 60113;
        var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for("react.suspense_list") : 60120;
        var REACT_MEMO_TYPE = hasSymbol ? Symbol.for("react.memo") : 60115;
        var REACT_LAZY_TYPE = hasSymbol ? Symbol.for("react.lazy") : 60116;
        var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for("react.block") : 60121;
        var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for("react.fundamental") : 60117;
        var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for("react.responder") : 60118;
        var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for("react.scope") : 60119;
        function isValidElementType2(type) {
          return typeof type === "string" || typeof type === "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
          type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === "object" && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
        }
        function typeOf(object) {
          if (typeof object === "object" && object !== null) {
            var $$typeof = object.$$typeof;
            switch ($$typeof) {
              case REACT_ELEMENT_TYPE:
                var type = object.type;
                switch (type) {
                  case REACT_ASYNC_MODE_TYPE:
                  case REACT_CONCURRENT_MODE_TYPE:
                  case REACT_FRAGMENT_TYPE:
                  case REACT_PROFILER_TYPE:
                  case REACT_STRICT_MODE_TYPE:
                  case REACT_SUSPENSE_TYPE:
                    return type;
                  default:
                    var $$typeofType = type && type.$$typeof;
                    switch ($$typeofType) {
                      case REACT_CONTEXT_TYPE:
                      case REACT_FORWARD_REF_TYPE:
                      case REACT_LAZY_TYPE:
                      case REACT_MEMO_TYPE:
                      case REACT_PROVIDER_TYPE:
                        return $$typeofType;
                      default:
                        return $$typeof;
                    }
                }
              case REACT_PORTAL_TYPE:
                return $$typeof;
            }
          }
          return void 0;
        }
        var AsyncMode = REACT_ASYNC_MODE_TYPE;
        var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
        var ContextConsumer = REACT_CONTEXT_TYPE;
        var ContextProvider = REACT_PROVIDER_TYPE;
        var Element2 = REACT_ELEMENT_TYPE;
        var ForwardRef = REACT_FORWARD_REF_TYPE;
        var Fragment27 = REACT_FRAGMENT_TYPE;
        var Lazy = REACT_LAZY_TYPE;
        var Memo = REACT_MEMO_TYPE;
        var Portal = REACT_PORTAL_TYPE;
        var Profiler = REACT_PROFILER_TYPE;
        var StrictMode = REACT_STRICT_MODE_TYPE;
        var Suspense = REACT_SUSPENSE_TYPE;
        var hasWarnedAboutDeprecatedIsAsyncMode = false;
        function isAsyncMode(object) {
          {
            if (!hasWarnedAboutDeprecatedIsAsyncMode) {
              hasWarnedAboutDeprecatedIsAsyncMode = true;
              console["warn"]("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.");
            }
          }
          return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
        }
        function isConcurrentMode(object) {
          return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
        }
        function isContextConsumer2(object) {
          return typeOf(object) === REACT_CONTEXT_TYPE;
        }
        function isContextProvider(object) {
          return typeOf(object) === REACT_PROVIDER_TYPE;
        }
        function isElement(object) {
          return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
        }
        function isForwardRef(object) {
          return typeOf(object) === REACT_FORWARD_REF_TYPE;
        }
        function isFragment(object) {
          return typeOf(object) === REACT_FRAGMENT_TYPE;
        }
        function isLazy(object) {
          return typeOf(object) === REACT_LAZY_TYPE;
        }
        function isMemo(object) {
          return typeOf(object) === REACT_MEMO_TYPE;
        }
        function isPortal(object) {
          return typeOf(object) === REACT_PORTAL_TYPE;
        }
        function isProfiler(object) {
          return typeOf(object) === REACT_PROFILER_TYPE;
        }
        function isStrictMode(object) {
          return typeOf(object) === REACT_STRICT_MODE_TYPE;
        }
        function isSuspense(object) {
          return typeOf(object) === REACT_SUSPENSE_TYPE;
        }
        exports.AsyncMode = AsyncMode;
        exports.ConcurrentMode = ConcurrentMode;
        exports.ContextConsumer = ContextConsumer;
        exports.ContextProvider = ContextProvider;
        exports.Element = Element2;
        exports.ForwardRef = ForwardRef;
        exports.Fragment = Fragment27;
        exports.Lazy = Lazy;
        exports.Memo = Memo;
        exports.Portal = Portal;
        exports.Profiler = Profiler;
        exports.StrictMode = StrictMode;
        exports.Suspense = Suspense;
        exports.isAsyncMode = isAsyncMode;
        exports.isConcurrentMode = isConcurrentMode;
        exports.isContextConsumer = isContextConsumer2;
        exports.isContextProvider = isContextProvider;
        exports.isElement = isElement;
        exports.isForwardRef = isForwardRef;
        exports.isFragment = isFragment;
        exports.isLazy = isLazy;
        exports.isMemo = isMemo;
        exports.isPortal = isPortal;
        exports.isProfiler = isProfiler;
        exports.isStrictMode = isStrictMode;
        exports.isSuspense = isSuspense;
        exports.isValidElementType = isValidElementType2;
        exports.typeOf = typeOf;
      })();
    }
  }
});

// node_modules/hoist-non-react-statics/node_modules/react-is/index.js
var require_react_is = __commonJS({
  "node_modules/hoist-non-react-statics/node_modules/react-is/index.js"(exports, module2) {
    "use strict";
    if (false) {
      module2.exports = null;
    } else {
      module2.exports = require_react_is_development();
    }
  }
});

// node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js
var require_hoist_non_react_statics_cjs = __commonJS({
  "node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js"(exports, module2) {
    "use strict";
    var reactIs = require_react_is();
    var REACT_STATICS = {
      childContextTypes: true,
      contextType: true,
      contextTypes: true,
      defaultProps: true,
      displayName: true,
      getDefaultProps: true,
      getDerivedStateFromError: true,
      getDerivedStateFromProps: true,
      mixins: true,
      propTypes: true,
      type: true
    };
    var KNOWN_STATICS = {
      name: true,
      length: true,
      prototype: true,
      caller: true,
      callee: true,
      arguments: true,
      arity: true
    };
    var FORWARD_REF_STATICS = {
      "$$typeof": true,
      render: true,
      defaultProps: true,
      displayName: true,
      propTypes: true
    };
    var MEMO_STATICS = {
      "$$typeof": true,
      compare: true,
      defaultProps: true,
      displayName: true,
      propTypes: true,
      type: true
    };
    var TYPE_STATICS = {};
    TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
    TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;
    function getStatics(component) {
      if (reactIs.isMemo(component)) {
        return MEMO_STATICS;
      }
      return TYPE_STATICS[component["$$typeof"]] || REACT_STATICS;
    }
    var defineProperty = Object.defineProperty;
    var getOwnPropertyNames = Object.getOwnPropertyNames;
    var getOwnPropertySymbols = Object.getOwnPropertySymbols;
    var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
    var getPrototypeOf = Object.getPrototypeOf;
    var objectPrototype = Object.prototype;
    function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
      if (typeof sourceComponent !== "string") {
        if (objectPrototype) {
          var inheritedComponent = getPrototypeOf(sourceComponent);
          if (inheritedComponent && inheritedComponent !== objectPrototype) {
            hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
          }
        }
        var keys = getOwnPropertyNames(sourceComponent);
        if (getOwnPropertySymbols) {
          keys = keys.concat(getOwnPropertySymbols(sourceComponent));
        }
        var targetStatics = getStatics(targetComponent);
        var sourceStatics = getStatics(sourceComponent);
        for (var i2 = 0; i2 < keys.length; ++i2) {
          var key = keys[i2];
          if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
            var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
            try {
              defineProperty(targetComponent, key, descriptor);
            } catch (e) {
            }
          }
        }
      }
      return targetComponent;
    }
    module2.exports = hoistNonReactStatics;
  }
});

// node_modules/react-redux/node_modules/react-is/cjs/react-is.development.js
var require_react_is_development2 = __commonJS({
  "node_modules/react-redux/node_modules/react-is/cjs/react-is.development.js"(exports) {
    "use strict";
    if (true) {
      (function() {
        "use strict";
        var REACT_ELEMENT_TYPE = Symbol.for("react.element");
        var REACT_PORTAL_TYPE = Symbol.for("react.portal");
        var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
        var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
        var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
        var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
        var REACT_CONTEXT_TYPE = Symbol.for("react.context");
        var REACT_SERVER_CONTEXT_TYPE = Symbol.for("react.server_context");
        var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
        var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
        var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
        var REACT_MEMO_TYPE = Symbol.for("react.memo");
        var REACT_LAZY_TYPE = Symbol.for("react.lazy");
        var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
        var enableScopeAPI = false;
        var enableCacheElement = false;
        var enableTransitionTracing = false;
        var enableLegacyHidden = false;
        var enableDebugTracing = false;
        var REACT_MODULE_REFERENCE;
        {
          REACT_MODULE_REFERENCE = Symbol.for("react.module.reference");
        }
        function isValidElementType2(type) {
          if (typeof type === "string" || typeof type === "function") {
            return true;
          }
          if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) {
            return true;
          }
          if (typeof type === "object" && type !== null) {
            if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
            // types supported by any Flight configuration anywhere since
            // we don't know which Flight build this will end up being used
            // with.
            type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) {
              return true;
            }
          }
          return false;
        }
        function typeOf(object) {
          if (typeof object === "object" && object !== null) {
            var $$typeof = object.$$typeof;
            switch ($$typeof) {
              case REACT_ELEMENT_TYPE:
                var type = object.type;
                switch (type) {
                  case REACT_FRAGMENT_TYPE:
                  case REACT_PROFILER_TYPE:
                  case REACT_STRICT_MODE_TYPE:
                  case REACT_SUSPENSE_TYPE:
                  case REACT_SUSPENSE_LIST_TYPE:
                    return type;
                  default:
                    var $$typeofType = type && type.$$typeof;
                    switch ($$typeofType) {
                      case REACT_SERVER_CONTEXT_TYPE:
                      case REACT_CONTEXT_TYPE:
                      case REACT_FORWARD_REF_TYPE:
                      case REACT_LAZY_TYPE:
                      case REACT_MEMO_TYPE:
                      case REACT_PROVIDER_TYPE:
                        return $$typeofType;
                      default:
                        return $$typeof;
                    }
                }
              case REACT_PORTAL_TYPE:
                return $$typeof;
            }
          }
          return void 0;
        }
        var ContextConsumer = REACT_CONTEXT_TYPE;
        var ContextProvider = REACT_PROVIDER_TYPE;
        var Element2 = REACT_ELEMENT_TYPE;
        var ForwardRef = REACT_FORWARD_REF_TYPE;
        var Fragment27 = REACT_FRAGMENT_TYPE;
        var Lazy = REACT_LAZY_TYPE;
        var Memo = REACT_MEMO_TYPE;
        var Portal = REACT_PORTAL_TYPE;
        var Profiler = REACT_PROFILER_TYPE;
        var StrictMode = REACT_STRICT_MODE_TYPE;
        var Suspense = REACT_SUSPENSE_TYPE;
        var SuspenseList = REACT_SUSPENSE_LIST_TYPE;
        var hasWarnedAboutDeprecatedIsAsyncMode = false;
        var hasWarnedAboutDeprecatedIsConcurrentMode = false;
        function isAsyncMode(object) {
          {
            if (!hasWarnedAboutDeprecatedIsAsyncMode) {
              hasWarnedAboutDeprecatedIsAsyncMode = true;
              console["warn"]("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.");
            }
          }
          return false;
        }
        function isConcurrentMode(object) {
          {
            if (!hasWarnedAboutDeprecatedIsConcurrentMode) {
              hasWarnedAboutDeprecatedIsConcurrentMode = true;
              console["warn"]("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.");
            }
          }
          return false;
        }
        function isContextConsumer2(object) {
          return typeOf(object) === REACT_CONTEXT_TYPE;
        }
        function isContextProvider(object) {
          return typeOf(object) === REACT_PROVIDER_TYPE;
        }
        function isElement(object) {
          return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
        }
        function isForwardRef(object) {
          return typeOf(object) === REACT_FORWARD_REF_TYPE;
        }
        function isFragment(object) {
          return typeOf(object) === REACT_FRAGMENT_TYPE;
        }
        function isLazy(object) {
          return typeOf(object) === REACT_LAZY_TYPE;
        }
        function isMemo(object) {
          return typeOf(object) === REACT_MEMO_TYPE;
        }
        function isPortal(object) {
          return typeOf(object) === REACT_PORTAL_TYPE;
        }
        function isProfiler(object) {
          return typeOf(object) === REACT_PROFILER_TYPE;
        }
        function isStrictMode(object) {
          return typeOf(object) === REACT_STRICT_MODE_TYPE;
        }
        function isSuspense(object) {
          return typeOf(object) === REACT_SUSPENSE_TYPE;
        }
        function isSuspenseList(object) {
          return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
        }
        exports.ContextConsumer = ContextConsumer;
        exports.ContextProvider = ContextProvider;
        exports.Element = Element2;
        exports.ForwardRef = ForwardRef;
        exports.Fragment = Fragment27;
        exports.Lazy = Lazy;
        exports.Memo = Memo;
        exports.Portal = Portal;
        exports.Profiler = Profiler;
        exports.StrictMode = StrictMode;
        exports.Suspense = Suspense;
        exports.SuspenseList = SuspenseList;
        exports.isAsyncMode = isAsyncMode;
        exports.isConcurrentMode = isConcurrentMode;
        exports.isContextConsumer = isContextConsumer2;
        exports.isContextProvider = isContextProvider;
        exports.isElement = isElement;
        exports.isForwardRef = isForwardRef;
        exports.isFragment = isFragment;
        exports.isLazy = isLazy;
        exports.isMemo = isMemo;
        exports.isPortal = isPortal;
        exports.isProfiler = isProfiler;
        exports.isStrictMode = isStrictMode;
        exports.isSuspense = isSuspense;
        exports.isSuspenseList = isSuspenseList;
        exports.isValidElementType = isValidElementType2;
        exports.typeOf = typeOf;
      })();
    }
  }
});

// node_modules/react-redux/node_modules/react-is/index.js
var require_react_is2 = __commonJS({
  "node_modules/react-redux/node_modules/react-is/index.js"(exports, module2) {
    "use strict";
    if (false) {
      module2.exports = null;
    } else {
      module2.exports = require_react_is_development2();
    }
  }
});

// node_modules/react/cjs/react-jsx-runtime.development.js
var require_react_jsx_runtime_development = __commonJS({
  "node_modules/react/cjs/react-jsx-runtime.development.js"(exports) {
    "use strict";
    if (true) {
      (function() {
        "use strict";
        var React66 = require_react();
        var REACT_ELEMENT_TYPE = Symbol.for("react.element");
        var REACT_PORTAL_TYPE = Symbol.for("react.portal");
        var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
        var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
        var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
        var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
        var REACT_CONTEXT_TYPE = Symbol.for("react.context");
        var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
        var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
        var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
        var REACT_MEMO_TYPE = Symbol.for("react.memo");
        var REACT_LAZY_TYPE = Symbol.for("react.lazy");
        var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
        var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
        var FAUX_ITERATOR_SYMBOL = "@@iterator";
        function getIteratorFn(maybeIterable) {
          if (maybeIterable === null || typeof maybeIterable !== "object") {
            return null;
          }
          var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
          if (typeof maybeIterator === "function") {
            return maybeIterator;
          }
          return null;
        }
        var ReactSharedInternals = React66.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
        function error(format) {
          {
            {
              for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
                args[_key2 - 1] = arguments[_key2];
              }
              printWarning("error", format, args);
            }
          }
        }
        function printWarning(level, format, args) {
          {
            var ReactDebugCurrentFrame2 = ReactSharedInternals.ReactDebugCurrentFrame;
            var stack = ReactDebugCurrentFrame2.getStackAddendum();
            if (stack !== "") {
              format += "%s";
              args = args.concat([stack]);
            }
            var argsWithFormat = args.map(function(item) {
              return String(item);
            });
            argsWithFormat.unshift("Warning: " + format);
            Function.prototype.apply.call(console[level], console, argsWithFormat);
          }
        }
        var enableScopeAPI = false;
        var enableCacheElement = false;
        var enableTransitionTracing = false;
        var enableLegacyHidden = false;
        var enableDebugTracing = false;
        var REACT_MODULE_REFERENCE;
        {
          REACT_MODULE_REFERENCE = Symbol.for("react.module.reference");
        }
        function isValidElementType2(type) {
          if (typeof type === "string" || typeof type === "function") {
            return true;
          }
          if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) {
            return true;
          }
          if (typeof type === "object" && type !== null) {
            if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
            // types supported by any Flight configuration anywhere since
            // we don't know which Flight build this will end up being used
            // with.
            type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) {
              return true;
            }
          }
          return false;
        }
        function getWrappedName(outerType, innerType, wrapperName) {
          var displayName = outerType.displayName;
          if (displayName) {
            return displayName;
          }
          var functionName = innerType.displayName || innerType.name || "";
          return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName;
        }
        function getContextName(type) {
          return type.displayName || "Context";
        }
        function getComponentNameFromType(type) {
          if (type == null) {
            return null;
          }
          {
            if (typeof type.tag === "number") {
              error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.");
            }
          }
          if (typeof type === "function") {
            return type.displayName || type.name || null;
          }
          if (typeof type === "string") {
            return type;
          }
          switch (type) {
            case REACT_FRAGMENT_TYPE:
              return "Fragment";
            case REACT_PORTAL_TYPE:
              return "Portal";
            case REACT_PROFILER_TYPE:
              return "Profiler";
            case REACT_STRICT_MODE_TYPE:
              return "StrictMode";
            case REACT_SUSPENSE_TYPE:
              return "Suspense";
            case REACT_SUSPENSE_LIST_TYPE:
              return "SuspenseList";
          }
          if (typeof type === "object") {
            switch (type.$$typeof) {
              case REACT_CONTEXT_TYPE:
                var context = type;
                return getContextName(context) + ".Consumer";
              case REACT_PROVIDER_TYPE:
                var provider = type;
                return getContextName(provider._context) + ".Provider";
              case REACT_FORWARD_REF_TYPE:
                return getWrappedName(type, type.render, "ForwardRef");
              case REACT_MEMO_TYPE:
                var outerName = type.displayName || null;
                if (outerName !== null) {
                  return outerName;
                }
                return getComponentNameFromType(type.type) || "Memo";
              case REACT_LAZY_TYPE: {
                var lazyComponent = type;
                var payload = lazyComponent._payload;
                var init2 = lazyComponent._init;
                try {
                  return getComponentNameFromType(init2(payload));
                } catch (x2) {
                  return null;
                }
              }
            }
          }
          return null;
        }
        var assign = Object.assign;
        var disabledDepth = 0;
        var prevLog;
        var prevInfo;
        var prevWarn;
        var prevError;
        var prevGroup;
        var prevGroupCollapsed;
        var prevGroupEnd;
        function disabledLog() {
        }
        disabledLog.__reactDisabledLog = true;
        function disableLogs() {
          {
            if (disabledDepth === 0) {
              prevLog = console.log;
              prevInfo = console.info;
              prevWarn = console.warn;
              prevError = console.error;
              prevGroup = console.group;
              prevGroupCollapsed = console.groupCollapsed;
              prevGroupEnd = console.groupEnd;
              var props = {
                configurable: true,
                enumerable: true,
                value: disabledLog,
                writable: true
              };
              Object.defineProperties(console, {
                info: props,
                log: props,
                warn: props,
                error: props,
                group: props,
                groupCollapsed: props,
                groupEnd: props
              });
            }
            disabledDepth++;
          }
        }
        function reenableLogs() {
          {
            disabledDepth--;
            if (disabledDepth === 0) {
              var props = {
                configurable: true,
                enumerable: true,
                writable: true
              };
              Object.defineProperties(console, {
                log: assign({}, props, {
                  value: prevLog
                }),
                info: assign({}, props, {
                  value: prevInfo
                }),
                warn: assign({}, props, {
                  value: prevWarn
                }),
                error: assign({}, props, {
                  value: prevError
                }),
                group: assign({}, props, {
                  value: prevGroup
                }),
                groupCollapsed: assign({}, props, {
                  value: prevGroupCollapsed
                }),
                groupEnd: assign({}, props, {
                  value: prevGroupEnd
                })
              });
            }
            if (disabledDepth < 0) {
              error("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
            }
          }
        }
        var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
        var prefix2;
        function describeBuiltInComponentFrame(name, source, ownerFn) {
          {
            if (prefix2 === void 0) {
              try {
                throw Error();
              } catch (x2) {
                var match = x2.stack.trim().match(/\n( *(at )?)/);
                prefix2 = match && match[1] || "";
              }
            }
            return "\n" + prefix2 + name;
          }
        }
        var reentry = false;
        var componentFrameCache;
        {
          var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map;
          componentFrameCache = new PossiblyWeakMap();
        }
        function describeNativeComponentFrame(fn2, construct) {
          if (!fn2 || reentry) {
            return "";
          }
          {
            var frame = componentFrameCache.get(fn2);
            if (frame !== void 0) {
              return frame;
            }
          }
          var control;
          reentry = true;
          var previousPrepareStackTrace = Error.prepareStackTrace;
          Error.prepareStackTrace = void 0;
          var previousDispatcher;
          {
            previousDispatcher = ReactCurrentDispatcher.current;
            ReactCurrentDispatcher.current = null;
            disableLogs();
          }
          try {
            if (construct) {
              var Fake = function() {
                throw Error();
              };
              Object.defineProperty(Fake.prototype, "props", {
                set: function() {
                  throw Error();
                }
              });
              if (typeof Reflect === "object" && Reflect.construct) {
                try {
                  Reflect.construct(Fake, []);
                } catch (x2) {
                  control = x2;
                }
                Reflect.construct(fn2, [], Fake);
              } else {
                try {
                  Fake.call();
                } catch (x2) {
                  control = x2;
                }
                fn2.call(Fake.prototype);
              }
            } else {
              try {
                throw Error();
              } catch (x2) {
                control = x2;
              }
              fn2();
            }
          } catch (sample) {
            if (sample && control && typeof sample.stack === "string") {
              var sampleLines = sample.stack.split("\n");
              var controlLines = control.stack.split("\n");
              var s2 = sampleLines.length - 1;
              var c2 = controlLines.length - 1;
              while (s2 >= 1 && c2 >= 0 && sampleLines[s2] !== controlLines[c2]) {
                c2--;
              }
              for (; s2 >= 1 && c2 >= 0; s2--, c2--) {
                if (sampleLines[s2] !== controlLines[c2]) {
                  if (s2 !== 1 || c2 !== 1) {
                    do {
                      s2--;
                      c2--;
                      if (c2 < 0 || sampleLines[s2] !== controlLines[c2]) {
                        var _frame = "\n" + sampleLines[s2].replace(" at new ", " at ");
                        if (fn2.displayName && _frame.includes("<anonymous>")) {
                          _frame = _frame.replace("<anonymous>", fn2.displayName);
                        }
                        {
                          if (typeof fn2 === "function") {
                            componentFrameCache.set(fn2, _frame);
                          }
                        }
                        return _frame;
                      }
                    } while (s2 >= 1 && c2 >= 0);
                  }
                  break;
                }
              }
            }
          } finally {
            reentry = false;
            {
              ReactCurrentDispatcher.current = previousDispatcher;
              reenableLogs();
            }
            Error.prepareStackTrace = previousPrepareStackTrace;
          }
          var name = fn2 ? fn2.displayName || fn2.name : "";
          var syntheticFrame = name ? describeBuiltInComponentFrame(name) : "";
          {
            if (typeof fn2 === "function") {
              componentFrameCache.set(fn2, syntheticFrame);
            }
          }
          return syntheticFrame;
        }
        function describeFunctionComponentFrame(fn2, source, ownerFn) {
          {
            return describeNativeComponentFrame(fn2, false);
          }
        }
        function shouldConstruct(Component) {
          var prototype = Component.prototype;
          return !!(prototype && prototype.isReactComponent);
        }
        function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
          if (type == null) {
            return "";
          }
          if (typeof type === "function") {
            {
              return describeNativeComponentFrame(type, shouldConstruct(type));
            }
          }
          if (typeof type === "string") {
            return describeBuiltInComponentFrame(type);
          }
          switch (type) {
            case REACT_SUSPENSE_TYPE:
              return describeBuiltInComponentFrame("Suspense");
            case REACT_SUSPENSE_LIST_TYPE:
              return describeBuiltInComponentFrame("SuspenseList");
          }
          if (typeof type === "object") {
            switch (type.$$typeof) {
              case REACT_FORWARD_REF_TYPE:
                return describeFunctionComponentFrame(type.render);
              case REACT_MEMO_TYPE:
                return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
              case REACT_LAZY_TYPE: {
                var lazyComponent = type;
                var payload = lazyComponent._payload;
                var init2 = lazyComponent._init;
                try {
                  return describeUnknownElementTypeFrameInDEV(init2(payload), source, ownerFn);
                } catch (x2) {
                }
              }
            }
          }
          return "";
        }
        var hasOwnProperty = Object.prototype.hasOwnProperty;
        var loggedTypeFailures = {};
        var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
        function setCurrentlyValidatingElement(element) {
          {
            if (element) {
              var owner = element._owner;
              var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
              ReactDebugCurrentFrame.setExtraStackFrame(stack);
            } else {
              ReactDebugCurrentFrame.setExtraStackFrame(null);
            }
          }
        }
        function checkPropTypes(typeSpecs, values, location, componentName, element) {
          {
            var has = Function.call.bind(hasOwnProperty);
            for (var typeSpecName in typeSpecs) {
              if (has(typeSpecs, typeSpecName)) {
                var error$1 = void 0;
                try {
                  if (typeof typeSpecs[typeSpecName] !== "function") {
                    var err = Error((componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
                    err.name = "Invariant Violation";
                    throw err;
                  }
                  error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
                } catch (ex) {
                  error$1 = ex;
                }
                if (error$1 && !(error$1 instanceof Error)) {
                  setCurrentlyValidatingElement(element);
                  error("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", componentName || "React class", location, typeSpecName, typeof error$1);
                  setCurrentlyValidatingElement(null);
                }
                if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
                  loggedTypeFailures[error$1.message] = true;
                  setCurrentlyValidatingElement(element);
                  error("Failed %s type: %s", location, error$1.message);
                  setCurrentlyValidatingElement(null);
                }
              }
            }
          }
        }
        var isArrayImpl = Array.isArray;
        function isArray(a2) {
          return isArrayImpl(a2);
        }
        function typeName(value) {
          {
            var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag;
            var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
            return type;
          }
        }
        function willCoercionThrow(value) {
          {
            try {
              testStringCoercion(value);
              return false;
            } catch (e) {
              return true;
            }
          }
        }
        function testStringCoercion(value) {
          return "" + value;
        }
        function checkKeyStringCoercion(value) {
          {
            if (willCoercionThrow(value)) {
              error("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", typeName(value));
              return testStringCoercion(value);
            }
          }
        }
        var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
        var RESERVED_PROPS = {
          key: true,
          ref: true,
          __self: true,
          __source: true
        };
        var specialPropKeyWarningShown;
        var specialPropRefWarningShown;
        var didWarnAboutStringRefs;
        {
          didWarnAboutStringRefs = {};
        }
        function hasValidRef(config) {
          {
            if (hasOwnProperty.call(config, "ref")) {
              var getter = Object.getOwnPropertyDescriptor(config, "ref").get;
              if (getter && getter.isReactWarning) {
                return false;
              }
            }
          }
          return config.ref !== void 0;
        }
        function hasValidKey(config) {
          {
            if (hasOwnProperty.call(config, "key")) {
              var getter = Object.getOwnPropertyDescriptor(config, "key").get;
              if (getter && getter.isReactWarning) {
                return false;
              }
            }
          }
          return config.key !== void 0;
        }
        function warnIfStringRefCannotBeAutoConverted(config, self2) {
          {
            if (typeof config.ref === "string" && ReactCurrentOwner.current && self2 && ReactCurrentOwner.current.stateNode !== self2) {
              var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
              if (!didWarnAboutStringRefs[componentName]) {
                error('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);
                didWarnAboutStringRefs[componentName] = true;
              }
            }
          }
        }
        function defineKeyPropWarningGetter(props, displayName) {
          {
            var warnAboutAccessingKey = function() {
              if (!specialPropKeyWarningShown) {
                specialPropKeyWarningShown = true;
                error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName);
              }
            };
            warnAboutAccessingKey.isReactWarning = true;
            Object.defineProperty(props, "key", {
              get: warnAboutAccessingKey,
              configurable: true
            });
          }
        }
        function defineRefPropWarningGetter(props, displayName) {
          {
            var warnAboutAccessingRef = function() {
              if (!specialPropRefWarningShown) {
                specialPropRefWarningShown = true;
                error("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName);
              }
            };
            warnAboutAccessingRef.isReactWarning = true;
            Object.defineProperty(props, "ref", {
              get: warnAboutAccessingRef,
              configurable: true
            });
          }
        }
        var ReactElement = function(type, key, ref, self2, source, owner, props) {
          var element = {
            // This tag allows us to uniquely identify this as a React Element
            $$typeof: REACT_ELEMENT_TYPE,
            // Built-in properties that belong on the element
            type,
            key,
            ref,
            props,
            // Record the component responsible for creating this element.
            _owner: owner
          };
          {
            element._store = {};
            Object.defineProperty(element._store, "validated", {
              configurable: false,
              enumerable: false,
              writable: true,
              value: false
            });
            Object.defineProperty(element, "_self", {
              configurable: false,
              enumerable: false,
              writable: false,
              value: self2
            });
            Object.defineProperty(element, "_source", {
              configurable: false,
              enumerable: false,
              writable: false,
              value: source
            });
            if (Object.freeze) {
              Object.freeze(element.props);
              Object.freeze(element);
            }
          }
          return element;
        };
        function jsxDEV(type, config, maybeKey, source, self2) {
          {
            var propName;
            var props = {};
            var key = null;
            var ref = null;
            if (maybeKey !== void 0) {
              {
                checkKeyStringCoercion(maybeKey);
              }
              key = "" + maybeKey;
            }
            if (hasValidKey(config)) {
              {
                checkKeyStringCoercion(config.key);
              }
              key = "" + config.key;
            }
            if (hasValidRef(config)) {
              ref = config.ref;
              warnIfStringRefCannotBeAutoConverted(config, self2);
            }
            for (propName in config) {
              if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
                props[propName] = config[propName];
              }
            }
            if (type && type.defaultProps) {
              var defaultProps = type.defaultProps;
              for (propName in defaultProps) {
                if (props[propName] === void 0) {
                  props[propName] = defaultProps[propName];
                }
              }
            }
            if (key || ref) {
              var displayName = typeof type === "function" ? type.displayName || type.name || "Unknown" : type;
              if (key) {
                defineKeyPropWarningGetter(props, displayName);
              }
              if (ref) {
                defineRefPropWarningGetter(props, displayName);
              }
            }
            return ReactElement(type, key, ref, self2, source, ReactCurrentOwner.current, props);
          }
        }
        var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
        var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
        function setCurrentlyValidatingElement$1(element) {
          {
            if (element) {
              var owner = element._owner;
              var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
              ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
            } else {
              ReactDebugCurrentFrame$1.setExtraStackFrame(null);
            }
          }
        }
        var propTypesMisspellWarningShown;
        {
          propTypesMisspellWarningShown = false;
        }
        function isValidElement(object) {
          {
            return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
          }
        }
        function getDeclarationErrorAddendum() {
          {
            if (ReactCurrentOwner$1.current) {
              var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
              if (name) {
                return "\n\nCheck the render method of `" + name + "`.";
              }
            }
            return "";
          }
        }
        function getSourceInfoErrorAddendum(source) {
          {
            if (source !== void 0) {
              var fileName = source.fileName.replace(/^.*[\\\/]/, "");
              var lineNumber = source.lineNumber;
              return "\n\nCheck your code at " + fileName + ":" + lineNumber + ".";
            }
            return "";
          }
        }
        var ownerHasKeyUseWarning = {};
        function getCurrentComponentErrorInfo(parentType) {
          {
            var info = getDeclarationErrorAddendum();
            if (!info) {
              var parentName = typeof parentType === "string" ? parentType : parentType.displayName || parentType.name;
              if (parentName) {
                info = "\n\nCheck the top-level render call using <" + parentName + ">.";
              }
            }
            return info;
          }
        }
        function validateExplicitKey(element, parentType) {
          {
            if (!element._store || element._store.validated || element.key != null) {
              return;
            }
            element._store.validated = true;
            var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
            if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
              return;
            }
            ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
            var childOwner = "";
            if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
              childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
            }
            setCurrentlyValidatingElement$1(element);
            error('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
            setCurrentlyValidatingElement$1(null);
          }
        }
        function validateChildKeys(node, parentType) {
          {
            if (typeof node !== "object") {
              return;
            }
            if (isArray(node)) {
              for (var i2 = 0; i2 < node.length; i2++) {
                var child = node[i2];
                if (isValidElement(child)) {
                  validateExplicitKey(child, parentType);
                }
              }
            } else if (isValidElement(node)) {
              if (node._store) {
                node._store.validated = true;
              }
            } else if (node) {
              var iteratorFn = getIteratorFn(node);
              if (typeof iteratorFn === "function") {
                if (iteratorFn !== node.entries) {
                  var iterator = iteratorFn.call(node);
                  var step;
                  while (!(step = iterator.next()).done) {
                    if (isValidElement(step.value)) {
                      validateExplicitKey(step.value, parentType);
                    }
                  }
                }
              }
            }
          }
        }
        function validatePropTypes(element) {
          {
            var type = element.type;
            if (type === null || type === void 0 || typeof type === "string") {
              return;
            }
            var propTypes;
            if (typeof type === "function") {
              propTypes = type.propTypes;
            } else if (typeof type === "object" && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
            // Inner props are checked in the reconciler.
            type.$$typeof === REACT_MEMO_TYPE)) {
              propTypes = type.propTypes;
            } else {
              return;
            }
            if (propTypes) {
              var name = getComponentNameFromType(type);
              checkPropTypes(propTypes, element.props, "prop", name, element);
            } else if (type.PropTypes !== void 0 && !propTypesMisspellWarningShown) {
              propTypesMisspellWarningShown = true;
              var _name = getComponentNameFromType(type);
              error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _name || "Unknown");
            }
            if (typeof type.getDefaultProps === "function" && !type.getDefaultProps.isReactClassApproved) {
              error("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
            }
          }
        }
        function validateFragmentProps(fragment) {
          {
            var keys = Object.keys(fragment.props);
            for (var i2 = 0; i2 < keys.length; i2++) {
              var key = keys[i2];
              if (key !== "children" && key !== "key") {
                setCurrentlyValidatingElement$1(fragment);
                error("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", key);
                setCurrentlyValidatingElement$1(null);
                break;
              }
            }
            if (fragment.ref !== null) {
              setCurrentlyValidatingElement$1(fragment);
              error("Invalid attribute `ref` supplied to `React.Fragment`.");
              setCurrentlyValidatingElement$1(null);
            }
          }
        }
        var didWarnAboutKeySpread = {};
        function jsxWithValidation(type, props, key, isStaticChildren, source, self2) {
          {
            var validType = isValidElementType2(type);
            if (!validType) {
              var info = "";
              if (type === void 0 || typeof type === "object" && type !== null && Object.keys(type).length === 0) {
                info += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.";
              }
              var sourceInfo = getSourceInfoErrorAddendum(source);
              if (sourceInfo) {
                info += sourceInfo;
              } else {
                info += getDeclarationErrorAddendum();
              }
              var typeString;
              if (type === null) {
                typeString = "null";
              } else if (isArray(type)) {
                typeString = "array";
              } else if (type !== void 0 && type.$$typeof === REACT_ELEMENT_TYPE) {
                typeString = "<" + (getComponentNameFromType(type.type) || "Unknown") + " />";
                info = " Did you accidentally export a JSX literal instead of a component?";
              } else {
                typeString = typeof type;
              }
              error("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", typeString, info);
            }
            var element = jsxDEV(type, props, key, source, self2);
            if (element == null) {
              return element;
            }
            if (validType) {
              var children = props.children;
              if (children !== void 0) {
                if (isStaticChildren) {
                  if (isArray(children)) {
                    for (var i2 = 0; i2 < children.length; i2++) {
                      validateChildKeys(children[i2], type);
                    }
                    if (Object.freeze) {
                      Object.freeze(children);
                    }
                  } else {
                    error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
                  }
                } else {
                  validateChildKeys(children, type);
                }
              }
            }
            {
              if (hasOwnProperty.call(props, "key")) {
                var componentName = getComponentNameFromType(type);
                var keys = Object.keys(props).filter(function(k2) {
                  return k2 !== "key";
                });
                var beforeExample = keys.length > 0 ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
                if (!didWarnAboutKeySpread[componentName + beforeExample]) {
                  var afterExample = keys.length > 0 ? "{" + keys.join(": ..., ") + ": ...}" : "{}";
                  error('A props object containing a "key" prop is being spread into JSX:\n  let props = %s;\n  <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n  let props = %s;\n  <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);
                  didWarnAboutKeySpread[componentName + beforeExample] = true;
                }
              }
            }
            if (type === REACT_FRAGMENT_TYPE) {
              validateFragmentProps(element);
            } else {
              validatePropTypes(element);
            }
            return element;
          }
        }
        function jsxWithValidationStatic(type, props, key) {
          {
            return jsxWithValidation(type, props, key, true);
          }
        }
        function jsxWithValidationDynamic(type, props, key) {
          {
            return jsxWithValidation(type, props, key, false);
          }
        }
        var jsx151 = jsxWithValidationDynamic;
        var jsxs72 = jsxWithValidationStatic;
        exports.Fragment = REACT_FRAGMENT_TYPE;
        exports.jsx = jsx151;
        exports.jsxs = jsxs72;
      })();
    }
  }
});

// node_modules/react/jsx-runtime.js
var require_jsx_runtime = __commonJS({
  "node_modules/react/jsx-runtime.js"(exports, module2) {
    "use strict";
    if (false) {
      module2.exports = null;
    } else {
      module2.exports = require_react_jsx_runtime_development();
    }
  }
});

// node_modules/fuzzysort/fuzzysort.js
var require_fuzzysort = __commonJS({
  "node_modules/fuzzysort/fuzzysort.js"(exports, module2) {
    ((root, UMD) => {
      if (typeof define === "function" && define.amd)
        define([], UMD);
      else if (typeof module2 === "object" && module2.exports)
        module2.exports = UMD();
      else
        root["fuzzysort"] = UMD();
    })(exports, (_7) => {
      "use strict";
      var single = (search, target) => {
        if (search == "farzher")
          return { target: "farzher was here (^-^*)/", score: 0, _indexes: [0] };
        if (!search || !target)
          return NULL;
        var preparedSearch = getPreparedSearch(search);
        if (!isObj(target))
          target = getPrepared(target);
        var searchBitflags = preparedSearch.bitflags;
        if ((searchBitflags & target._bitflags) !== searchBitflags)
          return NULL;
        return algorithm(preparedSearch, target);
      };
      var go = (search, targets, options) => {
        if (search == "farzher")
          return [{ target: "farzher was here (^-^*)/", score: 0, _indexes: [0], obj: targets ? targets[0] : NULL }];
        if (!search)
          return options && options.all ? all(search, targets, options) : noResults;
        var preparedSearch = getPreparedSearch(search);
        var searchBitflags = preparedSearch.bitflags;
        var containsSpace = preparedSearch.containsSpace;
        var threshold = options && options.threshold || INT_MIN;
        var limit = options && options["limit"] || INT_MAX;
        var resultsLen = 0;
        var limitedCount = 0;
        var targetsLen = targets.length;
        if (options && options.key) {
          var key = options.key;
          for (var i2 = 0; i2 < targetsLen; ++i2) {
            var obj = targets[i2];
            var target = getValue2(obj, key);
            if (!target)
              continue;
            if (!isObj(target))
              target = getPrepared(target);
            if ((searchBitflags & target._bitflags) !== searchBitflags)
              continue;
            var result = algorithm(preparedSearch, target);
            if (result === NULL)
              continue;
            if (result.score < threshold)
              continue;
            result = { target: result.target, _targetLower: "", _targetLowerCodes: NULL, _nextBeginningIndexes: NULL, _bitflags: 0, score: result.score, _indexes: result._indexes, obj };
            if (resultsLen < limit) {
              q2.add(result);
              ++resultsLen;
            } else {
              ++limitedCount;
              if (result.score > q2.peek().score)
                q2.replaceTop(result);
            }
          }
        } else if (options && options.keys) {
          var scoreFn = options["scoreFn"] || defaultScoreFn;
          var keys = options.keys;
          var keysLen = keys.length;
          for (var i2 = 0; i2 < targetsLen; ++i2) {
            var obj = targets[i2];
            var objResults = new Array(keysLen);
            for (var keyI = 0; keyI < keysLen; ++keyI) {
              var key = keys[keyI];
              var target = getValue2(obj, key);
              if (!target) {
                objResults[keyI] = NULL;
                continue;
              }
              if (!isObj(target))
                target = getPrepared(target);
              if ((searchBitflags & target._bitflags) !== searchBitflags)
                objResults[keyI] = NULL;
              else
                objResults[keyI] = algorithm(preparedSearch, target);
            }
            objResults.obj = obj;
            var score = scoreFn(objResults);
            if (score === NULL)
              continue;
            if (score < threshold)
              continue;
            objResults.score = score;
            if (resultsLen < limit) {
              q2.add(objResults);
              ++resultsLen;
            } else {
              ++limitedCount;
              if (score > q2.peek().score)
                q2.replaceTop(objResults);
            }
          }
        } else {
          for (var i2 = 0; i2 < targetsLen; ++i2) {
            var target = targets[i2];
            if (!target)
              continue;
            if (!isObj(target))
              target = getPrepared(target);
            if ((searchBitflags & target._bitflags) !== searchBitflags)
              continue;
            var result = algorithm(preparedSearch, target);
            if (result === NULL)
              continue;
            if (result.score < threshold)
              continue;
            if (resultsLen < limit) {
              q2.add(result);
              ++resultsLen;
            } else {
              ++limitedCount;
              if (result.score > q2.peek().score)
                q2.replaceTop(result);
            }
          }
        }
        if (resultsLen === 0)
          return noResults;
        var results = new Array(resultsLen);
        for (var i2 = resultsLen - 1; i2 >= 0; --i2)
          results[i2] = q2.poll();
        results.total = resultsLen + limitedCount;
        return results;
      };
      var highlight = (result, hOpen, hClose) => {
        if (typeof hOpen === "function")
          return highlightCallback(result, hOpen);
        if (result === NULL)
          return NULL;
        if (hOpen === void 0)
          hOpen = "<b>";
        if (hClose === void 0)
          hClose = "</b>";
        var highlighted = "";
        var matchesIndex = 0;
        var opened = false;
        var target = result.target;
        var targetLen = target.length;
        var indexes2 = result._indexes;
        indexes2 = indexes2.slice(0, indexes2.len).sort((a2, b2) => a2 - b2);
        for (var i2 = 0; i2 < targetLen; ++i2) {
          var char = target[i2];
          if (indexes2[matchesIndex] === i2) {
            ++matchesIndex;
            if (!opened) {
              opened = true;
              highlighted += hOpen;
            }
            if (matchesIndex === indexes2.length) {
              highlighted += char + hClose + target.substr(i2 + 1);
              break;
            }
          } else {
            if (opened) {
              opened = false;
              highlighted += hClose;
            }
          }
          highlighted += char;
        }
        return highlighted;
      };
      var highlightCallback = (result, cb) => {
        if (result === NULL)
          return NULL;
        var target = result.target;
        var targetLen = target.length;
        var indexes2 = result._indexes;
        indexes2 = indexes2.slice(0, indexes2.len).sort((a2, b2) => a2 - b2);
        var highlighted = "";
        var matchI = 0;
        var indexesI = 0;
        var opened = false;
        var result = [];
        for (var i2 = 0; i2 < targetLen; ++i2) {
          var char = target[i2];
          if (indexes2[indexesI] === i2) {
            ++indexesI;
            if (!opened) {
              opened = true;
              result.push(highlighted);
              highlighted = "";
            }
            if (indexesI === indexes2.length) {
              highlighted += char;
              result.push(cb(highlighted, matchI++));
              highlighted = "";
              result.push(target.substr(i2 + 1));
              break;
            }
          } else {
            if (opened) {
              opened = false;
              result.push(cb(highlighted, matchI++));
              highlighted = "";
            }
          }
          highlighted += char;
        }
        return result;
      };
      var indexes = (result) => result._indexes.slice(0, result._indexes.len).sort((a2, b2) => a2 - b2);
      var prepare = (target) => {
        if (typeof target !== "string")
          target = "";
        var info = prepareLowerInfo(target);
        return { "target": target, _targetLower: info._lower, _targetLowerCodes: info.lowerCodes, _nextBeginningIndexes: NULL, _bitflags: info.bitflags, "score": NULL, _indexes: [0], "obj": NULL };
      };
      var prepareSearch = (search) => {
        if (typeof search !== "string")
          search = "";
        search = search.trim();
        var info = prepareLowerInfo(search);
        var spaceSearches = [];
        if (info.containsSpace) {
          var searches = search.split(/\s+/);
          searches = [...new Set(searches)];
          for (var i2 = 0; i2 < searches.length; i2++) {
            if (searches[i2] === "")
              continue;
            var _info = prepareLowerInfo(searches[i2]);
            spaceSearches.push({ lowerCodes: _info.lowerCodes, _lower: searches[i2].toLowerCase(), containsSpace: false });
          }
        }
        return { lowerCodes: info.lowerCodes, bitflags: info.bitflags, containsSpace: info.containsSpace, _lower: info._lower, spaceSearches };
      };
      var getPrepared = (target) => {
        if (target.length > 999)
          return prepare(target);
        var targetPrepared = preparedCache.get(target);
        if (targetPrepared !== void 0)
          return targetPrepared;
        targetPrepared = prepare(target);
        preparedCache.set(target, targetPrepared);
        return targetPrepared;
      };
      var getPreparedSearch = (search) => {
        if (search.length > 999)
          return prepareSearch(search);
        var searchPrepared = preparedSearchCache.get(search);
        if (searchPrepared !== void 0)
          return searchPrepared;
        searchPrepared = prepareSearch(search);
        preparedSearchCache.set(search, searchPrepared);
        return searchPrepared;
      };
      var all = (search, targets, options) => {
        var results = [];
        results.total = targets.length;
        var limit = options && options.limit || INT_MAX;
        if (options && options.key) {
          for (var i2 = 0; i2 < targets.length; i2++) {
            var obj = targets[i2];
            var target = getValue2(obj, options.key);
            if (!target)
              continue;
            if (!isObj(target))
              target = getPrepared(target);
            target.score = INT_MIN;
            target._indexes.len = 0;
            var result = target;
            result = { target: result.target, _targetLower: "", _targetLowerCodes: NULL, _nextBeginningIndexes: NULL, _bitflags: 0, score: target.score, _indexes: NULL, obj };
            results.push(result);
            if (results.length >= limit)
              return results;
          }
        } else if (options && options.keys) {
          for (var i2 = 0; i2 < targets.length; i2++) {
            var obj = targets[i2];
            var objResults = new Array(options.keys.length);
            for (var keyI = options.keys.length - 1; keyI >= 0; --keyI) {
              var target = getValue2(obj, options.keys[keyI]);
              if (!target) {
                objResults[keyI] = NULL;
                continue;
              }
              if (!isObj(target))
                target = getPrepared(target);
              target.score = INT_MIN;
              target._indexes.len = 0;
              objResults[keyI] = target;
            }
            objResults.obj = obj;
            objResults.score = INT_MIN;
            results.push(objResults);
            if (results.length >= limit)
              return results;
          }
        } else {
          for (var i2 = 0; i2 < targets.length; i2++) {
            var target = targets[i2];
            if (!target)
              continue;
            if (!isObj(target))
              target = getPrepared(target);
            target.score = INT_MIN;
            target._indexes.len = 0;
            results.push(target);
            if (results.length >= limit)
              return results;
          }
        }
        return results;
      };
      var algorithm = (preparedSearch, prepared, allowSpaces = false) => {
        if (allowSpaces === false && preparedSearch.containsSpace)
          return algorithmSpaces(preparedSearch, prepared);
        var searchLower = preparedSearch._lower;
        var searchLowerCodes = preparedSearch.lowerCodes;
        var searchLowerCode = searchLowerCodes[0];
        var targetLowerCodes = prepared._targetLowerCodes;
        var searchLen = searchLowerCodes.length;
        var targetLen = targetLowerCodes.length;
        var searchI = 0;
        var targetI = 0;
        var matchesSimpleLen = 0;
        for (; ; ) {
          var isMatch = searchLowerCode === targetLowerCodes[targetI];
          if (isMatch) {
            matchesSimple[matchesSimpleLen++] = targetI;
            ++searchI;
            if (searchI === searchLen)
              break;
            searchLowerCode = searchLowerCodes[searchI];
          }
          ++targetI;
          if (targetI >= targetLen)
            return NULL;
        }
        var searchI = 0;
        var successStrict = false;
        var matchesStrictLen = 0;
        var nextBeginningIndexes = prepared._nextBeginningIndexes;
        if (nextBeginningIndexes === NULL)
          nextBeginningIndexes = prepared._nextBeginningIndexes = prepareNextBeginningIndexes(prepared.target);
        var firstPossibleI = targetI = matchesSimple[0] === 0 ? 0 : nextBeginningIndexes[matchesSimple[0] - 1];
        var backtrackCount = 0;
        if (targetI !== targetLen)
          for (; ; ) {
            if (targetI >= targetLen) {
              if (searchI <= 0)
                break;
              ++backtrackCount;
              if (backtrackCount > 200)
                break;
              --searchI;
              var lastMatch = matchesStrict[--matchesStrictLen];
              targetI = nextBeginningIndexes[lastMatch];
            } else {
              var isMatch = searchLowerCodes[searchI] === targetLowerCodes[targetI];
              if (isMatch) {
                matchesStrict[matchesStrictLen++] = targetI;
                ++searchI;
                if (searchI === searchLen) {
                  successStrict = true;
                  break;
                }
                ++targetI;
              } else {
                targetI = nextBeginningIndexes[targetI];
              }
            }
          }
        var substringIndex = prepared._targetLower.indexOf(searchLower, matchesSimple[0]);
        var isSubstring = ~substringIndex;
        if (isSubstring && !successStrict) {
          for (var i2 = 0; i2 < matchesSimpleLen; ++i2)
            matchesSimple[i2] = substringIndex + i2;
        }
        var isSubstringBeginning = false;
        if (isSubstring) {
          isSubstringBeginning = prepared._nextBeginningIndexes[substringIndex - 1] === substringIndex;
        }
        {
          if (successStrict) {
            var matchesBest = matchesStrict;
            var matchesBestLen = matchesStrictLen;
          } else {
            var matchesBest = matchesSimple;
            var matchesBestLen = matchesSimpleLen;
          }
          var score = 0;
          var extraMatchGroupCount = 0;
          for (var i2 = 1; i2 < searchLen; ++i2) {
            if (matchesBest[i2] - matchesBest[i2 - 1] !== 1) {
              score -= matchesBest[i2];
              ++extraMatchGroupCount;
            }
          }
          var unmatchedDistance = matchesBest[searchLen - 1] - matchesBest[0] - (searchLen - 1);
          score -= (12 + unmatchedDistance) * extraMatchGroupCount;
          if (matchesBest[0] !== 0)
            score -= matchesBest[0] * matchesBest[0] * 0.2;
          if (!successStrict) {
            score *= 1e3;
          } else {
            var uniqueBeginningIndexes = 1;
            for (var i2 = nextBeginningIndexes[0]; i2 < targetLen; i2 = nextBeginningIndexes[i2])
              ++uniqueBeginningIndexes;
            if (uniqueBeginningIndexes > 24)
              score *= (uniqueBeginningIndexes - 24) * 10;
          }
          if (isSubstring)
            score /= 1 + searchLen * searchLen * 1;
          if (isSubstringBeginning)
            score /= 1 + searchLen * searchLen * 1;
          score -= targetLen - searchLen;
          prepared.score = score;
          for (var i2 = 0; i2 < matchesBestLen; ++i2)
            prepared._indexes[i2] = matchesBest[i2];
          prepared._indexes.len = matchesBestLen;
          return prepared;
        }
      };
      var algorithmSpaces = (preparedSearch, target) => {
        var seen_indexes = /* @__PURE__ */ new Set();
        var score = 0;
        var result = NULL;
        var first_seen_index_last_search = 0;
        var searches = preparedSearch.spaceSearches;
        for (var i2 = 0; i2 < searches.length; ++i2) {
          var search = searches[i2];
          result = algorithm(search, target);
          if (result === NULL)
            return NULL;
          score += result.score;
          if (result._indexes[0] < first_seen_index_last_search) {
            score -= first_seen_index_last_search - result._indexes[0];
          }
          first_seen_index_last_search = result._indexes[0];
          for (var j2 = 0; j2 < result._indexes.len; ++j2)
            seen_indexes.add(result._indexes[j2]);
        }
        var allowSpacesResult = algorithm(
          preparedSearch,
          target,
          /*allowSpaces=*/
          true
        );
        if (allowSpacesResult !== NULL && allowSpacesResult.score > score) {
          return allowSpacesResult;
        }
        result.score = score;
        var i2 = 0;
        for (let index of seen_indexes)
          result._indexes[i2++] = index;
        result._indexes.len = i2;
        return result;
      };
      var prepareLowerInfo = (str) => {
        var strLen = str.length;
        var lower = str.toLowerCase();
        var lowerCodes = [];
        var bitflags = 0;
        var containsSpace = false;
        for (var i2 = 0; i2 < strLen; ++i2) {
          var lowerCode = lowerCodes[i2] = lower.charCodeAt(i2);
          if (lowerCode === 32) {
            containsSpace = true;
            continue;
          }
          var bit = lowerCode >= 97 && lowerCode <= 122 ? lowerCode - 97 : lowerCode >= 48 && lowerCode <= 57 ? 26 : lowerCode <= 127 ? 30 : 31;
          bitflags |= 1 << bit;
        }
        return { lowerCodes, bitflags, containsSpace, _lower: lower };
      };
      var prepareBeginningIndexes = (target) => {
        var targetLen = target.length;
        var beginningIndexes = [];
        var beginningIndexesLen = 0;
        var wasUpper = false;
        var wasAlphanum = false;
        for (var i2 = 0; i2 < targetLen; ++i2) {
          var targetCode = target.charCodeAt(i2);
          var isUpper = targetCode >= 65 && targetCode <= 90;
          var isAlphanum = isUpper || targetCode >= 97 && targetCode <= 122 || targetCode >= 48 && targetCode <= 57;
          var isBeginning = isUpper && !wasUpper || !wasAlphanum || !isAlphanum;
          wasUpper = isUpper;
          wasAlphanum = isAlphanum;
          if (isBeginning)
            beginningIndexes[beginningIndexesLen++] = i2;
        }
        return beginningIndexes;
      };
      var prepareNextBeginningIndexes = (target) => {
        var targetLen = target.length;
        var beginningIndexes = prepareBeginningIndexes(target);
        var nextBeginningIndexes = [];
        var lastIsBeginning = beginningIndexes[0];
        var lastIsBeginningI = 0;
        for (var i2 = 0; i2 < targetLen; ++i2) {
          if (lastIsBeginning > i2) {
            nextBeginningIndexes[i2] = lastIsBeginning;
          } else {
            lastIsBeginning = beginningIndexes[++lastIsBeginningI];
            nextBeginningIndexes[i2] = lastIsBeginning === void 0 ? targetLen : lastIsBeginning;
          }
        }
        return nextBeginningIndexes;
      };
      var cleanup = () => {
        preparedCache.clear();
        preparedSearchCache.clear();
        matchesSimple = [];
        matchesStrict = [];
      };
      var preparedCache = /* @__PURE__ */ new Map();
      var preparedSearchCache = /* @__PURE__ */ new Map();
      var matchesSimple = [];
      var matchesStrict = [];
      var defaultScoreFn = (a2) => {
        var max2 = INT_MIN;
        var len = a2.length;
        for (var i2 = 0; i2 < len; ++i2) {
          var result = a2[i2];
          if (result === NULL)
            continue;
          var score = result.score;
          if (score > max2)
            max2 = score;
        }
        if (max2 === INT_MIN)
          return NULL;
        return max2;
      };
      var getValue2 = (obj, prop) => {
        var tmp = obj[prop];
        if (tmp !== void 0)
          return tmp;
        var segs = prop;
        if (!Array.isArray(prop))
          segs = prop.split(".");
        var len = segs.length;
        var i2 = -1;
        while (obj && ++i2 < len)
          obj = obj[segs[i2]];
        return obj;
      };
      var isObj = (x2) => {
        return typeof x2 === "object";
      };
      var INT_MAX = Infinity;
      var INT_MIN = -INT_MAX;
      var noResults = [];
      noResults.total = 0;
      var NULL = null;
      var fastpriorityqueue = (r2) => {
        var e = [], o2 = 0, a2 = {}, v2 = (r3) => {
          for (var a3 = 0, v3 = e[a3], c2 = 1; c2 < o2; ) {
            var s2 = c2 + 1;
            a3 = c2, s2 < o2 && e[s2].score < e[c2].score && (a3 = s2), e[a3 - 1 >> 1] = e[a3], c2 = 1 + (a3 << 1);
          }
          for (var f3 = a3 - 1 >> 1; a3 > 0 && v3.score < e[f3].score; f3 = (a3 = f3) - 1 >> 1)
            e[a3] = e[f3];
          e[a3] = v3;
        };
        return a2.add = (r3) => {
          var a3 = o2;
          e[o2++] = r3;
          for (var v3 = a3 - 1 >> 1; a3 > 0 && r3.score < e[v3].score; v3 = (a3 = v3) - 1 >> 1)
            e[a3] = e[v3];
          e[a3] = r3;
        }, a2.poll = (r3) => {
          if (0 !== o2) {
            var a3 = e[0];
            return e[0] = e[--o2], v2(), a3;
          }
        }, a2.peek = (r3) => {
          if (0 !== o2)
            return e[0];
        }, a2.replaceTop = (r3) => {
          e[0] = r3, v2();
        }, a2;
      };
      var q2 = fastpriorityqueue();
      return { "single": single, "go": go, "highlight": highlight, "prepare": prepare, "indexes": indexes, "cleanup": cleanup };
    });
  }
});

// node_modules/dayjs/dayjs.min.js
var require_dayjs_min = __commonJS({
  "node_modules/dayjs/dayjs.min.js"(exports, module2) {
    !function(t2, e) {
      "object" == typeof exports && "undefined" != typeof module2 ? module2.exports = e() : "function" == typeof define && define.amd ? define(e) : (t2 = "undefined" != typeof globalThis ? globalThis : t2 || self).dayjs = e();
    }(exports, function() {
      "use strict";
      var t2 = 1e3, e = 6e4, n2 = 36e5, r2 = "millisecond", i2 = "second", s2 = "minute", u2 = "hour", a2 = "day", o2 = "week", c2 = "month", f3 = "quarter", h2 = "year", d2 = "date", l2 = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y2 = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M2 = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t3) {
        var e2 = ["th", "st", "nd", "rd"], n3 = t3 % 100;
        return "[" + t3 + (e2[(n3 - 20) % 10] || e2[n3] || e2[0]) + "]";
      } }, m2 = function(t3, e2, n3) {
        var r3 = String(t3);
        return !r3 || r3.length >= e2 ? t3 : "" + Array(e2 + 1 - r3.length).join(n3) + t3;
      }, v2 = { s: m2, z: function(t3) {
        var e2 = -t3.utcOffset(), n3 = Math.abs(e2), r3 = Math.floor(n3 / 60), i3 = n3 % 60;
        return (e2 <= 0 ? "+" : "-") + m2(r3, 2, "0") + ":" + m2(i3, 2, "0");
      }, m: function t3(e2, n3) {
        if (e2.date() < n3.date())
          return -t3(n3, e2);
        var r3 = 12 * (n3.year() - e2.year()) + (n3.month() - e2.month()), i3 = e2.clone().add(r3, c2), s3 = n3 - i3 < 0, u3 = e2.clone().add(r3 + (s3 ? -1 : 1), c2);
        return +(-(r3 + (n3 - i3) / (s3 ? i3 - u3 : u3 - i3)) || 0);
      }, a: function(t3) {
        return t3 < 0 ? Math.ceil(t3) || 0 : Math.floor(t3);
      }, p: function(t3) {
        return { M: c2, y: h2, w: o2, d: a2, D: d2, h: u2, m: s2, s: i2, ms: r2, Q: f3 }[t3] || String(t3 || "").toLowerCase().replace(/s$/, "");
      }, u: function(t3) {
        return void 0 === t3;
      } }, g2 = "en", D2 = {};
      D2[g2] = M2;
      var p2 = "$isDayjsObject", S2 = function(t3) {
        return t3 instanceof _7 || !(!t3 || !t3[p2]);
      }, w2 = function t3(e2, n3, r3) {
        var i3;
        if (!e2)
          return g2;
        if ("string" == typeof e2) {
          var s3 = e2.toLowerCase();
          D2[s3] && (i3 = s3), n3 && (D2[s3] = n3, i3 = s3);
          var u3 = e2.split("-");
          if (!i3 && u3.length > 1)
            return t3(u3[0]);
        } else {
          var a3 = e2.name;
          D2[a3] = e2, i3 = a3;
        }
        return !r3 && i3 && (g2 = i3), i3 || !r3 && g2;
      }, O2 = function(t3, e2) {
        if (S2(t3))
          return t3.clone();
        var n3 = "object" == typeof e2 ? e2 : {};
        return n3.date = t3, n3.args = arguments, new _7(n3);
      }, b2 = v2;
      b2.l = w2, b2.i = S2, b2.w = function(t3, e2) {
        return O2(t3, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
      };
      var _7 = function() {
        function M3(t3) {
          this.$L = w2(t3.locale, null, true), this.parse(t3), this.$x = this.$x || t3.x || {}, this[p2] = true;
        }
        var m3 = M3.prototype;
        return m3.parse = function(t3) {
          this.$d = function(t4) {
            var e2 = t4.date, n3 = t4.utc;
            if (null === e2)
              return /* @__PURE__ */ new Date(NaN);
            if (b2.u(e2))
              return /* @__PURE__ */ new Date();
            if (e2 instanceof Date)
              return new Date(e2);
            if ("string" == typeof e2 && !/Z$/i.test(e2)) {
              var r3 = e2.match($);
              if (r3) {
                var i3 = r3[2] - 1 || 0, s3 = (r3[7] || "0").substring(0, 3);
                return n3 ? new Date(Date.UTC(r3[1], i3, r3[3] || 1, r3[4] || 0, r3[5] || 0, r3[6] || 0, s3)) : new Date(r3[1], i3, r3[3] || 1, r3[4] || 0, r3[5] || 0, r3[6] || 0, s3);
              }
            }
            return new Date(e2);
          }(t3), this.init();
        }, m3.init = function() {
          var t3 = this.$d;
          this.$y = t3.getFullYear(), this.$M = t3.getMonth(), this.$D = t3.getDate(), this.$W = t3.getDay(), this.$H = t3.getHours(), this.$m = t3.getMinutes(), this.$s = t3.getSeconds(), this.$ms = t3.getMilliseconds();
        }, m3.$utils = function() {
          return b2;
        }, m3.isValid = function() {
          return !(this.$d.toString() === l2);
        }, m3.isSame = function(t3, e2) {
          var n3 = O2(t3);
          return this.startOf(e2) <= n3 && n3 <= this.endOf(e2);
        }, m3.isAfter = function(t3, e2) {
          return O2(t3) < this.startOf(e2);
        }, m3.isBefore = function(t3, e2) {
          return this.endOf(e2) < O2(t3);
        }, m3.$g = function(t3, e2, n3) {
          return b2.u(t3) ? this[e2] : this.set(n3, t3);
        }, m3.unix = function() {
          return Math.floor(this.valueOf() / 1e3);
        }, m3.valueOf = function() {
          return this.$d.getTime();
        }, m3.startOf = function(t3, e2) {
          var n3 = this, r3 = !!b2.u(e2) || e2, f4 = b2.p(t3), l3 = function(t4, e3) {
            var i3 = b2.w(n3.$u ? Date.UTC(n3.$y, e3, t4) : new Date(n3.$y, e3, t4), n3);
            return r3 ? i3 : i3.endOf(a2);
          }, $2 = function(t4, e3) {
            return b2.w(n3.toDate()[t4].apply(n3.toDate("s"), (r3 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n3);
          }, y3 = this.$W, M4 = this.$M, m4 = this.$D, v3 = "set" + (this.$u ? "UTC" : "");
          switch (f4) {
            case h2:
              return r3 ? l3(1, 0) : l3(31, 11);
            case c2:
              return r3 ? l3(1, M4) : l3(0, M4 + 1);
            case o2:
              var g3 = this.$locale().weekStart || 0, D3 = (y3 < g3 ? y3 + 7 : y3) - g3;
              return l3(r3 ? m4 - D3 : m4 + (6 - D3), M4);
            case a2:
            case d2:
              return $2(v3 + "Hours", 0);
            case u2:
              return $2(v3 + "Minutes", 1);
            case s2:
              return $2(v3 + "Seconds", 2);
            case i2:
              return $2(v3 + "Milliseconds", 3);
            default:
              return this.clone();
          }
        }, m3.endOf = function(t3) {
          return this.startOf(t3, false);
        }, m3.$set = function(t3, e2) {
          var n3, o3 = b2.p(t3), f4 = "set" + (this.$u ? "UTC" : ""), l3 = (n3 = {}, n3[a2] = f4 + "Date", n3[d2] = f4 + "Date", n3[c2] = f4 + "Month", n3[h2] = f4 + "FullYear", n3[u2] = f4 + "Hours", n3[s2] = f4 + "Minutes", n3[i2] = f4 + "Seconds", n3[r2] = f4 + "Milliseconds", n3)[o3], $2 = o3 === a2 ? this.$D + (e2 - this.$W) : e2;
          if (o3 === c2 || o3 === h2) {
            var y3 = this.clone().set(d2, 1);
            y3.$d[l3]($2), y3.init(), this.$d = y3.set(d2, Math.min(this.$D, y3.daysInMonth())).$d;
          } else
            l3 && this.$d[l3]($2);
          return this.init(), this;
        }, m3.set = function(t3, e2) {
          return this.clone().$set(t3, e2);
        }, m3.get = function(t3) {
          return this[b2.p(t3)]();
        }, m3.add = function(r3, f4) {
          var d3, l3 = this;
          r3 = Number(r3);
          var $2 = b2.p(f4), y3 = function(t3) {
            var e2 = O2(l3);
            return b2.w(e2.date(e2.date() + Math.round(t3 * r3)), l3);
          };
          if ($2 === c2)
            return this.set(c2, this.$M + r3);
          if ($2 === h2)
            return this.set(h2, this.$y + r3);
          if ($2 === a2)
            return y3(1);
          if ($2 === o2)
            return y3(7);
          var M4 = (d3 = {}, d3[s2] = e, d3[u2] = n2, d3[i2] = t2, d3)[$2] || 1, m4 = this.$d.getTime() + r3 * M4;
          return b2.w(m4, this);
        }, m3.subtract = function(t3, e2) {
          return this.add(-1 * t3, e2);
        }, m3.format = function(t3) {
          var e2 = this, n3 = this.$locale();
          if (!this.isValid())
            return n3.invalidDate || l2;
          var r3 = t3 || "YYYY-MM-DDTHH:mm:ssZ", i3 = b2.z(this), s3 = this.$H, u3 = this.$m, a3 = this.$M, o3 = n3.weekdays, c3 = n3.months, f4 = n3.meridiem, h3 = function(t4, n4, i4, s4) {
            return t4 && (t4[n4] || t4(e2, r3)) || i4[n4].slice(0, s4);
          }, d3 = function(t4) {
            return b2.s(s3 % 12 || 12, t4, "0");
          }, $2 = f4 || function(t4, e3, n4) {
            var r4 = t4 < 12 ? "AM" : "PM";
            return n4 ? r4.toLowerCase() : r4;
          };
          return r3.replace(y2, function(t4, r4) {
            return r4 || function(t5) {
              switch (t5) {
                case "YY":
                  return String(e2.$y).slice(-2);
                case "YYYY":
                  return b2.s(e2.$y, 4, "0");
                case "M":
                  return a3 + 1;
                case "MM":
                  return b2.s(a3 + 1, 2, "0");
                case "MMM":
                  return h3(n3.monthsShort, a3, c3, 3);
                case "MMMM":
                  return h3(c3, a3);
                case "D":
                  return e2.$D;
                case "DD":
                  return b2.s(e2.$D, 2, "0");
                case "d":
                  return String(e2.$W);
                case "dd":
                  return h3(n3.weekdaysMin, e2.$W, o3, 2);
                case "ddd":
                  return h3(n3.weekdaysShort, e2.$W, o3, 3);
                case "dddd":
                  return o3[e2.$W];
                case "H":
                  return String(s3);
                case "HH":
                  return b2.s(s3, 2, "0");
                case "h":
                  return d3(1);
                case "hh":
                  return d3(2);
                case "a":
                  return $2(s3, u3, true);
                case "A":
                  return $2(s3, u3, false);
                case "m":
                  return String(u3);
                case "mm":
                  return b2.s(u3, 2, "0");
                case "s":
                  return String(e2.$s);
                case "ss":
                  return b2.s(e2.$s, 2, "0");
                case "SSS":
                  return b2.s(e2.$ms, 3, "0");
                case "Z":
                  return i3;
              }
              return null;
            }(t4) || i3.replace(":", "");
          });
        }, m3.utcOffset = function() {
          return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
        }, m3.diff = function(r3, d3, l3) {
          var $2, y3 = this, M4 = b2.p(d3), m4 = O2(r3), v3 = (m4.utcOffset() - this.utcOffset()) * e, g3 = this - m4, D3 = function() {
            return b2.m(y3, m4);
          };
          switch (M4) {
            case h2:
              $2 = D3() / 12;
              break;
            case c2:
              $2 = D3();
              break;
            case f3:
              $2 = D3() / 3;
              break;
            case o2:
              $2 = (g3 - v3) / 6048e5;
              break;
            case a2:
              $2 = (g3 - v3) / 864e5;
              break;
            case u2:
              $2 = g3 / n2;
              break;
            case s2:
              $2 = g3 / e;
              break;
            case i2:
              $2 = g3 / t2;
              break;
            default:
              $2 = g3;
          }
          return l3 ? $2 : b2.a($2);
        }, m3.daysInMonth = function() {
          return this.endOf(c2).$D;
        }, m3.$locale = function() {
          return D2[this.$L];
        }, m3.locale = function(t3, e2) {
          if (!t3)
            return this.$L;
          var n3 = this.clone(), r3 = w2(t3, e2, true);
          return r3 && (n3.$L = r3), n3;
        }, m3.clone = function() {
          return b2.w(this.$d, this);
        }, m3.toDate = function() {
          return new Date(this.valueOf());
        }, m3.toJSON = function() {
          return this.isValid() ? this.toISOString() : null;
        }, m3.toISOString = function() {
          return this.$d.toISOString();
        }, m3.toString = function() {
          return this.$d.toUTCString();
        }, M3;
      }(), k2 = _7.prototype;
      return O2.prototype = k2, [["$ms", r2], ["$s", i2], ["$m", s2], ["$H", u2], ["$W", a2], ["$M", c2], ["$y", h2], ["$D", d2]].forEach(function(t3) {
        k2[t3[1]] = function(e2) {
          return this.$g(e2, t3[0], t3[1]);
        };
      }), O2.extend = function(t3, e2) {
        return t3.$i || (t3(e2, _7, O2), t3.$i = true), O2;
      }, O2.locale = w2, O2.isDayjs = S2, O2.unix = function(t3) {
        return O2(1e3 * t3);
      }, O2.en = D2[g2], O2.Ls = D2, O2.p = {}, O2;
    });
  }
});

// node_modules/dayjs/plugin/customParseFormat.js
var require_customParseFormat = __commonJS({
  "node_modules/dayjs/plugin/customParseFormat.js"(exports, module2) {
    !function(e, t2) {
      "object" == typeof exports && "undefined" != typeof module2 ? module2.exports = t2() : "function" == typeof define && define.amd ? define(t2) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_plugin_customParseFormat = t2();
    }(exports, function() {
      "use strict";
      var e = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }, t2 = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, n2 = /\d\d/, r2 = /\d\d?/, i2 = /\d*[^-_:/,()\s\d]+/, o2 = {}, s2 = function(e2) {
        return (e2 = +e2) + (e2 > 68 ? 1900 : 2e3);
      };
      var a2 = function(e2) {
        return function(t3) {
          this[e2] = +t3;
        };
      }, f3 = [/[+-]\d\d:?(\d\d)?|Z/, function(e2) {
        (this.zone || (this.zone = {})).offset = function(e3) {
          if (!e3)
            return 0;
          if ("Z" === e3)
            return 0;
          var t3 = e3.match(/([+-]|\d\d)/g), n3 = 60 * t3[1] + (+t3[2] || 0);
          return 0 === n3 ? 0 : "+" === t3[0] ? -n3 : n3;
        }(e2);
      }], h2 = function(e2) {
        var t3 = o2[e2];
        return t3 && (t3.indexOf ? t3 : t3.s.concat(t3.f));
      }, u2 = function(e2, t3) {
        var n3, r3 = o2.meridiem;
        if (r3) {
          for (var i3 = 1; i3 <= 24; i3 += 1)
            if (e2.indexOf(r3(i3, 0, t3)) > -1) {
              n3 = i3 > 12;
              break;
            }
        } else
          n3 = e2 === (t3 ? "pm" : "PM");
        return n3;
      }, d2 = { A: [i2, function(e2) {
        this.afternoon = u2(e2, false);
      }], a: [i2, function(e2) {
        this.afternoon = u2(e2, true);
      }], S: [/\d/, function(e2) {
        this.milliseconds = 100 * +e2;
      }], SS: [n2, function(e2) {
        this.milliseconds = 10 * +e2;
      }], SSS: [/\d{3}/, function(e2) {
        this.milliseconds = +e2;
      }], s: [r2, a2("seconds")], ss: [r2, a2("seconds")], m: [r2, a2("minutes")], mm: [r2, a2("minutes")], H: [r2, a2("hours")], h: [r2, a2("hours")], HH: [r2, a2("hours")], hh: [r2, a2("hours")], D: [r2, a2("day")], DD: [n2, a2("day")], Do: [i2, function(e2) {
        var t3 = o2.ordinal, n3 = e2.match(/\d+/);
        if (this.day = n3[0], t3)
          for (var r3 = 1; r3 <= 31; r3 += 1)
            t3(r3).replace(/\[|\]/g, "") === e2 && (this.day = r3);
      }], M: [r2, a2("month")], MM: [n2, a2("month")], MMM: [i2, function(e2) {
        var t3 = h2("months"), n3 = (h2("monthsShort") || t3.map(function(e3) {
          return e3.slice(0, 3);
        })).indexOf(e2) + 1;
        if (n3 < 1)
          throw new Error();
        this.month = n3 % 12 || n3;
      }], MMMM: [i2, function(e2) {
        var t3 = h2("months").indexOf(e2) + 1;
        if (t3 < 1)
          throw new Error();
        this.month = t3 % 12 || t3;
      }], Y: [/[+-]?\d+/, a2("year")], YY: [n2, function(e2) {
        this.year = s2(e2);
      }], YYYY: [/\d{4}/, a2("year")], Z: f3, ZZ: f3 };
      function c2(n3) {
        var r3, i3;
        r3 = n3, i3 = o2 && o2.formats;
        for (var s3 = (n3 = r3.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(t3, n4, r4) {
          var o3 = r4 && r4.toUpperCase();
          return n4 || i3[r4] || e[r4] || i3[o3].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(e2, t4, n5) {
            return t4 || n5.slice(1);
          });
        })).match(t2), a3 = s3.length, f4 = 0; f4 < a3; f4 += 1) {
          var h3 = s3[f4], u3 = d2[h3], c3 = u3 && u3[0], l2 = u3 && u3[1];
          s3[f4] = l2 ? { regex: c3, parser: l2 } : h3.replace(/^\[|\]$/g, "");
        }
        return function(e2) {
          for (var t3 = {}, n4 = 0, r4 = 0; n4 < a3; n4 += 1) {
            var i4 = s3[n4];
            if ("string" == typeof i4)
              r4 += i4.length;
            else {
              var o3 = i4.regex, f5 = i4.parser, h4 = e2.slice(r4), u4 = o3.exec(h4)[0];
              f5.call(t3, u4), e2 = e2.replace(u4, "");
            }
          }
          return function(e3) {
            var t4 = e3.afternoon;
            if (void 0 !== t4) {
              var n5 = e3.hours;
              t4 ? n5 < 12 && (e3.hours += 12) : 12 === n5 && (e3.hours = 0), delete e3.afternoon;
            }
          }(t3), t3;
        };
      }
      return function(e2, t3, n3) {
        n3.p.customParseFormat = true, e2 && e2.parseTwoDigitYear && (s2 = e2.parseTwoDigitYear);
        var r3 = t3.prototype, i3 = r3.parse;
        r3.parse = function(e3) {
          var t4 = e3.date, r4 = e3.utc, s3 = e3.args;
          this.$u = r4;
          var a3 = s3[1];
          if ("string" == typeof a3) {
            var f4 = true === s3[2], h3 = true === s3[3], u3 = f4 || h3, d3 = s3[2];
            h3 && (d3 = s3[2]), o2 = this.$locale(), !f4 && d3 && (o2 = n3.Ls[d3]), this.$d = function(e4, t5, n4) {
              try {
                if (["x", "X"].indexOf(t5) > -1)
                  return new Date(("X" === t5 ? 1e3 : 1) * e4);
                var r5 = c2(t5)(e4), i4 = r5.year, o3 = r5.month, s4 = r5.day, a4 = r5.hours, f5 = r5.minutes, h4 = r5.seconds, u4 = r5.milliseconds, d4 = r5.zone, l3 = /* @__PURE__ */ new Date(), m3 = s4 || (i4 || o3 ? 1 : l3.getDate()), M3 = i4 || l3.getFullYear(), Y2 = 0;
                i4 && !o3 || (Y2 = o3 > 0 ? o3 - 1 : l3.getMonth());
                var p2 = a4 || 0, v2 = f5 || 0, D2 = h4 || 0, g2 = u4 || 0;
                return d4 ? new Date(Date.UTC(M3, Y2, m3, p2, v2, D2, g2 + 60 * d4.offset * 1e3)) : n4 ? new Date(Date.UTC(M3, Y2, m3, p2, v2, D2, g2)) : new Date(M3, Y2, m3, p2, v2, D2, g2);
              } catch (e5) {
                return /* @__PURE__ */ new Date("");
              }
            }(t4, a3, r4), this.init(), d3 && true !== d3 && (this.$L = this.locale(d3).$L), u3 && t4 != this.format(a3) && (this.$d = /* @__PURE__ */ new Date("")), o2 = {};
          } else if (a3 instanceof Array)
            for (var l2 = a3.length, m2 = 1; m2 <= l2; m2 += 1) {
              s3[1] = a3[m2 - 1];
              var M2 = n3.apply(this, s3);
              if (M2.isValid()) {
                this.$d = M2.$d, this.$L = M2.$L, this.init();
                break;
              }
              m2 === l2 && (this.$d = /* @__PURE__ */ new Date(""));
            }
          else
            i3.call(this, e3);
        };
      };
    });
  }
});

// node_modules/markdown-it/node_modules/entities/lib/maps/entities.json
var require_entities = __commonJS({
  "node_modules/markdown-it/node_modules/entities/lib/maps/entities.json"(exports, module2) {
    module2.exports = { Aacute: "\xC1", aacute: "\xE1", Abreve: "\u0102", abreve: "\u0103", ac: "\u223E", acd: "\u223F", acE: "\u223E\u0333", Acirc: "\xC2", acirc: "\xE2", acute: "\xB4", Acy: "\u0410", acy: "\u0430", AElig: "\xC6", aelig: "\xE6", af: "\u2061", Afr: "\u{1D504}", afr: "\u{1D51E}", Agrave: "\xC0", agrave: "\xE0", alefsym: "\u2135", aleph: "\u2135", Alpha: "\u0391", alpha: "\u03B1", Amacr: "\u0100", amacr: "\u0101", amalg: "\u2A3F", amp: "&", AMP: "&", andand: "\u2A55", And: "\u2A53", and: "\u2227", andd: "\u2A5C", andslope: "\u2A58", andv: "\u2A5A", ang: "\u2220", ange: "\u29A4", angle: "\u2220", angmsdaa: "\u29A8", angmsdab: "\u29A9", angmsdac: "\u29AA", angmsdad: "\u29AB", angmsdae: "\u29AC", angmsdaf: "\u29AD", angmsdag: "\u29AE", angmsdah: "\u29AF", angmsd: "\u2221", angrt: "\u221F", angrtvb: "\u22BE", angrtvbd: "\u299D", angsph: "\u2222", angst: "\xC5", angzarr: "\u237C", Aogon: "\u0104", aogon: "\u0105", Aopf: "\u{1D538}", aopf: "\u{1D552}", apacir: "\u2A6F", ap: "\u2248", apE: "\u2A70", ape: "\u224A", apid: "\u224B", apos: "'", ApplyFunction: "\u2061", approx: "\u2248", approxeq: "\u224A", Aring: "\xC5", aring: "\xE5", Ascr: "\u{1D49C}", ascr: "\u{1D4B6}", Assign: "\u2254", ast: "*", asymp: "\u2248", asympeq: "\u224D", Atilde: "\xC3", atilde: "\xE3", Auml: "\xC4", auml: "\xE4", awconint: "\u2233", awint: "\u2A11", backcong: "\u224C", backepsilon: "\u03F6", backprime: "\u2035", backsim: "\u223D", backsimeq: "\u22CD", Backslash: "\u2216", Barv: "\u2AE7", barvee: "\u22BD", barwed: "\u2305", Barwed: "\u2306", barwedge: "\u2305", bbrk: "\u23B5", bbrktbrk: "\u23B6", bcong: "\u224C", Bcy: "\u0411", bcy: "\u0431", bdquo: "\u201E", becaus: "\u2235", because: "\u2235", Because: "\u2235", bemptyv: "\u29B0", bepsi: "\u03F6", bernou: "\u212C", Bernoullis: "\u212C", Beta: "\u0392", beta: "\u03B2", beth: "\u2136", between: "\u226C", Bfr: "\u{1D505}", bfr: "\u{1D51F}", bigcap: "\u22C2", bigcirc: "\u25EF", bigcup: "\u22C3", bigodot: "\u2A00", bigoplus: "\u2A01", bigotimes: "\u2A02", bigsqcup: "\u2A06", bigstar: "\u2605", bigtriangledown: "\u25BD", bigtriangleup: "\u25B3", biguplus: "\u2A04", bigvee: "\u22C1", bigwedge: "\u22C0", bkarow: "\u290D", blacklozenge: "\u29EB", blacksquare: "\u25AA", blacktriangle: "\u25B4", blacktriangledown: "\u25BE", blacktriangleleft: "\u25C2", blacktriangleright: "\u25B8", blank: "\u2423", blk12: "\u2592", blk14: "\u2591", blk34: "\u2593", block: "\u2588", bne: "=\u20E5", bnequiv: "\u2261\u20E5", bNot: "\u2AED", bnot: "\u2310", Bopf: "\u{1D539}", bopf: "\u{1D553}", bot: "\u22A5", bottom: "\u22A5", bowtie: "\u22C8", boxbox: "\u29C9", boxdl: "\u2510", boxdL: "\u2555", boxDl: "\u2556", boxDL: "\u2557", boxdr: "\u250C", boxdR: "\u2552", boxDr: "\u2553", boxDR: "\u2554", boxh: "\u2500", boxH: "\u2550", boxhd: "\u252C", boxHd: "\u2564", boxhD: "\u2565", boxHD: "\u2566", boxhu: "\u2534", boxHu: "\u2567", boxhU: "\u2568", boxHU: "\u2569", boxminus: "\u229F", boxplus: "\u229E", boxtimes: "\u22A0", boxul: "\u2518", boxuL: "\u255B", boxUl: "\u255C", boxUL: "\u255D", boxur: "\u2514", boxuR: "\u2558", boxUr: "\u2559", boxUR: "\u255A", boxv: "\u2502", boxV: "\u2551", boxvh: "\u253C", boxvH: "\u256A", boxVh: "\u256B", boxVH: "\u256C", boxvl: "\u2524", boxvL: "\u2561", boxVl: "\u2562", boxVL: "\u2563", boxvr: "\u251C", boxvR: "\u255E", boxVr: "\u255F", boxVR: "\u2560", bprime: "\u2035", breve: "\u02D8", Breve: "\u02D8", brvbar: "\xA6", bscr: "\u{1D4B7}", Bscr: "\u212C", bsemi: "\u204F", bsim: "\u223D", bsime: "\u22CD", bsolb: "\u29C5", bsol: "\\", bsolhsub: "\u27C8", bull: "\u2022", bullet: "\u2022", bump: "\u224E", bumpE: "\u2AAE", bumpe: "\u224F", Bumpeq: "\u224E", bumpeq: "\u224F", Cacute: "\u0106", cacute: "\u0107", capand: "\u2A44", capbrcup: "\u2A49", capcap: "\u2A4B", cap: "\u2229", Cap: "\u22D2", capcup: "\u2A47", capdot: "\u2A40", CapitalDifferentialD: "\u2145", caps: "\u2229\uFE00", caret: "\u2041", caron: "\u02C7", Cayleys: "\u212D", ccaps: "\u2A4D", Ccaron: "\u010C", ccaron: "\u010D", Ccedil: "\xC7", ccedil: "\xE7", Ccirc: "\u0108", ccirc: "\u0109", Cconint: "\u2230", ccups: "\u2A4C", ccupssm: "\u2A50", Cdot: "\u010A", cdot: "\u010B", cedil: "\xB8", Cedilla: "\xB8", cemptyv: "\u29B2", cent: "\xA2", centerdot: "\xB7", CenterDot: "\xB7", cfr: "\u{1D520}", Cfr: "\u212D", CHcy: "\u0427", chcy: "\u0447", check: "\u2713", checkmark: "\u2713", Chi: "\u03A7", chi: "\u03C7", circ: "\u02C6", circeq: "\u2257", circlearrowleft: "\u21BA", circlearrowright: "\u21BB", circledast: "\u229B", circledcirc: "\u229A", circleddash: "\u229D", CircleDot: "\u2299", circledR: "\xAE", circledS: "\u24C8", CircleMinus: "\u2296", CirclePlus: "\u2295", CircleTimes: "\u2297", cir: "\u25CB", cirE: "\u29C3", cire: "\u2257", cirfnint: "\u2A10", cirmid: "\u2AEF", cirscir: "\u29C2", ClockwiseContourIntegral: "\u2232", CloseCurlyDoubleQuote: "\u201D", CloseCurlyQuote: "\u2019", clubs: "\u2663", clubsuit: "\u2663", colon: ":", Colon: "\u2237", Colone: "\u2A74", colone: "\u2254", coloneq: "\u2254", comma: ",", commat: "@", comp: "\u2201", compfn: "\u2218", complement: "\u2201", complexes: "\u2102", cong: "\u2245", congdot: "\u2A6D", Congruent: "\u2261", conint: "\u222E", Conint: "\u222F", ContourIntegral: "\u222E", copf: "\u{1D554}", Copf: "\u2102", coprod: "\u2210", Coproduct: "\u2210", copy: "\xA9", COPY: "\xA9", copysr: "\u2117", CounterClockwiseContourIntegral: "\u2233", crarr: "\u21B5", cross: "\u2717", Cross: "\u2A2F", Cscr: "\u{1D49E}", cscr: "\u{1D4B8}", csub: "\u2ACF", csube: "\u2AD1", csup: "\u2AD0", csupe: "\u2AD2", ctdot: "\u22EF", cudarrl: "\u2938", cudarrr: "\u2935", cuepr: "\u22DE", cuesc: "\u22DF", cularr: "\u21B6", cularrp: "\u293D", cupbrcap: "\u2A48", cupcap: "\u2A46", CupCap: "\u224D", cup: "\u222A", Cup: "\u22D3", cupcup: "\u2A4A", cupdot: "\u228D", cupor: "\u2A45", cups: "\u222A\uFE00", curarr: "\u21B7", curarrm: "\u293C", curlyeqprec: "\u22DE", curlyeqsucc: "\u22DF", curlyvee: "\u22CE", curlywedge: "\u22CF", curren: "\xA4", curvearrowleft: "\u21B6", curvearrowright: "\u21B7", cuvee: "\u22CE", cuwed: "\u22CF", cwconint: "\u2232", cwint: "\u2231", cylcty: "\u232D", dagger: "\u2020", Dagger: "\u2021", daleth: "\u2138", darr: "\u2193", Darr: "\u21A1", dArr: "\u21D3", dash: "\u2010", Dashv: "\u2AE4", dashv: "\u22A3", dbkarow: "\u290F", dblac: "\u02DD", Dcaron: "\u010E", dcaron: "\u010F", Dcy: "\u0414", dcy: "\u0434", ddagger: "\u2021", ddarr: "\u21CA", DD: "\u2145", dd: "\u2146", DDotrahd: "\u2911", ddotseq: "\u2A77", deg: "\xB0", Del: "\u2207", Delta: "\u0394", delta: "\u03B4", demptyv: "\u29B1", dfisht: "\u297F", Dfr: "\u{1D507}", dfr: "\u{1D521}", dHar: "\u2965", dharl: "\u21C3", dharr: "\u21C2", DiacriticalAcute: "\xB4", DiacriticalDot: "\u02D9", DiacriticalDoubleAcute: "\u02DD", DiacriticalGrave: "`", DiacriticalTilde: "\u02DC", diam: "\u22C4", diamond: "\u22C4", Diamond: "\u22C4", diamondsuit: "\u2666", diams: "\u2666", die: "\xA8", DifferentialD: "\u2146", digamma: "\u03DD", disin: "\u22F2", div: "\xF7", divide: "\xF7", divideontimes: "\u22C7", divonx: "\u22C7", DJcy: "\u0402", djcy: "\u0452", dlcorn: "\u231E", dlcrop: "\u230D", dollar: "$", Dopf: "\u{1D53B}", dopf: "\u{1D555}", Dot: "\xA8", dot: "\u02D9", DotDot: "\u20DC", doteq: "\u2250", doteqdot: "\u2251", DotEqual: "\u2250", dotminus: "\u2238", dotplus: "\u2214", dotsquare: "\u22A1", doublebarwedge: "\u2306", DoubleContourIntegral: "\u222F", DoubleDot: "\xA8", DoubleDownArrow: "\u21D3", DoubleLeftArrow: "\u21D0", DoubleLeftRightArrow: "\u21D4", DoubleLeftTee: "\u2AE4", DoubleLongLeftArrow: "\u27F8", DoubleLongLeftRightArrow: "\u27FA", DoubleLongRightArrow: "\u27F9", DoubleRightArrow: "\u21D2", DoubleRightTee: "\u22A8", DoubleUpArrow: "\u21D1", DoubleUpDownArrow: "\u21D5", DoubleVerticalBar: "\u2225", DownArrowBar: "\u2913", downarrow: "\u2193", DownArrow: "\u2193", Downarrow: "\u21D3", DownArrowUpArrow: "\u21F5", DownBreve: "\u0311", downdownarrows: "\u21CA", downharpoonleft: "\u21C3", downharpoonright: "\u21C2", DownLeftRightVector: "\u2950", DownLeftTeeVector: "\u295E", DownLeftVectorBar: "\u2956", DownLeftVector: "\u21BD", DownRightTeeVector: "\u295F", DownRightVectorBar: "\u2957", DownRightVector: "\u21C1", DownTeeArrow: "\u21A7", DownTee: "\u22A4", drbkarow: "\u2910", drcorn: "\u231F", drcrop: "\u230C", Dscr: "\u{1D49F}", dscr: "\u{1D4B9}", DScy: "\u0405", dscy: "\u0455", dsol: "\u29F6", Dstrok: "\u0110", dstrok: "\u0111", dtdot: "\u22F1", dtri: "\u25BF", dtrif: "\u25BE", duarr: "\u21F5", duhar: "\u296F", dwangle: "\u29A6", DZcy: "\u040F", dzcy: "\u045F", dzigrarr: "\u27FF", Eacute: "\xC9", eacute: "\xE9", easter: "\u2A6E", Ecaron: "\u011A", ecaron: "\u011B", Ecirc: "\xCA", ecirc: "\xEA", ecir: "\u2256", ecolon: "\u2255", Ecy: "\u042D", ecy: "\u044D", eDDot: "\u2A77", Edot: "\u0116", edot: "\u0117", eDot: "\u2251", ee: "\u2147", efDot: "\u2252", Efr: "\u{1D508}", efr: "\u{1D522}", eg: "\u2A9A", Egrave: "\xC8", egrave: "\xE8", egs: "\u2A96", egsdot: "\u2A98", el: "\u2A99", Element: "\u2208", elinters: "\u23E7", ell: "\u2113", els: "\u2A95", elsdot: "\u2A97", Emacr: "\u0112", emacr: "\u0113", empty: "\u2205", emptyset: "\u2205", EmptySmallSquare: "\u25FB", emptyv: "\u2205", EmptyVerySmallSquare: "\u25AB", emsp13: "\u2004", emsp14: "\u2005", emsp: "\u2003", ENG: "\u014A", eng: "\u014B", ensp: "\u2002", Eogon: "\u0118", eogon: "\u0119", Eopf: "\u{1D53C}", eopf: "\u{1D556}", epar: "\u22D5", eparsl: "\u29E3", eplus: "\u2A71", epsi: "\u03B5", Epsilon: "\u0395", epsilon: "\u03B5", epsiv: "\u03F5", eqcirc: "\u2256", eqcolon: "\u2255", eqsim: "\u2242", eqslantgtr: "\u2A96", eqslantless: "\u2A95", Equal: "\u2A75", equals: "=", EqualTilde: "\u2242", equest: "\u225F", Equilibrium: "\u21CC", equiv: "\u2261", equivDD: "\u2A78", eqvparsl: "\u29E5", erarr: "\u2971", erDot: "\u2253", escr: "\u212F", Escr: "\u2130", esdot: "\u2250", Esim: "\u2A73", esim: "\u2242", Eta: "\u0397", eta: "\u03B7", ETH: "\xD0", eth: "\xF0", Euml: "\xCB", euml: "\xEB", euro: "\u20AC", excl: "!", exist: "\u2203", Exists: "\u2203", expectation: "\u2130", exponentiale: "\u2147", ExponentialE: "\u2147", fallingdotseq: "\u2252", Fcy: "\u0424", fcy: "\u0444", female: "\u2640", ffilig: "\uFB03", fflig: "\uFB00", ffllig: "\uFB04", Ffr: "\u{1D509}", ffr: "\u{1D523}", filig: "\uFB01", FilledSmallSquare: "\u25FC", FilledVerySmallSquare: "\u25AA", fjlig: "fj", flat: "\u266D", fllig: "\uFB02", fltns: "\u25B1", fnof: "\u0192", Fopf: "\u{1D53D}", fopf: "\u{1D557}", forall: "\u2200", ForAll: "\u2200", fork: "\u22D4", forkv: "\u2AD9", Fouriertrf: "\u2131", fpartint: "\u2A0D", frac12: "\xBD", frac13: "\u2153", frac14: "\xBC", frac15: "\u2155", frac16: "\u2159", frac18: "\u215B", frac23: "\u2154", frac25: "\u2156", frac34: "\xBE", frac35: "\u2157", frac38: "\u215C", frac45: "\u2158", frac56: "\u215A", frac58: "\u215D", frac78: "\u215E", frasl: "\u2044", frown: "\u2322", fscr: "\u{1D4BB}", Fscr: "\u2131", gacute: "\u01F5", Gamma: "\u0393", gamma: "\u03B3", Gammad: "\u03DC", gammad: "\u03DD", gap: "\u2A86", Gbreve: "\u011E", gbreve: "\u011F", Gcedil: "\u0122", Gcirc: "\u011C", gcirc: "\u011D", Gcy: "\u0413", gcy: "\u0433", Gdot: "\u0120", gdot: "\u0121", ge: "\u2265", gE: "\u2267", gEl: "\u2A8C", gel: "\u22DB", geq: "\u2265", geqq: "\u2267", geqslant: "\u2A7E", gescc: "\u2AA9", ges: "\u2A7E", gesdot: "\u2A80", gesdoto: "\u2A82", gesdotol: "\u2A84", gesl: "\u22DB\uFE00", gesles: "\u2A94", Gfr: "\u{1D50A}", gfr: "\u{1D524}", gg: "\u226B", Gg: "\u22D9", ggg: "\u22D9", gimel: "\u2137", GJcy: "\u0403", gjcy: "\u0453", gla: "\u2AA5", gl: "\u2277", glE: "\u2A92", glj: "\u2AA4", gnap: "\u2A8A", gnapprox: "\u2A8A", gne: "\u2A88", gnE: "\u2269", gneq: "\u2A88", gneqq: "\u2269", gnsim: "\u22E7", Gopf: "\u{1D53E}", gopf: "\u{1D558}", grave: "`", GreaterEqual: "\u2265", GreaterEqualLess: "\u22DB", GreaterFullEqual: "\u2267", GreaterGreater: "\u2AA2", GreaterLess: "\u2277", GreaterSlantEqual: "\u2A7E", GreaterTilde: "\u2273", Gscr: "\u{1D4A2}", gscr: "\u210A", gsim: "\u2273", gsime: "\u2A8E", gsiml: "\u2A90", gtcc: "\u2AA7", gtcir: "\u2A7A", gt: ">", GT: ">", Gt: "\u226B", gtdot: "\u22D7", gtlPar: "\u2995", gtquest: "\u2A7C", gtrapprox: "\u2A86", gtrarr: "\u2978", gtrdot: "\u22D7", gtreqless: "\u22DB", gtreqqless: "\u2A8C", gtrless: "\u2277", gtrsim: "\u2273", gvertneqq: "\u2269\uFE00", gvnE: "\u2269\uFE00", Hacek: "\u02C7", hairsp: "\u200A", half: "\xBD", hamilt: "\u210B", HARDcy: "\u042A", hardcy: "\u044A", harrcir: "\u2948", harr: "\u2194", hArr: "\u21D4", harrw: "\u21AD", Hat: "^", hbar: "\u210F", Hcirc: "\u0124", hcirc: "\u0125", hearts: "\u2665", heartsuit: "\u2665", hellip: "\u2026", hercon: "\u22B9", hfr: "\u{1D525}", Hfr: "\u210C", HilbertSpace: "\u210B", hksearow: "\u2925", hkswarow: "\u2926", hoarr: "\u21FF", homtht: "\u223B", hookleftarrow: "\u21A9", hookrightarrow: "\u21AA", hopf: "\u{1D559}", Hopf: "\u210D", horbar: "\u2015", HorizontalLine: "\u2500", hscr: "\u{1D4BD}", Hscr: "\u210B", hslash: "\u210F", Hstrok: "\u0126", hstrok: "\u0127", HumpDownHump: "\u224E", HumpEqual: "\u224F", hybull: "\u2043", hyphen: "\u2010", Iacute: "\xCD", iacute: "\xED", ic: "\u2063", Icirc: "\xCE", icirc: "\xEE", Icy: "\u0418", icy: "\u0438", Idot: "\u0130", IEcy: "\u0415", iecy: "\u0435", iexcl: "\xA1", iff: "\u21D4", ifr: "\u{1D526}", Ifr: "\u2111", Igrave: "\xCC", igrave: "\xEC", ii: "\u2148", iiiint: "\u2A0C", iiint: "\u222D", iinfin: "\u29DC", iiota: "\u2129", IJlig: "\u0132", ijlig: "\u0133", Imacr: "\u012A", imacr: "\u012B", image: "\u2111", ImaginaryI: "\u2148", imagline: "\u2110", imagpart: "\u2111", imath: "\u0131", Im: "\u2111", imof: "\u22B7", imped: "\u01B5", Implies: "\u21D2", incare: "\u2105", in: "\u2208", infin: "\u221E", infintie: "\u29DD", inodot: "\u0131", intcal: "\u22BA", int: "\u222B", Int: "\u222C", integers: "\u2124", Integral: "\u222B", intercal: "\u22BA", Intersection: "\u22C2", intlarhk: "\u2A17", intprod: "\u2A3C", InvisibleComma: "\u2063", InvisibleTimes: "\u2062", IOcy: "\u0401", iocy: "\u0451", Iogon: "\u012E", iogon: "\u012F", Iopf: "\u{1D540}", iopf: "\u{1D55A}", Iota: "\u0399", iota: "\u03B9", iprod: "\u2A3C", iquest: "\xBF", iscr: "\u{1D4BE}", Iscr: "\u2110", isin: "\u2208", isindot: "\u22F5", isinE: "\u22F9", isins: "\u22F4", isinsv: "\u22F3", isinv: "\u2208", it: "\u2062", Itilde: "\u0128", itilde: "\u0129", Iukcy: "\u0406", iukcy: "\u0456", Iuml: "\xCF", iuml: "\xEF", Jcirc: "\u0134", jcirc: "\u0135", Jcy: "\u0419", jcy: "\u0439", Jfr: "\u{1D50D}", jfr: "\u{1D527}", jmath: "\u0237", Jopf: "\u{1D541}", jopf: "\u{1D55B}", Jscr: "\u{1D4A5}", jscr: "\u{1D4BF}", Jsercy: "\u0408", jsercy: "\u0458", Jukcy: "\u0404", jukcy: "\u0454", Kappa: "\u039A", kappa: "\u03BA", kappav: "\u03F0", Kcedil: "\u0136", kcedil: "\u0137", Kcy: "\u041A", kcy: "\u043A", Kfr: "\u{1D50E}", kfr: "\u{1D528}", kgreen: "\u0138", KHcy: "\u0425", khcy: "\u0445", KJcy: "\u040C", kjcy: "\u045C", Kopf: "\u{1D542}", kopf: "\u{1D55C}", Kscr: "\u{1D4A6}", kscr: "\u{1D4C0}", lAarr: "\u21DA", Lacute: "\u0139", lacute: "\u013A", laemptyv: "\u29B4", lagran: "\u2112", Lambda: "\u039B", lambda: "\u03BB", lang: "\u27E8", Lang: "\u27EA", langd: "\u2991", langle: "\u27E8", lap: "\u2A85", Laplacetrf: "\u2112", laquo: "\xAB", larrb: "\u21E4", larrbfs: "\u291F", larr: "\u2190", Larr: "\u219E", lArr: "\u21D0", larrfs: "\u291D", larrhk: "\u21A9", larrlp: "\u21AB", larrpl: "\u2939", larrsim: "\u2973", larrtl: "\u21A2", latail: "\u2919", lAtail: "\u291B", lat: "\u2AAB", late: "\u2AAD", lates: "\u2AAD\uFE00", lbarr: "\u290C", lBarr: "\u290E", lbbrk: "\u2772", lbrace: "{", lbrack: "[", lbrke: "\u298B", lbrksld: "\u298F", lbrkslu: "\u298D", Lcaron: "\u013D", lcaron: "\u013E", Lcedil: "\u013B", lcedil: "\u013C", lceil: "\u2308", lcub: "{", Lcy: "\u041B", lcy: "\u043B", ldca: "\u2936", ldquo: "\u201C", ldquor: "\u201E", ldrdhar: "\u2967", ldrushar: "\u294B", ldsh: "\u21B2", le: "\u2264", lE: "\u2266", LeftAngleBracket: "\u27E8", LeftArrowBar: "\u21E4", leftarrow: "\u2190", LeftArrow: "\u2190", Leftarrow: "\u21D0", LeftArrowRightArrow: "\u21C6", leftarrowtail: "\u21A2", LeftCeiling: "\u2308", LeftDoubleBracket: "\u27E6", LeftDownTeeVector: "\u2961", LeftDownVectorBar: "\u2959", LeftDownVector: "\u21C3", LeftFloor: "\u230A", leftharpoondown: "\u21BD", leftharpoonup: "\u21BC", leftleftarrows: "\u21C7", leftrightarrow: "\u2194", LeftRightArrow: "\u2194", Leftrightarrow: "\u21D4", leftrightarrows: "\u21C6", leftrightharpoons: "\u21CB", leftrightsquigarrow: "\u21AD", LeftRightVector: "\u294E", LeftTeeArrow: "\u21A4", LeftTee: "\u22A3", LeftTeeVector: "\u295A", leftthreetimes: "\u22CB", LeftTriangleBar: "\u29CF", LeftTriangle: "\u22B2", LeftTriangleEqual: "\u22B4", LeftUpDownVector: "\u2951", LeftUpTeeVector: "\u2960", LeftUpVectorBar: "\u2958", LeftUpVector: "\u21BF", LeftVectorBar: "\u2952", LeftVector: "\u21BC", lEg: "\u2A8B", leg: "\u22DA", leq: "\u2264", leqq: "\u2266", leqslant: "\u2A7D", lescc: "\u2AA8", les: "\u2A7D", lesdot: "\u2A7F", lesdoto: "\u2A81", lesdotor: "\u2A83", lesg: "\u22DA\uFE00", lesges: "\u2A93", lessapprox: "\u2A85", lessdot: "\u22D6", lesseqgtr: "\u22DA", lesseqqgtr: "\u2A8B", LessEqualGreater: "\u22DA", LessFullEqual: "\u2266", LessGreater: "\u2276", lessgtr: "\u2276", LessLess: "\u2AA1", lesssim: "\u2272", LessSlantEqual: "\u2A7D", LessTilde: "\u2272", lfisht: "\u297C", lfloor: "\u230A", Lfr: "\u{1D50F}", lfr: "\u{1D529}", lg: "\u2276", lgE: "\u2A91", lHar: "\u2962", lhard: "\u21BD", lharu: "\u21BC", lharul: "\u296A", lhblk: "\u2584", LJcy: "\u0409", ljcy: "\u0459", llarr: "\u21C7", ll: "\u226A", Ll: "\u22D8", llcorner: "\u231E", Lleftarrow: "\u21DA", llhard: "\u296B", lltri: "\u25FA", Lmidot: "\u013F", lmidot: "\u0140", lmoustache: "\u23B0", lmoust: "\u23B0", lnap: "\u2A89", lnapprox: "\u2A89", lne: "\u2A87", lnE: "\u2268", lneq: "\u2A87", lneqq: "\u2268", lnsim: "\u22E6", loang: "\u27EC", loarr: "\u21FD", lobrk: "\u27E6", longleftarrow: "\u27F5", LongLeftArrow: "\u27F5", Longleftarrow: "\u27F8", longleftrightarrow: "\u27F7", LongLeftRightArrow: "\u27F7", Longleftrightarrow: "\u27FA", longmapsto: "\u27FC", longrightarrow: "\u27F6", LongRightArrow: "\u27F6", Longrightarrow: "\u27F9", looparrowleft: "\u21AB", looparrowright: "\u21AC", lopar: "\u2985", Lopf: "\u{1D543}", lopf: "\u{1D55D}", loplus: "\u2A2D", lotimes: "\u2A34", lowast: "\u2217", lowbar: "_", LowerLeftArrow: "\u2199", LowerRightArrow: "\u2198", loz: "\u25CA", lozenge: "\u25CA", lozf: "\u29EB", lpar: "(", lparlt: "\u2993", lrarr: "\u21C6", lrcorner: "\u231F", lrhar: "\u21CB", lrhard: "\u296D", lrm: "\u200E", lrtri: "\u22BF", lsaquo: "\u2039", lscr: "\u{1D4C1}", Lscr: "\u2112", lsh: "\u21B0", Lsh: "\u21B0", lsim: "\u2272", lsime: "\u2A8D", lsimg: "\u2A8F", lsqb: "[", lsquo: "\u2018", lsquor: "\u201A", Lstrok: "\u0141", lstrok: "\u0142", ltcc: "\u2AA6", ltcir: "\u2A79", lt: "<", LT: "<", Lt: "\u226A", ltdot: "\u22D6", lthree: "\u22CB", ltimes: "\u22C9", ltlarr: "\u2976", ltquest: "\u2A7B", ltri: "\u25C3", ltrie: "\u22B4", ltrif: "\u25C2", ltrPar: "\u2996", lurdshar: "\u294A", luruhar: "\u2966", lvertneqq: "\u2268\uFE00", lvnE: "\u2268\uFE00", macr: "\xAF", male: "\u2642", malt: "\u2720", maltese: "\u2720", Map: "\u2905", map: "\u21A6", mapsto: "\u21A6", mapstodown: "\u21A7", mapstoleft: "\u21A4", mapstoup: "\u21A5", marker: "\u25AE", mcomma: "\u2A29", Mcy: "\u041C", mcy: "\u043C", mdash: "\u2014", mDDot: "\u223A", measuredangle: "\u2221", MediumSpace: "\u205F", Mellintrf: "\u2133", Mfr: "\u{1D510}", mfr: "\u{1D52A}", mho: "\u2127", micro: "\xB5", midast: "*", midcir: "\u2AF0", mid: "\u2223", middot: "\xB7", minusb: "\u229F", minus: "\u2212", minusd: "\u2238", minusdu: "\u2A2A", MinusPlus: "\u2213", mlcp: "\u2ADB", mldr: "\u2026", mnplus: "\u2213", models: "\u22A7", Mopf: "\u{1D544}", mopf: "\u{1D55E}", mp: "\u2213", mscr: "\u{1D4C2}", Mscr: "\u2133", mstpos: "\u223E", Mu: "\u039C", mu: "\u03BC", multimap: "\u22B8", mumap: "\u22B8", nabla: "\u2207", Nacute: "\u0143", nacute: "\u0144", nang: "\u2220\u20D2", nap: "\u2249", napE: "\u2A70\u0338", napid: "\u224B\u0338", napos: "\u0149", napprox: "\u2249", natural: "\u266E", naturals: "\u2115", natur: "\u266E", nbsp: "\xA0", nbump: "\u224E\u0338", nbumpe: "\u224F\u0338", ncap: "\u2A43", Ncaron: "\u0147", ncaron: "\u0148", Ncedil: "\u0145", ncedil: "\u0146", ncong: "\u2247", ncongdot: "\u2A6D\u0338", ncup: "\u2A42", Ncy: "\u041D", ncy: "\u043D", ndash: "\u2013", nearhk: "\u2924", nearr: "\u2197", neArr: "\u21D7", nearrow: "\u2197", ne: "\u2260", nedot: "\u2250\u0338", NegativeMediumSpace: "\u200B", NegativeThickSpace: "\u200B", NegativeThinSpace: "\u200B", NegativeVeryThinSpace: "\u200B", nequiv: "\u2262", nesear: "\u2928", nesim: "\u2242\u0338", NestedGreaterGreater: "\u226B", NestedLessLess: "\u226A", NewLine: "\n", nexist: "\u2204", nexists: "\u2204", Nfr: "\u{1D511}", nfr: "\u{1D52B}", ngE: "\u2267\u0338", nge: "\u2271", ngeq: "\u2271", ngeqq: "\u2267\u0338", ngeqslant: "\u2A7E\u0338", nges: "\u2A7E\u0338", nGg: "\u22D9\u0338", ngsim: "\u2275", nGt: "\u226B\u20D2", ngt: "\u226F", ngtr: "\u226F", nGtv: "\u226B\u0338", nharr: "\u21AE", nhArr: "\u21CE", nhpar: "\u2AF2", ni: "\u220B", nis: "\u22FC", nisd: "\u22FA", niv: "\u220B", NJcy: "\u040A", njcy: "\u045A", nlarr: "\u219A", nlArr: "\u21CD", nldr: "\u2025", nlE: "\u2266\u0338", nle: "\u2270", nleftarrow: "\u219A", nLeftarrow: "\u21CD", nleftrightarrow: "\u21AE", nLeftrightarrow: "\u21CE", nleq: "\u2270", nleqq: "\u2266\u0338", nleqslant: "\u2A7D\u0338", nles: "\u2A7D\u0338", nless: "\u226E", nLl: "\u22D8\u0338", nlsim: "\u2274", nLt: "\u226A\u20D2", nlt: "\u226E", nltri: "\u22EA", nltrie: "\u22EC", nLtv: "\u226A\u0338", nmid: "\u2224", NoBreak: "\u2060", NonBreakingSpace: "\xA0", nopf: "\u{1D55F}", Nopf: "\u2115", Not: "\u2AEC", not: "\xAC", NotCongruent: "\u2262", NotCupCap: "\u226D", NotDoubleVerticalBar: "\u2226", NotElement: "\u2209", NotEqual: "\u2260", NotEqualTilde: "\u2242\u0338", NotExists: "\u2204", NotGreater: "\u226F", NotGreaterEqual: "\u2271", NotGreaterFullEqual: "\u2267\u0338", NotGreaterGreater: "\u226B\u0338", NotGreaterLess: "\u2279", NotGreaterSlantEqual: "\u2A7E\u0338", NotGreaterTilde: "\u2275", NotHumpDownHump: "\u224E\u0338", NotHumpEqual: "\u224F\u0338", notin: "\u2209", notindot: "\u22F5\u0338", notinE: "\u22F9\u0338", notinva: "\u2209", notinvb: "\u22F7", notinvc: "\u22F6", NotLeftTriangleBar: "\u29CF\u0338", NotLeftTriangle: "\u22EA", NotLeftTriangleEqual: "\u22EC", NotLess: "\u226E", NotLessEqual: "\u2270", NotLessGreater: "\u2278", NotLessLess: "\u226A\u0338", NotLessSlantEqual: "\u2A7D\u0338", NotLessTilde: "\u2274", NotNestedGreaterGreater: "\u2AA2\u0338", NotNestedLessLess: "\u2AA1\u0338", notni: "\u220C", notniva: "\u220C", notnivb: "\u22FE", notnivc: "\u22FD", NotPrecedes: "\u2280", NotPrecedesEqual: "\u2AAF\u0338", NotPrecedesSlantEqual: "\u22E0", NotReverseElement: "\u220C", NotRightTriangleBar: "\u29D0\u0338", NotRightTriangle: "\u22EB", NotRightTriangleEqual: "\u22ED", NotSquareSubset: "\u228F\u0338", NotSquareSubsetEqual: "\u22E2", NotSquareSuperset: "\u2290\u0338", NotSquareSupersetEqual: "\u22E3", NotSubset: "\u2282\u20D2", NotSubsetEqual: "\u2288", NotSucceeds: "\u2281", NotSucceedsEqual: "\u2AB0\u0338", NotSucceedsSlantEqual: "\u22E1", NotSucceedsTilde: "\u227F\u0338", NotSuperset: "\u2283\u20D2", NotSupersetEqual: "\u2289", NotTilde: "\u2241", NotTildeEqual: "\u2244", NotTildeFullEqual: "\u2247", NotTildeTilde: "\u2249", NotVerticalBar: "\u2224", nparallel: "\u2226", npar: "\u2226", nparsl: "\u2AFD\u20E5", npart: "\u2202\u0338", npolint: "\u2A14", npr: "\u2280", nprcue: "\u22E0", nprec: "\u2280", npreceq: "\u2AAF\u0338", npre: "\u2AAF\u0338", nrarrc: "\u2933\u0338", nrarr: "\u219B", nrArr: "\u21CF", nrarrw: "\u219D\u0338", nrightarrow: "\u219B", nRightarrow: "\u21CF", nrtri: "\u22EB", nrtrie: "\u22ED", nsc: "\u2281", nsccue: "\u22E1", nsce: "\u2AB0\u0338", Nscr: "\u{1D4A9}", nscr: "\u{1D4C3}", nshortmid: "\u2224", nshortparallel: "\u2226", nsim: "\u2241", nsime: "\u2244", nsimeq: "\u2244", nsmid: "\u2224", nspar: "\u2226", nsqsube: "\u22E2", nsqsupe: "\u22E3", nsub: "\u2284", nsubE: "\u2AC5\u0338", nsube: "\u2288", nsubset: "\u2282\u20D2", nsubseteq: "\u2288", nsubseteqq: "\u2AC5\u0338", nsucc: "\u2281", nsucceq: "\u2AB0\u0338", nsup: "\u2285", nsupE: "\u2AC6\u0338", nsupe: "\u2289", nsupset: "\u2283\u20D2", nsupseteq: "\u2289", nsupseteqq: "\u2AC6\u0338", ntgl: "\u2279", Ntilde: "\xD1", ntilde: "\xF1", ntlg: "\u2278", ntriangleleft: "\u22EA", ntrianglelefteq: "\u22EC", ntriangleright: "\u22EB", ntrianglerighteq: "\u22ED", Nu: "\u039D", nu: "\u03BD", num: "#", numero: "\u2116", numsp: "\u2007", nvap: "\u224D\u20D2", nvdash: "\u22AC", nvDash: "\u22AD", nVdash: "\u22AE", nVDash: "\u22AF", nvge: "\u2265\u20D2", nvgt: ">\u20D2", nvHarr: "\u2904", nvinfin: "\u29DE", nvlArr: "\u2902", nvle: "\u2264\u20D2", nvlt: "<\u20D2", nvltrie: "\u22B4\u20D2", nvrArr: "\u2903", nvrtrie: "\u22B5\u20D2", nvsim: "\u223C\u20D2", nwarhk: "\u2923", nwarr: "\u2196", nwArr: "\u21D6", nwarrow: "\u2196", nwnear: "\u2927", Oacute: "\xD3", oacute: "\xF3", oast: "\u229B", Ocirc: "\xD4", ocirc: "\xF4", ocir: "\u229A", Ocy: "\u041E", ocy: "\u043E", odash: "\u229D", Odblac: "\u0150", odblac: "\u0151", odiv: "\u2A38", odot: "\u2299", odsold: "\u29BC", OElig: "\u0152", oelig: "\u0153", ofcir: "\u29BF", Ofr: "\u{1D512}", ofr: "\u{1D52C}", ogon: "\u02DB", Ograve: "\xD2", ograve: "\xF2", ogt: "\u29C1", ohbar: "\u29B5", ohm: "\u03A9", oint: "\u222E", olarr: "\u21BA", olcir: "\u29BE", olcross: "\u29BB", oline: "\u203E", olt: "\u29C0", Omacr: "\u014C", omacr: "\u014D", Omega: "\u03A9", omega: "\u03C9", Omicron: "\u039F", omicron: "\u03BF", omid: "\u29B6", ominus: "\u2296", Oopf: "\u{1D546}", oopf: "\u{1D560}", opar: "\u29B7", OpenCurlyDoubleQuote: "\u201C", OpenCurlyQuote: "\u2018", operp: "\u29B9", oplus: "\u2295", orarr: "\u21BB", Or: "\u2A54", or: "\u2228", ord: "\u2A5D", order: "\u2134", orderof: "\u2134", ordf: "\xAA", ordm: "\xBA", origof: "\u22B6", oror: "\u2A56", orslope: "\u2A57", orv: "\u2A5B", oS: "\u24C8", Oscr: "\u{1D4AA}", oscr: "\u2134", Oslash: "\xD8", oslash: "\xF8", osol: "\u2298", Otilde: "\xD5", otilde: "\xF5", otimesas: "\u2A36", Otimes: "\u2A37", otimes: "\u2297", Ouml: "\xD6", ouml: "\xF6", ovbar: "\u233D", OverBar: "\u203E", OverBrace: "\u23DE", OverBracket: "\u23B4", OverParenthesis: "\u23DC", para: "\xB6", parallel: "\u2225", par: "\u2225", parsim: "\u2AF3", parsl: "\u2AFD", part: "\u2202", PartialD: "\u2202", Pcy: "\u041F", pcy: "\u043F", percnt: "%", period: ".", permil: "\u2030", perp: "\u22A5", pertenk: "\u2031", Pfr: "\u{1D513}", pfr: "\u{1D52D}", Phi: "\u03A6", phi: "\u03C6", phiv: "\u03D5", phmmat: "\u2133", phone: "\u260E", Pi: "\u03A0", pi: "\u03C0", pitchfork: "\u22D4", piv: "\u03D6", planck: "\u210F", planckh: "\u210E", plankv: "\u210F", plusacir: "\u2A23", plusb: "\u229E", pluscir: "\u2A22", plus: "+", plusdo: "\u2214", plusdu: "\u2A25", pluse: "\u2A72", PlusMinus: "\xB1", plusmn: "\xB1", plussim: "\u2A26", plustwo: "\u2A27", pm: "\xB1", Poincareplane: "\u210C", pointint: "\u2A15", popf: "\u{1D561}", Popf: "\u2119", pound: "\xA3", prap: "\u2AB7", Pr: "\u2ABB", pr: "\u227A", prcue: "\u227C", precapprox: "\u2AB7", prec: "\u227A", preccurlyeq: "\u227C", Precedes: "\u227A", PrecedesEqual: "\u2AAF", PrecedesSlantEqual: "\u227C", PrecedesTilde: "\u227E", preceq: "\u2AAF", precnapprox: "\u2AB9", precneqq: "\u2AB5", precnsim: "\u22E8", pre: "\u2AAF", prE: "\u2AB3", precsim: "\u227E", prime: "\u2032", Prime: "\u2033", primes: "\u2119", prnap: "\u2AB9", prnE: "\u2AB5", prnsim: "\u22E8", prod: "\u220F", Product: "\u220F", profalar: "\u232E", profline: "\u2312", profsurf: "\u2313", prop: "\u221D", Proportional: "\u221D", Proportion: "\u2237", propto: "\u221D", prsim: "\u227E", prurel: "\u22B0", Pscr: "\u{1D4AB}", pscr: "\u{1D4C5}", Psi: "\u03A8", psi: "\u03C8", puncsp: "\u2008", Qfr: "\u{1D514}", qfr: "\u{1D52E}", qint: "\u2A0C", qopf: "\u{1D562}", Qopf: "\u211A", qprime: "\u2057", Qscr: "\u{1D4AC}", qscr: "\u{1D4C6}", quaternions: "\u210D", quatint: "\u2A16", quest: "?", questeq: "\u225F", quot: '"', QUOT: '"', rAarr: "\u21DB", race: "\u223D\u0331", Racute: "\u0154", racute: "\u0155", radic: "\u221A", raemptyv: "\u29B3", rang: "\u27E9", Rang: "\u27EB", rangd: "\u2992", range: "\u29A5", rangle: "\u27E9", raquo: "\xBB", rarrap: "\u2975", rarrb: "\u21E5", rarrbfs: "\u2920", rarrc: "\u2933", rarr: "\u2192", Rarr: "\u21A0", rArr: "\u21D2", rarrfs: "\u291E", rarrhk: "\u21AA", rarrlp: "\u21AC", rarrpl: "\u2945", rarrsim: "\u2974", Rarrtl: "\u2916", rarrtl: "\u21A3", rarrw: "\u219D", ratail: "\u291A", rAtail: "\u291C", ratio: "\u2236", rationals: "\u211A", rbarr: "\u290D", rBarr: "\u290F", RBarr: "\u2910", rbbrk: "\u2773", rbrace: "}", rbrack: "]", rbrke: "\u298C", rbrksld: "\u298E", rbrkslu: "\u2990", Rcaron: "\u0158", rcaron: "\u0159", Rcedil: "\u0156", rcedil: "\u0157", rceil: "\u2309", rcub: "}", Rcy: "\u0420", rcy: "\u0440", rdca: "\u2937", rdldhar: "\u2969", rdquo: "\u201D", rdquor: "\u201D", rdsh: "\u21B3", real: "\u211C", realine: "\u211B", realpart: "\u211C", reals: "\u211D", Re: "\u211C", rect: "\u25AD", reg: "\xAE", REG: "\xAE", ReverseElement: "\u220B", ReverseEquilibrium: "\u21CB", ReverseUpEquilibrium: "\u296F", rfisht: "\u297D", rfloor: "\u230B", rfr: "\u{1D52F}", Rfr: "\u211C", rHar: "\u2964", rhard: "\u21C1", rharu: "\u21C0", rharul: "\u296C", Rho: "\u03A1", rho: "\u03C1", rhov: "\u03F1", RightAngleBracket: "\u27E9", RightArrowBar: "\u21E5", rightarrow: "\u2192", RightArrow: "\u2192", Rightarrow: "\u21D2", RightArrowLeftArrow: "\u21C4", rightarrowtail: "\u21A3", RightCeiling: "\u2309", RightDoubleBracket: "\u27E7", RightDownTeeVector: "\u295D", RightDownVectorBar: "\u2955", RightDownVector: "\u21C2", RightFloor: "\u230B", rightharpoondown: "\u21C1", rightharpoonup: "\u21C0", rightleftarrows: "\u21C4", rightleftharpoons: "\u21CC", rightrightarrows: "\u21C9", rightsquigarrow: "\u219D", RightTeeArrow: "\u21A6", RightTee: "\u22A2", RightTeeVector: "\u295B", rightthreetimes: "\u22CC", RightTriangleBar: "\u29D0", RightTriangle: "\u22B3", RightTriangleEqual: "\u22B5", RightUpDownVector: "\u294F", RightUpTeeVector: "\u295C", RightUpVectorBar: "\u2954", RightUpVector: "\u21BE", RightVectorBar: "\u2953", RightVector: "\u21C0", ring: "\u02DA", risingdotseq: "\u2253", rlarr: "\u21C4", rlhar: "\u21CC", rlm: "\u200F", rmoustache: "\u23B1", rmoust: "\u23B1", rnmid: "\u2AEE", roang: "\u27ED", roarr: "\u21FE", robrk: "\u27E7", ropar: "\u2986", ropf: "\u{1D563}", Ropf: "\u211D", roplus: "\u2A2E", rotimes: "\u2A35", RoundImplies: "\u2970", rpar: ")", rpargt: "\u2994", rppolint: "\u2A12", rrarr: "\u21C9", Rrightarrow: "\u21DB", rsaquo: "\u203A", rscr: "\u{1D4C7}", Rscr: "\u211B", rsh: "\u21B1", Rsh: "\u21B1", rsqb: "]", rsquo: "\u2019", rsquor: "\u2019", rthree: "\u22CC", rtimes: "\u22CA", rtri: "\u25B9", rtrie: "\u22B5", rtrif: "\u25B8", rtriltri: "\u29CE", RuleDelayed: "\u29F4", ruluhar: "\u2968", rx: "\u211E", Sacute: "\u015A", sacute: "\u015B", sbquo: "\u201A", scap: "\u2AB8", Scaron: "\u0160", scaron: "\u0161", Sc: "\u2ABC", sc: "\u227B", sccue: "\u227D", sce: "\u2AB0", scE: "\u2AB4", Scedil: "\u015E", scedil: "\u015F", Scirc: "\u015C", scirc: "\u015D", scnap: "\u2ABA", scnE: "\u2AB6", scnsim: "\u22E9", scpolint: "\u2A13", scsim: "\u227F", Scy: "\u0421", scy: "\u0441", sdotb: "\u22A1", sdot: "\u22C5", sdote: "\u2A66", searhk: "\u2925", searr: "\u2198", seArr: "\u21D8", searrow: "\u2198", sect: "\xA7", semi: ";", seswar: "\u2929", setminus: "\u2216", setmn: "\u2216", sext: "\u2736", Sfr: "\u{1D516}", sfr: "\u{1D530}", sfrown: "\u2322", sharp: "\u266F", SHCHcy: "\u0429", shchcy: "\u0449", SHcy: "\u0428", shcy: "\u0448", ShortDownArrow: "\u2193", ShortLeftArrow: "\u2190", shortmid: "\u2223", shortparallel: "\u2225", ShortRightArrow: "\u2192", ShortUpArrow: "\u2191", shy: "\xAD", Sigma: "\u03A3", sigma: "\u03C3", sigmaf: "\u03C2", sigmav: "\u03C2", sim: "\u223C", simdot: "\u2A6A", sime: "\u2243", simeq: "\u2243", simg: "\u2A9E", simgE: "\u2AA0", siml: "\u2A9D", simlE: "\u2A9F", simne: "\u2246", simplus: "\u2A24", simrarr: "\u2972", slarr: "\u2190", SmallCircle: "\u2218", smallsetminus: "\u2216", smashp: "\u2A33", smeparsl: "\u29E4", smid: "\u2223", smile: "\u2323", smt: "\u2AAA", smte: "\u2AAC", smtes: "\u2AAC\uFE00", SOFTcy: "\u042C", softcy: "\u044C", solbar: "\u233F", solb: "\u29C4", sol: "/", Sopf: "\u{1D54A}", sopf: "\u{1D564}", spades: "\u2660", spadesuit: "\u2660", spar: "\u2225", sqcap: "\u2293", sqcaps: "\u2293\uFE00", sqcup: "\u2294", sqcups: "\u2294\uFE00", Sqrt: "\u221A", sqsub: "\u228F", sqsube: "\u2291", sqsubset: "\u228F", sqsubseteq: "\u2291", sqsup: "\u2290", sqsupe: "\u2292", sqsupset: "\u2290", sqsupseteq: "\u2292", square: "\u25A1", Square: "\u25A1", SquareIntersection: "\u2293", SquareSubset: "\u228F", SquareSubsetEqual: "\u2291", SquareSuperset: "\u2290", SquareSupersetEqual: "\u2292", SquareUnion: "\u2294", squarf: "\u25AA", squ: "\u25A1", squf: "\u25AA", srarr: "\u2192", Sscr: "\u{1D4AE}", sscr: "\u{1D4C8}", ssetmn: "\u2216", ssmile: "\u2323", sstarf: "\u22C6", Star: "\u22C6", star: "\u2606", starf: "\u2605", straightepsilon: "\u03F5", straightphi: "\u03D5", strns: "\xAF", sub: "\u2282", Sub: "\u22D0", subdot: "\u2ABD", subE: "\u2AC5", sube: "\u2286", subedot: "\u2AC3", submult: "\u2AC1", subnE: "\u2ACB", subne: "\u228A", subplus: "\u2ABF", subrarr: "\u2979", subset: "\u2282", Subset: "\u22D0", subseteq: "\u2286", subseteqq: "\u2AC5", SubsetEqual: "\u2286", subsetneq: "\u228A", subsetneqq: "\u2ACB", subsim: "\u2AC7", subsub: "\u2AD5", subsup: "\u2AD3", succapprox: "\u2AB8", succ: "\u227B", succcurlyeq: "\u227D", Succeeds: "\u227B", SucceedsEqual: "\u2AB0", SucceedsSlantEqual: "\u227D", SucceedsTilde: "\u227F", succeq: "\u2AB0", succnapprox: "\u2ABA", succneqq: "\u2AB6", succnsim: "\u22E9", succsim: "\u227F", SuchThat: "\u220B", sum: "\u2211", Sum: "\u2211", sung: "\u266A", sup1: "\xB9", sup2: "\xB2", sup3: "\xB3", sup: "\u2283", Sup: "\u22D1", supdot: "\u2ABE", supdsub: "\u2AD8", supE: "\u2AC6", supe: "\u2287", supedot: "\u2AC4", Superset: "\u2283", SupersetEqual: "\u2287", suphsol: "\u27C9", suphsub: "\u2AD7", suplarr: "\u297B", supmult: "\u2AC2", supnE: "\u2ACC", supne: "\u228B", supplus: "\u2AC0", supset: "\u2283", Supset: "\u22D1", supseteq: "\u2287", supseteqq: "\u2AC6", supsetneq: "\u228B", supsetneqq: "\u2ACC", supsim: "\u2AC8", supsub: "\u2AD4", supsup: "\u2AD6", swarhk: "\u2926", swarr: "\u2199", swArr: "\u21D9", swarrow: "\u2199", swnwar: "\u292A", szlig: "\xDF", Tab: "	", target: "\u2316", Tau: "\u03A4", tau: "\u03C4", tbrk: "\u23B4", Tcaron: "\u0164", tcaron: "\u0165", Tcedil: "\u0162", tcedil: "\u0163", Tcy: "\u0422", tcy: "\u0442", tdot: "\u20DB", telrec: "\u2315", Tfr: "\u{1D517}", tfr: "\u{1D531}", there4: "\u2234", therefore: "\u2234", Therefore: "\u2234", Theta: "\u0398", theta: "\u03B8", thetasym: "\u03D1", thetav: "\u03D1", thickapprox: "\u2248", thicksim: "\u223C", ThickSpace: "\u205F\u200A", ThinSpace: "\u2009", thinsp: "\u2009", thkap: "\u2248", thksim: "\u223C", THORN: "\xDE", thorn: "\xFE", tilde: "\u02DC", Tilde: "\u223C", TildeEqual: "\u2243", TildeFullEqual: "\u2245", TildeTilde: "\u2248", timesbar: "\u2A31", timesb: "\u22A0", times: "\xD7", timesd: "\u2A30", tint: "\u222D", toea: "\u2928", topbot: "\u2336", topcir: "\u2AF1", top: "\u22A4", Topf: "\u{1D54B}", topf: "\u{1D565}", topfork: "\u2ADA", tosa: "\u2929", tprime: "\u2034", trade: "\u2122", TRADE: "\u2122", triangle: "\u25B5", triangledown: "\u25BF", triangleleft: "\u25C3", trianglelefteq: "\u22B4", triangleq: "\u225C", triangleright: "\u25B9", trianglerighteq: "\u22B5", tridot: "\u25EC", trie: "\u225C", triminus: "\u2A3A", TripleDot: "\u20DB", triplus: "\u2A39", trisb: "\u29CD", tritime: "\u2A3B", trpezium: "\u23E2", Tscr: "\u{1D4AF}", tscr: "\u{1D4C9}", TScy: "\u0426", tscy: "\u0446", TSHcy: "\u040B", tshcy: "\u045B", Tstrok: "\u0166", tstrok: "\u0167", twixt: "\u226C", twoheadleftarrow: "\u219E", twoheadrightarrow: "\u21A0", Uacute: "\xDA", uacute: "\xFA", uarr: "\u2191", Uarr: "\u219F", uArr: "\u21D1", Uarrocir: "\u2949", Ubrcy: "\u040E", ubrcy: "\u045E", Ubreve: "\u016C", ubreve: "\u016D", Ucirc: "\xDB", ucirc: "\xFB", Ucy: "\u0423", ucy: "\u0443", udarr: "\u21C5", Udblac: "\u0170", udblac: "\u0171", udhar: "\u296E", ufisht: "\u297E", Ufr: "\u{1D518}", ufr: "\u{1D532}", Ugrave: "\xD9", ugrave: "\xF9", uHar: "\u2963", uharl: "\u21BF", uharr: "\u21BE", uhblk: "\u2580", ulcorn: "\u231C", ulcorner: "\u231C", ulcrop: "\u230F", ultri: "\u25F8", Umacr: "\u016A", umacr: "\u016B", uml: "\xA8", UnderBar: "_", UnderBrace: "\u23DF", UnderBracket: "\u23B5", UnderParenthesis: "\u23DD", Union: "\u22C3", UnionPlus: "\u228E", Uogon: "\u0172", uogon: "\u0173", Uopf: "\u{1D54C}", uopf: "\u{1D566}", UpArrowBar: "\u2912", uparrow: "\u2191", UpArrow: "\u2191", Uparrow: "\u21D1", UpArrowDownArrow: "\u21C5", updownarrow: "\u2195", UpDownArrow: "\u2195", Updownarrow: "\u21D5", UpEquilibrium: "\u296E", upharpoonleft: "\u21BF", upharpoonright: "\u21BE", uplus: "\u228E", UpperLeftArrow: "\u2196", UpperRightArrow: "\u2197", upsi: "\u03C5", Upsi: "\u03D2", upsih: "\u03D2", Upsilon: "\u03A5", upsilon: "\u03C5", UpTeeArrow: "\u21A5", UpTee: "\u22A5", upuparrows: "\u21C8", urcorn: "\u231D", urcorner: "\u231D", urcrop: "\u230E", Uring: "\u016E", uring: "\u016F", urtri: "\u25F9", Uscr: "\u{1D4B0}", uscr: "\u{1D4CA}", utdot: "\u22F0", Utilde: "\u0168", utilde: "\u0169", utri: "\u25B5", utrif: "\u25B4", uuarr: "\u21C8", Uuml: "\xDC", uuml: "\xFC", uwangle: "\u29A7", vangrt: "\u299C", varepsilon: "\u03F5", varkappa: "\u03F0", varnothing: "\u2205", varphi: "\u03D5", varpi: "\u03D6", varpropto: "\u221D", varr: "\u2195", vArr: "\u21D5", varrho: "\u03F1", varsigma: "\u03C2", varsubsetneq: "\u228A\uFE00", varsubsetneqq: "\u2ACB\uFE00", varsupsetneq: "\u228B\uFE00", varsupsetneqq: "\u2ACC\uFE00", vartheta: "\u03D1", vartriangleleft: "\u22B2", vartriangleright: "\u22B3", vBar: "\u2AE8", Vbar: "\u2AEB", vBarv: "\u2AE9", Vcy: "\u0412", vcy: "\u0432", vdash: "\u22A2", vDash: "\u22A8", Vdash: "\u22A9", VDash: "\u22AB", Vdashl: "\u2AE6", veebar: "\u22BB", vee: "\u2228", Vee: "\u22C1", veeeq: "\u225A", vellip: "\u22EE", verbar: "|", Verbar: "\u2016", vert: "|", Vert: "\u2016", VerticalBar: "\u2223", VerticalLine: "|", VerticalSeparator: "\u2758", VerticalTilde: "\u2240", VeryThinSpace: "\u200A", Vfr: "\u{1D519}", vfr: "\u{1D533}", vltri: "\u22B2", vnsub: "\u2282\u20D2", vnsup: "\u2283\u20D2", Vopf: "\u{1D54D}", vopf: "\u{1D567}", vprop: "\u221D", vrtri: "\u22B3", Vscr: "\u{1D4B1}", vscr: "\u{1D4CB}", vsubnE: "\u2ACB\uFE00", vsubne: "\u228A\uFE00", vsupnE: "\u2ACC\uFE00", vsupne: "\u228B\uFE00", Vvdash: "\u22AA", vzigzag: "\u299A", Wcirc: "\u0174", wcirc: "\u0175", wedbar: "\u2A5F", wedge: "\u2227", Wedge: "\u22C0", wedgeq: "\u2259", weierp: "\u2118", Wfr: "\u{1D51A}", wfr: "\u{1D534}", Wopf: "\u{1D54E}", wopf: "\u{1D568}", wp: "\u2118", wr: "\u2240", wreath: "\u2240", Wscr: "\u{1D4B2}", wscr: "\u{1D4CC}", xcap: "\u22C2", xcirc: "\u25EF", xcup: "\u22C3", xdtri: "\u25BD", Xfr: "\u{1D51B}", xfr: "\u{1D535}", xharr: "\u27F7", xhArr: "\u27FA", Xi: "\u039E", xi: "\u03BE", xlarr: "\u27F5", xlArr: "\u27F8", xmap: "\u27FC", xnis: "\u22FB", xodot: "\u2A00", Xopf: "\u{1D54F}", xopf: "\u{1D569}", xoplus: "\u2A01", xotime: "\u2A02", xrarr: "\u27F6", xrArr: "\u27F9", Xscr: "\u{1D4B3}", xscr: "\u{1D4CD}", xsqcup: "\u2A06", xuplus: "\u2A04", xutri: "\u25B3", xvee: "\u22C1", xwedge: "\u22C0", Yacute: "\xDD", yacute: "\xFD", YAcy: "\u042F", yacy: "\u044F", Ycirc: "\u0176", ycirc: "\u0177", Ycy: "\u042B", ycy: "\u044B", yen: "\xA5", Yfr: "\u{1D51C}", yfr: "\u{1D536}", YIcy: "\u0407", yicy: "\u0457", Yopf: "\u{1D550}", yopf: "\u{1D56A}", Yscr: "\u{1D4B4}", yscr: "\u{1D4CE}", YUcy: "\u042E", yucy: "\u044E", yuml: "\xFF", Yuml: "\u0178", Zacute: "\u0179", zacute: "\u017A", Zcaron: "\u017D", zcaron: "\u017E", Zcy: "\u0417", zcy: "\u0437", Zdot: "\u017B", zdot: "\u017C", zeetrf: "\u2128", ZeroWidthSpace: "\u200B", Zeta: "\u0396", zeta: "\u03B6", zfr: "\u{1D537}", Zfr: "\u2128", ZHcy: "\u0416", zhcy: "\u0436", zigrarr: "\u21DD", zopf: "\u{1D56B}", Zopf: "\u2124", Zscr: "\u{1D4B5}", zscr: "\u{1D4CF}", zwj: "\u200D", zwnj: "\u200C" };
  }
});

// node_modules/markdown-it/lib/common/entities.js
var require_entities2 = __commonJS({
  "node_modules/markdown-it/lib/common/entities.js"(exports, module2) {
    "use strict";
    module2.exports = require_entities();
  }
});

// node_modules/uc.micro/categories/P/regex.js
var require_regex = __commonJS({
  "node_modules/uc.micro/categories/P/regex.js"(exports, module2) {
    module2.exports = /[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4E\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDF55-\uDF59]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD806[\uDC3B\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/;
  }
});

// node_modules/mdurl/encode.js
var require_encode = __commonJS({
  "node_modules/mdurl/encode.js"(exports, module2) {
    "use strict";
    var encodeCache = {};
    function getEncodeCache(exclude) {
      var i2, ch, cache = encodeCache[exclude];
      if (cache) {
        return cache;
      }
      cache = encodeCache[exclude] = [];
      for (i2 = 0; i2 < 128; i2++) {
        ch = String.fromCharCode(i2);
        if (/^[0-9a-z]$/i.test(ch)) {
          cache.push(ch);
        } else {
          cache.push("%" + ("0" + i2.toString(16).toUpperCase()).slice(-2));
        }
      }
      for (i2 = 0; i2 < exclude.length; i2++) {
        cache[exclude.charCodeAt(i2)] = exclude[i2];
      }
      return cache;
    }
    function encode(string, exclude, keepEscaped) {
      var i2, l2, code, nextCode, cache, result = "";
      if (typeof exclude !== "string") {
        keepEscaped = exclude;
        exclude = encode.defaultChars;
      }
      if (typeof keepEscaped === "undefined") {
        keepEscaped = true;
      }
      cache = getEncodeCache(exclude);
      for (i2 = 0, l2 = string.length; i2 < l2; i2++) {
        code = string.charCodeAt(i2);
        if (keepEscaped && code === 37 && i2 + 2 < l2) {
          if (/^[0-9a-f]{2}$/i.test(string.slice(i2 + 1, i2 + 3))) {
            result += string.slice(i2, i2 + 3);
            i2 += 2;
            continue;
          }
        }
        if (code < 128) {
          result += cache[code];
          continue;
        }
        if (code >= 55296 && code <= 57343) {
          if (code >= 55296 && code <= 56319 && i2 + 1 < l2) {
            nextCode = string.charCodeAt(i2 + 1);
            if (nextCode >= 56320 && nextCode <= 57343) {
              result += encodeURIComponent(string[i2] + string[i2 + 1]);
              i2++;
              continue;
            }
          }
          result += "%EF%BF%BD";
          continue;
        }
        result += encodeURIComponent(string[i2]);
      }
      return result;
    }
    encode.defaultChars = ";/?:@&=+$,-_.!~*'()#";
    encode.componentChars = "-_.!~*'()";
    module2.exports = encode;
  }
});

// node_modules/mdurl/decode.js
var require_decode = __commonJS({
  "node_modules/mdurl/decode.js"(exports, module2) {
    "use strict";
    var decodeCache = {};
    function getDecodeCache(exclude) {
      var i2, ch, cache = decodeCache[exclude];
      if (cache) {
        return cache;
      }
      cache = decodeCache[exclude] = [];
      for (i2 = 0; i2 < 128; i2++) {
        ch = String.fromCharCode(i2);
        cache.push(ch);
      }
      for (i2 = 0; i2 < exclude.length; i2++) {
        ch = exclude.charCodeAt(i2);
        cache[ch] = "%" + ("0" + ch.toString(16).toUpperCase()).slice(-2);
      }
      return cache;
    }
    function decode(string, exclude) {
      var cache;
      if (typeof exclude !== "string") {
        exclude = decode.defaultChars;
      }
      cache = getDecodeCache(exclude);
      return string.replace(/(%[a-f0-9]{2})+/gi, function(seq) {
        var i2, l2, b1, b2, b3, b4, chr, result = "";
        for (i2 = 0, l2 = seq.length; i2 < l2; i2 += 3) {
          b1 = parseInt(seq.slice(i2 + 1, i2 + 3), 16);
          if (b1 < 128) {
            result += cache[b1];
            continue;
          }
          if ((b1 & 224) === 192 && i2 + 3 < l2) {
            b2 = parseInt(seq.slice(i2 + 4, i2 + 6), 16);
            if ((b2 & 192) === 128) {
              chr = b1 << 6 & 1984 | b2 & 63;
              if (chr < 128) {
                result += "\uFFFD\uFFFD";
              } else {
                result += String.fromCharCode(chr);
              }
              i2 += 3;
              continue;
            }
          }
          if ((b1 & 240) === 224 && i2 + 6 < l2) {
            b2 = parseInt(seq.slice(i2 + 4, i2 + 6), 16);
            b3 = parseInt(seq.slice(i2 + 7, i2 + 9), 16);
            if ((b2 & 192) === 128 && (b3 & 192) === 128) {
              chr = b1 << 12 & 61440 | b2 << 6 & 4032 | b3 & 63;
              if (chr < 2048 || chr >= 55296 && chr <= 57343) {
                result += "\uFFFD\uFFFD\uFFFD";
              } else {
                result += String.fromCharCode(chr);
              }
              i2 += 6;
              continue;
            }
          }
          if ((b1 & 248) === 240 && i2 + 9 < l2) {
            b2 = parseInt(seq.slice(i2 + 4, i2 + 6), 16);
            b3 = parseInt(seq.slice(i2 + 7, i2 + 9), 16);
            b4 = parseInt(seq.slice(i2 + 10, i2 + 12), 16);
            if ((b2 & 192) === 128 && (b3 & 192) === 128 && (b4 & 192) === 128) {
              chr = b1 << 18 & 1835008 | b2 << 12 & 258048 | b3 << 6 & 4032 | b4 & 63;
              if (chr < 65536 || chr > 1114111) {
                result += "\uFFFD\uFFFD\uFFFD\uFFFD";
              } else {
                chr -= 65536;
                result += String.fromCharCode(55296 + (chr >> 10), 56320 + (chr & 1023));
              }
              i2 += 9;
              continue;
            }
          }
          result += "\uFFFD";
        }
        return result;
      });
    }
    decode.defaultChars = ";/?:@&=+$,#";
    decode.componentChars = "";
    module2.exports = decode;
  }
});

// node_modules/mdurl/format.js
var require_format = __commonJS({
  "node_modules/mdurl/format.js"(exports, module2) {
    "use strict";
    module2.exports = function format(url) {
      var result = "";
      result += url.protocol || "";
      result += url.slashes ? "//" : "";
      result += url.auth ? url.auth + "@" : "";
      if (url.hostname && url.hostname.indexOf(":") !== -1) {
        result += "[" + url.hostname + "]";
      } else {
        result += url.hostname || "";
      }
      result += url.port ? ":" + url.port : "";
      result += url.pathname || "";
      result += url.search || "";
      result += url.hash || "";
      return result;
    };
  }
});

// node_modules/mdurl/parse.js
var require_parse = __commonJS({
  "node_modules/mdurl/parse.js"(exports, module2) {
    "use strict";
    function Url() {
      this.protocol = null;
      this.slashes = null;
      this.auth = null;
      this.port = null;
      this.hostname = null;
      this.hash = null;
      this.search = null;
      this.pathname = null;
    }
    var protocolPattern = /^([a-z0-9.+-]+:)/i;
    var portPattern = /:[0-9]*$/;
    var simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/;
    var delims = ["<", ">", '"', "`", " ", "\r", "\n", "	"];
    var unwise = ["{", "}", "|", "\\", "^", "`"].concat(delims);
    var autoEscape = ["'"].concat(unwise);
    var nonHostChars = ["%", "/", "?", ";", "#"].concat(autoEscape);
    var hostEndingChars = ["/", "?", "#"];
    var hostnameMaxLen = 255;
    var hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/;
    var hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/;
    var hostlessProtocol = {
      "javascript": true,
      "javascript:": true
    };
    var slashedProtocol = {
      "http": true,
      "https": true,
      "ftp": true,
      "gopher": true,
      "file": true,
      "http:": true,
      "https:": true,
      "ftp:": true,
      "gopher:": true,
      "file:": true
    };
    function urlParse(url, slashesDenoteHost) {
      if (url && url instanceof Url) {
        return url;
      }
      var u2 = new Url();
      u2.parse(url, slashesDenoteHost);
      return u2;
    }
    Url.prototype.parse = function(url, slashesDenoteHost) {
      var i2, l2, lowerProto, hec, slashes, rest = url;
      rest = rest.trim();
      if (!slashesDenoteHost && url.split("#").length === 1) {
        var simplePath = simplePathPattern.exec(rest);
        if (simplePath) {
          this.pathname = simplePath[1];
          if (simplePath[2]) {
            this.search = simplePath[2];
          }
          return this;
        }
      }
      var proto = protocolPattern.exec(rest);
      if (proto) {
        proto = proto[0];
        lowerProto = proto.toLowerCase();
        this.protocol = proto;
        rest = rest.substr(proto.length);
      }
      if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
        slashes = rest.substr(0, 2) === "//";
        if (slashes && !(proto && hostlessProtocol[proto])) {
          rest = rest.substr(2);
          this.slashes = true;
        }
      }
      if (!hostlessProtocol[proto] && (slashes || proto && !slashedProtocol[proto])) {
        var hostEnd = -1;
        for (i2 = 0; i2 < hostEndingChars.length; i2++) {
          hec = rest.indexOf(hostEndingChars[i2]);
          if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) {
            hostEnd = hec;
          }
        }
        var auth, atSign;
        if (hostEnd === -1) {
          atSign = rest.lastIndexOf("@");
        } else {
          atSign = rest.lastIndexOf("@", hostEnd);
        }
        if (atSign !== -1) {
          auth = rest.slice(0, atSign);
          rest = rest.slice(atSign + 1);
          this.auth = auth;
        }
        hostEnd = -1;
        for (i2 = 0; i2 < nonHostChars.length; i2++) {
          hec = rest.indexOf(nonHostChars[i2]);
          if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) {
            hostEnd = hec;
          }
        }
        if (hostEnd === -1) {
          hostEnd = rest.length;
        }
        if (rest[hostEnd - 1] === ":") {
          hostEnd--;
        }
        var host = rest.slice(0, hostEnd);
        rest = rest.slice(hostEnd);
        this.parseHost(host);
        this.hostname = this.hostname || "";
        var ipv6Hostname = this.hostname[0] === "[" && this.hostname[this.hostname.length - 1] === "]";
        if (!ipv6Hostname) {
          var hostparts = this.hostname.split(/\./);
          for (i2 = 0, l2 = hostparts.length; i2 < l2; i2++) {
            var part = hostparts[i2];
            if (!part) {
              continue;
            }
            if (!part.match(hostnamePartPattern)) {
              var newpart = "";
              for (var j2 = 0, k2 = part.length; j2 < k2; j2++) {
                if (part.charCodeAt(j2) > 127) {
                  newpart += "x";
                } else {
                  newpart += part[j2];
                }
              }
              if (!newpart.match(hostnamePartPattern)) {
                var validParts = hostparts.slice(0, i2);
                var notHost = hostparts.slice(i2 + 1);
                var bit = part.match(hostnamePartStart);
                if (bit) {
                  validParts.push(bit[1]);
                  notHost.unshift(bit[2]);
                }
                if (notHost.length) {
                  rest = notHost.join(".") + rest;
                }
                this.hostname = validParts.join(".");
                break;
              }
            }
          }
        }
        if (this.hostname.length > hostnameMaxLen) {
          this.hostname = "";
        }
        if (ipv6Hostname) {
          this.hostname = this.hostname.substr(1, this.hostname.length - 2);
        }
      }
      var hash = rest.indexOf("#");
      if (hash !== -1) {
        this.hash = rest.substr(hash);
        rest = rest.slice(0, hash);
      }
      var qm = rest.indexOf("?");
      if (qm !== -1) {
        this.search = rest.substr(qm);
        rest = rest.slice(0, qm);
      }
      if (rest) {
        this.pathname = rest;
      }
      if (slashedProtocol[lowerProto] && this.hostname && !this.pathname) {
        this.pathname = "";
      }
      return this;
    };
    Url.prototype.parseHost = function(host) {
      var port = portPattern.exec(host);
      if (port) {
        port = port[0];
        if (port !== ":") {
          this.port = port.substr(1);
        }
        host = host.substr(0, host.length - port.length);
      }
      if (host) {
        this.hostname = host;
      }
    };
    module2.exports = urlParse;
  }
});

// node_modules/mdurl/index.js
var require_mdurl = __commonJS({
  "node_modules/mdurl/index.js"(exports, module2) {
    "use strict";
    module2.exports.encode = require_encode();
    module2.exports.decode = require_decode();
    module2.exports.format = require_format();
    module2.exports.parse = require_parse();
  }
});

// node_modules/uc.micro/properties/Any/regex.js
var require_regex2 = __commonJS({
  "node_modules/uc.micro/properties/Any/regex.js"(exports, module2) {
    module2.exports = /[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
  }
});

// node_modules/uc.micro/categories/Cc/regex.js
var require_regex3 = __commonJS({
  "node_modules/uc.micro/categories/Cc/regex.js"(exports, module2) {
    module2.exports = /[\0-\x1F\x7F-\x9F]/;
  }
});

// node_modules/uc.micro/categories/Cf/regex.js
var require_regex4 = __commonJS({
  "node_modules/uc.micro/categories/Cf/regex.js"(exports, module2) {
    module2.exports = /[\xAD\u0600-\u0605\u061C\u06DD\u070F\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/;
  }
});

// node_modules/uc.micro/categories/Z/regex.js
var require_regex5 = __commonJS({
  "node_modules/uc.micro/categories/Z/regex.js"(exports, module2) {
    module2.exports = /[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/;
  }
});

// node_modules/uc.micro/index.js
var require_uc = __commonJS({
  "node_modules/uc.micro/index.js"(exports) {
    "use strict";
    exports.Any = require_regex2();
    exports.Cc = require_regex3();
    exports.Cf = require_regex4();
    exports.P = require_regex();
    exports.Z = require_regex5();
  }
});

// node_modules/markdown-it/lib/common/utils.js
var require_utils = __commonJS({
  "node_modules/markdown-it/lib/common/utils.js"(exports) {
    "use strict";
    function _class(obj) {
      return Object.prototype.toString.call(obj);
    }
    function isString(obj) {
      return _class(obj) === "[object String]";
    }
    var _hasOwnProperty = Object.prototype.hasOwnProperty;
    function has(object, key) {
      return _hasOwnProperty.call(object, key);
    }
    function assign(obj) {
      var sources = Array.prototype.slice.call(arguments, 1);
      sources.forEach(function(source) {
        if (!source) {
          return;
        }
        if (typeof source !== "object") {
          throw new TypeError(source + "must be object");
        }
        Object.keys(source).forEach(function(key) {
          obj[key] = source[key];
        });
      });
      return obj;
    }
    function arrayReplaceAt(src, pos, newElements) {
      return [].concat(src.slice(0, pos), newElements, src.slice(pos + 1));
    }
    function isValidEntityCode(c2) {
      if (c2 >= 55296 && c2 <= 57343) {
        return false;
      }
      if (c2 >= 64976 && c2 <= 65007) {
        return false;
      }
      if ((c2 & 65535) === 65535 || (c2 & 65535) === 65534) {
        return false;
      }
      if (c2 >= 0 && c2 <= 8) {
        return false;
      }
      if (c2 === 11) {
        return false;
      }
      if (c2 >= 14 && c2 <= 31) {
        return false;
      }
      if (c2 >= 127 && c2 <= 159) {
        return false;
      }
      if (c2 > 1114111) {
        return false;
      }
      return true;
    }
    function fromCodePoint2(c2) {
      if (c2 > 65535) {
        c2 -= 65536;
        var surrogate1 = 55296 + (c2 >> 10), surrogate2 = 56320 + (c2 & 1023);
        return String.fromCharCode(surrogate1, surrogate2);
      }
      return String.fromCharCode(c2);
    }
    var UNESCAPE_MD_RE = /\\([!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~])/g;
    var ENTITY_RE = /&([a-z#][a-z0-9]{1,31});/gi;
    var UNESCAPE_ALL_RE = new RegExp(UNESCAPE_MD_RE.source + "|" + ENTITY_RE.source, "gi");
    var DIGITAL_ENTITY_TEST_RE = /^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;
    var entities = require_entities2();
    function replaceEntityPattern(match, name) {
      var code;
      if (has(entities, name)) {
        return entities[name];
      }
      if (name.charCodeAt(0) === 35 && DIGITAL_ENTITY_TEST_RE.test(name)) {
        code = name[1].toLowerCase() === "x" ? parseInt(name.slice(2), 16) : parseInt(name.slice(1), 10);
        if (isValidEntityCode(code)) {
          return fromCodePoint2(code);
        }
      }
      return match;
    }
    function unescapeMd(str) {
      if (str.indexOf("\\") < 0) {
        return str;
      }
      return str.replace(UNESCAPE_MD_RE, "$1");
    }
    function unescapeAll(str) {
      if (str.indexOf("\\") < 0 && str.indexOf("&") < 0) {
        return str;
      }
      return str.replace(UNESCAPE_ALL_RE, function(match, escaped, entity) {
        if (escaped) {
          return escaped;
        }
        return replaceEntityPattern(match, entity);
      });
    }
    var HTML_ESCAPE_TEST_RE = /[&<>"]/;
    var HTML_ESCAPE_REPLACE_RE = /[&<>"]/g;
    var HTML_REPLACEMENTS = {
      "&": "&amp;",
      "<": "&lt;",
      ">": "&gt;",
      '"': "&quot;"
    };
    function replaceUnsafeChar(ch) {
      return HTML_REPLACEMENTS[ch];
    }
    function escapeHtml(str) {
      if (HTML_ESCAPE_TEST_RE.test(str)) {
        return str.replace(HTML_ESCAPE_REPLACE_RE, replaceUnsafeChar);
      }
      return str;
    }
    var REGEXP_ESCAPE_RE = /[.?*+^$[\]\\(){}|-]/g;
    function escapeRE(str) {
      return str.replace(REGEXP_ESCAPE_RE, "\\$&");
    }
    function isSpace(code) {
      switch (code) {
        case 9:
        case 32:
          return true;
      }
      return false;
    }
    function isWhiteSpace(code) {
      if (code >= 8192 && code <= 8202) {
        return true;
      }
      switch (code) {
        case 9:
        case 10:
        case 11:
        case 12:
        case 13:
        case 32:
        case 160:
        case 5760:
        case 8239:
        case 8287:
        case 12288:
          return true;
      }
      return false;
    }
    var UNICODE_PUNCT_RE = require_regex();
    function isPunctChar(ch) {
      return UNICODE_PUNCT_RE.test(ch);
    }
    function isMdAsciiPunct(ch) {
      switch (ch) {
        case 33:
        case 34:
        case 35:
        case 36:
        case 37:
        case 38:
        case 39:
        case 40:
        case 41:
        case 42:
        case 43:
        case 44:
        case 45:
        case 46:
        case 47:
        case 58:
        case 59:
        case 60:
        case 61:
        case 62:
        case 63:
        case 64:
        case 91:
        case 92:
        case 93:
        case 94:
        case 95:
        case 96:
        case 123:
        case 124:
        case 125:
        case 126:
          return true;
        default:
          return false;
      }
    }
    function normalizeReference(str) {
      str = str.trim().replace(/\s+/g, " ");
      if ("\u1E9E".toLowerCase() === "\u1E7E") {
        str = str.replace(/ẞ/g, "\xDF");
      }
      return str.toLowerCase().toUpperCase();
    }
    exports.lib = {};
    exports.lib.mdurl = require_mdurl();
    exports.lib.ucmicro = require_uc();
    exports.assign = assign;
    exports.isString = isString;
    exports.has = has;
    exports.unescapeMd = unescapeMd;
    exports.unescapeAll = unescapeAll;
    exports.isValidEntityCode = isValidEntityCode;
    exports.fromCodePoint = fromCodePoint2;
    exports.escapeHtml = escapeHtml;
    exports.arrayReplaceAt = arrayReplaceAt;
    exports.isSpace = isSpace;
    exports.isWhiteSpace = isWhiteSpace;
    exports.isMdAsciiPunct = isMdAsciiPunct;
    exports.isPunctChar = isPunctChar;
    exports.escapeRE = escapeRE;
    exports.normalizeReference = normalizeReference;
  }
});

// node_modules/markdown-it/lib/helpers/parse_link_label.js
var require_parse_link_label = __commonJS({
  "node_modules/markdown-it/lib/helpers/parse_link_label.js"(exports, module2) {
    "use strict";
    module2.exports = function parseLinkLabel(state, start, disableNested) {
      var level, found, marker, prevPos, labelEnd = -1, max2 = state.posMax, oldPos = state.pos;
      state.pos = start + 1;
      level = 1;
      while (state.pos < max2) {
        marker = state.src.charCodeAt(state.pos);
        if (marker === 93) {
          level--;
          if (level === 0) {
            found = true;
            break;
          }
        }
        prevPos = state.pos;
        state.md.inline.skipToken(state);
        if (marker === 91) {
          if (prevPos === state.pos - 1) {
            level++;
          } else if (disableNested) {
            state.pos = oldPos;
            return -1;
          }
        }
      }
      if (found) {
        labelEnd = state.pos;
      }
      state.pos = oldPos;
      return labelEnd;
    };
  }
});

// node_modules/markdown-it/lib/helpers/parse_link_destination.js
var require_parse_link_destination = __commonJS({
  "node_modules/markdown-it/lib/helpers/parse_link_destination.js"(exports, module2) {
    "use strict";
    var unescapeAll = require_utils().unescapeAll;
    module2.exports = function parseLinkDestination(str, start, max2) {
      var code, level, pos = start, result = {
        ok: false,
        pos: 0,
        lines: 0,
        str: ""
      };
      if (str.charCodeAt(pos) === 60) {
        pos++;
        while (pos < max2) {
          code = str.charCodeAt(pos);
          if (code === 10) {
            return result;
          }
          if (code === 60) {
            return result;
          }
          if (code === 62) {
            result.pos = pos + 1;
            result.str = unescapeAll(str.slice(start + 1, pos));
            result.ok = true;
            return result;
          }
          if (code === 92 && pos + 1 < max2) {
            pos += 2;
            continue;
          }
          pos++;
        }
        return result;
      }
      level = 0;
      while (pos < max2) {
        code = str.charCodeAt(pos);
        if (code === 32) {
          break;
        }
        if (code < 32 || code === 127) {
          break;
        }
        if (code === 92 && pos + 1 < max2) {
          if (str.charCodeAt(pos + 1) === 32) {
            break;
          }
          pos += 2;
          continue;
        }
        if (code === 40) {
          level++;
          if (level > 32) {
            return result;
          }
        }
        if (code === 41) {
          if (level === 0) {
            break;
          }
          level--;
        }
        pos++;
      }
      if (start === pos) {
        return result;
      }
      if (level !== 0) {
        return result;
      }
      result.str = unescapeAll(str.slice(start, pos));
      result.pos = pos;
      result.ok = true;
      return result;
    };
  }
});

// node_modules/markdown-it/lib/helpers/parse_link_title.js
var require_parse_link_title = __commonJS({
  "node_modules/markdown-it/lib/helpers/parse_link_title.js"(exports, module2) {
    "use strict";
    var unescapeAll = require_utils().unescapeAll;
    module2.exports = function parseLinkTitle(str, start, max2) {
      var code, marker, lines = 0, pos = start, result = {
        ok: false,
        pos: 0,
        lines: 0,
        str: ""
      };
      if (pos >= max2) {
        return result;
      }
      marker = str.charCodeAt(pos);
      if (marker !== 34 && marker !== 39 && marker !== 40) {
        return result;
      }
      pos++;
      if (marker === 40) {
        marker = 41;
      }
      while (pos < max2) {
        code = str.charCodeAt(pos);
        if (code === marker) {
          result.pos = pos + 1;
          result.lines = lines;
          result.str = unescapeAll(str.slice(start + 1, pos));
          result.ok = true;
          return result;
        } else if (code === 40 && marker === 41) {
          return result;
        } else if (code === 10) {
          lines++;
        } else if (code === 92 && pos + 1 < max2) {
          pos++;
          if (str.charCodeAt(pos) === 10) {
            lines++;
          }
        }
        pos++;
      }
      return result;
    };
  }
});

// node_modules/markdown-it/lib/helpers/index.js
var require_helpers = __commonJS({
  "node_modules/markdown-it/lib/helpers/index.js"(exports) {
    "use strict";
    exports.parseLinkLabel = require_parse_link_label();
    exports.parseLinkDestination = require_parse_link_destination();
    exports.parseLinkTitle = require_parse_link_title();
  }
});

// node_modules/markdown-it/lib/renderer.js
var require_renderer = __commonJS({
  "node_modules/markdown-it/lib/renderer.js"(exports, module2) {
    "use strict";
    var assign = require_utils().assign;
    var unescapeAll = require_utils().unescapeAll;
    var escapeHtml = require_utils().escapeHtml;
    var default_rules = {};
    default_rules.code_inline = function(tokens, idx, options, env, slf) {
      var token = tokens[idx];
      return "<code" + slf.renderAttrs(token) + ">" + escapeHtml(token.content) + "</code>";
    };
    default_rules.code_block = function(tokens, idx, options, env, slf) {
      var token = tokens[idx];
      return "<pre" + slf.renderAttrs(token) + "><code>" + escapeHtml(tokens[idx].content) + "</code></pre>\n";
    };
    default_rules.fence = function(tokens, idx, options, env, slf) {
      var token = tokens[idx], info = token.info ? unescapeAll(token.info).trim() : "", langName = "", langAttrs = "", highlighted, i2, arr, tmpAttrs, tmpToken;
      if (info) {
        arr = info.split(/(\s+)/g);
        langName = arr[0];
        langAttrs = arr.slice(2).join("");
      }
      if (options.highlight) {
        highlighted = options.highlight(token.content, langName, langAttrs) || escapeHtml(token.content);
      } else {
        highlighted = escapeHtml(token.content);
      }
      if (highlighted.indexOf("<pre") === 0) {
        return highlighted + "\n";
      }
      if (info) {
        i2 = token.attrIndex("class");
        tmpAttrs = token.attrs ? token.attrs.slice() : [];
        if (i2 < 0) {
          tmpAttrs.push(["class", options.langPrefix + langName]);
        } else {
          tmpAttrs[i2] = tmpAttrs[i2].slice();
          tmpAttrs[i2][1] += " " + options.langPrefix + langName;
        }
        tmpToken = {
          attrs: tmpAttrs
        };
        return "<pre><code" + slf.renderAttrs(tmpToken) + ">" + highlighted + "</code></pre>\n";
      }
      return "<pre><code" + slf.renderAttrs(token) + ">" + highlighted + "</code></pre>\n";
    };
    default_rules.image = function(tokens, idx, options, env, slf) {
      var token = tokens[idx];
      token.attrs[token.attrIndex("alt")][1] = slf.renderInlineAsText(token.children, options, env);
      return slf.renderToken(tokens, idx, options);
    };
    default_rules.hardbreak = function(tokens, idx, options) {
      return options.xhtmlOut ? "<br />\n" : "<br>\n";
    };
    default_rules.softbreak = function(tokens, idx, options) {
      return options.breaks ? options.xhtmlOut ? "<br />\n" : "<br>\n" : "\n";
    };
    default_rules.text = function(tokens, idx) {
      return escapeHtml(tokens[idx].content);
    };
    default_rules.html_block = function(tokens, idx) {
      return tokens[idx].content;
    };
    default_rules.html_inline = function(tokens, idx) {
      return tokens[idx].content;
    };
    function Renderer() {
      this.rules = assign({}, default_rules);
    }
    Renderer.prototype.renderAttrs = function renderAttrs(token) {
      var i2, l2, result;
      if (!token.attrs) {
        return "";
      }
      result = "";
      for (i2 = 0, l2 = token.attrs.length; i2 < l2; i2++) {
        result += " " + escapeHtml(token.attrs[i2][0]) + '="' + escapeHtml(token.attrs[i2][1]) + '"';
      }
      return result;
    };
    Renderer.prototype.renderToken = function renderToken(tokens, idx, options) {
      var nextToken, result = "", needLf = false, token = tokens[idx];
      if (token.hidden) {
        return "";
      }
      if (token.block && token.nesting !== -1 && idx && tokens[idx - 1].hidden) {
        result += "\n";
      }
      result += (token.nesting === -1 ? "</" : "<") + token.tag;
      result += this.renderAttrs(token);
      if (token.nesting === 0 && options.xhtmlOut) {
        result += " /";
      }
      if (token.block) {
        needLf = true;
        if (token.nesting === 1) {
          if (idx + 1 < tokens.length) {
            nextToken = tokens[idx + 1];
            if (nextToken.type === "inline" || nextToken.hidden) {
              needLf = false;
            } else if (nextToken.nesting === -1 && nextToken.tag === token.tag) {
              needLf = false;
            }
          }
        }
      }
      result += needLf ? ">\n" : ">";
      return result;
    };
    Renderer.prototype.renderInline = function(tokens, options, env) {
      var type, result = "", rules = this.rules;
      for (var i2 = 0, len = tokens.length; i2 < len; i2++) {
        type = tokens[i2].type;
        if (typeof rules[type] !== "undefined") {
          result += rules[type](tokens, i2, options, env, this);
        } else {
          result += this.renderToken(tokens, i2, options);
        }
      }
      return result;
    };
    Renderer.prototype.renderInlineAsText = function(tokens, options, env) {
      var result = "";
      for (var i2 = 0, len = tokens.length; i2 < len; i2++) {
        if (tokens[i2].type === "text") {
          result += tokens[i2].content;
        } else if (tokens[i2].type === "image") {
          result += this.renderInlineAsText(tokens[i2].children, options, env);
        } else if (tokens[i2].type === "softbreak") {
          result += "\n";
        }
      }
      return result;
    };
    Renderer.prototype.render = function(tokens, options, env) {
      var i2, len, type, result = "", rules = this.rules;
      for (i2 = 0, len = tokens.length; i2 < len; i2++) {
        type = tokens[i2].type;
        if (type === "inline") {
          result += this.renderInline(tokens[i2].children, options, env);
        } else if (typeof rules[type] !== "undefined") {
          result += rules[type](tokens, i2, options, env, this);
        } else {
          result += this.renderToken(tokens, i2, options, env);
        }
      }
      return result;
    };
    module2.exports = Renderer;
  }
});

// node_modules/markdown-it/lib/ruler.js
var require_ruler = __commonJS({
  "node_modules/markdown-it/lib/ruler.js"(exports, module2) {
    "use strict";
    function Ruler() {
      this.__rules__ = [];
      this.__cache__ = null;
    }
    Ruler.prototype.__find__ = function(name) {
      for (var i2 = 0; i2 < this.__rules__.length; i2++) {
        if (this.__rules__[i2].name === name) {
          return i2;
        }
      }
      return -1;
    };
    Ruler.prototype.__compile__ = function() {
      var self2 = this;
      var chains = [""];
      self2.__rules__.forEach(function(rule) {
        if (!rule.enabled) {
          return;
        }
        rule.alt.forEach(function(altName) {
          if (chains.indexOf(altName) < 0) {
            chains.push(altName);
          }
        });
      });
      self2.__cache__ = {};
      chains.forEach(function(chain) {
        self2.__cache__[chain] = [];
        self2.__rules__.forEach(function(rule) {
          if (!rule.enabled) {
            return;
          }
          if (chain && rule.alt.indexOf(chain) < 0) {
            return;
          }
          self2.__cache__[chain].push(rule.fn);
        });
      });
    };
    Ruler.prototype.at = function(name, fn2, options) {
      var index = this.__find__(name);
      var opt = options || {};
      if (index === -1) {
        throw new Error("Parser rule not found: " + name);
      }
      this.__rules__[index].fn = fn2;
      this.__rules__[index].alt = opt.alt || [];
      this.__cache__ = null;
    };
    Ruler.prototype.before = function(beforeName, ruleName, fn2, options) {
      var index = this.__find__(beforeName);
      var opt = options || {};
      if (index === -1) {
        throw new Error("Parser rule not found: " + beforeName);
      }
      this.__rules__.splice(index, 0, {
        name: ruleName,
        enabled: true,
        fn: fn2,
        alt: opt.alt || []
      });
      this.__cache__ = null;
    };
    Ruler.prototype.after = function(afterName, ruleName, fn2, options) {
      var index = this.__find__(afterName);
      var opt = options || {};
      if (index === -1) {
        throw new Error("Parser rule not found: " + afterName);
      }
      this.__rules__.splice(index + 1, 0, {
        name: ruleName,
        enabled: true,
        fn: fn2,
        alt: opt.alt || []
      });
      this.__cache__ = null;
    };
    Ruler.prototype.push = function(ruleName, fn2, options) {
      var opt = options || {};
      this.__rules__.push({
        name: ruleName,
        enabled: true,
        fn: fn2,
        alt: opt.alt || []
      });
      this.__cache__ = null;
    };
    Ruler.prototype.enable = function(list, ignoreInvalid) {
      if (!Array.isArray(list)) {
        list = [list];
      }
      var result = [];
      list.forEach(function(name) {
        var idx = this.__find__(name);
        if (idx < 0) {
          if (ignoreInvalid) {
            return;
          }
          throw new Error("Rules manager: invalid rule name " + name);
        }
        this.__rules__[idx].enabled = true;
        result.push(name);
      }, this);
      this.__cache__ = null;
      return result;
    };
    Ruler.prototype.enableOnly = function(list, ignoreInvalid) {
      if (!Array.isArray(list)) {
        list = [list];
      }
      this.__rules__.forEach(function(rule) {
        rule.enabled = false;
      });
      this.enable(list, ignoreInvalid);
    };
    Ruler.prototype.disable = function(list, ignoreInvalid) {
      if (!Array.isArray(list)) {
        list = [list];
      }
      var result = [];
      list.forEach(function(name) {
        var idx = this.__find__(name);
        if (idx < 0) {
          if (ignoreInvalid) {
            return;
          }
          throw new Error("Rules manager: invalid rule name " + name);
        }
        this.__rules__[idx].enabled = false;
        result.push(name);
      }, this);
      this.__cache__ = null;
      return result;
    };
    Ruler.prototype.getRules = function(chainName) {
      if (this.__cache__ === null) {
        this.__compile__();
      }
      return this.__cache__[chainName] || [];
    };
    module2.exports = Ruler;
  }
});

// node_modules/markdown-it/lib/rules_core/normalize.js
var require_normalize = __commonJS({
  "node_modules/markdown-it/lib/rules_core/normalize.js"(exports, module2) {
    "use strict";
    var NEWLINES_RE = /\r\n?|\n/g;
    var NULL_RE = /\0/g;
    module2.exports = function normalize(state) {
      var str;
      str = state.src.replace(NEWLINES_RE, "\n");
      str = str.replace(NULL_RE, "\uFFFD");
      state.src = str;
    };
  }
});

// node_modules/markdown-it/lib/rules_core/block.js
var require_block = __commonJS({
  "node_modules/markdown-it/lib/rules_core/block.js"(exports, module2) {
    "use strict";
    module2.exports = function block(state) {
      var token;
      if (state.inlineMode) {
        token = new state.Token("inline", "", 0);
        token.content = state.src;
        token.map = [0, 1];
        token.children = [];
        state.tokens.push(token);
      } else {
        state.md.block.parse(state.src, state.md, state.env, state.tokens);
      }
    };
  }
});

// node_modules/markdown-it/lib/rules_core/inline.js
var require_inline = __commonJS({
  "node_modules/markdown-it/lib/rules_core/inline.js"(exports, module2) {
    "use strict";
    module2.exports = function inline(state) {
      var tokens = state.tokens, tok, i2, l2;
      for (i2 = 0, l2 = tokens.length; i2 < l2; i2++) {
        tok = tokens[i2];
        if (tok.type === "inline") {
          state.md.inline.parse(tok.content, state.md, state.env, tok.children);
        }
      }
    };
  }
});

// node_modules/markdown-it/lib/rules_core/linkify.js
var require_linkify = __commonJS({
  "node_modules/markdown-it/lib/rules_core/linkify.js"(exports, module2) {
    "use strict";
    var arrayReplaceAt = require_utils().arrayReplaceAt;
    function isLinkOpen(str) {
      return /^<a[>\s]/i.test(str);
    }
    function isLinkClose(str) {
      return /^<\/a\s*>/i.test(str);
    }
    module2.exports = function linkify(state) {
      var i2, j2, l2, tokens, token, currentToken, nodes, ln2, text, pos, lastPos, level, htmlLinkLevel, url, fullUrl, urlText, blockTokens = state.tokens, links;
      if (!state.md.options.linkify) {
        return;
      }
      for (j2 = 0, l2 = blockTokens.length; j2 < l2; j2++) {
        if (blockTokens[j2].type !== "inline" || !state.md.linkify.pretest(blockTokens[j2].content)) {
          continue;
        }
        tokens = blockTokens[j2].children;
        htmlLinkLevel = 0;
        for (i2 = tokens.length - 1; i2 >= 0; i2--) {
          currentToken = tokens[i2];
          if (currentToken.type === "link_close") {
            i2--;
            while (tokens[i2].level !== currentToken.level && tokens[i2].type !== "link_open") {
              i2--;
            }
            continue;
          }
          if (currentToken.type === "html_inline") {
            if (isLinkOpen(currentToken.content) && htmlLinkLevel > 0) {
              htmlLinkLevel--;
            }
            if (isLinkClose(currentToken.content)) {
              htmlLinkLevel++;
            }
          }
          if (htmlLinkLevel > 0) {
            continue;
          }
          if (currentToken.type === "text" && state.md.linkify.test(currentToken.content)) {
            text = currentToken.content;
            links = state.md.linkify.match(text);
            nodes = [];
            level = currentToken.level;
            lastPos = 0;
            if (links.length > 0 && links[0].index === 0 && i2 > 0 && tokens[i2 - 1].type === "text_special") {
              links = links.slice(1);
            }
            for (ln2 = 0; ln2 < links.length; ln2++) {
              url = links[ln2].url;
              fullUrl = state.md.normalizeLink(url);
              if (!state.md.validateLink(fullUrl)) {
                continue;
              }
              urlText = links[ln2].text;
              if (!links[ln2].schema) {
                urlText = state.md.normalizeLinkText("http://" + urlText).replace(/^http:\/\//, "");
              } else if (links[ln2].schema === "mailto:" && !/^mailto:/i.test(urlText)) {
                urlText = state.md.normalizeLinkText("mailto:" + urlText).replace(/^mailto:/, "");
              } else {
                urlText = state.md.normalizeLinkText(urlText);
              }
              pos = links[ln2].index;
              if (pos > lastPos) {
                token = new state.Token("text", "", 0);
                token.content = text.slice(lastPos, pos);
                token.level = level;
                nodes.push(token);
              }
              token = new state.Token("link_open", "a", 1);
              token.attrs = [["href", fullUrl]];
              token.level = level++;
              token.markup = "linkify";
              token.info = "auto";
              nodes.push(token);
              token = new state.Token("text", "", 0);
              token.content = urlText;
              token.level = level;
              nodes.push(token);
              token = new state.Token("link_close", "a", -1);
              token.level = --level;
              token.markup = "linkify";
              token.info = "auto";
              nodes.push(token);
              lastPos = links[ln2].lastIndex;
            }
            if (lastPos < text.length) {
              token = new state.Token("text", "", 0);
              token.content = text.slice(lastPos);
              token.level = level;
              nodes.push(token);
            }
            blockTokens[j2].children = tokens = arrayReplaceAt(tokens, i2, nodes);
          }
        }
      }
    };
  }
});

// node_modules/markdown-it/lib/rules_core/replacements.js
var require_replacements = __commonJS({
  "node_modules/markdown-it/lib/rules_core/replacements.js"(exports, module2) {
    "use strict";
    var RARE_RE = /\+-|\.\.|\?\?\?\?|!!!!|,,|--/;
    var SCOPED_ABBR_TEST_RE = /\((c|tm|r)\)/i;
    var SCOPED_ABBR_RE = /\((c|tm|r)\)/ig;
    var SCOPED_ABBR = {
      c: "\xA9",
      r: "\xAE",
      tm: "\u2122"
    };
    function replaceFn(match, name) {
      return SCOPED_ABBR[name.toLowerCase()];
    }
    function replace_scoped(inlineTokens) {
      var i2, token, inside_autolink = 0;
      for (i2 = inlineTokens.length - 1; i2 >= 0; i2--) {
        token = inlineTokens[i2];
        if (token.type === "text" && !inside_autolink) {
          token.content = token.content.replace(SCOPED_ABBR_RE, replaceFn);
        }
        if (token.type === "link_open" && token.info === "auto") {
          inside_autolink--;
        }
        if (token.type === "link_close" && token.info === "auto") {
          inside_autolink++;
        }
      }
    }
    function replace_rare(inlineTokens) {
      var i2, token, inside_autolink = 0;
      for (i2 = inlineTokens.length - 1; i2 >= 0; i2--) {
        token = inlineTokens[i2];
        if (token.type === "text" && !inside_autolink) {
          if (RARE_RE.test(token.content)) {
            token.content = token.content.replace(/\+-/g, "\xB1").replace(/\.{2,}/g, "\u2026").replace(/([?!])…/g, "$1..").replace(/([?!]){4,}/g, "$1$1$1").replace(/,{2,}/g, ",").replace(/(^|[^-])---(?=[^-]|$)/mg, "$1\u2014").replace(/(^|\s)--(?=\s|$)/mg, "$1\u2013").replace(/(^|[^-\s])--(?=[^-\s]|$)/mg, "$1\u2013");
          }
        }
        if (token.type === "link_open" && token.info === "auto") {
          inside_autolink--;
        }
        if (token.type === "link_close" && token.info === "auto") {
          inside_autolink++;
        }
      }
    }
    module2.exports = function replace(state) {
      var blkIdx;
      if (!state.md.options.typographer) {
        return;
      }
      for (blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) {
        if (state.tokens[blkIdx].type !== "inline") {
          continue;
        }
        if (SCOPED_ABBR_TEST_RE.test(state.tokens[blkIdx].content)) {
          replace_scoped(state.tokens[blkIdx].children);
        }
        if (RARE_RE.test(state.tokens[blkIdx].content)) {
          replace_rare(state.tokens[blkIdx].children);
        }
      }
    };
  }
});

// node_modules/markdown-it/lib/rules_core/smartquotes.js
var require_smartquotes = __commonJS({
  "node_modules/markdown-it/lib/rules_core/smartquotes.js"(exports, module2) {
    "use strict";
    var isWhiteSpace = require_utils().isWhiteSpace;
    var isPunctChar = require_utils().isPunctChar;
    var isMdAsciiPunct = require_utils().isMdAsciiPunct;
    var QUOTE_TEST_RE = /['"]/;
    var QUOTE_RE = /['"]/g;
    var APOSTROPHE = "\u2019";
    function replaceAt(str, index, ch) {
      return str.slice(0, index) + ch + str.slice(index + 1);
    }
    function process_inlines(tokens, state) {
      var i2, token, text, t2, pos, max2, thisLevel, item, lastChar, nextChar, isLastPunctChar, isNextPunctChar, isLastWhiteSpace, isNextWhiteSpace, canOpen, canClose, j2, isSingle2, stack, openQuote, closeQuote;
      stack = [];
      for (i2 = 0; i2 < tokens.length; i2++) {
        token = tokens[i2];
        thisLevel = tokens[i2].level;
        for (j2 = stack.length - 1; j2 >= 0; j2--) {
          if (stack[j2].level <= thisLevel) {
            break;
          }
        }
        stack.length = j2 + 1;
        if (token.type !== "text") {
          continue;
        }
        text = token.content;
        pos = 0;
        max2 = text.length;
        OUTER:
          while (pos < max2) {
            QUOTE_RE.lastIndex = pos;
            t2 = QUOTE_RE.exec(text);
            if (!t2) {
              break;
            }
            canOpen = canClose = true;
            pos = t2.index + 1;
            isSingle2 = t2[0] === "'";
            lastChar = 32;
            if (t2.index - 1 >= 0) {
              lastChar = text.charCodeAt(t2.index - 1);
            } else {
              for (j2 = i2 - 1; j2 >= 0; j2--) {
                if (tokens[j2].type === "softbreak" || tokens[j2].type === "hardbreak")
                  break;
                if (!tokens[j2].content)
                  continue;
                lastChar = tokens[j2].content.charCodeAt(tokens[j2].content.length - 1);
                break;
              }
            }
            nextChar = 32;
            if (pos < max2) {
              nextChar = text.charCodeAt(pos);
            } else {
              for (j2 = i2 + 1; j2 < tokens.length; j2++) {
                if (tokens[j2].type === "softbreak" || tokens[j2].type === "hardbreak")
                  break;
                if (!tokens[j2].content)
                  continue;
                nextChar = tokens[j2].content.charCodeAt(0);
                break;
              }
            }
            isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar));
            isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar));
            isLastWhiteSpace = isWhiteSpace(lastChar);
            isNextWhiteSpace = isWhiteSpace(nextChar);
            if (isNextWhiteSpace) {
              canOpen = false;
            } else if (isNextPunctChar) {
              if (!(isLastWhiteSpace || isLastPunctChar)) {
                canOpen = false;
              }
            }
            if (isLastWhiteSpace) {
              canClose = false;
            } else if (isLastPunctChar) {
              if (!(isNextWhiteSpace || isNextPunctChar)) {
                canClose = false;
              }
            }
            if (nextChar === 34 && t2[0] === '"') {
              if (lastChar >= 48 && lastChar <= 57) {
                canClose = canOpen = false;
              }
            }
            if (canOpen && canClose) {
              canOpen = isLastPunctChar;
              canClose = isNextPunctChar;
            }
            if (!canOpen && !canClose) {
              if (isSingle2) {
                token.content = replaceAt(token.content, t2.index, APOSTROPHE);
              }
              continue;
            }
            if (canClose) {
              for (j2 = stack.length - 1; j2 >= 0; j2--) {
                item = stack[j2];
                if (stack[j2].level < thisLevel) {
                  break;
                }
                if (item.single === isSingle2 && stack[j2].level === thisLevel) {
                  item = stack[j2];
                  if (isSingle2) {
                    openQuote = state.md.options.quotes[2];
                    closeQuote = state.md.options.quotes[3];
                  } else {
                    openQuote = state.md.options.quotes[0];
                    closeQuote = state.md.options.quotes[1];
                  }
                  token.content = replaceAt(token.content, t2.index, closeQuote);
                  tokens[item.token].content = replaceAt(
                    tokens[item.token].content,
                    item.pos,
                    openQuote
                  );
                  pos += closeQuote.length - 1;
                  if (item.token === i2) {
                    pos += openQuote.length - 1;
                  }
                  text = token.content;
                  max2 = text.length;
                  stack.length = j2;
                  continue OUTER;
                }
              }
            }
            if (canOpen) {
              stack.push({
                token: i2,
                pos: t2.index,
                single: isSingle2,
                level: thisLevel
              });
            } else if (canClose && isSingle2) {
              token.content = replaceAt(token.content, t2.index, APOSTROPHE);
            }
          }
      }
    }
    module2.exports = function smartquotes(state) {
      var blkIdx;
      if (!state.md.options.typographer) {
        return;
      }
      for (blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) {
        if (state.tokens[blkIdx].type !== "inline" || !QUOTE_TEST_RE.test(state.tokens[blkIdx].content)) {
          continue;
        }
        process_inlines(state.tokens[blkIdx].children, state);
      }
    };
  }
});

// node_modules/markdown-it/lib/rules_core/text_join.js
var require_text_join = __commonJS({
  "node_modules/markdown-it/lib/rules_core/text_join.js"(exports, module2) {
    "use strict";
    module2.exports = function text_join(state) {
      var j2, l2, tokens, curr, max2, last2, blockTokens = state.tokens;
      for (j2 = 0, l2 = blockTokens.length; j2 < l2; j2++) {
        if (blockTokens[j2].type !== "inline")
          continue;
        tokens = blockTokens[j2].children;
        max2 = tokens.length;
        for (curr = 0; curr < max2; curr++) {
          if (tokens[curr].type === "text_special") {
            tokens[curr].type = "text";
          }
        }
        for (curr = last2 = 0; curr < max2; curr++) {
          if (tokens[curr].type === "text" && curr + 1 < max2 && tokens[curr + 1].type === "text") {
            tokens[curr + 1].content = tokens[curr].content + tokens[curr + 1].content;
          } else {
            if (curr !== last2) {
              tokens[last2] = tokens[curr];
            }
            last2++;
          }
        }
        if (curr !== last2) {
          tokens.length = last2;
        }
      }
    };
  }
});

// node_modules/markdown-it/lib/token.js
var require_token = __commonJS({
  "node_modules/markdown-it/lib/token.js"(exports, module2) {
    "use strict";
    function Token(type, tag, nesting) {
      this.type = type;
      this.tag = tag;
      this.attrs = null;
      this.map = null;
      this.nesting = nesting;
      this.level = 0;
      this.children = null;
      this.content = "";
      this.markup = "";
      this.info = "";
      this.meta = null;
      this.block = false;
      this.hidden = false;
    }
    Token.prototype.attrIndex = function attrIndex(name) {
      var attrs, i2, len;
      if (!this.attrs) {
        return -1;
      }
      attrs = this.attrs;
      for (i2 = 0, len = attrs.length; i2 < len; i2++) {
        if (attrs[i2][0] === name) {
          return i2;
        }
      }
      return -1;
    };
    Token.prototype.attrPush = function attrPush(attrData) {
      if (this.attrs) {
        this.attrs.push(attrData);
      } else {
        this.attrs = [attrData];
      }
    };
    Token.prototype.attrSet = function attrSet(name, value) {
      var idx = this.attrIndex(name), attrData = [name, value];
      if (idx < 0) {
        this.attrPush(attrData);
      } else {
        this.attrs[idx] = attrData;
      }
    };
    Token.prototype.attrGet = function attrGet(name) {
      var idx = this.attrIndex(name), value = null;
      if (idx >= 0) {
        value = this.attrs[idx][1];
      }
      return value;
    };
    Token.prototype.attrJoin = function attrJoin(name, value) {
      var idx = this.attrIndex(name);
      if (idx < 0) {
        this.attrPush([name, value]);
      } else {
        this.attrs[idx][1] = this.attrs[idx][1] + " " + value;
      }
    };
    module2.exports = Token;
  }
});

// node_modules/markdown-it/lib/rules_core/state_core.js
var require_state_core = __commonJS({
  "node_modules/markdown-it/lib/rules_core/state_core.js"(exports, module2) {
    "use strict";
    var Token = require_token();
    function StateCore(src, md, env) {
      this.src = src;
      this.env = env;
      this.tokens = [];
      this.inlineMode = false;
      this.md = md;
    }
    StateCore.prototype.Token = Token;
    module2.exports = StateCore;
  }
});

// node_modules/markdown-it/lib/parser_core.js
var require_parser_core = __commonJS({
  "node_modules/markdown-it/lib/parser_core.js"(exports, module2) {
    "use strict";
    var Ruler = require_ruler();
    var _rules = [
      ["normalize", require_normalize()],
      ["block", require_block()],
      ["inline", require_inline()],
      ["linkify", require_linkify()],
      ["replacements", require_replacements()],
      ["smartquotes", require_smartquotes()],
      // `text_join` finds `text_special` tokens (for escape sequences)
      // and joins them with the rest of the text
      ["text_join", require_text_join()]
    ];
    function Core() {
      this.ruler = new Ruler();
      for (var i2 = 0; i2 < _rules.length; i2++) {
        this.ruler.push(_rules[i2][0], _rules[i2][1]);
      }
    }
    Core.prototype.process = function(state) {
      var i2, l2, rules;
      rules = this.ruler.getRules("");
      for (i2 = 0, l2 = rules.length; i2 < l2; i2++) {
        rules[i2](state);
      }
    };
    Core.prototype.State = require_state_core();
    module2.exports = Core;
  }
});

// node_modules/markdown-it/lib/rules_block/table.js
var require_table = __commonJS({
  "node_modules/markdown-it/lib/rules_block/table.js"(exports, module2) {
    "use strict";
    var isSpace = require_utils().isSpace;
    function getLine(state, line) {
      var pos = state.bMarks[line] + state.tShift[line], max2 = state.eMarks[line];
      return state.src.slice(pos, max2);
    }
    function escapedSplit(str) {
      var result = [], pos = 0, max2 = str.length, ch, isEscaped = false, lastPos = 0, current = "";
      ch = str.charCodeAt(pos);
      while (pos < max2) {
        if (ch === 124) {
          if (!isEscaped) {
            result.push(current + str.substring(lastPos, pos));
            current = "";
            lastPos = pos + 1;
          } else {
            current += str.substring(lastPos, pos - 1);
            lastPos = pos;
          }
        }
        isEscaped = ch === 92;
        pos++;
        ch = str.charCodeAt(pos);
      }
      result.push(current + str.substring(lastPos));
      return result;
    }
    module2.exports = function table(state, startLine, endLine, silent) {
      var ch, lineText, pos, i2, l2, nextLine, columns, columnCount, token, aligns, t2, tableLines, tbodyLines, oldParentType, terminate, terminatorRules, firstCh, secondCh;
      if (startLine + 2 > endLine) {
        return false;
      }
      nextLine = startLine + 1;
      if (state.sCount[nextLine] < state.blkIndent) {
        return false;
      }
      if (state.sCount[nextLine] - state.blkIndent >= 4) {
        return false;
      }
      pos = state.bMarks[nextLine] + state.tShift[nextLine];
      if (pos >= state.eMarks[nextLine]) {
        return false;
      }
      firstCh = state.src.charCodeAt(pos++);
      if (firstCh !== 124 && firstCh !== 45 && firstCh !== 58) {
        return false;
      }
      if (pos >= state.eMarks[nextLine]) {
        return false;
      }
      secondCh = state.src.charCodeAt(pos++);
      if (secondCh !== 124 && secondCh !== 45 && secondCh !== 58 && !isSpace(secondCh)) {
        return false;
      }
      if (firstCh === 45 && isSpace(secondCh)) {
        return false;
      }
      while (pos < state.eMarks[nextLine]) {
        ch = state.src.charCodeAt(pos);
        if (ch !== 124 && ch !== 45 && ch !== 58 && !isSpace(ch)) {
          return false;
        }
        pos++;
      }
      lineText = getLine(state, startLine + 1);
      columns = lineText.split("|");
      aligns = [];
      for (i2 = 0; i2 < columns.length; i2++) {
        t2 = columns[i2].trim();
        if (!t2) {
          if (i2 === 0 || i2 === columns.length - 1) {
            continue;
          } else {
            return false;
          }
        }
        if (!/^:?-+:?$/.test(t2)) {
          return false;
        }
        if (t2.charCodeAt(t2.length - 1) === 58) {
          aligns.push(t2.charCodeAt(0) === 58 ? "center" : "right");
        } else if (t2.charCodeAt(0) === 58) {
          aligns.push("left");
        } else {
          aligns.push("");
        }
      }
      lineText = getLine(state, startLine).trim();
      if (lineText.indexOf("|") === -1) {
        return false;
      }
      if (state.sCount[startLine] - state.blkIndent >= 4) {
        return false;
      }
      columns = escapedSplit(lineText);
      if (columns.length && columns[0] === "")
        columns.shift();
      if (columns.length && columns[columns.length - 1] === "")
        columns.pop();
      columnCount = columns.length;
      if (columnCount === 0 || columnCount !== aligns.length) {
        return false;
      }
      if (silent) {
        return true;
      }
      oldParentType = state.parentType;
      state.parentType = "table";
      terminatorRules = state.md.block.ruler.getRules("blockquote");
      token = state.push("table_open", "table", 1);
      token.map = tableLines = [startLine, 0];
      token = state.push("thead_open", "thead", 1);
      token.map = [startLine, startLine + 1];
      token = state.push("tr_open", "tr", 1);
      token.map = [startLine, startLine + 1];
      for (i2 = 0; i2 < columns.length; i2++) {
        token = state.push("th_open", "th", 1);
        if (aligns[i2]) {
          token.attrs = [["style", "text-align:" + aligns[i2]]];
        }
        token = state.push("inline", "", 0);
        token.content = columns[i2].trim();
        token.children = [];
        token = state.push("th_close", "th", -1);
      }
      token = state.push("tr_close", "tr", -1);
      token = state.push("thead_close", "thead", -1);
      for (nextLine = startLine + 2; nextLine < endLine; nextLine++) {
        if (state.sCount[nextLine] < state.blkIndent) {
          break;
        }
        terminate = false;
        for (i2 = 0, l2 = terminatorRules.length; i2 < l2; i2++) {
          if (terminatorRules[i2](state, nextLine, endLine, true)) {
            terminate = true;
            break;
          }
        }
        if (terminate) {
          break;
        }
        lineText = getLine(state, nextLine).trim();
        if (!lineText) {
          break;
        }
        if (state.sCount[nextLine] - state.blkIndent >= 4) {
          break;
        }
        columns = escapedSplit(lineText);
        if (columns.length && columns[0] === "")
          columns.shift();
        if (columns.length && columns[columns.length - 1] === "")
          columns.pop();
        if (nextLine === startLine + 2) {
          token = state.push("tbody_open", "tbody", 1);
          token.map = tbodyLines = [startLine + 2, 0];
        }
        token = state.push("tr_open", "tr", 1);
        token.map = [nextLine, nextLine + 1];
        for (i2 = 0; i2 < columnCount; i2++) {
          token = state.push("td_open", "td", 1);
          if (aligns[i2]) {
            token.attrs = [["style", "text-align:" + aligns[i2]]];
          }
          token = state.push("inline", "", 0);
          token.content = columns[i2] ? columns[i2].trim() : "";
          token.children = [];
          token = state.push("td_close", "td", -1);
        }
        token = state.push("tr_close", "tr", -1);
      }
      if (tbodyLines) {
        token = state.push("tbody_close", "tbody", -1);
        tbodyLines[1] = nextLine;
      }
      token = state.push("table_close", "table", -1);
      tableLines[1] = nextLine;
      state.parentType = oldParentType;
      state.line = nextLine;
      return true;
    };
  }
});

// node_modules/markdown-it/lib/rules_block/code.js
var require_code = __commonJS({
  "node_modules/markdown-it/lib/rules_block/code.js"(exports, module2) {
    "use strict";
    module2.exports = function code(state, startLine, endLine) {
      var nextLine, last2, token;
      if (state.sCount[startLine] - state.blkIndent < 4) {
        return false;
      }
      last2 = nextLine = startLine + 1;
      while (nextLine < endLine) {
        if (state.isEmpty(nextLine)) {
          nextLine++;
          continue;
        }
        if (state.sCount[nextLine] - state.blkIndent >= 4) {
          nextLine++;
          last2 = nextLine;
          continue;
        }
        break;
      }
      state.line = last2;
      token = state.push("code_block", "code", 0);
      token.content = state.getLines(startLine, last2, 4 + state.blkIndent, false) + "\n";
      token.map = [startLine, state.line];
      return true;
    };
  }
});

// node_modules/markdown-it/lib/rules_block/fence.js
var require_fence = __commonJS({
  "node_modules/markdown-it/lib/rules_block/fence.js"(exports, module2) {
    "use strict";
    module2.exports = function fence(state, startLine, endLine, silent) {
      var marker, len, params, nextLine, mem, token, markup, haveEndMarker = false, pos = state.bMarks[startLine] + state.tShift[startLine], max2 = state.eMarks[startLine];
      if (state.sCount[startLine] - state.blkIndent >= 4) {
        return false;
      }
      if (pos + 3 > max2) {
        return false;
      }
      marker = state.src.charCodeAt(pos);
      if (marker !== 126 && marker !== 96) {
        return false;
      }
      mem = pos;
      pos = state.skipChars(pos, marker);
      len = pos - mem;
      if (len < 3) {
        return false;
      }
      markup = state.src.slice(mem, pos);
      params = state.src.slice(pos, max2);
      if (marker === 96) {
        if (params.indexOf(String.fromCharCode(marker)) >= 0) {
          return false;
        }
      }
      if (silent) {
        return true;
      }
      nextLine = startLine;
      for (; ; ) {
        nextLine++;
        if (nextLine >= endLine) {
          break;
        }
        pos = mem = state.bMarks[nextLine] + state.tShift[nextLine];
        max2 = state.eMarks[nextLine];
        if (pos < max2 && state.sCount[nextLine] < state.blkIndent) {
          break;
        }
        if (state.src.charCodeAt(pos) !== marker) {
          continue;
        }
        if (state.sCount[nextLine] - state.blkIndent >= 4) {
          continue;
        }
        pos = state.skipChars(pos, marker);
        if (pos - mem < len) {
          continue;
        }
        pos = state.skipSpaces(pos);
        if (pos < max2) {
          continue;
        }
        haveEndMarker = true;
        break;
      }
      len = state.sCount[startLine];
      state.line = nextLine + (haveEndMarker ? 1 : 0);
      token = state.push("fence", "code", 0);
      token.info = params;
      token.content = state.getLines(startLine + 1, nextLine, len, true);
      token.markup = markup;
      token.map = [startLine, state.line];
      return true;
    };
  }
});

// node_modules/markdown-it/lib/rules_block/blockquote.js
var require_blockquote = __commonJS({
  "node_modules/markdown-it/lib/rules_block/blockquote.js"(exports, module2) {
    "use strict";
    var isSpace = require_utils().isSpace;
    module2.exports = function blockquote(state, startLine, endLine, silent) {
      var adjustTab, ch, i2, initial, l2, lastLineEmpty, lines, nextLine, offset, oldBMarks, oldBSCount, oldIndent, oldParentType, oldSCount, oldTShift, spaceAfterMarker, terminate, terminatorRules, token, isOutdented, oldLineMax = state.lineMax, pos = state.bMarks[startLine] + state.tShift[startLine], max2 = state.eMarks[startLine];
      if (state.sCount[startLine] - state.blkIndent >= 4) {
        return false;
      }
      if (state.src.charCodeAt(pos) !== 62) {
        return false;
      }
      if (silent) {
        return true;
      }
      oldBMarks = [];
      oldBSCount = [];
      oldSCount = [];
      oldTShift = [];
      terminatorRules = state.md.block.ruler.getRules("blockquote");
      oldParentType = state.parentType;
      state.parentType = "blockquote";
      for (nextLine = startLine; nextLine < endLine; nextLine++) {
        isOutdented = state.sCount[nextLine] < state.blkIndent;
        pos = state.bMarks[nextLine] + state.tShift[nextLine];
        max2 = state.eMarks[nextLine];
        if (pos >= max2) {
          break;
        }
        if (state.src.charCodeAt(pos++) === 62 && !isOutdented) {
          initial = state.sCount[nextLine] + 1;
          if (state.src.charCodeAt(pos) === 32) {
            pos++;
            initial++;
            adjustTab = false;
            spaceAfterMarker = true;
          } else if (state.src.charCodeAt(pos) === 9) {
            spaceAfterMarker = true;
            if ((state.bsCount[nextLine] + initial) % 4 === 3) {
              pos++;
              initial++;
              adjustTab = false;
            } else {
              adjustTab = true;
            }
          } else {
            spaceAfterMarker = false;
          }
          offset = initial;
          oldBMarks.push(state.bMarks[nextLine]);
          state.bMarks[nextLine] = pos;
          while (pos < max2) {
            ch = state.src.charCodeAt(pos);
            if (isSpace(ch)) {
              if (ch === 9) {
                offset += 4 - (offset + state.bsCount[nextLine] + (adjustTab ? 1 : 0)) % 4;
              } else {
                offset++;
              }
            } else {
              break;
            }
            pos++;
          }
          lastLineEmpty = pos >= max2;
          oldBSCount.push(state.bsCount[nextLine]);
          state.bsCount[nextLine] = state.sCount[nextLine] + 1 + (spaceAfterMarker ? 1 : 0);
          oldSCount.push(state.sCount[nextLine]);
          state.sCount[nextLine] = offset - initial;
          oldTShift.push(state.tShift[nextLine]);
          state.tShift[nextLine] = pos - state.bMarks[nextLine];
          continue;
        }
        if (lastLineEmpty) {
          break;
        }
        terminate = false;
        for (i2 = 0, l2 = terminatorRules.length; i2 < l2; i2++) {
          if (terminatorRules[i2](state, nextLine, endLine, true)) {
            terminate = true;
            break;
          }
        }
        if (terminate) {
          state.lineMax = nextLine;
          if (state.blkIndent !== 0) {
            oldBMarks.push(state.bMarks[nextLine]);
            oldBSCount.push(state.bsCount[nextLine]);
            oldTShift.push(state.tShift[nextLine]);
            oldSCount.push(state.sCount[nextLine]);
            state.sCount[nextLine] -= state.blkIndent;
          }
          break;
        }
        oldBMarks.push(state.bMarks[nextLine]);
        oldBSCount.push(state.bsCount[nextLine]);
        oldTShift.push(state.tShift[nextLine]);
        oldSCount.push(state.sCount[nextLine]);
        state.sCount[nextLine] = -1;
      }
      oldIndent = state.blkIndent;
      state.blkIndent = 0;
      token = state.push("blockquote_open", "blockquote", 1);
      token.markup = ">";
      token.map = lines = [startLine, 0];
      state.md.block.tokenize(state, startLine, nextLine);
      token = state.push("blockquote_close", "blockquote", -1);
      token.markup = ">";
      state.lineMax = oldLineMax;
      state.parentType = oldParentType;
      lines[1] = state.line;
      for (i2 = 0; i2 < oldTShift.length; i2++) {
        state.bMarks[i2 + startLine] = oldBMarks[i2];
        state.tShift[i2 + startLine] = oldTShift[i2];
        state.sCount[i2 + startLine] = oldSCount[i2];
        state.bsCount[i2 + startLine] = oldBSCount[i2];
      }
      state.blkIndent = oldIndent;
      return true;
    };
  }
});

// node_modules/markdown-it/lib/rules_block/hr.js
var require_hr = __commonJS({
  "node_modules/markdown-it/lib/rules_block/hr.js"(exports, module2) {
    "use strict";
    var isSpace = require_utils().isSpace;
    module2.exports = function hr(state, startLine, endLine, silent) {
      var marker, cnt, ch, token, pos = state.bMarks[startLine] + state.tShift[startLine], max2 = state.eMarks[startLine];
      if (state.sCount[startLine] - state.blkIndent >= 4) {
        return false;
      }
      marker = state.src.charCodeAt(pos++);
      if (marker !== 42 && marker !== 45 && marker !== 95) {
        return false;
      }
      cnt = 1;
      while (pos < max2) {
        ch = state.src.charCodeAt(pos++);
        if (ch !== marker && !isSpace(ch)) {
          return false;
        }
        if (ch === marker) {
          cnt++;
        }
      }
      if (cnt < 3) {
        return false;
      }
      if (silent) {
        return true;
      }
      state.line = startLine + 1;
      token = state.push("hr", "hr", 0);
      token.map = [startLine, state.line];
      token.markup = Array(cnt + 1).join(String.fromCharCode(marker));
      return true;
    };
  }
});

// node_modules/markdown-it/lib/rules_block/list.js
var require_list = __commonJS({
  "node_modules/markdown-it/lib/rules_block/list.js"(exports, module2) {
    "use strict";
    var isSpace = require_utils().isSpace;
    function skipBulletListMarker(state, startLine) {
      var marker, pos, max2, ch;
      pos = state.bMarks[startLine] + state.tShift[startLine];
      max2 = state.eMarks[startLine];
      marker = state.src.charCodeAt(pos++);
      if (marker !== 42 && marker !== 45 && marker !== 43) {
        return -1;
      }
      if (pos < max2) {
        ch = state.src.charCodeAt(pos);
        if (!isSpace(ch)) {
          return -1;
        }
      }
      return pos;
    }
    function skipOrderedListMarker(state, startLine) {
      var ch, start = state.bMarks[startLine] + state.tShift[startLine], pos = start, max2 = state.eMarks[startLine];
      if (pos + 1 >= max2) {
        return -1;
      }
      ch = state.src.charCodeAt(pos++);
      if (ch < 48 || ch > 57) {
        return -1;
      }
      for (; ; ) {
        if (pos >= max2) {
          return -1;
        }
        ch = state.src.charCodeAt(pos++);
        if (ch >= 48 && ch <= 57) {
          if (pos - start >= 10) {
            return -1;
          }
          continue;
        }
        if (ch === 41 || ch === 46) {
          break;
        }
        return -1;
      }
      if (pos < max2) {
        ch = state.src.charCodeAt(pos);
        if (!isSpace(ch)) {
          return -1;
        }
      }
      return pos;
    }
    function markTightParagraphs(state, idx) {
      var i2, l2, level = state.level + 2;
      for (i2 = idx + 2, l2 = state.tokens.length - 2; i2 < l2; i2++) {
        if (state.tokens[i2].level === level && state.tokens[i2].type === "paragraph_open") {
          state.tokens[i2 + 2].hidden = true;
          state.tokens[i2].hidden = true;
          i2 += 2;
        }
      }
    }
    module2.exports = function list(state, startLine, endLine, silent) {
      var ch, contentStart, i2, indent, indentAfterMarker, initial, isOrdered, itemLines, l2, listLines, listTokIdx, markerCharCode, markerValue, max2, offset, oldListIndent, oldParentType, oldSCount, oldTShift, oldTight, pos, posAfterMarker, prevEmptyEnd, start, terminate, terminatorRules, token, nextLine = startLine, isTerminatingParagraph = false, tight = true;
      if (state.sCount[nextLine] - state.blkIndent >= 4) {
        return false;
      }
      if (state.listIndent >= 0 && state.sCount[nextLine] - state.listIndent >= 4 && state.sCount[nextLine] < state.blkIndent) {
        return false;
      }
      if (silent && state.parentType === "paragraph") {
        if (state.sCount[nextLine] >= state.blkIndent) {
          isTerminatingParagraph = true;
        }
      }
      if ((posAfterMarker = skipOrderedListMarker(state, nextLine)) >= 0) {
        isOrdered = true;
        start = state.bMarks[nextLine] + state.tShift[nextLine];
        markerValue = Number(state.src.slice(start, posAfterMarker - 1));
        if (isTerminatingParagraph && markerValue !== 1)
          return false;
      } else if ((posAfterMarker = skipBulletListMarker(state, nextLine)) >= 0) {
        isOrdered = false;
      } else {
        return false;
      }
      if (isTerminatingParagraph) {
        if (state.skipSpaces(posAfterMarker) >= state.eMarks[nextLine])
          return false;
      }
      if (silent) {
        return true;
      }
      markerCharCode = state.src.charCodeAt(posAfterMarker - 1);
      listTokIdx = state.tokens.length;
      if (isOrdered) {
        token = state.push("ordered_list_open", "ol", 1);
        if (markerValue !== 1) {
          token.attrs = [["start", markerValue]];
        }
      } else {
        token = state.push("bullet_list_open", "ul", 1);
      }
      token.map = listLines = [nextLine, 0];
      token.markup = String.fromCharCode(markerCharCode);
      prevEmptyEnd = false;
      terminatorRules = state.md.block.ruler.getRules("list");
      oldParentType = state.parentType;
      state.parentType = "list";
      while (nextLine < endLine) {
        pos = posAfterMarker;
        max2 = state.eMarks[nextLine];
        initial = offset = state.sCount[nextLine] + posAfterMarker - (state.bMarks[nextLine] + state.tShift[nextLine]);
        while (pos < max2) {
          ch = state.src.charCodeAt(pos);
          if (ch === 9) {
            offset += 4 - (offset + state.bsCount[nextLine]) % 4;
          } else if (ch === 32) {
            offset++;
          } else {
            break;
          }
          pos++;
        }
        contentStart = pos;
        if (contentStart >= max2) {
          indentAfterMarker = 1;
        } else {
          indentAfterMarker = offset - initial;
        }
        if (indentAfterMarker > 4) {
          indentAfterMarker = 1;
        }
        indent = initial + indentAfterMarker;
        token = state.push("list_item_open", "li", 1);
        token.markup = String.fromCharCode(markerCharCode);
        token.map = itemLines = [nextLine, 0];
        if (isOrdered) {
          token.info = state.src.slice(start, posAfterMarker - 1);
        }
        oldTight = state.tight;
        oldTShift = state.tShift[nextLine];
        oldSCount = state.sCount[nextLine];
        oldListIndent = state.listIndent;
        state.listIndent = state.blkIndent;
        state.blkIndent = indent;
        state.tight = true;
        state.tShift[nextLine] = contentStart - state.bMarks[nextLine];
        state.sCount[nextLine] = offset;
        if (contentStart >= max2 && state.isEmpty(nextLine + 1)) {
          state.line = Math.min(state.line + 2, endLine);
        } else {
          state.md.block.tokenize(state, nextLine, endLine, true);
        }
        if (!state.tight || prevEmptyEnd) {
          tight = false;
        }
        prevEmptyEnd = state.line - nextLine > 1 && state.isEmpty(state.line - 1);
        state.blkIndent = state.listIndent;
        state.listIndent = oldListIndent;
        state.tShift[nextLine] = oldTShift;
        state.sCount[nextLine] = oldSCount;
        state.tight = oldTight;
        token = state.push("list_item_close", "li", -1);
        token.markup = String.fromCharCode(markerCharCode);
        nextLine = state.line;
        itemLines[1] = nextLine;
        if (nextLine >= endLine) {
          break;
        }
        if (state.sCount[nextLine] < state.blkIndent) {
          break;
        }
        if (state.sCount[nextLine] - state.blkIndent >= 4) {
          break;
        }
        terminate = false;
        for (i2 = 0, l2 = terminatorRules.length; i2 < l2; i2++) {
          if (terminatorRules[i2](state, nextLine, endLine, true)) {
            terminate = true;
            break;
          }
        }
        if (terminate) {
          break;
        }
        if (isOrdered) {
          posAfterMarker = skipOrderedListMarker(state, nextLine);
          if (posAfterMarker < 0) {
            break;
          }
          start = state.bMarks[nextLine] + state.tShift[nextLine];
        } else {
          posAfterMarker = skipBulletListMarker(state, nextLine);
          if (posAfterMarker < 0) {
            break;
          }
        }
        if (markerCharCode !== state.src.charCodeAt(posAfterMarker - 1)) {
          break;
        }
      }
      if (isOrdered) {
        token = state.push("ordered_list_close", "ol", -1);
      } else {
        token = state.push("bullet_list_close", "ul", -1);
      }
      token.markup = String.fromCharCode(markerCharCode);
      listLines[1] = nextLine;
      state.line = nextLine;
      state.parentType = oldParentType;
      if (tight) {
        markTightParagraphs(state, listTokIdx);
      }
      return true;
    };
  }
});

// node_modules/markdown-it/lib/rules_block/reference.js
var require_reference = __commonJS({
  "node_modules/markdown-it/lib/rules_block/reference.js"(exports, module2) {
    "use strict";
    var normalizeReference = require_utils().normalizeReference;
    var isSpace = require_utils().isSpace;
    module2.exports = function reference(state, startLine, _endLine, silent) {
      var ch, destEndPos, destEndLineNo, endLine, href, i2, l2, label, labelEnd, oldParentType, res, start, str, terminate, terminatorRules, title, lines = 0, pos = state.bMarks[startLine] + state.tShift[startLine], max2 = state.eMarks[startLine], nextLine = startLine + 1;
      if (state.sCount[startLine] - state.blkIndent >= 4) {
        return false;
      }
      if (state.src.charCodeAt(pos) !== 91) {
        return false;
      }
      while (++pos < max2) {
        if (state.src.charCodeAt(pos) === 93 && state.src.charCodeAt(pos - 1) !== 92) {
          if (pos + 1 === max2) {
            return false;
          }
          if (state.src.charCodeAt(pos + 1) !== 58) {
            return false;
          }
          break;
        }
      }
      endLine = state.lineMax;
      terminatorRules = state.md.block.ruler.getRules("reference");
      oldParentType = state.parentType;
      state.parentType = "reference";
      for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {
        if (state.sCount[nextLine] - state.blkIndent > 3) {
          continue;
        }
        if (state.sCount[nextLine] < 0) {
          continue;
        }
        terminate = false;
        for (i2 = 0, l2 = terminatorRules.length; i2 < l2; i2++) {
          if (terminatorRules[i2](state, nextLine, endLine, true)) {
            terminate = true;
            break;
          }
        }
        if (terminate) {
          break;
        }
      }
      str = state.getLines(startLine, nextLine, state.blkIndent, false).trim();
      max2 = str.length;
      for (pos = 1; pos < max2; pos++) {
        ch = str.charCodeAt(pos);
        if (ch === 91) {
          return false;
        } else if (ch === 93) {
          labelEnd = pos;
          break;
        } else if (ch === 10) {
          lines++;
        } else if (ch === 92) {
          pos++;
          if (pos < max2 && str.charCodeAt(pos) === 10) {
            lines++;
          }
        }
      }
      if (labelEnd < 0 || str.charCodeAt(labelEnd + 1) !== 58) {
        return false;
      }
      for (pos = labelEnd + 2; pos < max2; pos++) {
        ch = str.charCodeAt(pos);
        if (ch === 10) {
          lines++;
        } else if (isSpace(ch)) {
        } else {
          break;
        }
      }
      res = state.md.helpers.parseLinkDestination(str, pos, max2);
      if (!res.ok) {
        return false;
      }
      href = state.md.normalizeLink(res.str);
      if (!state.md.validateLink(href)) {
        return false;
      }
      pos = res.pos;
      lines += res.lines;
      destEndPos = pos;
      destEndLineNo = lines;
      start = pos;
      for (; pos < max2; pos++) {
        ch = str.charCodeAt(pos);
        if (ch === 10) {
          lines++;
        } else if (isSpace(ch)) {
        } else {
          break;
        }
      }
      res = state.md.helpers.parseLinkTitle(str, pos, max2);
      if (pos < max2 && start !== pos && res.ok) {
        title = res.str;
        pos = res.pos;
        lines += res.lines;
      } else {
        title = "";
        pos = destEndPos;
        lines = destEndLineNo;
      }
      while (pos < max2) {
        ch = str.charCodeAt(pos);
        if (!isSpace(ch)) {
          break;
        }
        pos++;
      }
      if (pos < max2 && str.charCodeAt(pos) !== 10) {
        if (title) {
          title = "";
          pos = destEndPos;
          lines = destEndLineNo;
          while (pos < max2) {
            ch = str.charCodeAt(pos);
            if (!isSpace(ch)) {
              break;
            }
            pos++;
          }
        }
      }
      if (pos < max2 && str.charCodeAt(pos) !== 10) {
        return false;
      }
      label = normalizeReference(str.slice(1, labelEnd));
      if (!label) {
        return false;
      }
      if (silent) {
        return true;
      }
      if (typeof state.env.references === "undefined") {
        state.env.references = {};
      }
      if (typeof state.env.references[label] === "undefined") {
        state.env.references[label] = { title, href };
      }
      state.parentType = oldParentType;
      state.line = startLine + lines + 1;
      return true;
    };
  }
});

// node_modules/markdown-it/lib/common/html_blocks.js
var require_html_blocks = __commonJS({
  "node_modules/markdown-it/lib/common/html_blocks.js"(exports, module2) {
    "use strict";
    module2.exports = [
      "address",
      "article",
      "aside",
      "base",
      "basefont",
      "blockquote",
      "body",
      "caption",
      "center",
      "col",
      "colgroup",
      "dd",
      "details",
      "dialog",
      "dir",
      "div",
      "dl",
      "dt",
      "fieldset",
      "figcaption",
      "figure",
      "footer",
      "form",
      "frame",
      "frameset",
      "h1",
      "h2",
      "h3",
      "h4",
      "h5",
      "h6",
      "head",
      "header",
      "hr",
      "html",
      "iframe",
      "legend",
      "li",
      "link",
      "main",
      "menu",
      "menuitem",
      "nav",
      "noframes",
      "ol",
      "optgroup",
      "option",
      "p",
      "param",
      "section",
      "source",
      "summary",
      "table",
      "tbody",
      "td",
      "tfoot",
      "th",
      "thead",
      "title",
      "tr",
      "track",
      "ul"
    ];
  }
});

// node_modules/markdown-it/lib/common/html_re.js
var require_html_re = __commonJS({
  "node_modules/markdown-it/lib/common/html_re.js"(exports, module2) {
    "use strict";
    var attr_name = "[a-zA-Z_:][a-zA-Z0-9:._-]*";
    var unquoted = "[^\"'=<>`\\x00-\\x20]+";
    var single_quoted = "'[^']*'";
    var double_quoted = '"[^"]*"';
    var attr_value = "(?:" + unquoted + "|" + single_quoted + "|" + double_quoted + ")";
    var attribute = "(?:\\s+" + attr_name + "(?:\\s*=\\s*" + attr_value + ")?)";
    var open_tag = "<[A-Za-z][A-Za-z0-9\\-]*" + attribute + "*\\s*\\/?>";
    var close_tag = "<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>";
    var comment = "<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->";
    var processing = "<[?][\\s\\S]*?[?]>";
    var declaration = "<![A-Z]+\\s+[^>]*>";
    var cdata = "<!\\[CDATA\\[[\\s\\S]*?\\]\\]>";
    var HTML_TAG_RE = new RegExp("^(?:" + open_tag + "|" + close_tag + "|" + comment + "|" + processing + "|" + declaration + "|" + cdata + ")");
    var HTML_OPEN_CLOSE_TAG_RE = new RegExp("^(?:" + open_tag + "|" + close_tag + ")");
    module2.exports.HTML_TAG_RE = HTML_TAG_RE;
    module2.exports.HTML_OPEN_CLOSE_TAG_RE = HTML_OPEN_CLOSE_TAG_RE;
  }
});

// node_modules/markdown-it/lib/rules_block/html_block.js
var require_html_block = __commonJS({
  "node_modules/markdown-it/lib/rules_block/html_block.js"(exports, module2) {
    "use strict";
    var block_names = require_html_blocks();
    var HTML_OPEN_CLOSE_TAG_RE = require_html_re().HTML_OPEN_CLOSE_TAG_RE;
    var HTML_SEQUENCES = [
      [/^<(script|pre|style|textarea)(?=(\s|>|$))/i, /<\/(script|pre|style|textarea)>/i, true],
      [/^<!--/, /-->/, true],
      [/^<\?/, /\?>/, true],
      [/^<![A-Z]/, />/, true],
      [/^<!\[CDATA\[/, /\]\]>/, true],
      [new RegExp("^</?(" + block_names.join("|") + ")(?=(\\s|/?>|$))", "i"), /^$/, true],
      [new RegExp(HTML_OPEN_CLOSE_TAG_RE.source + "\\s*$"), /^$/, false]
    ];
    module2.exports = function html_block(state, startLine, endLine, silent) {
      var i2, nextLine, token, lineText, pos = state.bMarks[startLine] + state.tShift[startLine], max2 = state.eMarks[startLine];
      if (state.sCount[startLine] - state.blkIndent >= 4) {
        return false;
      }
      if (!state.md.options.html) {
        return false;
      }
      if (state.src.charCodeAt(pos) !== 60) {
        return false;
      }
      lineText = state.src.slice(pos, max2);
      for (i2 = 0; i2 < HTML_SEQUENCES.length; i2++) {
        if (HTML_SEQUENCES[i2][0].test(lineText)) {
          break;
        }
      }
      if (i2 === HTML_SEQUENCES.length) {
        return false;
      }
      if (silent) {
        return HTML_SEQUENCES[i2][2];
      }
      nextLine = startLine + 1;
      if (!HTML_SEQUENCES[i2][1].test(lineText)) {
        for (; nextLine < endLine; nextLine++) {
          if (state.sCount[nextLine] < state.blkIndent) {
            break;
          }
          pos = state.bMarks[nextLine] + state.tShift[nextLine];
          max2 = state.eMarks[nextLine];
          lineText = state.src.slice(pos, max2);
          if (HTML_SEQUENCES[i2][1].test(lineText)) {
            if (lineText.length !== 0) {
              nextLine++;
            }
            break;
          }
        }
      }
      state.line = nextLine;
      token = state.push("html_block", "", 0);
      token.map = [startLine, nextLine];
      token.content = state.getLines(startLine, nextLine, state.blkIndent, true);
      return true;
    };
  }
});

// node_modules/markdown-it/lib/rules_block/heading.js
var require_heading = __commonJS({
  "node_modules/markdown-it/lib/rules_block/heading.js"(exports, module2) {
    "use strict";
    var isSpace = require_utils().isSpace;
    module2.exports = function heading(state, startLine, endLine, silent) {
      var ch, level, tmp, token, pos = state.bMarks[startLine] + state.tShift[startLine], max2 = state.eMarks[startLine];
      if (state.sCount[startLine] - state.blkIndent >= 4) {
        return false;
      }
      ch = state.src.charCodeAt(pos);
      if (ch !== 35 || pos >= max2) {
        return false;
      }
      level = 1;
      ch = state.src.charCodeAt(++pos);
      while (ch === 35 && pos < max2 && level <= 6) {
        level++;
        ch = state.src.charCodeAt(++pos);
      }
      if (level > 6 || pos < max2 && !isSpace(ch)) {
        return false;
      }
      if (silent) {
        return true;
      }
      max2 = state.skipSpacesBack(max2, pos);
      tmp = state.skipCharsBack(max2, 35, pos);
      if (tmp > pos && isSpace(state.src.charCodeAt(tmp - 1))) {
        max2 = tmp;
      }
      state.line = startLine + 1;
      token = state.push("heading_open", "h" + String(level), 1);
      token.markup = "########".slice(0, level);
      token.map = [startLine, state.line];
      token = state.push("inline", "", 0);
      token.content = state.src.slice(pos, max2).trim();
      token.map = [startLine, state.line];
      token.children = [];
      token = state.push("heading_close", "h" + String(level), -1);
      token.markup = "########".slice(0, level);
      return true;
    };
  }
});

// node_modules/markdown-it/lib/rules_block/lheading.js
var require_lheading = __commonJS({
  "node_modules/markdown-it/lib/rules_block/lheading.js"(exports, module2) {
    "use strict";
    module2.exports = function lheading(state, startLine, endLine) {
      var content, terminate, i2, l2, token, pos, max2, level, marker, nextLine = startLine + 1, oldParentType, terminatorRules = state.md.block.ruler.getRules("paragraph");
      if (state.sCount[startLine] - state.blkIndent >= 4) {
        return false;
      }
      oldParentType = state.parentType;
      state.parentType = "paragraph";
      for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {
        if (state.sCount[nextLine] - state.blkIndent > 3) {
          continue;
        }
        if (state.sCount[nextLine] >= state.blkIndent) {
          pos = state.bMarks[nextLine] + state.tShift[nextLine];
          max2 = state.eMarks[nextLine];
          if (pos < max2) {
            marker = state.src.charCodeAt(pos);
            if (marker === 45 || marker === 61) {
              pos = state.skipChars(pos, marker);
              pos = state.skipSpaces(pos);
              if (pos >= max2) {
                level = marker === 61 ? 1 : 2;
                break;
              }
            }
          }
        }
        if (state.sCount[nextLine] < 0) {
          continue;
        }
        terminate = false;
        for (i2 = 0, l2 = terminatorRules.length; i2 < l2; i2++) {
          if (terminatorRules[i2](state, nextLine, endLine, true)) {
            terminate = true;
            break;
          }
        }
        if (terminate) {
          break;
        }
      }
      if (!level) {
        return false;
      }
      content = state.getLines(startLine, nextLine, state.blkIndent, false).trim();
      state.line = nextLine + 1;
      token = state.push("heading_open", "h" + String(level), 1);
      token.markup = String.fromCharCode(marker);
      token.map = [startLine, state.line];
      token = state.push("inline", "", 0);
      token.content = content;
      token.map = [startLine, state.line - 1];
      token.children = [];
      token = state.push("heading_close", "h" + String(level), -1);
      token.markup = String.fromCharCode(marker);
      state.parentType = oldParentType;
      return true;
    };
  }
});

// node_modules/markdown-it/lib/rules_block/paragraph.js
var require_paragraph = __commonJS({
  "node_modules/markdown-it/lib/rules_block/paragraph.js"(exports, module2) {
    "use strict";
    module2.exports = function paragraph(state, startLine, endLine) {
      var content, terminate, i2, l2, token, oldParentType, nextLine = startLine + 1, terminatorRules = state.md.block.ruler.getRules("paragraph");
      oldParentType = state.parentType;
      state.parentType = "paragraph";
      for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {
        if (state.sCount[nextLine] - state.blkIndent > 3) {
          continue;
        }
        if (state.sCount[nextLine] < 0) {
          continue;
        }
        terminate = false;
        for (i2 = 0, l2 = terminatorRules.length; i2 < l2; i2++) {
          if (terminatorRules[i2](state, nextLine, endLine, true)) {
            terminate = true;
            break;
          }
        }
        if (terminate) {
          break;
        }
      }
      content = state.getLines(startLine, nextLine, state.blkIndent, false).trim();
      state.line = nextLine;
      token = state.push("paragraph_open", "p", 1);
      token.map = [startLine, state.line];
      token = state.push("inline", "", 0);
      token.content = content;
      token.map = [startLine, state.line];
      token.children = [];
      token = state.push("paragraph_close", "p", -1);
      state.parentType = oldParentType;
      return true;
    };
  }
});

// node_modules/markdown-it/lib/rules_block/state_block.js
var require_state_block = __commonJS({
  "node_modules/markdown-it/lib/rules_block/state_block.js"(exports, module2) {
    "use strict";
    var Token = require_token();
    var isSpace = require_utils().isSpace;
    function StateBlock(src, md, env, tokens) {
      var ch, s2, start, pos, len, indent, offset, indent_found;
      this.src = src;
      this.md = md;
      this.env = env;
      this.tokens = tokens;
      this.bMarks = [];
      this.eMarks = [];
      this.tShift = [];
      this.sCount = [];
      this.bsCount = [];
      this.blkIndent = 0;
      this.line = 0;
      this.lineMax = 0;
      this.tight = false;
      this.ddIndent = -1;
      this.listIndent = -1;
      this.parentType = "root";
      this.level = 0;
      this.result = "";
      s2 = this.src;
      indent_found = false;
      for (start = pos = indent = offset = 0, len = s2.length; pos < len; pos++) {
        ch = s2.charCodeAt(pos);
        if (!indent_found) {
          if (isSpace(ch)) {
            indent++;
            if (ch === 9) {
              offset += 4 - offset % 4;
            } else {
              offset++;
            }
            continue;
          } else {
            indent_found = true;
          }
        }
        if (ch === 10 || pos === len - 1) {
          if (ch !== 10) {
            pos++;
          }
          this.bMarks.push(start);
          this.eMarks.push(pos);
          this.tShift.push(indent);
          this.sCount.push(offset);
          this.bsCount.push(0);
          indent_found = false;
          indent = 0;
          offset = 0;
          start = pos + 1;
        }
      }
      this.bMarks.push(s2.length);
      this.eMarks.push(s2.length);
      this.tShift.push(0);
      this.sCount.push(0);
      this.bsCount.push(0);
      this.lineMax = this.bMarks.length - 1;
    }
    StateBlock.prototype.push = function(type, tag, nesting) {
      var token = new Token(type, tag, nesting);
      token.block = true;
      if (nesting < 0)
        this.level--;
      token.level = this.level;
      if (nesting > 0)
        this.level++;
      this.tokens.push(token);
      return token;
    };
    StateBlock.prototype.isEmpty = function isEmpty(line) {
      return this.bMarks[line] + this.tShift[line] >= this.eMarks[line];
    };
    StateBlock.prototype.skipEmptyLines = function skipEmptyLines(from) {
      for (var max2 = this.lineMax; from < max2; from++) {
        if (this.bMarks[from] + this.tShift[from] < this.eMarks[from]) {
          break;
        }
      }
      return from;
    };
    StateBlock.prototype.skipSpaces = function skipSpaces(pos) {
      var ch;
      for (var max2 = this.src.length; pos < max2; pos++) {
        ch = this.src.charCodeAt(pos);
        if (!isSpace(ch)) {
          break;
        }
      }
      return pos;
    };
    StateBlock.prototype.skipSpacesBack = function skipSpacesBack(pos, min2) {
      if (pos <= min2) {
        return pos;
      }
      while (pos > min2) {
        if (!isSpace(this.src.charCodeAt(--pos))) {
          return pos + 1;
        }
      }
      return pos;
    };
    StateBlock.prototype.skipChars = function skipChars(pos, code) {
      for (var max2 = this.src.length; pos < max2; pos++) {
        if (this.src.charCodeAt(pos) !== code) {
          break;
        }
      }
      return pos;
    };
    StateBlock.prototype.skipCharsBack = function skipCharsBack(pos, code, min2) {
      if (pos <= min2) {
        return pos;
      }
      while (pos > min2) {
        if (code !== this.src.charCodeAt(--pos)) {
          return pos + 1;
        }
      }
      return pos;
    };
    StateBlock.prototype.getLines = function getLines(begin, end, indent, keepLastLF) {
      var i2, lineIndent, ch, first, last2, queue, lineStart, line = begin;
      if (begin >= end) {
        return "";
      }
      queue = new Array(end - begin);
      for (i2 = 0; line < end; line++, i2++) {
        lineIndent = 0;
        lineStart = first = this.bMarks[line];
        if (line + 1 < end || keepLastLF) {
          last2 = this.eMarks[line] + 1;
        } else {
          last2 = this.eMarks[line];
        }
        while (first < last2 && lineIndent < indent) {
          ch = this.src.charCodeAt(first);
          if (isSpace(ch)) {
            if (ch === 9) {
              lineIndent += 4 - (lineIndent + this.bsCount[line]) % 4;
            } else {
              lineIndent++;
            }
          } else if (first - lineStart < this.tShift[line]) {
            lineIndent++;
          } else {
            break;
          }
          first++;
        }
        if (lineIndent > indent) {
          queue[i2] = new Array(lineIndent - indent + 1).join(" ") + this.src.slice(first, last2);
        } else {
          queue[i2] = this.src.slice(first, last2);
        }
      }
      return queue.join("");
    };
    StateBlock.prototype.Token = Token;
    module2.exports = StateBlock;
  }
});

// node_modules/markdown-it/lib/parser_block.js
var require_parser_block = __commonJS({
  "node_modules/markdown-it/lib/parser_block.js"(exports, module2) {
    "use strict";
    var Ruler = require_ruler();
    var _rules = [
      // First 2 params - rule name & source. Secondary array - list of rules,
      // which can be terminated by this one.
      ["table", require_table(), ["paragraph", "reference"]],
      ["code", require_code()],
      ["fence", require_fence(), ["paragraph", "reference", "blockquote", "list"]],
      ["blockquote", require_blockquote(), ["paragraph", "reference", "blockquote", "list"]],
      ["hr", require_hr(), ["paragraph", "reference", "blockquote", "list"]],
      ["list", require_list(), ["paragraph", "reference", "blockquote"]],
      ["reference", require_reference()],
      ["html_block", require_html_block(), ["paragraph", "reference", "blockquote"]],
      ["heading", require_heading(), ["paragraph", "reference", "blockquote"]],
      ["lheading", require_lheading()],
      ["paragraph", require_paragraph()]
    ];
    function ParserBlock() {
      this.ruler = new Ruler();
      for (var i2 = 0; i2 < _rules.length; i2++) {
        this.ruler.push(_rules[i2][0], _rules[i2][1], { alt: (_rules[i2][2] || []).slice() });
      }
    }
    ParserBlock.prototype.tokenize = function(state, startLine, endLine) {
      var ok, i2, prevLine, rules = this.ruler.getRules(""), len = rules.length, line = startLine, hasEmptyLines = false, maxNesting = state.md.options.maxNesting;
      while (line < endLine) {
        state.line = line = state.skipEmptyLines(line);
        if (line >= endLine) {
          break;
        }
        if (state.sCount[line] < state.blkIndent) {
          break;
        }
        if (state.level >= maxNesting) {
          state.line = endLine;
          break;
        }
        prevLine = state.line;
        for (i2 = 0; i2 < len; i2++) {
          ok = rules[i2](state, line, endLine, false);
          if (ok) {
            if (prevLine >= state.line) {
              throw new Error("block rule didn't increment state.line");
            }
            break;
          }
        }
        if (!ok)
          throw new Error("none of the block rules matched");
        state.tight = !hasEmptyLines;
        if (state.isEmpty(state.line - 1)) {
          hasEmptyLines = true;
        }
        line = state.line;
        if (line < endLine && state.isEmpty(line)) {
          hasEmptyLines = true;
          line++;
          state.line = line;
        }
      }
    };
    ParserBlock.prototype.parse = function(src, md, env, outTokens) {
      var state;
      if (!src) {
        return;
      }
      state = new this.State(src, md, env, outTokens);
      this.tokenize(state, state.line, state.lineMax);
    };
    ParserBlock.prototype.State = require_state_block();
    module2.exports = ParserBlock;
  }
});

// node_modules/markdown-it/lib/rules_inline/text.js
var require_text = __commonJS({
  "node_modules/markdown-it/lib/rules_inline/text.js"(exports, module2) {
    "use strict";
    function isTerminatorChar(ch) {
      switch (ch) {
        case 10:
        case 33:
        case 35:
        case 36:
        case 37:
        case 38:
        case 42:
        case 43:
        case 45:
        case 58:
        case 60:
        case 61:
        case 62:
        case 64:
        case 91:
        case 92:
        case 93:
        case 94:
        case 95:
        case 96:
        case 123:
        case 125:
        case 126:
          return true;
        default:
          return false;
      }
    }
    module2.exports = function text(state, silent) {
      var pos = state.pos;
      while (pos < state.posMax && !isTerminatorChar(state.src.charCodeAt(pos))) {
        pos++;
      }
      if (pos === state.pos) {
        return false;
      }
      if (!silent) {
        state.pending += state.src.slice(state.pos, pos);
      }
      state.pos = pos;
      return true;
    };
  }
});

// node_modules/markdown-it/lib/rules_inline/linkify.js
var require_linkify2 = __commonJS({
  "node_modules/markdown-it/lib/rules_inline/linkify.js"(exports, module2) {
    "use strict";
    var SCHEME_RE = /(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;
    module2.exports = function linkify(state, silent) {
      var pos, max2, match, proto, link, url, fullUrl, token;
      if (!state.md.options.linkify)
        return false;
      if (state.linkLevel > 0)
        return false;
      pos = state.pos;
      max2 = state.posMax;
      if (pos + 3 > max2)
        return false;
      if (state.src.charCodeAt(pos) !== 58)
        return false;
      if (state.src.charCodeAt(pos + 1) !== 47)
        return false;
      if (state.src.charCodeAt(pos + 2) !== 47)
        return false;
      match = state.pending.match(SCHEME_RE);
      if (!match)
        return false;
      proto = match[1];
      link = state.md.linkify.matchAtStart(state.src.slice(pos - proto.length));
      if (!link)
        return false;
      url = link.url;
      if (url.length <= proto.length)
        return false;
      url = url.replace(/\*+$/, "");
      fullUrl = state.md.normalizeLink(url);
      if (!state.md.validateLink(fullUrl))
        return false;
      if (!silent) {
        state.pending = state.pending.slice(0, -proto.length);
        token = state.push("link_open", "a", 1);
        token.attrs = [["href", fullUrl]];
        token.markup = "linkify";
        token.info = "auto";
        token = state.push("text", "", 0);
        token.content = state.md.normalizeLinkText(url);
        token = state.push("link_close", "a", -1);
        token.markup = "linkify";
        token.info = "auto";
      }
      state.pos += url.length - proto.length;
      return true;
    };
  }
});

// node_modules/markdown-it/lib/rules_inline/newline.js
var require_newline = __commonJS({
  "node_modules/markdown-it/lib/rules_inline/newline.js"(exports, module2) {
    "use strict";
    var isSpace = require_utils().isSpace;
    module2.exports = function newline(state, silent) {
      var pmax, max2, ws, pos = state.pos;
      if (state.src.charCodeAt(pos) !== 10) {
        return false;
      }
      pmax = state.pending.length - 1;
      max2 = state.posMax;
      if (!silent) {
        if (pmax >= 0 && state.pending.charCodeAt(pmax) === 32) {
          if (pmax >= 1 && state.pending.charCodeAt(pmax - 1) === 32) {
            ws = pmax - 1;
            while (ws >= 1 && state.pending.charCodeAt(ws - 1) === 32)
              ws--;
            state.pending = state.pending.slice(0, ws);
            state.push("hardbreak", "br", 0);
          } else {
            state.pending = state.pending.slice(0, -1);
            state.push("softbreak", "br", 0);
          }
        } else {
          state.push("softbreak", "br", 0);
        }
      }
      pos++;
      while (pos < max2 && isSpace(state.src.charCodeAt(pos))) {
        pos++;
      }
      state.pos = pos;
      return true;
    };
  }
});

// node_modules/markdown-it/lib/rules_inline/escape.js
var require_escape = __commonJS({
  "node_modules/markdown-it/lib/rules_inline/escape.js"(exports, module2) {
    "use strict";
    var isSpace = require_utils().isSpace;
    var ESCAPED = [];
    for (i2 = 0; i2 < 256; i2++) {
      ESCAPED.push(0);
    }
    var i2;
    "\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(ch) {
      ESCAPED[ch.charCodeAt(0)] = 1;
    });
    module2.exports = function escape2(state, silent) {
      var ch1, ch2, origStr, escapedStr, token, pos = state.pos, max2 = state.posMax;
      if (state.src.charCodeAt(pos) !== 92)
        return false;
      pos++;
      if (pos >= max2)
        return false;
      ch1 = state.src.charCodeAt(pos);
      if (ch1 === 10) {
        if (!silent) {
          state.push("hardbreak", "br", 0);
        }
        pos++;
        while (pos < max2) {
          ch1 = state.src.charCodeAt(pos);
          if (!isSpace(ch1))
            break;
          pos++;
        }
        state.pos = pos;
        return true;
      }
      escapedStr = state.src[pos];
      if (ch1 >= 55296 && ch1 <= 56319 && pos + 1 < max2) {
        ch2 = state.src.charCodeAt(pos + 1);
        if (ch2 >= 56320 && ch2 <= 57343) {
          escapedStr += state.src[pos + 1];
          pos++;
        }
      }
      origStr = "\\" + escapedStr;
      if (!silent) {
        token = state.push("text_special", "", 0);
        if (ch1 < 256 && ESCAPED[ch1] !== 0) {
          token.content = escapedStr;
        } else {
          token.content = origStr;
        }
        token.markup = origStr;
        token.info = "escape";
      }
      state.pos = pos + 1;
      return true;
    };
  }
});

// node_modules/markdown-it/lib/rules_inline/backticks.js
var require_backticks = __commonJS({
  "node_modules/markdown-it/lib/rules_inline/backticks.js"(exports, module2) {
    "use strict";
    module2.exports = function backtick(state, silent) {
      var start, max2, marker, token, matchStart, matchEnd, openerLength, closerLength, pos = state.pos, ch = state.src.charCodeAt(pos);
      if (ch !== 96) {
        return false;
      }
      start = pos;
      pos++;
      max2 = state.posMax;
      while (pos < max2 && state.src.charCodeAt(pos) === 96) {
        pos++;
      }
      marker = state.src.slice(start, pos);
      openerLength = marker.length;
      if (state.backticksScanned && (state.backticks[openerLength] || 0) <= start) {
        if (!silent)
          state.pending += marker;
        state.pos += openerLength;
        return true;
      }
      matchEnd = pos;
      while ((matchStart = state.src.indexOf("`", matchEnd)) !== -1) {
        matchEnd = matchStart + 1;
        while (matchEnd < max2 && state.src.charCodeAt(matchEnd) === 96) {
          matchEnd++;
        }
        closerLength = matchEnd - matchStart;
        if (closerLength === openerLength) {
          if (!silent) {
            token = state.push("code_inline", "code", 0);
            token.markup = marker;
            token.content = state.src.slice(pos, matchStart).replace(/\n/g, " ").replace(/^ (.+) $/, "$1");
          }
          state.pos = matchEnd;
          return true;
        }
        state.backticks[closerLength] = matchStart;
      }
      state.backticksScanned = true;
      if (!silent)
        state.pending += marker;
      state.pos += openerLength;
      return true;
    };
  }
});

// node_modules/markdown-it/lib/rules_inline/strikethrough.js
var require_strikethrough = __commonJS({
  "node_modules/markdown-it/lib/rules_inline/strikethrough.js"(exports, module2) {
    "use strict";
    module2.exports.tokenize = function strikethrough(state, silent) {
      var i2, scanned, token, len, ch, start = state.pos, marker = state.src.charCodeAt(start);
      if (silent) {
        return false;
      }
      if (marker !== 126) {
        return false;
      }
      scanned = state.scanDelims(state.pos, true);
      len = scanned.length;
      ch = String.fromCharCode(marker);
      if (len < 2) {
        return false;
      }
      if (len % 2) {
        token = state.push("text", "", 0);
        token.content = ch;
        len--;
      }
      for (i2 = 0; i2 < len; i2 += 2) {
        token = state.push("text", "", 0);
        token.content = ch + ch;
        state.delimiters.push({
          marker,
          length: 0,
          // disable "rule of 3" length checks meant for emphasis
          token: state.tokens.length - 1,
          end: -1,
          open: scanned.can_open,
          close: scanned.can_close
        });
      }
      state.pos += scanned.length;
      return true;
    };
    function postProcess(state, delimiters) {
      var i2, j2, startDelim, endDelim, token, loneMarkers = [], max2 = delimiters.length;
      for (i2 = 0; i2 < max2; i2++) {
        startDelim = delimiters[i2];
        if (startDelim.marker !== 126) {
          continue;
        }
        if (startDelim.end === -1) {
          continue;
        }
        endDelim = delimiters[startDelim.end];
        token = state.tokens[startDelim.token];
        token.type = "s_open";
        token.tag = "s";
        token.nesting = 1;
        token.markup = "~~";
        token.content = "";
        token = state.tokens[endDelim.token];
        token.type = "s_close";
        token.tag = "s";
        token.nesting = -1;
        token.markup = "~~";
        token.content = "";
        if (state.tokens[endDelim.token - 1].type === "text" && state.tokens[endDelim.token - 1].content === "~") {
          loneMarkers.push(endDelim.token - 1);
        }
      }
      while (loneMarkers.length) {
        i2 = loneMarkers.pop();
        j2 = i2 + 1;
        while (j2 < state.tokens.length && state.tokens[j2].type === "s_close") {
          j2++;
        }
        j2--;
        if (i2 !== j2) {
          token = state.tokens[j2];
          state.tokens[j2] = state.tokens[i2];
          state.tokens[i2] = token;
        }
      }
    }
    module2.exports.postProcess = function strikethrough(state) {
      var curr, tokens_meta = state.tokens_meta, max2 = state.tokens_meta.length;
      postProcess(state, state.delimiters);
      for (curr = 0; curr < max2; curr++) {
        if (tokens_meta[curr] && tokens_meta[curr].delimiters) {
          postProcess(state, tokens_meta[curr].delimiters);
        }
      }
    };
  }
});

// node_modules/markdown-it/lib/rules_inline/emphasis.js
var require_emphasis = __commonJS({
  "node_modules/markdown-it/lib/rules_inline/emphasis.js"(exports, module2) {
    "use strict";
    module2.exports.tokenize = function emphasis(state, silent) {
      var i2, scanned, token, start = state.pos, marker = state.src.charCodeAt(start);
      if (silent) {
        return false;
      }
      if (marker !== 95 && marker !== 42) {
        return false;
      }
      scanned = state.scanDelims(state.pos, marker === 42);
      for (i2 = 0; i2 < scanned.length; i2++) {
        token = state.push("text", "", 0);
        token.content = String.fromCharCode(marker);
        state.delimiters.push({
          // Char code of the starting marker (number).
          //
          marker,
          // Total length of these series of delimiters.
          //
          length: scanned.length,
          // A position of the token this delimiter corresponds to.
          //
          token: state.tokens.length - 1,
          // If this delimiter is matched as a valid opener, `end` will be
          // equal to its position, otherwise it's `-1`.
          //
          end: -1,
          // Boolean flags that determine if this delimiter could open or close
          // an emphasis.
          //
          open: scanned.can_open,
          close: scanned.can_close
        });
      }
      state.pos += scanned.length;
      return true;
    };
    function postProcess(state, delimiters) {
      var i2, startDelim, endDelim, token, ch, isStrong, max2 = delimiters.length;
      for (i2 = max2 - 1; i2 >= 0; i2--) {
        startDelim = delimiters[i2];
        if (startDelim.marker !== 95 && startDelim.marker !== 42) {
          continue;
        }
        if (startDelim.end === -1) {
          continue;
        }
        endDelim = delimiters[startDelim.end];
        isStrong = i2 > 0 && delimiters[i2 - 1].end === startDelim.end + 1 && // check that first two markers match and adjacent
        delimiters[i2 - 1].marker === startDelim.marker && delimiters[i2 - 1].token === startDelim.token - 1 && // check that last two markers are adjacent (we can safely assume they match)
        delimiters[startDelim.end + 1].token === endDelim.token + 1;
        ch = String.fromCharCode(startDelim.marker);
        token = state.tokens[startDelim.token];
        token.type = isStrong ? "strong_open" : "em_open";
        token.tag = isStrong ? "strong" : "em";
        token.nesting = 1;
        token.markup = isStrong ? ch + ch : ch;
        token.content = "";
        token = state.tokens[endDelim.token];
        token.type = isStrong ? "strong_close" : "em_close";
        token.tag = isStrong ? "strong" : "em";
        token.nesting = -1;
        token.markup = isStrong ? ch + ch : ch;
        token.content = "";
        if (isStrong) {
          state.tokens[delimiters[i2 - 1].token].content = "";
          state.tokens[delimiters[startDelim.end + 1].token].content = "";
          i2--;
        }
      }
    }
    module2.exports.postProcess = function emphasis(state) {
      var curr, tokens_meta = state.tokens_meta, max2 = state.tokens_meta.length;
      postProcess(state, state.delimiters);
      for (curr = 0; curr < max2; curr++) {
        if (tokens_meta[curr] && tokens_meta[curr].delimiters) {
          postProcess(state, tokens_meta[curr].delimiters);
        }
      }
    };
  }
});

// node_modules/markdown-it/lib/rules_inline/link.js
var require_link = __commonJS({
  "node_modules/markdown-it/lib/rules_inline/link.js"(exports, module2) {
    "use strict";
    var normalizeReference = require_utils().normalizeReference;
    var isSpace = require_utils().isSpace;
    module2.exports = function link(state, silent) {
      var attrs, code, label, labelEnd, labelStart, pos, res, ref, token, href = "", title = "", oldPos = state.pos, max2 = state.posMax, start = state.pos, parseReference = true;
      if (state.src.charCodeAt(state.pos) !== 91) {
        return false;
      }
      labelStart = state.pos + 1;
      labelEnd = state.md.helpers.parseLinkLabel(state, state.pos, true);
      if (labelEnd < 0) {
        return false;
      }
      pos = labelEnd + 1;
      if (pos < max2 && state.src.charCodeAt(pos) === 40) {
        parseReference = false;
        pos++;
        for (; pos < max2; pos++) {
          code = state.src.charCodeAt(pos);
          if (!isSpace(code) && code !== 10) {
            break;
          }
        }
        if (pos >= max2) {
          return false;
        }
        start = pos;
        res = state.md.helpers.parseLinkDestination(state.src, pos, state.posMax);
        if (res.ok) {
          href = state.md.normalizeLink(res.str);
          if (state.md.validateLink(href)) {
            pos = res.pos;
          } else {
            href = "";
          }
          start = pos;
          for (; pos < max2; pos++) {
            code = state.src.charCodeAt(pos);
            if (!isSpace(code) && code !== 10) {
              break;
            }
          }
          res = state.md.helpers.parseLinkTitle(state.src, pos, state.posMax);
          if (pos < max2 && start !== pos && res.ok) {
            title = res.str;
            pos = res.pos;
            for (; pos < max2; pos++) {
              code = state.src.charCodeAt(pos);
              if (!isSpace(code) && code !== 10) {
                break;
              }
            }
          }
        }
        if (pos >= max2 || state.src.charCodeAt(pos) !== 41) {
          parseReference = true;
        }
        pos++;
      }
      if (parseReference) {
        if (typeof state.env.references === "undefined") {
          return false;
        }
        if (pos < max2 && state.src.charCodeAt(pos) === 91) {
          start = pos + 1;
          pos = state.md.helpers.parseLinkLabel(state, pos);
          if (pos >= 0) {
            label = state.src.slice(start, pos++);
          } else {
            pos = labelEnd + 1;
          }
        } else {
          pos = labelEnd + 1;
        }
        if (!label) {
          label = state.src.slice(labelStart, labelEnd);
        }
        ref = state.env.references[normalizeReference(label)];
        if (!ref) {
          state.pos = oldPos;
          return false;
        }
        href = ref.href;
        title = ref.title;
      }
      if (!silent) {
        state.pos = labelStart;
        state.posMax = labelEnd;
        token = state.push("link_open", "a", 1);
        token.attrs = attrs = [["href", href]];
        if (title) {
          attrs.push(["title", title]);
        }
        state.linkLevel++;
        state.md.inline.tokenize(state);
        state.linkLevel--;
        token = state.push("link_close", "a", -1);
      }
      state.pos = pos;
      state.posMax = max2;
      return true;
    };
  }
});

// node_modules/markdown-it/lib/rules_inline/image.js
var require_image = __commonJS({
  "node_modules/markdown-it/lib/rules_inline/image.js"(exports, module2) {
    "use strict";
    var normalizeReference = require_utils().normalizeReference;
    var isSpace = require_utils().isSpace;
    module2.exports = function image(state, silent) {
      var attrs, code, content, label, labelEnd, labelStart, pos, ref, res, title, token, tokens, start, href = "", oldPos = state.pos, max2 = state.posMax;
      if (state.src.charCodeAt(state.pos) !== 33) {
        return false;
      }
      if (state.src.charCodeAt(state.pos + 1) !== 91) {
        return false;
      }
      labelStart = state.pos + 2;
      labelEnd = state.md.helpers.parseLinkLabel(state, state.pos + 1, false);
      if (labelEnd < 0) {
        return false;
      }
      pos = labelEnd + 1;
      if (pos < max2 && state.src.charCodeAt(pos) === 40) {
        pos++;
        for (; pos < max2; pos++) {
          code = state.src.charCodeAt(pos);
          if (!isSpace(code) && code !== 10) {
            break;
          }
        }
        if (pos >= max2) {
          return false;
        }
        start = pos;
        res = state.md.helpers.parseLinkDestination(state.src, pos, state.posMax);
        if (res.ok) {
          href = state.md.normalizeLink(res.str);
          if (state.md.validateLink(href)) {
            pos = res.pos;
          } else {
            href = "";
          }
        }
        start = pos;
        for (; pos < max2; pos++) {
          code = state.src.charCodeAt(pos);
          if (!isSpace(code) && code !== 10) {
            break;
          }
        }
        res = state.md.helpers.parseLinkTitle(state.src, pos, state.posMax);
        if (pos < max2 && start !== pos && res.ok) {
          title = res.str;
          pos = res.pos;
          for (; pos < max2; pos++) {
            code = state.src.charCodeAt(pos);
            if (!isSpace(code) && code !== 10) {
              break;
            }
          }
        } else {
          title = "";
        }
        if (pos >= max2 || state.src.charCodeAt(pos) !== 41) {
          state.pos = oldPos;
          return false;
        }
        pos++;
      } else {
        if (typeof state.env.references === "undefined") {
          return false;
        }
        if (pos < max2 && state.src.charCodeAt(pos) === 91) {
          start = pos + 1;
          pos = state.md.helpers.parseLinkLabel(state, pos);
          if (pos >= 0) {
            label = state.src.slice(start, pos++);
          } else {
            pos = labelEnd + 1;
          }
        } else {
          pos = labelEnd + 1;
        }
        if (!label) {
          label = state.src.slice(labelStart, labelEnd);
        }
        ref = state.env.references[normalizeReference(label)];
        if (!ref) {
          state.pos = oldPos;
          return false;
        }
        href = ref.href;
        title = ref.title;
      }
      if (!silent) {
        content = state.src.slice(labelStart, labelEnd);
        state.md.inline.parse(
          content,
          state.md,
          state.env,
          tokens = []
        );
        token = state.push("image", "img", 0);
        token.attrs = attrs = [["src", href], ["alt", ""]];
        token.children = tokens;
        token.content = content;
        if (title) {
          attrs.push(["title", title]);
        }
      }
      state.pos = pos;
      state.posMax = max2;
      return true;
    };
  }
});

// node_modules/markdown-it/lib/rules_inline/autolink.js
var require_autolink = __commonJS({
  "node_modules/markdown-it/lib/rules_inline/autolink.js"(exports, module2) {
    "use strict";
    var EMAIL_RE = /^([a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/;
    var AUTOLINK_RE = /^([a-zA-Z][a-zA-Z0-9+.\-]{1,31}):([^<>\x00-\x20]*)$/;
    module2.exports = function autolink(state, silent) {
      var url, fullUrl, token, ch, start, max2, pos = state.pos;
      if (state.src.charCodeAt(pos) !== 60) {
        return false;
      }
      start = state.pos;
      max2 = state.posMax;
      for (; ; ) {
        if (++pos >= max2)
          return false;
        ch = state.src.charCodeAt(pos);
        if (ch === 60)
          return false;
        if (ch === 62)
          break;
      }
      url = state.src.slice(start + 1, pos);
      if (AUTOLINK_RE.test(url)) {
        fullUrl = state.md.normalizeLink(url);
        if (!state.md.validateLink(fullUrl)) {
          return false;
        }
        if (!silent) {
          token = state.push("link_open", "a", 1);
          token.attrs = [["href", fullUrl]];
          token.markup = "autolink";
          token.info = "auto";
          token = state.push("text", "", 0);
          token.content = state.md.normalizeLinkText(url);
          token = state.push("link_close", "a", -1);
          token.markup = "autolink";
          token.info = "auto";
        }
        state.pos += url.length + 2;
        return true;
      }
      if (EMAIL_RE.test(url)) {
        fullUrl = state.md.normalizeLink("mailto:" + url);
        if (!state.md.validateLink(fullUrl)) {
          return false;
        }
        if (!silent) {
          token = state.push("link_open", "a", 1);
          token.attrs = [["href", fullUrl]];
          token.markup = "autolink";
          token.info = "auto";
          token = state.push("text", "", 0);
          token.content = state.md.normalizeLinkText(url);
          token = state.push("link_close", "a", -1);
          token.markup = "autolink";
          token.info = "auto";
        }
        state.pos += url.length + 2;
        return true;
      }
      return false;
    };
  }
});

// node_modules/markdown-it/lib/rules_inline/html_inline.js
var require_html_inline = __commonJS({
  "node_modules/markdown-it/lib/rules_inline/html_inline.js"(exports, module2) {
    "use strict";
    var HTML_TAG_RE = require_html_re().HTML_TAG_RE;
    function isLinkOpen(str) {
      return /^<a[>\s]/i.test(str);
    }
    function isLinkClose(str) {
      return /^<\/a\s*>/i.test(str);
    }
    function isLetter(ch) {
      var lc = ch | 32;
      return lc >= 97 && lc <= 122;
    }
    module2.exports = function html_inline(state, silent) {
      var ch, match, max2, token, pos = state.pos;
      if (!state.md.options.html) {
        return false;
      }
      max2 = state.posMax;
      if (state.src.charCodeAt(pos) !== 60 || pos + 2 >= max2) {
        return false;
      }
      ch = state.src.charCodeAt(pos + 1);
      if (ch !== 33 && ch !== 63 && ch !== 47 && !isLetter(ch)) {
        return false;
      }
      match = state.src.slice(pos).match(HTML_TAG_RE);
      if (!match) {
        return false;
      }
      if (!silent) {
        token = state.push("html_inline", "", 0);
        token.content = match[0];
        if (isLinkOpen(token.content))
          state.linkLevel++;
        if (isLinkClose(token.content))
          state.linkLevel--;
      }
      state.pos += match[0].length;
      return true;
    };
  }
});

// node_modules/markdown-it/lib/rules_inline/entity.js
var require_entity = __commonJS({
  "node_modules/markdown-it/lib/rules_inline/entity.js"(exports, module2) {
    "use strict";
    var entities = require_entities2();
    var has = require_utils().has;
    var isValidEntityCode = require_utils().isValidEntityCode;
    var fromCodePoint2 = require_utils().fromCodePoint;
    var DIGITAL_RE = /^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i;
    var NAMED_RE = /^&([a-z][a-z0-9]{1,31});/i;
    module2.exports = function entity(state, silent) {
      var ch, code, match, token, pos = state.pos, max2 = state.posMax;
      if (state.src.charCodeAt(pos) !== 38)
        return false;
      if (pos + 1 >= max2)
        return false;
      ch = state.src.charCodeAt(pos + 1);
      if (ch === 35) {
        match = state.src.slice(pos).match(DIGITAL_RE);
        if (match) {
          if (!silent) {
            code = match[1][0].toLowerCase() === "x" ? parseInt(match[1].slice(1), 16) : parseInt(match[1], 10);
            token = state.push("text_special", "", 0);
            token.content = isValidEntityCode(code) ? fromCodePoint2(code) : fromCodePoint2(65533);
            token.markup = match[0];
            token.info = "entity";
          }
          state.pos += match[0].length;
          return true;
        }
      } else {
        match = state.src.slice(pos).match(NAMED_RE);
        if (match) {
          if (has(entities, match[1])) {
            if (!silent) {
              token = state.push("text_special", "", 0);
              token.content = entities[match[1]];
              token.markup = match[0];
              token.info = "entity";
            }
            state.pos += match[0].length;
            return true;
          }
        }
      }
      return false;
    };
  }
});

// node_modules/markdown-it/lib/rules_inline/balance_pairs.js
var require_balance_pairs = __commonJS({
  "node_modules/markdown-it/lib/rules_inline/balance_pairs.js"(exports, module2) {
    "use strict";
    function processDelimiters(delimiters) {
      var closerIdx, openerIdx, closer, opener, minOpenerIdx, newMinOpenerIdx, isOddMatch, lastJump, openersBottom = {}, max2 = delimiters.length;
      if (!max2)
        return;
      var headerIdx = 0;
      var lastTokenIdx = -2;
      var jumps = [];
      for (closerIdx = 0; closerIdx < max2; closerIdx++) {
        closer = delimiters[closerIdx];
        jumps.push(0);
        if (delimiters[headerIdx].marker !== closer.marker || lastTokenIdx !== closer.token - 1) {
          headerIdx = closerIdx;
        }
        lastTokenIdx = closer.token;
        closer.length = closer.length || 0;
        if (!closer.close)
          continue;
        if (!openersBottom.hasOwnProperty(closer.marker)) {
          openersBottom[closer.marker] = [-1, -1, -1, -1, -1, -1];
        }
        minOpenerIdx = openersBottom[closer.marker][(closer.open ? 3 : 0) + closer.length % 3];
        openerIdx = headerIdx - jumps[headerIdx] - 1;
        newMinOpenerIdx = openerIdx;
        for (; openerIdx > minOpenerIdx; openerIdx -= jumps[openerIdx] + 1) {
          opener = delimiters[openerIdx];
          if (opener.marker !== closer.marker)
            continue;
          if (opener.open && opener.end < 0) {
            isOddMatch = false;
            if (opener.close || closer.open) {
              if ((opener.length + closer.length) % 3 === 0) {
                if (opener.length % 3 !== 0 || closer.length % 3 !== 0) {
                  isOddMatch = true;
                }
              }
            }
            if (!isOddMatch) {
              lastJump = openerIdx > 0 && !delimiters[openerIdx - 1].open ? jumps[openerIdx - 1] + 1 : 0;
              jumps[closerIdx] = closerIdx - openerIdx + lastJump;
              jumps[openerIdx] = lastJump;
              closer.open = false;
              opener.end = closerIdx;
              opener.close = false;
              newMinOpenerIdx = -1;
              lastTokenIdx = -2;
              break;
            }
          }
        }
        if (newMinOpenerIdx !== -1) {
          openersBottom[closer.marker][(closer.open ? 3 : 0) + (closer.length || 0) % 3] = newMinOpenerIdx;
        }
      }
    }
    module2.exports = function link_pairs(state) {
      var curr, tokens_meta = state.tokens_meta, max2 = state.tokens_meta.length;
      processDelimiters(state.delimiters);
      for (curr = 0; curr < max2; curr++) {
        if (tokens_meta[curr] && tokens_meta[curr].delimiters) {
          processDelimiters(tokens_meta[curr].delimiters);
        }
      }
    };
  }
});

// node_modules/markdown-it/lib/rules_inline/fragments_join.js
var require_fragments_join = __commonJS({
  "node_modules/markdown-it/lib/rules_inline/fragments_join.js"(exports, module2) {
    "use strict";
    module2.exports = function fragments_join(state) {
      var curr, last2, level = 0, tokens = state.tokens, max2 = state.tokens.length;
      for (curr = last2 = 0; curr < max2; curr++) {
        if (tokens[curr].nesting < 0)
          level--;
        tokens[curr].level = level;
        if (tokens[curr].nesting > 0)
          level++;
        if (tokens[curr].type === "text" && curr + 1 < max2 && tokens[curr + 1].type === "text") {
          tokens[curr + 1].content = tokens[curr].content + tokens[curr + 1].content;
        } else {
          if (curr !== last2) {
            tokens[last2] = tokens[curr];
          }
          last2++;
        }
      }
      if (curr !== last2) {
        tokens.length = last2;
      }
    };
  }
});

// node_modules/markdown-it/lib/rules_inline/state_inline.js
var require_state_inline = __commonJS({
  "node_modules/markdown-it/lib/rules_inline/state_inline.js"(exports, module2) {
    "use strict";
    var Token = require_token();
    var isWhiteSpace = require_utils().isWhiteSpace;
    var isPunctChar = require_utils().isPunctChar;
    var isMdAsciiPunct = require_utils().isMdAsciiPunct;
    function StateInline(src, md, env, outTokens) {
      this.src = src;
      this.env = env;
      this.md = md;
      this.tokens = outTokens;
      this.tokens_meta = Array(outTokens.length);
      this.pos = 0;
      this.posMax = this.src.length;
      this.level = 0;
      this.pending = "";
      this.pendingLevel = 0;
      this.cache = {};
      this.delimiters = [];
      this._prev_delimiters = [];
      this.backticks = {};
      this.backticksScanned = false;
      this.linkLevel = 0;
    }
    StateInline.prototype.pushPending = function() {
      var token = new Token("text", "", 0);
      token.content = this.pending;
      token.level = this.pendingLevel;
      this.tokens.push(token);
      this.pending = "";
      return token;
    };
    StateInline.prototype.push = function(type, tag, nesting) {
      if (this.pending) {
        this.pushPending();
      }
      var token = new Token(type, tag, nesting);
      var token_meta = null;
      if (nesting < 0) {
        this.level--;
        this.delimiters = this._prev_delimiters.pop();
      }
      token.level = this.level;
      if (nesting > 0) {
        this.level++;
        this._prev_delimiters.push(this.delimiters);
        this.delimiters = [];
        token_meta = { delimiters: this.delimiters };
      }
      this.pendingLevel = this.level;
      this.tokens.push(token);
      this.tokens_meta.push(token_meta);
      return token;
    };
    StateInline.prototype.scanDelims = function(start, canSplitWord) {
      var pos = start, lastChar, nextChar, count, can_open, can_close, isLastWhiteSpace, isLastPunctChar, isNextWhiteSpace, isNextPunctChar, left_flanking = true, right_flanking = true, max2 = this.posMax, marker = this.src.charCodeAt(start);
      lastChar = start > 0 ? this.src.charCodeAt(start - 1) : 32;
      while (pos < max2 && this.src.charCodeAt(pos) === marker) {
        pos++;
      }
      count = pos - start;
      nextChar = pos < max2 ? this.src.charCodeAt(pos) : 32;
      isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar));
      isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar));
      isLastWhiteSpace = isWhiteSpace(lastChar);
      isNextWhiteSpace = isWhiteSpace(nextChar);
      if (isNextWhiteSpace) {
        left_flanking = false;
      } else if (isNextPunctChar) {
        if (!(isLastWhiteSpace || isLastPunctChar)) {
          left_flanking = false;
        }
      }
      if (isLastWhiteSpace) {
        right_flanking = false;
      } else if (isLastPunctChar) {
        if (!(isNextWhiteSpace || isNextPunctChar)) {
          right_flanking = false;
        }
      }
      if (!canSplitWord) {
        can_open = left_flanking && (!right_flanking || isLastPunctChar);
        can_close = right_flanking && (!left_flanking || isNextPunctChar);
      } else {
        can_open = left_flanking;
        can_close = right_flanking;
      }
      return {
        can_open,
        can_close,
        length: count
      };
    };
    StateInline.prototype.Token = Token;
    module2.exports = StateInline;
  }
});

// node_modules/markdown-it/lib/parser_inline.js
var require_parser_inline = __commonJS({
  "node_modules/markdown-it/lib/parser_inline.js"(exports, module2) {
    "use strict";
    var Ruler = require_ruler();
    var _rules = [
      ["text", require_text()],
      ["linkify", require_linkify2()],
      ["newline", require_newline()],
      ["escape", require_escape()],
      ["backticks", require_backticks()],
      ["strikethrough", require_strikethrough().tokenize],
      ["emphasis", require_emphasis().tokenize],
      ["link", require_link()],
      ["image", require_image()],
      ["autolink", require_autolink()],
      ["html_inline", require_html_inline()],
      ["entity", require_entity()]
    ];
    var _rules2 = [
      ["balance_pairs", require_balance_pairs()],
      ["strikethrough", require_strikethrough().postProcess],
      ["emphasis", require_emphasis().postProcess],
      // rules for pairs separate '**' into its own text tokens, which may be left unused,
      // rule below merges unused segments back with the rest of the text
      ["fragments_join", require_fragments_join()]
    ];
    function ParserInline() {
      var i2;
      this.ruler = new Ruler();
      for (i2 = 0; i2 < _rules.length; i2++) {
        this.ruler.push(_rules[i2][0], _rules[i2][1]);
      }
      this.ruler2 = new Ruler();
      for (i2 = 0; i2 < _rules2.length; i2++) {
        this.ruler2.push(_rules2[i2][0], _rules2[i2][1]);
      }
    }
    ParserInline.prototype.skipToken = function(state) {
      var ok, i2, pos = state.pos, rules = this.ruler.getRules(""), len = rules.length, maxNesting = state.md.options.maxNesting, cache = state.cache;
      if (typeof cache[pos] !== "undefined") {
        state.pos = cache[pos];
        return;
      }
      if (state.level < maxNesting) {
        for (i2 = 0; i2 < len; i2++) {
          state.level++;
          ok = rules[i2](state, true);
          state.level--;
          if (ok) {
            if (pos >= state.pos) {
              throw new Error("inline rule didn't increment state.pos");
            }
            break;
          }
        }
      } else {
        state.pos = state.posMax;
      }
      if (!ok) {
        state.pos++;
      }
      cache[pos] = state.pos;
    };
    ParserInline.prototype.tokenize = function(state) {
      var ok, i2, prevPos, rules = this.ruler.getRules(""), len = rules.length, end = state.posMax, maxNesting = state.md.options.maxNesting;
      while (state.pos < end) {
        prevPos = state.pos;
        if (state.level < maxNesting) {
          for (i2 = 0; i2 < len; i2++) {
            ok = rules[i2](state, false);
            if (ok) {
              if (prevPos >= state.pos) {
                throw new Error("inline rule didn't increment state.pos");
              }
              break;
            }
          }
        }
        if (ok) {
          if (state.pos >= end) {
            break;
          }
          continue;
        }
        state.pending += state.src[state.pos++];
      }
      if (state.pending) {
        state.pushPending();
      }
    };
    ParserInline.prototype.parse = function(str, md, env, outTokens) {
      var i2, rules, len;
      var state = new this.State(str, md, env, outTokens);
      this.tokenize(state);
      rules = this.ruler2.getRules("");
      len = rules.length;
      for (i2 = 0; i2 < len; i2++) {
        rules[i2](state);
      }
    };
    ParserInline.prototype.State = require_state_inline();
    module2.exports = ParserInline;
  }
});

// node_modules/linkify-it/lib/re.js
var require_re = __commonJS({
  "node_modules/linkify-it/lib/re.js"(exports, module2) {
    "use strict";
    module2.exports = function(opts) {
      var re = {};
      opts = opts || {};
      re.src_Any = require_regex2().source;
      re.src_Cc = require_regex3().source;
      re.src_Z = require_regex5().source;
      re.src_P = require_regex().source;
      re.src_ZPCc = [re.src_Z, re.src_P, re.src_Cc].join("|");
      re.src_ZCc = [re.src_Z, re.src_Cc].join("|");
      var text_separators = "[><\uFF5C]";
      re.src_pseudo_letter = "(?:(?!" + text_separators + "|" + re.src_ZPCc + ")" + re.src_Any + ")";
      re.src_ip4 = "(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)";
      re.src_auth = "(?:(?:(?!" + re.src_ZCc + "|[@/\\[\\]()]).)+@)?";
      re.src_port = "(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?";
      re.src_host_terminator = "(?=$|" + text_separators + "|" + re.src_ZPCc + ")(?!" + (opts["---"] ? "-(?!--)|" : "-|") + "_|:\\d|\\.-|\\.(?!$|" + re.src_ZPCc + "))";
      re.src_path = "(?:[/?#](?:(?!" + re.src_ZCc + "|" + text_separators + `|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!` + re.src_ZCc + "|\\]).)*\\]|\\((?:(?!" + re.src_ZCc + "|[)]).)*\\)|\\{(?:(?!" + re.src_ZCc + '|[}]).)*\\}|\\"(?:(?!' + re.src_ZCc + `|["]).)+\\"|\\'(?:(?!` + re.src_ZCc + "|[']).)+\\'|\\'(?=" + re.src_pseudo_letter + "|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!" + re.src_ZCc + "|[.]|$)|" + (opts["---"] ? "\\-(?!--(?:[^-]|$))(?:-*)|" : "\\-+|") + ",(?!" + re.src_ZCc + "|$)|;(?!" + re.src_ZCc + "|$)|\\!+(?!" + re.src_ZCc + "|[!]|$)|\\?(?!" + re.src_ZCc + "|[?]|$))+|\\/)?";
      re.src_email_name = '[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*';
      re.src_xn = "xn--[a-z0-9\\-]{1,59}";
      re.src_domain_root = // Allow letters & digits (http://test1)
      "(?:" + re.src_xn + "|" + re.src_pseudo_letter + "{1,63})";
      re.src_domain = "(?:" + re.src_xn + "|(?:" + re.src_pseudo_letter + ")|(?:" + re.src_pseudo_letter + "(?:-|" + re.src_pseudo_letter + "){0,61}" + re.src_pseudo_letter + "))";
      re.src_host = "(?:(?:(?:(?:" + re.src_domain + ")\\.)*" + re.src_domain + "))";
      re.tpl_host_fuzzy = "(?:" + re.src_ip4 + "|(?:(?:(?:" + re.src_domain + ")\\.)+(?:%TLDS%)))";
      re.tpl_host_no_ip_fuzzy = "(?:(?:(?:" + re.src_domain + ")\\.)+(?:%TLDS%))";
      re.src_host_strict = re.src_host + re.src_host_terminator;
      re.tpl_host_fuzzy_strict = re.tpl_host_fuzzy + re.src_host_terminator;
      re.src_host_port_strict = re.src_host + re.src_port + re.src_host_terminator;
      re.tpl_host_port_fuzzy_strict = re.tpl_host_fuzzy + re.src_port + re.src_host_terminator;
      re.tpl_host_port_no_ip_fuzzy_strict = re.tpl_host_no_ip_fuzzy + re.src_port + re.src_host_terminator;
      re.tpl_host_fuzzy_test = "localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:" + re.src_ZPCc + "|>|$))";
      re.tpl_email_fuzzy = "(^|" + text_separators + '|"|\\(|' + re.src_ZCc + ")(" + re.src_email_name + "@" + re.tpl_host_fuzzy_strict + ")";
      re.tpl_link_fuzzy = // Fuzzy link can't be prepended with .:/\- and non punctuation.
      // but can start with > (markdown blockquote)
      "(^|(?![.:/\\-_@])(?:[$+<=>^`|\uFF5C]|" + re.src_ZPCc + "))((?![$+<=>^`|\uFF5C])" + re.tpl_host_port_fuzzy_strict + re.src_path + ")";
      re.tpl_link_no_ip_fuzzy = // Fuzzy link can't be prepended with .:/\- and non punctuation.
      // but can start with > (markdown blockquote)
      "(^|(?![.:/\\-_@])(?:[$+<=>^`|\uFF5C]|" + re.src_ZPCc + "))((?![$+<=>^`|\uFF5C])" + re.tpl_host_port_no_ip_fuzzy_strict + re.src_path + ")";
      return re;
    };
  }
});

// node_modules/linkify-it/index.js
var require_linkify_it = __commonJS({
  "node_modules/linkify-it/index.js"(exports, module2) {
    "use strict";
    function assign(obj) {
      var sources = Array.prototype.slice.call(arguments, 1);
      sources.forEach(function(source) {
        if (!source) {
          return;
        }
        Object.keys(source).forEach(function(key) {
          obj[key] = source[key];
        });
      });
      return obj;
    }
    function _class(obj) {
      return Object.prototype.toString.call(obj);
    }
    function isString(obj) {
      return _class(obj) === "[object String]";
    }
    function isObject(obj) {
      return _class(obj) === "[object Object]";
    }
    function isRegExp(obj) {
      return _class(obj) === "[object RegExp]";
    }
    function isFunction(obj) {
      return _class(obj) === "[object Function]";
    }
    function escapeRE(str) {
      return str.replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&");
    }
    var defaultOptions = {
      fuzzyLink: true,
      fuzzyEmail: true,
      fuzzyIP: false
    };
    function isOptionsObj(obj) {
      return Object.keys(obj || {}).reduce(function(acc, k2) {
        return acc || defaultOptions.hasOwnProperty(k2);
      }, false);
    }
    var defaultSchemas = {
      "http:": {
        validate: function(text, pos, self2) {
          var tail = text.slice(pos);
          if (!self2.re.http) {
            self2.re.http = new RegExp(
              "^\\/\\/" + self2.re.src_auth + self2.re.src_host_port_strict + self2.re.src_path,
              "i"
            );
          }
          if (self2.re.http.test(tail)) {
            return tail.match(self2.re.http)[0].length;
          }
          return 0;
        }
      },
      "https:": "http:",
      "ftp:": "http:",
      "//": {
        validate: function(text, pos, self2) {
          var tail = text.slice(pos);
          if (!self2.re.no_http) {
            self2.re.no_http = new RegExp(
              "^" + self2.re.src_auth + // Don't allow single-level domains, because of false positives like '//test'
              // with code comments
              "(?:localhost|(?:(?:" + self2.re.src_domain + ")\\.)+" + self2.re.src_domain_root + ")" + self2.re.src_port + self2.re.src_host_terminator + self2.re.src_path,
              "i"
            );
          }
          if (self2.re.no_http.test(tail)) {
            if (pos >= 3 && text[pos - 3] === ":") {
              return 0;
            }
            if (pos >= 3 && text[pos - 3] === "/") {
              return 0;
            }
            return tail.match(self2.re.no_http)[0].length;
          }
          return 0;
        }
      },
      "mailto:": {
        validate: function(text, pos, self2) {
          var tail = text.slice(pos);
          if (!self2.re.mailto) {
            self2.re.mailto = new RegExp(
              "^" + self2.re.src_email_name + "@" + self2.re.src_host_strict,
              "i"
            );
          }
          if (self2.re.mailto.test(tail)) {
            return tail.match(self2.re.mailto)[0].length;
          }
          return 0;
        }
      }
    };
    var tlds_2ch_src_re = "a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]";
    var tlds_default = "biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|\u0440\u0444".split("|");
    function resetScanCache(self2) {
      self2.__index__ = -1;
      self2.__text_cache__ = "";
    }
    function createValidator(re) {
      return function(text, pos) {
        var tail = text.slice(pos);
        if (re.test(tail)) {
          return tail.match(re)[0].length;
        }
        return 0;
      };
    }
    function createNormalizer() {
      return function(match, self2) {
        self2.normalize(match);
      };
    }
    function compile(self2) {
      var re = self2.re = require_re()(self2.__opts__);
      var tlds = self2.__tlds__.slice();
      self2.onCompile();
      if (!self2.__tlds_replaced__) {
        tlds.push(tlds_2ch_src_re);
      }
      tlds.push(re.src_xn);
      re.src_tlds = tlds.join("|");
      function untpl(tpl) {
        return tpl.replace("%TLDS%", re.src_tlds);
      }
      re.email_fuzzy = RegExp(untpl(re.tpl_email_fuzzy), "i");
      re.link_fuzzy = RegExp(untpl(re.tpl_link_fuzzy), "i");
      re.link_no_ip_fuzzy = RegExp(untpl(re.tpl_link_no_ip_fuzzy), "i");
      re.host_fuzzy_test = RegExp(untpl(re.tpl_host_fuzzy_test), "i");
      var aliases = [];
      self2.__compiled__ = {};
      function schemaError(name, val) {
        throw new Error('(LinkifyIt) Invalid schema "' + name + '": ' + val);
      }
      Object.keys(self2.__schemas__).forEach(function(name) {
        var val = self2.__schemas__[name];
        if (val === null) {
          return;
        }
        var compiled = { validate: null, link: null };
        self2.__compiled__[name] = compiled;
        if (isObject(val)) {
          if (isRegExp(val.validate)) {
            compiled.validate = createValidator(val.validate);
          } else if (isFunction(val.validate)) {
            compiled.validate = val.validate;
          } else {
            schemaError(name, val);
          }
          if (isFunction(val.normalize)) {
            compiled.normalize = val.normalize;
          } else if (!val.normalize) {
            compiled.normalize = createNormalizer();
          } else {
            schemaError(name, val);
          }
          return;
        }
        if (isString(val)) {
          aliases.push(name);
          return;
        }
        schemaError(name, val);
      });
      aliases.forEach(function(alias) {
        if (!self2.__compiled__[self2.__schemas__[alias]]) {
          return;
        }
        self2.__compiled__[alias].validate = self2.__compiled__[self2.__schemas__[alias]].validate;
        self2.__compiled__[alias].normalize = self2.__compiled__[self2.__schemas__[alias]].normalize;
      });
      self2.__compiled__[""] = { validate: null, normalize: createNormalizer() };
      var slist = Object.keys(self2.__compiled__).filter(function(name) {
        return name.length > 0 && self2.__compiled__[name];
      }).map(escapeRE).join("|");
      self2.re.schema_test = RegExp("(^|(?!_)(?:[><\uFF5C]|" + re.src_ZPCc + "))(" + slist + ")", "i");
      self2.re.schema_search = RegExp("(^|(?!_)(?:[><\uFF5C]|" + re.src_ZPCc + "))(" + slist + ")", "ig");
      self2.re.schema_at_start = RegExp("^" + self2.re.schema_search.source, "i");
      self2.re.pretest = RegExp(
        "(" + self2.re.schema_test.source + ")|(" + self2.re.host_fuzzy_test.source + ")|@",
        "i"
      );
      resetScanCache(self2);
    }
    function Match(self2, shift) {
      var start = self2.__index__, end = self2.__last_index__, text = self2.__text_cache__.slice(start, end);
      this.schema = self2.__schema__.toLowerCase();
      this.index = start + shift;
      this.lastIndex = end + shift;
      this.raw = text;
      this.text = text;
      this.url = text;
    }
    function createMatch(self2, shift) {
      var match = new Match(self2, shift);
      self2.__compiled__[match.schema].normalize(match, self2);
      return match;
    }
    function LinkifyIt(schemas, options) {
      if (!(this instanceof LinkifyIt)) {
        return new LinkifyIt(schemas, options);
      }
      if (!options) {
        if (isOptionsObj(schemas)) {
          options = schemas;
          schemas = {};
        }
      }
      this.__opts__ = assign({}, defaultOptions, options);
      this.__index__ = -1;
      this.__last_index__ = -1;
      this.__schema__ = "";
      this.__text_cache__ = "";
      this.__schemas__ = assign({}, defaultSchemas, schemas);
      this.__compiled__ = {};
      this.__tlds__ = tlds_default;
      this.__tlds_replaced__ = false;
      this.re = {};
      compile(this);
    }
    LinkifyIt.prototype.add = function add(schema, definition) {
      this.__schemas__[schema] = definition;
      compile(this);
      return this;
    };
    LinkifyIt.prototype.set = function set(options) {
      this.__opts__ = assign(this.__opts__, options);
      return this;
    };
    LinkifyIt.prototype.test = function test(text) {
      this.__text_cache__ = text;
      this.__index__ = -1;
      if (!text.length) {
        return false;
      }
      var m2, ml, me, len, shift, next, re, tld_pos, at_pos;
      if (this.re.schema_test.test(text)) {
        re = this.re.schema_search;
        re.lastIndex = 0;
        while ((m2 = re.exec(text)) !== null) {
          len = this.testSchemaAt(text, m2[2], re.lastIndex);
          if (len) {
            this.__schema__ = m2[2];
            this.__index__ = m2.index + m2[1].length;
            this.__last_index__ = m2.index + m2[0].length + len;
            break;
          }
        }
      }
      if (this.__opts__.fuzzyLink && this.__compiled__["http:"]) {
        tld_pos = text.search(this.re.host_fuzzy_test);
        if (tld_pos >= 0) {
          if (this.__index__ < 0 || tld_pos < this.__index__) {
            if ((ml = text.match(this.__opts__.fuzzyIP ? this.re.link_fuzzy : this.re.link_no_ip_fuzzy)) !== null) {
              shift = ml.index + ml[1].length;
              if (this.__index__ < 0 || shift < this.__index__) {
                this.__schema__ = "";
                this.__index__ = shift;
                this.__last_index__ = ml.index + ml[0].length;
              }
            }
          }
        }
      }
      if (this.__opts__.fuzzyEmail && this.__compiled__["mailto:"]) {
        at_pos = text.indexOf("@");
        if (at_pos >= 0) {
          if ((me = text.match(this.re.email_fuzzy)) !== null) {
            shift = me.index + me[1].length;
            next = me.index + me[0].length;
            if (this.__index__ < 0 || shift < this.__index__ || shift === this.__index__ && next > this.__last_index__) {
              this.__schema__ = "mailto:";
              this.__index__ = shift;
              this.__last_index__ = next;
            }
          }
        }
      }
      return this.__index__ >= 0;
    };
    LinkifyIt.prototype.pretest = function pretest(text) {
      return this.re.pretest.test(text);
    };
    LinkifyIt.prototype.testSchemaAt = function testSchemaAt(text, schema, pos) {
      if (!this.__compiled__[schema.toLowerCase()]) {
        return 0;
      }
      return this.__compiled__[schema.toLowerCase()].validate(text, pos, this);
    };
    LinkifyIt.prototype.match = function match(text) {
      var shift = 0, result = [];
      if (this.__index__ >= 0 && this.__text_cache__ === text) {
        result.push(createMatch(this, shift));
        shift = this.__last_index__;
      }
      var tail = shift ? text.slice(shift) : text;
      while (this.test(tail)) {
        result.push(createMatch(this, shift));
        tail = tail.slice(this.__last_index__);
        shift += this.__last_index__;
      }
      if (result.length) {
        return result;
      }
      return null;
    };
    LinkifyIt.prototype.matchAtStart = function matchAtStart(text) {
      this.__text_cache__ = text;
      this.__index__ = -1;
      if (!text.length)
        return null;
      var m2 = this.re.schema_at_start.exec(text);
      if (!m2)
        return null;
      var len = this.testSchemaAt(text, m2[2], m2[0].length);
      if (!len)
        return null;
      this.__schema__ = m2[2];
      this.__index__ = m2.index + m2[1].length;
      this.__last_index__ = m2.index + m2[0].length + len;
      return createMatch(this, 0);
    };
    LinkifyIt.prototype.tlds = function tlds(list, keepOld) {
      list = Array.isArray(list) ? list : [list];
      if (!keepOld) {
        this.__tlds__ = list.slice();
        this.__tlds_replaced__ = true;
        compile(this);
        return this;
      }
      this.__tlds__ = this.__tlds__.concat(list).sort().filter(function(el, idx, arr) {
        return el !== arr[idx - 1];
      }).reverse();
      compile(this);
      return this;
    };
    LinkifyIt.prototype.normalize = function normalize(match) {
      if (!match.schema) {
        match.url = "http://" + match.url;
      }
      if (match.schema === "mailto:" && !/^mailto:/i.test(match.url)) {
        match.url = "mailto:" + match.url;
      }
    };
    LinkifyIt.prototype.onCompile = function onCompile() {
    };
    module2.exports = LinkifyIt;
  }
});

// node_modules/markdown-it/lib/presets/default.js
var require_default = __commonJS({
  "node_modules/markdown-it/lib/presets/default.js"(exports, module2) {
    "use strict";
    module2.exports = {
      options: {
        html: false,
        // Enable HTML tags in source
        xhtmlOut: false,
        // Use '/' to close single tags (<br />)
        breaks: false,
        // Convert '\n' in paragraphs into <br>
        langPrefix: "language-",
        // CSS language prefix for fenced blocks
        linkify: false,
        // autoconvert URL-like texts to links
        // Enable some language-neutral replacements + quotes beautification
        typographer: false,
        // Double + single quotes replacement pairs, when typographer enabled,
        // and smartquotes on. Could be either a String or an Array.
        //
        // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
        // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
        quotes: "\u201C\u201D\u2018\u2019",
        /* “”‘’ */
        // Highlighter function. Should return escaped HTML,
        // or '' if the source string is not changed and should be escaped externaly.
        // If result starts with <pre... internal wrapper is skipped.
        //
        // function (/*str, lang*/) { return ''; }
        //
        highlight: null,
        maxNesting: 100
        // Internal protection, recursion limit
      },
      components: {
        core: {},
        block: {},
        inline: {}
      }
    };
  }
});

// node_modules/markdown-it/lib/presets/zero.js
var require_zero = __commonJS({
  "node_modules/markdown-it/lib/presets/zero.js"(exports, module2) {
    "use strict";
    module2.exports = {
      options: {
        html: false,
        // Enable HTML tags in source
        xhtmlOut: false,
        // Use '/' to close single tags (<br />)
        breaks: false,
        // Convert '\n' in paragraphs into <br>
        langPrefix: "language-",
        // CSS language prefix for fenced blocks
        linkify: false,
        // autoconvert URL-like texts to links
        // Enable some language-neutral replacements + quotes beautification
        typographer: false,
        // Double + single quotes replacement pairs, when typographer enabled,
        // and smartquotes on. Could be either a String or an Array.
        //
        // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
        // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
        quotes: "\u201C\u201D\u2018\u2019",
        /* “”‘’ */
        // Highlighter function. Should return escaped HTML,
        // or '' if the source string is not changed and should be escaped externaly.
        // If result starts with <pre... internal wrapper is skipped.
        //
        // function (/*str, lang*/) { return ''; }
        //
        highlight: null,
        maxNesting: 20
        // Internal protection, recursion limit
      },
      components: {
        core: {
          rules: [
            "normalize",
            "block",
            "inline",
            "text_join"
          ]
        },
        block: {
          rules: [
            "paragraph"
          ]
        },
        inline: {
          rules: [
            "text"
          ],
          rules2: [
            "balance_pairs",
            "fragments_join"
          ]
        }
      }
    };
  }
});

// node_modules/markdown-it/lib/presets/commonmark.js
var require_commonmark = __commonJS({
  "node_modules/markdown-it/lib/presets/commonmark.js"(exports, module2) {
    "use strict";
    module2.exports = {
      options: {
        html: true,
        // Enable HTML tags in source
        xhtmlOut: true,
        // Use '/' to close single tags (<br />)
        breaks: false,
        // Convert '\n' in paragraphs into <br>
        langPrefix: "language-",
        // CSS language prefix for fenced blocks
        linkify: false,
        // autoconvert URL-like texts to links
        // Enable some language-neutral replacements + quotes beautification
        typographer: false,
        // Double + single quotes replacement pairs, when typographer enabled,
        // and smartquotes on. Could be either a String or an Array.
        //
        // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
        // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
        quotes: "\u201C\u201D\u2018\u2019",
        /* “”‘’ */
        // Highlighter function. Should return escaped HTML,
        // or '' if the source string is not changed and should be escaped externaly.
        // If result starts with <pre... internal wrapper is skipped.
        //
        // function (/*str, lang*/) { return ''; }
        //
        highlight: null,
        maxNesting: 20
        // Internal protection, recursion limit
      },
      components: {
        core: {
          rules: [
            "normalize",
            "block",
            "inline",
            "text_join"
          ]
        },
        block: {
          rules: [
            "blockquote",
            "code",
            "fence",
            "heading",
            "hr",
            "html_block",
            "lheading",
            "list",
            "reference",
            "paragraph"
          ]
        },
        inline: {
          rules: [
            "autolink",
            "backticks",
            "emphasis",
            "entity",
            "escape",
            "html_inline",
            "image",
            "link",
            "newline",
            "text"
          ],
          rules2: [
            "balance_pairs",
            "emphasis",
            "fragments_join"
          ]
        }
      }
    };
  }
});

// node_modules/markdown-it/lib/index.js
var require_lib2 = __commonJS({
  "node_modules/markdown-it/lib/index.js"(exports, module2) {
    "use strict";
    var utils = require_utils();
    var helpers = require_helpers();
    var Renderer = require_renderer();
    var ParserCore = require_parser_core();
    var ParserBlock = require_parser_block();
    var ParserInline = require_parser_inline();
    var LinkifyIt = require_linkify_it();
    var mdurl = require_mdurl();
    var punycode = require("punycode");
    var config = {
      default: require_default(),
      zero: require_zero(),
      commonmark: require_commonmark()
    };
    var BAD_PROTO_RE = /^(vbscript|javascript|file|data):/;
    var GOOD_DATA_RE = /^data:image\/(gif|png|jpeg|webp);/;
    function validateLink(url) {
      var str = url.trim().toLowerCase();
      return BAD_PROTO_RE.test(str) ? GOOD_DATA_RE.test(str) ? true : false : true;
    }
    var RECODE_HOSTNAME_FOR = ["http:", "https:", "mailto:"];
    function normalizeLink(url) {
      var parsed = mdurl.parse(url, true);
      if (parsed.hostname) {
        if (!parsed.protocol || RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0) {
          try {
            parsed.hostname = punycode.toASCII(parsed.hostname);
          } catch (er) {
          }
        }
      }
      return mdurl.encode(mdurl.format(parsed));
    }
    function normalizeLinkText(url) {
      var parsed = mdurl.parse(url, true);
      if (parsed.hostname) {
        if (!parsed.protocol || RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0) {
          try {
            parsed.hostname = punycode.toUnicode(parsed.hostname);
          } catch (er) {
          }
        }
      }
      return mdurl.decode(mdurl.format(parsed), mdurl.decode.defaultChars + "%");
    }
    function MarkdownIt(presetName, options) {
      if (!(this instanceof MarkdownIt)) {
        return new MarkdownIt(presetName, options);
      }
      if (!options) {
        if (!utils.isString(presetName)) {
          options = presetName || {};
          presetName = "default";
        }
      }
      this.inline = new ParserInline();
      this.block = new ParserBlock();
      this.core = new ParserCore();
      this.renderer = new Renderer();
      this.linkify = new LinkifyIt();
      this.validateLink = validateLink;
      this.normalizeLink = normalizeLink;
      this.normalizeLinkText = normalizeLinkText;
      this.utils = utils;
      this.helpers = utils.assign({}, helpers);
      this.options = {};
      this.configure(presetName);
      if (options) {
        this.set(options);
      }
    }
    MarkdownIt.prototype.set = function(options) {
      utils.assign(this.options, options);
      return this;
    };
    MarkdownIt.prototype.configure = function(presets) {
      var self2 = this, presetName;
      if (utils.isString(presets)) {
        presetName = presets;
        presets = config[presetName];
        if (!presets) {
          throw new Error('Wrong `markdown-it` preset "' + presetName + '", check name');
        }
      }
      if (!presets) {
        throw new Error("Wrong `markdown-it` preset, can't be empty");
      }
      if (presets.options) {
        self2.set(presets.options);
      }
      if (presets.components) {
        Object.keys(presets.components).forEach(function(name) {
          if (presets.components[name].rules) {
            self2[name].ruler.enableOnly(presets.components[name].rules);
          }
          if (presets.components[name].rules2) {
            self2[name].ruler2.enableOnly(presets.components[name].rules2);
          }
        });
      }
      return this;
    };
    MarkdownIt.prototype.enable = function(list, ignoreInvalid) {
      var result = [];
      if (!Array.isArray(list)) {
        list = [list];
      }
      ["core", "block", "inline"].forEach(function(chain) {
        result = result.concat(this[chain].ruler.enable(list, true));
      }, this);
      result = result.concat(this.inline.ruler2.enable(list, true));
      var missed = list.filter(function(name) {
        return result.indexOf(name) < 0;
      });
      if (missed.length && !ignoreInvalid) {
        throw new Error("MarkdownIt. Failed to enable unknown rule(s): " + missed);
      }
      return this;
    };
    MarkdownIt.prototype.disable = function(list, ignoreInvalid) {
      var result = [];
      if (!Array.isArray(list)) {
        list = [list];
      }
      ["core", "block", "inline"].forEach(function(chain) {
        result = result.concat(this[chain].ruler.disable(list, true));
      }, this);
      result = result.concat(this.inline.ruler2.disable(list, true));
      var missed = list.filter(function(name) {
        return result.indexOf(name) < 0;
      });
      if (missed.length && !ignoreInvalid) {
        throw new Error("MarkdownIt. Failed to disable unknown rule(s): " + missed);
      }
      return this;
    };
    MarkdownIt.prototype.use = function(plugin) {
      var args = [this].concat(Array.prototype.slice.call(arguments, 1));
      plugin.apply(plugin, args);
      return this;
    };
    MarkdownIt.prototype.parse = function(src, env) {
      if (typeof src !== "string") {
        throw new Error("Input data should be a String");
      }
      var state = new this.core.State(src, this, env);
      this.core.process(state);
      return state.tokens;
    };
    MarkdownIt.prototype.render = function(src, env) {
      env = env || {};
      return this.renderer.render(this.parse(src, env), this.options, env);
    };
    MarkdownIt.prototype.parseInline = function(src, env) {
      var state = new this.core.State(src, this, env);
      state.inlineMode = true;
      this.core.process(state);
      return state.tokens;
    };
    MarkdownIt.prototype.renderInline = function(src, env) {
      env = env || {};
      return this.renderer.render(this.parseInline(src, env), this.options, env);
    };
    module2.exports = MarkdownIt;
  }
});

// node_modules/markdown-it/index.js
var require_markdown_it = __commonJS({
  "node_modules/markdown-it/index.js"(exports, module2) {
    "use strict";
    module2.exports = require_lib2();
  }
});

// node_modules/papaparse/papaparse.min.js
var require_papaparse_min = __commonJS({
  "node_modules/papaparse/papaparse.min.js"(exports, module2) {
    !function(e, t2) {
      "function" == typeof define && define.amd ? define([], t2) : "object" == typeof module2 && "undefined" != typeof exports ? module2.exports = t2() : e.Papa = t2();
    }(exports, function s2() {
      "use strict";
      var f3 = "undefined" != typeof self ? self : "undefined" != typeof window ? window : void 0 !== f3 ? f3 : {};
      var n2 = !f3.document && !!f3.postMessage, o2 = f3.IS_PAPA_WORKER || false, a2 = {}, u2 = 0, b2 = { parse: function(e, t2) {
        var r3 = (t2 = t2 || {}).dynamicTyping || false;
        J(r3) && (t2.dynamicTypingFunction = r3, r3 = {});
        if (t2.dynamicTyping = r3, t2.transform = !!J(t2.transform) && t2.transform, t2.worker && b2.WORKERS_SUPPORTED) {
          var i2 = function() {
            if (!b2.WORKERS_SUPPORTED)
              return false;
            var e2 = (r4 = f3.URL || f3.webkitURL || null, i3 = s2.toString(), b2.BLOB_URL || (b2.BLOB_URL = r4.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ", "(", i3, ")();"], { type: "text/javascript" })))), t3 = new f3.Worker(e2);
            var r4, i3;
            return t3.onmessage = _7, t3.id = u2++, a2[t3.id] = t3;
          }();
          return i2.userStep = t2.step, i2.userChunk = t2.chunk, i2.userComplete = t2.complete, i2.userError = t2.error, t2.step = J(t2.step), t2.chunk = J(t2.chunk), t2.complete = J(t2.complete), t2.error = J(t2.error), delete t2.worker, void i2.postMessage({ input: e, config: t2, workerId: i2.id });
        }
        var n3 = null;
        b2.NODE_STREAM_INPUT, "string" == typeof e ? (e = function(e2) {
          if (65279 === e2.charCodeAt(0))
            return e2.slice(1);
          return e2;
        }(e), n3 = t2.download ? new l2(t2) : new p2(t2)) : true === e.readable && J(e.read) && J(e.on) ? n3 = new g2(t2) : (f3.File && e instanceof File || e instanceof Object) && (n3 = new c2(t2));
        return n3.stream(e);
      }, unparse: function(e, t2) {
        var n3 = false, _8 = true, m3 = ",", y3 = "\r\n", s3 = '"', a3 = s3 + s3, r3 = false, i2 = null, o3 = false;
        !function() {
          if ("object" != typeof t2)
            return;
          "string" != typeof t2.delimiter || b2.BAD_DELIMITERS.filter(function(e2) {
            return -1 !== t2.delimiter.indexOf(e2);
          }).length || (m3 = t2.delimiter);
          ("boolean" == typeof t2.quotes || "function" == typeof t2.quotes || Array.isArray(t2.quotes)) && (n3 = t2.quotes);
          "boolean" != typeof t2.skipEmptyLines && "string" != typeof t2.skipEmptyLines || (r3 = t2.skipEmptyLines);
          "string" == typeof t2.newline && (y3 = t2.newline);
          "string" == typeof t2.quoteChar && (s3 = t2.quoteChar);
          "boolean" == typeof t2.header && (_8 = t2.header);
          if (Array.isArray(t2.columns)) {
            if (0 === t2.columns.length)
              throw new Error("Option columns is empty");
            i2 = t2.columns;
          }
          void 0 !== t2.escapeChar && (a3 = t2.escapeChar + s3);
          ("boolean" == typeof t2.escapeFormulae || t2.escapeFormulae instanceof RegExp) && (o3 = t2.escapeFormulae instanceof RegExp ? t2.escapeFormulae : /^[=+\-@\t\r].*$/);
        }();
        var u3 = new RegExp(Q2(s3), "g");
        "string" == typeof e && (e = JSON.parse(e));
        if (Array.isArray(e)) {
          if (!e.length || Array.isArray(e[0]))
            return h3(null, e, r3);
          if ("object" == typeof e[0])
            return h3(i2 || Object.keys(e[0]), e, r3);
        } else if ("object" == typeof e)
          return "string" == typeof e.data && (e.data = JSON.parse(e.data)), Array.isArray(e.data) && (e.fields || (e.fields = e.meta && e.meta.fields || i2), e.fields || (e.fields = Array.isArray(e.data[0]) ? e.fields : "object" == typeof e.data[0] ? Object.keys(e.data[0]) : []), Array.isArray(e.data[0]) || "object" == typeof e.data[0] || (e.data = [e.data])), h3(e.fields || [], e.data || [], r3);
        throw new Error("Unable to serialize unrecognized input");
        function h3(e2, t3, r4) {
          var i3 = "";
          "string" == typeof e2 && (e2 = JSON.parse(e2)), "string" == typeof t3 && (t3 = JSON.parse(t3));
          var n4 = Array.isArray(e2) && 0 < e2.length, s4 = !Array.isArray(t3[0]);
          if (n4 && _8) {
            for (var a4 = 0; a4 < e2.length; a4++)
              0 < a4 && (i3 += m3), i3 += v3(e2[a4], a4);
            0 < t3.length && (i3 += y3);
          }
          for (var o4 = 0; o4 < t3.length; o4++) {
            var u4 = n4 ? e2.length : t3[o4].length, h4 = false, f4 = n4 ? 0 === Object.keys(t3[o4]).length : 0 === t3[o4].length;
            if (r4 && !n4 && (h4 = "greedy" === r4 ? "" === t3[o4].join("").trim() : 1 === t3[o4].length && 0 === t3[o4][0].length), "greedy" === r4 && n4) {
              for (var d3 = [], l3 = 0; l3 < u4; l3++) {
                var c3 = s4 ? e2[l3] : l3;
                d3.push(t3[o4][c3]);
              }
              h4 = "" === d3.join("").trim();
            }
            if (!h4) {
              for (var p3 = 0; p3 < u4; p3++) {
                0 < p3 && !f4 && (i3 += m3);
                var g3 = n4 && s4 ? e2[p3] : p3;
                i3 += v3(t3[o4][g3], p3);
              }
              o4 < t3.length - 1 && (!r4 || 0 < u4 && !f4) && (i3 += y3);
            }
          }
          return i3;
        }
        function v3(e2, t3) {
          if (null == e2)
            return "";
          if (e2.constructor === Date)
            return JSON.stringify(e2).slice(1, 25);
          var r4 = false;
          o3 && "string" == typeof e2 && o3.test(e2) && (e2 = "'" + e2, r4 = true);
          var i3 = e2.toString().replace(u3, a3);
          return (r4 = r4 || true === n3 || "function" == typeof n3 && n3(e2, t3) || Array.isArray(n3) && n3[t3] || function(e3, t4) {
            for (var r5 = 0; r5 < t4.length; r5++)
              if (-1 < e3.indexOf(t4[r5]))
                return true;
            return false;
          }(i3, b2.BAD_DELIMITERS) || -1 < i3.indexOf(m3) || " " === i3.charAt(0) || " " === i3.charAt(i3.length - 1)) ? s3 + i3 + s3 : i3;
        }
      } };
      if (b2.RECORD_SEP = String.fromCharCode(30), b2.UNIT_SEP = String.fromCharCode(31), b2.BYTE_ORDER_MARK = "\uFEFF", b2.BAD_DELIMITERS = ["\r", "\n", '"', b2.BYTE_ORDER_MARK], b2.WORKERS_SUPPORTED = !n2 && !!f3.Worker, b2.NODE_STREAM_INPUT = 1, b2.LocalChunkSize = 10485760, b2.RemoteChunkSize = 5242880, b2.DefaultDelimiter = ",", b2.Parser = E2, b2.ParserHandle = r2, b2.NetworkStreamer = l2, b2.FileStreamer = c2, b2.StringStreamer = p2, b2.ReadableStreamStreamer = g2, f3.jQuery) {
        var d2 = f3.jQuery;
        d2.fn.parse = function(o3) {
          var r3 = o3.config || {}, u3 = [];
          return this.each(function(e2) {
            if (!("INPUT" === d2(this).prop("tagName").toUpperCase() && "file" === d2(this).attr("type").toLowerCase() && f3.FileReader) || !this.files || 0 === this.files.length)
              return true;
            for (var t2 = 0; t2 < this.files.length; t2++)
              u3.push({ file: this.files[t2], inputElem: this, instanceConfig: d2.extend({}, r3) });
          }), e(), this;
          function e() {
            if (0 !== u3.length) {
              var e2, t2, r4, i2, n3 = u3[0];
              if (J(o3.before)) {
                var s3 = o3.before(n3.file, n3.inputElem);
                if ("object" == typeof s3) {
                  if ("abort" === s3.action)
                    return e2 = "AbortError", t2 = n3.file, r4 = n3.inputElem, i2 = s3.reason, void (J(o3.error) && o3.error({ name: e2 }, t2, r4, i2));
                  if ("skip" === s3.action)
                    return void h3();
                  "object" == typeof s3.config && (n3.instanceConfig = d2.extend(n3.instanceConfig, s3.config));
                } else if ("skip" === s3)
                  return void h3();
              }
              var a3 = n3.instanceConfig.complete;
              n3.instanceConfig.complete = function(e3) {
                J(a3) && a3(e3, n3.file, n3.inputElem), h3();
              }, b2.parse(n3.file, n3.instanceConfig);
            } else
              J(o3.complete) && o3.complete();
          }
          function h3() {
            u3.splice(0, 1), e();
          }
        };
      }
      function h2(e) {
        this._handle = null, this._finished = false, this._completed = false, this._halted = false, this._input = null, this._baseIndex = 0, this._partialLine = "", this._rowCount = 0, this._start = 0, this._nextChunk = null, this.isFirstChunk = true, this._completeResults = { data: [], errors: [], meta: {} }, function(e2) {
          var t2 = w2(e2);
          t2.chunkSize = parseInt(t2.chunkSize), e2.step || e2.chunk || (t2.chunkSize = null);
          this._handle = new r2(t2), (this._handle.streamer = this)._config = t2;
        }.call(this, e), this.parseChunk = function(e2, t2) {
          if (this.isFirstChunk && J(this._config.beforeFirstChunk)) {
            var r3 = this._config.beforeFirstChunk(e2);
            void 0 !== r3 && (e2 = r3);
          }
          this.isFirstChunk = false, this._halted = false;
          var i2 = this._partialLine + e2;
          this._partialLine = "";
          var n3 = this._handle.parse(i2, this._baseIndex, !this._finished);
          if (!this._handle.paused() && !this._handle.aborted()) {
            var s3 = n3.meta.cursor;
            this._finished || (this._partialLine = i2.substring(s3 - this._baseIndex), this._baseIndex = s3), n3 && n3.data && (this._rowCount += n3.data.length);
            var a3 = this._finished || this._config.preview && this._rowCount >= this._config.preview;
            if (o2)
              f3.postMessage({ results: n3, workerId: b2.WORKER_ID, finished: a3 });
            else if (J(this._config.chunk) && !t2) {
              if (this._config.chunk(n3, this._handle), this._handle.paused() || this._handle.aborted())
                return void (this._halted = true);
              n3 = void 0, this._completeResults = void 0;
            }
            return this._config.step || this._config.chunk || (this._completeResults.data = this._completeResults.data.concat(n3.data), this._completeResults.errors = this._completeResults.errors.concat(n3.errors), this._completeResults.meta = n3.meta), this._completed || !a3 || !J(this._config.complete) || n3 && n3.meta.aborted || (this._config.complete(this._completeResults, this._input), this._completed = true), a3 || n3 && n3.meta.paused || this._nextChunk(), n3;
          }
          this._halted = true;
        }, this._sendError = function(e2) {
          J(this._config.error) ? this._config.error(e2) : o2 && this._config.error && f3.postMessage({ workerId: b2.WORKER_ID, error: e2, finished: false });
        };
      }
      function l2(e) {
        var i2;
        (e = e || {}).chunkSize || (e.chunkSize = b2.RemoteChunkSize), h2.call(this, e), this._nextChunk = n2 ? function() {
          this._readChunk(), this._chunkLoaded();
        } : function() {
          this._readChunk();
        }, this.stream = function(e2) {
          this._input = e2, this._nextChunk();
        }, this._readChunk = function() {
          if (this._finished)
            this._chunkLoaded();
          else {
            if (i2 = new XMLHttpRequest(), this._config.withCredentials && (i2.withCredentials = this._config.withCredentials), n2 || (i2.onload = v2(this._chunkLoaded, this), i2.onerror = v2(this._chunkError, this)), i2.open(this._config.downloadRequestBody ? "POST" : "GET", this._input, !n2), this._config.downloadRequestHeaders) {
              var e2 = this._config.downloadRequestHeaders;
              for (var t2 in e2)
                i2.setRequestHeader(t2, e2[t2]);
            }
            if (this._config.chunkSize) {
              var r3 = this._start + this._config.chunkSize - 1;
              i2.setRequestHeader("Range", "bytes=" + this._start + "-" + r3);
            }
            try {
              i2.send(this._config.downloadRequestBody);
            } catch (e3) {
              this._chunkError(e3.message);
            }
            n2 && 0 === i2.status && this._chunkError();
          }
        }, this._chunkLoaded = function() {
          4 === i2.readyState && (i2.status < 200 || 400 <= i2.status ? this._chunkError() : (this._start += this._config.chunkSize ? this._config.chunkSize : i2.responseText.length, this._finished = !this._config.chunkSize || this._start >= function(e2) {
            var t2 = e2.getResponseHeader("Content-Range");
            if (null === t2)
              return -1;
            return parseInt(t2.substring(t2.lastIndexOf("/") + 1));
          }(i2), this.parseChunk(i2.responseText)));
        }, this._chunkError = function(e2) {
          var t2 = i2.statusText || e2;
          this._sendError(new Error(t2));
        };
      }
      function c2(e) {
        var i2, n3;
        (e = e || {}).chunkSize || (e.chunkSize = b2.LocalChunkSize), h2.call(this, e);
        var s3 = "undefined" != typeof FileReader;
        this.stream = function(e2) {
          this._input = e2, n3 = e2.slice || e2.webkitSlice || e2.mozSlice, s3 ? ((i2 = new FileReader()).onload = v2(this._chunkLoaded, this), i2.onerror = v2(this._chunkError, this)) : i2 = new FileReaderSync(), this._nextChunk();
        }, this._nextChunk = function() {
          this._finished || this._config.preview && !(this._rowCount < this._config.preview) || this._readChunk();
        }, this._readChunk = function() {
          var e2 = this._input;
          if (this._config.chunkSize) {
            var t2 = Math.min(this._start + this._config.chunkSize, this._input.size);
            e2 = n3.call(e2, this._start, t2);
          }
          var r3 = i2.readAsText(e2, this._config.encoding);
          s3 || this._chunkLoaded({ target: { result: r3 } });
        }, this._chunkLoaded = function(e2) {
          this._start += this._config.chunkSize, this._finished = !this._config.chunkSize || this._start >= this._input.size, this.parseChunk(e2.target.result);
        }, this._chunkError = function() {
          this._sendError(i2.error);
        };
      }
      function p2(e) {
        var r3;
        h2.call(this, e = e || {}), this.stream = function(e2) {
          return r3 = e2, this._nextChunk();
        }, this._nextChunk = function() {
          if (!this._finished) {
            var e2, t2 = this._config.chunkSize;
            return t2 ? (e2 = r3.substring(0, t2), r3 = r3.substring(t2)) : (e2 = r3, r3 = ""), this._finished = !r3, this.parseChunk(e2);
          }
        };
      }
      function g2(e) {
        h2.call(this, e = e || {});
        var t2 = [], r3 = true, i2 = false;
        this.pause = function() {
          h2.prototype.pause.apply(this, arguments), this._input.pause();
        }, this.resume = function() {
          h2.prototype.resume.apply(this, arguments), this._input.resume();
        }, this.stream = function(e2) {
          this._input = e2, this._input.on("data", this._streamData), this._input.on("end", this._streamEnd), this._input.on("error", this._streamError);
        }, this._checkIsFinished = function() {
          i2 && 1 === t2.length && (this._finished = true);
        }, this._nextChunk = function() {
          this._checkIsFinished(), t2.length ? this.parseChunk(t2.shift()) : r3 = true;
        }, this._streamData = v2(function(e2) {
          try {
            t2.push("string" == typeof e2 ? e2 : e2.toString(this._config.encoding)), r3 && (r3 = false, this._checkIsFinished(), this.parseChunk(t2.shift()));
          } catch (e3) {
            this._streamError(e3);
          }
        }, this), this._streamError = v2(function(e2) {
          this._streamCleanUp(), this._sendError(e2);
        }, this), this._streamEnd = v2(function() {
          this._streamCleanUp(), i2 = true, this._streamData("");
        }, this), this._streamCleanUp = v2(function() {
          this._input.removeListener("data", this._streamData), this._input.removeListener("end", this._streamEnd), this._input.removeListener("error", this._streamError);
        }, this);
      }
      function r2(m3) {
        var a3, o3, u3, i2 = Math.pow(2, 53), n3 = -i2, s3 = /^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/, h3 = /^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/, t2 = this, r3 = 0, f4 = 0, d3 = false, e = false, l3 = [], c3 = { data: [], errors: [], meta: {} };
        if (J(m3.step)) {
          var p3 = m3.step;
          m3.step = function(e2) {
            if (c3 = e2, _8())
              g3();
            else {
              if (g3(), 0 === c3.data.length)
                return;
              r3 += e2.data.length, m3.preview && r3 > m3.preview ? o3.abort() : (c3.data = c3.data[0], p3(c3, t2));
            }
          };
        }
        function y3(e2) {
          return "greedy" === m3.skipEmptyLines ? "" === e2.join("").trim() : 1 === e2.length && 0 === e2[0].length;
        }
        function g3() {
          return c3 && u3 && (k2("Delimiter", "UndetectableDelimiter", "Unable to auto-detect delimiting character; defaulted to '" + b2.DefaultDelimiter + "'"), u3 = false), m3.skipEmptyLines && (c3.data = c3.data.filter(function(e2) {
            return !y3(e2);
          })), _8() && function() {
            if (!c3)
              return;
            function e2(e3, t4) {
              J(m3.transformHeader) && (e3 = m3.transformHeader(e3, t4)), l3.push(e3);
            }
            if (Array.isArray(c3.data[0])) {
              for (var t3 = 0; _8() && t3 < c3.data.length; t3++)
                c3.data[t3].forEach(e2);
              c3.data.splice(0, 1);
            } else
              c3.data.forEach(e2);
          }(), function() {
            if (!c3 || !m3.header && !m3.dynamicTyping && !m3.transform)
              return c3;
            function e2(e3, t4) {
              var r4, i3 = m3.header ? {} : [];
              for (r4 = 0; r4 < e3.length; r4++) {
                var n4 = r4, s4 = e3[r4];
                m3.header && (n4 = r4 >= l3.length ? "__parsed_extra" : l3[r4]), m3.transform && (s4 = m3.transform(s4, n4)), s4 = v3(n4, s4), "__parsed_extra" === n4 ? (i3[n4] = i3[n4] || [], i3[n4].push(s4)) : i3[n4] = s4;
              }
              return m3.header && (r4 > l3.length ? k2("FieldMismatch", "TooManyFields", "Too many fields: expected " + l3.length + " fields but parsed " + r4, f4 + t4) : r4 < l3.length && k2("FieldMismatch", "TooFewFields", "Too few fields: expected " + l3.length + " fields but parsed " + r4, f4 + t4)), i3;
            }
            var t3 = 1;
            !c3.data.length || Array.isArray(c3.data[0]) ? (c3.data = c3.data.map(e2), t3 = c3.data.length) : c3.data = e2(c3.data, 0);
            m3.header && c3.meta && (c3.meta.fields = l3);
            return f4 += t3, c3;
          }();
        }
        function _8() {
          return m3.header && 0 === l3.length;
        }
        function v3(e2, t3) {
          return r4 = e2, m3.dynamicTypingFunction && void 0 === m3.dynamicTyping[r4] && (m3.dynamicTyping[r4] = m3.dynamicTypingFunction(r4)), true === (m3.dynamicTyping[r4] || m3.dynamicTyping) ? "true" === t3 || "TRUE" === t3 || "false" !== t3 && "FALSE" !== t3 && (function(e3) {
            if (s3.test(e3)) {
              var t4 = parseFloat(e3);
              if (n3 < t4 && t4 < i2)
                return true;
            }
            return false;
          }(t3) ? parseFloat(t3) : h3.test(t3) ? new Date(t3) : "" === t3 ? null : t3) : t3;
          var r4;
        }
        function k2(e2, t3, r4, i3) {
          var n4 = { type: e2, code: t3, message: r4 };
          void 0 !== i3 && (n4.row = i3), c3.errors.push(n4);
        }
        this.parse = function(e2, t3, r4) {
          var i3 = m3.quoteChar || '"';
          if (m3.newline || (m3.newline = function(e3, t4) {
            e3 = e3.substring(0, 1048576);
            var r5 = new RegExp(Q2(t4) + "([^]*?)" + Q2(t4), "gm"), i4 = (e3 = e3.replace(r5, "")).split("\r"), n5 = e3.split("\n"), s5 = 1 < n5.length && n5[0].length < i4[0].length;
            if (1 === i4.length || s5)
              return "\n";
            for (var a4 = 0, o4 = 0; o4 < i4.length; o4++)
              "\n" === i4[o4][0] && a4++;
            return a4 >= i4.length / 2 ? "\r\n" : "\r";
          }(e2, i3)), u3 = false, m3.delimiter)
            J(m3.delimiter) && (m3.delimiter = m3.delimiter(e2), c3.meta.delimiter = m3.delimiter);
          else {
            var n4 = function(e3, t4, r5, i4, n5) {
              var s5, a4, o4, u4;
              n5 = n5 || [",", "	", "|", ";", b2.RECORD_SEP, b2.UNIT_SEP];
              for (var h4 = 0; h4 < n5.length; h4++) {
                var f5 = n5[h4], d4 = 0, l4 = 0, c4 = 0;
                o4 = void 0;
                for (var p4 = new E2({ comments: i4, delimiter: f5, newline: t4, preview: 10 }).parse(e3), g4 = 0; g4 < p4.data.length; g4++)
                  if (r5 && y3(p4.data[g4]))
                    c4++;
                  else {
                    var _9 = p4.data[g4].length;
                    l4 += _9, void 0 !== o4 ? 0 < _9 && (d4 += Math.abs(_9 - o4), o4 = _9) : o4 = _9;
                  }
                0 < p4.data.length && (l4 /= p4.data.length - c4), (void 0 === a4 || d4 <= a4) && (void 0 === u4 || u4 < l4) && 1.99 < l4 && (a4 = d4, s5 = f5, u4 = l4);
              }
              return { successful: !!(m3.delimiter = s5), bestDelimiter: s5 };
            }(e2, m3.newline, m3.skipEmptyLines, m3.comments, m3.delimitersToGuess);
            n4.successful ? m3.delimiter = n4.bestDelimiter : (u3 = true, m3.delimiter = b2.DefaultDelimiter), c3.meta.delimiter = m3.delimiter;
          }
          var s4 = w2(m3);
          return m3.preview && m3.header && s4.preview++, a3 = e2, o3 = new E2(s4), c3 = o3.parse(a3, t3, r4), g3(), d3 ? { meta: { paused: true } } : c3 || { meta: { paused: false } };
        }, this.paused = function() {
          return d3;
        }, this.pause = function() {
          d3 = true, o3.abort(), a3 = J(m3.chunk) ? "" : a3.substring(o3.getCharIndex());
        }, this.resume = function() {
          t2.streamer._halted ? (d3 = false, t2.streamer.parseChunk(a3, true)) : setTimeout(t2.resume, 3);
        }, this.aborted = function() {
          return e;
        }, this.abort = function() {
          e = true, o3.abort(), c3.meta.aborted = true, J(m3.complete) && m3.complete(c3), a3 = "";
        };
      }
      function Q2(e) {
        return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
      }
      function E2(j2) {
        var z2, M2 = (j2 = j2 || {}).delimiter, P2 = j2.newline, U2 = j2.comments, q2 = j2.step, N2 = j2.preview, B2 = j2.fastMode, K = z2 = void 0 === j2.quoteChar || null === j2.quoteChar ? '"' : j2.quoteChar;
        if (void 0 !== j2.escapeChar && (K = j2.escapeChar), ("string" != typeof M2 || -1 < b2.BAD_DELIMITERS.indexOf(M2)) && (M2 = ","), U2 === M2)
          throw new Error("Comment character same as delimiter");
        true === U2 ? U2 = "#" : ("string" != typeof U2 || -1 < b2.BAD_DELIMITERS.indexOf(U2)) && (U2 = false), "\n" !== P2 && "\r" !== P2 && "\r\n" !== P2 && (P2 = "\n");
        var W2 = 0, H2 = false;
        this.parse = function(i2, t2, r3) {
          if ("string" != typeof i2)
            throw new Error("Input must be a string");
          var n3 = i2.length, e = M2.length, s3 = P2.length, a3 = U2.length, o3 = J(q2), u3 = [], h3 = [], f4 = [], d3 = W2 = 0;
          if (!i2)
            return L2();
          if (j2.header && !t2) {
            var l3 = i2.split(P2)[0].split(M2), c3 = [], p3 = {}, g3 = false;
            for (var _8 in l3) {
              var m3 = l3[_8];
              J(j2.transformHeader) && (m3 = j2.transformHeader(m3, _8));
              var y3 = m3, v3 = p3[m3] || 0;
              for (0 < v3 && (g3 = true, y3 = m3 + "_" + v3), p3[m3] = v3 + 1; c3.includes(y3); )
                y3 = y3 + "_" + v3;
              c3.push(y3);
            }
            if (g3) {
              var k2 = i2.split(P2);
              k2[0] = c3.join(M2), i2 = k2.join(P2);
            }
          }
          if (B2 || false !== B2 && -1 === i2.indexOf(z2)) {
            for (var b3 = i2.split(P2), E3 = 0; E3 < b3.length; E3++) {
              if (f4 = b3[E3], W2 += f4.length, E3 !== b3.length - 1)
                W2 += P2.length;
              else if (r3)
                return L2();
              if (!U2 || f4.substring(0, a3) !== U2) {
                if (o3) {
                  if (u3 = [], I2(f4.split(M2)), F2(), H2)
                    return L2();
                } else
                  I2(f4.split(M2));
                if (N2 && N2 <= E3)
                  return u3 = u3.slice(0, N2), L2(true);
              }
            }
            return L2();
          }
          for (var w3 = i2.indexOf(M2, W2), R2 = i2.indexOf(P2, W2), C = new RegExp(Q2(K) + Q2(z2), "g"), S2 = i2.indexOf(z2, W2); ; )
            if (i2[W2] !== z2)
              if (U2 && 0 === f4.length && i2.substring(W2, W2 + a3) === U2) {
                if (-1 === R2)
                  return L2();
                W2 = R2 + s3, R2 = i2.indexOf(P2, W2), w3 = i2.indexOf(M2, W2);
              } else if (-1 !== w3 && (w3 < R2 || -1 === R2))
                f4.push(i2.substring(W2, w3)), W2 = w3 + e, w3 = i2.indexOf(M2, W2);
              else {
                if (-1 === R2)
                  break;
                if (f4.push(i2.substring(W2, R2)), D2(R2 + s3), o3 && (F2(), H2))
                  return L2();
                if (N2 && u3.length >= N2)
                  return L2(true);
              }
            else
              for (S2 = W2, W2++; ; ) {
                if (-1 === (S2 = i2.indexOf(z2, S2 + 1)))
                  return r3 || h3.push({ type: "Quotes", code: "MissingQuotes", message: "Quoted field unterminated", row: u3.length, index: W2 }), T();
                if (S2 === n3 - 1)
                  return T(i2.substring(W2, S2).replace(C, z2));
                if (z2 !== K || i2[S2 + 1] !== K) {
                  if (z2 === K || 0 === S2 || i2[S2 - 1] !== K) {
                    -1 !== w3 && w3 < S2 + 1 && (w3 = i2.indexOf(M2, S2 + 1)), -1 !== R2 && R2 < S2 + 1 && (R2 = i2.indexOf(P2, S2 + 1));
                    var O2 = A2(-1 === R2 ? w3 : Math.min(w3, R2));
                    if (i2.substr(S2 + 1 + O2, e) === M2) {
                      f4.push(i2.substring(W2, S2).replace(C, z2)), i2[W2 = S2 + 1 + O2 + e] !== z2 && (S2 = i2.indexOf(z2, W2)), w3 = i2.indexOf(M2, W2), R2 = i2.indexOf(P2, W2);
                      break;
                    }
                    var x2 = A2(R2);
                    if (i2.substring(S2 + 1 + x2, S2 + 1 + x2 + s3) === P2) {
                      if (f4.push(i2.substring(W2, S2).replace(C, z2)), D2(S2 + 1 + x2 + s3), w3 = i2.indexOf(M2, W2), S2 = i2.indexOf(z2, W2), o3 && (F2(), H2))
                        return L2();
                      if (N2 && u3.length >= N2)
                        return L2(true);
                      break;
                    }
                    h3.push({ type: "Quotes", code: "InvalidQuotes", message: "Trailing quote on quoted field is malformed", row: u3.length, index: W2 }), S2++;
                  }
                } else
                  S2++;
              }
          return T();
          function I2(e2) {
            u3.push(e2), d3 = W2;
          }
          function A2(e2) {
            var t3 = 0;
            if (-1 !== e2) {
              var r4 = i2.substring(S2 + 1, e2);
              r4 && "" === r4.trim() && (t3 = r4.length);
            }
            return t3;
          }
          function T(e2) {
            return r3 || (void 0 === e2 && (e2 = i2.substring(W2)), f4.push(e2), W2 = n3, I2(f4), o3 && F2()), L2();
          }
          function D2(e2) {
            W2 = e2, I2(f4), f4 = [], R2 = i2.indexOf(P2, W2);
          }
          function L2(e2) {
            return { data: u3, errors: h3, meta: { delimiter: M2, linebreak: P2, aborted: H2, truncated: !!e2, cursor: d3 + (t2 || 0) } };
          }
          function F2() {
            q2(L2()), u3 = [], h3 = [];
          }
        }, this.abort = function() {
          H2 = true;
        }, this.getCharIndex = function() {
          return W2;
        };
      }
      function _7(e) {
        var t2 = e.data, r3 = a2[t2.workerId], i2 = false;
        if (t2.error)
          r3.userError(t2.error, t2.file);
        else if (t2.results && t2.results.data) {
          var n3 = { abort: function() {
            i2 = true, m2(t2.workerId, { data: [], errors: [], meta: { aborted: true } });
          }, pause: y2, resume: y2 };
          if (J(r3.userStep)) {
            for (var s3 = 0; s3 < t2.results.data.length && (r3.userStep({ data: t2.results.data[s3], errors: t2.results.errors, meta: t2.results.meta }, n3), !i2); s3++)
              ;
            delete t2.results;
          } else
            J(r3.userChunk) && (r3.userChunk(t2.results, n3, t2.file), delete t2.results);
        }
        t2.finished && !i2 && m2(t2.workerId, t2.results);
      }
      function m2(e, t2) {
        var r3 = a2[e];
        J(r3.userComplete) && r3.userComplete(t2), r3.terminate(), delete a2[e];
      }
      function y2() {
        throw new Error("Not implemented.");
      }
      function w2(e) {
        if ("object" != typeof e || null === e)
          return e;
        var t2 = Array.isArray(e) ? [] : {};
        for (var r3 in e)
          t2[r3] = w2(e[r3]);
        return t2;
      }
      function v2(e, t2) {
        return function() {
          e.apply(t2, arguments);
        };
      }
      function J(e) {
        return "function" == typeof e;
      }
      return o2 && (f3.onmessage = function(e) {
        var t2 = e.data;
        void 0 === b2.WORKER_ID && t2 && (b2.WORKER_ID = t2.workerId);
        if ("string" == typeof t2.input)
          f3.postMessage({ workerId: b2.WORKER_ID, results: b2.parse(t2.input, t2.config), finished: true });
        else if (f3.File && t2.input instanceof File || t2.input instanceof Object) {
          var r3 = b2.parse(t2.input, t2.config);
          r3 && f3.postMessage({ workerId: b2.WORKER_ID, results: r3, finished: true });
        }
      }), (l2.prototype = Object.create(h2.prototype)).constructor = l2, (c2.prototype = Object.create(h2.prototype)).constructor = c2, (p2.prototype = Object.create(p2.prototype)).constructor = p2, (g2.prototype = Object.create(h2.prototype)).constructor = g2, b2;
    });
  }
});

// node_modules/jsondiffpatch/dist/empty.js
var require_empty = __commonJS({
  "node_modules/jsondiffpatch/dist/empty.js"() {
  }
});

// node_modules/jsondiffpatch/dist/jsondiffpatch.umd.js
var require_jsondiffpatch_umd = __commonJS({
  "node_modules/jsondiffpatch/dist/jsondiffpatch.umd.js"(exports, module2) {
    (function(global2, factory) {
      typeof exports === "object" && typeof module2 !== "undefined" ? factory(exports, require_empty()) : typeof define === "function" && define.amd ? define(["exports", "./empty"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.jsondiffpatch = {}, global2.chalk));
    })(exports, function(exports2, chalk) {
      "use strict";
      class Processor {
        constructor(options) {
          this.selfOptions = options || {};
          this.pipes = {};
        }
        options(options) {
          if (options) {
            this.selfOptions = options;
          }
          return this.selfOptions;
        }
        pipe(name, pipeArg) {
          let pipe2 = pipeArg;
          if (typeof name === "string") {
            if (typeof pipe2 === "undefined") {
              return this.pipes[name];
            } else {
              this.pipes[name] = pipe2;
            }
          }
          if (name && name.name) {
            pipe2 = name;
            if (pipe2.processor === this) {
              return pipe2;
            }
            this.pipes[pipe2.name] = pipe2;
          }
          pipe2.processor = this;
          return pipe2;
        }
        process(input, pipe2) {
          let context = input;
          context.options = this.options();
          let nextPipe = pipe2 || input.pipe || "default";
          let lastPipe;
          let lastContext;
          while (nextPipe) {
            if (typeof context.nextAfterChildren !== "undefined") {
              context.next = context.nextAfterChildren;
              context.nextAfterChildren = null;
            }
            if (typeof nextPipe === "string") {
              nextPipe = this.pipe(nextPipe);
            }
            nextPipe.process(context);
            lastContext = context;
            lastPipe = nextPipe;
            nextPipe = null;
            if (context) {
              if (context.next) {
                context = context.next;
                nextPipe = lastContext.nextPipe || context.pipe || lastPipe;
              }
            }
          }
          return context.hasResult ? context.result : void 0;
        }
      }
      class Pipe {
        constructor(name) {
          this.name = name;
          this.filters = [];
        }
        process(input) {
          if (!this.processor) {
            throw new Error("add this pipe to a processor before using it");
          }
          const debug = this.debug;
          const length = this.filters.length;
          const context = input;
          for (let index2 = 0; index2 < length; index2++) {
            const filter3 = this.filters[index2];
            if (debug) {
              this.log(`filter: ${filter3.filterName}`);
            }
            filter3(context);
            if (typeof context === "object" && context.exiting) {
              context.exiting = false;
              break;
            }
          }
          if (!context.next && this.resultCheck) {
            this.resultCheck(context);
          }
        }
        log(msg) {
          console.log(`[jsondiffpatch] ${this.name} pipe, ${msg}`);
        }
        append() {
          this.filters.push(...arguments);
          return this;
        }
        prepend() {
          this.filters.unshift(...arguments);
          return this;
        }
        indexOf(filterName) {
          if (!filterName) {
            throw new Error("a filter name is required");
          }
          for (let index2 = 0; index2 < this.filters.length; index2++) {
            const filter3 = this.filters[index2];
            if (filter3.filterName === filterName) {
              return index2;
            }
          }
          throw new Error(`filter not found: ${filterName}`);
        }
        list() {
          return this.filters.map((f3) => f3.filterName);
        }
        after(filterName) {
          const index2 = this.indexOf(filterName);
          const params = Array.prototype.slice.call(arguments, 1);
          if (!params.length) {
            throw new Error("a filter is required");
          }
          params.unshift(index2 + 1, 0);
          Array.prototype.splice.apply(this.filters, params);
          return this;
        }
        before(filterName) {
          const index2 = this.indexOf(filterName);
          const params = Array.prototype.slice.call(arguments, 1);
          if (!params.length) {
            throw new Error("a filter is required");
          }
          params.unshift(index2, 0);
          Array.prototype.splice.apply(this.filters, params);
          return this;
        }
        replace(filterName) {
          const index2 = this.indexOf(filterName);
          const params = Array.prototype.slice.call(arguments, 1);
          if (!params.length) {
            throw new Error("a filter is required");
          }
          params.unshift(index2, 1);
          Array.prototype.splice.apply(this.filters, params);
          return this;
        }
        remove(filterName) {
          const index2 = this.indexOf(filterName);
          this.filters.splice(index2, 1);
          return this;
        }
        clear() {
          this.filters.length = 0;
          return this;
        }
        shouldHaveResult(should) {
          if (should === false) {
            this.resultCheck = null;
            return;
          }
          if (this.resultCheck) {
            return;
          }
          const pipe2 = this;
          this.resultCheck = (context) => {
            if (!context.hasResult) {
              console.log(context);
              const error = new Error(`${pipe2.name} failed`);
              error.noResult = true;
              throw error;
            }
          };
          return this;
        }
      }
      class Context {
        setResult(result) {
          this.result = result;
          this.hasResult = true;
          return this;
        }
        exit() {
          this.exiting = true;
          return this;
        }
        switchTo(next, pipe2) {
          if (typeof next === "string" || next instanceof Pipe) {
            this.nextPipe = next;
          } else {
            this.next = next;
            if (pipe2) {
              this.nextPipe = pipe2;
            }
          }
          return this;
        }
        push(child, name) {
          child.parent = this;
          if (typeof name !== "undefined") {
            child.childName = name;
          }
          child.root = this.root || this;
          child.options = child.options || this.options;
          if (!this.children) {
            this.children = [child];
            this.nextAfterChildren = this.next || null;
            this.next = child;
          } else {
            this.children[this.children.length - 1].next = child;
            this.children.push(child);
          }
          child.next = this;
          return this;
        }
      }
      const isArray$3 = typeof Array.isArray === "function" ? Array.isArray : (a2) => a2 instanceof Array;
      function cloneRegExp(re) {
        const regexMatch = /^\/(.*)\/([gimyu]*)$/.exec(re.toString());
        return new RegExp(regexMatch[1], regexMatch[2]);
      }
      function clone$1(arg) {
        if (typeof arg !== "object") {
          return arg;
        }
        if (arg === null) {
          return null;
        }
        if (isArray$3(arg)) {
          return arg.map(clone$1);
        }
        if (arg instanceof Date) {
          return new Date(arg.getTime());
        }
        if (arg instanceof RegExp) {
          return cloneRegExp(arg);
        }
        const cloned = {};
        for (const name in arg) {
          if (Object.prototype.hasOwnProperty.call(arg, name)) {
            cloned[name] = clone$1(arg[name]);
          }
        }
        return cloned;
      }
      class DiffContext extends Context {
        constructor(left, right) {
          super();
          this.left = left;
          this.right = right;
          this.pipe = "diff";
        }
        setResult(result) {
          if (this.options.cloneDiffValues && typeof result === "object") {
            const clone3 = typeof this.options.cloneDiffValues === "function" ? this.options.cloneDiffValues : clone$1;
            if (typeof result[0] === "object") {
              result[0] = clone3(result[0]);
            }
            if (typeof result[1] === "object") {
              result[1] = clone3(result[1]);
            }
          }
          return Context.prototype.setResult.apply(this, arguments);
        }
      }
      class PatchContext extends Context {
        constructor(left, delta) {
          super();
          this.left = left;
          this.delta = delta;
          this.pipe = "patch";
        }
      }
      class ReverseContext extends Context {
        constructor(delta) {
          super();
          this.delta = delta;
          this.pipe = "reverse";
        }
      }
      const isArray$2 = typeof Array.isArray === "function" ? Array.isArray : function(a2) {
        return a2 instanceof Array;
      };
      const diffFilter$3 = function trivialMatchesDiffFilter(context) {
        if (context.left === context.right) {
          context.setResult(void 0).exit();
          return;
        }
        if (typeof context.left === "undefined") {
          if (typeof context.right === "function") {
            throw new Error("functions are not supported");
          }
          context.setResult([context.right]).exit();
          return;
        }
        if (typeof context.right === "undefined") {
          context.setResult([context.left, 0, 0]).exit();
          return;
        }
        if (typeof context.left === "function" || typeof context.right === "function") {
          throw new Error("functions are not supported");
        }
        context.leftType = context.left === null ? "null" : typeof context.left;
        context.rightType = context.right === null ? "null" : typeof context.right;
        if (context.leftType !== context.rightType) {
          context.setResult([context.left, context.right]).exit();
          return;
        }
        if (context.leftType === "boolean" || context.leftType === "number") {
          context.setResult([context.left, context.right]).exit();
          return;
        }
        if (context.leftType === "object") {
          context.leftIsArray = isArray$2(context.left);
        }
        if (context.rightType === "object") {
          context.rightIsArray = isArray$2(context.right);
        }
        if (context.leftIsArray !== context.rightIsArray) {
          context.setResult([context.left, context.right]).exit();
          return;
        }
        if (context.left instanceof RegExp) {
          if (context.right instanceof RegExp) {
            context.setResult([context.left.toString(), context.right.toString()]).exit();
          } else {
            context.setResult([context.left, context.right]).exit();
          }
        }
      };
      diffFilter$3.filterName = "trivial";
      const patchFilter$3 = function trivialMatchesPatchFilter(context) {
        if (typeof context.delta === "undefined") {
          context.setResult(context.left).exit();
          return;
        }
        context.nested = !isArray$2(context.delta);
        if (context.nested) {
          return;
        }
        if (context.delta.length === 1) {
          context.setResult(context.delta[0]).exit();
          return;
        }
        if (context.delta.length === 2) {
          if (context.left instanceof RegExp) {
            const regexArgs = /^\/(.*)\/([gimyu]+)$/.exec(context.delta[1]);
            if (regexArgs) {
              context.setResult(new RegExp(regexArgs[1], regexArgs[2])).exit();
              return;
            }
          }
          context.setResult(context.delta[1]).exit();
          return;
        }
        if (context.delta.length === 3 && context.delta[2] === 0) {
          context.setResult(void 0).exit();
        }
      };
      patchFilter$3.filterName = "trivial";
      const reverseFilter$3 = function trivialReferseFilter(context) {
        if (typeof context.delta === "undefined") {
          context.setResult(context.delta).exit();
          return;
        }
        context.nested = !isArray$2(context.delta);
        if (context.nested) {
          return;
        }
        if (context.delta.length === 1) {
          context.setResult([context.delta[0], 0, 0]).exit();
          return;
        }
        if (context.delta.length === 2) {
          context.setResult([context.delta[1], context.delta[0]]).exit();
          return;
        }
        if (context.delta.length === 3 && context.delta[2] === 0) {
          context.setResult([context.delta[0]]).exit();
        }
      };
      reverseFilter$3.filterName = "trivial";
      function collectChildrenDiffFilter(context) {
        if (!context || !context.children) {
          return;
        }
        const length = context.children.length;
        let child;
        let result = context.result;
        for (let index2 = 0; index2 < length; index2++) {
          child = context.children[index2];
          if (typeof child.result === "undefined") {
            continue;
          }
          result = result || {};
          result[child.childName] = child.result;
        }
        if (result && context.leftIsArray) {
          result._t = "a";
        }
        context.setResult(result).exit();
      }
      collectChildrenDiffFilter.filterName = "collectChildren";
      function objectsDiffFilter(context) {
        if (context.leftIsArray || context.leftType !== "object") {
          return;
        }
        let name;
        let child;
        const propertyFilter = context.options.propertyFilter;
        for (name in context.left) {
          if (!Object.prototype.hasOwnProperty.call(context.left, name)) {
            continue;
          }
          if (propertyFilter && !propertyFilter(name, context)) {
            continue;
          }
          child = new DiffContext(context.left[name], context.right[name]);
          context.push(child, name);
        }
        for (name in context.right) {
          if (!Object.prototype.hasOwnProperty.call(context.right, name)) {
            continue;
          }
          if (propertyFilter && !propertyFilter(name, context)) {
            continue;
          }
          if (typeof context.left[name] === "undefined") {
            child = new DiffContext(void 0, context.right[name]);
            context.push(child, name);
          }
        }
        if (!context.children || context.children.length === 0) {
          context.setResult(void 0).exit();
          return;
        }
        context.exit();
      }
      objectsDiffFilter.filterName = "objects";
      const patchFilter$2 = function nestedPatchFilter(context) {
        if (!context.nested) {
          return;
        }
        if (context.delta._t) {
          return;
        }
        let name;
        let child;
        for (name in context.delta) {
          child = new PatchContext(context.left[name], context.delta[name]);
          context.push(child, name);
        }
        context.exit();
      };
      patchFilter$2.filterName = "objects";
      const collectChildrenPatchFilter$1 = function collectChildrenPatchFilter2(context) {
        if (!context || !context.children) {
          return;
        }
        if (context.delta._t) {
          return;
        }
        const length = context.children.length;
        let child;
        for (let index2 = 0; index2 < length; index2++) {
          child = context.children[index2];
          if (Object.prototype.hasOwnProperty.call(context.left, child.childName) && child.result === void 0) {
            delete context.left[child.childName];
          } else if (context.left[child.childName] !== child.result) {
            context.left[child.childName] = child.result;
          }
        }
        context.setResult(context.left).exit();
      };
      collectChildrenPatchFilter$1.filterName = "collectChildren";
      const reverseFilter$2 = function nestedReverseFilter(context) {
        if (!context.nested) {
          return;
        }
        if (context.delta._t) {
          return;
        }
        let name;
        let child;
        for (name in context.delta) {
          child = new ReverseContext(context.delta[name]);
          context.push(child, name);
        }
        context.exit();
      };
      reverseFilter$2.filterName = "objects";
      function collectChildrenReverseFilter$1(context) {
        if (!context || !context.children) {
          return;
        }
        if (context.delta._t) {
          return;
        }
        const length = context.children.length;
        let child;
        const delta = {};
        for (let index2 = 0; index2 < length; index2++) {
          child = context.children[index2];
          if (delta[child.childName] !== child.result) {
            delta[child.childName] = child.result;
          }
        }
        context.setResult(delta).exit();
      }
      collectChildrenReverseFilter$1.filterName = "collectChildren";
      const defaultMatch = function(array1, array2, index1, index2) {
        return array1[index1] === array2[index2];
      };
      const lengthMatrix = function(array1, array2, match, context) {
        const len1 = array1.length;
        const len2 = array2.length;
        let x2, y2;
        const matrix = [len1 + 1];
        for (x2 = 0; x2 < len1 + 1; x2++) {
          matrix[x2] = [len2 + 1];
          for (y2 = 0; y2 < len2 + 1; y2++) {
            matrix[x2][y2] = 0;
          }
        }
        matrix.match = match;
        for (x2 = 1; x2 < len1 + 1; x2++) {
          for (y2 = 1; y2 < len2 + 1; y2++) {
            if (match(array1, array2, x2 - 1, y2 - 1, context)) {
              matrix[x2][y2] = matrix[x2 - 1][y2 - 1] + 1;
            } else {
              matrix[x2][y2] = Math.max(matrix[x2 - 1][y2], matrix[x2][y2 - 1]);
            }
          }
        }
        return matrix;
      };
      const backtrack = function(matrix, array1, array2, context) {
        let index1 = array1.length;
        let index2 = array2.length;
        const subsequence = {
          sequence: [],
          indices1: [],
          indices2: []
        };
        while (index1 !== 0 && index2 !== 0) {
          const sameLetter = matrix.match(array1, array2, index1 - 1, index2 - 1, context);
          if (sameLetter) {
            subsequence.sequence.unshift(array1[index1 - 1]);
            subsequence.indices1.unshift(index1 - 1);
            subsequence.indices2.unshift(index2 - 1);
            --index1;
            --index2;
          } else {
            const valueAtMatrixAbove = matrix[index1][index2 - 1];
            const valueAtMatrixLeft = matrix[index1 - 1][index2];
            if (valueAtMatrixAbove > valueAtMatrixLeft) {
              --index2;
            } else {
              --index1;
            }
          }
        }
        return subsequence;
      };
      const get = function(array1, array2, match, context) {
        const innerContext = context || {};
        const matrix = lengthMatrix(array1, array2, match || defaultMatch, innerContext);
        const result = backtrack(matrix, array1, array2, innerContext);
        if (typeof array1 === "string" && typeof array2 === "string") {
          result.sequence = result.sequence.join("");
        }
        return result;
      };
      var lcs = {
        get
      };
      const ARRAY_MOVE = 3;
      const isArray$1 = typeof Array.isArray === "function" ? Array.isArray : (a2) => a2 instanceof Array;
      const arrayIndexOf = typeof Array.prototype.indexOf === "function" ? (array, item) => array.indexOf(item) : (array, item) => {
        const length = array.length;
        for (let i2 = 0; i2 < length; i2++) {
          if (array[i2] === item) {
            return i2;
          }
        }
        return -1;
      };
      function arraysHaveMatchByRef(array1, array2, len1, len2) {
        for (let index1 = 0; index1 < len1; index1++) {
          const val1 = array1[index1];
          for (let index2 = 0; index2 < len2; index2++) {
            const val2 = array2[index2];
            if (index1 !== index2 && val1 === val2) {
              return true;
            }
          }
        }
      }
      function matchItems(array1, array2, index1, index2, context) {
        const value1 = array1[index1];
        const value2 = array2[index2];
        if (value1 === value2) {
          return true;
        }
        if (typeof value1 !== "object" || typeof value2 !== "object") {
          return false;
        }
        const objectHash = context.objectHash;
        if (!objectHash) {
          return context.matchByPosition && index1 === index2;
        }
        let hash1;
        let hash2;
        if (typeof index1 === "number") {
          context.hashCache1 = context.hashCache1 || [];
          hash1 = context.hashCache1[index1];
          if (typeof hash1 === "undefined") {
            context.hashCache1[index1] = hash1 = objectHash(value1, index1);
          }
        } else {
          hash1 = objectHash(value1);
        }
        if (typeof hash1 === "undefined") {
          return false;
        }
        if (typeof index2 === "number") {
          context.hashCache2 = context.hashCache2 || [];
          hash2 = context.hashCache2[index2];
          if (typeof hash2 === "undefined") {
            context.hashCache2[index2] = hash2 = objectHash(value2, index2);
          }
        } else {
          hash2 = objectHash(value2);
        }
        if (typeof hash2 === "undefined") {
          return false;
        }
        return hash1 === hash2;
      }
      const diffFilter$2 = function arraysDiffFilter(context) {
        if (!context.leftIsArray) {
          return;
        }
        const matchContext = {
          objectHash: context.options && context.options.objectHash,
          matchByPosition: context.options && context.options.matchByPosition
        };
        let commonHead = 0;
        let commonTail = 0;
        let index2;
        let index1;
        let index22;
        const array1 = context.left;
        const array2 = context.right;
        const len1 = array1.length;
        const len2 = array2.length;
        let child;
        if (len1 > 0 && len2 > 0 && !matchContext.objectHash && typeof matchContext.matchByPosition !== "boolean") {
          matchContext.matchByPosition = !arraysHaveMatchByRef(array1, array2, len1, len2);
        }
        while (commonHead < len1 && commonHead < len2 && matchItems(array1, array2, commonHead, commonHead, matchContext)) {
          index2 = commonHead;
          child = new DiffContext(context.left[index2], context.right[index2]);
          context.push(child, index2);
          commonHead++;
        }
        while (commonTail + commonHead < len1 && commonTail + commonHead < len2 && matchItems(array1, array2, len1 - 1 - commonTail, len2 - 1 - commonTail, matchContext)) {
          index1 = len1 - 1 - commonTail;
          index22 = len2 - 1 - commonTail;
          child = new DiffContext(context.left[index1], context.right[index22]);
          context.push(child, index22);
          commonTail++;
        }
        let result;
        if (commonHead + commonTail === len1) {
          if (len1 === len2) {
            context.setResult(void 0).exit();
            return;
          }
          result = result || {
            _t: "a"
          };
          for (index2 = commonHead; index2 < len2 - commonTail; index2++) {
            result[index2] = [array2[index2]];
          }
          context.setResult(result).exit();
          return;
        }
        if (commonHead + commonTail === len2) {
          result = result || {
            _t: "a"
          };
          for (index2 = commonHead; index2 < len1 - commonTail; index2++) {
            result[`_${index2}`] = [array1[index2], 0, 0];
          }
          context.setResult(result).exit();
          return;
        }
        delete matchContext.hashCache1;
        delete matchContext.hashCache2;
        const trimmed1 = array1.slice(commonHead, len1 - commonTail);
        const trimmed2 = array2.slice(commonHead, len2 - commonTail);
        const seq = lcs.get(trimmed1, trimmed2, matchItems, matchContext);
        const removedItems = [];
        result = result || {
          _t: "a"
        };
        for (index2 = commonHead; index2 < len1 - commonTail; index2++) {
          if (arrayIndexOf(seq.indices1, index2 - commonHead) < 0) {
            result[`_${index2}`] = [array1[index2], 0, 0];
            removedItems.push(index2);
          }
        }
        let detectMove = true;
        if (context.options && context.options.arrays && context.options.arrays.detectMove === false) {
          detectMove = false;
        }
        let includeValueOnMove = false;
        if (context.options && context.options.arrays && context.options.arrays.includeValueOnMove) {
          includeValueOnMove = true;
        }
        const removedItemsLength = removedItems.length;
        for (index2 = commonHead; index2 < len2 - commonTail; index2++) {
          const indexOnArray2 = arrayIndexOf(seq.indices2, index2 - commonHead);
          if (indexOnArray2 < 0) {
            let isMove = false;
            if (detectMove && removedItemsLength > 0) {
              for (let removeItemIndex1 = 0; removeItemIndex1 < removedItemsLength; removeItemIndex1++) {
                index1 = removedItems[removeItemIndex1];
                if (matchItems(trimmed1, trimmed2, index1 - commonHead, index2 - commonHead, matchContext)) {
                  result[`_${index1}`].splice(1, 2, index2, ARRAY_MOVE);
                  if (!includeValueOnMove) {
                    result[`_${index1}`][0] = "";
                  }
                  index22 = index2;
                  child = new DiffContext(context.left[index1], context.right[index22]);
                  context.push(child, index22);
                  removedItems.splice(removeItemIndex1, 1);
                  isMove = true;
                  break;
                }
              }
            }
            if (!isMove) {
              result[index2] = [array2[index2]];
            }
          } else {
            index1 = seq.indices1[indexOnArray2] + commonHead;
            index22 = seq.indices2[indexOnArray2] + commonHead;
            child = new DiffContext(context.left[index1], context.right[index22]);
            context.push(child, index22);
          }
        }
        context.setResult(result).exit();
      };
      diffFilter$2.filterName = "arrays";
      const compare = {
        numerically(a2, b2) {
          return a2 - b2;
        },
        numericallyBy(name) {
          return (a2, b2) => a2[name] - b2[name];
        }
      };
      const patchFilter$1 = function nestedPatchFilter(context) {
        if (!context.nested) {
          return;
        }
        if (context.delta._t !== "a") {
          return;
        }
        let index2;
        let index1;
        const delta = context.delta;
        const array = context.left;
        let toRemove = [];
        let toInsert = [];
        const toModify = [];
        for (index2 in delta) {
          if (index2 !== "_t") {
            if (index2[0] === "_") {
              if (delta[index2][2] === 0 || delta[index2][2] === ARRAY_MOVE) {
                toRemove.push(parseInt(index2.slice(1), 10));
              } else {
                throw new Error(`only removal or move can be applied at original array indices, invalid diff type: ${delta[index2][2]}`);
              }
            } else {
              if (delta[index2].length === 1) {
                toInsert.push({
                  index: parseInt(index2, 10),
                  value: delta[index2][0]
                });
              } else {
                toModify.push({
                  index: parseInt(index2, 10),
                  delta: delta[index2]
                });
              }
            }
          }
        }
        toRemove = toRemove.sort(compare.numerically);
        for (index2 = toRemove.length - 1; index2 >= 0; index2--) {
          index1 = toRemove[index2];
          const indexDiff = delta[`_${index1}`];
          const removedValue = array.splice(index1, 1)[0];
          if (indexDiff[2] === ARRAY_MOVE) {
            toInsert.push({
              index: indexDiff[1],
              value: removedValue
            });
          }
        }
        toInsert = toInsert.sort(compare.numericallyBy("index"));
        const toInsertLength = toInsert.length;
        for (index2 = 0; index2 < toInsertLength; index2++) {
          const insertion = toInsert[index2];
          array.splice(insertion.index, 0, insertion.value);
        }
        const toModifyLength = toModify.length;
        let child;
        if (toModifyLength > 0) {
          for (index2 = 0; index2 < toModifyLength; index2++) {
            const modification = toModify[index2];
            child = new PatchContext(context.left[modification.index], modification.delta);
            context.push(child, modification.index);
          }
        }
        if (!context.children) {
          context.setResult(context.left).exit();
          return;
        }
        context.exit();
      };
      patchFilter$1.filterName = "arrays";
      const collectChildrenPatchFilter = function collectChildrenPatchFilter2(context) {
        if (!context || !context.children) {
          return;
        }
        if (context.delta._t !== "a") {
          return;
        }
        const length = context.children.length;
        let child;
        for (let index2 = 0; index2 < length; index2++) {
          child = context.children[index2];
          context.left[child.childName] = child.result;
        }
        context.setResult(context.left).exit();
      };
      collectChildrenPatchFilter.filterName = "arraysCollectChildren";
      const reverseFilter$1 = function arraysReverseFilter(context) {
        if (!context.nested) {
          if (context.delta[2] === ARRAY_MOVE) {
            context.newName = `_${context.delta[1]}`;
            context.setResult([context.delta[0], parseInt(context.childName.substr(1), 10), ARRAY_MOVE]).exit();
          }
          return;
        }
        if (context.delta._t !== "a") {
          return;
        }
        let name;
        let child;
        for (name in context.delta) {
          if (name === "_t") {
            continue;
          }
          child = new ReverseContext(context.delta[name]);
          context.push(child, name);
        }
        context.exit();
      };
      reverseFilter$1.filterName = "arrays";
      const reverseArrayDeltaIndex = (delta, index2, itemDelta) => {
        if (typeof index2 === "string" && index2[0] === "_") {
          return parseInt(index2.substr(1), 10);
        } else if (isArray$1(itemDelta) && itemDelta[2] === 0) {
          return `_${index2}`;
        }
        let reverseIndex = +index2;
        for (const deltaIndex in delta) {
          const deltaItem = delta[deltaIndex];
          if (isArray$1(deltaItem)) {
            if (deltaItem[2] === ARRAY_MOVE) {
              const moveFromIndex = parseInt(deltaIndex.substr(1), 10);
              const moveToIndex = deltaItem[1];
              if (moveToIndex === +index2) {
                return moveFromIndex;
              }
              if (moveFromIndex <= reverseIndex && moveToIndex > reverseIndex) {
                reverseIndex++;
              } else if (moveFromIndex >= reverseIndex && moveToIndex < reverseIndex) {
                reverseIndex--;
              }
            } else if (deltaItem[2] === 0) {
              const deleteIndex = parseInt(deltaIndex.substr(1), 10);
              if (deleteIndex <= reverseIndex) {
                reverseIndex++;
              }
            } else if (deltaItem.length === 1 && deltaIndex <= reverseIndex) {
              reverseIndex--;
            }
          }
        }
        return reverseIndex;
      };
      function collectChildrenReverseFilter(context) {
        if (!context || !context.children) {
          return;
        }
        if (context.delta._t !== "a") {
          return;
        }
        const length = context.children.length;
        let child;
        const delta = {
          _t: "a"
        };
        for (let index2 = 0; index2 < length; index2++) {
          child = context.children[index2];
          let name = child.newName;
          if (typeof name === "undefined") {
            name = reverseArrayDeltaIndex(context.delta, child.childName, child.result);
          }
          if (delta[name] !== child.result) {
            delta[name] = child.result;
          }
        }
        context.setResult(delta).exit();
      }
      collectChildrenReverseFilter.filterName = "arraysCollectChildren";
      const diffFilter$1 = function datesDiffFilter(context) {
        if (context.left instanceof Date) {
          if (context.right instanceof Date) {
            if (context.left.getTime() !== context.right.getTime()) {
              context.setResult([context.left, context.right]);
            } else {
              context.setResult(void 0);
            }
          } else {
            context.setResult([context.left, context.right]);
          }
          context.exit();
        } else if (context.right instanceof Date) {
          context.setResult([context.left, context.right]).exit();
        }
      };
      diffFilter$1.filterName = "dates";
      function getDefaultExportFromCjs(x2) {
        return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
      }
      var diffMatchPatch = { exports: {} };
      (function(module3) {
        var diff_match_patch2 = function() {
          this.Diff_Timeout = 1;
          this.Diff_EditCost = 4;
          this.Match_Threshold = 0.5;
          this.Match_Distance = 1e3;
          this.Patch_DeleteThreshold = 0.5;
          this.Patch_Margin = 4;
          this.Match_MaxBits = 32;
        };
        var DIFF_DELETE = -1;
        var DIFF_INSERT = 1;
        var DIFF_EQUAL = 0;
        diff_match_patch2.Diff = function(op, text) {
          return [op, text];
        };
        diff_match_patch2.prototype.diff_main = function(text1, text2, opt_checklines, opt_deadline) {
          if (typeof opt_deadline == "undefined") {
            if (this.Diff_Timeout <= 0) {
              opt_deadline = Number.MAX_VALUE;
            } else {
              opt_deadline = (/* @__PURE__ */ new Date()).getTime() + this.Diff_Timeout * 1e3;
            }
          }
          var deadline = opt_deadline;
          if (text1 == null || text2 == null) {
            throw new Error("Null input. (diff_main)");
          }
          if (text1 == text2) {
            if (text1) {
              return [new diff_match_patch2.Diff(DIFF_EQUAL, text1)];
            }
            return [];
          }
          if (typeof opt_checklines == "undefined") {
            opt_checklines = true;
          }
          var checklines = opt_checklines;
          var commonlength = this.diff_commonPrefix(text1, text2);
          var commonprefix = text1.substring(0, commonlength);
          text1 = text1.substring(commonlength);
          text2 = text2.substring(commonlength);
          commonlength = this.diff_commonSuffix(text1, text2);
          var commonsuffix = text1.substring(text1.length - commonlength);
          text1 = text1.substring(0, text1.length - commonlength);
          text2 = text2.substring(0, text2.length - commonlength);
          var diffs = this.diff_compute_(text1, text2, checklines, deadline);
          if (commonprefix) {
            diffs.unshift(new diff_match_patch2.Diff(DIFF_EQUAL, commonprefix));
          }
          if (commonsuffix) {
            diffs.push(new diff_match_patch2.Diff(DIFF_EQUAL, commonsuffix));
          }
          this.diff_cleanupMerge(diffs);
          return diffs;
        };
        diff_match_patch2.prototype.diff_compute_ = function(text1, text2, checklines, deadline) {
          var diffs;
          if (!text1) {
            return [new diff_match_patch2.Diff(DIFF_INSERT, text2)];
          }
          if (!text2) {
            return [new diff_match_patch2.Diff(DIFF_DELETE, text1)];
          }
          var longtext = text1.length > text2.length ? text1 : text2;
          var shorttext = text1.length > text2.length ? text2 : text1;
          var i2 = longtext.indexOf(shorttext);
          if (i2 != -1) {
            diffs = [
              new diff_match_patch2.Diff(DIFF_INSERT, longtext.substring(0, i2)),
              new diff_match_patch2.Diff(DIFF_EQUAL, shorttext),
              new diff_match_patch2.Diff(
                DIFF_INSERT,
                longtext.substring(i2 + shorttext.length)
              )
            ];
            if (text1.length > text2.length) {
              diffs[0][0] = diffs[2][0] = DIFF_DELETE;
            }
            return diffs;
          }
          if (shorttext.length == 1) {
            return [
              new diff_match_patch2.Diff(DIFF_DELETE, text1),
              new diff_match_patch2.Diff(DIFF_INSERT, text2)
            ];
          }
          var hm = this.diff_halfMatch_(text1, text2);
          if (hm) {
            var text1_a = hm[0];
            var text1_b = hm[1];
            var text2_a = hm[2];
            var text2_b = hm[3];
            var mid_common = hm[4];
            var diffs_a = this.diff_main(text1_a, text2_a, checklines, deadline);
            var diffs_b = this.diff_main(text1_b, text2_b, checklines, deadline);
            return diffs_a.concat(
              [new diff_match_patch2.Diff(DIFF_EQUAL, mid_common)],
              diffs_b
            );
          }
          if (checklines && text1.length > 100 && text2.length > 100) {
            return this.diff_lineMode_(text1, text2, deadline);
          }
          return this.diff_bisect_(text1, text2, deadline);
        };
        diff_match_patch2.prototype.diff_lineMode_ = function(text1, text2, deadline) {
          var a2 = this.diff_linesToChars_(text1, text2);
          text1 = a2.chars1;
          text2 = a2.chars2;
          var linearray = a2.lineArray;
          var diffs = this.diff_main(text1, text2, false, deadline);
          this.diff_charsToLines_(diffs, linearray);
          this.diff_cleanupSemantic(diffs);
          diffs.push(new diff_match_patch2.Diff(DIFF_EQUAL, ""));
          var pointer = 0;
          var count_delete = 0;
          var count_insert = 0;
          var text_delete = "";
          var text_insert = "";
          while (pointer < diffs.length) {
            switch (diffs[pointer][0]) {
              case DIFF_INSERT:
                count_insert++;
                text_insert += diffs[pointer][1];
                break;
              case DIFF_DELETE:
                count_delete++;
                text_delete += diffs[pointer][1];
                break;
              case DIFF_EQUAL:
                if (count_delete >= 1 && count_insert >= 1) {
                  diffs.splice(
                    pointer - count_delete - count_insert,
                    count_delete + count_insert
                  );
                  pointer = pointer - count_delete - count_insert;
                  var subDiff = this.diff_main(text_delete, text_insert, false, deadline);
                  for (var j2 = subDiff.length - 1; j2 >= 0; j2--) {
                    diffs.splice(pointer, 0, subDiff[j2]);
                  }
                  pointer = pointer + subDiff.length;
                }
                count_insert = 0;
                count_delete = 0;
                text_delete = "";
                text_insert = "";
                break;
            }
            pointer++;
          }
          diffs.pop();
          return diffs;
        };
        diff_match_patch2.prototype.diff_bisect_ = function(text1, text2, deadline) {
          var text1_length = text1.length;
          var text2_length = text2.length;
          var max_d = Math.ceil((text1_length + text2_length) / 2);
          var v_offset = max_d;
          var v_length = 2 * max_d;
          var v1 = new Array(v_length);
          var v2 = new Array(v_length);
          for (var x2 = 0; x2 < v_length; x2++) {
            v1[x2] = -1;
            v2[x2] = -1;
          }
          v1[v_offset + 1] = 0;
          v2[v_offset + 1] = 0;
          var delta = text1_length - text2_length;
          var front = delta % 2 != 0;
          var k1start = 0;
          var k1end = 0;
          var k2start = 0;
          var k2end = 0;
          for (var d2 = 0; d2 < max_d; d2++) {
            if ((/* @__PURE__ */ new Date()).getTime() > deadline) {
              break;
            }
            for (var k1 = -d2 + k1start; k1 <= d2 - k1end; k1 += 2) {
              var k1_offset = v_offset + k1;
              var x1;
              if (k1 == -d2 || k1 != d2 && v1[k1_offset - 1] < v1[k1_offset + 1]) {
                x1 = v1[k1_offset + 1];
              } else {
                x1 = v1[k1_offset - 1] + 1;
              }
              var y1 = x1 - k1;
              while (x1 < text1_length && y1 < text2_length && text1.charAt(x1) == text2.charAt(y1)) {
                x1++;
                y1++;
              }
              v1[k1_offset] = x1;
              if (x1 > text1_length) {
                k1end += 2;
              } else if (y1 > text2_length) {
                k1start += 2;
              } else if (front) {
                var k2_offset = v_offset + delta - k1;
                if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] != -1) {
                  var x22 = text1_length - v2[k2_offset];
                  if (x1 >= x22) {
                    return this.diff_bisectSplit_(text1, text2, x1, y1, deadline);
                  }
                }
              }
            }
            for (var k2 = -d2 + k2start; k2 <= d2 - k2end; k2 += 2) {
              var k2_offset = v_offset + k2;
              var x22;
              if (k2 == -d2 || k2 != d2 && v2[k2_offset - 1] < v2[k2_offset + 1]) {
                x22 = v2[k2_offset + 1];
              } else {
                x22 = v2[k2_offset - 1] + 1;
              }
              var y2 = x22 - k2;
              while (x22 < text1_length && y2 < text2_length && text1.charAt(text1_length - x22 - 1) == text2.charAt(text2_length - y2 - 1)) {
                x22++;
                y2++;
              }
              v2[k2_offset] = x22;
              if (x22 > text1_length) {
                k2end += 2;
              } else if (y2 > text2_length) {
                k2start += 2;
              } else if (!front) {
                var k1_offset = v_offset + delta - k2;
                if (k1_offset >= 0 && k1_offset < v_length && v1[k1_offset] != -1) {
                  var x1 = v1[k1_offset];
                  var y1 = v_offset + x1 - k1_offset;
                  x22 = text1_length - x22;
                  if (x1 >= x22) {
                    return this.diff_bisectSplit_(text1, text2, x1, y1, deadline);
                  }
                }
              }
            }
          }
          return [
            new diff_match_patch2.Diff(DIFF_DELETE, text1),
            new diff_match_patch2.Diff(DIFF_INSERT, text2)
          ];
        };
        diff_match_patch2.prototype.diff_bisectSplit_ = function(text1, text2, x2, y2, deadline) {
          var text1a = text1.substring(0, x2);
          var text2a = text2.substring(0, y2);
          var text1b = text1.substring(x2);
          var text2b = text2.substring(y2);
          var diffs = this.diff_main(text1a, text2a, false, deadline);
          var diffsb = this.diff_main(text1b, text2b, false, deadline);
          return diffs.concat(diffsb);
        };
        diff_match_patch2.prototype.diff_linesToChars_ = function(text1, text2) {
          var lineArray = [];
          var lineHash = {};
          lineArray[0] = "";
          function diff_linesToCharsMunge_(text) {
            var chars = "";
            var lineStart = 0;
            var lineEnd = -1;
            var lineArrayLength = lineArray.length;
            while (lineEnd < text.length - 1) {
              lineEnd = text.indexOf("\n", lineStart);
              if (lineEnd == -1) {
                lineEnd = text.length - 1;
              }
              var line = text.substring(lineStart, lineEnd + 1);
              if (lineHash.hasOwnProperty ? lineHash.hasOwnProperty(line) : lineHash[line] !== void 0) {
                chars += String.fromCharCode(lineHash[line]);
              } else {
                if (lineArrayLength == maxLines) {
                  line = text.substring(lineStart);
                  lineEnd = text.length;
                }
                chars += String.fromCharCode(lineArrayLength);
                lineHash[line] = lineArrayLength;
                lineArray[lineArrayLength++] = line;
              }
              lineStart = lineEnd + 1;
            }
            return chars;
          }
          var maxLines = 4e4;
          var chars1 = diff_linesToCharsMunge_(text1);
          maxLines = 65535;
          var chars2 = diff_linesToCharsMunge_(text2);
          return { chars1, chars2, lineArray };
        };
        diff_match_patch2.prototype.diff_charsToLines_ = function(diffs, lineArray) {
          for (var i2 = 0; i2 < diffs.length; i2++) {
            var chars = diffs[i2][1];
            var text = [];
            for (var j2 = 0; j2 < chars.length; j2++) {
              text[j2] = lineArray[chars.charCodeAt(j2)];
            }
            diffs[i2][1] = text.join("");
          }
        };
        diff_match_patch2.prototype.diff_commonPrefix = function(text1, text2) {
          if (!text1 || !text2 || text1.charAt(0) != text2.charAt(0)) {
            return 0;
          }
          var pointermin = 0;
          var pointermax = Math.min(text1.length, text2.length);
          var pointermid = pointermax;
          var pointerstart = 0;
          while (pointermin < pointermid) {
            if (text1.substring(pointerstart, pointermid) == text2.substring(pointerstart, pointermid)) {
              pointermin = pointermid;
              pointerstart = pointermin;
            } else {
              pointermax = pointermid;
            }
            pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
          }
          return pointermid;
        };
        diff_match_patch2.prototype.diff_commonSuffix = function(text1, text2) {
          if (!text1 || !text2 || text1.charAt(text1.length - 1) != text2.charAt(text2.length - 1)) {
            return 0;
          }
          var pointermin = 0;
          var pointermax = Math.min(text1.length, text2.length);
          var pointermid = pointermax;
          var pointerend = 0;
          while (pointermin < pointermid) {
            if (text1.substring(text1.length - pointermid, text1.length - pointerend) == text2.substring(text2.length - pointermid, text2.length - pointerend)) {
              pointermin = pointermid;
              pointerend = pointermin;
            } else {
              pointermax = pointermid;
            }
            pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
          }
          return pointermid;
        };
        diff_match_patch2.prototype.diff_commonOverlap_ = function(text1, text2) {
          var text1_length = text1.length;
          var text2_length = text2.length;
          if (text1_length == 0 || text2_length == 0) {
            return 0;
          }
          if (text1_length > text2_length) {
            text1 = text1.substring(text1_length - text2_length);
          } else if (text1_length < text2_length) {
            text2 = text2.substring(0, text1_length);
          }
          var text_length = Math.min(text1_length, text2_length);
          if (text1 == text2) {
            return text_length;
          }
          var best = 0;
          var length = 1;
          while (true) {
            var pattern = text1.substring(text_length - length);
            var found = text2.indexOf(pattern);
            if (found == -1) {
              return best;
            }
            length += found;
            if (found == 0 || text1.substring(text_length - length) == text2.substring(0, length)) {
              best = length;
              length++;
            }
          }
        };
        diff_match_patch2.prototype.diff_halfMatch_ = function(text1, text2) {
          if (this.Diff_Timeout <= 0) {
            return null;
          }
          var longtext = text1.length > text2.length ? text1 : text2;
          var shorttext = text1.length > text2.length ? text2 : text1;
          if (longtext.length < 4 || shorttext.length * 2 < longtext.length) {
            return null;
          }
          var dmp2 = this;
          function diff_halfMatchI_(longtext2, shorttext2, i2) {
            var seed = longtext2.substring(i2, i2 + Math.floor(longtext2.length / 4));
            var j2 = -1;
            var best_common = "";
            var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b;
            while ((j2 = shorttext2.indexOf(seed, j2 + 1)) != -1) {
              var prefixLength = dmp2.diff_commonPrefix(
                longtext2.substring(i2),
                shorttext2.substring(j2)
              );
              var suffixLength = dmp2.diff_commonSuffix(
                longtext2.substring(0, i2),
                shorttext2.substring(0, j2)
              );
              if (best_common.length < suffixLength + prefixLength) {
                best_common = shorttext2.substring(j2 - suffixLength, j2) + shorttext2.substring(j2, j2 + prefixLength);
                best_longtext_a = longtext2.substring(0, i2 - suffixLength);
                best_longtext_b = longtext2.substring(i2 + prefixLength);
                best_shorttext_a = shorttext2.substring(0, j2 - suffixLength);
                best_shorttext_b = shorttext2.substring(j2 + prefixLength);
              }
            }
            if (best_common.length * 2 >= longtext2.length) {
              return [
                best_longtext_a,
                best_longtext_b,
                best_shorttext_a,
                best_shorttext_b,
                best_common
              ];
            } else {
              return null;
            }
          }
          var hm1 = diff_halfMatchI_(
            longtext,
            shorttext,
            Math.ceil(longtext.length / 4)
          );
          var hm2 = diff_halfMatchI_(
            longtext,
            shorttext,
            Math.ceil(longtext.length / 2)
          );
          var hm;
          if (!hm1 && !hm2) {
            return null;
          } else if (!hm2) {
            hm = hm1;
          } else if (!hm1) {
            hm = hm2;
          } else {
            hm = hm1[4].length > hm2[4].length ? hm1 : hm2;
          }
          var text1_a, text1_b, text2_a, text2_b;
          if (text1.length > text2.length) {
            text1_a = hm[0];
            text1_b = hm[1];
            text2_a = hm[2];
            text2_b = hm[3];
          } else {
            text2_a = hm[0];
            text2_b = hm[1];
            text1_a = hm[2];
            text1_b = hm[3];
          }
          var mid_common = hm[4];
          return [text1_a, text1_b, text2_a, text2_b, mid_common];
        };
        diff_match_patch2.prototype.diff_cleanupSemantic = function(diffs) {
          var changes = false;
          var equalities = [];
          var equalitiesLength = 0;
          var lastEquality = null;
          var pointer = 0;
          var length_insertions1 = 0;
          var length_deletions1 = 0;
          var length_insertions2 = 0;
          var length_deletions2 = 0;
          while (pointer < diffs.length) {
            if (diffs[pointer][0] == DIFF_EQUAL) {
              equalities[equalitiesLength++] = pointer;
              length_insertions1 = length_insertions2;
              length_deletions1 = length_deletions2;
              length_insertions2 = 0;
              length_deletions2 = 0;
              lastEquality = diffs[pointer][1];
            } else {
              if (diffs[pointer][0] == DIFF_INSERT) {
                length_insertions2 += diffs[pointer][1].length;
              } else {
                length_deletions2 += diffs[pointer][1].length;
              }
              if (lastEquality && lastEquality.length <= Math.max(length_insertions1, length_deletions1) && lastEquality.length <= Math.max(
                length_insertions2,
                length_deletions2
              )) {
                diffs.splice(
                  equalities[equalitiesLength - 1],
                  0,
                  new diff_match_patch2.Diff(DIFF_DELETE, lastEquality)
                );
                diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT;
                equalitiesLength--;
                equalitiesLength--;
                pointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1;
                length_insertions1 = 0;
                length_deletions1 = 0;
                length_insertions2 = 0;
                length_deletions2 = 0;
                lastEquality = null;
                changes = true;
              }
            }
            pointer++;
          }
          if (changes) {
            this.diff_cleanupMerge(diffs);
          }
          this.diff_cleanupSemanticLossless(diffs);
          pointer = 1;
          while (pointer < diffs.length) {
            if (diffs[pointer - 1][0] == DIFF_DELETE && diffs[pointer][0] == DIFF_INSERT) {
              var deletion = diffs[pointer - 1][1];
              var insertion = diffs[pointer][1];
              var overlap_length1 = this.diff_commonOverlap_(deletion, insertion);
              var overlap_length2 = this.diff_commonOverlap_(insertion, deletion);
              if (overlap_length1 >= overlap_length2) {
                if (overlap_length1 >= deletion.length / 2 || overlap_length1 >= insertion.length / 2) {
                  diffs.splice(pointer, 0, new diff_match_patch2.Diff(
                    DIFF_EQUAL,
                    insertion.substring(0, overlap_length1)
                  ));
                  diffs[pointer - 1][1] = deletion.substring(0, deletion.length - overlap_length1);
                  diffs[pointer + 1][1] = insertion.substring(overlap_length1);
                  pointer++;
                }
              } else {
                if (overlap_length2 >= deletion.length / 2 || overlap_length2 >= insertion.length / 2) {
                  diffs.splice(pointer, 0, new diff_match_patch2.Diff(
                    DIFF_EQUAL,
                    deletion.substring(0, overlap_length2)
                  ));
                  diffs[pointer - 1][0] = DIFF_INSERT;
                  diffs[pointer - 1][1] = insertion.substring(0, insertion.length - overlap_length2);
                  diffs[pointer + 1][0] = DIFF_DELETE;
                  diffs[pointer + 1][1] = deletion.substring(overlap_length2);
                  pointer++;
                }
              }
              pointer++;
            }
            pointer++;
          }
        };
        diff_match_patch2.prototype.diff_cleanupSemanticLossless = function(diffs) {
          function diff_cleanupSemanticScore_(one, two) {
            if (!one || !two) {
              return 6;
            }
            var char1 = one.charAt(one.length - 1);
            var char2 = two.charAt(0);
            var nonAlphaNumeric1 = char1.match(diff_match_patch2.nonAlphaNumericRegex_);
            var nonAlphaNumeric2 = char2.match(diff_match_patch2.nonAlphaNumericRegex_);
            var whitespace1 = nonAlphaNumeric1 && char1.match(diff_match_patch2.whitespaceRegex_);
            var whitespace2 = nonAlphaNumeric2 && char2.match(diff_match_patch2.whitespaceRegex_);
            var lineBreak1 = whitespace1 && char1.match(diff_match_patch2.linebreakRegex_);
            var lineBreak2 = whitespace2 && char2.match(diff_match_patch2.linebreakRegex_);
            var blankLine1 = lineBreak1 && one.match(diff_match_patch2.blanklineEndRegex_);
            var blankLine2 = lineBreak2 && two.match(diff_match_patch2.blanklineStartRegex_);
            if (blankLine1 || blankLine2) {
              return 5;
            } else if (lineBreak1 || lineBreak2) {
              return 4;
            } else if (nonAlphaNumeric1 && !whitespace1 && whitespace2) {
              return 3;
            } else if (whitespace1 || whitespace2) {
              return 2;
            } else if (nonAlphaNumeric1 || nonAlphaNumeric2) {
              return 1;
            }
            return 0;
          }
          var pointer = 1;
          while (pointer < diffs.length - 1) {
            if (diffs[pointer - 1][0] == DIFF_EQUAL && diffs[pointer + 1][0] == DIFF_EQUAL) {
              var equality1 = diffs[pointer - 1][1];
              var edit = diffs[pointer][1];
              var equality2 = diffs[pointer + 1][1];
              var commonOffset = this.diff_commonSuffix(equality1, edit);
              if (commonOffset) {
                var commonString = edit.substring(edit.length - commonOffset);
                equality1 = equality1.substring(0, equality1.length - commonOffset);
                edit = commonString + edit.substring(0, edit.length - commonOffset);
                equality2 = commonString + equality2;
              }
              var bestEquality1 = equality1;
              var bestEdit = edit;
              var bestEquality2 = equality2;
              var bestScore = diff_cleanupSemanticScore_(equality1, edit) + diff_cleanupSemanticScore_(edit, equality2);
              while (edit.charAt(0) === equality2.charAt(0)) {
                equality1 += edit.charAt(0);
                edit = edit.substring(1) + equality2.charAt(0);
                equality2 = equality2.substring(1);
                var score = diff_cleanupSemanticScore_(equality1, edit) + diff_cleanupSemanticScore_(edit, equality2);
                if (score >= bestScore) {
                  bestScore = score;
                  bestEquality1 = equality1;
                  bestEdit = edit;
                  bestEquality2 = equality2;
                }
              }
              if (diffs[pointer - 1][1] != bestEquality1) {
                if (bestEquality1) {
                  diffs[pointer - 1][1] = bestEquality1;
                } else {
                  diffs.splice(pointer - 1, 1);
                  pointer--;
                }
                diffs[pointer][1] = bestEdit;
                if (bestEquality2) {
                  diffs[pointer + 1][1] = bestEquality2;
                } else {
                  diffs.splice(pointer + 1, 1);
                  pointer--;
                }
              }
            }
            pointer++;
          }
        };
        diff_match_patch2.nonAlphaNumericRegex_ = /[^a-zA-Z0-9]/;
        diff_match_patch2.whitespaceRegex_ = /\s/;
        diff_match_patch2.linebreakRegex_ = /[\r\n]/;
        diff_match_patch2.blanklineEndRegex_ = /\n\r?\n$/;
        diff_match_patch2.blanklineStartRegex_ = /^\r?\n\r?\n/;
        diff_match_patch2.prototype.diff_cleanupEfficiency = function(diffs) {
          var changes = false;
          var equalities = [];
          var equalitiesLength = 0;
          var lastEquality = null;
          var pointer = 0;
          var pre_ins = false;
          var pre_del = false;
          var post_ins = false;
          var post_del = false;
          while (pointer < diffs.length) {
            if (diffs[pointer][0] == DIFF_EQUAL) {
              if (diffs[pointer][1].length < this.Diff_EditCost && (post_ins || post_del)) {
                equalities[equalitiesLength++] = pointer;
                pre_ins = post_ins;
                pre_del = post_del;
                lastEquality = diffs[pointer][1];
              } else {
                equalitiesLength = 0;
                lastEquality = null;
              }
              post_ins = post_del = false;
            } else {
              if (diffs[pointer][0] == DIFF_DELETE) {
                post_del = true;
              } else {
                post_ins = true;
              }
              if (lastEquality && (pre_ins && pre_del && post_ins && post_del || lastEquality.length < this.Diff_EditCost / 2 && pre_ins + pre_del + post_ins + post_del == 3)) {
                diffs.splice(
                  equalities[equalitiesLength - 1],
                  0,
                  new diff_match_patch2.Diff(DIFF_DELETE, lastEquality)
                );
                diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT;
                equalitiesLength--;
                lastEquality = null;
                if (pre_ins && pre_del) {
                  post_ins = post_del = true;
                  equalitiesLength = 0;
                } else {
                  equalitiesLength--;
                  pointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1;
                  post_ins = post_del = false;
                }
                changes = true;
              }
            }
            pointer++;
          }
          if (changes) {
            this.diff_cleanupMerge(diffs);
          }
        };
        diff_match_patch2.prototype.diff_cleanupMerge = function(diffs) {
          diffs.push(new diff_match_patch2.Diff(DIFF_EQUAL, ""));
          var pointer = 0;
          var count_delete = 0;
          var count_insert = 0;
          var text_delete = "";
          var text_insert = "";
          var commonlength;
          while (pointer < diffs.length) {
            switch (diffs[pointer][0]) {
              case DIFF_INSERT:
                count_insert++;
                text_insert += diffs[pointer][1];
                pointer++;
                break;
              case DIFF_DELETE:
                count_delete++;
                text_delete += diffs[pointer][1];
                pointer++;
                break;
              case DIFF_EQUAL:
                if (count_delete + count_insert > 1) {
                  if (count_delete !== 0 && count_insert !== 0) {
                    commonlength = this.diff_commonPrefix(text_insert, text_delete);
                    if (commonlength !== 0) {
                      if (pointer - count_delete - count_insert > 0 && diffs[pointer - count_delete - count_insert - 1][0] == DIFF_EQUAL) {
                        diffs[pointer - count_delete - count_insert - 1][1] += text_insert.substring(0, commonlength);
                      } else {
                        diffs.splice(0, 0, new diff_match_patch2.Diff(
                          DIFF_EQUAL,
                          text_insert.substring(0, commonlength)
                        ));
                        pointer++;
                      }
                      text_insert = text_insert.substring(commonlength);
                      text_delete = text_delete.substring(commonlength);
                    }
                    commonlength = this.diff_commonSuffix(text_insert, text_delete);
                    if (commonlength !== 0) {
                      diffs[pointer][1] = text_insert.substring(text_insert.length - commonlength) + diffs[pointer][1];
                      text_insert = text_insert.substring(0, text_insert.length - commonlength);
                      text_delete = text_delete.substring(0, text_delete.length - commonlength);
                    }
                  }
                  pointer -= count_delete + count_insert;
                  diffs.splice(pointer, count_delete + count_insert);
                  if (text_delete.length) {
                    diffs.splice(
                      pointer,
                      0,
                      new diff_match_patch2.Diff(DIFF_DELETE, text_delete)
                    );
                    pointer++;
                  }
                  if (text_insert.length) {
                    diffs.splice(
                      pointer,
                      0,
                      new diff_match_patch2.Diff(DIFF_INSERT, text_insert)
                    );
                    pointer++;
                  }
                  pointer++;
                } else if (pointer !== 0 && diffs[pointer - 1][0] == DIFF_EQUAL) {
                  diffs[pointer - 1][1] += diffs[pointer][1];
                  diffs.splice(pointer, 1);
                } else {
                  pointer++;
                }
                count_insert = 0;
                count_delete = 0;
                text_delete = "";
                text_insert = "";
                break;
            }
          }
          if (diffs[diffs.length - 1][1] === "") {
            diffs.pop();
          }
          var changes = false;
          pointer = 1;
          while (pointer < diffs.length - 1) {
            if (diffs[pointer - 1][0] == DIFF_EQUAL && diffs[pointer + 1][0] == DIFF_EQUAL) {
              if (diffs[pointer][1].substring(diffs[pointer][1].length - diffs[pointer - 1][1].length) == diffs[pointer - 1][1]) {
                diffs[pointer][1] = diffs[pointer - 1][1] + diffs[pointer][1].substring(0, diffs[pointer][1].length - diffs[pointer - 1][1].length);
                diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];
                diffs.splice(pointer - 1, 1);
                changes = true;
              } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) == diffs[pointer + 1][1]) {
                diffs[pointer - 1][1] += diffs[pointer + 1][1];
                diffs[pointer][1] = diffs[pointer][1].substring(diffs[pointer + 1][1].length) + diffs[pointer + 1][1];
                diffs.splice(pointer + 1, 1);
                changes = true;
              }
            }
            pointer++;
          }
          if (changes) {
            this.diff_cleanupMerge(diffs);
          }
        };
        diff_match_patch2.prototype.diff_xIndex = function(diffs, loc) {
          var chars1 = 0;
          var chars2 = 0;
          var last_chars1 = 0;
          var last_chars2 = 0;
          var x2;
          for (x2 = 0; x2 < diffs.length; x2++) {
            if (diffs[x2][0] !== DIFF_INSERT) {
              chars1 += diffs[x2][1].length;
            }
            if (diffs[x2][0] !== DIFF_DELETE) {
              chars2 += diffs[x2][1].length;
            }
            if (chars1 > loc) {
              break;
            }
            last_chars1 = chars1;
            last_chars2 = chars2;
          }
          if (diffs.length != x2 && diffs[x2][0] === DIFF_DELETE) {
            return last_chars2;
          }
          return last_chars2 + (loc - last_chars1);
        };
        diff_match_patch2.prototype.diff_prettyHtml = function(diffs) {
          var html2 = [];
          var pattern_amp = /&/g;
          var pattern_lt = /</g;
          var pattern_gt = />/g;
          var pattern_para = /\n/g;
          for (var x2 = 0; x2 < diffs.length; x2++) {
            var op = diffs[x2][0];
            var data = diffs[x2][1];
            var text = data.replace(pattern_amp, "&amp;").replace(pattern_lt, "&lt;").replace(pattern_gt, "&gt;").replace(pattern_para, "&para;<br>");
            switch (op) {
              case DIFF_INSERT:
                html2[x2] = '<ins style="background:#e6ffe6;">' + text + "</ins>";
                break;
              case DIFF_DELETE:
                html2[x2] = '<del style="background:#ffe6e6;">' + text + "</del>";
                break;
              case DIFF_EQUAL:
                html2[x2] = "<span>" + text + "</span>";
                break;
            }
          }
          return html2.join("");
        };
        diff_match_patch2.prototype.diff_text1 = function(diffs) {
          var text = [];
          for (var x2 = 0; x2 < diffs.length; x2++) {
            if (diffs[x2][0] !== DIFF_INSERT) {
              text[x2] = diffs[x2][1];
            }
          }
          return text.join("");
        };
        diff_match_patch2.prototype.diff_text2 = function(diffs) {
          var text = [];
          for (var x2 = 0; x2 < diffs.length; x2++) {
            if (diffs[x2][0] !== DIFF_DELETE) {
              text[x2] = diffs[x2][1];
            }
          }
          return text.join("");
        };
        diff_match_patch2.prototype.diff_levenshtein = function(diffs) {
          var levenshtein = 0;
          var insertions = 0;
          var deletions = 0;
          for (var x2 = 0; x2 < diffs.length; x2++) {
            var op = diffs[x2][0];
            var data = diffs[x2][1];
            switch (op) {
              case DIFF_INSERT:
                insertions += data.length;
                break;
              case DIFF_DELETE:
                deletions += data.length;
                break;
              case DIFF_EQUAL:
                levenshtein += Math.max(insertions, deletions);
                insertions = 0;
                deletions = 0;
                break;
            }
          }
          levenshtein += Math.max(insertions, deletions);
          return levenshtein;
        };
        diff_match_patch2.prototype.diff_toDelta = function(diffs) {
          var text = [];
          for (var x2 = 0; x2 < diffs.length; x2++) {
            switch (diffs[x2][0]) {
              case DIFF_INSERT:
                text[x2] = "+" + encodeURI(diffs[x2][1]);
                break;
              case DIFF_DELETE:
                text[x2] = "-" + diffs[x2][1].length;
                break;
              case DIFF_EQUAL:
                text[x2] = "=" + diffs[x2][1].length;
                break;
            }
          }
          return text.join("	").replace(/%20/g, " ");
        };
        diff_match_patch2.prototype.diff_fromDelta = function(text1, delta) {
          var diffs = [];
          var diffsLength = 0;
          var pointer = 0;
          var tokens = delta.split(/\t/g);
          for (var x2 = 0; x2 < tokens.length; x2++) {
            var param = tokens[x2].substring(1);
            switch (tokens[x2].charAt(0)) {
              case "+":
                try {
                  diffs[diffsLength++] = new diff_match_patch2.Diff(DIFF_INSERT, decodeURI(param));
                } catch (ex) {
                  throw new Error("Illegal escape in diff_fromDelta: " + param);
                }
                break;
              case "-":
              case "=":
                var n2 = parseInt(param, 10);
                if (isNaN(n2) || n2 < 0) {
                  throw new Error("Invalid number in diff_fromDelta: " + param);
                }
                var text = text1.substring(pointer, pointer += n2);
                if (tokens[x2].charAt(0) == "=") {
                  diffs[diffsLength++] = new diff_match_patch2.Diff(DIFF_EQUAL, text);
                } else {
                  diffs[diffsLength++] = new diff_match_patch2.Diff(DIFF_DELETE, text);
                }
                break;
              default:
                if (tokens[x2]) {
                  throw new Error("Invalid diff operation in diff_fromDelta: " + tokens[x2]);
                }
            }
          }
          if (pointer != text1.length) {
            throw new Error("Delta length (" + pointer + ") does not equal source text length (" + text1.length + ").");
          }
          return diffs;
        };
        diff_match_patch2.prototype.match_main = function(text, pattern, loc) {
          if (text == null || pattern == null || loc == null) {
            throw new Error("Null input. (match_main)");
          }
          loc = Math.max(0, Math.min(loc, text.length));
          if (text == pattern) {
            return 0;
          } else if (!text.length) {
            return -1;
          } else if (text.substring(loc, loc + pattern.length) == pattern) {
            return loc;
          } else {
            return this.match_bitap_(text, pattern, loc);
          }
        };
        diff_match_patch2.prototype.match_bitap_ = function(text, pattern, loc) {
          if (pattern.length > this.Match_MaxBits) {
            throw new Error("Pattern too long for this browser.");
          }
          var s2 = this.match_alphabet_(pattern);
          var dmp2 = this;
          function match_bitapScore_(e, x2) {
            var accuracy = e / pattern.length;
            var proximity = Math.abs(loc - x2);
            if (!dmp2.Match_Distance) {
              return proximity ? 1 : accuracy;
            }
            return accuracy + proximity / dmp2.Match_Distance;
          }
          var score_threshold = this.Match_Threshold;
          var best_loc = text.indexOf(pattern, loc);
          if (best_loc != -1) {
            score_threshold = Math.min(match_bitapScore_(0, best_loc), score_threshold);
            best_loc = text.lastIndexOf(pattern, loc + pattern.length);
            if (best_loc != -1) {
              score_threshold = Math.min(match_bitapScore_(0, best_loc), score_threshold);
            }
          }
          var matchmask = 1 << pattern.length - 1;
          best_loc = -1;
          var bin_min, bin_mid;
          var bin_max = pattern.length + text.length;
          var last_rd;
          for (var d2 = 0; d2 < pattern.length; d2++) {
            bin_min = 0;
            bin_mid = bin_max;
            while (bin_min < bin_mid) {
              if (match_bitapScore_(d2, loc + bin_mid) <= score_threshold) {
                bin_min = bin_mid;
              } else {
                bin_max = bin_mid;
              }
              bin_mid = Math.floor((bin_max - bin_min) / 2 + bin_min);
            }
            bin_max = bin_mid;
            var start = Math.max(1, loc - bin_mid + 1);
            var finish = Math.min(loc + bin_mid, text.length) + pattern.length;
            var rd = Array(finish + 2);
            rd[finish + 1] = (1 << d2) - 1;
            for (var j2 = finish; j2 >= start; j2--) {
              var charMatch = s2[text.charAt(j2 - 1)];
              if (d2 === 0) {
                rd[j2] = (rd[j2 + 1] << 1 | 1) & charMatch;
              } else {
                rd[j2] = (rd[j2 + 1] << 1 | 1) & charMatch | ((last_rd[j2 + 1] | last_rd[j2]) << 1 | 1) | last_rd[j2 + 1];
              }
              if (rd[j2] & matchmask) {
                var score = match_bitapScore_(d2, j2 - 1);
                if (score <= score_threshold) {
                  score_threshold = score;
                  best_loc = j2 - 1;
                  if (best_loc > loc) {
                    start = Math.max(1, 2 * loc - best_loc);
                  } else {
                    break;
                  }
                }
              }
            }
            if (match_bitapScore_(d2 + 1, loc) > score_threshold) {
              break;
            }
            last_rd = rd;
          }
          return best_loc;
        };
        diff_match_patch2.prototype.match_alphabet_ = function(pattern) {
          var s2 = {};
          for (var i2 = 0; i2 < pattern.length; i2++) {
            s2[pattern.charAt(i2)] = 0;
          }
          for (var i2 = 0; i2 < pattern.length; i2++) {
            s2[pattern.charAt(i2)] |= 1 << pattern.length - i2 - 1;
          }
          return s2;
        };
        diff_match_patch2.prototype.patch_addContext_ = function(patch2, text) {
          if (text.length == 0) {
            return;
          }
          if (patch2.start2 === null) {
            throw Error("patch not initialized");
          }
          var pattern = text.substring(patch2.start2, patch2.start2 + patch2.length1);
          var padding = 0;
          while (text.indexOf(pattern) != text.lastIndexOf(pattern) && pattern.length < this.Match_MaxBits - this.Patch_Margin - this.Patch_Margin) {
            padding += this.Patch_Margin;
            pattern = text.substring(
              patch2.start2 - padding,
              patch2.start2 + patch2.length1 + padding
            );
          }
          padding += this.Patch_Margin;
          var prefix2 = text.substring(patch2.start2 - padding, patch2.start2);
          if (prefix2) {
            patch2.diffs.unshift(new diff_match_patch2.Diff(DIFF_EQUAL, prefix2));
          }
          var suffix = text.substring(
            patch2.start2 + patch2.length1,
            patch2.start2 + patch2.length1 + padding
          );
          if (suffix) {
            patch2.diffs.push(new diff_match_patch2.Diff(DIFF_EQUAL, suffix));
          }
          patch2.start1 -= prefix2.length;
          patch2.start2 -= prefix2.length;
          patch2.length1 += prefix2.length + suffix.length;
          patch2.length2 += prefix2.length + suffix.length;
        };
        diff_match_patch2.prototype.patch_make = function(a2, opt_b, opt_c) {
          var text1, diffs;
          if (typeof a2 == "string" && typeof opt_b == "string" && typeof opt_c == "undefined") {
            text1 = /** @type {string} */
            a2;
            diffs = this.diff_main(
              text1,
              /** @type {string} */
              opt_b,
              true
            );
            if (diffs.length > 2) {
              this.diff_cleanupSemantic(diffs);
              this.diff_cleanupEfficiency(diffs);
            }
          } else if (a2 && typeof a2 == "object" && typeof opt_b == "undefined" && typeof opt_c == "undefined") {
            diffs = /** @type {!Array.<!diff_match_patch.Diff>} */
            a2;
            text1 = this.diff_text1(diffs);
          } else if (typeof a2 == "string" && opt_b && typeof opt_b == "object" && typeof opt_c == "undefined") {
            text1 = /** @type {string} */
            a2;
            diffs = /** @type {!Array.<!diff_match_patch.Diff>} */
            opt_b;
          } else if (typeof a2 == "string" && typeof opt_b == "string" && opt_c && typeof opt_c == "object") {
            text1 = /** @type {string} */
            a2;
            diffs = /** @type {!Array.<!diff_match_patch.Diff>} */
            opt_c;
          } else {
            throw new Error("Unknown call format to patch_make.");
          }
          if (diffs.length === 0) {
            return [];
          }
          var patches = [];
          var patch2 = new diff_match_patch2.patch_obj();
          var patchDiffLength = 0;
          var char_count1 = 0;
          var char_count2 = 0;
          var prepatch_text = text1;
          var postpatch_text = text1;
          for (var x2 = 0; x2 < diffs.length; x2++) {
            var diff_type = diffs[x2][0];
            var diff_text = diffs[x2][1];
            if (!patchDiffLength && diff_type !== DIFF_EQUAL) {
              patch2.start1 = char_count1;
              patch2.start2 = char_count2;
            }
            switch (diff_type) {
              case DIFF_INSERT:
                patch2.diffs[patchDiffLength++] = diffs[x2];
                patch2.length2 += diff_text.length;
                postpatch_text = postpatch_text.substring(0, char_count2) + diff_text + postpatch_text.substring(char_count2);
                break;
              case DIFF_DELETE:
                patch2.length1 += diff_text.length;
                patch2.diffs[patchDiffLength++] = diffs[x2];
                postpatch_text = postpatch_text.substring(0, char_count2) + postpatch_text.substring(char_count2 + diff_text.length);
                break;
              case DIFF_EQUAL:
                if (diff_text.length <= 2 * this.Patch_Margin && patchDiffLength && diffs.length != x2 + 1) {
                  patch2.diffs[patchDiffLength++] = diffs[x2];
                  patch2.length1 += diff_text.length;
                  patch2.length2 += diff_text.length;
                } else if (diff_text.length >= 2 * this.Patch_Margin) {
                  if (patchDiffLength) {
                    this.patch_addContext_(patch2, prepatch_text);
                    patches.push(patch2);
                    patch2 = new diff_match_patch2.patch_obj();
                    patchDiffLength = 0;
                    prepatch_text = postpatch_text;
                    char_count1 = char_count2;
                  }
                }
                break;
            }
            if (diff_type !== DIFF_INSERT) {
              char_count1 += diff_text.length;
            }
            if (diff_type !== DIFF_DELETE) {
              char_count2 += diff_text.length;
            }
          }
          if (patchDiffLength) {
            this.patch_addContext_(patch2, prepatch_text);
            patches.push(patch2);
          }
          return patches;
        };
        diff_match_patch2.prototype.patch_deepCopy = function(patches) {
          var patchesCopy = [];
          for (var x2 = 0; x2 < patches.length; x2++) {
            var patch2 = patches[x2];
            var patchCopy = new diff_match_patch2.patch_obj();
            patchCopy.diffs = [];
            for (var y2 = 0; y2 < patch2.diffs.length; y2++) {
              patchCopy.diffs[y2] = new diff_match_patch2.Diff(patch2.diffs[y2][0], patch2.diffs[y2][1]);
            }
            patchCopy.start1 = patch2.start1;
            patchCopy.start2 = patch2.start2;
            patchCopy.length1 = patch2.length1;
            patchCopy.length2 = patch2.length2;
            patchesCopy[x2] = patchCopy;
          }
          return patchesCopy;
        };
        diff_match_patch2.prototype.patch_apply = function(patches, text) {
          if (patches.length == 0) {
            return [text, []];
          }
          patches = this.patch_deepCopy(patches);
          var nullPadding = this.patch_addPadding(patches);
          text = nullPadding + text + nullPadding;
          this.patch_splitMax(patches);
          var delta = 0;
          var results = [];
          for (var x2 = 0; x2 < patches.length; x2++) {
            var expected_loc = patches[x2].start2 + delta;
            var text1 = this.diff_text1(patches[x2].diffs);
            var start_loc;
            var end_loc = -1;
            if (text1.length > this.Match_MaxBits) {
              start_loc = this.match_main(
                text,
                text1.substring(0, this.Match_MaxBits),
                expected_loc
              );
              if (start_loc != -1) {
                end_loc = this.match_main(
                  text,
                  text1.substring(text1.length - this.Match_MaxBits),
                  expected_loc + text1.length - this.Match_MaxBits
                );
                if (end_loc == -1 || start_loc >= end_loc) {
                  start_loc = -1;
                }
              }
            } else {
              start_loc = this.match_main(text, text1, expected_loc);
            }
            if (start_loc == -1) {
              results[x2] = false;
              delta -= patches[x2].length2 - patches[x2].length1;
            } else {
              results[x2] = true;
              delta = start_loc - expected_loc;
              var text2;
              if (end_loc == -1) {
                text2 = text.substring(start_loc, start_loc + text1.length);
              } else {
                text2 = text.substring(start_loc, end_loc + this.Match_MaxBits);
              }
              if (text1 == text2) {
                text = text.substring(0, start_loc) + this.diff_text2(patches[x2].diffs) + text.substring(start_loc + text1.length);
              } else {
                var diffs = this.diff_main(text1, text2, false);
                if (text1.length > this.Match_MaxBits && this.diff_levenshtein(diffs) / text1.length > this.Patch_DeleteThreshold) {
                  results[x2] = false;
                } else {
                  this.diff_cleanupSemanticLossless(diffs);
                  var index1 = 0;
                  var index2;
                  for (var y2 = 0; y2 < patches[x2].diffs.length; y2++) {
                    var mod = patches[x2].diffs[y2];
                    if (mod[0] !== DIFF_EQUAL) {
                      index2 = this.diff_xIndex(diffs, index1);
                    }
                    if (mod[0] === DIFF_INSERT) {
                      text = text.substring(0, start_loc + index2) + mod[1] + text.substring(start_loc + index2);
                    } else if (mod[0] === DIFF_DELETE) {
                      text = text.substring(0, start_loc + index2) + text.substring(start_loc + this.diff_xIndex(
                        diffs,
                        index1 + mod[1].length
                      ));
                    }
                    if (mod[0] !== DIFF_DELETE) {
                      index1 += mod[1].length;
                    }
                  }
                }
              }
            }
          }
          text = text.substring(nullPadding.length, text.length - nullPadding.length);
          return [text, results];
        };
        diff_match_patch2.prototype.patch_addPadding = function(patches) {
          var paddingLength = this.Patch_Margin;
          var nullPadding = "";
          for (var x2 = 1; x2 <= paddingLength; x2++) {
            nullPadding += String.fromCharCode(x2);
          }
          for (var x2 = 0; x2 < patches.length; x2++) {
            patches[x2].start1 += paddingLength;
            patches[x2].start2 += paddingLength;
          }
          var patch2 = patches[0];
          var diffs = patch2.diffs;
          if (diffs.length == 0 || diffs[0][0] != DIFF_EQUAL) {
            diffs.unshift(new diff_match_patch2.Diff(DIFF_EQUAL, nullPadding));
            patch2.start1 -= paddingLength;
            patch2.start2 -= paddingLength;
            patch2.length1 += paddingLength;
            patch2.length2 += paddingLength;
          } else if (paddingLength > diffs[0][1].length) {
            var extraLength = paddingLength - diffs[0][1].length;
            diffs[0][1] = nullPadding.substring(diffs[0][1].length) + diffs[0][1];
            patch2.start1 -= extraLength;
            patch2.start2 -= extraLength;
            patch2.length1 += extraLength;
            patch2.length2 += extraLength;
          }
          patch2 = patches[patches.length - 1];
          diffs = patch2.diffs;
          if (diffs.length == 0 || diffs[diffs.length - 1][0] != DIFF_EQUAL) {
            diffs.push(new diff_match_patch2.Diff(DIFF_EQUAL, nullPadding));
            patch2.length1 += paddingLength;
            patch2.length2 += paddingLength;
          } else if (paddingLength > diffs[diffs.length - 1][1].length) {
            var extraLength = paddingLength - diffs[diffs.length - 1][1].length;
            diffs[diffs.length - 1][1] += nullPadding.substring(0, extraLength);
            patch2.length1 += extraLength;
            patch2.length2 += extraLength;
          }
          return nullPadding;
        };
        diff_match_patch2.prototype.patch_splitMax = function(patches) {
          var patch_size = this.Match_MaxBits;
          for (var x2 = 0; x2 < patches.length; x2++) {
            if (patches[x2].length1 <= patch_size) {
              continue;
            }
            var bigpatch = patches[x2];
            patches.splice(x2--, 1);
            var start1 = bigpatch.start1;
            var start2 = bigpatch.start2;
            var precontext = "";
            while (bigpatch.diffs.length !== 0) {
              var patch2 = new diff_match_patch2.patch_obj();
              var empty2 = true;
              patch2.start1 = start1 - precontext.length;
              patch2.start2 = start2 - precontext.length;
              if (precontext !== "") {
                patch2.length1 = patch2.length2 = precontext.length;
                patch2.diffs.push(new diff_match_patch2.Diff(DIFF_EQUAL, precontext));
              }
              while (bigpatch.diffs.length !== 0 && patch2.length1 < patch_size - this.Patch_Margin) {
                var diff_type = bigpatch.diffs[0][0];
                var diff_text = bigpatch.diffs[0][1];
                if (diff_type === DIFF_INSERT) {
                  patch2.length2 += diff_text.length;
                  start2 += diff_text.length;
                  patch2.diffs.push(bigpatch.diffs.shift());
                  empty2 = false;
                } else if (diff_type === DIFF_DELETE && patch2.diffs.length == 1 && patch2.diffs[0][0] == DIFF_EQUAL && diff_text.length > 2 * patch_size) {
                  patch2.length1 += diff_text.length;
                  start1 += diff_text.length;
                  empty2 = false;
                  patch2.diffs.push(new diff_match_patch2.Diff(diff_type, diff_text));
                  bigpatch.diffs.shift();
                } else {
                  diff_text = diff_text.substring(
                    0,
                    patch_size - patch2.length1 - this.Patch_Margin
                  );
                  patch2.length1 += diff_text.length;
                  start1 += diff_text.length;
                  if (diff_type === DIFF_EQUAL) {
                    patch2.length2 += diff_text.length;
                    start2 += diff_text.length;
                  } else {
                    empty2 = false;
                  }
                  patch2.diffs.push(new diff_match_patch2.Diff(diff_type, diff_text));
                  if (diff_text == bigpatch.diffs[0][1]) {
                    bigpatch.diffs.shift();
                  } else {
                    bigpatch.diffs[0][1] = bigpatch.diffs[0][1].substring(diff_text.length);
                  }
                }
              }
              precontext = this.diff_text2(patch2.diffs);
              precontext = precontext.substring(precontext.length - this.Patch_Margin);
              var postcontext = this.diff_text1(bigpatch.diffs).substring(0, this.Patch_Margin);
              if (postcontext !== "") {
                patch2.length1 += postcontext.length;
                patch2.length2 += postcontext.length;
                if (patch2.diffs.length !== 0 && patch2.diffs[patch2.diffs.length - 1][0] === DIFF_EQUAL) {
                  patch2.diffs[patch2.diffs.length - 1][1] += postcontext;
                } else {
                  patch2.diffs.push(new diff_match_patch2.Diff(DIFF_EQUAL, postcontext));
                }
              }
              if (!empty2) {
                patches.splice(++x2, 0, patch2);
              }
            }
          }
        };
        diff_match_patch2.prototype.patch_toText = function(patches) {
          var text = [];
          for (var x2 = 0; x2 < patches.length; x2++) {
            text[x2] = patches[x2];
          }
          return text.join("");
        };
        diff_match_patch2.prototype.patch_fromText = function(textline) {
          var patches = [];
          if (!textline) {
            return patches;
          }
          var text = textline.split("\n");
          var textPointer = 0;
          var patchHeader = /^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;
          while (textPointer < text.length) {
            var m2 = text[textPointer].match(patchHeader);
            if (!m2) {
              throw new Error("Invalid patch string: " + text[textPointer]);
            }
            var patch2 = new diff_match_patch2.patch_obj();
            patches.push(patch2);
            patch2.start1 = parseInt(m2[1], 10);
            if (m2[2] === "") {
              patch2.start1--;
              patch2.length1 = 1;
            } else if (m2[2] == "0") {
              patch2.length1 = 0;
            } else {
              patch2.start1--;
              patch2.length1 = parseInt(m2[2], 10);
            }
            patch2.start2 = parseInt(m2[3], 10);
            if (m2[4] === "") {
              patch2.start2--;
              patch2.length2 = 1;
            } else if (m2[4] == "0") {
              patch2.length2 = 0;
            } else {
              patch2.start2--;
              patch2.length2 = parseInt(m2[4], 10);
            }
            textPointer++;
            while (textPointer < text.length) {
              var sign = text[textPointer].charAt(0);
              try {
                var line = decodeURI(text[textPointer].substring(1));
              } catch (ex) {
                throw new Error("Illegal escape in patch_fromText: " + line);
              }
              if (sign == "-") {
                patch2.diffs.push(new diff_match_patch2.Diff(DIFF_DELETE, line));
              } else if (sign == "+") {
                patch2.diffs.push(new diff_match_patch2.Diff(DIFF_INSERT, line));
              } else if (sign == " ") {
                patch2.diffs.push(new diff_match_patch2.Diff(DIFF_EQUAL, line));
              } else if (sign == "@") {
                break;
              } else if (sign === "")
                ;
              else {
                throw new Error('Invalid patch mode "' + sign + '" in: ' + line);
              }
              textPointer++;
            }
          }
          return patches;
        };
        diff_match_patch2.patch_obj = function() {
          this.diffs = [];
          this.start1 = null;
          this.start2 = null;
          this.length1 = 0;
          this.length2 = 0;
        };
        diff_match_patch2.patch_obj.prototype.toString = function() {
          var coords1, coords2;
          if (this.length1 === 0) {
            coords1 = this.start1 + ",0";
          } else if (this.length1 == 1) {
            coords1 = this.start1 + 1;
          } else {
            coords1 = this.start1 + 1 + "," + this.length1;
          }
          if (this.length2 === 0) {
            coords2 = this.start2 + ",0";
          } else if (this.length2 == 1) {
            coords2 = this.start2 + 1;
          } else {
            coords2 = this.start2 + 1 + "," + this.length2;
          }
          var text = ["@@ -" + coords1 + " +" + coords2 + " @@\n"];
          var op;
          for (var x2 = 0; x2 < this.diffs.length; x2++) {
            switch (this.diffs[x2][0]) {
              case DIFF_INSERT:
                op = "+";
                break;
              case DIFF_DELETE:
                op = "-";
                break;
              case DIFF_EQUAL:
                op = " ";
                break;
            }
            text[x2 + 1] = op + encodeURI(this.diffs[x2][1]) + "\n";
          }
          return text.join("").replace(/%20/g, " ");
        };
        module3.exports = diff_match_patch2;
        module3.exports["diff_match_patch"] = diff_match_patch2;
        module3.exports["DIFF_DELETE"] = DIFF_DELETE;
        module3.exports["DIFF_INSERT"] = DIFF_INSERT;
        module3.exports["DIFF_EQUAL"] = DIFF_EQUAL;
      })(diffMatchPatch);
      var diffMatchPatchExports = diffMatchPatch.exports;
      var dmp = /* @__PURE__ */ getDefaultExportFromCjs(diffMatchPatchExports);
      const TEXT_DIFF = 2;
      const DEFAULT_MIN_LENGTH = 60;
      let cachedDiffPatch = null;
      const getDiffMatchPatch = function(required) {
        if (!cachedDiffPatch) {
          let instance;
          if (typeof diff_match_patch !== "undefined") {
            instance = typeof diff_match_patch === "function" ? new diff_match_patch() : new diff_match_patch.diff_match_patch();
          } else if (dmp) {
            try {
              instance = dmp && new dmp();
            } catch (err) {
              instance = null;
            }
          }
          if (!instance) {
            if (!required) {
              return null;
            }
            const error = new Error("text diff_match_patch library not found");
            error.diff_match_patch_not_found = true;
            throw error;
          }
          cachedDiffPatch = {
            diff: function(txt1, txt2) {
              return instance.patch_toText(instance.patch_make(txt1, txt2));
            },
            patch: function(txt1, patch2) {
              const results = instance.patch_apply(instance.patch_fromText(patch2), txt1);
              for (let i2 = 0; i2 < results[1].length; i2++) {
                if (!results[1][i2]) {
                  const error = new Error("text patch failed");
                  error.textPatchFailed = true;
                }
              }
              return results[0];
            }
          };
        }
        return cachedDiffPatch;
      };
      const diffFilter = function textsDiffFilter(context) {
        if (context.leftType !== "string") {
          return;
        }
        const minLength = context.options && context.options.textDiff && context.options.textDiff.minLength || DEFAULT_MIN_LENGTH;
        if (context.left.length < minLength || context.right.length < minLength) {
          context.setResult([context.left, context.right]).exit();
          return;
        }
        const diffMatchPatch2 = getDiffMatchPatch();
        if (!diffMatchPatch2) {
          context.setResult([context.left, context.right]).exit();
          return;
        }
        const diff2 = diffMatchPatch2.diff;
        context.setResult([diff2(context.left, context.right), 0, TEXT_DIFF]).exit();
      };
      diffFilter.filterName = "texts";
      const patchFilter = function textsPatchFilter(context) {
        if (context.nested) {
          return;
        }
        if (context.delta[2] !== TEXT_DIFF) {
          return;
        }
        const patch2 = getDiffMatchPatch(true).patch;
        context.setResult(patch2(context.left, context.delta[0])).exit();
      };
      patchFilter.filterName = "texts";
      const textDeltaReverse = function(delta) {
        let i2;
        let l2;
        let line;
        let lineTmp;
        let header = null;
        const headerRegex = /^@@ +-(\d+),(\d+) +\+(\d+),(\d+) +@@$/;
        let lineHeader;
        const lines = delta.split("\n");
        for (i2 = 0, l2 = lines.length; i2 < l2; i2++) {
          line = lines[i2];
          const lineStart = line.slice(0, 1);
          if (lineStart === "@") {
            header = headerRegex.exec(line);
            lineHeader = i2;
            lines[lineHeader] = "@@ -" + header[3] + "," + header[4] + " +" + header[1] + "," + header[2] + " @@";
          } else if (lineStart === "+") {
            lines[i2] = "-" + lines[i2].slice(1);
            if (lines[i2 - 1].slice(0, 1) === "+") {
              lineTmp = lines[i2];
              lines[i2] = lines[i2 - 1];
              lines[i2 - 1] = lineTmp;
            }
          } else if (lineStart === "-") {
            lines[i2] = "+" + lines[i2].slice(1);
          }
        }
        return lines.join("\n");
      };
      const reverseFilter = function textsReverseFilter(context) {
        if (context.nested) {
          return;
        }
        if (context.delta[2] !== TEXT_DIFF) {
          return;
        }
        context.setResult([textDeltaReverse(context.delta[0]), 0, TEXT_DIFF]).exit();
      };
      reverseFilter.filterName = "texts";
      class DiffPatcher {
        constructor(options) {
          this.processor = new Processor(options);
          this.processor.pipe(new Pipe("diff").append(collectChildrenDiffFilter, diffFilter$3, diffFilter$1, diffFilter, objectsDiffFilter, diffFilter$2).shouldHaveResult());
          this.processor.pipe(new Pipe("patch").append(collectChildrenPatchFilter$1, collectChildrenPatchFilter, patchFilter$3, patchFilter, patchFilter$2, patchFilter$1).shouldHaveResult());
          this.processor.pipe(new Pipe("reverse").append(collectChildrenReverseFilter$1, collectChildrenReverseFilter, reverseFilter$3, reverseFilter, reverseFilter$2, reverseFilter$1).shouldHaveResult());
        }
        options() {
          return this.processor.options(...arguments);
        }
        diff(left, right) {
          return this.processor.process(new DiffContext(left, right));
        }
        patch(left, delta) {
          return this.processor.process(new PatchContext(left, delta));
        }
        reverse(delta) {
          return this.processor.process(new ReverseContext(delta));
        }
        unpatch(right, delta) {
          return this.patch(right, this.reverse(delta));
        }
        clone(value) {
          return clone$1(value);
        }
      }
      const isArray = typeof Array.isArray === "function" ? Array.isArray : (a2) => a2 instanceof Array;
      const getObjectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (obj) => {
        const names = [];
        for (const property in obj) {
          if (Object.prototype.hasOwnProperty.call(obj, property)) {
            names.push(property);
          }
        }
        return names;
      };
      const trimUnderscore = (str) => {
        if (str.substr(0, 1) === "_") {
          return str.slice(1);
        }
        return str;
      };
      const arrayKeyToSortNumber = (key) => {
        if (key === "_t") {
          return -1;
        } else {
          if (key.substr(0, 1) === "_") {
            return parseInt(key.slice(1), 10);
          } else {
            return parseInt(key, 10) + 0.1;
          }
        }
      };
      const arrayKeyComparer = (key1, key2) => arrayKeyToSortNumber(key1) - arrayKeyToSortNumber(key2);
      class BaseFormatter {
        format(delta, left) {
          const context = {};
          this.prepareContext(context);
          this.recurse(context, delta, left);
          return this.finalize(context);
        }
        prepareContext(context) {
          context.buffer = [];
          context.out = function() {
            this.buffer.push(...arguments);
          };
        }
        typeFormattterNotFound(context, deltaType) {
          throw new Error(`cannot format delta type: ${deltaType}`);
        }
        typeFormattterErrorFormatter(context, err) {
          return err.toString();
        }
        finalize(_ref) {
          let {
            buffer
          } = _ref;
          if (isArray(buffer)) {
            return buffer.join("");
          }
        }
        recurse(context, delta, left, key, leftKey, movedFrom, isLast) {
          const useMoveOriginHere = delta && movedFrom;
          const leftValue = useMoveOriginHere ? movedFrom.value : left;
          if (typeof delta === "undefined" && typeof key === "undefined") {
            return void 0;
          }
          const type = this.getDeltaType(delta, movedFrom);
          const nodeType = type === "node" ? delta._t === "a" ? "array" : "object" : "";
          if (typeof key !== "undefined") {
            this.nodeBegin(context, key, leftKey, type, nodeType, isLast);
          } else {
            this.rootBegin(context, type, nodeType);
          }
          let typeFormattter;
          try {
            typeFormattter = this[`format_${type}`] || this.typeFormattterNotFound(context, type);
            typeFormattter.call(this, context, delta, leftValue, key, leftKey, movedFrom);
          } catch (err) {
            this.typeFormattterErrorFormatter(context, err, delta, leftValue, key, leftKey, movedFrom);
            if (typeof console !== "undefined" && console.error) {
              console.error(err.stack);
            }
          }
          if (typeof key !== "undefined") {
            this.nodeEnd(context, key, leftKey, type, nodeType, isLast);
          } else {
            this.rootEnd(context, type, nodeType);
          }
        }
        formatDeltaChildren(context, delta, left) {
          const self2 = this;
          this.forEachDeltaKey(delta, left, (key, leftKey, movedFrom, isLast) => {
            self2.recurse(context, delta[key], left ? left[leftKey] : void 0, key, leftKey, movedFrom, isLast);
          });
        }
        forEachDeltaKey(delta, left, fn2) {
          const keys = getObjectKeys(delta);
          const arrayKeys = delta._t === "a";
          const moveDestinations = {};
          let name;
          if (typeof left !== "undefined") {
            for (name in left) {
              if (Object.prototype.hasOwnProperty.call(left, name)) {
                if (typeof delta[name] === "undefined" && (!arrayKeys || typeof delta[`_${name}`] === "undefined")) {
                  keys.push(name);
                }
              }
            }
          }
          for (name in delta) {
            if (Object.prototype.hasOwnProperty.call(delta, name)) {
              const value = delta[name];
              if (isArray(value) && value[2] === 3) {
                moveDestinations[value[1].toString()] = {
                  key: name,
                  value: left && left[parseInt(name.substr(1))]
                };
                if (this.includeMoveDestinations !== false) {
                  if (typeof left === "undefined" && typeof delta[value[1]] === "undefined") {
                    keys.push(value[1].toString());
                  }
                }
              }
            }
          }
          if (arrayKeys) {
            keys.sort(arrayKeyComparer);
          } else {
            keys.sort();
          }
          for (let index2 = 0, length = keys.length; index2 < length; index2++) {
            const key = keys[index2];
            if (arrayKeys && key === "_t") {
              continue;
            }
            const leftKey = arrayKeys ? typeof key === "number" ? key : parseInt(trimUnderscore(key), 10) : key;
            const isLast = index2 === length - 1;
            fn2(key, leftKey, moveDestinations[leftKey], isLast);
          }
        }
        getDeltaType(delta, movedFrom) {
          if (typeof delta === "undefined") {
            if (typeof movedFrom !== "undefined") {
              return "movedestination";
            }
            return "unchanged";
          }
          if (isArray(delta)) {
            if (delta.length === 1) {
              return "added";
            }
            if (delta.length === 2) {
              return "modified";
            }
            if (delta.length === 3 && delta[2] === 0) {
              return "deleted";
            }
            if (delta.length === 3 && delta[2] === 2) {
              return "textdiff";
            }
            if (delta.length === 3 && delta[2] === 3) {
              return "moved";
            }
          } else if (typeof delta === "object") {
            return "node";
          }
          return "unknown";
        }
        parseTextDiff(value) {
          const output = [];
          const lines = value.split("\n@@ ");
          for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
            const line = lines[i2];
            const lineOutput = {
              pieces: []
            };
            const location = /^(?:@@ )?[-+]?(\d+),(\d+)/.exec(line).slice(1);
            lineOutput.location = {
              line: location[0],
              chr: location[1]
            };
            const pieces = line.split("\n").slice(1);
            for (let pieceIndex = 0, piecesLength = pieces.length; pieceIndex < piecesLength; pieceIndex++) {
              const piece = pieces[pieceIndex];
              if (!piece.length) {
                continue;
              }
              const pieceOutput = {
                type: "context"
              };
              if (piece.substr(0, 1) === "+") {
                pieceOutput.type = "added";
              } else if (piece.substr(0, 1) === "-") {
                pieceOutput.type = "deleted";
              }
              pieceOutput.text = piece.slice(1);
              lineOutput.pieces.push(pieceOutput);
            }
            output.push(lineOutput);
          }
          return output;
        }
      }
      var base = /* @__PURE__ */ Object.freeze({
        __proto__: null,
        default: BaseFormatter
      });
      class HtmlFormatter extends BaseFormatter {
        typeFormattterErrorFormatter(context, err) {
          context.out(`<pre class="jsondiffpatch-error">${err}</pre>`);
        }
        formatValue(context, value) {
          context.out(`<pre>${htmlEscape(JSON.stringify(value, null, 2))}</pre>`);
        }
        formatTextDiffString(context, value) {
          const lines = this.parseTextDiff(value);
          context.out('<ul class="jsondiffpatch-textdiff">');
          for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
            const line = lines[i2];
            context.out(`<li><div class="jsondiffpatch-textdiff-location"><span class="jsondiffpatch-textdiff-line-number">${line.location.line}</span><span class="jsondiffpatch-textdiff-char">${line.location.chr}</span></div><div class="jsondiffpatch-textdiff-line">`);
            const pieces = line.pieces;
            for (let pieceIndex = 0, piecesLength = pieces.length; pieceIndex < piecesLength; pieceIndex++) {
              const piece = pieces[pieceIndex];
              context.out(`<span class="jsondiffpatch-textdiff-${piece.type}">${htmlEscape(decodeURI(piece.text))}</span>`);
            }
            context.out("</div></li>");
          }
          context.out("</ul>");
        }
        rootBegin(context, type, nodeType) {
          const nodeClass = `jsondiffpatch-${type}${nodeType ? ` jsondiffpatch-child-node-type-${nodeType}` : ""}`;
          context.out(`<div class="jsondiffpatch-delta ${nodeClass}">`);
        }
        rootEnd(context) {
          context.out(`</div>${context.hasArrows ? `<script type="text/javascript">setTimeout(${adjustArrows.toString()},10);<\/script>` : ""}`);
        }
        nodeBegin(context, key, leftKey, type, nodeType) {
          const nodeClass = `jsondiffpatch-${type}${nodeType ? ` jsondiffpatch-child-node-type-${nodeType}` : ""}`;
          context.out(`<li class="${nodeClass}" data-key="${leftKey}"><div class="jsondiffpatch-property-name">${leftKey}</div>`);
        }
        nodeEnd(context) {
          context.out("</li>");
        }
        /* jshint camelcase: false */
        /* eslint-disable camelcase */
        format_unchanged(context, delta, left) {
          if (typeof left === "undefined") {
            return;
          }
          context.out('<div class="jsondiffpatch-value">');
          this.formatValue(context, left);
          context.out("</div>");
        }
        format_movedestination(context, delta, left) {
          if (typeof left === "undefined") {
            return;
          }
          context.out('<div class="jsondiffpatch-value">');
          this.formatValue(context, left);
          context.out("</div>");
        }
        format_node(context, delta, left) {
          const nodeType = delta._t === "a" ? "array" : "object";
          context.out(`<ul class="jsondiffpatch-node jsondiffpatch-node-type-${nodeType}">`);
          this.formatDeltaChildren(context, delta, left);
          context.out("</ul>");
        }
        format_added(context, delta) {
          context.out('<div class="jsondiffpatch-value">');
          this.formatValue(context, delta[0]);
          context.out("</div>");
        }
        format_modified(context, delta) {
          context.out('<div class="jsondiffpatch-value jsondiffpatch-left-value">');
          this.formatValue(context, delta[0]);
          context.out('</div><div class="jsondiffpatch-value jsondiffpatch-right-value">');
          this.formatValue(context, delta[1]);
          context.out("</div>");
        }
        format_deleted(context, delta) {
          context.out('<div class="jsondiffpatch-value">');
          this.formatValue(context, delta[0]);
          context.out("</div>");
        }
        format_moved(context, delta) {
          context.out('<div class="jsondiffpatch-value">');
          this.formatValue(context, delta[0]);
          context.out(`</div><div class="jsondiffpatch-moved-destination">${delta[1]}</div>`);
          context.out(
            /* jshint multistr: true */
            `<div class="jsondiffpatch-arrow" style="position: relative; left: -34px;">
          <svg width="30" height="60" style="position: absolute; display: none;">
          <defs>
              <marker id="markerArrow" markerWidth="8" markerHeight="8"
                 refx="2" refy="4"
                     orient="auto" markerUnits="userSpaceOnUse">
                  <path d="M1,1 L1,7 L7,4 L1,1" style="fill: #339;" />
              </marker>
          </defs>
          <path d="M30,0 Q-10,25 26,50"
            style="stroke: #88f; stroke-width: 2px; fill: none; stroke-opacity: 0.5; marker-end: url(#markerArrow);"
          ></path>
          </svg>
      </div>`
          );
          context.hasArrows = true;
        }
        format_textdiff(context, delta) {
          context.out('<div class="jsondiffpatch-value">');
          this.formatTextDiffString(context, delta[0]);
          context.out("</div>");
        }
      }
      function htmlEscape(text) {
        let html2 = text;
        const replacements = [[/&/g, "&amp;"], [/</g, "&lt;"], [/>/g, "&gt;"], [/'/g, "&apos;"], [/"/g, "&quot;"]];
        for (let i2 = 0; i2 < replacements.length; i2++) {
          html2 = html2.replace(replacements[i2][0], replacements[i2][1]);
        }
        return html2;
      }
      const adjustArrows = function jsondiffpatchHtmlFormatterAdjustArrows(nodeArg) {
        const node = nodeArg || document;
        const getElementText = (_ref) => {
          let {
            textContent: textContent2,
            innerText: innerText2
          } = _ref;
          return textContent2 || innerText2;
        };
        const eachByQuery = (el, query, fn2) => {
          const elems = el.querySelectorAll(query);
          for (let i2 = 0, l2 = elems.length; i2 < l2; i2++) {
            fn2(elems[i2]);
          }
        };
        const eachChildren = (_ref2, fn2) => {
          let {
            children
          } = _ref2;
          for (let i2 = 0, l2 = children.length; i2 < l2; i2++) {
            fn2(children[i2], i2);
          }
        };
        eachByQuery(node, ".jsondiffpatch-arrow", (_ref3) => {
          let {
            parentNode,
            children,
            style
          } = _ref3;
          const arrowParent = parentNode;
          const svg = children[0];
          const path = svg.children[1];
          svg.style.display = "none";
          const destination = getElementText(arrowParent.querySelector(".jsondiffpatch-moved-destination"));
          const container = arrowParent.parentNode;
          let destinationElem;
          eachChildren(container, (child) => {
            if (child.getAttribute("data-key") === destination) {
              destinationElem = child;
            }
          });
          if (!destinationElem) {
            return;
          }
          try {
            const distance = destinationElem.offsetTop - arrowParent.offsetTop;
            svg.setAttribute("height", Math.abs(distance) + 6);
            style.top = `${-8 + (distance > 0 ? 0 : distance)}px`;
            const curve = distance > 0 ? `M30,0 Q-10,${Math.round(distance / 2)} 26,${distance - 4}` : `M30,${-distance} Q-10,${Math.round(-distance / 2)} 26,4`;
            path.setAttribute("d", curve);
            svg.style.display = "";
          } catch (err) {
          }
        });
      };
      const showUnchanged = (show, node, delay) => {
        const el = node || document.body;
        const prefix2 = "jsondiffpatch-unchanged-";
        const classes = {
          showing: `${prefix2}showing`,
          hiding: `${prefix2}hiding`,
          visible: `${prefix2}visible`,
          hidden: `${prefix2}hidden`
        };
        const list = el.classList;
        if (!list) {
          return;
        }
        if (!delay) {
          list.remove(classes.showing);
          list.remove(classes.hiding);
          list.remove(classes.visible);
          list.remove(classes.hidden);
          if (show === false) {
            list.add(classes.hidden);
          }
          return;
        }
        if (show === false) {
          list.remove(classes.showing);
          list.add(classes.visible);
          setTimeout(() => {
            list.add(classes.hiding);
          }, 10);
        } else {
          list.remove(classes.hiding);
          list.add(classes.showing);
          list.remove(classes.hidden);
        }
        const intervalId = setInterval(() => {
          adjustArrows(el);
        }, 100);
        setTimeout(() => {
          list.remove(classes.showing);
          list.remove(classes.hiding);
          if (show === false) {
            list.add(classes.hidden);
            list.remove(classes.visible);
          } else {
            list.add(classes.visible);
            list.remove(classes.hidden);
          }
          setTimeout(() => {
            list.remove(classes.visible);
            clearInterval(intervalId);
          }, delay + 400);
        }, delay);
      };
      const hideUnchanged = (node, delay) => showUnchanged(false, node, delay);
      let defaultInstance$4;
      function format$3(delta, left) {
        if (!defaultInstance$4) {
          defaultInstance$4 = new HtmlFormatter();
        }
        return defaultInstance$4.format(delta, left);
      }
      var html = /* @__PURE__ */ Object.freeze({
        __proto__: null,
        default: HtmlFormatter,
        format: format$3,
        hideUnchanged,
        showUnchanged
      });
      class AnnotatedFormatter extends BaseFormatter {
        constructor() {
          super();
          this.includeMoveDestinations = false;
        }
        prepareContext(context) {
          super.prepareContext(context);
          context.indent = function(levels) {
            this.indentLevel = (this.indentLevel || 0) + (typeof levels === "undefined" ? 1 : levels);
            this.indentPad = new Array(this.indentLevel + 1).join("&nbsp;&nbsp;");
          };
          context.row = (json, htmlNote) => {
            context.out('<tr><td style="white-space: nowrap;"><pre class="jsondiffpatch-annotated-indent" style="display: inline-block">');
            context.out(context.indentPad);
            context.out('</pre><pre style="display: inline-block">');
            context.out(json);
            context.out('</pre></td><td class="jsondiffpatch-delta-note"><div>');
            context.out(htmlNote);
            context.out("</div></td></tr>");
          };
        }
        typeFormattterErrorFormatter(context, err) {
          context.row("", `<pre class="jsondiffpatch-error">${err}</pre>`);
        }
        formatTextDiffString(context, value) {
          const lines = this.parseTextDiff(value);
          context.out('<ul class="jsondiffpatch-textdiff">');
          for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
            const line = lines[i2];
            context.out(`<li><div class="jsondiffpatch-textdiff-location"><span class="jsondiffpatch-textdiff-line-number">${line.location.line}</span><span class="jsondiffpatch-textdiff-char">${line.location.chr}</span></div><div class="jsondiffpatch-textdiff-line">`);
            const pieces = line.pieces;
            for (let pieceIndex = 0, piecesLength = pieces.length; pieceIndex < piecesLength; pieceIndex++) {
              const piece = pieces[pieceIndex];
              context.out(`<span class="jsondiffpatch-textdiff-${piece.type}">${piece.text}</span>`);
            }
            context.out("</div></li>");
          }
          context.out("</ul>");
        }
        rootBegin(context, type, nodeType) {
          context.out('<table class="jsondiffpatch-annotated-delta">');
          if (type === "node") {
            context.row("{");
            context.indent();
          }
          if (nodeType === "array") {
            context.row('"_t": "a",', "Array delta (member names indicate array indices)");
          }
        }
        rootEnd(context, type) {
          if (type === "node") {
            context.indent(-1);
            context.row("}");
          }
          context.out("</table>");
        }
        nodeBegin(context, key, leftKey, type, nodeType) {
          context.row(`&quot;${key}&quot;: {`);
          if (type === "node") {
            context.indent();
          }
          if (nodeType === "array") {
            context.row('"_t": "a",', "Array delta (member names indicate array indices)");
          }
        }
        nodeEnd(context, key, leftKey, type, nodeType, isLast) {
          if (type === "node") {
            context.indent(-1);
          }
          context.row(`}${isLast ? "" : ","}`);
        }
        /* jshint camelcase: false */
        /* eslint-disable camelcase */
        format_unchanged() {
        }
        format_movedestination() {
        }
        format_node(context, delta, left) {
          this.formatDeltaChildren(context, delta, left);
        }
      }
      const wrapPropertyName = (name) => `<pre style="display:inline-block">&quot;${name}&quot;</pre>`;
      const deltaAnnotations = {
        added(delta, left, key, leftKey) {
          const formatLegend = " <pre>([newValue])</pre>";
          if (typeof leftKey === "undefined") {
            return `new value${formatLegend}`;
          }
          if (typeof leftKey === "number") {
            return `insert at index ${leftKey}${formatLegend}`;
          }
          return `add property ${wrapPropertyName(leftKey)}${formatLegend}`;
        },
        modified(delta, left, key, leftKey) {
          const formatLegend = " <pre>([previousValue, newValue])</pre>";
          if (typeof leftKey === "undefined") {
            return `modify value${formatLegend}`;
          }
          if (typeof leftKey === "number") {
            return `modify at index ${leftKey}${formatLegend}`;
          }
          return `modify property ${wrapPropertyName(leftKey)}${formatLegend}`;
        },
        deleted(delta, left, key, leftKey) {
          const formatLegend = " <pre>([previousValue, 0, 0])</pre>";
          if (typeof leftKey === "undefined") {
            return `delete value${formatLegend}`;
          }
          if (typeof leftKey === "number") {
            return `remove index ${leftKey}${formatLegend}`;
          }
          return `delete property ${wrapPropertyName(leftKey)}${formatLegend}`;
        },
        moved(delta, left, key, leftKey) {
          return `move from <span title="(position to remove at original state)">index ${leftKey}</span> to <span title="(position to insert at final state)">index ${delta[1]}</span>`;
        },
        textdiff(delta, left, key, leftKey) {
          const location = typeof leftKey === "undefined" ? "" : typeof leftKey === "number" ? ` at index ${leftKey}` : ` at property ${wrapPropertyName(leftKey)}`;
          return `text diff${location}, format is <a href="https://code.google.com/p/google-diff-match-patch/wiki/Unidiff">a variation of Unidiff</a>`;
        }
      };
      const formatAnyChange = function(context, delta) {
        const deltaType = this.getDeltaType(delta);
        const annotator = deltaAnnotations[deltaType];
        const htmlNote = annotator && annotator.apply(annotator, Array.prototype.slice.call(arguments, 1));
        let json = JSON.stringify(delta, null, 2);
        if (deltaType === "textdiff") {
          json = json.split("\\n").join('\\n"+\n   "');
        }
        context.indent();
        context.row(json, htmlNote);
        context.indent(-1);
      };
      AnnotatedFormatter.prototype.format_added = formatAnyChange;
      AnnotatedFormatter.prototype.format_modified = formatAnyChange;
      AnnotatedFormatter.prototype.format_deleted = formatAnyChange;
      AnnotatedFormatter.prototype.format_moved = formatAnyChange;
      AnnotatedFormatter.prototype.format_textdiff = formatAnyChange;
      let defaultInstance$3;
      function format$2(delta, left) {
        if (!defaultInstance$3) {
          defaultInstance$3 = new AnnotatedFormatter();
        }
        return defaultInstance$3.format(delta, left);
      }
      var annotated = /* @__PURE__ */ Object.freeze({
        __proto__: null,
        default: AnnotatedFormatter,
        format: format$2
      });
      const OPERATIONS = {
        add: "add",
        remove: "remove",
        replace: "replace",
        move: "move"
      };
      class JSONFormatter extends BaseFormatter {
        constructor() {
          super();
          this.includeMoveDestinations = true;
        }
        prepareContext(context) {
          super.prepareContext(context);
          context.result = [];
          context.path = [];
          context.pushCurrentOp = function(obj) {
            const {
              op,
              value
            } = obj;
            const val = {
              op,
              path: this.currentPath()
            };
            if (typeof value !== "undefined") {
              val.value = value;
            }
            this.result.push(val);
          };
          context.pushMoveOp = function(to) {
            const from = this.currentPath();
            this.result.push({
              op: OPERATIONS.move,
              from,
              path: this.toPath(to)
            });
          };
          context.currentPath = function() {
            return `/${this.path.join("/")}`;
          };
          context.toPath = function(toPath) {
            const to = this.path.slice();
            to[to.length - 1] = toPath;
            return `/${to.join("/")}`;
          };
        }
        typeFormattterErrorFormatter(context, err) {
          context.out(`[ERROR] ${err}`);
        }
        rootBegin() {
        }
        rootEnd() {
        }
        nodeBegin(_ref, key, leftKey) {
          let {
            path
          } = _ref;
          path.push(leftKey);
        }
        nodeEnd(_ref2) {
          let {
            path
          } = _ref2;
          path.pop();
        }
        /* jshint camelcase: false */
        /* eslint-disable camelcase */
        format_unchanged() {
        }
        format_movedestination() {
        }
        format_node(context, delta, left) {
          this.formatDeltaChildren(context, delta, left);
        }
        format_added(context, delta) {
          context.pushCurrentOp({
            op: OPERATIONS.add,
            value: delta[0]
          });
        }
        format_modified(context, delta) {
          context.pushCurrentOp({
            op: OPERATIONS.replace,
            value: delta[1]
          });
        }
        format_deleted(context) {
          context.pushCurrentOp({
            op: OPERATIONS.remove
          });
        }
        format_moved(context, delta) {
          const to = delta[1];
          context.pushMoveOp(to);
        }
        format_textdiff() {
          throw new Error("Not implemented");
        }
        format(delta, left) {
          const context = {};
          this.prepareContext(context);
          this.recurse(context, delta, left);
          return context.result;
        }
      }
      const last2 = (arr) => arr[arr.length - 1];
      const sortBy = (arr, pred) => {
        arr.sort(pred);
        return arr;
      };
      const compareByIndexDesc = (indexA, indexB) => {
        const lastA = parseInt(indexA, 10);
        const lastB = parseInt(indexB, 10);
        if (!(isNaN(lastA) || isNaN(lastB))) {
          return lastB - lastA;
        } else {
          return 0;
        }
      };
      const opsByDescendingOrder = (removeOps) => sortBy(removeOps, (a2, b2) => {
        const splitA = a2.path.split("/");
        const splitB = b2.path.split("/");
        if (splitA.length !== splitB.length) {
          return splitA.length - splitB.length;
        } else {
          return compareByIndexDesc(last2(splitA), last2(splitB));
        }
      });
      const partitionOps = (arr, fns) => {
        const initArr = Array(fns.length + 1).fill().map(() => []);
        return arr.map((item) => {
          let position = fns.map((fn2) => fn2(item)).indexOf(true);
          if (position < 0) {
            position = fns.length;
          }
          return {
            item,
            position
          };
        }).reduce((acc, item) => {
          acc[item.position].push(item.item);
          return acc;
        }, initArr);
      };
      const isMoveOp = (_ref3) => {
        let {
          op
        } = _ref3;
        return op === "move";
      };
      const isRemoveOp = (_ref4) => {
        let {
          op
        } = _ref4;
        return op === "remove";
      };
      const reorderOps = (diff2) => {
        const [moveOps, removedOps, restOps] = partitionOps(diff2, [isMoveOp, isRemoveOp]);
        const removeOpsReverse = opsByDescendingOrder(removedOps);
        return [...removeOpsReverse, ...moveOps, ...restOps];
      };
      let defaultInstance$2;
      const format$1 = (delta, left) => {
        if (!defaultInstance$2) {
          defaultInstance$2 = new JSONFormatter();
        }
        return reorderOps(defaultInstance$2.format(delta, left));
      };
      const log$1 = (delta, left) => {
        console.log(format$1(delta, left));
      };
      var jsonpatch = /* @__PURE__ */ Object.freeze({
        __proto__: null,
        default: JSONFormatter,
        format: format$1,
        log: log$1,
        partitionOps
      });
      function chalkColor(name) {
        return chalk && chalk[name] || function() {
          for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
            args[_key] = arguments[_key];
          }
          return args;
        };
      }
      const colors = {
        added: chalkColor("green"),
        deleted: chalkColor("red"),
        movedestination: chalkColor("gray"),
        moved: chalkColor("yellow"),
        unchanged: chalkColor("gray"),
        error: chalkColor("white.bgRed"),
        textDiffLine: chalkColor("gray")
      };
      class ConsoleFormatter extends BaseFormatter {
        constructor() {
          super();
          this.includeMoveDestinations = false;
        }
        prepareContext(context) {
          super.prepareContext(context);
          context.indent = function(levels) {
            this.indentLevel = (this.indentLevel || 0) + (typeof levels === "undefined" ? 1 : levels);
            this.indentPad = new Array(this.indentLevel + 1).join("  ");
            this.outLine();
          };
          context.outLine = function() {
            this.buffer.push(`
${this.indentPad || ""}`);
          };
          context.out = function() {
            for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
              args[_key2] = arguments[_key2];
            }
            for (let i2 = 0, l2 = args.length; i2 < l2; i2++) {
              const lines = args[i2].split("\n");
              let text = lines.join(`
${this.indentPad || ""}`);
              if (this.color && this.color[0]) {
                text = this.color[0](text);
              }
              this.buffer.push(text);
            }
          };
          context.pushColor = function(color) {
            this.color = this.color || [];
            this.color.unshift(color);
          };
          context.popColor = function() {
            this.color = this.color || [];
            this.color.shift();
          };
        }
        typeFormattterErrorFormatter(context, err) {
          context.pushColor(colors.error);
          context.out(`[ERROR]${err}`);
          context.popColor();
        }
        formatValue(context, value) {
          context.out(JSON.stringify(value, null, 2));
        }
        formatTextDiffString(context, value) {
          const lines = this.parseTextDiff(value);
          context.indent();
          for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
            const line = lines[i2];
            context.pushColor(colors.textDiffLine);
            context.out(`${line.location.line},${line.location.chr} `);
            context.popColor();
            const pieces = line.pieces;
            for (let pieceIndex = 0, piecesLength = pieces.length; pieceIndex < piecesLength; pieceIndex++) {
              const piece = pieces[pieceIndex];
              context.pushColor(colors[piece.type]);
              context.out(piece.text);
              context.popColor();
            }
            if (i2 < l2 - 1) {
              context.outLine();
            }
          }
          context.indent(-1);
        }
        rootBegin(context, type, nodeType) {
          context.pushColor(colors[type]);
          if (type === "node") {
            context.out(nodeType === "array" ? "[" : "{");
            context.indent();
          }
        }
        rootEnd(context, type, nodeType) {
          if (type === "node") {
            context.indent(-1);
            context.out(nodeType === "array" ? "]" : "}");
          }
          context.popColor();
        }
        nodeBegin(context, key, leftKey, type, nodeType) {
          context.pushColor(colors[type]);
          context.out(`${leftKey}: `);
          if (type === "node") {
            context.out(nodeType === "array" ? "[" : "{");
            context.indent();
          }
        }
        nodeEnd(context, key, leftKey, type, nodeType, isLast) {
          if (type === "node") {
            context.indent(-1);
            context.out(nodeType === "array" ? "]" : `}${isLast ? "" : ","}`);
          }
          if (!isLast) {
            context.outLine();
          }
          context.popColor();
        }
        /* jshint camelcase: false */
        /* eslint-disable camelcase */
        format_unchanged(context, delta, left) {
          if (typeof left === "undefined") {
            return;
          }
          this.formatValue(context, left);
        }
        format_movedestination(context, delta, left) {
          if (typeof left === "undefined") {
            return;
          }
          this.formatValue(context, left);
        }
        format_node(context, delta, left) {
          this.formatDeltaChildren(context, delta, left);
        }
        format_added(context, delta) {
          this.formatValue(context, delta[0]);
        }
        format_modified(context, delta) {
          context.pushColor(colors.deleted);
          this.formatValue(context, delta[0]);
          context.popColor();
          context.out(" => ");
          context.pushColor(colors.added);
          this.formatValue(context, delta[1]);
          context.popColor();
        }
        format_deleted(context, delta) {
          this.formatValue(context, delta[0]);
        }
        format_moved(context, delta) {
          context.out(`==> ${delta[1]}`);
        }
        format_textdiff(context, delta) {
          this.formatTextDiffString(context, delta[0]);
        }
      }
      let defaultInstance$1;
      const format = (delta, left) => {
        if (!defaultInstance$1) {
          defaultInstance$1 = new ConsoleFormatter();
        }
        return defaultInstance$1.format(delta, left);
      };
      function log(delta, left) {
        console.log(format(delta, left));
      }
      var console$1 = /* @__PURE__ */ Object.freeze({
        __proto__: null,
        default: ConsoleFormatter,
        format,
        log
      });
      var index = /* @__PURE__ */ Object.freeze({
        __proto__: null,
        annotated,
        base,
        console: console$1,
        html,
        jsonpatch
      });
      function dateReviver(key, value) {
        let parts;
        if (typeof value === "string") {
          parts = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d*))?(Z|([+-])(\d{2}):(\d{2}))$/.exec(value);
          if (parts) {
            return new Date(Date.UTC(+parts[1], +parts[2] - 1, +parts[3], +parts[4], +parts[5], +parts[6], +(parts[7] || 0)));
          }
        }
        return value;
      }
      function create(options) {
        return new DiffPatcher(options);
      }
      let defaultInstance;
      function diff() {
        if (!defaultInstance) {
          defaultInstance = new DiffPatcher();
        }
        return defaultInstance.diff.apply(defaultInstance, arguments);
      }
      function patch() {
        if (!defaultInstance) {
          defaultInstance = new DiffPatcher();
        }
        return defaultInstance.patch.apply(defaultInstance, arguments);
      }
      function unpatch() {
        if (!defaultInstance) {
          defaultInstance = new DiffPatcher();
        }
        return defaultInstance.unpatch.apply(defaultInstance, arguments);
      }
      function reverse() {
        if (!defaultInstance) {
          defaultInstance = new DiffPatcher();
        }
        return defaultInstance.reverse.apply(defaultInstance, arguments);
      }
      function clone2() {
        if (!defaultInstance) {
          defaultInstance = new DiffPatcher();
        }
        return defaultInstance.clone.apply(defaultInstance, arguments);
      }
      exports2.DiffPatcher = DiffPatcher;
      exports2.clone = clone2;
      exports2.console = console$1;
      exports2.create = create;
      exports2.dateReviver = dateReviver;
      exports2.diff = diff;
      exports2.formatters = index;
      exports2.patch = patch;
      exports2.reverse = reverse;
      exports2.unpatch = unpatch;
    });
  }
});

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

// src/obsidian/modal/welcome-modal/index.tsx
var import_obsidian = require("obsidian");

// src/obsidian/shared/index.ts
var renderDivider = (contentEl) => {
  const isFirstChild = contentEl.children.length === 0;
  const dividerEl = contentEl.createEl("hr", {
    cls: "dataloom-modal__divider"
  });
  if (isFirstChild) {
    dividerEl.addClass("dataloom-modal__divider--first-child");
  }
};
var setModalTitle = (containerEl, text) => {
  const modalTitleEl = containerEl.querySelector(".modal-title");
  modalTitleEl == null ? void 0 : modalTitleEl.createEl("h3", { text });
  modalTitleEl == null ? void 0 : modalTitleEl.addClass("dataloom-modal__title");
};

// src/obsidian/modal/welcome-modal/index.tsx
var WelcomeModal = class extends import_obsidian.Modal {
  constructor(app) {
    super(app);
  }
  onOpen() {
    const { containerEl } = this;
    containerEl.addClass("dataloom-welcome-modal");
    setModalTitle(containerEl, "Welcome to DataLoom");
    const { contentEl } = this;
    contentEl.createDiv({
      text: "Weave together data from diverse sources into a cohesive table view."
    });
    renderDivider(contentEl);
    contentEl.createEl("h5", {
      text: "Learn how to use",
      cls: "dataloom-welcome-modal__title"
    });
    const cardContainerEl = contentEl.createDiv({
      cls: "dataloom-welcome-modal__card-container"
    });
    this.renderCard(
      cardContainerEl,
      "Quick start",
      "Learn the basics of creating a loom",
      "https://dataloom.xyz/quick-start",
      "table"
    );
    this.renderCard(
      cardContainerEl,
      "Import markdown tables and CSV data",
      "Learn how to import data from markdown tables and CSV files",
      "https://dataloom.xyz/basics/import",
      "import"
    );
    this.renderCard(
      cardContainerEl,
      "Embedded looms",
      "Learn how to embed a loom into a markdown note",
      "https://dataloom.xyz/basics/embed-looms",
      "sticky-note"
    );
    this.renderCard(
      cardContainerEl,
      "Keyboard navigation",
      "Learn how to navigate looms with your keyboard",
      "https://dataloom.xyz/basics/keyboard-navigation",
      "list-plus"
    );
  }
  renderCard(contentEl, title, description, link, iconId) {
    const cardEl = contentEl.createDiv({
      cls: "dataloom-welcome-modal__card"
    });
    const iconEl = cardEl.createDiv();
    (0, import_obsidian.setIcon)(iconEl, iconId);
    iconEl.firstChild.classList.add(
      "dataloom-welcome-modal__card-icon"
    );
    const cardContainerEl = cardEl.createDiv();
    cardContainerEl.createEl("h6", {
      text: title,
      cls: "dataloom-welcome-modal__card-title"
    });
    cardContainerEl.createEl("p", {
      text: description,
      cls: "dataloom-welcome-modal__card-description"
    });
    cardContainerEl.createEl("a", { text: "Get started", href: link });
  }
  onClose() {
    const { contentEl } = this;
    contentEl.empty();
  }
};

// src/obsidian/dataloom-settings-tab.ts
var import_obsidian2 = require("obsidian");
var import_obsidian3 = require("obsidian");
var import_js_logger2 = __toESM(require_logger());

// src/shared/logger/constants.ts
var LOG_LEVEL_OFF = "off";
var LOG_LEVEL_ERROR = "error";
var LOG_LEVEL_WARN = "warn";
var LOG_LEVEL_INFO = "info";
var LOG_LEVEL_DEBUG = "debug";
var LOG_LEVEL_TRACE = "trace";

// src/shared/logger/index.ts
var import_js_logger = __toESM(require_logger());
var stringToLogLevel = (value) => {
  switch (value) {
    case LOG_LEVEL_OFF:
      return import_js_logger.default.OFF;
    case LOG_LEVEL_ERROR:
      return import_js_logger.default.ERROR;
    case LOG_LEVEL_WARN:
      return import_js_logger.default.WARN;
    case LOG_LEVEL_INFO:
      return import_js_logger.default.INFO;
    case LOG_LEVEL_DEBUG:
      return import_js_logger.default.DEBUG;
    case LOG_LEVEL_TRACE:
      return import_js_logger.default.TRACE;
    default:
      throw new Error(`Unhandled log level: ${value}`);
  }
};
var formatMessageForLogger = (...args) => {
  if (args.length < 3) {
    return { message: args[0], data: null };
  }
  const fileName = args[0];
  const functionName = args[1];
  const message = args[2];
  if (args.length === 4) {
    const data = args[3];
    if (Object.keys(data).length !== 0) {
      return { message: `[${fileName}:${functionName}] ${message}`, data };
    }
  }
  return { message: `[${fileName}:${functionName}] ${message}`, data: null };
};

// src/obsidian/dataloom-settings-tab.ts
var DataLoomSettingsTab = class extends import_obsidian2.PluginSettingTab {
  constructor(app, plugin) {
    super(app, plugin);
    this.plugin = plugin;
  }
  display() {
    const { containerEl } = this;
    containerEl.empty();
    this.renderFileSettings(containerEl);
    this.renderTableSettings(containerEl);
    this.renderExportSettings(containerEl);
    this.renderEmbeddedLoomSettings(containerEl);
    this.renderDebugSettings(containerEl);
  }
  renderFileSettings(containerEl) {
    new import_obsidian3.Setting(containerEl).setName("File").setHeading();
    const attachmentsFolderDesc = new DocumentFragment();
    attachmentsFolderDesc.createDiv({
      text: "Create looms in the attachments folder defined in the Obsidian settings."
    });
    attachmentsFolderDesc.createSpan({
      text: "This can be changed in"
    });
    attachmentsFolderDesc.createSpan({
      text: " Files & Links -> Default location for new attachments",
      cls: "dataloom-modal-text--emphasize"
    });
    attachmentsFolderDesc.createEl("br");
    attachmentsFolderDesc.createDiv({
      text: "Otherwise, the folder location below will be used"
    });
    new import_obsidian3.Setting(containerEl).setName("Create looms in the attachments folder").setDesc(attachmentsFolderDesc).addToggle((cb) => {
      cb.setValue(
        this.plugin.settings.createAtObsidianAttachmentFolder
      ).onChange(async (value) => {
        this.plugin.settings.createAtObsidianAttachmentFolder = value;
        await this.plugin.saveSettings();
        this.display();
      });
    });
    const defaultLocationDesc = new DocumentFragment();
    defaultLocationDesc.createSpan({
      text: "Where newly created looms are placed. Default location is the vault root folder, if not specified."
    });
    if (this.plugin.settings.createAtObsidianAttachmentFolder === false) {
      new import_obsidian3.Setting(containerEl).setName("Default location for new looms").setDesc(defaultLocationDesc).addText((cb) => {
        cb.setValue(
          this.plugin.settings.customFolderForNewFiles
        ).onChange(async (value) => {
          this.plugin.settings.customFolderForNewFiles = value;
          await this.plugin.saveSettings();
        });
      });
    }
  }
  renderTableSettings(containerEl) {
    const freezeColumnsDesc = new DocumentFragment();
    freezeColumnsDesc.createSpan({
      text: "The number of columns to stay in place when the table scrolls horizontally."
    });
    new import_obsidian3.Setting(containerEl).setName("Table").setHeading();
    new import_obsidian3.Setting(containerEl).setName("Frozen columns").setDesc(freezeColumnsDesc).addDropdown((cb) => {
      cb.addOptions({
        "0": "0",
        "1": "1",
        "2": "2",
        "3": "3"
      }).setValue(
        this.plugin.settings.defaultFrozenColumnCount.toString()
      ).onChange(async (value) => {
        this.plugin.settings.defaultFrozenColumnCount = parseInt(value);
        await this.plugin.saveSettings();
      });
    });
  }
  renderExportSettings(containerEl) {
    const removeMarkdownOnExportDesc = new DocumentFragment();
    removeMarkdownOnExportDesc.createSpan({
      text: "If enabled, content will be exported as plain text instead of markdown. For example, if enabled, a checkbox cell's content will be exported true or false instead of [ ] or [x]."
    });
    new import_obsidian3.Setting(containerEl).setName("Export").setHeading();
    new import_obsidian3.Setting(containerEl).setName("Remove markdown").setDesc(removeMarkdownOnExportDesc).addToggle((cb) => {
      cb.setValue(
        this.plugin.settings.removeMarkdownOnExport
      ).onChange(async (value) => {
        this.plugin.settings.removeMarkdownOnExport = value;
        await this.plugin.saveSettings();
      });
    });
  }
  renderEmbeddedLoomSettings(containerEl) {
    new import_obsidian3.Setting(containerEl).setName("Embedded looms").setHeading();
    const defaultEmbedWidthDesc = new DocumentFragment();
    defaultEmbedWidthDesc.createSpan({
      text: "The default embedded loom width. Accepts valid HTML width values. Like 100px, 50%, etc."
    });
    defaultEmbedWidthDesc.createDiv({
      text: "Please close and reopen your embedded looms for this setting to take effect",
      cls: "dataloom-modal-text--emphasize"
    });
    new import_obsidian3.Setting(containerEl).setName("Default embedded loom width").setDesc(defaultEmbedWidthDesc).addText((cb) => {
      cb.setValue(this.plugin.settings.defaultEmbedWidth).onChange(
        async (value) => {
          this.plugin.settings.defaultEmbedWidth = value;
          await this.plugin.saveSettings();
        }
      );
    });
    const defaultEmbedHeightDesc = new DocumentFragment();
    defaultEmbedHeightDesc.createSpan({
      text: "The default embedded loom height. Accepts valid HTML width values. Like 100px, 50%, etc."
    });
    defaultEmbedHeightDesc.createDiv({
      text: "Please close and reopen your embedded looms for this setting to take effect",
      cls: "dataloom-modal-text--emphasize"
    });
    new import_obsidian3.Setting(containerEl).setName("Default embedded loom height").setDesc(defaultEmbedHeightDesc).addText((cb) => {
      cb.setValue(this.plugin.settings.defaultEmbedHeight).onChange(
        async (value) => {
          this.plugin.settings.defaultEmbedHeight = value;
          await this.plugin.saveSettings();
        }
      );
    });
  }
  renderDebugSettings(containerEl) {
    new import_obsidian3.Setting(containerEl).setName("Debugging").setHeading();
    new import_obsidian3.Setting(containerEl).setName("Log level").setDesc(
      "Sets the log level. Please use trace to see all log messages."
    ).addDropdown((cb) => {
      cb.addOptions({
        [LOG_LEVEL_OFF]: "Off",
        [LOG_LEVEL_ERROR]: "Error",
        [LOG_LEVEL_WARN]: "Warn",
        [LOG_LEVEL_INFO]: "Info",
        [LOG_LEVEL_DEBUG]: "Debug",
        [LOG_LEVEL_TRACE]: "Trace"
      });
      cb.setValue(this.plugin.settings.logLevel).onChange(
        async (value) => {
          this.plugin.settings.logLevel = value;
          await this.plugin.saveSettings();
          import_js_logger2.default.setLevel(stringToLogLevel(value));
        }
      );
    });
  }
};

// src/obsidian/editing-view-plugin.tsx
var import_view = require("@codemirror/view");

// src/obsidian/embedded/embedded-app-manager.tsx
var import_obsidian17 = require("obsidian");

// src/data/constants.ts
var DEFAULT_LOOM_NAME = "Untitled";
var LOOM_EXTENSION = "loom";
var EXTENSION_REGEX = new RegExp(/\.[a-z]*$/);
var WIKI_LINK_REGEX = new RegExp(/\[\[([^|\]]+)(\|([\w-]*))?\]\]/g);

// src/shared/conversion.ts
var pxToNum = (value) => {
  return parseFloat(value.split("px")[0]);
};
var numToPx = (value) => {
  return `${value}px`;
};

// src/obsidian/embedded/embed-utils.ts
var getEmbeddedLoomLinkEls = (view, mode) => {
  const linkEls = [];
  const { contentEl } = view;
  const el = mode === "source" ? contentEl.querySelector(".markdown-source-view") : contentEl.querySelector(".markdown-reading-view");
  if (el) {
    const embeddedLinkEls = el.querySelectorAll(".internal-embed");
    for (let i2 = 0; i2 < embeddedLinkEls.length; i2++) {
      const linkEl = embeddedLinkEls[i2];
      const src = linkEl.getAttribute("src");
      if (src == null ? void 0 : src.endsWith(LOOM_EXTENSION))
        linkEls.push(linkEl);
    }
  }
  return linkEls;
};
var hasLoadedEmbeddedLoom = (linkEl) => {
  if (linkEl.children.length > 0) {
    const firstChildEl = linkEl.children[0];
    if (firstChildEl.classList.contains("dataloom-embedded-container"))
      return true;
  }
  return false;
};
var findEmbeddedLoomFile = (app, linkEl, sourcePath) => {
  const src = linkEl.getAttribute("src");
  if (!src)
    return null;
  return app.metadataCache.getFirstLinkpathDest(src, sourcePath);
};
var getLinkWidth = (linkEl, defaultWidth) => {
  const width = linkEl.getAttribute("width");
  if (width === null || width === "0")
    return defaultWidth;
  return numToPx(width);
};
var getLinkHeight = (linkEl, defaultHeight) => {
  const height = linkEl.getAttribute("height");
  if (height === null || height === "0")
    return defaultHeight;
  return numToPx(height);
};

// src/obsidian/embedded/embedded-app-manager.tsx
var import_client4 = __toESM(require_client());

// node_modules/immer/dist/immer.esm.mjs
function n(n2) {
  for (var r2 = arguments.length, t2 = Array(r2 > 1 ? r2 - 1 : 0), e = 1; e < r2; e++)
    t2[e - 1] = arguments[e];
  if (true) {
    var i2 = Y[n2], o2 = i2 ? "function" == typeof i2 ? i2.apply(null, t2) : i2 : "unknown error nr: " + n2;
    throw Error("[Immer] " + o2);
  }
  throw Error("[Immer] minified error nr: " + n2 + (t2.length ? " " + t2.map(function(n3) {
    return "'" + n3 + "'";
  }).join(",") : "") + ". Find the full error at: https://bit.ly/3cXEKWf");
}
function r(n2) {
  return !!n2 && !!n2[Q];
}
function t(n2) {
  var r2;
  return !!n2 && (function(n3) {
    if (!n3 || "object" != typeof n3)
      return false;
    var r3 = Object.getPrototypeOf(n3);
    if (null === r3)
      return true;
    var t2 = Object.hasOwnProperty.call(r3, "constructor") && r3.constructor;
    return t2 === Object || "function" == typeof t2 && Function.toString.call(t2) === Z;
  }(n2) || Array.isArray(n2) || !!n2[L] || !!(null === (r2 = n2.constructor) || void 0 === r2 ? void 0 : r2[L]) || s(n2) || v(n2));
}
function i(n2, r2, t2) {
  void 0 === t2 && (t2 = false), 0 === o(n2) ? (t2 ? Object.keys : nn)(n2).forEach(function(e) {
    t2 && "symbol" == typeof e || r2(e, n2[e], n2);
  }) : n2.forEach(function(t3, e) {
    return r2(e, t3, n2);
  });
}
function o(n2) {
  var r2 = n2[Q];
  return r2 ? r2.i > 3 ? r2.i - 4 : r2.i : Array.isArray(n2) ? 1 : s(n2) ? 2 : v(n2) ? 3 : 0;
}
function u(n2, r2) {
  return 2 === o(n2) ? n2.has(r2) : Object.prototype.hasOwnProperty.call(n2, r2);
}
function a(n2, r2) {
  return 2 === o(n2) ? n2.get(r2) : n2[r2];
}
function f(n2, r2, t2) {
  var e = o(n2);
  2 === e ? n2.set(r2, t2) : 3 === e ? n2.add(t2) : n2[r2] = t2;
}
function c(n2, r2) {
  return n2 === r2 ? 0 !== n2 || 1 / n2 == 1 / r2 : n2 != n2 && r2 != r2;
}
function s(n2) {
  return X && n2 instanceof Map;
}
function v(n2) {
  return q && n2 instanceof Set;
}
function p(n2) {
  return n2.o || n2.t;
}
function l(n2) {
  if (Array.isArray(n2))
    return Array.prototype.slice.call(n2);
  var r2 = rn(n2);
  delete r2[Q];
  for (var t2 = nn(r2), e = 0; e < t2.length; e++) {
    var i2 = t2[e], o2 = r2[i2];
    false === o2.writable && (o2.writable = true, o2.configurable = true), (o2.get || o2.set) && (r2[i2] = { configurable: true, writable: true, enumerable: o2.enumerable, value: n2[i2] });
  }
  return Object.create(Object.getPrototypeOf(n2), r2);
}
function d(n2, e) {
  return void 0 === e && (e = false), y(n2) || r(n2) || !t(n2) || (o(n2) > 1 && (n2.set = n2.add = n2.clear = n2.delete = h), Object.freeze(n2), e && i(n2, function(n3, r2) {
    return d(r2, true);
  }, true)), n2;
}
function h() {
  n(2);
}
function y(n2) {
  return null == n2 || "object" != typeof n2 || Object.isFrozen(n2);
}
function b(r2) {
  var t2 = tn[r2];
  return t2 || n(18, r2), t2;
}
function m(n2, r2) {
  tn[n2] || (tn[n2] = r2);
}
function _() {
  return U || n(0), U;
}
function j(n2, r2) {
  r2 && (b("Patches"), n2.u = [], n2.s = [], n2.v = r2);
}
function g(n2) {
  O(n2), n2.p.forEach(S), n2.p = null;
}
function O(n2) {
  n2 === U && (U = n2.l);
}
function w(n2) {
  return U = { p: [], l: U, h: n2, m: true, _: 0 };
}
function S(n2) {
  var r2 = n2[Q];
  0 === r2.i || 1 === r2.i ? r2.j() : r2.g = true;
}
function P(r2, e) {
  e._ = e.p.length;
  var i2 = e.p[0], o2 = void 0 !== r2 && r2 !== i2;
  return e.h.O || b("ES5").S(e, r2, o2), o2 ? (i2[Q].P && (g(e), n(4)), t(r2) && (r2 = M(e, r2), e.l || x(e, r2)), e.u && b("Patches").M(i2[Q].t, r2, e.u, e.s)) : r2 = M(e, i2, []), g(e), e.u && e.v(e.u, e.s), r2 !== H ? r2 : void 0;
}
function M(n2, r2, t2) {
  if (y(r2))
    return r2;
  var e = r2[Q];
  if (!e)
    return i(r2, function(i2, o3) {
      return A(n2, e, r2, i2, o3, t2);
    }, true), r2;
  if (e.A !== n2)
    return r2;
  if (!e.P)
    return x(n2, e.t, true), e.t;
  if (!e.I) {
    e.I = true, e.A._--;
    var o2 = 4 === e.i || 5 === e.i ? e.o = l(e.k) : e.o, u2 = o2, a2 = false;
    3 === e.i && (u2 = new Set(o2), o2.clear(), a2 = true), i(u2, function(r3, i2) {
      return A(n2, e, o2, r3, i2, t2, a2);
    }), x(n2, o2, false), t2 && n2.u && b("Patches").N(e, t2, n2.u, n2.s);
  }
  return e.o;
}
function A(e, i2, o2, a2, c2, s2, v2) {
  if (c2 === o2 && n(5), r(c2)) {
    var p2 = M(e, c2, s2 && i2 && 3 !== i2.i && !u(i2.R, a2) ? s2.concat(a2) : void 0);
    if (f(o2, a2, p2), !r(p2))
      return;
    e.m = false;
  } else
    v2 && o2.add(c2);
  if (t(c2) && !y(c2)) {
    if (!e.h.D && e._ < 1)
      return;
    M(e, c2), i2 && i2.A.l || x(e, c2);
  }
}
function x(n2, r2, t2) {
  void 0 === t2 && (t2 = false), !n2.l && n2.h.D && n2.m && d(r2, t2);
}
function z(n2, r2) {
  var t2 = n2[Q];
  return (t2 ? p(t2) : n2)[r2];
}
function I(n2, r2) {
  if (r2 in n2)
    for (var t2 = Object.getPrototypeOf(n2); t2; ) {
      var e = Object.getOwnPropertyDescriptor(t2, r2);
      if (e)
        return e;
      t2 = Object.getPrototypeOf(t2);
    }
}
function k(n2) {
  n2.P || (n2.P = true, n2.l && k(n2.l));
}
function E(n2) {
  n2.o || (n2.o = l(n2.t));
}
function N(n2, r2, t2) {
  var e = s(r2) ? b("MapSet").F(r2, t2) : v(r2) ? b("MapSet").T(r2, t2) : n2.O ? function(n3, r3) {
    var t3 = Array.isArray(n3), e2 = { i: t3 ? 1 : 0, A: r3 ? r3.A : _(), P: false, I: false, R: {}, l: r3, t: n3, k: null, o: null, j: null, C: false }, i2 = e2, o2 = en;
    t3 && (i2 = [e2], o2 = on);
    var u2 = Proxy.revocable(i2, o2), a2 = u2.revoke, f3 = u2.proxy;
    return e2.k = f3, e2.j = a2, f3;
  }(r2, t2) : b("ES5").J(r2, t2);
  return (t2 ? t2.A : _()).p.push(e), e;
}
function R(e) {
  return r(e) || n(22, e), function n2(r2) {
    if (!t(r2))
      return r2;
    var e2, u2 = r2[Q], c2 = o(r2);
    if (u2) {
      if (!u2.P && (u2.i < 4 || !b("ES5").K(u2)))
        return u2.t;
      u2.I = true, e2 = D(r2, c2), u2.I = false;
    } else
      e2 = D(r2, c2);
    return i(e2, function(r3, t2) {
      u2 && a(u2.t, r3) === t2 || f(e2, r3, n2(t2));
    }), 3 === c2 ? new Set(e2) : e2;
  }(e);
}
function D(n2, r2) {
  switch (r2) {
    case 2:
      return new Map(n2);
    case 3:
      return Array.from(n2);
  }
  return l(n2);
}
function F() {
  function t2(n2, r2) {
    var t3 = s2[n2];
    return t3 ? t3.enumerable = r2 : s2[n2] = t3 = { configurable: true, enumerable: r2, get: function() {
      var r3 = this[Q];
      return f3(r3), en.get(r3, n2);
    }, set: function(r3) {
      var t4 = this[Q];
      f3(t4), en.set(t4, n2, r3);
    } }, t3;
  }
  function e(n2) {
    for (var r2 = n2.length - 1; r2 >= 0; r2--) {
      var t3 = n2[r2][Q];
      if (!t3.P)
        switch (t3.i) {
          case 5:
            a2(t3) && k(t3);
            break;
          case 4:
            o2(t3) && k(t3);
        }
    }
  }
  function o2(n2) {
    for (var r2 = n2.t, t3 = n2.k, e2 = nn(t3), i2 = e2.length - 1; i2 >= 0; i2--) {
      var o3 = e2[i2];
      if (o3 !== Q) {
        var a3 = r2[o3];
        if (void 0 === a3 && !u(r2, o3))
          return true;
        var f4 = t3[o3], s3 = f4 && f4[Q];
        if (s3 ? s3.t !== a3 : !c(f4, a3))
          return true;
      }
    }
    var v2 = !!r2[Q];
    return e2.length !== nn(r2).length + (v2 ? 0 : 1);
  }
  function a2(n2) {
    var r2 = n2.k;
    if (r2.length !== n2.t.length)
      return true;
    var t3 = Object.getOwnPropertyDescriptor(r2, r2.length - 1);
    if (t3 && !t3.get)
      return true;
    for (var e2 = 0; e2 < r2.length; e2++)
      if (!r2.hasOwnProperty(e2))
        return true;
    return false;
  }
  function f3(r2) {
    r2.g && n(3, JSON.stringify(p(r2)));
  }
  var s2 = {};
  m("ES5", { J: function(n2, r2) {
    var e2 = Array.isArray(n2), i2 = function(n3, r3) {
      if (n3) {
        for (var e3 = Array(r3.length), i3 = 0; i3 < r3.length; i3++)
          Object.defineProperty(e3, "" + i3, t2(i3, true));
        return e3;
      }
      var o4 = rn(r3);
      delete o4[Q];
      for (var u2 = nn(o4), a3 = 0; a3 < u2.length; a3++) {
        var f4 = u2[a3];
        o4[f4] = t2(f4, n3 || !!o4[f4].enumerable);
      }
      return Object.create(Object.getPrototypeOf(r3), o4);
    }(e2, n2), o3 = { i: e2 ? 5 : 4, A: r2 ? r2.A : _(), P: false, I: false, R: {}, l: r2, t: n2, k: i2, o: null, g: false, C: false };
    return Object.defineProperty(i2, Q, { value: o3, writable: true }), i2;
  }, S: function(n2, t3, o3) {
    o3 ? r(t3) && t3[Q].A === n2 && e(n2.p) : (n2.u && function n3(r2) {
      if (r2 && "object" == typeof r2) {
        var t4 = r2[Q];
        if (t4) {
          var e2 = t4.t, o4 = t4.k, f4 = t4.R, c2 = t4.i;
          if (4 === c2)
            i(o4, function(r3) {
              r3 !== Q && (void 0 !== e2[r3] || u(e2, r3) ? f4[r3] || n3(o4[r3]) : (f4[r3] = true, k(t4)));
            }), i(e2, function(n4) {
              void 0 !== o4[n4] || u(o4, n4) || (f4[n4] = false, k(t4));
            });
          else if (5 === c2) {
            if (a2(t4) && (k(t4), f4.length = true), o4.length < e2.length)
              for (var s3 = o4.length; s3 < e2.length; s3++)
                f4[s3] = false;
            else
              for (var v2 = e2.length; v2 < o4.length; v2++)
                f4[v2] = true;
            for (var p2 = Math.min(o4.length, e2.length), l2 = 0; l2 < p2; l2++)
              o4.hasOwnProperty(l2) || (f4[l2] = true), void 0 === f4[l2] && n3(o4[l2]);
          }
        }
      }
    }(n2.p[0]), e(n2.p));
  }, K: function(n2) {
    return 4 === n2.i ? o2(n2) : a2(n2);
  } });
}
var G;
var U;
var W = "undefined" != typeof Symbol && "symbol" == typeof Symbol("x");
var X = "undefined" != typeof Map;
var q = "undefined" != typeof Set;
var B = "undefined" != typeof Proxy && void 0 !== Proxy.revocable && "undefined" != typeof Reflect;
var H = W ? Symbol.for("immer-nothing") : ((G = {})["immer-nothing"] = true, G);
var L = W ? Symbol.for("immer-draftable") : "__$immer_draftable";
var Q = W ? Symbol.for("immer-state") : "__$immer_state";
var Y = { 0: "Illegal state", 1: "Immer drafts cannot have computed properties", 2: "This object has been frozen and should not be mutated", 3: function(n2) {
  return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + n2;
}, 4: "An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.", 5: "Immer forbids circular references", 6: "The first or second argument to `produce` must be a function", 7: "The third argument to `produce` must be a function or undefined", 8: "First argument to `createDraft` must be a plain object, an array, or an immerable object", 9: "First argument to `finishDraft` must be a draft returned by `createDraft`", 10: "The given draft is already finalized", 11: "Object.defineProperty() cannot be used on an Immer draft", 12: "Object.setPrototypeOf() cannot be used on an Immer draft", 13: "Immer only supports deleting array indices", 14: "Immer only supports setting array indices and the 'length' property", 15: function(n2) {
  return "Cannot apply patch, path doesn't resolve: " + n2;
}, 16: 'Sets cannot have "replace" patches.', 17: function(n2) {
  return "Unsupported patch operation: " + n2;
}, 18: function(n2) {
  return "The plugin for '" + n2 + "' has not been loaded into Immer. To enable the plugin, import and call `enable" + n2 + "()` when initializing your application.";
}, 20: "Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available", 21: function(n2) {
  return "produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '" + n2 + "'";
}, 22: function(n2) {
  return "'current' expects a draft, got: " + n2;
}, 23: function(n2) {
  return "'original' expects a draft, got: " + n2;
}, 24: "Patching reserved attributes like __proto__, prototype and constructor is not allowed" };
var Z = "" + Object.prototype.constructor;
var nn = "undefined" != typeof Reflect && Reflect.ownKeys ? Reflect.ownKeys : void 0 !== Object.getOwnPropertySymbols ? function(n2) {
  return Object.getOwnPropertyNames(n2).concat(Object.getOwnPropertySymbols(n2));
} : Object.getOwnPropertyNames;
var rn = Object.getOwnPropertyDescriptors || function(n2) {
  var r2 = {};
  return nn(n2).forEach(function(t2) {
    r2[t2] = Object.getOwnPropertyDescriptor(n2, t2);
  }), r2;
};
var tn = {};
var en = { get: function(n2, r2) {
  if (r2 === Q)
    return n2;
  var e = p(n2);
  if (!u(e, r2))
    return function(n3, r3, t2) {
      var e2, i3 = I(r3, t2);
      return i3 ? "value" in i3 ? i3.value : null === (e2 = i3.get) || void 0 === e2 ? void 0 : e2.call(n3.k) : void 0;
    }(n2, e, r2);
  var i2 = e[r2];
  return n2.I || !t(i2) ? i2 : i2 === z(n2.t, r2) ? (E(n2), n2.o[r2] = N(n2.A.h, i2, n2)) : i2;
}, has: function(n2, r2) {
  return r2 in p(n2);
}, ownKeys: function(n2) {
  return Reflect.ownKeys(p(n2));
}, set: function(n2, r2, t2) {
  var e = I(p(n2), r2);
  if (null == e ? void 0 : e.set)
    return e.set.call(n2.k, t2), true;
  if (!n2.P) {
    var i2 = z(p(n2), r2), o2 = null == i2 ? void 0 : i2[Q];
    if (o2 && o2.t === t2)
      return n2.o[r2] = t2, n2.R[r2] = false, true;
    if (c(t2, i2) && (void 0 !== t2 || u(n2.t, r2)))
      return true;
    E(n2), k(n2);
  }
  return n2.o[r2] === t2 && (void 0 !== t2 || r2 in n2.o) || Number.isNaN(t2) && Number.isNaN(n2.o[r2]) || (n2.o[r2] = t2, n2.R[r2] = true), true;
}, deleteProperty: function(n2, r2) {
  return void 0 !== z(n2.t, r2) || r2 in n2.t ? (n2.R[r2] = false, E(n2), k(n2)) : delete n2.R[r2], n2.o && delete n2.o[r2], true;
}, getOwnPropertyDescriptor: function(n2, r2) {
  var t2 = p(n2), e = Reflect.getOwnPropertyDescriptor(t2, r2);
  return e ? { writable: true, configurable: 1 !== n2.i || "length" !== r2, enumerable: e.enumerable, value: t2[r2] } : e;
}, defineProperty: function() {
  n(11);
}, getPrototypeOf: function(n2) {
  return Object.getPrototypeOf(n2.t);
}, setPrototypeOf: function() {
  n(12);
} };
var on = {};
i(en, function(n2, r2) {
  on[n2] = function() {
    return arguments[0] = arguments[0][0], r2.apply(this, arguments);
  };
}), on.deleteProperty = function(r2, t2) {
  return isNaN(parseInt(t2)) && n(13), on.set.call(this, r2, t2, void 0);
}, on.set = function(r2, t2, e) {
  return "length" !== t2 && isNaN(parseInt(t2)) && n(14), en.set.call(this, r2[0], t2, e, r2[0]);
};
var un = function() {
  function e(r2) {
    var e2 = this;
    this.O = B, this.D = true, this.produce = function(r3, i3, o2) {
      if ("function" == typeof r3 && "function" != typeof i3) {
        var u2 = i3;
        i3 = r3;
        var a2 = e2;
        return function(n2) {
          var r4 = this;
          void 0 === n2 && (n2 = u2);
          for (var t2 = arguments.length, e3 = Array(t2 > 1 ? t2 - 1 : 0), o3 = 1; o3 < t2; o3++)
            e3[o3 - 1] = arguments[o3];
          return a2.produce(n2, function(n3) {
            var t3;
            return (t3 = i3).call.apply(t3, [r4, n3].concat(e3));
          });
        };
      }
      var f3;
      if ("function" != typeof i3 && n(6), void 0 !== o2 && "function" != typeof o2 && n(7), t(r3)) {
        var c2 = w(e2), s2 = N(e2, r3, void 0), v2 = true;
        try {
          f3 = i3(s2), v2 = false;
        } finally {
          v2 ? g(c2) : O(c2);
        }
        return "undefined" != typeof Promise && f3 instanceof Promise ? f3.then(function(n2) {
          return j(c2, o2), P(n2, c2);
        }, function(n2) {
          throw g(c2), n2;
        }) : (j(c2, o2), P(f3, c2));
      }
      if (!r3 || "object" != typeof r3) {
        if (void 0 === (f3 = i3(r3)) && (f3 = r3), f3 === H && (f3 = void 0), e2.D && d(f3, true), o2) {
          var p2 = [], l2 = [];
          b("Patches").M(r3, f3, p2, l2), o2(p2, l2);
        }
        return f3;
      }
      n(21, r3);
    }, this.produceWithPatches = function(n2, r3) {
      if ("function" == typeof n2)
        return function(r4) {
          for (var t3 = arguments.length, i4 = Array(t3 > 1 ? t3 - 1 : 0), o3 = 1; o3 < t3; o3++)
            i4[o3 - 1] = arguments[o3];
          return e2.produceWithPatches(r4, function(r5) {
            return n2.apply(void 0, [r5].concat(i4));
          });
        };
      var t2, i3, o2 = e2.produce(n2, r3, function(n3, r4) {
        t2 = n3, i3 = r4;
      });
      return "undefined" != typeof Promise && o2 instanceof Promise ? o2.then(function(n3) {
        return [n3, t2, i3];
      }) : [o2, t2, i3];
    }, "boolean" == typeof (null == r2 ? void 0 : r2.useProxies) && this.setUseProxies(r2.useProxies), "boolean" == typeof (null == r2 ? void 0 : r2.autoFreeze) && this.setAutoFreeze(r2.autoFreeze);
  }
  var i2 = e.prototype;
  return i2.createDraft = function(e2) {
    t(e2) || n(8), r(e2) && (e2 = R(e2));
    var i3 = w(this), o2 = N(this, e2, void 0);
    return o2[Q].C = true, O(i3), o2;
  }, i2.finishDraft = function(r2, t2) {
    var e2 = r2 && r2[Q];
    e2 && e2.C || n(9), e2.I && n(10);
    var i3 = e2.A;
    return j(i3, t2), P(void 0, i3);
  }, i2.setAutoFreeze = function(n2) {
    this.D = n2;
  }, i2.setUseProxies = function(r2) {
    r2 && !B && n(20), this.O = r2;
  }, i2.applyPatches = function(n2, t2) {
    var e2;
    for (e2 = t2.length - 1; e2 >= 0; e2--) {
      var i3 = t2[e2];
      if (0 === i3.path.length && "replace" === i3.op) {
        n2 = i3.value;
        break;
      }
    }
    e2 > -1 && (t2 = t2.slice(e2 + 1));
    var o2 = b("Patches").$;
    return r(n2) ? o2(n2, t2) : this.produce(n2, function(n3) {
      return o2(n3, t2);
    });
  }, e;
}();
var an = new un();
var fn = an.produce;
var cn = an.produceWithPatches.bind(an);
var sn = an.setAutoFreeze.bind(an);
var vn = an.setUseProxies.bind(an);
var pn = an.applyPatches.bind(an);
var ln = an.createDraft.bind(an);
var dn = an.finishDraft.bind(an);
var immer_esm_default = fn;

// node_modules/@babel/runtime/helpers/esm/typeof.js
function _typeof(o2) {
  "@babel/helpers - typeof";
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) {
    return typeof o3;
  } : function(o3) {
    return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3;
  }, _typeof(o2);
}

// node_modules/@babel/runtime/helpers/esm/toPrimitive.js
function toPrimitive(t2, r2) {
  if ("object" != _typeof(t2) || !t2)
    return t2;
  var e = t2[Symbol.toPrimitive];
  if (void 0 !== e) {
    var i2 = e.call(t2, r2 || "default");
    if ("object" != _typeof(i2))
      return i2;
    throw new TypeError("@@toPrimitive must return a primitive value.");
  }
  return ("string" === r2 ? String : Number)(t2);
}

// node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
function toPropertyKey(t2) {
  var i2 = toPrimitive(t2, "string");
  return "symbol" == _typeof(i2) ? i2 : i2 + "";
}

// node_modules/@babel/runtime/helpers/esm/defineProperty.js
function _defineProperty(e, r2, t2) {
  return (r2 = toPropertyKey(r2)) in e ? Object.defineProperty(e, r2, {
    value: t2,
    enumerable: true,
    configurable: true,
    writable: true
  }) : e[r2] = t2, e;
}

// node_modules/@babel/runtime/helpers/esm/objectSpread2.js
function ownKeys(e, r2) {
  var t2 = Object.keys(e);
  if (Object.getOwnPropertySymbols) {
    var o2 = Object.getOwnPropertySymbols(e);
    r2 && (o2 = o2.filter(function(r3) {
      return Object.getOwnPropertyDescriptor(e, r3).enumerable;
    })), t2.push.apply(t2, o2);
  }
  return t2;
}
function _objectSpread2(e) {
  for (var r2 = 1; r2 < arguments.length; r2++) {
    var t2 = null != arguments[r2] ? arguments[r2] : {};
    r2 % 2 ? ownKeys(Object(t2), true).forEach(function(r3) {
      _defineProperty(e, r3, t2[r3]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys(Object(t2)).forEach(function(r3) {
      Object.defineProperty(e, r3, Object.getOwnPropertyDescriptor(t2, r3));
    });
  }
  return e;
}

// node_modules/redux/es/redux.js
var $$observable = function() {
  return typeof Symbol === "function" && Symbol.observable || "@@observable";
}();
var randomString = function randomString2() {
  return Math.random().toString(36).substring(7).split("").join(".");
};
var ActionTypes = {
  INIT: "@@redux/INIT" + randomString(),
  REPLACE: "@@redux/REPLACE" + randomString(),
  PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
    return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
  }
};
function isPlainObject(obj) {
  if (typeof obj !== "object" || obj === null)
    return false;
  var proto = obj;
  while (Object.getPrototypeOf(proto) !== null) {
    proto = Object.getPrototypeOf(proto);
  }
  return Object.getPrototypeOf(obj) === proto;
}
function miniKindOf(val) {
  if (val === void 0)
    return "undefined";
  if (val === null)
    return "null";
  var type = typeof val;
  switch (type) {
    case "boolean":
    case "string":
    case "number":
    case "symbol":
    case "function": {
      return type;
    }
  }
  if (Array.isArray(val))
    return "array";
  if (isDate(val))
    return "date";
  if (isError(val))
    return "error";
  var constructorName = ctorName(val);
  switch (constructorName) {
    case "Symbol":
    case "Promise":
    case "WeakMap":
    case "WeakSet":
    case "Map":
    case "Set":
      return constructorName;
  }
  return type.slice(8, -1).toLowerCase().replace(/\s/g, "");
}
function ctorName(val) {
  return typeof val.constructor === "function" ? val.constructor.name : null;
}
function isError(val) {
  return val instanceof Error || typeof val.message === "string" && val.constructor && typeof val.constructor.stackTraceLimit === "number";
}
function isDate(val) {
  if (val instanceof Date)
    return true;
  return typeof val.toDateString === "function" && typeof val.getDate === "function" && typeof val.setDate === "function";
}
function kindOf(val) {
  var typeOfVal = typeof val;
  if (true) {
    typeOfVal = miniKindOf(val);
  }
  return typeOfVal;
}
function createStore(reducer, preloadedState, enhancer) {
  var _ref2;
  if (typeof preloadedState === "function" && typeof enhancer === "function" || typeof enhancer === "function" && typeof arguments[3] === "function") {
    throw new Error(false ? formatProdErrorMessage(0) : "It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");
  }
  if (typeof preloadedState === "function" && typeof enhancer === "undefined") {
    enhancer = preloadedState;
    preloadedState = void 0;
  }
  if (typeof enhancer !== "undefined") {
    if (typeof enhancer !== "function") {
      throw new Error(false ? formatProdErrorMessage(1) : "Expected the enhancer to be a function. Instead, received: '" + kindOf(enhancer) + "'");
    }
    return enhancer(createStore)(reducer, preloadedState);
  }
  if (typeof reducer !== "function") {
    throw new Error(false ? formatProdErrorMessage(2) : "Expected the root reducer to be a function. Instead, received: '" + kindOf(reducer) + "'");
  }
  var currentReducer = reducer;
  var currentState = preloadedState;
  var currentListeners = [];
  var nextListeners = currentListeners;
  var isDispatching = false;
  function ensureCanMutateNextListeners() {
    if (nextListeners === currentListeners) {
      nextListeners = currentListeners.slice();
    }
  }
  function getState() {
    if (isDispatching) {
      throw new Error(false ? formatProdErrorMessage(3) : "You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");
    }
    return currentState;
  }
  function subscribe2(listener2) {
    if (typeof listener2 !== "function") {
      throw new Error(false ? formatProdErrorMessage(4) : "Expected the listener to be a function. Instead, received: '" + kindOf(listener2) + "'");
    }
    if (isDispatching) {
      throw new Error(false ? formatProdErrorMessage(5) : "You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");
    }
    var isSubscribed = true;
    ensureCanMutateNextListeners();
    nextListeners.push(listener2);
    return function unsubscribe() {
      if (!isSubscribed) {
        return;
      }
      if (isDispatching) {
        throw new Error(false ? formatProdErrorMessage(6) : "You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");
      }
      isSubscribed = false;
      ensureCanMutateNextListeners();
      var index = nextListeners.indexOf(listener2);
      nextListeners.splice(index, 1);
      currentListeners = null;
    };
  }
  function dispatch(action) {
    if (!isPlainObject(action)) {
      throw new Error(false ? formatProdErrorMessage(7) : "Actions must be plain objects. Instead, the actual type was: '" + kindOf(action) + "'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");
    }
    if (typeof action.type === "undefined") {
      throw new Error(false ? formatProdErrorMessage(8) : 'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');
    }
    if (isDispatching) {
      throw new Error(false ? formatProdErrorMessage(9) : "Reducers may not dispatch actions.");
    }
    try {
      isDispatching = true;
      currentState = currentReducer(currentState, action);
    } finally {
      isDispatching = false;
    }
    var listeners = currentListeners = nextListeners;
    for (var i2 = 0; i2 < listeners.length; i2++) {
      var listener2 = listeners[i2];
      listener2();
    }
    return action;
  }
  function replaceReducer(nextReducer) {
    if (typeof nextReducer !== "function") {
      throw new Error(false ? formatProdErrorMessage(10) : "Expected the nextReducer to be a function. Instead, received: '" + kindOf(nextReducer));
    }
    currentReducer = nextReducer;
    dispatch({
      type: ActionTypes.REPLACE
    });
  }
  function observable() {
    var _ref;
    var outerSubscribe = subscribe2;
    return _ref = {
      /**
       * The minimal observable subscription method.
       * @param {Object} observer Any object that can be used as an observer.
       * The observer object should have a `next` method.
       * @returns {subscription} An object with an `unsubscribe` method that can
       * be used to unsubscribe the observable from the store, and prevent further
       * emission of values from the observable.
       */
      subscribe: function subscribe3(observer) {
        if (typeof observer !== "object" || observer === null) {
          throw new Error(false ? formatProdErrorMessage(11) : "Expected the observer to be an object. Instead, received: '" + kindOf(observer) + "'");
        }
        function observeState() {
          if (observer.next) {
            observer.next(getState());
          }
        }
        observeState();
        var unsubscribe = outerSubscribe(observeState);
        return {
          unsubscribe
        };
      }
    }, _ref[$$observable] = function() {
      return this;
    }, _ref;
  }
  dispatch({
    type: ActionTypes.INIT
  });
  return _ref2 = {
    dispatch,
    subscribe: subscribe2,
    getState,
    replaceReducer
  }, _ref2[$$observable] = observable, _ref2;
}
function warning(message) {
  if (typeof console !== "undefined" && typeof console.error === "function") {
    console.error(message);
  }
  try {
    throw new Error(message);
  } catch (e) {
  }
}
function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
  var reducerKeys = Object.keys(reducers);
  var argumentName = action && action.type === ActionTypes.INIT ? "preloadedState argument passed to createStore" : "previous state received by the reducer";
  if (reducerKeys.length === 0) {
    return "Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";
  }
  if (!isPlainObject(inputState)) {
    return "The " + argumentName + ' has unexpected type of "' + kindOf(inputState) + '". Expected argument to be an object with the following ' + ('keys: "' + reducerKeys.join('", "') + '"');
  }
  var unexpectedKeys = Object.keys(inputState).filter(function(key) {
    return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];
  });
  unexpectedKeys.forEach(function(key) {
    unexpectedKeyCache[key] = true;
  });
  if (action && action.type === ActionTypes.REPLACE)
    return;
  if (unexpectedKeys.length > 0) {
    return "Unexpected " + (unexpectedKeys.length > 1 ? "keys" : "key") + " " + ('"' + unexpectedKeys.join('", "') + '" found in ' + argumentName + ". ") + "Expected to find one of the known reducer keys instead: " + ('"' + reducerKeys.join('", "') + '". Unexpected keys will be ignored.');
  }
}
function assertReducerShape(reducers) {
  Object.keys(reducers).forEach(function(key) {
    var reducer = reducers[key];
    var initialState2 = reducer(void 0, {
      type: ActionTypes.INIT
    });
    if (typeof initialState2 === "undefined") {
      throw new Error(false ? formatProdErrorMessage(12) : 'The slice reducer for key "' + key + `" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);
    }
    if (typeof reducer(void 0, {
      type: ActionTypes.PROBE_UNKNOWN_ACTION()
    }) === "undefined") {
      throw new Error(false ? formatProdErrorMessage(13) : 'The slice reducer for key "' + key + '" returned undefined when probed with a random type. ' + ("Don't try to handle '" + ActionTypes.INIT + `' or other actions in "redux/*" `) + "namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.");
    }
  });
}
function combineReducers(reducers) {
  var reducerKeys = Object.keys(reducers);
  var finalReducers = {};
  for (var i2 = 0; i2 < reducerKeys.length; i2++) {
    var key = reducerKeys[i2];
    if (true) {
      if (typeof reducers[key] === "undefined") {
        warning('No reducer provided for key "' + key + '"');
      }
    }
    if (typeof reducers[key] === "function") {
      finalReducers[key] = reducers[key];
    }
  }
  var finalReducerKeys = Object.keys(finalReducers);
  var unexpectedKeyCache;
  if (true) {
    unexpectedKeyCache = {};
  }
  var shapeAssertionError;
  try {
    assertReducerShape(finalReducers);
  } catch (e) {
    shapeAssertionError = e;
  }
  return function combination(state, action) {
    if (state === void 0) {
      state = {};
    }
    if (shapeAssertionError) {
      throw shapeAssertionError;
    }
    if (true) {
      var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
      if (warningMessage) {
        warning(warningMessage);
      }
    }
    var hasChanged = false;
    var nextState = {};
    for (var _i = 0; _i < finalReducerKeys.length; _i++) {
      var _key = finalReducerKeys[_i];
      var reducer = finalReducers[_key];
      var previousStateForKey = state[_key];
      var nextStateForKey = reducer(previousStateForKey, action);
      if (typeof nextStateForKey === "undefined") {
        var actionType = action && action.type;
        throw new Error(false ? formatProdErrorMessage(14) : "When called with an action of type " + (actionType ? '"' + String(actionType) + '"' : "(unknown type)") + ', the slice reducer for key "' + _key + '" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.');
      }
      nextState[_key] = nextStateForKey;
      hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
    }
    hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
    return hasChanged ? nextState : state;
  };
}
function compose() {
  for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
    funcs[_key] = arguments[_key];
  }
  if (funcs.length === 0) {
    return function(arg) {
      return arg;
    };
  }
  if (funcs.length === 1) {
    return funcs[0];
  }
  return funcs.reduce(function(a2, b2) {
    return function() {
      return a2(b2.apply(void 0, arguments));
    };
  });
}
function applyMiddleware() {
  for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {
    middlewares[_key] = arguments[_key];
  }
  return function(createStore2) {
    return function() {
      var store2 = createStore2.apply(void 0, arguments);
      var _dispatch = function dispatch() {
        throw new Error(false ? formatProdErrorMessage(15) : "Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.");
      };
      var middlewareAPI = {
        getState: store2.getState,
        dispatch: function dispatch() {
          return _dispatch.apply(void 0, arguments);
        }
      };
      var chain = middlewares.map(function(middleware) {
        return middleware(middlewareAPI);
      });
      _dispatch = compose.apply(void 0, chain)(store2.dispatch);
      return _objectSpread2(_objectSpread2({}, store2), {}, {
        dispatch: _dispatch
      });
    };
  };
}

// node_modules/redux-thunk/es/index.js
function createThunkMiddleware(extraArgument) {
  var middleware = function middleware2(_ref) {
    var dispatch = _ref.dispatch, getState = _ref.getState;
    return function(next) {
      return function(action) {
        if (typeof action === "function") {
          return action(dispatch, getState, extraArgument);
        }
        return next(action);
      };
    };
  };
  return middleware;
}
var thunk = createThunkMiddleware();
thunk.withExtraArgument = createThunkMiddleware;
var es_default = thunk;

// node_modules/@reduxjs/toolkit/dist/redux-toolkit.esm.js
var __extends = /* @__PURE__ */ function() {
  var extendStatics = function(d2, b2) {
    extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) {
      d3.__proto__ = b3;
    } || function(d3, b3) {
      for (var p2 in b3)
        if (Object.prototype.hasOwnProperty.call(b3, p2))
          d3[p2] = b3[p2];
    };
    return extendStatics(d2, b2);
  };
  return function(d2, b2) {
    if (typeof b2 !== "function" && b2 !== null)
      throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null");
    extendStatics(d2, b2);
    function __() {
      this.constructor = d2;
    }
    d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
  };
}();
var __generator = function(thisArg, body) {
  var _7 = { label: 0, sent: function() {
    if (t2[0] & 1)
      throw t2[1];
    return t2[1];
  }, trys: [], ops: [] }, f3, y2, t2, g2;
  return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() {
    return this;
  }), g2;
  function verb(n2) {
    return function(v2) {
      return step([n2, v2]);
    };
  }
  function step(op) {
    if (f3)
      throw new TypeError("Generator is already executing.");
    while (_7)
      try {
        if (f3 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done)
          return t2;
        if (y2 = 0, t2)
          op = [op[0] & 2, t2.value];
        switch (op[0]) {
          case 0:
          case 1:
            t2 = op;
            break;
          case 4:
            _7.label++;
            return { value: op[1], done: false };
          case 5:
            _7.label++;
            y2 = op[1];
            op = [0];
            continue;
          case 7:
            op = _7.ops.pop();
            _7.trys.pop();
            continue;
          default:
            if (!(t2 = _7.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) {
              _7 = 0;
              continue;
            }
            if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) {
              _7.label = op[1];
              break;
            }
            if (op[0] === 6 && _7.label < t2[1]) {
              _7.label = t2[1];
              t2 = op;
              break;
            }
            if (t2 && _7.label < t2[2]) {
              _7.label = t2[2];
              _7.ops.push(op);
              break;
            }
            if (t2[2])
              _7.ops.pop();
            _7.trys.pop();
            continue;
        }
        op = body.call(thisArg, _7);
      } catch (e) {
        op = [6, e];
        y2 = 0;
      } finally {
        f3 = t2 = 0;
      }
    if (op[0] & 5)
      throw op[1];
    return { value: op[0] ? op[1] : void 0, done: true };
  }
};
var __spreadArray = function(to, from) {
  for (var i2 = 0, il = from.length, j2 = to.length; i2 < il; i2++, j2++)
    to[j2] = from[i2];
  return to;
};
var __defProp2 = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = function(obj, key, value) {
  return key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
};
var __spreadValues = function(a2, b2) {
  for (var prop in b2 || (b2 = {}))
    if (__hasOwnProp2.call(b2, prop))
      __defNormalProp(a2, prop, b2[prop]);
  if (__getOwnPropSymbols)
    for (var _i = 0, _c = __getOwnPropSymbols(b2); _i < _c.length; _i++) {
      var prop = _c[_i];
      if (__propIsEnum.call(b2, prop))
        __defNormalProp(a2, prop, b2[prop]);
    }
  return a2;
};
var __spreadProps = function(a2, b2) {
  return __defProps(a2, __getOwnPropDescs(b2));
};
var __async = function(__this, __arguments, generator) {
  return new Promise(function(resolve, reject) {
    var fulfilled = function(value) {
      try {
        step(generator.next(value));
      } catch (e) {
        reject(e);
      }
    };
    var rejected = function(value) {
      try {
        step(generator.throw(value));
      } catch (e) {
        reject(e);
      }
    };
    var step = function(x2) {
      return x2.done ? resolve(x2.value) : Promise.resolve(x2.value).then(fulfilled, rejected);
    };
    step((generator = generator.apply(__this, __arguments)).next());
  });
};
var composeWithDevTools = typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : function() {
  if (arguments.length === 0)
    return void 0;
  if (typeof arguments[0] === "object")
    return compose;
  return compose.apply(null, arguments);
};
var devToolsEnhancer = typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION__ ? window.__REDUX_DEVTOOLS_EXTENSION__ : function() {
  return function(noop2) {
    return noop2;
  };
};
function isPlainObject2(value) {
  if (typeof value !== "object" || value === null)
    return false;
  var proto = Object.getPrototypeOf(value);
  if (proto === null)
    return true;
  var baseProto = proto;
  while (Object.getPrototypeOf(baseProto) !== null) {
    baseProto = Object.getPrototypeOf(baseProto);
  }
  return proto === baseProto;
}
var hasMatchFunction = function(v2) {
  return v2 && typeof v2.match === "function";
};
function createAction(type, prepareAction) {
  function actionCreator() {
    var args = [];
    for (var _i = 0; _i < arguments.length; _i++) {
      args[_i] = arguments[_i];
    }
    if (prepareAction) {
      var prepared = prepareAction.apply(void 0, args);
      if (!prepared) {
        throw new Error("prepareAction did not return an object");
      }
      return __spreadValues(__spreadValues({
        type,
        payload: prepared.payload
      }, "meta" in prepared && { meta: prepared.meta }), "error" in prepared && { error: prepared.error });
    }
    return { type, payload: args[0] };
  }
  actionCreator.toString = function() {
    return "" + type;
  };
  actionCreator.type = type;
  actionCreator.match = function(action) {
    return action.type === type;
  };
  return actionCreator;
}
function isActionCreator(action) {
  return typeof action === "function" && "type" in action && hasMatchFunction(action);
}
function getMessage(type) {
  var splitType = type ? ("" + type).split("/") : [];
  var actionName = splitType[splitType.length - 1] || "actionCreator";
  return 'Detected an action creator with type "' + (type || "unknown") + "\" being dispatched. \nMake sure you're calling the action creator before dispatching, i.e. `dispatch(" + actionName + "())` instead of `dispatch(" + actionName + ")`. This is necessary even if the action has no payload.";
}
function createActionCreatorInvariantMiddleware(options) {
  if (options === void 0) {
    options = {};
  }
  if (false) {
    return function() {
      return function(next) {
        return function(action) {
          return next(action);
        };
      };
    };
  }
  var _c = options.isActionCreator, isActionCreator2 = _c === void 0 ? isActionCreator : _c;
  return function() {
    return function(next) {
      return function(action) {
        if (isActionCreator2(action)) {
          console.warn(getMessage(action.type));
        }
        return next(action);
      };
    };
  };
}
function getTimeMeasureUtils(maxDelay, fnName) {
  var elapsed = 0;
  return {
    measureTime: function(fn2) {
      var started = Date.now();
      try {
        return fn2();
      } finally {
        var finished = Date.now();
        elapsed += finished - started;
      }
    },
    warnIfExceeded: function() {
      if (elapsed > maxDelay) {
        console.warn(fnName + " took " + elapsed + "ms, which is more than the warning threshold of " + maxDelay + "ms. \nIf your state or actions are very large, you may want to disable the middleware as it might cause too much of a slowdown in development mode. See https://redux-toolkit.js.org/api/getDefaultMiddleware for instructions.\nIt is disabled in production builds, so you don't need to worry about that.");
      }
    }
  };
}
var MiddlewareArray = (
  /** @class */
  function(_super) {
    __extends(MiddlewareArray2, _super);
    function MiddlewareArray2() {
      var args = [];
      for (var _i = 0; _i < arguments.length; _i++) {
        args[_i] = arguments[_i];
      }
      var _this = _super.apply(this, args) || this;
      Object.setPrototypeOf(_this, MiddlewareArray2.prototype);
      return _this;
    }
    Object.defineProperty(MiddlewareArray2, Symbol.species, {
      get: function() {
        return MiddlewareArray2;
      },
      enumerable: false,
      configurable: true
    });
    MiddlewareArray2.prototype.concat = function() {
      var arr = [];
      for (var _i = 0; _i < arguments.length; _i++) {
        arr[_i] = arguments[_i];
      }
      return _super.prototype.concat.apply(this, arr);
    };
    MiddlewareArray2.prototype.prepend = function() {
      var arr = [];
      for (var _i = 0; _i < arguments.length; _i++) {
        arr[_i] = arguments[_i];
      }
      if (arr.length === 1 && Array.isArray(arr[0])) {
        return new (MiddlewareArray2.bind.apply(MiddlewareArray2, __spreadArray([void 0], arr[0].concat(this))))();
      }
      return new (MiddlewareArray2.bind.apply(MiddlewareArray2, __spreadArray([void 0], arr.concat(this))))();
    };
    return MiddlewareArray2;
  }(Array)
);
var EnhancerArray = (
  /** @class */
  function(_super) {
    __extends(EnhancerArray2, _super);
    function EnhancerArray2() {
      var args = [];
      for (var _i = 0; _i < arguments.length; _i++) {
        args[_i] = arguments[_i];
      }
      var _this = _super.apply(this, args) || this;
      Object.setPrototypeOf(_this, EnhancerArray2.prototype);
      return _this;
    }
    Object.defineProperty(EnhancerArray2, Symbol.species, {
      get: function() {
        return EnhancerArray2;
      },
      enumerable: false,
      configurable: true
    });
    EnhancerArray2.prototype.concat = function() {
      var arr = [];
      for (var _i = 0; _i < arguments.length; _i++) {
        arr[_i] = arguments[_i];
      }
      return _super.prototype.concat.apply(this, arr);
    };
    EnhancerArray2.prototype.prepend = function() {
      var arr = [];
      for (var _i = 0; _i < arguments.length; _i++) {
        arr[_i] = arguments[_i];
      }
      if (arr.length === 1 && Array.isArray(arr[0])) {
        return new (EnhancerArray2.bind.apply(EnhancerArray2, __spreadArray([void 0], arr[0].concat(this))))();
      }
      return new (EnhancerArray2.bind.apply(EnhancerArray2, __spreadArray([void 0], arr.concat(this))))();
    };
    return EnhancerArray2;
  }(Array)
);
function freezeDraftable(val) {
  return t(val) ? immer_esm_default(val, function() {
  }) : val;
}
var isProduction = false;
var prefix = "Invariant failed";
function invariant(condition, message) {
  if (condition) {
    return;
  }
  if (isProduction) {
    throw new Error(prefix);
  }
  throw new Error(prefix + ": " + (message || ""));
}
function stringify(obj, serializer, indent, decycler) {
  return JSON.stringify(obj, getSerialize(serializer, decycler), indent);
}
function getSerialize(serializer, decycler) {
  var stack = [], keys = [];
  if (!decycler)
    decycler = function(_7, value) {
      if (stack[0] === value)
        return "[Circular ~]";
      return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]";
    };
  return function(key, value) {
    if (stack.length > 0) {
      var thisPos = stack.indexOf(this);
      ~thisPos ? stack.splice(thisPos + 1) : stack.push(this);
      ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key);
      if (~stack.indexOf(value))
        value = decycler.call(this, key, value);
    } else
      stack.push(value);
    return serializer == null ? value : serializer.call(this, key, value);
  };
}
function isImmutableDefault(value) {
  return typeof value !== "object" || value == null || Object.isFrozen(value);
}
function trackForMutations(isImmutable, ignorePaths, obj) {
  var trackedProperties = trackProperties(isImmutable, ignorePaths, obj);
  return {
    detectMutations: function() {
      return detectMutations(isImmutable, ignorePaths, trackedProperties, obj);
    }
  };
}
function trackProperties(isImmutable, ignorePaths, obj, path, checkedObjects) {
  if (ignorePaths === void 0) {
    ignorePaths = [];
  }
  if (path === void 0) {
    path = "";
  }
  if (checkedObjects === void 0) {
    checkedObjects = /* @__PURE__ */ new Set();
  }
  var tracked = { value: obj };
  if (!isImmutable(obj) && !checkedObjects.has(obj)) {
    checkedObjects.add(obj);
    tracked.children = {};
    for (var key in obj) {
      var childPath = path ? path + "." + key : key;
      if (ignorePaths.length && ignorePaths.indexOf(childPath) !== -1) {
        continue;
      }
      tracked.children[key] = trackProperties(isImmutable, ignorePaths, obj[key], childPath);
    }
  }
  return tracked;
}
function detectMutations(isImmutable, ignoredPaths, trackedProperty, obj, sameParentRef, path) {
  if (ignoredPaths === void 0) {
    ignoredPaths = [];
  }
  if (sameParentRef === void 0) {
    sameParentRef = false;
  }
  if (path === void 0) {
    path = "";
  }
  var prevObj = trackedProperty ? trackedProperty.value : void 0;
  var sameRef = prevObj === obj;
  if (sameParentRef && !sameRef && !Number.isNaN(obj)) {
    return { wasMutated: true, path };
  }
  if (isImmutable(prevObj) || isImmutable(obj)) {
    return { wasMutated: false };
  }
  var keysToDetect = {};
  for (var key in trackedProperty.children) {
    keysToDetect[key] = true;
  }
  for (var key in obj) {
    keysToDetect[key] = true;
  }
  var hasIgnoredPaths = ignoredPaths.length > 0;
  var _loop_1 = function(key2) {
    var nestedPath = path ? path + "." + key2 : key2;
    if (hasIgnoredPaths) {
      var hasMatches = ignoredPaths.some(function(ignored) {
        if (ignored instanceof RegExp) {
          return ignored.test(nestedPath);
        }
        return nestedPath === ignored;
      });
      if (hasMatches) {
        return "continue";
      }
    }
    var result = detectMutations(isImmutable, ignoredPaths, trackedProperty.children[key2], obj[key2], sameRef, nestedPath);
    if (result.wasMutated) {
      return { value: result };
    }
  };
  for (var key in keysToDetect) {
    var state_1 = _loop_1(key);
    if (typeof state_1 === "object")
      return state_1.value;
  }
  return { wasMutated: false };
}
function createImmutableStateInvariantMiddleware(options) {
  if (options === void 0) {
    options = {};
  }
  if (false) {
    return function() {
      return function(next) {
        return function(action) {
          return next(action);
        };
      };
    };
  }
  var _c = options.isImmutable, isImmutable = _c === void 0 ? isImmutableDefault : _c, ignoredPaths = options.ignoredPaths, _d = options.warnAfter, warnAfter = _d === void 0 ? 32 : _d, ignore = options.ignore;
  ignoredPaths = ignoredPaths || ignore;
  var track = trackForMutations.bind(null, isImmutable, ignoredPaths);
  return function(_c2) {
    var getState = _c2.getState;
    var state = getState();
    var tracker = track(state);
    var result;
    return function(next) {
      return function(action) {
        var measureUtils = getTimeMeasureUtils(warnAfter, "ImmutableStateInvariantMiddleware");
        measureUtils.measureTime(function() {
          state = getState();
          result = tracker.detectMutations();
          tracker = track(state);
          invariant(!result.wasMutated, "A state mutation was detected between dispatches, in the path '" + (result.path || "") + "'.  This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)");
        });
        var dispatchedAction = next(action);
        measureUtils.measureTime(function() {
          state = getState();
          result = tracker.detectMutations();
          tracker = track(state);
          result.wasMutated && invariant(!result.wasMutated, "A state mutation was detected inside a dispatch, in the path: " + (result.path || "") + ". Take a look at the reducer(s) handling the action " + stringify(action) + ". (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)");
        });
        measureUtils.warnIfExceeded();
        return dispatchedAction;
      };
    };
  };
}
function isPlain(val) {
  var type = typeof val;
  return val == null || type === "string" || type === "boolean" || type === "number" || Array.isArray(val) || isPlainObject2(val);
}
function findNonSerializableValue(value, path, isSerializable, getEntries, ignoredPaths, cache) {
  if (path === void 0) {
    path = "";
  }
  if (isSerializable === void 0) {
    isSerializable = isPlain;
  }
  if (ignoredPaths === void 0) {
    ignoredPaths = [];
  }
  var foundNestedSerializable;
  if (!isSerializable(value)) {
    return {
      keyPath: path || "<root>",
      value
    };
  }
  if (typeof value !== "object" || value === null) {
    return false;
  }
  if (cache == null ? void 0 : cache.has(value))
    return false;
  var entries = getEntries != null ? getEntries(value) : Object.entries(value);
  var hasIgnoredPaths = ignoredPaths.length > 0;
  var _loop_2 = function(key2, nestedValue2) {
    var nestedPath = path ? path + "." + key2 : key2;
    if (hasIgnoredPaths) {
      var hasMatches = ignoredPaths.some(function(ignored) {
        if (ignored instanceof RegExp) {
          return ignored.test(nestedPath);
        }
        return nestedPath === ignored;
      });
      if (hasMatches) {
        return "continue";
      }
    }
    if (!isSerializable(nestedValue2)) {
      return { value: {
        keyPath: nestedPath,
        value: nestedValue2
      } };
    }
    if (typeof nestedValue2 === "object") {
      foundNestedSerializable = findNonSerializableValue(nestedValue2, nestedPath, isSerializable, getEntries, ignoredPaths, cache);
      if (foundNestedSerializable) {
        return { value: foundNestedSerializable };
      }
    }
  };
  for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
    var _c = entries_1[_i], key = _c[0], nestedValue = _c[1];
    var state_2 = _loop_2(key, nestedValue);
    if (typeof state_2 === "object")
      return state_2.value;
  }
  if (cache && isNestedFrozen(value))
    cache.add(value);
  return false;
}
function isNestedFrozen(value) {
  if (!Object.isFrozen(value))
    return false;
  for (var _i = 0, _c = Object.values(value); _i < _c.length; _i++) {
    var nestedValue = _c[_i];
    if (typeof nestedValue !== "object" || nestedValue === null)
      continue;
    if (!isNestedFrozen(nestedValue))
      return false;
  }
  return true;
}
function createSerializableStateInvariantMiddleware(options) {
  if (options === void 0) {
    options = {};
  }
  if (false) {
    return function() {
      return function(next) {
        return function(action) {
          return next(action);
        };
      };
    };
  }
  var _c = options.isSerializable, isSerializable = _c === void 0 ? isPlain : _c, getEntries = options.getEntries, _d = options.ignoredActions, ignoredActions = _d === void 0 ? [] : _d, _e = options.ignoredActionPaths, ignoredActionPaths = _e === void 0 ? ["meta.arg", "meta.baseQueryMeta"] : _e, _f = options.ignoredPaths, ignoredPaths = _f === void 0 ? [] : _f, _g = options.warnAfter, warnAfter = _g === void 0 ? 32 : _g, _h = options.ignoreState, ignoreState = _h === void 0 ? false : _h, _j = options.ignoreActions, ignoreActions = _j === void 0 ? false : _j, _k = options.disableCache, disableCache = _k === void 0 ? false : _k;
  var cache = !disableCache && WeakSet ? /* @__PURE__ */ new WeakSet() : void 0;
  return function(storeAPI) {
    return function(next) {
      return function(action) {
        var result = next(action);
        var measureUtils = getTimeMeasureUtils(warnAfter, "SerializableStateInvariantMiddleware");
        if (!ignoreActions && !(ignoredActions.length && ignoredActions.indexOf(action.type) !== -1)) {
          measureUtils.measureTime(function() {
            var foundActionNonSerializableValue = findNonSerializableValue(action, "", isSerializable, getEntries, ignoredActionPaths, cache);
            if (foundActionNonSerializableValue) {
              var keyPath = foundActionNonSerializableValue.keyPath, value = foundActionNonSerializableValue.value;
              console.error("A non-serializable value was detected in an action, in the path: `" + keyPath + "`. Value:", value, "\nTake a look at the logic that dispatched this action: ", action, "\n(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)", "\n(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)");
            }
          });
        }
        if (!ignoreState) {
          measureUtils.measureTime(function() {
            var state = storeAPI.getState();
            var foundStateNonSerializableValue = findNonSerializableValue(state, "", isSerializable, getEntries, ignoredPaths, cache);
            if (foundStateNonSerializableValue) {
              var keyPath = foundStateNonSerializableValue.keyPath, value = foundStateNonSerializableValue.value;
              console.error("A non-serializable value was detected in the state, in the path: `" + keyPath + "`. Value:", value, "\nTake a look at the reducer(s) handling this action type: " + action.type + ".\n(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)");
            }
          });
          measureUtils.warnIfExceeded();
        }
        return result;
      };
    };
  };
}
function isBoolean(x2) {
  return typeof x2 === "boolean";
}
function curryGetDefaultMiddleware() {
  return function curriedGetDefaultMiddleware(options) {
    return getDefaultMiddleware(options);
  };
}
function getDefaultMiddleware(options) {
  if (options === void 0) {
    options = {};
  }
  var _c = options.thunk, thunk2 = _c === void 0 ? true : _c, _d = options.immutableCheck, immutableCheck = _d === void 0 ? true : _d, _e = options.serializableCheck, serializableCheck = _e === void 0 ? true : _e, _f = options.actionCreatorCheck, actionCreatorCheck = _f === void 0 ? true : _f;
  var middlewareArray = new MiddlewareArray();
  if (thunk2) {
    if (isBoolean(thunk2)) {
      middlewareArray.push(es_default);
    } else {
      middlewareArray.push(es_default.withExtraArgument(thunk2.extraArgument));
    }
  }
  if (true) {
    if (immutableCheck) {
      var immutableOptions = {};
      if (!isBoolean(immutableCheck)) {
        immutableOptions = immutableCheck;
      }
      middlewareArray.unshift(createImmutableStateInvariantMiddleware(immutableOptions));
    }
    if (serializableCheck) {
      var serializableOptions = {};
      if (!isBoolean(serializableCheck)) {
        serializableOptions = serializableCheck;
      }
      middlewareArray.push(createSerializableStateInvariantMiddleware(serializableOptions));
    }
    if (actionCreatorCheck) {
      var actionCreatorOptions = {};
      if (!isBoolean(actionCreatorCheck)) {
        actionCreatorOptions = actionCreatorCheck;
      }
      middlewareArray.unshift(createActionCreatorInvariantMiddleware(actionCreatorOptions));
    }
  }
  return middlewareArray;
}
var IS_PRODUCTION = false;
function configureStore(options) {
  var curriedGetDefaultMiddleware = curryGetDefaultMiddleware();
  var _c = options || {}, _d = _c.reducer, reducer = _d === void 0 ? void 0 : _d, _e = _c.middleware, middleware = _e === void 0 ? curriedGetDefaultMiddleware() : _e, _f = _c.devTools, devTools = _f === void 0 ? true : _f, _g = _c.preloadedState, preloadedState = _g === void 0 ? void 0 : _g, _h = _c.enhancers, enhancers = _h === void 0 ? void 0 : _h;
  var rootReducer;
  if (typeof reducer === "function") {
    rootReducer = reducer;
  } else if (isPlainObject2(reducer)) {
    rootReducer = combineReducers(reducer);
  } else {
    throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');
  }
  var finalMiddleware = middleware;
  if (typeof finalMiddleware === "function") {
    finalMiddleware = finalMiddleware(curriedGetDefaultMiddleware);
    if (!IS_PRODUCTION && !Array.isArray(finalMiddleware)) {
      throw new Error("when using a middleware builder function, an array of middleware must be returned");
    }
  }
  if (!IS_PRODUCTION && finalMiddleware.some(function(item) {
    return typeof item !== "function";
  })) {
    throw new Error("each middleware provided to configureStore must be a function");
  }
  var middlewareEnhancer = applyMiddleware.apply(void 0, finalMiddleware);
  var finalCompose = compose;
  if (devTools) {
    finalCompose = composeWithDevTools(__spreadValues({
      trace: !IS_PRODUCTION
    }, typeof devTools === "object" && devTools));
  }
  var defaultEnhancers = new EnhancerArray(middlewareEnhancer);
  var storeEnhancers = defaultEnhancers;
  if (Array.isArray(enhancers)) {
    storeEnhancers = __spreadArray([middlewareEnhancer], enhancers);
  } else if (typeof enhancers === "function") {
    storeEnhancers = enhancers(defaultEnhancers);
  }
  var composedEnhancer = finalCompose.apply(void 0, storeEnhancers);
  return createStore(rootReducer, preloadedState, composedEnhancer);
}
function executeReducerBuilderCallback(builderCallback) {
  var actionsMap = {};
  var actionMatchers = [];
  var defaultCaseReducer;
  var builder = {
    addCase: function(typeOrActionCreator, reducer) {
      if (true) {
        if (actionMatchers.length > 0) {
          throw new Error("`builder.addCase` should only be called before calling `builder.addMatcher`");
        }
        if (defaultCaseReducer) {
          throw new Error("`builder.addCase` should only be called before calling `builder.addDefaultCase`");
        }
      }
      var type = typeof typeOrActionCreator === "string" ? typeOrActionCreator : typeOrActionCreator.type;
      if (!type) {
        throw new Error("`builder.addCase` cannot be called with an empty action type");
      }
      if (type in actionsMap) {
        throw new Error("`builder.addCase` cannot be called with two reducers for the same action type");
      }
      actionsMap[type] = reducer;
      return builder;
    },
    addMatcher: function(matcher, reducer) {
      if (true) {
        if (defaultCaseReducer) {
          throw new Error("`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");
        }
      }
      actionMatchers.push({ matcher, reducer });
      return builder;
    },
    addDefaultCase: function(reducer) {
      if (true) {
        if (defaultCaseReducer) {
          throw new Error("`builder.addDefaultCase` can only be called once");
        }
      }
      defaultCaseReducer = reducer;
      return builder;
    }
  };
  builderCallback(builder);
  return [actionsMap, actionMatchers, defaultCaseReducer];
}
function isStateFunction(x2) {
  return typeof x2 === "function";
}
var hasWarnedAboutObjectNotation = false;
function createReducer(initialState2, mapOrBuilderCallback, actionMatchers, defaultCaseReducer) {
  if (actionMatchers === void 0) {
    actionMatchers = [];
  }
  if (true) {
    if (typeof mapOrBuilderCallback === "object") {
      if (!hasWarnedAboutObjectNotation) {
        hasWarnedAboutObjectNotation = true;
        console.warn("The object notation for `createReducer` is deprecated, and will be removed in RTK 2.0. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");
      }
    }
  }
  var _c = typeof mapOrBuilderCallback === "function" ? executeReducerBuilderCallback(mapOrBuilderCallback) : [mapOrBuilderCallback, actionMatchers, defaultCaseReducer], actionsMap = _c[0], finalActionMatchers = _c[1], finalDefaultCaseReducer = _c[2];
  var getInitialState;
  if (isStateFunction(initialState2)) {
    getInitialState = function() {
      return freezeDraftable(initialState2());
    };
  } else {
    var frozenInitialState_1 = freezeDraftable(initialState2);
    getInitialState = function() {
      return frozenInitialState_1;
    };
  }
  function reducer(state, action) {
    if (state === void 0) {
      state = getInitialState();
    }
    var caseReducers = __spreadArray([
      actionsMap[action.type]
    ], finalActionMatchers.filter(function(_c2) {
      var matcher = _c2.matcher;
      return matcher(action);
    }).map(function(_c2) {
      var reducer2 = _c2.reducer;
      return reducer2;
    }));
    if (caseReducers.filter(function(cr) {
      return !!cr;
    }).length === 0) {
      caseReducers = [finalDefaultCaseReducer];
    }
    return caseReducers.reduce(function(previousState, caseReducer) {
      if (caseReducer) {
        if (r(previousState)) {
          var draft = previousState;
          var result = caseReducer(draft, action);
          if (result === void 0) {
            return previousState;
          }
          return result;
        } else if (!t(previousState)) {
          var result = caseReducer(previousState, action);
          if (result === void 0) {
            if (previousState === null) {
              return previousState;
            }
            throw Error("A case reducer on a non-draftable value must not return undefined");
          }
          return result;
        } else {
          return immer_esm_default(previousState, function(draft2) {
            return caseReducer(draft2, action);
          });
        }
      }
      return previousState;
    }, state);
  }
  reducer.getInitialState = getInitialState;
  return reducer;
}
var hasWarnedAboutObjectNotation2 = false;
function getType2(slice, actionKey) {
  return slice + "/" + actionKey;
}
function createSlice(options) {
  var name = options.name;
  if (!name) {
    throw new Error("`name` is a required option for createSlice");
  }
  if (typeof process !== "undefined" && true) {
    if (options.initialState === void 0) {
      console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");
    }
  }
  var initialState2 = typeof options.initialState == "function" ? options.initialState : freezeDraftable(options.initialState);
  var reducers = options.reducers || {};
  var reducerNames = Object.keys(reducers);
  var sliceCaseReducersByName = {};
  var sliceCaseReducersByType = {};
  var actionCreators = {};
  reducerNames.forEach(function(reducerName) {
    var maybeReducerWithPrepare = reducers[reducerName];
    var type = getType2(name, reducerName);
    var caseReducer;
    var prepareCallback;
    if ("reducer" in maybeReducerWithPrepare) {
      caseReducer = maybeReducerWithPrepare.reducer;
      prepareCallback = maybeReducerWithPrepare.prepare;
    } else {
      caseReducer = maybeReducerWithPrepare;
    }
    sliceCaseReducersByName[reducerName] = caseReducer;
    sliceCaseReducersByType[type] = caseReducer;
    actionCreators[reducerName] = prepareCallback ? createAction(type, prepareCallback) : createAction(type);
  });
  function buildReducer() {
    if (true) {
      if (typeof options.extraReducers === "object") {
        if (!hasWarnedAboutObjectNotation2) {
          hasWarnedAboutObjectNotation2 = true;
          console.warn("The object notation for `createSlice.extraReducers` is deprecated, and will be removed in RTK 2.0. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");
        }
      }
    }
    var _c = typeof options.extraReducers === "function" ? executeReducerBuilderCallback(options.extraReducers) : [options.extraReducers], _d = _c[0], extraReducers = _d === void 0 ? {} : _d, _e = _c[1], actionMatchers = _e === void 0 ? [] : _e, _f = _c[2], defaultCaseReducer = _f === void 0 ? void 0 : _f;
    var finalCaseReducers = __spreadValues(__spreadValues({}, extraReducers), sliceCaseReducersByType);
    return createReducer(initialState2, function(builder) {
      for (var key in finalCaseReducers) {
        builder.addCase(key, finalCaseReducers[key]);
      }
      for (var _i = 0, actionMatchers_1 = actionMatchers; _i < actionMatchers_1.length; _i++) {
        var m2 = actionMatchers_1[_i];
        builder.addMatcher(m2.matcher, m2.reducer);
      }
      if (defaultCaseReducer) {
        builder.addDefaultCase(defaultCaseReducer);
      }
    });
  }
  var _reducer;
  return {
    name,
    reducer: function(state, action) {
      if (!_reducer)
        _reducer = buildReducer();
      return _reducer(state, action);
    },
    actions: actionCreators,
    caseReducers: sliceCaseReducersByName,
    getInitialState: function() {
      if (!_reducer)
        _reducer = buildReducer();
      return _reducer.getInitialState();
    }
  };
}
var urlAlphabet = "ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW";
var nanoid = function(size) {
  if (size === void 0) {
    size = 21;
  }
  var id2 = "";
  var i2 = size;
  while (i2--) {
    id2 += urlAlphabet[Math.random() * 64 | 0];
  }
  return id2;
};
var commonProperties = [
  "name",
  "message",
  "stack",
  "code"
];
var RejectWithValue = (
  /** @class */
  /* @__PURE__ */ function() {
    function RejectWithValue2(payload, meta) {
      this.payload = payload;
      this.meta = meta;
    }
    return RejectWithValue2;
  }()
);
var FulfillWithMeta = (
  /** @class */
  /* @__PURE__ */ function() {
    function FulfillWithMeta2(payload, meta) {
      this.payload = payload;
      this.meta = meta;
    }
    return FulfillWithMeta2;
  }()
);
var miniSerializeError = function(value) {
  if (typeof value === "object" && value !== null) {
    var simpleError = {};
    for (var _i = 0, commonProperties_1 = commonProperties; _i < commonProperties_1.length; _i++) {
      var property = commonProperties_1[_i];
      if (typeof value[property] === "string") {
        simpleError[property] = value[property];
      }
    }
    return simpleError;
  }
  return { message: String(value) };
};
var createAsyncThunk = function() {
  function createAsyncThunk2(typePrefix, payloadCreator, options) {
    var fulfilled = createAction(typePrefix + "/fulfilled", function(payload, requestId, arg, meta) {
      return {
        payload,
        meta: __spreadProps(__spreadValues({}, meta || {}), {
          arg,
          requestId,
          requestStatus: "fulfilled"
        })
      };
    });
    var pending = createAction(typePrefix + "/pending", function(requestId, arg, meta) {
      return {
        payload: void 0,
        meta: __spreadProps(__spreadValues({}, meta || {}), {
          arg,
          requestId,
          requestStatus: "pending"
        })
      };
    });
    var rejected = createAction(typePrefix + "/rejected", function(error, requestId, arg, payload, meta) {
      return {
        payload,
        error: (options && options.serializeError || miniSerializeError)(error || "Rejected"),
        meta: __spreadProps(__spreadValues({}, meta || {}), {
          arg,
          requestId,
          rejectedWithValue: !!payload,
          requestStatus: "rejected",
          aborted: (error == null ? void 0 : error.name) === "AbortError",
          condition: (error == null ? void 0 : error.name) === "ConditionError"
        })
      };
    });
    var displayedWarning = false;
    var AC = typeof AbortController !== "undefined" ? AbortController : (
      /** @class */
      function() {
        function class_1() {
          this.signal = {
            aborted: false,
            addEventListener: function() {
            },
            dispatchEvent: function() {
              return false;
            },
            onabort: function() {
            },
            removeEventListener: function() {
            },
            reason: void 0,
            throwIfAborted: function() {
            }
          };
        }
        class_1.prototype.abort = function() {
          if (true) {
            if (!displayedWarning) {
              displayedWarning = true;
              console.info("This platform does not implement AbortController. \nIf you want to use the AbortController to react to `abort` events, please consider importing a polyfill like 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'.");
            }
          }
        };
        return class_1;
      }()
    );
    function actionCreator(arg) {
      return function(dispatch, getState, extra) {
        var requestId = (options == null ? void 0 : options.idGenerator) ? options.idGenerator(arg) : nanoid();
        var abortController = new AC();
        var abortReason;
        var started = false;
        function abort(reason) {
          abortReason = reason;
          abortController.abort();
        }
        var promise2 = function() {
          return __async(this, null, function() {
            var _a2, _b, finalAction, conditionResult, abortedPromise, err_1, skipDispatch;
            return __generator(this, function(_c) {
              switch (_c.label) {
                case 0:
                  _c.trys.push([0, 4, , 5]);
                  conditionResult = (_a2 = options == null ? void 0 : options.condition) == null ? void 0 : _a2.call(options, arg, { getState, extra });
                  if (!isThenable(conditionResult))
                    return [3, 2];
                  return [4, conditionResult];
                case 1:
                  conditionResult = _c.sent();
                  _c.label = 2;
                case 2:
                  if (conditionResult === false || abortController.signal.aborted) {
                    throw {
                      name: "ConditionError",
                      message: "Aborted due to condition callback returning false."
                    };
                  }
                  started = true;
                  abortedPromise = new Promise(function(_7, reject) {
                    return abortController.signal.addEventListener("abort", function() {
                      return reject({
                        name: "AbortError",
                        message: abortReason || "Aborted"
                      });
                    });
                  });
                  dispatch(pending(requestId, arg, (_b = options == null ? void 0 : options.getPendingMeta) == null ? void 0 : _b.call(options, { requestId, arg }, { getState, extra })));
                  return [4, Promise.race([
                    abortedPromise,
                    Promise.resolve(payloadCreator(arg, {
                      dispatch,
                      getState,
                      extra,
                      requestId,
                      signal: abortController.signal,
                      abort,
                      rejectWithValue: function(value, meta) {
                        return new RejectWithValue(value, meta);
                      },
                      fulfillWithValue: function(value, meta) {
                        return new FulfillWithMeta(value, meta);
                      }
                    })).then(function(result) {
                      if (result instanceof RejectWithValue) {
                        throw result;
                      }
                      if (result instanceof FulfillWithMeta) {
                        return fulfilled(result.payload, requestId, arg, result.meta);
                      }
                      return fulfilled(result, requestId, arg);
                    })
                  ])];
                case 3:
                  finalAction = _c.sent();
                  return [3, 5];
                case 4:
                  err_1 = _c.sent();
                  finalAction = err_1 instanceof RejectWithValue ? rejected(null, requestId, arg, err_1.payload, err_1.meta) : rejected(err_1, requestId, arg);
                  return [3, 5];
                case 5:
                  skipDispatch = options && !options.dispatchConditionRejection && rejected.match(finalAction) && finalAction.meta.condition;
                  if (!skipDispatch) {
                    dispatch(finalAction);
                  }
                  return [2, finalAction];
              }
            });
          });
        }();
        return Object.assign(promise2, {
          abort,
          requestId,
          arg,
          unwrap: function() {
            return promise2.then(unwrapResult);
          }
        });
      };
    }
    return Object.assign(actionCreator, {
      pending,
      rejected,
      fulfilled,
      typePrefix
    });
  }
  createAsyncThunk2.withTypes = function() {
    return createAsyncThunk2;
  };
  return createAsyncThunk2;
}();
function unwrapResult(action) {
  if (action.meta && action.meta.rejectedWithValue) {
    throw action.payload;
  }
  if (action.error) {
    throw action.error;
  }
  return action.payload;
}
function isThenable(value) {
  return value !== null && typeof value === "object" && typeof value.then === "function";
}
var listener = "listener";
var completed = "completed";
var cancelled = "cancelled";
var taskCancelled = "task-" + cancelled;
var taskCompleted = "task-" + completed;
var listenerCancelled = listener + "-" + cancelled;
var listenerCompleted = listener + "-" + completed;
var alm = "listenerMiddleware";
var addListener = createAction(alm + "/add");
var clearAllListeners = createAction(alm + "/removeAll");
var removeListener = createAction(alm + "/remove");
var promise;
var queueMicrotaskShim = typeof queueMicrotask === "function" ? queueMicrotask.bind(typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : globalThis) : function(cb) {
  return (promise || (promise = Promise.resolve())).then(cb).catch(function(err) {
    return setTimeout(function() {
      throw err;
    }, 0);
  });
};
var createQueueWithTimer = function(timeout) {
  return function(notify) {
    setTimeout(notify, timeout);
  };
};
var rAF = typeof window !== "undefined" && window.requestAnimationFrame ? window.requestAnimationFrame : createQueueWithTimer(10);
F();

// src/redux/global-slice.ts
var initialState = {
  settings: DEFAULT_SETTINGS,
  isDarkMode: false,
  pluginVersion: ""
};
var globalSlice = createSlice({
  name: "global",
  initialState,
  reducers: {
    setDarkMode(state, action) {
      state.isDarkMode = action.payload;
    },
    setSettings(state, action) {
      state.settings = action.payload;
    },
    setPluginVersion(state, action) {
      state.pluginVersion = action.payload;
    }
  }
});
var { setDarkMode, setSettings, setPluginVersion } = globalSlice.actions;
var global_slice_default = globalSlice.reducer;

// src/redux/store.ts
var store = configureStore({
  reducer: {
    global: global_slice_default
  }
});

// src/shared/versioning.ts
var legacyVersionToString = (version) => {
  return version.toString().split("").join(".");
};
var isVersionLessThan = (oldVersion, newVersion) => {
  const oldVersionArray = oldVersion.split(".");
  const newVersionArray = newVersion.split(".");
  for (let i2 = 0; i2 < oldVersionArray.length; i2++) {
    const oldVersionNumber = parseInt(oldVersionArray[i2]);
    const newVersionNumber = parseInt(newVersionArray[i2]);
    if (oldVersionNumber < newVersionNumber) {
      return true;
    }
    if (oldVersionNumber > newVersionNumber) {
      return false;
    }
  }
  return false;
};

// src/shared/loom-state/migrate/migrate-state-0.ts
var MigrateState0 = class {
  migrate(prevState) {
    const { columns } = prevState.model;
    const nextColumns = columns.map((column) => {
      return {
        ...column,
        currencyType: "USD" /* UNITED_STATES */
      };
    });
    return {
      ...prevState,
      model: {
        ...prevState.model,
        columns: nextColumns
      }
    };
  }
};

// src/shared/loom-state/migrate/migrate-state-1.ts
var MigrateState1 = class {
  migrate(prevState) {
    const { columns } = prevState.model;
    const nextColumns = columns.map((column) => {
      return {
        ...column,
        dateFormat: "dd/mm/yyyy" /* DD_MM_YYYY */
      };
    });
    return {
      ...prevState,
      model: {
        ...prevState.model,
        columns: nextColumns
      }
    };
  }
};

// src/shared/loom-state/migrate/migrate-state-2.ts
var import_lodash = __toESM(require_lodash());
var MigrateState2 = class {
  migrate(prevState) {
    const { columns, rows, cells } = prevState.model;
    const nextRows = rows.map((row, i2) => {
      return {
        ...row,
        index: i2
      };
    });
    const nextColumns = columns.map((column) => {
      const columnCopy = (0, import_lodash.cloneDeep)(column);
      const unknownColumn = columnCopy;
      if (unknownColumn["hasAutoWidth"]) {
        delete unknownColumn.hasAutoWidth;
      }
      return {
        ...columnCopy,
        isVisible: true
      };
    });
    const nextCells = cells.map((cell) => {
      return {
        ...cell,
        dateTime: null
      };
    });
    return {
      ...prevState,
      model: {
        ...prevState.model,
        columns: nextColumns,
        cells: nextCells,
        rows: nextRows
      }
    };
  }
};

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

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

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

// node_modules/uuid/dist/esm-browser/stringify.js
var byteToHex = [];
for (let i2 = 0; i2 < 256; ++i2) {
  byteToHex.push((i2 + 256).toString(16).slice(1));
}
function unsafeStringify(arr, offset = 0) {
  return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
}

// node_modules/uuid/dist/esm-browser/parse.js
function parse(uuid) {
  if (!validate_default(uuid)) {
    throw TypeError("Invalid UUID");
  }
  let v2;
  const arr = new Uint8Array(16);
  arr[0] = (v2 = parseInt(uuid.slice(0, 8), 16)) >>> 24;
  arr[1] = v2 >>> 16 & 255;
  arr[2] = v2 >>> 8 & 255;
  arr[3] = v2 & 255;
  arr[4] = (v2 = parseInt(uuid.slice(9, 13), 16)) >>> 8;
  arr[5] = v2 & 255;
  arr[6] = (v2 = parseInt(uuid.slice(14, 18), 16)) >>> 8;
  arr[7] = v2 & 255;
  arr[8] = (v2 = parseInt(uuid.slice(19, 23), 16)) >>> 8;
  arr[9] = v2 & 255;
  arr[10] = (v2 = parseInt(uuid.slice(24, 36), 16)) / 1099511627776 & 255;
  arr[11] = v2 / 4294967296 & 255;
  arr[12] = v2 >>> 24 & 255;
  arr[13] = v2 >>> 16 & 255;
  arr[14] = v2 >>> 8 & 255;
  arr[15] = v2 & 255;
  return arr;
}
var parse_default = parse;

// node_modules/uuid/dist/esm-browser/v35.js
function stringToBytes(str) {
  str = unescape(encodeURIComponent(str));
  const bytes = [];
  for (let i2 = 0; i2 < str.length; ++i2) {
    bytes.push(str.charCodeAt(i2));
  }
  return bytes;
}
var DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8";
var URL = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
function v35(name, version, hashfunc) {
  function generateUUID(value, namespace, buf, offset) {
    var _namespace;
    if (typeof value === "string") {
      value = stringToBytes(value);
    }
    if (typeof namespace === "string") {
      namespace = parse_default(namespace);
    }
    if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) {
      throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
    }
    let bytes = new Uint8Array(16 + value.length);
    bytes.set(namespace);
    bytes.set(value, namespace.length);
    bytes = hashfunc(bytes);
    bytes[6] = bytes[6] & 15 | version;
    bytes[8] = bytes[8] & 63 | 128;
    if (buf) {
      offset = offset || 0;
      for (let i2 = 0; i2 < 16; ++i2) {
        buf[offset + i2] = bytes[i2];
      }
      return buf;
    }
    return unsafeStringify(bytes);
  }
  try {
    generateUUID.name = name;
  } catch (err) {
  }
  generateUUID.DNS = DNS;
  generateUUID.URL = URL;
  return generateUUID;
}

// node_modules/uuid/dist/esm-browser/native.js
var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
var native_default = {
  randomUUID
};

// node_modules/uuid/dist/esm-browser/v4.js
function v4(options, buf, offset) {
  if (native_default.randomUUID && !buf && !options) {
    return native_default.randomUUID();
  }
  options = options || {};
  const rnds = options.random || (options.rng || rng)();
  rnds[6] = rnds[6] & 15 | 64;
  rnds[8] = rnds[8] & 63 | 128;
  if (buf) {
    offset = offset || 0;
    for (let i2 = 0; i2 < 16; ++i2) {
      buf[offset + i2] = rnds[i2];
    }
    return buf;
  }
  return unsafeStringify(rnds);
}
var v4_default = v4;

// node_modules/uuid/dist/esm-browser/sha1.js
function f2(s2, x2, y2, z2) {
  switch (s2) {
    case 0:
      return x2 & y2 ^ ~x2 & z2;
    case 1:
      return x2 ^ y2 ^ z2;
    case 2:
      return x2 & y2 ^ x2 & z2 ^ y2 & z2;
    case 3:
      return x2 ^ y2 ^ z2;
  }
}
function ROTL(x2, n2) {
  return x2 << n2 | x2 >>> 32 - n2;
}
function sha1(bytes) {
  const K = [1518500249, 1859775393, 2400959708, 3395469782];
  const H2 = [1732584193, 4023233417, 2562383102, 271733878, 3285377520];
  if (typeof bytes === "string") {
    const msg = unescape(encodeURIComponent(bytes));
    bytes = [];
    for (let i2 = 0; i2 < msg.length; ++i2) {
      bytes.push(msg.charCodeAt(i2));
    }
  } else if (!Array.isArray(bytes)) {
    bytes = Array.prototype.slice.call(bytes);
  }
  bytes.push(128);
  const l2 = bytes.length / 4 + 2;
  const N2 = Math.ceil(l2 / 16);
  const M2 = new Array(N2);
  for (let i2 = 0; i2 < N2; ++i2) {
    const arr = new Uint32Array(16);
    for (let j2 = 0; j2 < 16; ++j2) {
      arr[j2] = bytes[i2 * 64 + j2 * 4] << 24 | bytes[i2 * 64 + j2 * 4 + 1] << 16 | bytes[i2 * 64 + j2 * 4 + 2] << 8 | bytes[i2 * 64 + j2 * 4 + 3];
    }
    M2[i2] = arr;
  }
  M2[N2 - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);
  M2[N2 - 1][14] = Math.floor(M2[N2 - 1][14]);
  M2[N2 - 1][15] = (bytes.length - 1) * 8 & 4294967295;
  for (let i2 = 0; i2 < N2; ++i2) {
    const W2 = new Uint32Array(80);
    for (let t2 = 0; t2 < 16; ++t2) {
      W2[t2] = M2[i2][t2];
    }
    for (let t2 = 16; t2 < 80; ++t2) {
      W2[t2] = ROTL(W2[t2 - 3] ^ W2[t2 - 8] ^ W2[t2 - 14] ^ W2[t2 - 16], 1);
    }
    let a2 = H2[0];
    let b2 = H2[1];
    let c2 = H2[2];
    let d2 = H2[3];
    let e = H2[4];
    for (let t2 = 0; t2 < 80; ++t2) {
      const s2 = Math.floor(t2 / 20);
      const T = ROTL(a2, 5) + f2(s2, b2, c2, d2) + e + K[s2] + W2[t2] >>> 0;
      e = d2;
      d2 = c2;
      c2 = ROTL(b2, 30) >>> 0;
      b2 = a2;
      a2 = T;
    }
    H2[0] = H2[0] + a2 >>> 0;
    H2[1] = H2[1] + b2 >>> 0;
    H2[2] = H2[2] + c2 >>> 0;
    H2[3] = H2[3] + d2 >>> 0;
    H2[4] = H2[4] + e >>> 0;
  }
  return [H2[0] >> 24 & 255, H2[0] >> 16 & 255, H2[0] >> 8 & 255, H2[0] & 255, H2[1] >> 24 & 255, H2[1] >> 16 & 255, H2[1] >> 8 & 255, H2[1] & 255, H2[2] >> 24 & 255, H2[2] >> 16 & 255, H2[2] >> 8 & 255, H2[2] & 255, H2[3] >> 24 & 255, H2[3] >> 16 & 255, H2[3] >> 8 & 255, H2[3] & 255, H2[4] >> 24 & 255, H2[4] >> 16 & 255, H2[4] >> 8 & 255, H2[4] & 255];
}
var sha1_default = sha1;

// node_modules/uuid/dist/esm-browser/v5.js
var v5 = v35("v5", 80, sha1_default);
var v5_default = v5;

// src/shared/uuid.ts
var generateUuid = () => v4_default();

// src/shared/loom-state/migrate/migrate-state-3.ts
var MigrateState3 = class {
  migrate(prevState) {
    const { columns, rows, cells, tags } = prevState.model;
    const nextHeaderRows = [createHeaderRow()];
    const nextBodyRows = rows.filter((_row, i2) => i2 !== 0).map((row) => {
      return {
        id: row.id,
        index: row.index - 1,
        creationTime: row.creationTime,
        lastEditedTime: row.lastEditedTime,
        menuCellId: row.menuCellId
      };
    });
    const nextFooterRows = [
      createFooterRow(),
      createFooterRow()
    ];
    const nextColumns = columns.map((column) => {
      return {
        id: column.id,
        sortDir: column.sortDir,
        width: column.width,
        type: column.type,
        isVisible: column.isVisible,
        dateFormat: column.dateFormat,
        currencyType: column.currencyType,
        shouldWrapOverflow: column.shouldWrapOverflow
      };
    });
    const nextHeaderCells = cells.filter((cell) => cell.isHeader).map((cell) => {
      return {
        id: cell.id,
        columnId: cell.columnId,
        rowId: nextHeaderRows[0].id,
        markdown: cell.markdown
      };
    });
    const nextBodyCells = cells.filter((cell) => !cell.isHeader).map((cell) => {
      return {
        id: cell.id,
        columnId: cell.columnId,
        rowId: cell.rowId,
        dateTime: cell.dateTime,
        markdown: cell.markdown
      };
    });
    const nextFooterCells = [];
    for (let i2 = 0; i2 < 2; i2++) {
      columns.forEach((column) => {
        nextFooterCells.push({
          id: generateUuid(),
          columnId: column.id,
          rowId: nextFooterRows[i2].id,
          functionType: "none" /* NONE */
        });
      });
    }
    return {
      ...prevState,
      model: {
        ...prevState.model,
        columns: nextColumns,
        headerRows: nextHeaderRows,
        bodyRows: nextBodyRows,
        footerRows: nextFooterRows,
        headerCells: nextHeaderCells,
        bodyCells: nextBodyCells,
        footerCells: [],
        tags
      }
    };
  }
};
var createHeaderRow = () => {
  return {
    id: generateUuid()
  };
};
var createFooterRow = () => {
  return {
    id: generateUuid()
  };
};

// src/shared/error/column-not-found-error.ts
var ColumnNotFoundError = class extends Error {
  constructor({ id: id2, type }) {
    let message = "";
    if (id2) {
      message = `Cannot find column with id: ${id2}`;
    } else {
      message = `Cannot find column of type: ${type}`;
    }
    super(message);
    this.name = "ColumnNotFoundError";
  }
};

// src/shared/markdown/constants.ts
var CHECKBOX_MARKDOWN_UNCHECKED = "[ ]";
var CHECKBOX_MARKDOWN_CHECKED = "[x]";

// src/shared/loom-state/migrate/migrate-state-4.ts
var MigrateState4 = class {
  migrate(prevState) {
    const { columns, bodyCells } = prevState.model;
    const nextBodyCells = bodyCells.map((cell) => {
      const column = columns.find(
        (column2) => column2.id === cell.columnId
      );
      if (!column)
        throw new ColumnNotFoundError({ id: cell.columnId });
      let markdown = cell.markdown;
      if (column.type === "checkbox" /* CHECKBOX */) {
        if (markdown === "") {
          markdown = CHECKBOX_MARKDOWN_UNCHECKED;
        }
      }
      return {
        ...cell,
        markdown
      };
    });
    return {
      model: {
        ...prevState.model,
        bodyCells: nextBodyCells,
        filterRules: []
      },
      pluginVersion: prevState.pluginVersion
    };
  }
};

// src/shared/loom-state/migrate/migrate-state-5.ts
var MigrateState5 = class {
  migrate(prevState) {
    const { footerCells } = prevState.model;
    const nextFooterCells = footerCells.map((cell) => {
      return {
        ...cell,
        functionType: cell.functionType.replace(
          /_/g,
          "-"
        )
      };
    });
    return {
      ...prevState,
      model: {
        ...prevState.model,
        footerCells: nextFooterCells
      }
    };
  }
};

// src/shared/loom-state/migrate/migrate-state-6.ts
var import_lodash2 = __toESM(require_lodash());
var MigrateState6 = class {
  migrate(prevState) {
    const {
      columns,
      tags,
      bodyCells,
      bodyRows,
      headerCells,
      headerRows,
      footerRows,
      footerCells,
      filterRules
    } = prevState.model;
    const nextColumns = columns.map((column) => {
      const filteredTags = tags.filter(
        (tag) => tag.columnId === column.id
      );
      const nextTags = filteredTags.map((tag) => {
        return {
          id: tag.id,
          markdown: tag.markdown,
          color: tag.color
        };
      });
      return {
        ...column,
        tags: nextTags
      };
    });
    const nextBodyCells = bodyCells.map((cell) => {
      const filteredTags = tags.filter(
        (tag) => tag.cellIds.includes(cell.id)
      );
      const nextTagIds = filteredTags.map((tag) => tag.id);
      return {
        ...cell,
        tagIds: nextTagIds
      };
    });
    const nextBodyRows = bodyRows.map((row) => {
      const rowCopy = (0, import_lodash2.cloneDeep)(row);
      const unknownRow = rowCopy;
      if (unknownRow["menuCellId"]) {
        delete unknownRow.menuCellId;
      }
      return rowCopy;
    });
    return {
      ...prevState,
      model: {
        columns: nextColumns,
        headerRows,
        bodyRows: nextBodyRows,
        footerRows,
        headerCells,
        bodyCells: nextBodyCells,
        footerCells,
        filterRules
      }
    };
  }
};

// src/shared/loom-state/migrate/migrate-state-7.ts
var import_lodash3 = __toESM(require_lodash());
var MigrateState7 = class {
  migrate(prevState) {
    const { columns, footerCells } = prevState.model;
    const nextColumns = columns.map((column) => {
      const footerCell = footerCells.find(
        (cell) => cell.columnId === column.id
      );
      if (!footerCell)
        throw new Error("Footer cell not found");
      return {
        ...column,
        functionType: footerCell.functionType
      };
    });
    const nextFooterCells = footerCells.map((cell) => {
      const cellCopy = (0, import_lodash3.cloneDeep)(cell);
      const unknownCell = cellCopy;
      if (unknownCell["functionType"]) {
        delete unknownCell.functionType;
      }
      return cell;
    });
    return {
      ...prevState,
      model: {
        ...prevState.model,
        columns: nextColumns,
        footerCells: nextFooterCells
      }
    };
  }
};

// src/shared/loom-state/migrate/migrate-state-8.ts
var MigrateState8 = class {
  migrate(prevState) {
    const { columns } = prevState.model;
    const nextColumns = columns.map((column) => {
      return {
        ...column,
        isLocked: false,
        aspectRatio: "16/9" /* SIXTEEN_BY_NINE */,
        horizontalPadding: "unset" /* UNSET */,
        verticalPadding: "unset" /* UNSET */
      };
    });
    return {
      ...prevState,
      model: {
        ...prevState.model,
        columns: nextColumns
      }
    };
  }
};

// src/shared/loom-state/types/loom-state.ts
var Color = /* @__PURE__ */ ((Color2) => {
  Color2["LIGHT_GRAY"] = "light gray";
  Color2["GRAY"] = "gray";
  Color2["BROWN"] = "brown";
  Color2["ORANGE"] = "orange";
  Color2["YELLOW"] = "yellow";
  Color2["GREEN"] = "green";
  Color2["BLUE"] = "blue";
  Color2["PURPLE"] = "purple";
  Color2["PINK"] = "pink";
  Color2["RED"] = "red";
  return Color2;
})(Color || {});
var PaddingSize2 = /* @__PURE__ */ ((PaddingSize5) => {
  PaddingSize5["UNSET"] = "unset";
  PaddingSize5["SM"] = "sm";
  PaddingSize5["MD"] = "md";
  PaddingSize5["LG"] = "lg";
  PaddingSize5["XL"] = "xl";
  PaddingSize5["XXL"] = "2xl";
  PaddingSize5["XXXL"] = "3xl";
  PaddingSize5["XXXXL"] = "4xl";
  return PaddingSize5;
})(PaddingSize2 || {});
var CellType2 = /* @__PURE__ */ ((CellType8) => {
  CellType8["SOURCE_FILE"] = "source-file";
  CellType8["SOURCE"] = "source";
  CellType8["TEXT"] = "text";
  CellType8["EMBED"] = "embed";
  CellType8["FILE"] = "file";
  CellType8["NUMBER"] = "number";
  CellType8["TAG"] = "tag";
  CellType8["MULTI_TAG"] = "multi-tag";
  CellType8["DATE"] = "date";
  CellType8["CHECKBOX"] = "checkbox";
  CellType8["CREATION_TIME"] = "creation-time";
  CellType8["LAST_EDITED_TIME"] = "last-edited-time";
  return CellType8;
})(CellType2 || {});
var DateFormat2 = /* @__PURE__ */ ((DateFormat12) => {
  DateFormat12["MM_DD_YYYY"] = "mmddyyyy";
  DateFormat12["DD_MM_YYYY"] = "ddmmyyyy";
  DateFormat12["YYYY_MM_DD"] = "yyyymmdd";
  return DateFormat12;
})(DateFormat2 || {});
var DateFormatSeparator = /* @__PURE__ */ ((DateFormatSeparator12) => {
  DateFormatSeparator12["HYPHEN"] = "-";
  DateFormatSeparator12["SLASH"] = "/";
  DateFormatSeparator12["DOT"] = ".";
  return DateFormatSeparator12;
})(DateFormatSeparator || {});
var CurrencyType2 = /* @__PURE__ */ ((CurrencyType11) => {
  CurrencyType11["ARGENTINA"] = "ARS";
  CurrencyType11["AUSTRALIA"] = "AUD";
  CurrencyType11["CANADA"] = "CAD";
  CurrencyType11["COLOMBIA"] = "COP";
  CurrencyType11["DENMARK"] = "DKK";
  CurrencyType11["UAE"] = "AED";
  CurrencyType11["EUROPE"] = "EUR";
  CurrencyType11["ICELAND"] = "ISK";
  CurrencyType11["ISRAEL"] = "ILS";
  CurrencyType11["MEXICO"] = "MXN";
  CurrencyType11["NORWAY"] = "NOK";
  CurrencyType11["GREAT_BRITAIN"] = "GBP";
  CurrencyType11["BRAZIL"] = "BRL";
  CurrencyType11["SAUDI_ARABIA"] = "SAR";
  CurrencyType11["RUSSIA"] = "RUB";
  CurrencyType11["INDIA"] = "INR";
  CurrencyType11["SINGAPORE"] = "SGB";
  CurrencyType11["SWEDEN"] = "SEK";
  CurrencyType11["SWITZERLAND"] = "CHF";
  CurrencyType11["UNITED_STATES"] = "USD";
  CurrencyType11["SOUTH_KOREA"] = "KRW";
  CurrencyType11["JAPAN"] = "JPY";
  CurrencyType11["CHINA"] = "CNY";
  return CurrencyType11;
})(CurrencyType2 || {});
var AspectRatio2 = /* @__PURE__ */ ((AspectRatio5) => {
  AspectRatio5["UNSET"] = "unset";
  AspectRatio5["NINE_BY_SIXTEEN"] = "9/16";
  AspectRatio5["FOUR_BY_THREE"] = "4/3";
  AspectRatio5["SIXTEEN_BY_NINE"] = "16/9";
  return AspectRatio5;
})(AspectRatio2 || {});
var GeneralCalculation = /* @__PURE__ */ ((GeneralCalculation3) => {
  GeneralCalculation3["NONE"] = "none";
  GeneralCalculation3["COUNT_ALL"] = "count-all";
  GeneralCalculation3["COUNT_VALUES"] = "count-values";
  GeneralCalculation3["COUNT_UNIQUE"] = "count-unique";
  GeneralCalculation3["COUNT_EMPTY"] = "count-empty";
  GeneralCalculation3["COUNT_NOT_EMPTY"] = "count-not-empty";
  GeneralCalculation3["PERCENT_EMPTY"] = "percent-empty";
  GeneralCalculation3["PERCENT_NOT_EMPTY"] = "percent-not-empty";
  return GeneralCalculation3;
})(GeneralCalculation || {});
var NumberCalculation = /* @__PURE__ */ ((NumberCalculation2) => {
  NumberCalculation2["SUM"] = "sum";
  NumberCalculation2["AVG"] = "avg";
  NumberCalculation2["MIN"] = "min";
  NumberCalculation2["MAX"] = "max";
  NumberCalculation2["MEDIAN"] = "median";
  NumberCalculation2["RANGE"] = "range";
  return NumberCalculation2;
})(NumberCalculation || {});
var DateFilterOption = /* @__PURE__ */ ((DateFilterOption5) => {
  DateFilterOption5["UNSELECTED"] = "unselected";
  DateFilterOption5["TODAY"] = "today";
  DateFilterOption5["TOMORROW"] = "tomorrow";
  DateFilterOption5["YESTERDAY"] = "yesterday";
  DateFilterOption5["ONE_WEEK_AGO"] = "one-week-ago";
  DateFilterOption5["ONE_WEEK_FROM_NOW"] = "one-week-from-now";
  DateFilterOption5["ONE_MONTH_AGO"] = "one-month-ago";
  DateFilterOption5["ONE_MONTH_FROM_NOW"] = "one-month-from-now";
  return DateFilterOption5;
})(DateFilterOption || {});
var SourceType = /* @__PURE__ */ ((SourceType6) => {
  SourceType6["FOLDER"] = "folder";
  SourceType6["FRONTMATTER"] = "frontmatter";
  return SourceType6;
})(SourceType || {});

// src/shared/loom-state/migrate/migrate-state-9.ts
var import_lodash4 = __toESM(require_lodash());
var MigrateState9 = class {
  migrate(prevState) {
    const { columns, bodyRows } = prevState.model;
    const nextColumns = columns.map((column) => {
      return {
        ...column,
        sortDir: "default" /* NONE */
      };
    });
    const bodyRowsCopy = (0, import_lodash4.cloneDeep)(bodyRows);
    bodyRowsCopy.sort((a2, b2) => a2.index - b2.index);
    const nextBodyRows = bodyRowsCopy.map((row, i2) => {
      return {
        ...row,
        index: i2
      };
    });
    return {
      ...prevState,
      model: {
        ...prevState.model,
        columns: nextColumns,
        bodyRows: nextBodyRows
      }
    };
  }
};

// src/shared/loom-state/migrate/migrate-state-10.ts
var import_lodash5 = __toESM(require_lodash());
var MigrateState10 = class {
  migrate(prevState) {
    const { columns, bodyCells } = prevState.model;
    const nextColumns = columns.map((column) => {
      const columnCopy = (0, import_lodash5.cloneDeep)(column);
      const unknownCopy = columnCopy;
      unknownCopy.calculationType = unknownCopy.functionType;
      delete unknownCopy.functionType;
      return columnCopy;
    });
    const nextBodyCells = bodyCells.map((cell) => {
      return {
        ...cell,
        isExternalLink: true
      };
    });
    return {
      ...prevState,
      model: {
        ...prevState.model,
        columns: nextColumns,
        bodyCells: nextBodyCells
      }
    };
  }
};

// src/shared/loom-state/migrate/migrate-state-11.ts
var MigrateState11 = class {
  migrate(prevState) {
    return {
      ...prevState,
      model: {
        ...prevState.model,
        settings: {
          numFrozenColumns: 1
        }
      }
    };
  }
};

// src/shared/loom-state/migrate/migrate-state-12.ts
var MigrateState12 = class {
  migrate(prevState) {
    const {
      filterRules,
      columns,
      headerCells,
      headerRows,
      bodyCells,
      bodyRows,
      footerCells,
      footerRows,
      settings
    } = prevState.model;
    const nextColumns = columns.map((column) => {
      const { type, currencyType } = column;
      let newType;
      if (type === "currency" /* CURRENCY */) {
        newType = "number" /* NUMBER */;
      } else {
        newType = type;
      }
      let newCurrency;
      if (currencyType == "GBP" /* POUND */) {
        newCurrency = "GBP" /* GREAT_BRITAIN */;
      } else {
        newCurrency = currencyType;
      }
      return {
        ...column,
        type: newType,
        currencyType: newCurrency,
        calculationType: column.calculationType,
        numberPrefix: "",
        numberSuffix: "",
        numberSeparator: "",
        numberFormat: "number" /* NUMBER */
      };
    });
    const nextFilters = filterRules.map((rule) => {
      const column = columns.find(
        (column2) => column2.id === rule.columnId
      );
      if (!column)
        throw new ColumnNotFoundError({ id: rule.columnId });
      const { type } = column;
      if (type === "multi-tag" /* MULTI_TAG */) {
        let condition = filterTypeToFilterCondition(rule.type);
        if (condition !== "contains" /* CONTAINS */ && condition !== "does-not-contain" /* DOES_NOT_CONTAIN */ && condition !== "is-empty" /* IS_EMPTY */ && condition !== "is-not-empty" /* IS_NOT_EMPTY */) {
          condition = "contains" /* CONTAINS */;
        }
        const filter3 = createMultiTagFilter(rule.columnId, {
          condition,
          tagIds: rule.tagIds,
          isEnabled: rule.isEnabled
        });
        return filter3;
      } else if (type === "tag" /* TAG */) {
        let condition = filterTypeToFilterCondition(rule.type);
        if (condition !== "is" /* IS */ && condition !== "is-not" /* IS_NOT */ && condition !== "is-empty" /* IS_EMPTY */ && condition !== "is-not-empty" /* IS_NOT_EMPTY */) {
          condition = "is" /* IS */;
        }
        const filter3 = createTagFilter(rule.columnId, {
          condition,
          tagId: rule.tagIds[0],
          isEnabled: rule.isEnabled
        });
        return filter3;
      } else if (type === "checkbox" /* CHECKBOX */) {
        let condition = filterTypeToFilterCondition(rule.type);
        if (condition !== "is" /* IS */ && condition !== "is-not" /* IS_NOT */) {
          condition = "is" /* IS */;
        }
        const filter3 = createCheckboxFilter(rule.columnId, {
          condition,
          text: rule.text,
          isEnabled: rule.isEnabled
        });
        return filter3;
      } else if (type === "file" /* FILE */) {
        const condition = filterTypeToFilterCondition(rule.type);
        const filter3 = createFileFilter(rule.columnId, {
          condition,
          text: rule.text,
          isEnabled: rule.isEnabled
        });
        return filter3;
      } else {
        const condition = filterTypeToFilterCondition(rule.type);
        const filter3 = createTextFilter(rule.columnId, {
          condition,
          text: rule.text,
          isEnabled: rule.isEnabled
        });
        return filter3;
      }
    });
    return {
      ...prevState,
      model: {
        columns: nextColumns,
        footerCells,
        footerRows,
        headerCells,
        headerRows,
        bodyCells,
        bodyRows,
        filters: nextFilters,
        settings
      }
    };
  }
};
var filterTypeToFilterCondition = (type) => {
  switch (type) {
    case "is" /* IS */:
      return "is" /* IS */;
    case "is-not" /* IS_NOT */:
      return "is-not" /* IS_NOT */;
    case "contains" /* CONTAINS */:
      return "contains" /* CONTAINS */;
    case "does-not-contain" /* DOES_NOT_CONTAIN */:
      return "does-not-contain" /* DOES_NOT_CONTAIN */;
    case "starts-with" /* STARTS_WITH */:
      return "starts-with" /* STARTS_WITH */;
    case "ends-with" /* ENDS_WITH */:
      return "ends-with" /* ENDS_WITH */;
    case "is-empty" /* IS_EMPTY */:
      return "is-empty" /* IS_EMPTY */;
    case "is-not-empty" /* IS_NOT_EMPTY */:
      return "is-not-empty" /* IS_NOT_EMPTY */;
    default:
      throw new Error("Invalid filter type");
  }
};
var createTextFilter = (columnId, options) => {
  const {
    condition = "is" /* IS */,
    isEnabled = true,
    text = ""
  } = options || {};
  const baseFilter = createBaseFilter(columnId, {
    isEnabled
  });
  return {
    ...baseFilter,
    type: "text" /* TEXT */,
    condition,
    text
  };
};
var createFileFilter = (columnId, options) => {
  const {
    condition = "is" /* IS */,
    isEnabled = true,
    text = ""
  } = options || {};
  const baseFilter = createBaseFilter(columnId, {
    isEnabled
  });
  return {
    ...baseFilter,
    type: "file" /* FILE */,
    condition,
    text
  };
};
var createCheckboxFilter = (columnId, options) => {
  const {
    condition = "is" /* IS */,
    isEnabled = true,
    text = ""
  } = options || {};
  const baseFilter = createBaseFilter(columnId, {
    isEnabled
  });
  return {
    ...baseFilter,
    type: "checkbox" /* CHECKBOX */,
    condition,
    text,
    isEnabled
  };
};
var createTagFilter = (columnId, options) => {
  const {
    condition = "is" /* IS */,
    isEnabled = true,
    tagId = ""
  } = options || {};
  const baseFilter = createBaseFilter(columnId, {
    isEnabled
  });
  return {
    ...baseFilter,
    type: "tag" /* TAG */,
    condition,
    tagId,
    isEnabled
  };
};
var createMultiTagFilter = (columnId, options) => {
  const {
    condition = "contains" /* CONTAINS */,
    isEnabled = true,
    tagIds = []
  } = options || {};
  const baseFilter = createBaseFilter(columnId, {
    isEnabled
  });
  return {
    ...baseFilter,
    type: "multi-tag" /* MULTI_TAG */,
    condition,
    tagIds
  };
};
var createBaseFilter = (columnId, options) => {
  const { isEnabled = true } = options || {};
  return {
    id: generateUuid(),
    columnId,
    operator: "or",
    isEnabled
  };
};

// src/shared/loom-state/migrate/migrate-state-13.ts
var MigrateState13 = class {
  migrate(prevState) {
    const { settings, columns, headerCells, bodyCells, bodyRows, filters } = prevState.model;
    const nextSettings = {
      ...settings,
      showCalculationRow: true
    };
    const nextColumns = columns.map((column) => {
      const cell = headerCells.find(
        (cell2) => cell2.columnId === column.id
      );
      if (!cell)
        throw new Error("Header cell not found");
      const { markdown } = cell;
      const { tags } = column;
      const nextTags = tags.map((tag) => {
        const { id: id2, markdown: markdown2, color } = tag;
        return {
          id: id2,
          content: markdown2,
          color
        };
      });
      return {
        ...column,
        content: markdown,
        tags: nextTags
      };
    });
    const nextRows = bodyRows.map((row) => {
      const cells = bodyCells.filter(
        (cell) => cell.rowId === row.id
      );
      const nextCells = cells.map((cell) => {
        const {
          columnId,
          id: id2,
          isExternalLink: isExternalLink2,
          dateTime,
          markdown,
          tagIds
        } = cell;
        return {
          id: id2,
          columnId,
          isExternalLink: isExternalLink2,
          dateTime,
          content: markdown,
          tagIds
        };
      });
      return {
        ...row,
        cells: nextCells
      };
    });
    return {
      ...prevState,
      model: {
        columns: nextColumns,
        rows: nextRows,
        filters,
        settings: nextSettings
      }
    };
  }
};

// src/shared/loom-state/migrate/migrate-state-14.ts
var MigrateState14 = class {
  migrate(prevState) {
    const { rows, columns } = prevState.model;
    const nextRows = rows.map((row) => {
      return {
        ...row,
        sourceId: null
      };
    });
    const newColumns = columns.map((column) => {
      return {
        ...column,
        frontmatterKey: null
      };
    });
    return {
      ...prevState,
      model: {
        ...prevState.model,
        rows: nextRows,
        columns: newColumns,
        sources: [],
        externalRowOrder: []
      }
    };
  }
};

// src/shared/loom-state/migrate/migrate-state-15.ts
var MigrateState15 = class {
  migrate(prevState) {
    const { rows, columns, sources, filters, settings, externalRowOrder } = prevState.model;
    return {
      ...prevState,
      model: {
        rows,
        columns,
        filters,
        settings,
        externalRowOrder,
        sources
      }
    };
  }
};

// src/shared/loom-state/migrate/migrate-state-16.ts
var MigrateState16 = class {
  migrate(prevState) {
    const { sources } = prevState.model;
    const nextSources = sources.map((source) => {
      if (source.type === "folder" /* FOLDER */) {
        const { id: id2, path, type } = source;
        return {
          id: id2,
          path,
          type,
          //Set default value
          includeSubfolders: true
        };
      }
      return source;
    });
    return {
      ...prevState,
      model: {
        ...prevState.model,
        sources: nextSources
      }
    };
  }
};

// src/shared/date/utils.ts
var getDateFormatString = (format, separator) => {
  switch (format) {
    case "mmddyyyy" /* MM_DD_YYYY */:
      return `MM${separator}DD${separator}YYYY`;
    case "ddmmyyyy" /* DD_MM_YYYY */:
      return `DD${separator}MM${separator}YYYY`;
    case "yyyymmdd" /* YYYY_MM_DD */:
      return `YYYY${separator}MM${separator}DD`;
    default:
      throw new Error("Date format not supported.");
  }
};
var getTimeFormatString = (hour12) => {
  return hour12 ? "h:mm A" : "HH:mm";
};
var getDateTimeFromUnixTime = (unixTime) => {
  return new Date(unixTime).toISOString();
};
var getCurrentDateTime = () => {
  return (/* @__PURE__ */ new Date()).toISOString();
};
var padToTwoDigits = (value) => {
  return ("0" + value).slice(-2);
};

// src/shared/loom-state/migrate/migrate-state-17.ts
var MigrateState17 = class {
  migrate(prevState) {
    const { columns, rows, filters } = prevState.model;
    const nextColumns = columns.map((column) => {
      const { dateFormat, frontmatterKey } = column;
      let newFrontmatterKey = null;
      if (frontmatterKey) {
        newFrontmatterKey = frontmatterKey.value;
      }
      return {
        ...column,
        dateFormat: getDateFormatDisplay(dateFormat),
        dateFormatSeparator: "-" /* HYPHEN */,
        hour12: true,
        includeTime: false,
        frontmatterKey: newFrontmatterKey
      };
    });
    const nextRows = rows.map((row) => {
      const { cells, creationTime, lastEditedTime } = row;
      const nextCells = cells.map((cell) => {
        const { dateTime } = cell;
        let nextDateTime = null;
        if (dateTime !== null) {
          nextDateTime = getDateTimeFromUnixTime(dateTime);
        }
        return {
          ...cell,
          dateTime: nextDateTime
        };
      });
      const nextCreationDateTime = getDateTimeFromUnixTime(creationTime);
      const nextLastEditedDateTime = getDateTimeFromUnixTime(lastEditedTime);
      return {
        ...row,
        lastEditedDateTime: nextLastEditedDateTime,
        creationDateTime: nextCreationDateTime,
        cells: nextCells
      };
    });
    const nextFilters = filters.map((filter3) => {
      const { type } = filter3;
      if (type === "date" /* DATE */ || type === "last-edited-time" /* LAST_EDITED_TIME */ || type === "creation-time" /* CREATION_TIME */) {
        let nextDateTime = null;
        if (filter3.dateTime !== null) {
          nextDateTime = getDateTimeFromUnixTime(filter3.dateTime);
        }
        return {
          ...filter3,
          dateTime: nextDateTime
        };
      }
      return filter3;
    });
    return {
      ...prevState,
      model: {
        ...prevState.model,
        columns: nextColumns,
        rows: nextRows,
        filters: nextFilters
      }
    };
  }
};
var getDateFormatDisplay = (format) => {
  switch (format) {
    case "mm/dd/yyyy" /* MM_DD_YYYY */:
    case "dd/mm/yyyy" /* DD_MM_YYYY */:
    case "yyyy/mm/dd" /* YYYY_MM_DD */:
      return format.replaceAll("/", "");
    case "full" /* FULL */:
    case "relative" /* RELATIVE */:
      return "yyyymmdd" /* YYYY_MM_DD */;
    default:
      return format;
  }
};

// src/shared/link-and-path/link-predicates.ts
var isExternalLink = (link) => {
  if (isUrlLink(link))
    return true;
  if (isObsidianLink(link))
    return false;
  return false;
};
var isRelativePath = (link) => {
  return !isUrlLink(link);
};
var isUrlLink = (link) => {
  if (isHttpLink(link))
    return true;
  if (isObsidianLink(link))
    return true;
  return false;
};
var isObsidianLink = (link) => {
  return link.startsWith("obsidian://");
};
var isHttpLink = (link) => {
  return link.startsWith("http://") || link.startsWith("https://");
};

// src/shared/link-and-path/markdown-link-utils.ts
var extractWikiLinkComponents = (markdown) => {
  if (!markdown.startsWith("[[") || !markdown.endsWith("]]")) {
    return { path: null, alias: null };
  }
  const content = markdown.slice(2, -2);
  if (content.length === 0) {
    return { path: null, alias: null };
  }
  const parts = content.split("|");
  if (parts[0] === "") {
    return { path: null, alias: null };
  }
  const path = parts[0];
  let alias = null;
  if (parts.length > 1 && parts[1] !== "") {
    alias = parts[1];
  }
  return { path, alias };
};
var componentsToWikiLink = (path, alias) => {
  if (alias === null)
    return `[[${path}]]`;
  return `[[${path}|${alias}]]`;
};

// src/shared/loom-state/migrate/migrate-state-18.ts
var MigrateState18 = class {
  migrate(prevState) {
    const { rows, columns, filters } = prevState.model;
    const nextRows = rows.map((row) => {
      const { cells } = row;
      const nextCells = cells.map((cell) => {
        const {
          dateTime,
          content,
          id: id2,
          columnId,
          isExternalLink: isExternalLink2,
          tagIds
        } = cell;
        const column = columns.find((column2) => column2.id === columnId);
        if (!column) {
          throw new ColumnNotFoundError({ id: columnId });
        }
        const { type } = column;
        if (type === "text" /* TEXT */) {
          const newCell = {
            id: id2,
            columnId,
            content
          };
          return newCell;
        } else if (type === "number" /* NUMBER */) {
          const newCell = {
            id: id2,
            columnId,
            value: Number(content)
          };
          return newCell;
        } else if (type === "date" /* DATE */) {
          const newCell = {
            id: id2,
            columnId,
            dateTime
          };
          return newCell;
        } else if (type === "checkbox" /* CHECKBOX */) {
          const value = isCheckboxChecked(content) ? true : false;
          const newCell = {
            id: id2,
            columnId,
            value
          };
          return newCell;
        } else if (type === "embed" /* EMBED */) {
          const isUrl = isUrlLink(content);
          let pathOrUrl = "";
          let saveAlias = null;
          if (isUrl) {
            pathOrUrl = content;
          } else {
            const { path, alias } = extractWikiLinkComponents(content);
            if (path !== null) {
              pathOrUrl = path;
              saveAlias = alias;
            }
          }
          const newCell = {
            id: id2,
            columnId,
            pathOrUrl,
            alias: saveAlias,
            isExternal: isExternalLink2
          };
          return newCell;
        } else if (type === "file" /* FILE */) {
          const { path, alias } = extractWikiLinkComponents(content);
          const newCell = {
            id: id2,
            columnId,
            path: path != null ? path : "",
            alias
          };
          return newCell;
        } else if (type === "tag" /* TAG */) {
          const newCell = {
            id: id2,
            columnId,
            tagId: tagIds.length > 0 ? tagIds[0] : null
          };
          return newCell;
        } else if (type === "multi-tag" /* MULTI_TAG */) {
          const newCell = {
            id: id2,
            columnId,
            tagIds
          };
          return newCell;
        } else if (type === "creation-time" /* CREATION_TIME */) {
          const newCell = {
            id: id2,
            columnId
          };
          return newCell;
        } else if (type === "last-edited-time" /* LAST_EDITED_TIME */) {
          const newCell = {
            id: id2,
            columnId
          };
          return newCell;
        } else if (type === "source" /* SOURCE */) {
          const newCell = {
            id: id2,
            columnId
          };
          return newCell;
        } else if (type === "source-file" /* SOURCE_FILE */) {
          const { path } = extractWikiLinkComponents(content);
          const newCell = {
            id: id2,
            columnId,
            path: path != null ? path : ""
          };
          return newCell;
        } else {
          throw new Error("Unhandled cell type");
        }
      });
      return {
        ...row,
        cells: nextCells
      };
    });
    const nextFilters = filters.map((filter3) => {
      const { type } = filter3;
      if (type === "checkbox" /* CHECKBOX */) {
        const { text } = filter3;
        return {
          ...filter3,
          value: isCheckboxChecked(text) ? true : false
        };
      }
      return filter3;
    });
    return {
      ...prevState,
      model: {
        ...prevState.model,
        rows: nextRows,
        filters: nextFilters
      }
    };
  }
};
var CHECKBOX_CHECKED_REGEX = new RegExp(/^\[[x]\]$/);
var isCheckboxChecked = (value) => {
  return value.match(CHECKBOX_CHECKED_REGEX) !== null;
};

// src/shared/loom-state/migrate/migrate-state-19.ts
var MigrateState19 = class {
  migrate(prevState) {
    const { sources } = prevState.model;
    const nextSources = sources.filter(
      (source) => source.type !== "tag" /* TAG */
    );
    return {
      ...prevState,
      model: {
        ...prevState.model,
        sources: nextSources
      }
    };
  }
};

// src/shared/frontmatter/types.ts
var ObsidianPropertyType = /* @__PURE__ */ ((ObsidianPropertyType2) => {
  ObsidianPropertyType2["TEXT"] = "text";
  ObsidianPropertyType2["NUMBER"] = "number";
  ObsidianPropertyType2["TAGS"] = "tags";
  ObsidianPropertyType2["MULTITEXT"] = "multitext";
  ObsidianPropertyType2["CHECKBOX"] = "checkbox";
  ObsidianPropertyType2["ALIASES"] = "aliases";
  ObsidianPropertyType2["DATETIME"] = "datetime";
  ObsidianPropertyType2["DATE"] = "date";
  return ObsidianPropertyType2;
})(ObsidianPropertyType || {});

// src/react/loom-app/option-bar/sources-menu/add-source-submenu/utils.ts
var getFilterConditionsForPropertyType = (type) => {
  switch (type) {
    case "text" /* TEXT */:
      return [
        "is" /* IS */,
        "is-not" /* IS_NOT */,
        "starts-with" /* STARTS_WITH */,
        "ends-with" /* ENDS_WITH */,
        "contains" /* CONTAINS */,
        "does-not-contain" /* DOES_NOT_CONTAIN */,
        "is-empty" /* IS_EMPTY */,
        "is-not-empty" /* IS_NOT_EMPTY */
      ];
    case "number" /* NUMBER */:
      return [
        "is-equal" /* IS_EQUAL */,
        "is-not-equal" /* IS_NOT_EQUAL */,
        "is-greater" /* IS_GREATER */,
        "is-less" /* IS_LESS */,
        "is-greater-or-equal" /* IS_GREATER_OR_EQUAL */,
        "is-less-or-equal" /* IS_LESS_OR_EQUAL */,
        "is-empty" /* IS_EMPTY */,
        "is-not-empty" /* IS_NOT_EMPTY */
      ];
    case "date" /* DATE */:
    case "datetime" /* DATETIME */:
      return [
        "is" /* IS */,
        "is-before" /* IS_BEFORE */,
        "is-after" /* IS_AFTER */,
        "is-empty" /* IS_EMPTY */,
        "is-not-empty" /* IS_NOT_EMPTY */
      ];
    case "aliases" /* ALIASES */:
    case "tags" /* TAGS */:
    case "multitext" /* MULTITEXT */:
      return [
        "contains" /* CONTAINS */,
        "does-not-contain" /* DOES_NOT_CONTAIN */,
        "is-empty" /* IS_EMPTY */,
        "is-not-empty" /* IS_NOT_EMPTY */
      ];
    case "checkbox" /* CHECKBOX */:
      return ["is" /* IS */, "is-not" /* IS_NOT */];
    default:
      return [];
  }
};

// src/shared/loom-state/migrate/migrate-state-20.ts
var MigrateState20 = class {
  migrate(prevState) {
    const { sources } = prevState.model;
    const nextSources = sources.map((source) => {
      const { type } = source;
      if (type === "frontmatter" /* FRONTMATTER */) {
        const { propertyType } = source;
        return {
          ...source,
          filterCondition: getFilterConditionsForPropertyType(propertyType)[0]
        };
      }
      return source;
    });
    return {
      ...prevState,
      model: {
        ...prevState.model,
        sources: nextSources
      }
    };
  }
};

// src/shared/loom-state/migrate/migrate-state-21.ts
var MigrateState21 = class {
  migrate(prevState) {
    const { rows } = prevState.model;
    const nextRows = rows.map((row) => {
      const { cells } = row;
      const nextCells = cells.map((cell) => {
        return {
          ...cell,
          hasValidFrontmatter: null
        };
      });
      return {
        ...row,
        cells: nextCells
      };
    });
    return {
      ...prevState,
      model: {
        ...prevState.model,
        rows: nextRows
      }
    };
  }
};

// src/shared/loom-state/migrate/migrate-state-22.ts
var MigrateState22 = class {
  migrate(prevState) {
    const { columns } = prevState.model;
    const nextColumns = columns.map((column) => {
      return {
        ...column,
        multiTagSortDir: "default" /* NONE */
      };
    });
    return {
      ...prevState,
      model: {
        ...prevState.model,
        columns: nextColumns
      }
    };
  }
};

// src/shared/loom-state/validate-state.ts
var import_runtypes = __toESM(require_lib());
var FilterOperatorUnion = (0, import_runtypes.Union)((0, import_runtypes.Literal)("and"), (0, import_runtypes.Literal)("or"));
var TextFilterConditionUnion = (0, import_runtypes.Union)(
  (0, import_runtypes.Literal)("is" /* IS */),
  (0, import_runtypes.Literal)("is-not" /* IS_NOT */),
  (0, import_runtypes.Literal)("contains" /* CONTAINS */),
  (0, import_runtypes.Literal)("does-not-contain" /* DOES_NOT_CONTAIN */),
  (0, import_runtypes.Literal)("starts-with" /* STARTS_WITH */),
  (0, import_runtypes.Literal)("ends-with" /* ENDS_WITH */),
  (0, import_runtypes.Literal)("is-empty" /* IS_EMPTY */),
  (0, import_runtypes.Literal)("is-not-empty" /* IS_NOT_EMPTY */)
);
var NumberFilterConditionUnion = (0, import_runtypes.Union)(
  (0, import_runtypes.Literal)("is-equal" /* IS_EQUAL */),
  (0, import_runtypes.Literal)("is-not-equal" /* IS_NOT_EQUAL */),
  (0, import_runtypes.Literal)("is-greater" /* IS_GREATER */),
  (0, import_runtypes.Literal)("is-less" /* IS_LESS */),
  (0, import_runtypes.Literal)("is-greater-or-equal" /* IS_GREATER_OR_EQUAL */),
  (0, import_runtypes.Literal)("is-less-or-equal" /* IS_LESS_OR_EQUAL */),
  (0, import_runtypes.Literal)("is-empty" /* IS_EMPTY */),
  (0, import_runtypes.Literal)("is-not-empty" /* IS_NOT_EMPTY */)
);
var DateFilterConditionUnion = (0, import_runtypes.Union)(
  (0, import_runtypes.Literal)("is" /* IS */),
  (0, import_runtypes.Literal)("is-before" /* IS_BEFORE */),
  (0, import_runtypes.Literal)("is-after" /* IS_AFTER */),
  (0, import_runtypes.Literal)("is-empty" /* IS_EMPTY */),
  (0, import_runtypes.Literal)("is-not-empty" /* IS_NOT_EMPTY */)
);
var DateFilterOptionUnion = (0, import_runtypes.Union)(
  (0, import_runtypes.Literal)("unselected" /* UNSELECTED */),
  (0, import_runtypes.Literal)("today" /* TODAY */),
  (0, import_runtypes.Literal)("tomorrow" /* TOMORROW */),
  (0, import_runtypes.Literal)("yesterday" /* YESTERDAY */),
  (0, import_runtypes.Literal)("one-week-ago" /* ONE_WEEK_AGO */),
  (0, import_runtypes.Literal)("one-week-from-now" /* ONE_WEEK_FROM_NOW */),
  (0, import_runtypes.Literal)("one-month-ago" /* ONE_MONTH_AGO */),
  (0, import_runtypes.Literal)("one-month-from-now" /* ONE_MONTH_FROM_NOW */)
);
var GeneralCalculationUnion = (0, import_runtypes.Union)(
  (0, import_runtypes.Literal)("none" /* NONE */),
  (0, import_runtypes.Literal)("count-all" /* COUNT_ALL */),
  (0, import_runtypes.Literal)("count-values" /* COUNT_VALUES */),
  (0, import_runtypes.Literal)("count-unique" /* COUNT_UNIQUE */),
  (0, import_runtypes.Literal)("count-empty" /* COUNT_EMPTY */),
  (0, import_runtypes.Literal)("count-not-empty" /* COUNT_NOT_EMPTY */),
  (0, import_runtypes.Literal)("percent-empty" /* PERCENT_EMPTY */),
  (0, import_runtypes.Literal)("percent-not-empty" /* PERCENT_NOT_EMPTY */)
);
var NumberCalculationUnion = (0, import_runtypes.Union)(
  (0, import_runtypes.Literal)("sum" /* SUM */),
  (0, import_runtypes.Literal)("avg" /* AVG */),
  (0, import_runtypes.Literal)("min" /* MIN */),
  (0, import_runtypes.Literal)("max" /* MAX */),
  (0, import_runtypes.Literal)("median" /* MEDIAN */),
  (0, import_runtypes.Literal)("range" /* RANGE */)
);
var CalculationTypeUnion = (0, import_runtypes.Union)(
  GeneralCalculationUnion,
  NumberCalculationUnion
);
var PaddingSizeUnion = (0, import_runtypes.Union)(
  (0, import_runtypes.Literal)("unset" /* UNSET */),
  (0, import_runtypes.Literal)("sm" /* SM */),
  (0, import_runtypes.Literal)("md" /* MD */),
  (0, import_runtypes.Literal)("lg" /* LG */),
  (0, import_runtypes.Literal)("xl" /* XL */),
  (0, import_runtypes.Literal)("2xl" /* XXL */),
  (0, import_runtypes.Literal)("3xl" /* XXXL */),
  (0, import_runtypes.Literal)("4xl" /* XXXXL */)
);
var AspectRatioUnion = (0, import_runtypes.Union)(
  (0, import_runtypes.Literal)("unset" /* UNSET */),
  (0, import_runtypes.Literal)("9/16" /* NINE_BY_SIXTEEN */),
  (0, import_runtypes.Literal)("4/3" /* FOUR_BY_THREE */),
  (0, import_runtypes.Literal)("16/9" /* SIXTEEN_BY_NINE */)
);
var ColorUnion = (0, import_runtypes.Union)(
  (0, import_runtypes.Literal)("light gray" /* LIGHT_GRAY */),
  (0, import_runtypes.Literal)("gray" /* GRAY */),
  (0, import_runtypes.Literal)("brown" /* BROWN */),
  (0, import_runtypes.Literal)("orange" /* ORANGE */),
  (0, import_runtypes.Literal)("yellow" /* YELLOW */),
  (0, import_runtypes.Literal)("green" /* GREEN */),
  (0, import_runtypes.Literal)("blue" /* BLUE */),
  (0, import_runtypes.Literal)("purple" /* PURPLE */),
  (0, import_runtypes.Literal)("pink" /* PINK */),
  (0, import_runtypes.Literal)("red" /* RED */)
);
var SortDirUnion = (0, import_runtypes.Union)(
  (0, import_runtypes.Literal)("asc" /* ASC */),
  (0, import_runtypes.Literal)("desc" /* DESC */),
  (0, import_runtypes.Literal)("default" /* NONE */)
);
var CellTypeUnion = (0, import_runtypes.Union)(
  (0, import_runtypes.Literal)("text" /* TEXT */),
  (0, import_runtypes.Literal)("source" /* SOURCE */),
  (0, import_runtypes.Literal)("source-file" /* SOURCE_FILE */),
  (0, import_runtypes.Literal)("embed" /* EMBED */),
  (0, import_runtypes.Literal)("file" /* FILE */),
  (0, import_runtypes.Literal)("number" /* NUMBER */),
  (0, import_runtypes.Literal)("tag" /* TAG */),
  (0, import_runtypes.Literal)("multi-tag" /* MULTI_TAG */),
  (0, import_runtypes.Literal)("date" /* DATE */),
  (0, import_runtypes.Literal)("checkbox" /* CHECKBOX */),
  (0, import_runtypes.Literal)("creation-time" /* CREATION_TIME */),
  (0, import_runtypes.Literal)("last-edited-time" /* LAST_EDITED_TIME */)
);
var DateFormatUnion = (0, import_runtypes.Union)(
  (0, import_runtypes.Literal)("mmddyyyy" /* MM_DD_YYYY */),
  (0, import_runtypes.Literal)("ddmmyyyy" /* DD_MM_YYYY */),
  (0, import_runtypes.Literal)("yyyymmdd" /* YYYY_MM_DD */)
);
var DateFormatSeparatorUnion = (0, import_runtypes.Union)(
  (0, import_runtypes.Literal)("-" /* HYPHEN */),
  (0, import_runtypes.Literal)("/" /* SLASH */),
  (0, import_runtypes.Literal)("." /* DOT */)
);
var NumberFormatUnion = (0, import_runtypes.Union)(
  (0, import_runtypes.Literal)("number" /* NUMBER */),
  (0, import_runtypes.Literal)("currency" /* CURRENCY */)
);
var CurrencyUnion = (0, import_runtypes.Union)(
  (0, import_runtypes.Literal)("ARS" /* ARGENTINA */),
  (0, import_runtypes.Literal)("AUD" /* AUSTRALIA */),
  (0, import_runtypes.Literal)("BRL" /* BRAZIL */),
  (0, import_runtypes.Literal)("CAD" /* CANADA */),
  (0, import_runtypes.Literal)("CNY" /* CHINA */),
  (0, import_runtypes.Literal)("COP" /* COLOMBIA */),
  (0, import_runtypes.Literal)("DKK" /* DENMARK */),
  (0, import_runtypes.Literal)("EUR" /* EUROPE */),
  (0, import_runtypes.Literal)("GBP" /* GREAT_BRITAIN */),
  (0, import_runtypes.Literal)("ISK" /* ICELAND */),
  (0, import_runtypes.Literal)("ILS" /* ISRAEL */),
  (0, import_runtypes.Literal)("INR" /* INDIA */),
  (0, import_runtypes.Literal)("JPY" /* JAPAN */),
  (0, import_runtypes.Literal)("MXN" /* MEXICO */),
  (0, import_runtypes.Literal)("NOK" /* NORWAY */),
  (0, import_runtypes.Literal)("RUB" /* RUSSIA */),
  (0, import_runtypes.Literal)("SAR" /* SAUDI_ARABIA */),
  (0, import_runtypes.Literal)("SGB" /* SINGAPORE */),
  (0, import_runtypes.Literal)("KRW" /* SOUTH_KOREA */),
  (0, import_runtypes.Literal)("SEK" /* SWEDEN */),
  (0, import_runtypes.Literal)("CHF" /* SWITZERLAND */),
  (0, import_runtypes.Literal)("AED" /* UAE */),
  (0, import_runtypes.Literal)("USD" /* UNITED_STATES */)
);
var BaseFilter = (0, import_runtypes.Record)({
  id: import_runtypes.String,
  columnId: import_runtypes.String,
  operator: FilterOperatorUnion,
  isEnabled: import_runtypes.Boolean
});
var TextFilter = BaseFilter.extend({
  type: (0, import_runtypes.Literal)("text" /* TEXT */),
  condition: TextFilterConditionUnion,
  text: import_runtypes.String
});
var FileFilter = BaseFilter.extend({
  type: (0, import_runtypes.Literal)("file" /* FILE */),
  condition: TextFilterConditionUnion,
  text: import_runtypes.String
});
var SourceFileFilter = BaseFilter.extend({
  type: (0, import_runtypes.Literal)("source-file" /* SOURCE_FILE */),
  condition: TextFilterConditionUnion,
  text: import_runtypes.String
});
var CheckboxConditionUnion = (0, import_runtypes.Union)(
  (0, import_runtypes.Literal)("is" /* IS */),
  (0, import_runtypes.Literal)("is-not" /* IS_NOT */)
);
var CheckboxFilter = BaseFilter.extend({
  type: (0, import_runtypes.Literal)("checkbox" /* CHECKBOX */),
  condition: CheckboxConditionUnion,
  value: import_runtypes.Boolean
});
var TagFilterConditionUnion = (0, import_runtypes.Union)(
  (0, import_runtypes.Literal)("is" /* IS */),
  (0, import_runtypes.Literal)("is-not" /* IS_NOT */),
  (0, import_runtypes.Literal)("is-empty" /* IS_EMPTY */),
  (0, import_runtypes.Literal)("is-not-empty" /* IS_NOT_EMPTY */)
);
var TagFilter = BaseFilter.extend({
  type: (0, import_runtypes.Literal)("tag" /* TAG */),
  condition: TagFilterConditionUnion,
  tagId: import_runtypes.String
});
var MultiTagConditionUnion = (0, import_runtypes.Union)(
  (0, import_runtypes.Literal)("contains" /* CONTAINS */),
  (0, import_runtypes.Literal)("does-not-contain" /* DOES_NOT_CONTAIN */),
  (0, import_runtypes.Literal)("is-empty" /* IS_EMPTY */),
  (0, import_runtypes.Literal)("is-not-empty" /* IS_NOT_EMPTY */)
);
var MultiTagFilter = BaseFilter.extend({
  type: (0, import_runtypes.Literal)("multi-tag" /* MULTI_TAG */),
  condition: MultiTagConditionUnion,
  tagIds: (0, import_runtypes.Array)(import_runtypes.String)
});
var EmbedConditionUnion = (0, import_runtypes.Union)(
  (0, import_runtypes.Literal)("is-empty" /* IS_EMPTY */),
  (0, import_runtypes.Literal)("is-not-empty" /* IS_NOT_EMPTY */)
);
var EmbedFilter = BaseFilter.extend({
  type: (0, import_runtypes.Literal)("embed" /* EMBED */),
  condition: EmbedConditionUnion,
  text: import_runtypes.String
});
var NumberFilter = BaseFilter.extend({
  type: (0, import_runtypes.Literal)("number" /* NUMBER */),
  condition: NumberFilterConditionUnion,
  text: import_runtypes.String
});
var DateFilter = BaseFilter.extend({
  type: (0, import_runtypes.Literal)("date" /* DATE */),
  condition: DateFilterConditionUnion,
  option: DateFilterOptionUnion,
  dateTime: (0, import_runtypes.Union)(import_runtypes.String, (0, import_runtypes.Literal)(null))
});
var CreationTimeConditionUnion = (0, import_runtypes.Union)(
  (0, import_runtypes.Literal)("is" /* IS */),
  (0, import_runtypes.Literal)("is-after" /* IS_AFTER */),
  (0, import_runtypes.Literal)("is-before" /* IS_BEFORE */)
);
var CreationTimeFilter = BaseFilter.extend({
  type: (0, import_runtypes.Literal)("creation-time" /* CREATION_TIME */),
  condition: CreationTimeConditionUnion,
  option: DateFilterOptionUnion,
  dateTime: (0, import_runtypes.Union)(import_runtypes.String, (0, import_runtypes.Literal)(null))
});
var LastEditedTimeConditionUnion = (0, import_runtypes.Union)(
  (0, import_runtypes.Literal)("is" /* IS */),
  (0, import_runtypes.Literal)("is-after" /* IS_AFTER */),
  (0, import_runtypes.Literal)("is-before" /* IS_BEFORE */)
);
var LastEditedTimeFilter = BaseFilter.extend({
  type: (0, import_runtypes.Literal)("last-edited-time" /* LAST_EDITED_TIME */),
  condition: LastEditedTimeConditionUnion,
  option: DateFilterOptionUnion,
  dateTime: (0, import_runtypes.Union)(import_runtypes.String, (0, import_runtypes.Literal)(null))
});
var Filter2 = (0, import_runtypes.Union)(
  TextFilter,
  TagFilter,
  MultiTagFilter,
  CheckboxFilter,
  FileFilter,
  EmbedFilter,
  NumberFilter,
  DateFilter,
  CreationTimeFilter,
  LastEditedTimeFilter,
  SourceFileFilter
);
var Tag = (0, import_runtypes.Record)({
  id: import_runtypes.String,
  content: import_runtypes.String,
  color: ColorUnion
});
var Column3 = (0, import_runtypes.Record)({
  id: import_runtypes.String,
  sortDir: SortDirUnion,
  width: import_runtypes.String,
  type: CellTypeUnion,
  isVisible: import_runtypes.Boolean,
  dateFormat: DateFormatUnion,
  dateFormatSeparator: DateFormatSeparatorUnion,
  hour12: import_runtypes.Boolean,
  includeTime: import_runtypes.Boolean,
  content: import_runtypes.String,
  numberFormat: NumberFormatUnion,
  currencyType: CurrencyUnion,
  numberPrefix: import_runtypes.String,
  numberSuffix: import_runtypes.String,
  numberSeparator: import_runtypes.String,
  shouldWrapOverflow: import_runtypes.Boolean,
  tags: (0, import_runtypes.Array)(Tag),
  calculationType: CalculationTypeUnion,
  aspectRatio: AspectRatioUnion,
  horizontalPadding: PaddingSizeUnion,
  verticalPadding: PaddingSizeUnion,
  multiTagSortDir: SortDirUnion
});
var BaseCell = (0, import_runtypes.Record)({
  id: import_runtypes.String,
  columnId: import_runtypes.String,
  hasValidFrontmatter: (0, import_runtypes.Union)(import_runtypes.Boolean, (0, import_runtypes.Literal)(null))
});
var TextCell2 = BaseCell.extend({
  content: import_runtypes.String
});
var EmbedCell2 = BaseCell.extend({
  content: import_runtypes.String
});
var FileCell2 = BaseCell.extend({
  isExternalLink: import_runtypes.Boolean,
  content: import_runtypes.String
});
var NumberCell2 = BaseCell.extend({
  content: (0, import_runtypes.Union)(import_runtypes.Number, (0, import_runtypes.Literal)(null))
});
var TagCell2 = BaseCell.extend({
  tagId: (0, import_runtypes.Union)(import_runtypes.String, (0, import_runtypes.Literal)(null))
});
var MultiTagCell2 = BaseCell.extend({
  tagIds: (0, import_runtypes.Array)(import_runtypes.String)
});
var DateCell2 = BaseCell.extend({
  dateTime: (0, import_runtypes.Union)(import_runtypes.String, (0, import_runtypes.Literal)(null))
});
var CheckboxCell2 = BaseCell.extend({
  content: import_runtypes.Boolean
});
var CreationTimeCell2 = BaseCell.extend({});
var LastEditedTimeCell2 = BaseCell.extend({});
var SourceFileCell2 = BaseCell.extend({});
var SourceCell2 = BaseCell.extend({});
var Cell = (0, import_runtypes.Union)(
  TextCell2,
  TagCell2,
  MultiTagCell2,
  CheckboxCell2,
  FileCell2,
  EmbedCell2,
  NumberCell2,
  DateCell2,
  CreationTimeCell2,
  LastEditedTimeCell2,
  SourceCell2,
  SourceFileCell2
);
var Row = (0, import_runtypes.Record)({
  id: import_runtypes.String,
  index: import_runtypes.Number,
  creationDateTime: import_runtypes.String,
  lastEditedDateTime: import_runtypes.String,
  cells: (0, import_runtypes.Array)(Cell)
});
var SourceUnion = (0, import_runtypes.Union)(
  (0, import_runtypes.Literal)("folder" /* FOLDER */),
  (0, import_runtypes.Literal)("frontmatter" /* FRONTMATTER */)
);
var BaseSource = (0, import_runtypes.Record)({
  id: import_runtypes.String,
  type: SourceUnion
});
var ObsidianFolderSource = BaseSource.extend({
  type: (0, import_runtypes.Literal)("folder" /* FOLDER */),
  path: import_runtypes.String,
  includeSubfolders: import_runtypes.Boolean
});
var ObsidianPropertyTypeUnion = (0, import_runtypes.Union)(
  (0, import_runtypes.Literal)("aliases" /* ALIASES */),
  (0, import_runtypes.Literal)("checkbox" /* CHECKBOX */),
  (0, import_runtypes.Literal)("date" /* DATE */),
  (0, import_runtypes.Literal)("datetime" /* DATETIME */),
  (0, import_runtypes.Literal)("number" /* NUMBER */),
  (0, import_runtypes.Literal)("text" /* TEXT */),
  (0, import_runtypes.Literal)("tags" /* TAGS */),
  (0, import_runtypes.Literal)("multitext" /* MULTITEXT */)
);
var ObsidianFrontmatterSource = BaseSource.extend({
  type: (0, import_runtypes.Literal)("frontmatter" /* FRONTMATTER */),
  propertyType: ObsidianPropertyTypeUnion,
  propertyKey: import_runtypes.String,
  filterCondition: (0, import_runtypes.Union)(
    TextFilterConditionUnion,
    NumberFilterConditionUnion,
    DateFilterConditionUnion
  ),
  filterText: import_runtypes.String
});
var Source = (0, import_runtypes.Union)(ObsidianFolderSource, ObsidianFrontmatterSource);
var TableSettings = (0, import_runtypes.Record)({
  numFrozenColumns: import_runtypes.Number,
  showCalculationRow: import_runtypes.Boolean
});
var SourceRowOrder = (0, import_runtypes.Record)({
  sourceId: import_runtypes.String,
  index: import_runtypes.Number,
  uniqueId: import_runtypes.String
});
var TableModel = (0, import_runtypes.Record)({
  columns: (0, import_runtypes.Array)(Column3),
  rows: (0, import_runtypes.Array)(Row),
  filters: (0, import_runtypes.Array)(Filter2),
  settings: TableSettings,
  sources: (0, import_runtypes.Array)(Source),
  externalRowOrder: (0, import_runtypes.Array)(SourceRowOrder)
});
var LoomStateObject = (0, import_runtypes.Record)({
  pluginVersion: import_runtypes.String,
  model: TableModel
});

// src/data/deserialization-error.ts
var import_runtypes2 = __toESM(require_lib());
var DeserializationError = class extends Error {
  constructor(error, pluginVersion, fileVersion, failedMigration) {
    let message = "";
    if (error instanceof import_runtypes2.ValidationError) {
      message = JSON.stringify(error.details, null, 2);
    } else {
      message = error.message;
    }
    super(message);
    this.name = "DeserializationError";
    this.pluginVersion = pluginVersion;
    this.fileVersion = fileVersion;
    this.failedMigration = failedMigration;
  }
};

// src/data/serialize-state.ts
var serializeState = (state) => {
  const filteredRows = state.model.rows.filter(
    (row) => row.sourceId === null
  );
  const filteredState = {
    ...state,
    model: {
      ...state.model,
      rows: filteredRows
    }
  };
  return JSON.stringify(filteredState, null, 2);
};
var deserializeState = (data, pluginVersion) => {
  let fileVersion = "Unknown";
  let failedMigration = null;
  try {
    const parsedState = JSON.parse(data);
    const untypedVersion = parsedState["pluginVersion"];
    if (typeof untypedVersion === "number") {
      fileVersion = legacyVersionToString(untypedVersion);
    } else if (typeof untypedVersion === "string") {
      fileVersion = untypedVersion;
    }
    if (isVersionLessThan(pluginVersion, fileVersion)) {
      throw new Error(
        "Loom was made with a newer plugin version. Please update the DataLoom plugin of this vault."
      );
    }
    let currentState = parsedState;
    const VERSION_6_1_0 = "6.1.0";
    if (isVersionLessThan(fileVersion, VERSION_6_1_0)) {
      failedMigration = VERSION_6_1_0;
      const nextState = new MigrateState0().migrate(
        currentState
      );
      currentState = nextState;
      failedMigration = null;
    }
    const VERSION_6_2_0 = "6.2.0";
    if (isVersionLessThan(fileVersion, VERSION_6_2_0)) {
      failedMigration = VERSION_6_2_0;
      const nextState = new MigrateState1().migrate(
        currentState
      );
      currentState = nextState;
      failedMigration = null;
    }
    const VERSION_6_3_0 = "6.3.0";
    if (isVersionLessThan(fileVersion, VERSION_6_3_0)) {
      failedMigration = VERSION_6_3_0;
      const nextState = new MigrateState2().migrate(
        currentState
      );
      currentState = nextState;
      failedMigration = null;
    }
    const VERSION_6_4_0 = "6.4.0";
    if (isVersionLessThan(fileVersion, VERSION_6_4_0)) {
      failedMigration = VERSION_6_4_0;
      const nextState = new MigrateState3().migrate(
        currentState
      );
      currentState = nextState;
      failedMigration = null;
    }
    const VERSION_6_8_0 = "6.8.0";
    if (isVersionLessThan(fileVersion, VERSION_6_8_0)) {
      failedMigration = VERSION_6_8_0;
      const nextState = new MigrateState4().migrate(
        currentState
      );
      currentState = nextState;
      failedMigration = null;
    }
    const VERSION_6_9_1 = "6.9.1";
    if (isVersionLessThan(fileVersion, VERSION_6_9_1)) {
      failedMigration = VERSION_6_9_1;
      const nextState = new MigrateState5().migrate(
        currentState
      );
      currentState = nextState;
      failedMigration = null;
    }
    const VERSION_6_10_0 = "6.10.0";
    if (isVersionLessThan(fileVersion, VERSION_6_10_0)) {
      failedMigration = VERSION_6_10_0;
      const nextState = new MigrateState6().migrate(
        currentState
      );
      currentState = nextState;
      failedMigration = null;
    }
    const VERSION_6_12_3 = "6.12.3";
    if (isVersionLessThan(fileVersion, VERSION_6_12_3)) {
      failedMigration = VERSION_6_12_3;
      const nextState = new MigrateState7().migrate(
        currentState
      );
      currentState = nextState;
      failedMigration = VERSION_6_12_3;
    }
    const VERSION_6_17_0 = "6.17.0";
    if (isVersionLessThan(fileVersion, VERSION_6_17_0)) {
      failedMigration = VERSION_6_17_0;
      const nextState = new MigrateState8().migrate(
        currentState
      );
      currentState = nextState;
      failedMigration = null;
    }
    const VERSION_6_18_6 = "6.18.6";
    if (isVersionLessThan(fileVersion, VERSION_6_18_6)) {
      failedMigration = VERSION_6_18_6;
      const nextState = new MigrateState9().migrate(
        currentState
      );
      currentState = nextState;
      failedMigration = null;
    }
    const VERSION_6_19_0 = "6.19.0";
    if (isVersionLessThan(fileVersion, VERSION_6_19_0)) {
      failedMigration = VERSION_6_19_0;
      const nextState = new MigrateState10().migrate(
        currentState
      );
      currentState = nextState;
      failedMigration = null;
    }
    const VERSION_8_2_0 = "8.2.0";
    if (isVersionLessThan(fileVersion, VERSION_8_2_0)) {
      failedMigration = VERSION_8_2_0;
      const nextState = new MigrateState11().migrate(
        currentState
      );
      currentState = nextState;
      failedMigration = null;
    }
    const VERSION_8_5_0 = "8.5.0";
    if (isVersionLessThan(fileVersion, VERSION_8_5_0)) {
      failedMigration = VERSION_8_5_0;
      const nextState = new MigrateState12().migrate(
        currentState
      );
      currentState = nextState;
      failedMigration = null;
    }
    const VERSION_8_6_0 = "8.6.0";
    if (isVersionLessThan(fileVersion, VERSION_8_6_0)) {
      failedMigration = VERSION_8_6_0;
      const nextState = new MigrateState13().migrate(
        currentState
      );
      currentState = nextState;
      failedMigration = null;
    }
    const VERSION_8_7_0 = "8.7.0";
    if (isVersionLessThan(fileVersion, VERSION_8_7_0)) {
      failedMigration = VERSION_8_7_0;
      const nextState = new MigrateState14().migrate(
        currentState
      );
      currentState = nextState;
      failedMigration = null;
    }
    const VERSION_8_8_0 = "8.8.0";
    if (isVersionLessThan(fileVersion, VERSION_8_8_0)) {
      failedMigration = VERSION_8_8_0;
      const nextState = new MigrateState15().migrate(
        currentState
      );
      currentState = nextState;
      failedMigration = null;
    }
    const VERSION_8_11_0 = "8.11.0";
    if (isVersionLessThan(fileVersion, VERSION_8_11_0)) {
      failedMigration = VERSION_8_11_0;
      const nextState = new MigrateState16().migrate(
        currentState
      );
      currentState = nextState;
      failedMigration = null;
    }
    const VERSION_8_12_0 = "8.12.0";
    if (isVersionLessThan(fileVersion, VERSION_8_12_0)) {
      failedMigration = VERSION_8_12_0;
      const nextState = new MigrateState17().migrate(
        currentState
      );
      currentState = nextState;
      failedMigration = null;
    }
    const VERSION_8_13_0 = "8.13.0";
    if (isVersionLessThan(fileVersion, VERSION_8_13_0)) {
      failedMigration = VERSION_8_13_0;
      const nextState = new MigrateState18().migrate(
        currentState
      );
      currentState = nextState;
      failedMigration = null;
    }
    const VERSION_8_15_0 = "8.15.0";
    if (isVersionLessThan(fileVersion, VERSION_8_15_0)) {
      failedMigration = VERSION_8_15_0;
      const nextState = new MigrateState19().migrate(
        currentState
      );
      currentState = nextState;
      failedMigration = null;
    }
    const VERSION_8_15_1 = "8.15.1";
    if (isVersionLessThan(fileVersion, VERSION_8_15_1)) {
      failedMigration = VERSION_8_15_1;
      const nextState = new MigrateState20().migrate(
        currentState
      );
      currentState = nextState;
      failedMigration = null;
    }
    const VERSION_8_15_6 = "8.15.6";
    if (isVersionLessThan(fileVersion, VERSION_8_15_6)) {
      failedMigration = VERSION_8_15_6;
      const nextState = new MigrateState21().migrate(
        currentState
      );
      currentState = nextState;
      failedMigration = null;
    }
    const VERSION_8_16_0 = "8.16.0";
    if (isVersionLessThan(fileVersion, VERSION_8_16_0)) {
      failedMigration = VERSION_8_16_0;
      const nextState = new MigrateState22().migrate(
        currentState
      );
      currentState = nextState;
      failedMigration = null;
    }
    LoomStateObject.check(currentState);
    const state = currentState;
    state.pluginVersion = pluginVersion;
    return state;
  } catch (err) {
    throw new DeserializationError(
      err,
      pluginVersion,
      fileVersion,
      failedMigration
    );
  }
};

// src/obsidian/embedded/embedded-app-manager.tsx
var import_lodash16 = __toESM(require_lodash());

// node_modules/react-redux/es/index.js
var import_shim = __toESM(require_shim());
var import_with_selector = __toESM(require_with_selector());

// node_modules/react-redux/es/utils/reactBatchedUpdates.js
var import_react_dom = __toESM(require_react_dom());

// node_modules/react-redux/es/utils/batch.js
function defaultNoopBatch(callback) {
  callback();
}
var batch = defaultNoopBatch;
var setBatch = (newBatch) => batch = newBatch;
var getBatch = () => batch;

// node_modules/react-redux/es/hooks/useSelector.js
var import_react2 = __toESM(require_react());

// node_modules/react-redux/es/hooks/useReduxContext.js
var import_react = __toESM(require_react());

// node_modules/react-redux/es/components/Context.js
var React = __toESM(require_react());
var ContextKey = Symbol.for(`react-redux-context`);
var gT = typeof globalThis !== "undefined" ? globalThis : (
  /* fall back to a per-module scope (pre-8.1 behaviour) if `globalThis` is not available */
  {}
);
function getContext() {
  var _gT$ContextKey;
  if (!React.createContext)
    return {};
  const contextMap = (_gT$ContextKey = gT[ContextKey]) != null ? _gT$ContextKey : gT[ContextKey] = /* @__PURE__ */ new Map();
  let realContext = contextMap.get(React.createContext);
  if (!realContext) {
    realContext = React.createContext(null);
    if (true) {
      realContext.displayName = "ReactRedux";
    }
    contextMap.set(React.createContext, realContext);
  }
  return realContext;
}
var ReactReduxContext = /* @__PURE__ */ getContext();

// node_modules/react-redux/es/hooks/useReduxContext.js
function createReduxContextHook(context = ReactReduxContext) {
  return function useReduxContext2() {
    const contextValue = (0, import_react.useContext)(context);
    if (!contextValue) {
      throw new Error("could not find react-redux context value; please ensure the component is wrapped in a <Provider>");
    }
    return contextValue;
  };
}
var useReduxContext = /* @__PURE__ */ createReduxContextHook();

// node_modules/react-redux/es/utils/useSyncExternalStore.js
var notInitialized = () => {
  throw new Error("uSES not initialized!");
};

// node_modules/react-redux/es/hooks/useSelector.js
var useSyncExternalStoreWithSelector = notInitialized;
var initializeUseSelector = (fn2) => {
  useSyncExternalStoreWithSelector = fn2;
};
var refEquality = (a2, b2) => a2 === b2;
function createSelectorHook(context = ReactReduxContext) {
  const useReduxContext2 = context === ReactReduxContext ? useReduxContext : createReduxContextHook(context);
  return function useSelector2(selector, equalityFnOrOptions = {}) {
    const {
      equalityFn = refEquality,
      stabilityCheck = void 0,
      noopCheck = void 0
    } = typeof equalityFnOrOptions === "function" ? {
      equalityFn: equalityFnOrOptions
    } : equalityFnOrOptions;
    if (true) {
      if (!selector) {
        throw new Error(`You must pass a selector to useSelector`);
      }
      if (typeof selector !== "function") {
        throw new Error(`You must pass a function as a selector to useSelector`);
      }
      if (typeof equalityFn !== "function") {
        throw new Error(`You must pass a function as an equality function to useSelector`);
      }
    }
    const {
      store: store2,
      subscription,
      getServerState,
      stabilityCheck: globalStabilityCheck,
      noopCheck: globalNoopCheck
    } = useReduxContext2();
    const firstRun = (0, import_react2.useRef)(true);
    const wrappedSelector = (0, import_react2.useCallback)({
      [selector.name](state) {
        const selected = selector(state);
        if (true) {
          const finalStabilityCheck = typeof stabilityCheck === "undefined" ? globalStabilityCheck : stabilityCheck;
          if (finalStabilityCheck === "always" || finalStabilityCheck === "once" && firstRun.current) {
            const toCompare = selector(state);
            if (!equalityFn(selected, toCompare)) {
              let stack = void 0;
              try {
                throw new Error();
              } catch (e) {
                ;
                ({
                  stack
                } = e);
              }
              console.warn("Selector " + (selector.name || "unknown") + " returned a different result when called with the same parameters. This can lead to unnecessary rerenders.\nSelectors that return a new reference (such as an object or an array) should be memoized: https://redux.js.org/usage/deriving-data-selectors#optimizing-selectors-with-memoization", {
                state,
                selected,
                selected2: toCompare,
                stack
              });
            }
          }
          const finalNoopCheck = typeof noopCheck === "undefined" ? globalNoopCheck : noopCheck;
          if (finalNoopCheck === "always" || finalNoopCheck === "once" && firstRun.current) {
            if (selected === state) {
              let stack = void 0;
              try {
                throw new Error();
              } catch (e) {
                ;
                ({
                  stack
                } = e);
              }
              console.warn("Selector " + (selector.name || "unknown") + " returned the root state when called. This can lead to unnecessary rerenders.\nSelectors that return the entire state are almost certainly a mistake, as they will cause a rerender whenever *anything* in state changes.", {
                stack
              });
            }
          }
          if (firstRun.current)
            firstRun.current = false;
        }
        return selected;
      }
    }[selector.name], [selector, globalStabilityCheck, stabilityCheck]);
    const selectedState = useSyncExternalStoreWithSelector(subscription.addNestedSub, store2.getState, getServerState || store2.getState, wrappedSelector, equalityFn);
    (0, import_react2.useDebugValue)(selectedState);
    return selectedState;
  };
}
var useSelector = /* @__PURE__ */ createSelectorHook();

// node_modules/react-redux/es/components/connect.js
var import_hoist_non_react_statics = __toESM(require_hoist_non_react_statics_cjs());
var React3 = __toESM(require_react());
var import_react_is = __toESM(require_react_is2());

// node_modules/react-redux/es/utils/Subscription.js
function createListenerCollection() {
  const batch2 = getBatch();
  let first = null;
  let last2 = null;
  return {
    clear() {
      first = null;
      last2 = null;
    },
    notify() {
      batch2(() => {
        let listener2 = first;
        while (listener2) {
          listener2.callback();
          listener2 = listener2.next;
        }
      });
    },
    get() {
      let listeners = [];
      let listener2 = first;
      while (listener2) {
        listeners.push(listener2);
        listener2 = listener2.next;
      }
      return listeners;
    },
    subscribe(callback) {
      let isSubscribed = true;
      let listener2 = last2 = {
        callback,
        next: null,
        prev: last2
      };
      if (listener2.prev) {
        listener2.prev.next = listener2;
      } else {
        first = listener2;
      }
      return function unsubscribe() {
        if (!isSubscribed || first === null)
          return;
        isSubscribed = false;
        if (listener2.next) {
          listener2.next.prev = listener2.prev;
        } else {
          last2 = listener2.prev;
        }
        if (listener2.prev) {
          listener2.prev.next = listener2.next;
        } else {
          first = listener2.next;
        }
      };
    }
  };
}
var nullListeners = {
  notify() {
  },
  get: () => []
};
function createSubscription(store2, parentSub) {
  let unsubscribe;
  let listeners = nullListeners;
  let subscriptionsAmount = 0;
  let selfSubscribed = false;
  function addNestedSub(listener2) {
    trySubscribe();
    const cleanupListener = listeners.subscribe(listener2);
    let removed = false;
    return () => {
      if (!removed) {
        removed = true;
        cleanupListener();
        tryUnsubscribe();
      }
    };
  }
  function notifyNestedSubs() {
    listeners.notify();
  }
  function handleChangeWrapper() {
    if (subscription.onStateChange) {
      subscription.onStateChange();
    }
  }
  function isSubscribed() {
    return selfSubscribed;
  }
  function trySubscribe() {
    subscriptionsAmount++;
    if (!unsubscribe) {
      unsubscribe = parentSub ? parentSub.addNestedSub(handleChangeWrapper) : store2.subscribe(handleChangeWrapper);
      listeners = createListenerCollection();
    }
  }
  function tryUnsubscribe() {
    subscriptionsAmount--;
    if (unsubscribe && subscriptionsAmount === 0) {
      unsubscribe();
      unsubscribe = void 0;
      listeners.clear();
      listeners = nullListeners;
    }
  }
  function trySubscribeSelf() {
    if (!selfSubscribed) {
      selfSubscribed = true;
      trySubscribe();
    }
  }
  function tryUnsubscribeSelf() {
    if (selfSubscribed) {
      selfSubscribed = false;
      tryUnsubscribe();
    }
  }
  const subscription = {
    addNestedSub,
    notifyNestedSubs,
    handleChangeWrapper,
    isSubscribed,
    trySubscribe: trySubscribeSelf,
    tryUnsubscribe: tryUnsubscribeSelf,
    getListeners: () => listeners
  };
  return subscription;
}

// node_modules/react-redux/es/utils/useIsomorphicLayoutEffect.js
var React2 = __toESM(require_react());
var canUseDOM = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
var useIsomorphicLayoutEffect = canUseDOM ? React2.useLayoutEffect : React2.useEffect;

// node_modules/react-redux/es/components/connect.js
var useSyncExternalStore = notInitialized;
var initializeConnect = (fn2) => {
  useSyncExternalStore = fn2;
};

// node_modules/react-redux/es/components/Provider.js
var React4 = __toESM(require_react());
function Provider({
  store: store2,
  context,
  children,
  serverState,
  stabilityCheck = "once",
  noopCheck = "once"
}) {
  const contextValue = React4.useMemo(() => {
    const subscription = createSubscription(store2);
    return {
      store: store2,
      subscription,
      getServerState: serverState ? () => serverState : void 0,
      stabilityCheck,
      noopCheck
    };
  }, [store2, serverState, stabilityCheck, noopCheck]);
  const previousState = React4.useMemo(() => store2.getState(), [store2]);
  useIsomorphicLayoutEffect(() => {
    const {
      subscription
    } = contextValue;
    subscription.onStateChange = subscription.notifyNestedSubs;
    subscription.trySubscribe();
    if (previousState !== store2.getState()) {
      subscription.notifyNestedSubs();
    }
    return () => {
      subscription.tryUnsubscribe();
      subscription.onStateChange = void 0;
    };
  }, [contextValue, previousState]);
  const Context = context || ReactReduxContext;
  return /* @__PURE__ */ React4.createElement(Context.Provider, {
    value: contextValue
  }, children);
}
var Provider_default = Provider;

// node_modules/react-redux/es/index.js
initializeUseSelector(import_with_selector.useSyncExternalStoreWithSelector);
initializeConnect(import_shim.useSyncExternalStore);
setBatch(import_react_dom.unstable_batchedUpdates);

// src/react/loom-app/loom-state-provider/index.tsx
var import_react4 = __toESM(require_react());

// src/shared/error/cell-not-found-error.ts
var CellNotFoundError = class extends Error {
  constructor(options) {
    const { id: id2, rowId, columnId } = options || {};
    let message = "";
    if (rowId && columnId) {
      message = `Cannot find cell with row id: ${rowId} and column id: ${columnId}`;
    } else if (rowId) {
      message = `Cannot find cell with row id: ${rowId}`;
    } else if (columnId) {
      message = `Cannot find cell with column id: ${columnId}`;
    } else {
      message = `Cannot find cell with id: ${id2}`;
    }
    super(message);
    this.name = "CellNotFoundError";
  }
};

// src/shared/error/tag-not-found-error.ts
var TagNotFoundError = class extends Error {
  constructor(id2) {
    super(`Cannot find tag with id: ${id2}`);
    this.name = "TagNotFoundError";
  }
};

// src/shared/cell-content/source-cell-content.ts
var getSourceCellContent = (source) => {
  if (source === null)
    return "Internal";
  const { type } = source;
  switch (type) {
    case "folder" /* FOLDER */: {
      const { path } = source;
      return path;
    }
    case "frontmatter" /* FRONTMATTER */: {
      const { propertyKey } = source;
      return propertyKey;
    }
    default:
      throw new Error("Source type not supported");
  }
};

// src/shared/sort-utils.ts
var confirmSortOrderChange = (state) => {
  const { columns } = state.model;
  const isSorted = columns.find((column) => column.sortDir !== "default" /* NONE */);
  if (isSorted) {
    return window.confirm(
      "This will set the default row sorting as the current sort order. Do you wish to continue?\n\nIf not, please remove the sort filter before preforming this operation."
    );
  }
  return true;
};
var sortByBoolean = (a2, b2, sortDir) => {
  if (sortDir === "asc" /* ASC */) {
    if (a2 && !b2)
      return 1;
    if (!a2 && b2)
      return -1;
    return 0;
  } else if (sortDir === "desc" /* DESC */) {
    if (b2 && !a2)
      return 1;
    if (!b2 && a2)
      return -1;
    return 0;
  } else {
    return 0;
  }
};
var sortByNumber = (a2, b2, sortDir) => {
  if (sortDir === "asc" /* ASC */) {
    return a2 - b2;
  } else if (sortDir === "desc" /* DESC */) {
    return b2 - a2;
  } else {
    return 0;
  }
};
var sortByText = (a2, b2, sortDir, forceEmptyToBottom = true) => {
  const result = forceEmptyTextCellsToBottom(a2, b2);
  if (result !== null) {
    if (forceEmptyToBottom) {
      return result;
    }
  }
  if (sortDir === "asc" /* ASC */) {
    return a2.localeCompare(b2);
  } else if (sortDir === "desc" /* DESC */) {
    return b2.localeCompare(a2);
  } else {
    return 0;
  }
};
var forceEmptyNumberCellsToBottom = (a2, b2) => {
  if (a2 === null && b2 !== null)
    return 1;
  if (a2 !== null && b2 === null)
    return -1;
  if (a2 === null && b2 === null)
    return 0;
  return null;
};
var forceEmptyTextCellsToBottom = (a2, b2) => {
  if (a2 === "" && b2 !== "")
    return 1;
  if (a2 !== "" && b2 === "")
    return -1;
  if (a2 === "" && b2 === "")
    return 0;
  return null;
};

// src/shared/link-and-path/constants.ts
var MARKDOWN_EXTENSION = "md";

// src/shared/link-and-path/file-path-utils.ts
var getFileName = (path) => {
  const split2 = path.split("/");
  if (split2.length === 0)
    return "";
  const fileName = split2[split2.length - 1];
  if (fileName.includes(".")) {
    return fileName.substring(0, fileName.lastIndexOf("."));
  }
  return fileName;
};
var getBasename = (filePath) => {
  const fileName = stripDirectory(filePath);
  return stripFileExtension(fileName);
};
var isMarkdownFile = (path) => {
  return path.endsWith(`.${MARKDOWN_EXTENSION}`);
};
var stripFileExtension = (filePath) => {
  return filePath.substring(0, filePath.lastIndexOf("."));
};
var stripDirectory = (filePath) => {
  return filePath.substring(filePath.lastIndexOf("/") + 1);
};

// src/shared/loom-state/sort-rows.ts
var sortRows = (prevState) => {
  const { columns, rows, sources } = prevState.model;
  const sortedColumns = columns.filter(
    (columns2) => columns2.sortDir !== "default" /* NONE */
  );
  let newRows = [...rows];
  if (sortedColumns.length !== 0) {
    newRows = multiSort(sources, sortedColumns, rows);
  } else {
    newRows = sortByIndex(rows);
  }
  const nextState = {
    ...prevState,
    model: {
      ...prevState.model,
      rows: newRows
    }
  };
  return nextState;
};
var multiSort = (sources, sortedColumns, rows) => {
  const rowsCopy = [...rows];
  rowsCopy.sort((a2, b2) => {
    var _a2, _b;
    for (const column of sortedColumns) {
      const cellA = a2.cells.find((cell) => cell.columnId === column.id);
      if (!cellA)
        throw new CellNotFoundError({
          columnId: column.id,
          rowId: a2.id
        });
      const cellB = b2.cells.find((cell) => cell.columnId === column.id);
      if (!cellB)
        throw new CellNotFoundError({
          columnId: column.id,
          rowId: b2.id
        });
      const sourceA = (_a2 = sources.find((source) => source.id === a2.sourceId)) != null ? _a2 : null;
      const sourceB = (_b = sources.find((source) => source.id === b2.sourceId)) != null ? _b : null;
      const comparison = sortByColumn(
        a2,
        b2,
        cellA,
        cellB,
        sourceA,
        sourceB,
        column
      );
      if (comparison !== 0) {
        return comparison;
      }
    }
    return 0;
  });
  return rowsCopy;
};
var sortByIndex = (rows) => {
  const rowsCopy = [...rows];
  rowsCopy.sort((a2, b2) => {
    return a2.index - b2.index;
  });
  return rowsCopy;
};
var sortByColumn = (rowA, rowB, cellA, cellB, sourceA, sourceB, column) => {
  const { type, sortDir, tags } = column;
  if (type === "number" /* NUMBER */) {
    return sortByNumberCell(
      cellA,
      cellB,
      sortDir
    );
  } else if (type === "multi-tag" /* MULTI_TAG */) {
    return sortByMultiTag(
      cellA,
      cellB,
      tags,
      sortDir
    );
  } else if (type === "tag" /* TAG */) {
    return sortByTag(cellA, cellB, tags, sortDir);
  } else if (type === "date" /* DATE */) {
    return sortByDateCell(cellA, cellB, sortDir);
  } else if (type === "last-edited-time" /* LAST_EDITED_TIME */) {
    return sortByLastEditedTimeCell(rowA, rowA, sortDir);
  } else if (type === "creation-time" /* CREATION_TIME */) {
    return sortByCreationTimeCell(rowB, rowB, sortDir);
  } else if (type === "checkbox" /* CHECKBOX */) {
    return sortByCheckboxCell(
      cellA,
      cellB,
      sortDir
    );
  } else if (type === "source-file" /* SOURCE_FILE */) {
    return sortBySourceFileCell(
      cellA,
      cellB,
      sortDir
    );
  } else if (type === "source" /* SOURCE */) {
    return sortBySourceCell(sourceA, sourceB, sortDir);
  } else if (type === "text" /* TEXT */) {
    return sortByTextCell(cellA, cellB, sortDir);
  } else if (type === "file" /* FILE */) {
    return sortByFileCell(cellA, cellB, sortDir);
  } else if (type === "embed" /* EMBED */) {
    return sortByEmbedCell(cellA, cellB, sortDir);
  } else {
    throw new Error("Unhandled cell type");
  }
};
var sortBySourceCell = (a2, b2, sortDir) => {
  const contentA = a2 ? getSourceCellContent(a2) : "";
  const contentB = b2 ? getSourceCellContent(b2) : "";
  return sortByText(contentA, contentB, sortDir, false);
};
var sortBySourceFileCell = (a2, b2, sortDir) => {
  const { path: pathA } = a2;
  const { path: pathB } = b2;
  const contentA = getFileName(pathA);
  const contentB = getFileName(pathB);
  return sortByText(contentA, contentB, sortDir, false);
};
var sortByTextCell = (a2, b2, sortDir) => {
  const { content: contentA } = a2;
  const { content: contentB } = b2;
  return sortByText(contentA, contentB, sortDir);
};
var sortByFileCell = (a2, b2, sortDir) => {
  const { path: pathA } = a2;
  const { path: pathB } = b2;
  const contentA = getFileName(pathA);
  const contentB = getFileName(pathB);
  return sortByText(contentA, contentB, sortDir);
};
var sortByEmbedCell = (a2, b2, sortDir) => {
  const { pathOrUrl: pathOrUrlA } = a2;
  const { pathOrUrl: pathOrUrlB } = b2;
  let contentA = pathOrUrlA;
  if (isRelativePath(pathOrUrlA)) {
    contentA = getFileName(pathOrUrlA);
  }
  let contentB = pathOrUrlB;
  if (isRelativePath(pathOrUrlB)) {
    contentB = getFileName(pathOrUrlB);
  }
  return sortByText(contentA, contentB, sortDir);
};
var sortByNumberCell = (a2, b2, sortDir) => {
  const { value: valueA } = a2;
  const { value: valueB } = b2;
  const result = forceEmptyNumberCellsToBottom(valueA, valueB);
  if (result !== null) {
    return result;
  }
  return sortByNumber(valueA, valueB, sortDir);
};
var sortByMultiTag = (cellA, cellB, columnTags, sortDir) => {
  if (cellA.tagIds.length === 0 && cellB.tagIds.length > 0)
    return 1;
  if (cellA.tagIds.length > 0 && cellB.tagIds.length === 0)
    return -1;
  if (cellA.tagIds.length === 0 && cellB.tagIds.length === 0)
    return 0;
  let tagLength = cellA.tagIds.length;
  if (cellB.tagIds.length > cellA.tagIds.length) {
    tagLength = cellB.tagIds.length;
  }
  for (let i2 = 0; i2 < tagLength; i2++) {
    const tagIdA = cellA.tagIds[i2];
    if (tagIdA === void 0)
      return -1;
    const tagA = columnTags.find((t2) => t2.id === tagIdA);
    if (!tagA)
      throw new TagNotFoundError(tagIdA);
    const tagIdB = cellB.tagIds[i2];
    if (tagIdB === void 0)
      return 1;
    const tagB = columnTags.find((t2) => t2.id === tagIdB);
    if (!tagB)
      throw new TagNotFoundError(tagIdA);
    if (sortDir === "asc" /* ASC */) {
      const result = tagA.content.localeCompare(tagB.content);
      if (result !== 0)
        return result;
    } else if (sortDir === "desc" /* DESC */) {
      const result = tagB.content.localeCompare(tagA.content);
      if (result !== 0)
        return result;
    }
  }
  return 0;
};
var sortByTag = (cellA, cellB, columnTags, sortDir) => {
  const { tagId: tagIdA } = cellA;
  const { tagId: tagIdB } = cellB;
  if (tagIdA === null && tagIdB !== null)
    return 1;
  if (tagIdA !== null && tagIdB == null)
    return -1;
  if (tagIdA === null && tagIdB === null)
    return 0;
  const tagA = columnTags.find((t2) => t2.id === tagIdA);
  if (!tagA)
    throw new TagNotFoundError(tagIdA);
  const tagB = columnTags.find((t2) => t2.id === tagIdB);
  if (!tagB)
    throw new TagNotFoundError(tagIdB);
  if (sortDir === "asc" /* ASC */) {
    const result = tagA.content.localeCompare(tagB.content);
    if (result !== 0)
      return result;
  } else if (sortDir === "desc" /* DESC */) {
    const result = tagB.content.localeCompare(tagA.content);
    if (result !== 0)
      return result;
  }
  return 0;
};
var sortByCheckboxCell = (a2, b2, sortDir) => {
  const { value: valueA } = a2;
  const { value: valueB } = b2;
  return sortByBoolean(valueA, valueB, sortDir);
};
var sortByDateCell = (a2, b2, sortDir) => {
  const dateTimeA = a2.dateTime ? new Date(a2.dateTime).getTime() : 0;
  const dateTimeB = b2.dateTime ? new Date(b2.dateTime).getTime() : 0;
  return sortByNumber(dateTimeA, dateTimeB, sortDir);
};
var sortByCreationTimeCell = (a2, b2, sortDir) => {
  const creationTimeA = new Date(a2.creationDateTime).getTime();
  const creationTimeB = new Date(b2.creationDateTime).getTime();
  return sortByNumber(creationTimeA, creationTimeB, sortDir);
};
var sortByLastEditedTimeCell = (a2, b2, sortDir) => {
  const creationTimeA = new Date(a2.lastEditedDateTime).getTime();
  const creationTimeB = new Date(b2.lastEditedDateTime).getTime();
  return sortByNumber(creationTimeA, creationTimeB, sortDir);
};

// src/react/loom-app/app-mount-provider/index.tsx
var import_react3 = __toESM(require_react());
var import_jsx_runtime = __toESM(require_jsx_runtime());
var MountContext = import_react3.default.createContext(null);
var useAppMount = () => {
  const value = import_react3.default.useContext(MountContext);
  if (value === null) {
    throw new Error(
      "useAppMount() called without a <AppMountProvider /> in the tree."
    );
  }
  return value;
};
function AppMountProvider({
  app,
  reactAppId,
  mountLeaf,
  loomFile,
  isMarkdownView,
  children
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
    MountContext.Provider,
    {
      value: { app, reactAppId, mountLeaf, loomFile, isMarkdownView },
      children
    }
  );
}

// src/shared/event/event-manager.ts
var import_js_logger3 = __toESM(require_logger());
var CLASS_NAME = "EventManager";
var EventManager = class _EventManager {
  constructor() {
    this.eventListeners = {};
  }
  // Ensures only one instance is created
  static getInstance() {
    if (!_EventManager.instance) {
      _EventManager.instance = new _EventManager();
    }
    return _EventManager.instance;
  }
  // Method to add an event listener
  on(eventName, callback) {
    if (!this.eventListeners[eventName]) {
      this.eventListeners[eventName] = [];
    }
    this.eventListeners[eventName].push(callback);
  }
  // Method to remove an event listener
  off(eventName, callbackToRemove) {
    if (!this.eventListeners[eventName]) {
      return;
    }
    this.eventListeners[eventName] = this.eventListeners[eventName].filter(
      (callback) => callback !== callbackToRemove
    );
  }
  // Method to trigger all callbacks associated with an event
  emit(eventName, ...data) {
    import_js_logger3.default.trace(CLASS_NAME, "emit", `emiting ${eventName} event`, data);
    if (!this.eventListeners[eventName]) {
      return;
    }
    this.eventListeners[eventName].forEach((callback) => {
      callback(...data);
    });
  }
};

// src/react/loom-app/loom-state-provider/index.tsx
var import_js_logger4 = __toESM(require_logger());
var import_jsx_runtime2 = __toESM(require_jsx_runtime());
var LoomStateContext = import_react4.default.createContext(null);
var useLoomState = () => {
  const value = import_react4.default.useContext(LoomStateContext);
  if (value === null) {
    throw new Error(
      "useLoomState() called without a <LoomStateProvider /> in the tree."
    );
  }
  return value;
};
function LoomStateProvider({
  initialState: initialState2,
  onSaveState,
  children
}) {
  const [loomState, setLoomState] = import_react4.default.useState({
    state: initialState2,
    shouldSaveToDisk: false,
    shouldSaveFrontmatter: true,
    time: Date.now()
  });
  const [searchText, setSearchText] = import_react4.default.useState("");
  const [isSearchBarVisible, setSearchBarVisible] = import_react4.default.useState(false);
  const [resizingColumnId, setResizingColumnId] = import_react4.default.useState(null);
  const [history, setHistory] = import_react4.default.useState([
    null
  ]);
  const [position, setPosition] = import_react4.default.useState(0);
  const { reactAppId, loomFile, app } = useAppMount();
  const [error, setError] = import_react4.default.useState(null);
  const isMountedRef = import_react4.default.useRef(false);
  import_react4.default.useEffect(() => {
    if (!isMountedRef.current) {
      isMountedRef.current = true;
      return;
    }
    const { shouldSaveToDisk, state, shouldSaveFrontmatter } = loomState;
    if (shouldSaveToDisk) {
      import_js_logger4.default.info("LoomStateProvider saving state to disk!");
      onSaveState(reactAppId, state, shouldSaveFrontmatter);
    }
  }, [reactAppId, loomState, onSaveState]);
  import_react4.default.useEffect(() => {
    function handleRefreshEvent(filePath, sourceAppId, state) {
      if (reactAppId !== sourceAppId && filePath === loomFile.path) {
        setLoomState({
          state,
          shouldSaveToDisk: false,
          shouldSaveFrontmatter: true,
          time: Date.now()
        });
      }
    }
    EventManager.getInstance().on(
      "app-refresh-by-state",
      handleRefreshEvent
    );
    return () => EventManager.getInstance().off(
      "app-refresh-by-state",
      handleRefreshEvent
    );
  }, [reactAppId, loomFile, app]);
  import_react4.default.useEffect(() => {
    async function handleRefreshEvent(file, pluginVersion) {
      if (file.path === loomFile.path) {
        const fileData = await app.vault.read(loomFile);
        try {
          const state = deserializeState(fileData, pluginVersion);
          setLoomState({
            state,
            shouldSaveToDisk: false,
            shouldSaveFrontmatter: false,
            time: Date.now()
          });
        } catch (err) {
          setError(err);
        }
      }
    }
    EventManager.getInstance().on(
      "app-refresh-by-file",
      handleRefreshEvent
    );
    return () => EventManager.getInstance().off(
      "app-refresh-by-file",
      handleRefreshEvent
    );
  }, [loomFile, app]);
  function handleToggleSearchBar() {
    setSearchBarVisible((prevState) => !prevState);
  }
  const undo = import_react4.default.useCallback(() => {
    if (position > 0) {
      import_js_logger4.default.trace("handleUndoEvent");
      const currentPosition = position - 1;
      setPosition(currentPosition);
      const command = history[position];
      if (command !== null) {
        import_js_logger4.default.trace(command.constructor.name + ".undo");
        let newState = command.undo(loomState.state);
        if (command.shouldSortRows) {
          newState = sortRows(newState);
        }
        setLoomState({
          state: newState,
          shouldSaveToDisk: true,
          shouldSaveFrontmatter: command.shouldSaveFrontmatter,
          time: Date.now()
        });
      }
    }
  }, [position, history, loomState]);
  const redo = import_react4.default.useCallback(() => {
    if (position < history.length - 1) {
      import_js_logger4.default.trace("handleRedoEvent");
      const currentPosition = position + 1;
      setPosition(currentPosition);
      const command = history[currentPosition];
      if (command !== null) {
        import_js_logger4.default.trace(command.constructor.name + ".redo");
        let newState = command.redo(loomState.state);
        if (command.shouldSortRows) {
          newState = sortRows(newState);
        }
        setLoomState({
          state: newState,
          shouldSaveToDisk: true,
          shouldSaveFrontmatter: command.shouldSaveFrontmatter,
          time: Date.now()
        });
      }
    }
  }, [position, history, loomState]);
  const doCommand = import_react4.default.useCallback(
    (command) => {
      setHistory((prevState) => {
        if (position < history.length - 1) {
          const newState2 = prevState.slice(0, position + 1);
          return [...newState2, command];
        } else {
          return [...prevState, command];
        }
      });
      setPosition((prevState) => prevState + 1);
      let newState = command.execute(loomState.state);
      if (command.shouldSortRows) {
        newState = sortRows(newState);
      }
      setLoomState({
        state: newState,
        shouldSaveToDisk: true,
        shouldSaveFrontmatter: command.shouldSaveFrontmatter,
        time: Date.now()
      });
    },
    [position, history, loomState]
  );
  if (error) {
    throw error;
  }
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
    LoomStateContext.Provider,
    {
      value: {
        loomState: loomState.state,
        setLoomState,
        doCommand,
        onRedo: redo,
        onUndo: undo,
        isSearchBarVisible,
        searchText,
        resizingColumnId,
        setResizingColumnId,
        toggleSearchBar: handleToggleSearchBar,
        setSearchText
      },
      children
    }
  );
}

// src/react/loom-app/app/index.tsx
var import_react63 = __toESM(require_react());

// src/react/loom-app/table/index.tsx
var import_react39 = __toESM(require_react());

// node_modules/react-virtuoso/dist/index.mjs
var import_react5 = __toESM(require_react(), 1);
var import_react_dom2 = __toESM(require_react_dom(), 1);
var PUBLISH = 0;
var SUBSCRIBE = 1;
var RESET = 2;
var VALUE = 4;
function compose2(a2, b2) {
  return (arg) => a2(b2(arg));
}
function thrush(arg, proc) {
  return proc(arg);
}
function curry2to1(proc, arg1) {
  return (arg2) => proc(arg1, arg2);
}
function curry1to0(proc, arg) {
  return () => proc(arg);
}
function tap(arg, proc) {
  proc(arg);
  return arg;
}
function tup(...args) {
  return args;
}
function call(proc) {
  proc();
}
function always(value) {
  return () => value;
}
function joinProc(...procs) {
  return () => {
    procs.map(call);
  };
}
function isDefined(arg) {
  return arg !== void 0;
}
function noop() {
}
function subscribe(emitter, subscription) {
  return emitter(SUBSCRIBE, subscription);
}
function publish(publisher, value) {
  publisher(PUBLISH, value);
}
function reset(emitter) {
  emitter(RESET);
}
function getValue(depot) {
  return depot(VALUE);
}
function connect(emitter, publisher) {
  return subscribe(emitter, curry2to1(publisher, PUBLISH));
}
function handleNext(emitter, subscription) {
  const unsub = emitter(SUBSCRIBE, (value) => {
    unsub();
    subscription(value);
  });
  return unsub;
}
function stream() {
  const subscriptions = [];
  return (action, arg) => {
    switch (action) {
      case RESET:
        subscriptions.splice(0, subscriptions.length);
        return;
      case SUBSCRIBE:
        subscriptions.push(arg);
        return () => {
          const indexOf = subscriptions.indexOf(arg);
          if (indexOf > -1) {
            subscriptions.splice(indexOf, 1);
          }
        };
      case PUBLISH:
        subscriptions.slice().forEach((subscription) => {
          subscription(arg);
        });
        return;
      default:
        throw new Error(`unrecognized action ${action}`);
    }
  };
}
function statefulStream(initial) {
  let value = initial;
  const innerSubject = stream();
  return (action, arg) => {
    switch (action) {
      case SUBSCRIBE:
        const subscription = arg;
        subscription(value);
        break;
      case PUBLISH:
        value = arg;
        break;
      case VALUE:
        return value;
    }
    return innerSubject(action, arg);
  };
}
function eventHandler(emitter) {
  let unsub;
  let currentSubscription;
  const cleanup = () => unsub && unsub();
  return function(action, subscription) {
    switch (action) {
      case SUBSCRIBE:
        if (subscription) {
          if (currentSubscription === subscription) {
            return;
          }
          cleanup();
          currentSubscription = subscription;
          unsub = subscribe(emitter, subscription);
          return unsub;
        } else {
          cleanup();
          return noop;
        }
      case RESET:
        cleanup();
        currentSubscription = null;
        return;
      default:
        throw new Error(`unrecognized action ${action}`);
    }
  };
}
function streamFromEmitter(emitter) {
  return tap(stream(), (stream2) => connect(emitter, stream2));
}
function statefulStreamFromEmitter(emitter, initial) {
  return tap(statefulStream(initial), (stream2) => connect(emitter, stream2));
}
function combineOperators(...operators) {
  return (subscriber) => {
    return operators.reduceRight(thrush, subscriber);
  };
}
function pipe(source, ...operators) {
  const project = combineOperators(...operators);
  return (action, subscription) => {
    switch (action) {
      case SUBSCRIBE:
        return subscribe(source, project(subscription));
      case RESET:
        reset(source);
        return;
    }
  };
}
function defaultComparator(previous, next) {
  return previous === next;
}
function distinctUntilChanged(comparator = defaultComparator) {
  let current;
  return (done) => (next) => {
    if (!comparator(current, next)) {
      current = next;
      done(next);
    }
  };
}
function filter(predicate) {
  return (done) => (value) => {
    predicate(value) && done(value);
  };
}
function map(project) {
  return (done) => compose2(done, project);
}
function mapTo(value) {
  return (done) => () => done(value);
}
function scan(scanner, initial) {
  return (done) => (value) => done(initial = scanner(initial, value));
}
function skip(times) {
  return (done) => (value) => {
    times > 0 ? times-- : done(value);
  };
}
function throttleTime(interval) {
  let currentValue = null;
  let timeout;
  return (done) => (value) => {
    currentValue = value;
    if (timeout) {
      return;
    }
    timeout = setTimeout(() => {
      timeout = void 0;
      done(currentValue);
    }, interval);
  };
}
function debounceTime(interval) {
  let currentValue;
  let timeout;
  return (done) => (value) => {
    currentValue = value;
    if (timeout) {
      clearTimeout(timeout);
    }
    timeout = setTimeout(() => {
      done(currentValue);
    }, interval);
  };
}
function withLatestFrom(...sources) {
  const values = new Array(sources.length);
  let called = 0;
  let pendingCall = null;
  const allCalled = Math.pow(2, sources.length) - 1;
  sources.forEach((source, index) => {
    const bit = Math.pow(2, index);
    subscribe(source, (value) => {
      const prevCalled = called;
      called = called | bit;
      values[index] = value;
      if (prevCalled !== allCalled && called === allCalled && pendingCall) {
        pendingCall();
        pendingCall = null;
      }
    });
  });
  return (done) => (value) => {
    const call2 = () => done([value].concat(values));
    if (called === allCalled) {
      call2();
    } else {
      pendingCall = call2;
    }
  };
}
function merge(...sources) {
  return function(action, subscription) {
    switch (action) {
      case SUBSCRIBE:
        return joinProc(...sources.map((source) => subscribe(source, subscription)));
      case RESET:
        return;
      default:
        throw new Error(`unrecognized action ${action}`);
    }
  };
}
function duc(source, comparator = defaultComparator) {
  return pipe(source, distinctUntilChanged(comparator));
}
function combineLatest(...emitters) {
  const innerSubject = stream();
  const values = new Array(emitters.length);
  let called = 0;
  const allCalled = Math.pow(2, emitters.length) - 1;
  emitters.forEach((source, index) => {
    const bit = Math.pow(2, index);
    subscribe(source, (value) => {
      values[index] = value;
      called = called | bit;
      if (called === allCalled) {
        publish(innerSubject, values);
      }
    });
  });
  return function(action, subscription) {
    switch (action) {
      case SUBSCRIBE:
        if (called === allCalled) {
          subscription(values);
        }
        return subscribe(innerSubject, subscription);
      case RESET:
        return reset(innerSubject);
      default:
        throw new Error(`unrecognized action ${action}`);
    }
  };
}
function system(constructor, dependencies = [], { singleton } = { singleton: true }) {
  return {
    id: id(),
    constructor,
    dependencies,
    singleton
  };
}
var id = () => Symbol();
function init(systemSpec) {
  const singletons = /* @__PURE__ */ new Map();
  const _init = ({ id: id2, constructor, dependencies, singleton }) => {
    if (singleton && singletons.has(id2)) {
      return singletons.get(id2);
    }
    const system2 = constructor(dependencies.map((e) => _init(e)));
    if (singleton) {
      singletons.set(id2, system2);
    }
    return system2;
  };
  return _init(systemSpec);
}
function omit(keys, obj) {
  const result = {};
  const index = {};
  let idx = 0;
  const len = keys.length;
  while (idx < len) {
    index[keys[idx]] = 1;
    idx += 1;
  }
  for (const prop in obj) {
    if (!index.hasOwnProperty(prop)) {
      result[prop] = obj[prop];
    }
  }
  return result;
}
var useIsomorphicLayoutEffect$2 = typeof document !== "undefined" ? import_react5.default.useLayoutEffect : import_react5.default.useEffect;
function systemToComponent(systemSpec, map2, Root6) {
  const requiredPropNames = Object.keys(map2.required || {});
  const optionalPropNames = Object.keys(map2.optional || {});
  const methodNames = Object.keys(map2.methods || {});
  const eventNames = Object.keys(map2.events || {});
  const Context = import_react5.default.createContext({});
  function applyPropsToSystem(system2, props) {
    if (system2["propsReady"]) {
      publish(system2["propsReady"], false);
    }
    for (const requiredPropName of requiredPropNames) {
      const stream2 = system2[map2.required[requiredPropName]];
      publish(stream2, props[requiredPropName]);
    }
    for (const optionalPropName of optionalPropNames) {
      if (optionalPropName in props) {
        const stream2 = system2[map2.optional[optionalPropName]];
        publish(stream2, props[optionalPropName]);
      }
    }
    if (system2["propsReady"]) {
      publish(system2["propsReady"], true);
    }
  }
  function buildMethods(system2) {
    return methodNames.reduce((acc, methodName) => {
      acc[methodName] = (value) => {
        const stream2 = system2[map2.methods[methodName]];
        publish(stream2, value);
      };
      return acc;
    }, {});
  }
  function buildEventHandlers(system2) {
    return eventNames.reduce((handlers, eventName) => {
      handlers[eventName] = eventHandler(system2[map2.events[eventName]]);
      return handlers;
    }, {});
  }
  const Component = import_react5.default.forwardRef((propsWithChildren, ref) => {
    const { children, ...props } = propsWithChildren;
    const [system2] = import_react5.default.useState(() => {
      return tap(init(systemSpec), (system22) => applyPropsToSystem(system22, props));
    });
    const [handlers] = import_react5.default.useState(curry1to0(buildEventHandlers, system2));
    useIsomorphicLayoutEffect$2(() => {
      for (const eventName of eventNames) {
        if (eventName in props) {
          subscribe(handlers[eventName], props[eventName]);
        }
      }
      return () => {
        Object.values(handlers).map(reset);
      };
    }, [props, handlers, system2]);
    useIsomorphicLayoutEffect$2(() => {
      applyPropsToSystem(system2, props);
    });
    import_react5.default.useImperativeHandle(ref, always(buildMethods(system2)));
    return import_react5.default.createElement(
      Context.Provider,
      { value: system2 },
      Root6 ? import_react5.default.createElement(
        Root6,
        omit([...requiredPropNames, ...optionalPropNames, ...eventNames], props),
        children
      ) : children
    );
  });
  const usePublisher2 = (key) => {
    return import_react5.default.useCallback(curry2to1(publish, import_react5.default.useContext(Context)[key]), [key]);
  };
  const useEmitterValue18 = (key) => {
    const system2 = import_react5.default.useContext(Context);
    const source = system2[key];
    const cb = import_react5.default.useCallback(
      (c2) => {
        return subscribe(source, c2);
      },
      [source]
    );
    return import_react5.default.useSyncExternalStore(
      cb,
      () => getValue(source),
      () => getValue(source)
    );
  };
  const useEmitterValueLegacy = (key) => {
    const system2 = import_react5.default.useContext(Context);
    const source = system2[key];
    const [value, setValue] = import_react5.default.useState(curry1to0(getValue, source));
    useIsomorphicLayoutEffect$2(
      () => subscribe(source, (next) => {
        if (next !== value) {
          setValue(always(next));
        }
      }),
      [source, value]
    );
    return value;
  };
  const useEmitterValue2 = import_react5.default.version.startsWith("18") ? useEmitterValue18 : useEmitterValueLegacy;
  const useEmitter2 = (key, callback) => {
    const context = import_react5.default.useContext(Context);
    const source = context[key];
    useIsomorphicLayoutEffect$2(() => subscribe(source, callback), [callback, source]);
  };
  return {
    Component,
    usePublisher: usePublisher2,
    useEmitterValue: useEmitterValue2,
    useEmitter: useEmitter2
  };
}
var useIsomorphicLayoutEffect2 = typeof document !== "undefined" ? import_react5.default.useLayoutEffect : import_react5.default.useEffect;
var useIsomorphicLayoutEffect$1 = useIsomorphicLayoutEffect2;
var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
  LogLevel2[LogLevel2["DEBUG"] = 0] = "DEBUG";
  LogLevel2[LogLevel2["INFO"] = 1] = "INFO";
  LogLevel2[LogLevel2["WARN"] = 2] = "WARN";
  LogLevel2[LogLevel2["ERROR"] = 3] = "ERROR";
  return LogLevel2;
})(LogLevel || {});
var CONSOLE_METHOD_MAP = {
  [
    0
    /* DEBUG */
  ]: "debug",
  [
    1
    /* INFO */
  ]: "log",
  [
    2
    /* WARN */
  ]: "warn",
  [
    3
    /* ERROR */
  ]: "error"
};
var getGlobalThis = () => typeof globalThis === "undefined" ? window : globalThis;
var loggerSystem = system(
  () => {
    const logLevel = statefulStream(
      3
      /* ERROR */
    );
    const log = statefulStream((label, message, level = 1) => {
      var _a2;
      const currentLevel = (_a2 = getGlobalThis()["VIRTUOSO_LOG_LEVEL"]) != null ? _a2 : getValue(logLevel);
      if (level >= currentLevel) {
        console[CONSOLE_METHOD_MAP[level]](
          "%creact-virtuoso: %c%s %o",
          "color: #0253b3; font-weight: bold",
          "color: initial",
          label,
          message
        );
      }
    });
    return {
      log,
      logLevel
    };
  },
  [],
  { singleton: true }
);
function useSizeWithElRef(callback, enabled = true) {
  const ref = import_react5.default.useRef(null);
  let callbackRef = (_el) => {
  };
  if (typeof ResizeObserver !== "undefined") {
    const observer = import_react5.default.useMemo(() => {
      return new ResizeObserver((entries) => {
        requestAnimationFrame(() => {
          const element = entries[0].target;
          if (element.offsetParent !== null) {
            callback(element);
          }
        });
      });
    }, [callback]);
    callbackRef = (elRef) => {
      if (elRef && enabled) {
        observer.observe(elRef);
        ref.current = elRef;
      } else {
        if (ref.current) {
          observer.unobserve(ref.current);
        }
        ref.current = null;
      }
    };
  }
  return { ref, callbackRef };
}
function useSize(callback, enabled = true) {
  return useSizeWithElRef(callback, enabled).callbackRef;
}
function useChangedListContentsSizes(callback, itemSize, enabled, scrollContainerStateCallback, log, gap, customScrollParent) {
  const memoedCallback = import_react5.default.useCallback(
    (el) => {
      const ranges = getChangedChildSizes(el.children, itemSize, "offsetHeight", log);
      let scrollableElement = el.parentElement;
      while (!scrollableElement.dataset["virtuosoScroller"]) {
        scrollableElement = scrollableElement.parentElement;
      }
      const windowScrolling = scrollableElement.lastElementChild.dataset["viewportType"] === "window";
      const scrollTop = customScrollParent ? customScrollParent.scrollTop : windowScrolling ? window.pageYOffset || document.documentElement.scrollTop : scrollableElement.scrollTop;
      const scrollHeight = customScrollParent ? customScrollParent.scrollHeight : windowScrolling ? document.documentElement.scrollHeight : scrollableElement.scrollHeight;
      const viewportHeight = customScrollParent ? customScrollParent.offsetHeight : windowScrolling ? window.innerHeight : scrollableElement.offsetHeight;
      scrollContainerStateCallback({
        scrollTop: Math.max(scrollTop, 0),
        scrollHeight,
        viewportHeight
      });
      gap == null ? void 0 : gap(resolveGapValue$1("row-gap", getComputedStyle(el).rowGap, log));
      if (ranges !== null) {
        callback(ranges);
      }
    },
    [callback, itemSize, log, gap, customScrollParent, scrollContainerStateCallback]
  );
  return useSizeWithElRef(memoedCallback, enabled);
}
function getChangedChildSizes(children, itemSize, field, log) {
  const length = children.length;
  if (length === 0) {
    return null;
  }
  const results = [];
  for (let i2 = 0; i2 < length; i2++) {
    const child = children.item(i2);
    if (!child || child.dataset.index === void 0) {
      continue;
    }
    const index = parseInt(child.dataset.index);
    const knownSize = parseFloat(child.dataset.knownSize);
    const size = itemSize(child, field);
    if (size === 0) {
      log("Zero-sized element, this should not happen", { child }, LogLevel.ERROR);
    }
    if (size === knownSize) {
      continue;
    }
    const lastResult = results[results.length - 1];
    if (results.length === 0 || lastResult.size !== size || lastResult.endIndex !== index - 1) {
      results.push({ startIndex: index, endIndex: index, size });
    } else {
      results[results.length - 1].endIndex++;
    }
  }
  return results;
}
function resolveGapValue$1(property, value, log) {
  if (value !== "normal" && !(value == null ? void 0 : value.endsWith("px"))) {
    log(`${property} was not resolved to pixel value correctly`, value, LogLevel.WARN);
  }
  if (value === "normal") {
    return 0;
  }
  return parseInt(value != null ? value : "0", 10);
}
function correctItemSize(el, dimension) {
  return Math.round(el.getBoundingClientRect()[dimension]);
}
function approximatelyEqual(num1, num2) {
  return Math.abs(num1 - num2) < 1.01;
}
function useScrollTop(scrollContainerStateCallback, smoothScrollTargetReached, scrollerElement, scrollerRefCallback = noop, customScrollParent) {
  const scrollerRef = import_react5.default.useRef(null);
  const scrollTopTarget = import_react5.default.useRef(null);
  const timeoutRef = import_react5.default.useRef(null);
  const handler = import_react5.default.useCallback(
    (ev) => {
      const el = ev.target;
      const windowScroll = el === window || el === document;
      const scrollTop = windowScroll ? window.pageYOffset || document.documentElement.scrollTop : el.scrollTop;
      const scrollHeight = windowScroll ? document.documentElement.scrollHeight : el.scrollHeight;
      const viewportHeight = windowScroll ? window.innerHeight : el.offsetHeight;
      const call2 = () => {
        scrollContainerStateCallback({
          scrollTop: Math.max(scrollTop, 0),
          scrollHeight,
          viewportHeight
        });
      };
      if (ev.suppressFlushSync) {
        call2();
      } else {
        import_react_dom2.default.flushSync(call2);
      }
      if (scrollTopTarget.current !== null) {
        if (scrollTop === scrollTopTarget.current || scrollTop <= 0 || scrollTop === scrollHeight - viewportHeight) {
          scrollTopTarget.current = null;
          smoothScrollTargetReached(true);
          if (timeoutRef.current) {
            clearTimeout(timeoutRef.current);
            timeoutRef.current = null;
          }
        }
      }
    },
    [scrollContainerStateCallback, smoothScrollTargetReached]
  );
  import_react5.default.useEffect(() => {
    const localRef = customScrollParent ? customScrollParent : scrollerRef.current;
    scrollerRefCallback(customScrollParent ? customScrollParent : scrollerRef.current);
    handler({ target: localRef, suppressFlushSync: true });
    localRef.addEventListener("scroll", handler, { passive: true });
    return () => {
      scrollerRefCallback(null);
      localRef.removeEventListener("scroll", handler);
    };
  }, [scrollerRef, handler, scrollerElement, scrollerRefCallback, customScrollParent]);
  function scrollToCallback(location) {
    const scrollerElement2 = scrollerRef.current;
    if (!scrollerElement2 || "offsetHeight" in scrollerElement2 && scrollerElement2.offsetHeight === 0) {
      return;
    }
    const isSmooth = location.behavior === "smooth";
    let offsetHeight;
    let scrollHeight;
    let scrollTop;
    if (scrollerElement2 === window) {
      scrollHeight = Math.max(correctItemSize(document.documentElement, "height"), document.documentElement.scrollHeight);
      offsetHeight = window.innerHeight;
      scrollTop = document.documentElement.scrollTop;
    } else {
      scrollHeight = scrollerElement2.scrollHeight;
      offsetHeight = correctItemSize(scrollerElement2, "height");
      scrollTop = scrollerElement2.scrollTop;
    }
    const maxScrollTop = scrollHeight - offsetHeight;
    location.top = Math.ceil(Math.max(Math.min(maxScrollTop, location.top), 0));
    if (approximatelyEqual(offsetHeight, scrollHeight) || location.top === scrollTop) {
      scrollContainerStateCallback({ scrollTop, scrollHeight, viewportHeight: offsetHeight });
      if (isSmooth) {
        smoothScrollTargetReached(true);
      }
      return;
    }
    if (isSmooth) {
      scrollTopTarget.current = location.top;
      if (timeoutRef.current) {
        clearTimeout(timeoutRef.current);
      }
      timeoutRef.current = setTimeout(() => {
        timeoutRef.current = null;
        scrollTopTarget.current = null;
        smoothScrollTargetReached(true);
      }, 1e3);
    } else {
      scrollTopTarget.current = null;
    }
    scrollerElement2.scrollTo(location);
  }
  function scrollByCallback(location) {
    scrollerRef.current.scrollBy(location);
  }
  return { scrollerRef, scrollByCallback, scrollToCallback };
}
var domIOSystem = system(
  () => {
    const scrollContainerState = stream();
    const scrollTop = stream();
    const deviation = statefulStream(0);
    const smoothScrollTargetReached = stream();
    const statefulScrollTop = statefulStream(0);
    const viewportHeight = stream();
    const scrollHeight = stream();
    const headerHeight = statefulStream(0);
    const fixedHeaderHeight = statefulStream(0);
    const fixedFooterHeight = statefulStream(0);
    const footerHeight = statefulStream(0);
    const scrollTo = stream();
    const scrollBy = stream();
    const scrollingInProgress = statefulStream(false);
    connect(
      pipe(
        scrollContainerState,
        map(({ scrollTop: scrollTop2 }) => scrollTop2)
      ),
      scrollTop
    );
    connect(
      pipe(
        scrollContainerState,
        map(({ scrollHeight: scrollHeight2 }) => scrollHeight2)
      ),
      scrollHeight
    );
    connect(scrollTop, statefulScrollTop);
    return {
      // input
      scrollContainerState,
      scrollTop,
      viewportHeight,
      headerHeight,
      fixedHeaderHeight,
      fixedFooterHeight,
      footerHeight,
      scrollHeight,
      smoothScrollTargetReached,
      // signals
      scrollTo,
      scrollBy,
      // state
      statefulScrollTop,
      deviation,
      scrollingInProgress
    };
  },
  [],
  { singleton: true }
);
var NIL_NODE = { lvl: 0 };
function newAANode(k2, v2, lvl, l2 = NIL_NODE, r2 = NIL_NODE) {
  return { k: k2, v: v2, lvl, l: l2, r: r2 };
}
function empty(node) {
  return node === NIL_NODE;
}
function newTree() {
  return NIL_NODE;
}
function remove(node, key) {
  if (empty(node))
    return NIL_NODE;
  const { k: k2, l: l2, r: r2 } = node;
  if (key === k2) {
    if (empty(l2)) {
      return r2;
    } else if (empty(r2)) {
      return l2;
    } else {
      const [lastKey, lastValue] = last(l2);
      return adjust(clone(node, { k: lastKey, v: lastValue, l: deleteLast(l2) }));
    }
  } else if (key < k2) {
    return adjust(clone(node, { l: remove(l2, key) }));
  } else {
    return adjust(clone(node, { r: remove(r2, key) }));
  }
}
function find(node, key) {
  if (empty(node)) {
    return;
  }
  if (key === node.k) {
    return node.v;
  } else if (key < node.k) {
    return find(node.l, key);
  } else {
    return find(node.r, key);
  }
}
function findMaxKeyValue(node, value, field = "k") {
  if (empty(node)) {
    return [-Infinity, void 0];
  }
  if (Number(node[field]) === value) {
    return [node.k, node.v];
  }
  if (Number(node[field]) < value) {
    const r2 = findMaxKeyValue(node.r, value, field);
    if (r2[0] === -Infinity) {
      return [node.k, node.v];
    } else {
      return r2;
    }
  }
  return findMaxKeyValue(node.l, value, field);
}
function insert(node, k2, v2) {
  if (empty(node)) {
    return newAANode(k2, v2, 1);
  }
  if (k2 === node.k) {
    return clone(node, { k: k2, v: v2 });
  } else if (k2 < node.k) {
    return rebalance(clone(node, { l: insert(node.l, k2, v2) }));
  } else {
    return rebalance(clone(node, { r: insert(node.r, k2, v2) }));
  }
}
function walkWithin(node, start, end) {
  if (empty(node)) {
    return [];
  }
  const { k: k2, v: v2, l: l2, r: r2 } = node;
  let result = [];
  if (k2 > start) {
    result = result.concat(walkWithin(l2, start, end));
  }
  if (k2 >= start && k2 <= end) {
    result.push({ k: k2, v: v2 });
  }
  if (k2 <= end) {
    result = result.concat(walkWithin(r2, start, end));
  }
  return result;
}
function walk(node) {
  if (empty(node)) {
    return [];
  }
  return [...walk(node.l), { k: node.k, v: node.v }, ...walk(node.r)];
}
function last(node) {
  return empty(node.r) ? [node.k, node.v] : last(node.r);
}
function deleteLast(node) {
  return empty(node.r) ? node.l : adjust(clone(node, { r: deleteLast(node.r) }));
}
function clone(node, args) {
  return newAANode(
    args.k !== void 0 ? args.k : node.k,
    args.v !== void 0 ? args.v : node.v,
    args.lvl !== void 0 ? args.lvl : node.lvl,
    args.l !== void 0 ? args.l : node.l,
    args.r !== void 0 ? args.r : node.r
  );
}
function isSingle(node) {
  return empty(node) || node.lvl > node.r.lvl;
}
function rebalance(node) {
  return split(skew(node));
}
function adjust(node) {
  const { l: l2, r: r2, lvl } = node;
  if (r2.lvl >= lvl - 1 && l2.lvl >= lvl - 1) {
    return node;
  } else if (lvl > r2.lvl + 1) {
    if (isSingle(l2)) {
      return skew(clone(node, { lvl: lvl - 1 }));
    } else {
      if (!empty(l2) && !empty(l2.r)) {
        return clone(l2.r, {
          l: clone(l2, { r: l2.r.l }),
          r: clone(node, {
            l: l2.r.r,
            lvl: lvl - 1
          }),
          lvl
        });
      } else {
        throw new Error("Unexpected empty nodes");
      }
    }
  } else {
    if (isSingle(node)) {
      return split(clone(node, { lvl: lvl - 1 }));
    } else {
      if (!empty(r2) && !empty(r2.l)) {
        const rl = r2.l;
        const rlvl = isSingle(rl) ? r2.lvl - 1 : r2.lvl;
        return clone(rl, {
          l: clone(node, {
            r: rl.l,
            lvl: lvl - 1
          }),
          r: split(clone(r2, { l: rl.r, lvl: rlvl })),
          lvl: rl.lvl + 1
        });
      } else {
        throw new Error("Unexpected empty nodes");
      }
    }
  }
}
function rangesWithin(node, startIndex, endIndex) {
  if (empty(node)) {
    return [];
  }
  const adjustedStart = findMaxKeyValue(node, startIndex)[0];
  return toRanges(walkWithin(node, adjustedStart, endIndex));
}
function arrayToRanges(items, parser) {
  const length = items.length;
  if (length === 0) {
    return [];
  }
  let { index: start, value } = parser(items[0]);
  const result = [];
  for (let i2 = 1; i2 < length; i2++) {
    const { index: nextIndex, value: nextValue } = parser(items[i2]);
    result.push({ start, end: nextIndex - 1, value });
    start = nextIndex;
    value = nextValue;
  }
  result.push({ start, end: Infinity, value });
  return result;
}
function toRanges(nodes) {
  return arrayToRanges(nodes, ({ k: index, v: value }) => ({ index, value }));
}
function split(node) {
  const { r: r2, lvl } = node;
  return !empty(r2) && !empty(r2.r) && r2.lvl === lvl && r2.r.lvl === lvl ? clone(r2, { l: clone(node, { r: r2.l }), lvl: lvl + 1 }) : node;
}
function skew(node) {
  const { l: l2 } = node;
  return !empty(l2) && l2.lvl === node.lvl ? clone(l2, { r: clone(node, { l: l2.r }) }) : node;
}
function findIndexOfClosestSmallerOrEqual(items, value, comparator, start = 0) {
  let end = items.length - 1;
  while (start <= end) {
    const index = Math.floor((start + end) / 2);
    const item = items[index];
    const match = comparator(item, value);
    if (match === 0) {
      return index;
    }
    if (match === -1) {
      if (end - start < 2) {
        return index - 1;
      }
      end = index - 1;
    } else {
      if (end === start) {
        return index;
      }
      start = index + 1;
    }
  }
  throw new Error(`Failed binary finding record in array - ${items.join(",")}, searched for ${value}`);
}
function findClosestSmallerOrEqual(items, value, comparator) {
  return items[findIndexOfClosestSmallerOrEqual(items, value, comparator)];
}
function findRange(items, startValue, endValue, comparator) {
  const startIndex = findIndexOfClosestSmallerOrEqual(items, startValue, comparator);
  const endIndex = findIndexOfClosestSmallerOrEqual(items, endValue, comparator, startIndex);
  return items.slice(startIndex, endIndex + 1);
}
var recalcSystem = system(
  () => {
    const recalcInProgress = statefulStream(false);
    return { recalcInProgress };
  },
  [],
  { singleton: true }
);
function rangeIncludes(refRange) {
  const { size, startIndex, endIndex } = refRange;
  return (range) => {
    return range.start === startIndex && (range.end === endIndex || range.end === Infinity) && range.value === size;
  };
}
function affectedGroupCount(offset, groupIndices) {
  let recognizedOffsetItems = 0;
  let groupIndex = 0;
  while (recognizedOffsetItems < offset) {
    recognizedOffsetItems += groupIndices[groupIndex + 1] - groupIndices[groupIndex] - 1;
    groupIndex++;
  }
  const offsetIsExact = recognizedOffsetItems === offset;
  return groupIndex - (offsetIsExact ? 0 : 1);
}
function insertRanges(sizeTree, ranges) {
  let syncStart = empty(sizeTree) ? 0 : Infinity;
  for (const range of ranges) {
    const { size, startIndex, endIndex } = range;
    syncStart = Math.min(syncStart, startIndex);
    if (empty(sizeTree)) {
      sizeTree = insert(sizeTree, 0, size);
      continue;
    }
    const overlappingRanges = rangesWithin(sizeTree, startIndex - 1, endIndex + 1);
    if (overlappingRanges.some(rangeIncludes(range))) {
      continue;
    }
    let firstPassDone = false;
    let shouldInsert = false;
    for (const { start: rangeStart, end: rangeEnd, value: rangeValue } of overlappingRanges) {
      if (!firstPassDone) {
        shouldInsert = rangeValue !== size;
        firstPassDone = true;
      } else {
        if (endIndex >= rangeStart || size === rangeValue) {
          sizeTree = remove(sizeTree, rangeStart);
        }
      }
      if (rangeEnd > endIndex && endIndex >= rangeStart) {
        if (rangeValue !== size) {
          sizeTree = insert(sizeTree, endIndex + 1, rangeValue);
        }
      }
    }
    if (shouldInsert) {
      sizeTree = insert(sizeTree, startIndex, size);
    }
  }
  return [sizeTree, syncStart];
}
function initialSizeState() {
  return {
    offsetTree: [],
    sizeTree: newTree(),
    groupOffsetTree: newTree(),
    lastIndex: 0,
    lastOffset: 0,
    lastSize: 0,
    groupIndices: []
  };
}
function indexComparator({ index: itemIndex }, index) {
  return index === itemIndex ? 0 : index < itemIndex ? -1 : 1;
}
function offsetComparator({ offset: itemOffset }, offset) {
  return offset === itemOffset ? 0 : offset < itemOffset ? -1 : 1;
}
function offsetPointParser(point) {
  return { index: point.index, value: point };
}
function rangesWithinOffsets(tree, startOffset, endOffset, minStartIndex = 0) {
  if (minStartIndex > 0) {
    startOffset = Math.max(startOffset, findClosestSmallerOrEqual(tree, minStartIndex, indexComparator).offset);
  }
  return arrayToRanges(findRange(tree, startOffset, endOffset, offsetComparator), offsetPointParser);
}
function createOffsetTree(prevOffsetTree, syncStart, sizeTree, gap) {
  let offsetTree = prevOffsetTree;
  let prevIndex = 0;
  let prevSize = 0;
  let prevOffset = 0;
  let startIndex = 0;
  if (syncStart !== 0) {
    startIndex = findIndexOfClosestSmallerOrEqual(offsetTree, syncStart - 1, indexComparator);
    const offsetInfo = offsetTree[startIndex];
    prevOffset = offsetInfo.offset;
    const kv = findMaxKeyValue(sizeTree, syncStart - 1);
    prevIndex = kv[0];
    prevSize = kv[1];
    if (offsetTree.length && offsetTree[startIndex].size === findMaxKeyValue(sizeTree, syncStart)[1]) {
      startIndex -= 1;
    }
    offsetTree = offsetTree.slice(0, startIndex + 1);
  } else {
    offsetTree = [];
  }
  for (const { start: startIndex2, value } of rangesWithin(sizeTree, syncStart, Infinity)) {
    const indexOffset = startIndex2 - prevIndex;
    const aOffset = indexOffset * prevSize + prevOffset + indexOffset * gap;
    offsetTree.push({
      offset: aOffset,
      size: value,
      index: startIndex2
    });
    prevIndex = startIndex2;
    prevOffset = aOffset;
    prevSize = value;
  }
  return {
    offsetTree,
    lastIndex: prevIndex,
    lastOffset: prevOffset,
    lastSize: prevSize
  };
}
function sizeStateReducer(state, [ranges, groupIndices, log, gap]) {
  if (ranges.length > 0) {
    log("received item sizes", ranges, LogLevel.DEBUG);
  }
  const sizeTree = state.sizeTree;
  let newSizeTree = sizeTree;
  let syncStart = 0;
  if (groupIndices.length > 0 && empty(sizeTree) && ranges.length === 2) {
    const groupSize = ranges[0].size;
    const itemSize = ranges[1].size;
    newSizeTree = groupIndices.reduce((tree, groupIndex) => {
      return insert(insert(tree, groupIndex, groupSize), groupIndex + 1, itemSize);
    }, newSizeTree);
  } else {
    [newSizeTree, syncStart] = insertRanges(newSizeTree, ranges);
  }
  if (newSizeTree === sizeTree) {
    return state;
  }
  const { offsetTree: newOffsetTree, lastIndex, lastSize, lastOffset } = createOffsetTree(state.offsetTree, syncStart, newSizeTree, gap);
  return {
    sizeTree: newSizeTree,
    offsetTree: newOffsetTree,
    lastIndex,
    lastOffset,
    lastSize,
    groupOffsetTree: groupIndices.reduce((tree, index) => {
      return insert(tree, index, offsetOf(index, newOffsetTree, gap));
    }, newTree()),
    groupIndices
  };
}
function offsetOf(index, tree, gap) {
  if (tree.length === 0) {
    return 0;
  }
  const { offset, index: startIndex, size } = findClosestSmallerOrEqual(tree, index, indexComparator);
  const itemCount = index - startIndex;
  const top = size * itemCount + (itemCount - 1) * gap + offset;
  return top > 0 ? top + gap : top;
}
function isGroupLocation(location) {
  return typeof location.groupIndex !== "undefined";
}
function originalIndexFromLocation(location, sizes, lastIndex) {
  if (isGroupLocation(location)) {
    return sizes.groupIndices[location.groupIndex] + 1;
  } else {
    const numericIndex = location.index === "LAST" ? lastIndex : location.index;
    let result = originalIndexFromItemIndex(numericIndex, sizes);
    result = Math.max(0, result, Math.min(lastIndex, result));
    return result;
  }
}
function originalIndexFromItemIndex(itemIndex, sizes) {
  if (!hasGroups(sizes)) {
    return itemIndex;
  }
  let groupOffset = 0;
  while (sizes.groupIndices[groupOffset] <= itemIndex + groupOffset) {
    groupOffset++;
  }
  return itemIndex + groupOffset;
}
function hasGroups(sizes) {
  return !empty(sizes.groupOffsetTree);
}
function sizeTreeToRanges(sizeTree) {
  return walk(sizeTree).map(({ k: startIndex, v: size }, index, sizeArray) => {
    const nextSize = sizeArray[index + 1];
    const endIndex = nextSize ? nextSize.k - 1 : Infinity;
    return { startIndex, endIndex, size };
  });
}
var SIZE_MAP = {
  offsetHeight: "height",
  offsetWidth: "width"
};
var sizeSystem = system(
  ([{ log }, { recalcInProgress }]) => {
    const sizeRanges = stream();
    const totalCount = stream();
    const statefulTotalCount = statefulStreamFromEmitter(totalCount, 0);
    const unshiftWith = stream();
    const shiftWith = stream();
    const firstItemIndex = statefulStream(0);
    const groupIndices = statefulStream([]);
    const fixedItemSize = statefulStream(void 0);
    const defaultItemSize = statefulStream(void 0);
    const itemSize = statefulStream((el, field) => correctItemSize(el, SIZE_MAP[field]));
    const data = statefulStream(void 0);
    const gap = statefulStream(0);
    const initial = initialSizeState();
    const sizes = statefulStreamFromEmitter(
      pipe(sizeRanges, withLatestFrom(groupIndices, log, gap), scan(sizeStateReducer, initial), distinctUntilChanged()),
      initial
    );
    const prevGroupIndices = statefulStreamFromEmitter(
      pipe(
        groupIndices,
        distinctUntilChanged(),
        scan((prev, curr) => ({ prev: prev.current, current: curr }), {
          prev: [],
          current: []
        }),
        map(({ prev }) => prev)
      ),
      []
    );
    connect(
      pipe(
        groupIndices,
        filter((indexes) => indexes.length > 0),
        withLatestFrom(sizes, gap),
        map(([groupIndices2, sizes2, gap2]) => {
          const groupOffsetTree = groupIndices2.reduce((tree, index, idx) => {
            return insert(tree, index, offsetOf(index, sizes2.offsetTree, gap2) || idx);
          }, newTree());
          return {
            ...sizes2,
            groupIndices: groupIndices2,
            groupOffsetTree
          };
        })
      ),
      sizes
    );
    connect(
      pipe(
        totalCount,
        withLatestFrom(sizes),
        filter(([totalCount2, { lastIndex }]) => {
          return totalCount2 < lastIndex;
        }),
        map(([totalCount2, { lastIndex, lastSize }]) => {
          return [
            {
              startIndex: totalCount2,
              endIndex: lastIndex,
              size: lastSize
            }
          ];
        })
      ),
      sizeRanges
    );
    connect(fixedItemSize, defaultItemSize);
    const trackItemSizes = statefulStreamFromEmitter(
      pipe(
        fixedItemSize,
        map((size) => size === void 0)
      ),
      true
    );
    connect(
      pipe(
        defaultItemSize,
        filter((value) => {
          return value !== void 0 && empty(getValue(sizes).sizeTree);
        }),
        map((size) => [{ startIndex: 0, endIndex: 0, size }])
      ),
      sizeRanges
    );
    const listRefresh = streamFromEmitter(
      pipe(
        sizeRanges,
        withLatestFrom(sizes),
        scan(
          ({ sizes: oldSizes }, [_7, newSizes]) => {
            return {
              changed: newSizes !== oldSizes,
              sizes: newSizes
            };
          },
          { changed: false, sizes: initial }
        ),
        map((value) => value.changed)
      )
    );
    subscribe(
      pipe(
        firstItemIndex,
        scan(
          (prev, next) => {
            return { diff: prev.prev - next, prev: next };
          },
          { diff: 0, prev: 0 }
        ),
        map((val) => val.diff)
      ),
      (offset) => {
        const { groupIndices: groupIndices2 } = getValue(sizes);
        if (offset > 0) {
          publish(recalcInProgress, true);
          publish(unshiftWith, offset + affectedGroupCount(offset, groupIndices2));
        } else if (offset < 0) {
          const prevGroupIndicesValue = getValue(prevGroupIndices);
          if (prevGroupIndicesValue.length > 0) {
            offset -= affectedGroupCount(-offset, prevGroupIndicesValue);
          }
          publish(shiftWith, offset);
        }
      }
    );
    subscribe(pipe(firstItemIndex, withLatestFrom(log)), ([index, log2]) => {
      if (index < 0) {
        log2(
          "`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",
          { firstItemIndex },
          LogLevel.ERROR
        );
      }
    });
    const beforeUnshiftWith = streamFromEmitter(unshiftWith);
    connect(
      pipe(
        unshiftWith,
        withLatestFrom(sizes),
        map(([unshiftWith2, sizes2]) => {
          const groupedMode = sizes2.groupIndices.length > 0;
          const initialRanges = [];
          const defaultSize = sizes2.lastSize;
          if (groupedMode) {
            const firstGroupSize = find(sizes2.sizeTree, 0);
            let prependedGroupItemsCount = 0;
            let groupIndex = 0;
            while (prependedGroupItemsCount < unshiftWith2) {
              const theGroupIndex = sizes2.groupIndices[groupIndex];
              const groupItemCount = sizes2.groupIndices.length === groupIndex + 1 ? Infinity : sizes2.groupIndices[groupIndex + 1] - theGroupIndex - 1;
              initialRanges.push({
                startIndex: theGroupIndex,
                endIndex: theGroupIndex,
                size: firstGroupSize
              });
              initialRanges.push({
                startIndex: theGroupIndex + 1,
                endIndex: theGroupIndex + 1 + groupItemCount - 1,
                size: defaultSize
              });
              groupIndex++;
              prependedGroupItemsCount += groupItemCount + 1;
            }
            const sizeTreeKV = walk(sizes2.sizeTree);
            const firstGroupIsExpanded = prependedGroupItemsCount !== unshiftWith2;
            if (firstGroupIsExpanded) {
              sizeTreeKV.shift();
            }
            return sizeTreeKV.reduce(
              (acc, { k: index, v: size }) => {
                let ranges = acc.ranges;
                if (acc.prevSize !== 0) {
                  ranges = [
                    ...acc.ranges,
                    {
                      startIndex: acc.prevIndex,
                      endIndex: index + unshiftWith2 - 1,
                      size: acc.prevSize
                    }
                  ];
                }
                return {
                  ranges,
                  prevIndex: index + unshiftWith2,
                  prevSize: size
                };
              },
              {
                ranges: initialRanges,
                prevIndex: unshiftWith2,
                prevSize: 0
              }
            ).ranges;
          }
          return walk(sizes2.sizeTree).reduce(
            (acc, { k: index, v: size }) => {
              return {
                ranges: [...acc.ranges, { startIndex: acc.prevIndex, endIndex: index + unshiftWith2 - 1, size: acc.prevSize }],
                prevIndex: index + unshiftWith2,
                prevSize: size
              };
            },
            {
              ranges: [],
              prevIndex: 0,
              prevSize: defaultSize
            }
          ).ranges;
        })
      ),
      sizeRanges
    );
    const shiftWithOffset = streamFromEmitter(
      pipe(
        shiftWith,
        withLatestFrom(sizes, gap),
        map(([shiftWith2, { offsetTree }, gap2]) => {
          const newFirstItemIndex = -shiftWith2;
          return offsetOf(newFirstItemIndex, offsetTree, gap2);
        })
      )
    );
    connect(
      pipe(
        shiftWith,
        withLatestFrom(sizes, gap),
        map(([shiftWith2, sizes2, gap2]) => {
          const groupedMode = sizes2.groupIndices.length > 0;
          if (groupedMode) {
            if (empty(sizes2.sizeTree)) {
              return sizes2;
            }
            let newSizeTree = newTree();
            const prevGroupIndicesValue = getValue(prevGroupIndices);
            let removedItemsCount = 0;
            let groupIndex = 0;
            let groupOffset = 0;
            while (removedItemsCount < -shiftWith2) {
              groupOffset = prevGroupIndicesValue[groupIndex];
              const groupItemCount = prevGroupIndicesValue[groupIndex + 1] - groupOffset - 1;
              groupIndex++;
              removedItemsCount += groupItemCount + 1;
            }
            newSizeTree = walk(sizes2.sizeTree).reduce((acc, { k: k2, v: v2 }) => {
              return insert(acc, Math.max(0, k2 + shiftWith2), v2);
            }, newSizeTree);
            const aGroupIsShrunk = removedItemsCount !== -shiftWith2;
            if (aGroupIsShrunk) {
              const firstGroupSize = find(sizes2.sizeTree, groupOffset);
              newSizeTree = insert(newSizeTree, 0, firstGroupSize);
              const nextItemSize = findMaxKeyValue(sizes2.sizeTree, -shiftWith2 + 1)[1];
              newSizeTree = insert(newSizeTree, 1, nextItemSize);
            }
            return {
              ...sizes2,
              sizeTree: newSizeTree,
              ...createOffsetTree(sizes2.offsetTree, 0, newSizeTree, gap2)
            };
          } else {
            const newSizeTree = walk(sizes2.sizeTree).reduce((acc, { k: k2, v: v2 }) => {
              return insert(acc, Math.max(0, k2 + shiftWith2), v2);
            }, newTree());
            return {
              ...sizes2,
              sizeTree: newSizeTree,
              ...createOffsetTree(sizes2.offsetTree, 0, newSizeTree, gap2)
            };
          }
        })
      ),
      sizes
    );
    return {
      // input
      data,
      totalCount,
      sizeRanges,
      groupIndices,
      defaultItemSize,
      fixedItemSize,
      unshiftWith,
      shiftWith,
      shiftWithOffset,
      beforeUnshiftWith,
      firstItemIndex,
      gap,
      // output
      sizes,
      listRefresh,
      statefulTotalCount,
      trackItemSizes,
      itemSize
    };
  },
  tup(loggerSystem, recalcSystem),
  { singleton: true }
);
var SUPPORTS_SCROLL_TO_OPTIONS = typeof document !== "undefined" && "scrollBehavior" in document.documentElement.style;
function normalizeIndexLocation(location) {
  const result = typeof location === "number" ? { index: location } : location;
  if (!result.align) {
    result.align = "start";
  }
  if (!result.behavior || !SUPPORTS_SCROLL_TO_OPTIONS) {
    result.behavior = "auto";
  }
  if (!result.offset) {
    result.offset = 0;
  }
  return result;
}
var scrollToIndexSystem = system(
  ([
    { sizes, totalCount, listRefresh, gap },
    {
      scrollingInProgress,
      viewportHeight,
      scrollTo,
      smoothScrollTargetReached,
      headerHeight,
      footerHeight,
      fixedHeaderHeight,
      fixedFooterHeight
    },
    { log }
  ]) => {
    const scrollToIndex = stream();
    const scrollTargetReached = stream();
    const topListHeight = statefulStream(0);
    let unsubscribeNextListRefresh = null;
    let cleartTimeoutRef = null;
    let unsubscribeListRefresh = null;
    function cleanup() {
      if (unsubscribeNextListRefresh) {
        unsubscribeNextListRefresh();
        unsubscribeNextListRefresh = null;
      }
      if (unsubscribeListRefresh) {
        unsubscribeListRefresh();
        unsubscribeListRefresh = null;
      }
      if (cleartTimeoutRef) {
        clearTimeout(cleartTimeoutRef);
        cleartTimeoutRef = null;
      }
      publish(scrollingInProgress, false);
    }
    connect(
      pipe(
        scrollToIndex,
        withLatestFrom(sizes, viewportHeight, totalCount, topListHeight, headerHeight, footerHeight, log),
        withLatestFrom(gap, fixedHeaderHeight, fixedFooterHeight),
        map(
          ([
            [location, sizes2, viewportHeight2, totalCount2, topListHeight2, headerHeight2, footerHeight2, log2],
            gap2,
            fixedHeaderHeight2,
            fixedFooterHeight2
          ]) => {
            const normalLocation = normalizeIndexLocation(location);
            const { align, behavior, offset } = normalLocation;
            const lastIndex = totalCount2 - 1;
            const index = originalIndexFromLocation(normalLocation, sizes2, lastIndex);
            let top = offsetOf(index, sizes2.offsetTree, gap2) + headerHeight2;
            if (align === "end") {
              top += fixedHeaderHeight2 + findMaxKeyValue(sizes2.sizeTree, index)[1] - viewportHeight2 + fixedFooterHeight2;
              if (index === lastIndex) {
                top += footerHeight2;
              }
            } else if (align === "center") {
              top += (fixedHeaderHeight2 + findMaxKeyValue(sizes2.sizeTree, index)[1] - viewportHeight2 + fixedFooterHeight2) / 2;
            } else {
              top -= topListHeight2;
            }
            if (offset) {
              top += offset;
            }
            const retry = (listChanged) => {
              cleanup();
              if (listChanged) {
                log2("retrying to scroll to", { location }, LogLevel.DEBUG);
                publish(scrollToIndex, location);
              } else {
                publish(scrollTargetReached, true);
                log2("list did not change, scroll successful", {}, LogLevel.DEBUG);
              }
            };
            cleanup();
            if (behavior === "smooth") {
              let listChanged = false;
              unsubscribeListRefresh = subscribe(listRefresh, (changed) => {
                listChanged = listChanged || changed;
              });
              unsubscribeNextListRefresh = handleNext(smoothScrollTargetReached, () => {
                retry(listChanged);
              });
            } else {
              unsubscribeNextListRefresh = handleNext(pipe(listRefresh, watchChangesFor(150)), retry);
            }
            cleartTimeoutRef = setTimeout(() => {
              cleanup();
            }, 1200);
            publish(scrollingInProgress, true);
            log2("scrolling from index to", { index, top, behavior }, LogLevel.DEBUG);
            return { top, behavior };
          }
        )
      ),
      scrollTo
    );
    return {
      scrollToIndex,
      scrollTargetReached,
      topListHeight
    };
  },
  tup(sizeSystem, domIOSystem, loggerSystem),
  { singleton: true }
);
function watchChangesFor(limit) {
  return (done) => {
    const timeoutRef = setTimeout(() => {
      done(false);
    }, limit);
    return (value) => {
      if (value) {
        done(true);
        clearTimeout(timeoutRef);
      }
    };
  };
}
var UP = "up";
var DOWN = "down";
var NONE$1 = "none";
var INITIAL_BOTTOM_STATE = {
  atBottom: false,
  notAtBottomBecause: "NOT_SHOWING_LAST_ITEM",
  state: {
    offsetBottom: 0,
    scrollTop: 0,
    viewportHeight: 0,
    scrollHeight: 0
  }
};
var DEFAULT_AT_TOP_THRESHOLD = 0;
var stateFlagsSystem = system(([{ scrollContainerState, scrollTop, viewportHeight, headerHeight, footerHeight, scrollBy }]) => {
  const isAtBottom = statefulStream(false);
  const isAtTop = statefulStream(true);
  const atBottomStateChange = stream();
  const atTopStateChange = stream();
  const atBottomThreshold = statefulStream(4);
  const atTopThreshold = statefulStream(DEFAULT_AT_TOP_THRESHOLD);
  const isScrolling = statefulStreamFromEmitter(
    pipe(
      merge(pipe(duc(scrollTop), skip(1), mapTo(true)), pipe(duc(scrollTop), skip(1), mapTo(false), debounceTime(100))),
      distinctUntilChanged()
    ),
    false
  );
  const isScrollingBy = statefulStreamFromEmitter(
    pipe(merge(pipe(scrollBy, mapTo(true)), pipe(scrollBy, mapTo(false), debounceTime(200))), distinctUntilChanged()),
    false
  );
  connect(
    pipe(
      combineLatest(duc(scrollTop), duc(atTopThreshold)),
      map(([top, atTopThreshold2]) => top <= atTopThreshold2),
      distinctUntilChanged()
    ),
    isAtTop
  );
  connect(pipe(isAtTop, throttleTime(50)), atTopStateChange);
  const atBottomState = streamFromEmitter(
    pipe(
      combineLatest(scrollContainerState, duc(viewportHeight), duc(headerHeight), duc(footerHeight), duc(atBottomThreshold)),
      scan((current, [{ scrollTop: scrollTop2, scrollHeight }, viewportHeight2, _headerHeight, _footerHeight, atBottomThreshold2]) => {
        const isAtBottom2 = scrollTop2 + viewportHeight2 - scrollHeight > -atBottomThreshold2;
        const state = {
          viewportHeight: viewportHeight2,
          scrollTop: scrollTop2,
          scrollHeight
        };
        if (isAtBottom2) {
          let atBottomBecause;
          let scrollTopDelta;
          if (scrollTop2 > current.state.scrollTop) {
            atBottomBecause = "SCROLLED_DOWN";
            scrollTopDelta = current.state.scrollTop - scrollTop2;
          } else {
            atBottomBecause = "SIZE_DECREASED";
            scrollTopDelta = current.state.scrollTop - scrollTop2 || current.scrollTopDelta;
          }
          return {
            atBottom: true,
            state,
            atBottomBecause,
            scrollTopDelta
          };
        }
        let notAtBottomBecause;
        if (state.scrollHeight > current.state.scrollHeight) {
          notAtBottomBecause = "SIZE_INCREASED";
        } else if (viewportHeight2 < current.state.viewportHeight) {
          notAtBottomBecause = "VIEWPORT_HEIGHT_DECREASING";
        } else if (scrollTop2 < current.state.scrollTop) {
          notAtBottomBecause = "SCROLLING_UPWARDS";
        } else {
          notAtBottomBecause = "NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM";
        }
        return {
          atBottom: false,
          notAtBottomBecause,
          state
        };
      }, INITIAL_BOTTOM_STATE),
      distinctUntilChanged((prev, next) => {
        return prev && prev.atBottom === next.atBottom;
      })
    )
  );
  const lastJumpDueToItemResize = statefulStreamFromEmitter(
    pipe(
      scrollContainerState,
      scan(
        (current, { scrollTop: scrollTop2, scrollHeight, viewportHeight: viewportHeight2 }) => {
          if (!approximatelyEqual(current.scrollHeight, scrollHeight)) {
            const atBottom = scrollHeight - (scrollTop2 + viewportHeight2) < 1;
            if (current.scrollTop !== scrollTop2 && atBottom) {
              return {
                scrollHeight,
                scrollTop: scrollTop2,
                jump: current.scrollTop - scrollTop2,
                changed: true
              };
            } else {
              return {
                scrollHeight,
                scrollTop: scrollTop2,
                jump: 0,
                changed: true
              };
            }
          } else {
            return {
              scrollTop: scrollTop2,
              scrollHeight,
              jump: 0,
              changed: false
            };
          }
        },
        { scrollHeight: 0, jump: 0, scrollTop: 0, changed: false }
      ),
      filter((value) => value.changed),
      map((value) => value.jump)
    ),
    0
  );
  connect(
    pipe(
      atBottomState,
      map((state) => state.atBottom)
    ),
    isAtBottom
  );
  connect(pipe(isAtBottom, throttleTime(50)), atBottomStateChange);
  const scrollDirection = statefulStream(DOWN);
  connect(
    pipe(
      scrollContainerState,
      map(({ scrollTop: scrollTop2 }) => scrollTop2),
      distinctUntilChanged(),
      scan(
        (acc, scrollTop2) => {
          if (getValue(isScrollingBy)) {
            return { direction: acc.direction, prevScrollTop: scrollTop2 };
          }
          return { direction: scrollTop2 < acc.prevScrollTop ? UP : DOWN, prevScrollTop: scrollTop2 };
        },
        { direction: DOWN, prevScrollTop: 0 }
      ),
      map((value) => value.direction)
    ),
    scrollDirection
  );
  connect(pipe(scrollContainerState, throttleTime(50), mapTo(NONE$1)), scrollDirection);
  const scrollVelocity = statefulStream(0);
  connect(
    pipe(
      isScrolling,
      filter((value) => !value),
      // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
      mapTo(0)
    ),
    scrollVelocity
  );
  connect(
    pipe(
      scrollTop,
      throttleTime(100),
      withLatestFrom(isScrolling),
      filter(([_7, isScrolling2]) => !!isScrolling2),
      scan(([_7, prev], [next]) => [prev, next], [0, 0]),
      map(([prev, next]) => next - prev)
    ),
    scrollVelocity
  );
  return {
    isScrolling,
    isAtTop,
    isAtBottom,
    atBottomState,
    atTopStateChange,
    atBottomStateChange,
    scrollDirection,
    atBottomThreshold,
    atTopThreshold,
    scrollVelocity,
    lastJumpDueToItemResize
  };
}, tup(domIOSystem));
var propsReadySystem = system(
  ([{ log }]) => {
    const propsReady = statefulStream(false);
    const didMount = streamFromEmitter(
      pipe(
        propsReady,
        filter((ready) => ready),
        distinctUntilChanged()
      )
    );
    subscribe(propsReady, (value) => {
      value && getValue(log)("props updated", {}, LogLevel.DEBUG);
    });
    return { propsReady, didMount };
  },
  tup(loggerSystem),
  { singleton: true }
);
function skipFrames(frameCount, callback) {
  if (frameCount == 0) {
    callback();
  } else {
    requestAnimationFrame(() => skipFrames(frameCount - 1, callback));
  }
}
function getInitialTopMostItemIndexNumber(location, totalCount) {
  const lastIndex = totalCount - 1;
  const index = typeof location === "number" ? location : location.index === "LAST" ? lastIndex : location.index;
  return index;
}
var initialTopMostItemIndexSystem = system(
  ([{ sizes, listRefresh, defaultItemSize }, { scrollTop }, { scrollToIndex, scrollTargetReached }, { didMount }]) => {
    const scrolledToInitialItem = statefulStream(true);
    const initialTopMostItemIndex = statefulStream(0);
    const initialItemFinalLocationReached = statefulStream(true);
    connect(
      pipe(
        didMount,
        withLatestFrom(initialTopMostItemIndex),
        filter(([_7, location]) => !!location),
        mapTo(false)
      ),
      scrolledToInitialItem
    );
    connect(
      pipe(
        didMount,
        withLatestFrom(initialTopMostItemIndex),
        filter(([_7, location]) => !!location),
        mapTo(false)
      ),
      initialItemFinalLocationReached
    );
    subscribe(
      pipe(
        combineLatest(listRefresh, didMount),
        withLatestFrom(scrolledToInitialItem, sizes, defaultItemSize, initialItemFinalLocationReached),
        filter(([[, didMount2], scrolledToInitialItem2, { sizeTree }, defaultItemSize2, scrollScheduled]) => {
          return didMount2 && (!empty(sizeTree) || isDefined(defaultItemSize2)) && !scrolledToInitialItem2 && !scrollScheduled;
        }),
        withLatestFrom(initialTopMostItemIndex)
      ),
      ([, initialTopMostItemIndex2]) => {
        handleNext(scrollTargetReached, () => {
          publish(initialItemFinalLocationReached, true);
        });
        skipFrames(4, () => {
          handleNext(scrollTop, () => {
            publish(scrolledToInitialItem, true);
          });
          publish(scrollToIndex, initialTopMostItemIndex2);
        });
      }
    );
    return {
      scrolledToInitialItem,
      initialTopMostItemIndex,
      initialItemFinalLocationReached
    };
  },
  tup(sizeSystem, domIOSystem, scrollToIndexSystem, propsReadySystem),
  { singleton: true }
);
function normalizeFollowOutput(follow) {
  if (!follow) {
    return false;
  }
  return follow === "smooth" ? "smooth" : "auto";
}
var behaviorFromFollowOutput = (follow, isAtBottom) => {
  if (typeof follow === "function") {
    return normalizeFollowOutput(follow(isAtBottom));
  }
  return isAtBottom && normalizeFollowOutput(follow);
};
var followOutputSystem = system(
  ([
    { totalCount, listRefresh },
    { isAtBottom, atBottomState },
    { scrollToIndex },
    { scrolledToInitialItem },
    { propsReady, didMount },
    { log },
    { scrollingInProgress }
  ]) => {
    const followOutput = statefulStream(false);
    const autoscrollToBottom = stream();
    let pendingScrollHandle = null;
    function scrollToBottom(followOutputBehavior) {
      publish(scrollToIndex, {
        index: "LAST",
        align: "end",
        behavior: followOutputBehavior
      });
    }
    subscribe(
      pipe(
        combineLatest(pipe(duc(totalCount), skip(1)), didMount),
        withLatestFrom(duc(followOutput), isAtBottom, scrolledToInitialItem, scrollingInProgress),
        map(([[totalCount2, didMount2], followOutput2, isAtBottom2, scrolledToInitialItem2, scrollingInProgress2]) => {
          let shouldFollow = didMount2 && scrolledToInitialItem2;
          let followOutputBehavior = "auto";
          if (shouldFollow) {
            followOutputBehavior = behaviorFromFollowOutput(followOutput2, isAtBottom2 || scrollingInProgress2);
            shouldFollow = shouldFollow && !!followOutputBehavior;
          }
          return { totalCount: totalCount2, shouldFollow, followOutputBehavior };
        }),
        filter(({ shouldFollow }) => shouldFollow)
      ),
      ({ totalCount: totalCount2, followOutputBehavior }) => {
        if (pendingScrollHandle) {
          pendingScrollHandle();
          pendingScrollHandle = null;
        }
        pendingScrollHandle = handleNext(listRefresh, () => {
          getValue(log)("following output to ", { totalCount: totalCount2 }, LogLevel.DEBUG);
          scrollToBottom(followOutputBehavior);
          pendingScrollHandle = null;
        });
      }
    );
    function trapNextSizeIncrease(followOutput2) {
      const cancel = handleNext(atBottomState, (state) => {
        if (followOutput2 && !state.atBottom && state.notAtBottomBecause === "SIZE_INCREASED" && !pendingScrollHandle) {
          getValue(log)("scrolling to bottom due to increased size", {}, LogLevel.DEBUG);
          scrollToBottom("auto");
        }
      });
      setTimeout(cancel, 100);
    }
    subscribe(
      pipe(
        combineLatest(duc(followOutput), totalCount, propsReady),
        filter(([follow, , ready]) => follow && ready),
        scan(
          ({ value }, [, next]) => {
            return { refreshed: value === next, value: next };
          },
          { refreshed: false, value: 0 }
        ),
        filter(({ refreshed }) => refreshed),
        withLatestFrom(followOutput, totalCount)
      ),
      ([, followOutput2]) => {
        if (getValue(scrolledToInitialItem)) {
          trapNextSizeIncrease(followOutput2 !== false);
        }
      }
    );
    subscribe(autoscrollToBottom, () => {
      trapNextSizeIncrease(getValue(followOutput) !== false);
    });
    subscribe(combineLatest(duc(followOutput), atBottomState), ([followOutput2, state]) => {
      if (followOutput2 && !state.atBottom && state.notAtBottomBecause === "VIEWPORT_HEIGHT_DECREASING") {
        scrollToBottom("auto");
      }
    });
    return { followOutput, autoscrollToBottom };
  },
  tup(sizeSystem, stateFlagsSystem, scrollToIndexSystem, initialTopMostItemIndexSystem, propsReadySystem, loggerSystem, domIOSystem)
);
function groupCountsToIndicesAndCount(counts) {
  return counts.reduce(
    (acc, groupCount) => {
      acc.groupIndices.push(acc.totalCount);
      acc.totalCount += groupCount + 1;
      return acc;
    },
    {
      totalCount: 0,
      groupIndices: []
    }
  );
}
var groupedListSystem = system(([{ totalCount, groupIndices, sizes }, { scrollTop, headerHeight }]) => {
  const groupCounts = stream();
  const topItemsIndexes = stream();
  const groupIndicesAndCount = streamFromEmitter(pipe(groupCounts, map(groupCountsToIndicesAndCount)));
  connect(
    pipe(
      groupIndicesAndCount,
      map((value) => value.totalCount)
    ),
    totalCount
  );
  connect(
    pipe(
      groupIndicesAndCount,
      map((value) => value.groupIndices)
    ),
    groupIndices
  );
  connect(
    pipe(
      combineLatest(scrollTop, sizes, headerHeight),
      filter(([_7, sizes2]) => hasGroups(sizes2)),
      map(([scrollTop2, state, headerHeight2]) => findMaxKeyValue(state.groupOffsetTree, Math.max(scrollTop2 - headerHeight2, 0), "v")[0]),
      distinctUntilChanged(),
      map((index) => [index])
    ),
    topItemsIndexes
  );
  return { groupCounts, topItemsIndexes };
}, tup(sizeSystem, domIOSystem));
function tupleComparator(prev, current) {
  return !!(prev && prev[0] === current[0] && prev[1] === current[1]);
}
function rangeComparator(prev, next) {
  return !!(prev && prev.startIndex === next.startIndex && prev.endIndex === next.endIndex);
}
var TOP = "top";
var BOTTOM = "bottom";
var NONE = "none";
function getOverscan(overscan, end, direction) {
  if (typeof overscan === "number") {
    return direction === UP && end === TOP || direction === DOWN && end === BOTTOM ? overscan : 0;
  } else {
    if (direction === UP) {
      return end === TOP ? overscan.main : overscan.reverse;
    } else {
      return end === BOTTOM ? overscan.main : overscan.reverse;
    }
  }
}
function getViewportIncrease(value, end) {
  return typeof value === "number" ? value : value[end] || 0;
}
var sizeRangeSystem = system(
  ([{ scrollTop, viewportHeight, deviation, headerHeight, fixedHeaderHeight }]) => {
    const listBoundary = stream();
    const topListHeight = statefulStream(0);
    const increaseViewportBy = statefulStream(0);
    const overscan = statefulStream(0);
    const visibleRange = statefulStreamFromEmitter(
      pipe(
        combineLatest(
          duc(scrollTop),
          duc(viewportHeight),
          duc(headerHeight),
          duc(listBoundary, tupleComparator),
          duc(overscan),
          duc(topListHeight),
          duc(fixedHeaderHeight),
          duc(deviation),
          duc(increaseViewportBy)
        ),
        map(
          ([
            scrollTop2,
            viewportHeight2,
            headerHeight2,
            [listTop, listBottom],
            overscan2,
            topListHeight2,
            fixedHeaderHeight2,
            deviation2,
            increaseViewportBy2
          ]) => {
            const top = scrollTop2 - deviation2;
            const stickyHeaderHeight = topListHeight2 + fixedHeaderHeight2;
            const headerVisible = Math.max(headerHeight2 - top, 0);
            let direction = NONE;
            const topViewportAddition = getViewportIncrease(increaseViewportBy2, TOP);
            const bottomViewportAddition = getViewportIncrease(increaseViewportBy2, BOTTOM);
            listTop -= deviation2;
            listTop += headerHeight2 + fixedHeaderHeight2;
            listBottom += headerHeight2 + fixedHeaderHeight2;
            listBottom -= deviation2;
            if (listTop > scrollTop2 + stickyHeaderHeight - topViewportAddition) {
              direction = UP;
            }
            if (listBottom < scrollTop2 - headerVisible + viewportHeight2 + bottomViewportAddition) {
              direction = DOWN;
            }
            if (direction !== NONE) {
              return [
                Math.max(top - headerHeight2 - getOverscan(overscan2, TOP, direction) - topViewportAddition, 0),
                top - headerVisible - fixedHeaderHeight2 + viewportHeight2 + getOverscan(overscan2, BOTTOM, direction) + bottomViewportAddition
              ];
            }
            return null;
          }
        ),
        filter((value) => value != null),
        distinctUntilChanged(tupleComparator)
      ),
      [0, 0]
    );
    return {
      // input
      listBoundary,
      overscan,
      topListHeight,
      increaseViewportBy,
      // output
      visibleRange
    };
  },
  tup(domIOSystem),
  { singleton: true }
);
function probeItemSet(index, sizes, data) {
  if (hasGroups(sizes)) {
    const itemIndex = originalIndexFromItemIndex(index, sizes);
    const groupIndex = findMaxKeyValue(sizes.groupOffsetTree, itemIndex)[0];
    return [
      { index: groupIndex, size: 0, offset: 0 },
      { index: itemIndex, size: 0, offset: 0, data: data && data[0] }
    ];
  }
  return [{ index, size: 0, offset: 0, data: data && data[0] }];
}
var EMPTY_LIST_STATE = {
  items: [],
  topItems: [],
  offsetTop: 0,
  offsetBottom: 0,
  top: 0,
  bottom: 0,
  topListHeight: 0,
  totalCount: 0,
  firstItemIndex: 0
};
function transposeItems(items, sizes, firstItemIndex) {
  if (items.length === 0) {
    return [];
  }
  if (!hasGroups(sizes)) {
    return items.map((item) => ({ ...item, index: item.index + firstItemIndex, originalIndex: item.index }));
  }
  const startIndex = items[0].index;
  const endIndex = items[items.length - 1].index;
  const transposedItems = [];
  const groupRanges = rangesWithin(sizes.groupOffsetTree, startIndex, endIndex);
  let currentRange = void 0;
  let currentGroupIndex = 0;
  for (const item of items) {
    if (!currentRange || currentRange.end < item.index) {
      currentRange = groupRanges.shift();
      currentGroupIndex = sizes.groupIndices.indexOf(currentRange.start);
    }
    let transposedItem;
    if (item.index === currentRange.start) {
      transposedItem = {
        type: "group",
        index: currentGroupIndex
      };
    } else {
      transposedItem = {
        index: item.index - (currentGroupIndex + 1) + firstItemIndex,
        groupIndex: currentGroupIndex
      };
    }
    transposedItems.push({
      ...transposedItem,
      size: item.size,
      offset: item.offset,
      originalIndex: item.index,
      data: item.data
    });
  }
  return transposedItems;
}
function buildListState(items, topItems, totalCount, gap, sizes, firstItemIndex) {
  const { lastSize, lastOffset, lastIndex } = sizes;
  let offsetTop = 0;
  let bottom = 0;
  if (items.length > 0) {
    offsetTop = items[0].offset;
    const lastItem = items[items.length - 1];
    bottom = lastItem.offset + lastItem.size;
  }
  const itemCount = totalCount - lastIndex;
  const total = lastOffset + itemCount * lastSize + (itemCount - 1) * gap;
  const top = offsetTop;
  const offsetBottom = total - bottom;
  return {
    items: transposeItems(items, sizes, firstItemIndex),
    topItems: transposeItems(topItems, sizes, firstItemIndex),
    topListHeight: topItems.reduce((height, item) => item.size + height, 0),
    offsetTop,
    offsetBottom,
    top,
    bottom,
    totalCount,
    firstItemIndex
  };
}
function buildListStateFromItemCount(itemCount, initialTopMostItemIndex, sizes, firstItemIndex, gap, data) {
  let includedGroupsCount = 0;
  if (sizes.groupIndices.length > 0) {
    for (const index of sizes.groupIndices) {
      if (index - includedGroupsCount >= itemCount) {
        break;
      }
      includedGroupsCount++;
    }
  }
  const adjustedCount = itemCount + includedGroupsCount;
  const initialTopMostItemIndexNumber = getInitialTopMostItemIndexNumber(initialTopMostItemIndex, adjustedCount);
  const items = Array.from({ length: adjustedCount }).map((_7, index) => ({
    index: index + initialTopMostItemIndexNumber,
    size: 0,
    offset: 0,
    data: data[index + initialTopMostItemIndexNumber]
  }));
  return buildListState(items, [], adjustedCount, gap, sizes, firstItemIndex);
}
var listStateSystem = system(
  ([
    { sizes, totalCount, data, firstItemIndex, gap },
    groupedListSystem2,
    { visibleRange, listBoundary, topListHeight: rangeTopListHeight },
    { scrolledToInitialItem, initialTopMostItemIndex },
    { topListHeight },
    stateFlags,
    { didMount },
    { recalcInProgress }
  ]) => {
    const topItemsIndexes = statefulStream([]);
    const initialItemCount = statefulStream(0);
    const itemsRendered = stream();
    connect(groupedListSystem2.topItemsIndexes, topItemsIndexes);
    const listState = statefulStreamFromEmitter(
      pipe(
        combineLatest(
          didMount,
          recalcInProgress,
          duc(visibleRange, tupleComparator),
          duc(totalCount),
          duc(sizes),
          duc(initialTopMostItemIndex),
          scrolledToInitialItem,
          duc(topItemsIndexes),
          duc(firstItemIndex),
          duc(gap),
          data
        ),
        filter(([mount, recalcInProgress2, , totalCount2, , , , , , , data2]) => {
          const dataChangeInProgress = data2 && data2.length !== totalCount2;
          return mount && !recalcInProgress2 && !dataChangeInProgress;
        }),
        map(
          ([
            ,
            ,
            [startOffset, endOffset],
            totalCount2,
            sizes2,
            initialTopMostItemIndex2,
            scrolledToInitialItem2,
            topItemsIndexes2,
            firstItemIndex2,
            gap2,
            data2
          ]) => {
            const sizesValue = sizes2;
            const { sizeTree, offsetTree } = sizesValue;
            const initialItemCountValue = getValue(initialItemCount);
            if (totalCount2 === 0) {
              return { ...EMPTY_LIST_STATE, totalCount: totalCount2 };
            }
            if (startOffset === 0 && endOffset === 0) {
              if (initialItemCountValue === 0) {
                return { ...EMPTY_LIST_STATE, totalCount: totalCount2 };
              } else {
                return buildListStateFromItemCount(initialItemCountValue, initialTopMostItemIndex2, sizes2, firstItemIndex2, gap2, data2 || []);
              }
            }
            if (empty(sizeTree)) {
              if (initialItemCountValue > 0) {
                return null;
              }
              const state = buildListState(
                probeItemSet(getInitialTopMostItemIndexNumber(initialTopMostItemIndex2, totalCount2), sizesValue, data2),
                [],
                totalCount2,
                gap2,
                sizesValue,
                firstItemIndex2
              );
              return state;
            }
            const topItems = [];
            if (topItemsIndexes2.length > 0) {
              const startIndex = topItemsIndexes2[0];
              const endIndex = topItemsIndexes2[topItemsIndexes2.length - 1];
              let offset = 0;
              for (const range of rangesWithin(sizeTree, startIndex, endIndex)) {
                const size = range.value;
                const rangeStartIndex = Math.max(range.start, startIndex);
                const rangeEndIndex = Math.min(range.end, endIndex);
                for (let i2 = rangeStartIndex; i2 <= rangeEndIndex; i2++) {
                  topItems.push({ index: i2, size, offset, data: data2 && data2[i2] });
                  offset += size;
                }
              }
            }
            if (!scrolledToInitialItem2) {
              return buildListState([], topItems, totalCount2, gap2, sizesValue, firstItemIndex2);
            }
            const minStartIndex = topItemsIndexes2.length > 0 ? topItemsIndexes2[topItemsIndexes2.length - 1] + 1 : 0;
            const offsetPointRanges = rangesWithinOffsets(offsetTree, startOffset, endOffset, minStartIndex);
            if (offsetPointRanges.length === 0) {
              return null;
            }
            const maxIndex = totalCount2 - 1;
            const items = tap([], (result) => {
              for (const range of offsetPointRanges) {
                const point = range.value;
                let offset = point.offset;
                let rangeStartIndex = range.start;
                const size = point.size;
                if (point.offset < startOffset) {
                  rangeStartIndex += Math.floor((startOffset - point.offset + gap2) / (size + gap2));
                  const itemCount = rangeStartIndex - range.start;
                  offset += itemCount * size + itemCount * gap2;
                }
                if (rangeStartIndex < minStartIndex) {
                  offset += (minStartIndex - rangeStartIndex) * size;
                  rangeStartIndex = minStartIndex;
                }
                const endIndex = Math.min(range.end, maxIndex);
                for (let i2 = rangeStartIndex; i2 <= endIndex; i2++) {
                  if (offset >= endOffset) {
                    break;
                  }
                  result.push({ index: i2, size, offset, data: data2 && data2[i2] });
                  offset += size + gap2;
                }
              }
            });
            return buildListState(items, topItems, totalCount2, gap2, sizesValue, firstItemIndex2);
          }
        ),
        //@ts-expect-error filter needs to be fixed
        filter((value) => value !== null),
        distinctUntilChanged()
      ),
      EMPTY_LIST_STATE
    );
    connect(
      pipe(
        data,
        filter(isDefined),
        map((data2) => data2 == null ? void 0 : data2.length)
      ),
      totalCount
    );
    connect(
      pipe(
        listState,
        map((value) => value.topListHeight)
      ),
      topListHeight
    );
    connect(topListHeight, rangeTopListHeight);
    connect(
      pipe(
        listState,
        map((state) => [state.top, state.bottom])
      ),
      listBoundary
    );
    connect(
      pipe(
        listState,
        map((state) => state.items)
      ),
      itemsRendered
    );
    const endReached = streamFromEmitter(
      pipe(
        listState,
        filter(({ items }) => items.length > 0),
        withLatestFrom(totalCount, data),
        filter(([{ items }, totalCount2]) => items[items.length - 1].originalIndex === totalCount2 - 1),
        map(([, totalCount2, data2]) => [totalCount2 - 1, data2]),
        distinctUntilChanged(tupleComparator),
        map(([count]) => count)
      )
    );
    const startReached = streamFromEmitter(
      pipe(
        listState,
        throttleTime(200),
        filter(({ items, topItems }) => {
          return items.length > 0 && items[0].originalIndex === topItems.length;
        }),
        map(({ items }) => items[0].index),
        distinctUntilChanged()
      )
    );
    const rangeChanged = streamFromEmitter(
      pipe(
        listState,
        filter(({ items }) => items.length > 0),
        map(({ items }) => {
          let startIndex = 0;
          let endIndex = items.length - 1;
          while (items[startIndex].type === "group" && startIndex < endIndex) {
            startIndex++;
          }
          while (items[endIndex].type === "group" && endIndex > startIndex) {
            endIndex--;
          }
          return {
            startIndex: items[startIndex].index,
            endIndex: items[endIndex].index
          };
        }),
        distinctUntilChanged(rangeComparator)
      )
    );
    return { listState, topItemsIndexes, endReached, startReached, rangeChanged, itemsRendered, initialItemCount, ...stateFlags };
  },
  tup(
    sizeSystem,
    groupedListSystem,
    sizeRangeSystem,
    initialTopMostItemIndexSystem,
    scrollToIndexSystem,
    stateFlagsSystem,
    propsReadySystem,
    recalcSystem
  ),
  { singleton: true }
);
var initialItemCountSystem = system(
  ([{ sizes, firstItemIndex, data, gap }, { initialTopMostItemIndex }, { initialItemCount, listState }, { didMount }]) => {
    connect(
      pipe(
        didMount,
        withLatestFrom(initialItemCount),
        filter(([, count]) => count !== 0),
        withLatestFrom(initialTopMostItemIndex, sizes, firstItemIndex, gap, data),
        map(([[, count], initialTopMostItemIndexValue, sizes2, firstItemIndex2, gap2, data2 = []]) => {
          return buildListStateFromItemCount(count, initialTopMostItemIndexValue, sizes2, firstItemIndex2, gap2, data2);
        })
      ),
      listState
    );
    return {};
  },
  tup(sizeSystem, initialTopMostItemIndexSystem, listStateSystem, propsReadySystem),
  { singleton: true }
);
var scrollSeekSystem = system(
  ([{ scrollVelocity }]) => {
    const isSeeking = statefulStream(false);
    const rangeChanged = stream();
    const scrollSeekConfiguration = statefulStream(false);
    connect(
      pipe(
        scrollVelocity,
        withLatestFrom(scrollSeekConfiguration, isSeeking, rangeChanged),
        filter(([_7, config]) => !!config),
        map(([speed, config, isSeeking2, range]) => {
          const { exit, enter } = config;
          if (isSeeking2) {
            if (exit(speed, range)) {
              return false;
            }
          } else {
            if (enter(speed, range)) {
              return true;
            }
          }
          return isSeeking2;
        }),
        distinctUntilChanged()
      ),
      isSeeking
    );
    subscribe(
      pipe(combineLatest(isSeeking, scrollVelocity, rangeChanged), withLatestFrom(scrollSeekConfiguration)),
      ([[isSeeking2, velocity, range], config]) => isSeeking2 && config && config.change && config.change(velocity, range)
    );
    return { isSeeking, scrollSeekConfiguration, scrollVelocity, scrollSeekRangeChanged: rangeChanged };
  },
  tup(stateFlagsSystem),
  { singleton: true }
);
var topItemCountSystem = system(([{ topItemsIndexes }]) => {
  const topItemCount = statefulStream(0);
  connect(
    pipe(
      topItemCount,
      filter((length) => length > 0),
      map((length) => Array.from({ length }).map((_7, index) => index))
    ),
    topItemsIndexes
  );
  return { topItemCount };
}, tup(listStateSystem));
var totalListHeightSystem = system(
  ([{ footerHeight, headerHeight, fixedHeaderHeight, fixedFooterHeight }, { listState }]) => {
    const totalListHeightChanged = stream();
    const totalListHeight = statefulStreamFromEmitter(
      pipe(
        combineLatest(footerHeight, fixedFooterHeight, headerHeight, fixedHeaderHeight, listState),
        map(([footerHeight2, fixedFooterHeight2, headerHeight2, fixedHeaderHeight2, listState2]) => {
          return footerHeight2 + fixedFooterHeight2 + headerHeight2 + fixedHeaderHeight2 + listState2.offsetBottom + listState2.bottom;
        })
      ),
      0
    );
    connect(duc(totalListHeight), totalListHeightChanged);
    return { totalListHeight, totalListHeightChanged };
  },
  tup(domIOSystem, listStateSystem),
  { singleton: true }
);
function simpleMemoize(func) {
  let called = false;
  let result;
  return () => {
    if (!called) {
      called = true;
      result = func();
    }
    return result;
  };
}
var isMobileSafari = simpleMemoize(() => {
  return /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.test(navigator.userAgent);
});
var upwardScrollFixSystem = system(
  ([
    { scrollBy, scrollTop, deviation, scrollingInProgress },
    { isScrolling, isAtBottom, scrollDirection, lastJumpDueToItemResize },
    { listState },
    { beforeUnshiftWith, shiftWithOffset, sizes, gap },
    { log },
    { recalcInProgress }
  ]) => {
    const deviationOffset = streamFromEmitter(
      pipe(
        listState,
        withLatestFrom(lastJumpDueToItemResize),
        scan(
          ([, prevItems, prevTotalCount, prevTotalHeight], [{ items, totalCount, bottom, offsetBottom }, lastJumpDueToItemResize2]) => {
            const totalHeight = bottom + offsetBottom;
            let newDev = 0;
            if (prevTotalCount === totalCount) {
              if (prevItems.length > 0 && items.length > 0) {
                const atStart = items[0].originalIndex === 0 && prevItems[0].originalIndex === 0;
                if (!atStart) {
                  newDev = totalHeight - prevTotalHeight;
                  if (newDev !== 0) {
                    newDev += lastJumpDueToItemResize2;
                  }
                }
              }
            }
            return [newDev, items, totalCount, totalHeight];
          },
          [0, [], 0, 0]
        ),
        filter(([amount]) => amount !== 0),
        withLatestFrom(scrollTop, scrollDirection, scrollingInProgress, isAtBottom, log, recalcInProgress),
        filter(([, scrollTop2, scrollDirection2, scrollingInProgress2, , , recalcInProgress2]) => {
          return !recalcInProgress2 && !scrollingInProgress2 && scrollTop2 !== 0 && scrollDirection2 === UP;
        }),
        map(([[amount], , , , , log2]) => {
          log2("Upward scrolling compensation", { amount }, LogLevel.DEBUG);
          return amount;
        })
      )
    );
    function scrollByWith(offset) {
      if (offset > 0) {
        publish(scrollBy, { top: -offset, behavior: "auto" });
        publish(deviation, 0);
      } else {
        publish(deviation, 0);
        publish(scrollBy, { top: -offset, behavior: "auto" });
      }
    }
    subscribe(pipe(deviationOffset, withLatestFrom(deviation, isScrolling)), ([offset, deviationAmount, isScrolling2]) => {
      if (isScrolling2 && isMobileSafari()) {
        publish(deviation, deviationAmount - offset);
      } else {
        scrollByWith(-offset);
      }
    });
    subscribe(
      pipe(
        combineLatest(statefulStreamFromEmitter(isScrolling, false), deviation, recalcInProgress),
        filter(([is, deviation2, recalc]) => !is && !recalc && deviation2 !== 0),
        map(([_7, deviation2]) => deviation2),
        throttleTime(1)
      ),
      scrollByWith
    );
    connect(
      pipe(
        shiftWithOffset,
        map((offset) => {
          return { top: -offset };
        })
      ),
      scrollBy
    );
    subscribe(
      pipe(
        beforeUnshiftWith,
        withLatestFrom(sizes, gap),
        map(([offset, { lastSize: defaultItemSize, groupIndices, sizeTree }, gap2]) => {
          function getItemOffset(itemCount) {
            return itemCount * (defaultItemSize + gap2);
          }
          if (groupIndices.length === 0) {
            return getItemOffset(offset);
          } else {
            let amount = 0;
            const defaultGroupSize = find(sizeTree, 0);
            let recognizedOffsetItems = 0;
            let groupIndex = 0;
            while (recognizedOffsetItems < offset) {
              recognizedOffsetItems++;
              amount += defaultGroupSize;
              let groupItemCount = groupIndices.length === groupIndex + 1 ? Infinity : groupIndices[groupIndex + 1] - groupIndices[groupIndex] - 1;
              if (recognizedOffsetItems + groupItemCount > offset) {
                amount -= defaultGroupSize;
                groupItemCount = offset - recognizedOffsetItems + 1;
              }
              recognizedOffsetItems += groupItemCount;
              amount += getItemOffset(groupItemCount);
              groupIndex++;
            }
            return amount;
          }
        })
      ),
      (offset) => {
        publish(deviation, offset);
        requestAnimationFrame(() => {
          publish(scrollBy, { top: offset });
          requestAnimationFrame(() => {
            publish(deviation, 0);
            publish(recalcInProgress, false);
          });
        });
      }
    );
    return { deviation };
  },
  tup(domIOSystem, stateFlagsSystem, listStateSystem, sizeSystem, loggerSystem, recalcSystem)
);
var initialScrollTopSystem = system(
  ([{ didMount }, { scrollTo }, { listState }]) => {
    const initialScrollTop = statefulStream(0);
    subscribe(
      pipe(
        didMount,
        withLatestFrom(initialScrollTop),
        filter(([, offset]) => offset !== 0),
        map(([, offset]) => ({ top: offset }))
      ),
      (location) => {
        handleNext(
          pipe(
            listState,
            skip(1),
            filter((state) => state.items.length > 1)
          ),
          () => {
            requestAnimationFrame(() => {
              publish(scrollTo, location);
            });
          }
        );
      }
    );
    return {
      initialScrollTop
    };
  },
  tup(propsReadySystem, domIOSystem, listStateSystem),
  { singleton: true }
);
var alignToBottomSystem = system(
  ([{ viewportHeight }, { totalListHeight }]) => {
    const alignToBottom = statefulStream(false);
    const paddingTopAddition = statefulStreamFromEmitter(
      pipe(
        combineLatest(alignToBottom, viewportHeight, totalListHeight),
        filter(([enabled]) => enabled),
        map(([, viewportHeight2, totalListHeight2]) => {
          return Math.max(0, viewportHeight2 - totalListHeight2);
        }),
        throttleTime(0),
        distinctUntilChanged()
      ),
      0
    );
    return { alignToBottom, paddingTopAddition };
  },
  tup(domIOSystem, totalListHeightSystem),
  { singleton: true }
);
var windowScrollerSystem = system(([{ scrollTo, scrollContainerState }]) => {
  const windowScrollContainerState = stream();
  const windowViewportRect = stream();
  const windowScrollTo = stream();
  const useWindowScroll = statefulStream(false);
  const customScrollParent = statefulStream(void 0);
  connect(
    pipe(
      combineLatest(windowScrollContainerState, windowViewportRect),
      map(([{ viewportHeight, scrollTop: windowScrollTop, scrollHeight }, { offsetTop }]) => {
        return {
          scrollTop: Math.max(0, windowScrollTop - offsetTop),
          scrollHeight,
          viewportHeight
        };
      })
    ),
    scrollContainerState
  );
  connect(
    pipe(
      scrollTo,
      withLatestFrom(windowViewportRect),
      map(([scrollTo2, { offsetTop }]) => {
        return {
          ...scrollTo2,
          top: scrollTo2.top + offsetTop
        };
      })
    ),
    windowScrollTo
  );
  return {
    // config
    useWindowScroll,
    customScrollParent,
    // input
    windowScrollContainerState,
    windowViewportRect,
    // signals
    windowScrollTo
  };
}, tup(domIOSystem));
var defaultCalculateViewLocation = ({
  itemTop: itemTop2,
  itemBottom,
  viewportTop,
  viewportBottom,
  locationParams: { behavior, align, ...rest }
}) => {
  if (itemTop2 < viewportTop) {
    return { ...rest, behavior, align: align != null ? align : "start" };
  }
  if (itemBottom > viewportBottom) {
    return { ...rest, behavior, align: align != null ? align : "end" };
  }
  return null;
};
var scrollIntoViewSystem = system(
  ([
    { sizes, totalCount, gap },
    { scrollTop, viewportHeight, headerHeight, fixedHeaderHeight, fixedFooterHeight, scrollingInProgress },
    { scrollToIndex }
  ]) => {
    const scrollIntoView = stream();
    connect(
      pipe(
        scrollIntoView,
        withLatestFrom(sizes, viewportHeight, totalCount, headerHeight, fixedHeaderHeight, fixedFooterHeight, scrollTop),
        withLatestFrom(gap),
        map(([[viewLocation, sizes2, viewportHeight2, totalCount2, headerHeight2, fixedHeaderHeight2, fixedFooterHeight2, scrollTop2], gap2]) => {
          const { done, behavior, align, calculateViewLocation = defaultCalculateViewLocation, ...rest } = viewLocation;
          const actualIndex = originalIndexFromLocation(viewLocation, sizes2, totalCount2 - 1);
          const itemTop2 = offsetOf(actualIndex, sizes2.offsetTree, gap2) + headerHeight2 + fixedHeaderHeight2;
          const itemBottom = itemTop2 + findMaxKeyValue(sizes2.sizeTree, actualIndex)[1];
          const viewportTop = scrollTop2 + fixedHeaderHeight2;
          const viewportBottom = scrollTop2 + viewportHeight2 - fixedFooterHeight2;
          const location = calculateViewLocation({
            itemTop: itemTop2,
            itemBottom,
            viewportTop,
            viewportBottom,
            locationParams: { behavior, align, ...rest }
          });
          if (location) {
            done && handleNext(
              pipe(
                scrollingInProgress,
                filter((value) => value === false),
                // skips the initial publish of false, and the cleanup call.
                // but if scrollingInProgress is true, we skip the initial publish.
                skip(getValue(scrollingInProgress) ? 1 : 2)
              ),
              done
            );
          } else {
            done && done();
          }
          return location;
        }),
        filter((value) => value !== null)
      ),
      scrollToIndex
    );
    return {
      scrollIntoView
    };
  },
  tup(sizeSystem, domIOSystem, scrollToIndexSystem, listStateSystem, loggerSystem),
  { singleton: true }
);
var stateLoadSystem = system(
  ([
    { sizes, sizeRanges },
    { scrollTop },
    { initialTopMostItemIndex },
    { didMount },
    { useWindowScroll, windowScrollContainerState, windowViewportRect }
  ]) => {
    const getState = stream();
    const restoreStateFrom = statefulStream(void 0);
    const statefulWindowScrollContainerState = statefulStream(null);
    const statefulWindowViewportRect = statefulStream(null);
    connect(windowScrollContainerState, statefulWindowScrollContainerState);
    connect(windowViewportRect, statefulWindowViewportRect);
    subscribe(
      pipe(getState, withLatestFrom(sizes, scrollTop, useWindowScroll, statefulWindowScrollContainerState, statefulWindowViewportRect)),
      ([callback, sizes2, scrollTop2, useWindowScroll2, windowScrollContainerState2, windowViewportRect2]) => {
        const ranges = sizeTreeToRanges(sizes2.sizeTree);
        if (useWindowScroll2 && windowScrollContainerState2 !== null && windowViewportRect2 !== null) {
          scrollTop2 = windowScrollContainerState2.scrollTop - windowViewportRect2.offsetTop;
        }
        callback({ ranges, scrollTop: scrollTop2 });
      }
    );
    connect(pipe(restoreStateFrom, filter(isDefined), map(locationFromSnapshot)), initialTopMostItemIndex);
    connect(
      pipe(
        didMount,
        withLatestFrom(restoreStateFrom),
        filter(([, state]) => state !== void 0),
        distinctUntilChanged(),
        map(([, snapshot]) => {
          return snapshot.ranges;
        })
      ),
      sizeRanges
    );
    return {
      getState,
      restoreStateFrom
    };
  },
  tup(sizeSystem, domIOSystem, initialTopMostItemIndexSystem, propsReadySystem, windowScrollerSystem)
);
function locationFromSnapshot(snapshot) {
  return { offset: snapshot.scrollTop, index: 0, align: "start" };
}
var featureGroup1System = system(
  ([
    sizeRange,
    initialItemCount,
    propsReady,
    scrollSeek,
    totalListHeight,
    initialScrollTopSystem2,
    alignToBottom,
    windowScroller,
    scrollIntoView,
    logger
  ]) => {
    return {
      ...sizeRange,
      ...initialItemCount,
      ...propsReady,
      ...scrollSeek,
      ...totalListHeight,
      ...initialScrollTopSystem2,
      ...alignToBottom,
      ...windowScroller,
      ...scrollIntoView,
      ...logger
    };
  },
  tup(
    sizeRangeSystem,
    initialItemCountSystem,
    propsReadySystem,
    scrollSeekSystem,
    totalListHeightSystem,
    initialScrollTopSystem,
    alignToBottomSystem,
    windowScrollerSystem,
    scrollIntoViewSystem,
    loggerSystem
  )
);
var listSystem = system(
  ([
    {
      totalCount,
      sizeRanges,
      fixedItemSize,
      defaultItemSize,
      trackItemSizes,
      itemSize,
      data,
      firstItemIndex,
      groupIndices,
      statefulTotalCount,
      gap,
      sizes
    },
    { initialTopMostItemIndex, scrolledToInitialItem, initialItemFinalLocationReached },
    domIO,
    stateLoad,
    followOutput,
    { listState, topItemsIndexes, ...flags },
    { scrollToIndex },
    _7,
    { topItemCount },
    { groupCounts },
    featureGroup1
  ]) => {
    connect(flags.rangeChanged, featureGroup1.scrollSeekRangeChanged);
    connect(
      pipe(
        featureGroup1.windowViewportRect,
        map((value) => value.visibleHeight)
      ),
      domIO.viewportHeight
    );
    return {
      // input
      totalCount,
      data,
      firstItemIndex,
      sizeRanges,
      initialTopMostItemIndex,
      scrolledToInitialItem,
      initialItemFinalLocationReached,
      topItemsIndexes,
      topItemCount,
      groupCounts,
      fixedItemHeight: fixedItemSize,
      defaultItemHeight: defaultItemSize,
      gap,
      ...followOutput,
      // output
      statefulTotalCount,
      listState,
      scrollToIndex,
      trackItemSizes,
      itemSize,
      groupIndices,
      // exported from stateFlagsSystem
      ...flags,
      // the bag of IO from featureGroup1System
      ...featureGroup1,
      ...domIO,
      sizes,
      ...stateLoad
    };
  },
  tup(
    sizeSystem,
    initialTopMostItemIndexSystem,
    domIOSystem,
    stateLoadSystem,
    followOutputSystem,
    listStateSystem,
    scrollToIndexSystem,
    upwardScrollFixSystem,
    topItemCountSystem,
    groupedListSystem,
    featureGroup1System
  )
);
var WEBKIT_STICKY = "-webkit-sticky";
var STICKY = "sticky";
var positionStickyCssValue = simpleMemoize(() => {
  if (typeof document === "undefined") {
    return STICKY;
  }
  const node = document.createElement("div");
  node.style.position = WEBKIT_STICKY;
  return node.style.position === WEBKIT_STICKY ? WEBKIT_STICKY : STICKY;
});
function useWindowViewportRectRef(callback, customScrollParent) {
  const viewportInfo = import_react5.default.useRef(null);
  const calculateInfo = import_react5.default.useCallback(
    (element) => {
      if (element === null || !element.offsetParent) {
        return;
      }
      const rect = element.getBoundingClientRect();
      const visibleWidth = rect.width;
      let visibleHeight, offsetTop;
      if (customScrollParent) {
        const customScrollParentRect = customScrollParent.getBoundingClientRect();
        const deltaTop = rect.top - customScrollParentRect.top;
        visibleHeight = customScrollParentRect.height - Math.max(0, deltaTop);
        offsetTop = deltaTop + customScrollParent.scrollTop;
      } else {
        visibleHeight = window.innerHeight - Math.max(0, rect.top);
        offsetTop = rect.top + window.pageYOffset;
      }
      viewportInfo.current = {
        offsetTop,
        visibleHeight,
        visibleWidth
      };
      callback(viewportInfo.current);
    },
    [callback, customScrollParent]
  );
  const { callbackRef, ref } = useSizeWithElRef(calculateInfo);
  const scrollAndResizeEventHandler = import_react5.default.useCallback(() => {
    calculateInfo(ref.current);
  }, [calculateInfo, ref]);
  import_react5.default.useEffect(() => {
    if (customScrollParent) {
      customScrollParent.addEventListener("scroll", scrollAndResizeEventHandler);
      const observer = new ResizeObserver(() => {
        requestAnimationFrame(scrollAndResizeEventHandler);
      });
      observer.observe(customScrollParent);
      return () => {
        customScrollParent.removeEventListener("scroll", scrollAndResizeEventHandler);
        observer.unobserve(customScrollParent);
      };
    } else {
      window.addEventListener("scroll", scrollAndResizeEventHandler);
      window.addEventListener("resize", scrollAndResizeEventHandler);
      return () => {
        window.removeEventListener("scroll", scrollAndResizeEventHandler);
        window.removeEventListener("resize", scrollAndResizeEventHandler);
      };
    }
  }, [scrollAndResizeEventHandler, customScrollParent]);
  return callbackRef;
}
var VirtuosoMockContext = import_react5.default.createContext(void 0);
var VirtuosoGridMockContext = import_react5.default.createContext(void 0);
function identity(value) {
  return value;
}
var listComponentPropsSystem = /* @__PURE__ */ system(() => {
  const itemContent = statefulStream((index) => `Item ${index}`);
  const context = statefulStream(null);
  const groupContent = statefulStream((index) => `Group ${index}`);
  const components = statefulStream({});
  const computeItemKey = statefulStream(identity);
  const headerFooterTag = statefulStream("div");
  const scrollerRef = statefulStream(noop);
  const distinctProp = (propName, defaultValue = null) => {
    return statefulStreamFromEmitter(
      pipe(
        components,
        map((components2) => components2[propName]),
        distinctUntilChanged()
      ),
      defaultValue
    );
  };
  return {
    context,
    itemContent,
    groupContent,
    components,
    computeItemKey,
    headerFooterTag,
    scrollerRef,
    FooterComponent: distinctProp("Footer"),
    HeaderComponent: distinctProp("Header"),
    TopItemListComponent: distinctProp("TopItemList"),
    ListComponent: distinctProp("List", "div"),
    ItemComponent: distinctProp("Item", "div"),
    GroupComponent: distinctProp("Group", "div"),
    ScrollerComponent: distinctProp("Scroller", "div"),
    EmptyPlaceholder: distinctProp("EmptyPlaceholder"),
    ScrollSeekPlaceholder: distinctProp("ScrollSeekPlaceholder")
  };
});
var combinedSystem$2 = /* @__PURE__ */ system(([listSystem2, propsSystem]) => {
  return { ...listSystem2, ...propsSystem };
}, tup(listSystem, listComponentPropsSystem));
var DefaultScrollSeekPlaceholder$1 = ({ height }) => /* @__PURE__ */ import_react5.default.createElement("div", { style: { height } });
var GROUP_STYLE = { position: positionStickyCssValue(), zIndex: 1, overflowAnchor: "none" };
var ITEM_STYLE$1 = { overflowAnchor: "none" };
var Items$1 = /* @__PURE__ */ import_react5.default.memo(function VirtuosoItems({ showTopList = false }) {
  const listState = useEmitterValue$2("listState");
  const sizeRanges = usePublisher$2("sizeRanges");
  const useWindowScroll = useEmitterValue$2("useWindowScroll");
  const customScrollParent = useEmitterValue$2("customScrollParent");
  const windowScrollContainerStateCallback = usePublisher$2("windowScrollContainerState");
  const _scrollContainerStateCallback = usePublisher$2("scrollContainerState");
  const scrollContainerStateCallback = customScrollParent || useWindowScroll ? windowScrollContainerStateCallback : _scrollContainerStateCallback;
  const itemContent = useEmitterValue$2("itemContent");
  const context = useEmitterValue$2("context");
  const groupContent = useEmitterValue$2("groupContent");
  const trackItemSizes = useEmitterValue$2("trackItemSizes");
  const itemSize = useEmitterValue$2("itemSize");
  const log = useEmitterValue$2("log");
  const listGap = usePublisher$2("gap");
  const { callbackRef } = useChangedListContentsSizes(
    sizeRanges,
    itemSize,
    trackItemSizes,
    showTopList ? noop : scrollContainerStateCallback,
    log,
    listGap,
    customScrollParent
  );
  const [deviation, setDeviation] = import_react5.default.useState(0);
  useEmitter$2("deviation", (value) => {
    if (deviation !== value) {
      setDeviation(value);
    }
  });
  const EmptyPlaceholder = useEmitterValue$2("EmptyPlaceholder");
  const ScrollSeekPlaceholder = useEmitterValue$2("ScrollSeekPlaceholder") || DefaultScrollSeekPlaceholder$1;
  const ListComponent = useEmitterValue$2("ListComponent");
  const ItemComponent = useEmitterValue$2("ItemComponent");
  const GroupComponent = useEmitterValue$2("GroupComponent");
  const computeItemKey = useEmitterValue$2("computeItemKey");
  const isSeeking = useEmitterValue$2("isSeeking");
  const hasGroups2 = useEmitterValue$2("groupIndices").length > 0;
  const alignToBottom = useEmitterValue$2("alignToBottom");
  const initialItemFinalLocationReached = useEmitterValue$2("initialItemFinalLocationReached");
  const containerStyle = showTopList ? {} : {
    boxSizing: "border-box",
    paddingTop: listState.offsetTop,
    paddingBottom: listState.offsetBottom,
    marginTop: deviation !== 0 ? deviation : alignToBottom ? "auto" : 0,
    ...initialItemFinalLocationReached ? {} : { visibility: "hidden" }
  };
  if (!showTopList && listState.totalCount === 0 && EmptyPlaceholder) {
    return import_react5.default.createElement(EmptyPlaceholder, contextPropIfNotDomElement(EmptyPlaceholder, context));
  }
  return import_react5.default.createElement(
    ListComponent,
    {
      ...contextPropIfNotDomElement(ListComponent, context),
      ref: callbackRef,
      style: containerStyle,
      "data-testid": showTopList ? "virtuoso-top-item-list" : "virtuoso-item-list"
    },
    (showTopList ? listState.topItems : listState.items).map((item) => {
      const index = item.originalIndex;
      const key = computeItemKey(index + listState.firstItemIndex, item.data, context);
      if (isSeeking) {
        return import_react5.default.createElement(ScrollSeekPlaceholder, {
          ...contextPropIfNotDomElement(ScrollSeekPlaceholder, context),
          key,
          index: item.index,
          height: item.size,
          type: item.type || "item",
          ...item.type === "group" ? {} : { groupIndex: item.groupIndex }
        });
      }
      if (item.type === "group") {
        return import_react5.default.createElement(
          GroupComponent,
          {
            ...contextPropIfNotDomElement(GroupComponent, context),
            key,
            "data-index": index,
            "data-known-size": item.size,
            "data-item-index": item.index,
            style: GROUP_STYLE
          },
          groupContent(item.index, context)
        );
      } else {
        return import_react5.default.createElement(
          ItemComponent,
          {
            ...contextPropIfNotDomElement(ItemComponent, context),
            ...itemPropIfNotDomElement(ItemComponent, item.data),
            key,
            "data-index": index,
            "data-known-size": item.size,
            "data-item-index": item.index,
            "data-item-group-index": item.groupIndex,
            style: ITEM_STYLE$1
          },
          hasGroups2 ? itemContent(item.index, item.groupIndex, item.data, context) : itemContent(item.index, item.data, context)
        );
      }
    })
  );
});
var scrollerStyle = {
  height: "100%",
  outline: "none",
  overflowY: "auto",
  position: "relative",
  WebkitOverflowScrolling: "touch"
};
var viewportStyle = (alignToBottom) => ({
  width: "100%",
  height: "100%",
  position: "absolute",
  top: 0,
  ...alignToBottom ? { display: "flex", flexDirection: "column" } : {}
});
var topItemListStyle = {
  width: "100%",
  position: positionStickyCssValue(),
  top: 0,
  zIndex: 1
};
function contextPropIfNotDomElement(element, context) {
  if (typeof element === "string") {
    return void 0;
  }
  return { context };
}
function itemPropIfNotDomElement(element, item) {
  return { item: typeof element === "string" ? void 0 : item };
}
var Header$1 = /* @__PURE__ */ import_react5.default.memo(function VirtuosoHeader() {
  const Header2 = useEmitterValue$2("HeaderComponent");
  const headerHeight = usePublisher$2("headerHeight");
  const headerFooterTag = useEmitterValue$2("headerFooterTag");
  const ref = useSize((el) => headerHeight(correctItemSize(el, "height")));
  const context = useEmitterValue$2("context");
  return Header2 ? import_react5.default.createElement(headerFooterTag, { ref }, import_react5.default.createElement(Header2, contextPropIfNotDomElement(Header2, context))) : null;
});
var Footer$1 = /* @__PURE__ */ import_react5.default.memo(function VirtuosoFooter() {
  const Footer2 = useEmitterValue$2("FooterComponent");
  const footerHeight = usePublisher$2("footerHeight");
  const headerFooterTag = useEmitterValue$2("headerFooterTag");
  const ref = useSize((el) => footerHeight(correctItemSize(el, "height")));
  const context = useEmitterValue$2("context");
  return Footer2 ? import_react5.default.createElement(headerFooterTag, { ref }, import_react5.default.createElement(Footer2, contextPropIfNotDomElement(Footer2, context))) : null;
});
function buildScroller({ usePublisher: usePublisher2, useEmitter: useEmitter2, useEmitterValue: useEmitterValue2 }) {
  const Scroller2 = import_react5.default.memo(function VirtuosoScroller({ style, children, ...props }) {
    const scrollContainerStateCallback = usePublisher2("scrollContainerState");
    const ScrollerComponent = useEmitterValue2("ScrollerComponent");
    const smoothScrollTargetReached = usePublisher2("smoothScrollTargetReached");
    const scrollerRefCallback = useEmitterValue2("scrollerRef");
    const context = useEmitterValue2("context");
    const { scrollerRef, scrollByCallback, scrollToCallback } = useScrollTop(
      scrollContainerStateCallback,
      smoothScrollTargetReached,
      ScrollerComponent,
      scrollerRefCallback
    );
    useEmitter2("scrollTo", scrollToCallback);
    useEmitter2("scrollBy", scrollByCallback);
    return import_react5.default.createElement(
      ScrollerComponent,
      {
        ref: scrollerRef,
        style: { ...scrollerStyle, ...style },
        "data-testid": "virtuoso-scroller",
        "data-virtuoso-scroller": true,
        tabIndex: 0,
        ...props,
        ...contextPropIfNotDomElement(ScrollerComponent, context)
      },
      children
    );
  });
  return Scroller2;
}
function buildWindowScroller({ usePublisher: usePublisher2, useEmitter: useEmitter2, useEmitterValue: useEmitterValue2 }) {
  const Scroller2 = import_react5.default.memo(function VirtuosoWindowScroller({ style, children, ...props }) {
    const scrollContainerStateCallback = usePublisher2("windowScrollContainerState");
    const ScrollerComponent = useEmitterValue2("ScrollerComponent");
    const smoothScrollTargetReached = usePublisher2("smoothScrollTargetReached");
    const totalListHeight = useEmitterValue2("totalListHeight");
    const deviation = useEmitterValue2("deviation");
    const customScrollParent = useEmitterValue2("customScrollParent");
    const context = useEmitterValue2("context");
    const { scrollerRef, scrollByCallback, scrollToCallback } = useScrollTop(
      scrollContainerStateCallback,
      smoothScrollTargetReached,
      ScrollerComponent,
      noop,
      customScrollParent
    );
    useIsomorphicLayoutEffect$1(() => {
      scrollerRef.current = customScrollParent ? customScrollParent : window;
      return () => {
        scrollerRef.current = null;
      };
    }, [scrollerRef, customScrollParent]);
    useEmitter2("windowScrollTo", scrollToCallback);
    useEmitter2("scrollBy", scrollByCallback);
    return import_react5.default.createElement(
      ScrollerComponent,
      {
        style: { position: "relative", ...style, ...totalListHeight !== 0 ? { height: totalListHeight + deviation } : {} },
        "data-virtuoso-scroller": true,
        ...props,
        ...contextPropIfNotDomElement(ScrollerComponent, context)
      },
      children
    );
  });
  return Scroller2;
}
var Viewport$2 = ({ children }) => {
  const ctx = import_react5.default.useContext(VirtuosoMockContext);
  const viewportHeight = usePublisher$2("viewportHeight");
  const fixedItemHeight = usePublisher$2("fixedItemHeight");
  const alignToBottom = useEmitterValue$2("alignToBottom");
  const viewportRef = useSize(compose2(viewportHeight, (el) => correctItemSize(el, "height")));
  import_react5.default.useEffect(() => {
    if (ctx) {
      viewportHeight(ctx.viewportHeight);
      fixedItemHeight(ctx.itemHeight);
    }
  }, [ctx, viewportHeight, fixedItemHeight]);
  return /* @__PURE__ */ import_react5.default.createElement("div", { style: viewportStyle(alignToBottom), ref: viewportRef, "data-viewport-type": "element" }, children);
};
var WindowViewport$2 = ({ children }) => {
  const ctx = import_react5.default.useContext(VirtuosoMockContext);
  const windowViewportRect = usePublisher$2("windowViewportRect");
  const fixedItemHeight = usePublisher$2("fixedItemHeight");
  const customScrollParent = useEmitterValue$2("customScrollParent");
  const viewportRef = useWindowViewportRectRef(windowViewportRect, customScrollParent);
  const alignToBottom = useEmitterValue$2("alignToBottom");
  import_react5.default.useEffect(() => {
    if (ctx) {
      fixedItemHeight(ctx.itemHeight);
      windowViewportRect({ offsetTop: 0, visibleHeight: ctx.viewportHeight, visibleWidth: 100 });
    }
  }, [ctx, windowViewportRect, fixedItemHeight]);
  return /* @__PURE__ */ import_react5.default.createElement("div", { ref: viewportRef, style: viewportStyle(alignToBottom), "data-viewport-type": "window" }, children);
};
var TopItemListContainer = ({ children }) => {
  const TopItemList = useEmitterValue$2("TopItemListComponent") || "div";
  const headerHeight = useEmitterValue$2("headerHeight");
  const style = { ...topItemListStyle, marginTop: `${headerHeight}px` };
  const context = useEmitterValue$2("context");
  return import_react5.default.createElement(TopItemList, { style, ...contextPropIfNotDomElement(TopItemList, context) }, children);
};
var ListRoot = /* @__PURE__ */ import_react5.default.memo(function VirtuosoRoot(props) {
  const useWindowScroll = useEmitterValue$2("useWindowScroll");
  const showTopList = useEmitterValue$2("topItemsIndexes").length > 0;
  const customScrollParent = useEmitterValue$2("customScrollParent");
  const TheScroller = customScrollParent || useWindowScroll ? WindowScroller$2 : Scroller$2;
  const TheViewport = customScrollParent || useWindowScroll ? WindowViewport$2 : Viewport$2;
  return /* @__PURE__ */ import_react5.default.createElement(TheScroller, { ...props }, showTopList && /* @__PURE__ */ import_react5.default.createElement(TopItemListContainer, null, /* @__PURE__ */ import_react5.default.createElement(Items$1, { showTopList: true })), /* @__PURE__ */ import_react5.default.createElement(TheViewport, null, /* @__PURE__ */ import_react5.default.createElement(Header$1, null), /* @__PURE__ */ import_react5.default.createElement(Items$1, null), /* @__PURE__ */ import_react5.default.createElement(Footer$1, null)));
});
var {
  Component: List,
  usePublisher: usePublisher$2,
  useEmitterValue: useEmitterValue$2,
  useEmitter: useEmitter$2
} = /* @__PURE__ */ systemToComponent(
  combinedSystem$2,
  {
    required: {},
    optional: {
      restoreStateFrom: "restoreStateFrom",
      context: "context",
      followOutput: "followOutput",
      itemContent: "itemContent",
      groupContent: "groupContent",
      overscan: "overscan",
      increaseViewportBy: "increaseViewportBy",
      totalCount: "totalCount",
      groupCounts: "groupCounts",
      topItemCount: "topItemCount",
      firstItemIndex: "firstItemIndex",
      initialTopMostItemIndex: "initialTopMostItemIndex",
      components: "components",
      atBottomThreshold: "atBottomThreshold",
      atTopThreshold: "atTopThreshold",
      computeItemKey: "computeItemKey",
      defaultItemHeight: "defaultItemHeight",
      fixedItemHeight: "fixedItemHeight",
      itemSize: "itemSize",
      scrollSeekConfiguration: "scrollSeekConfiguration",
      headerFooterTag: "headerFooterTag",
      data: "data",
      initialItemCount: "initialItemCount",
      initialScrollTop: "initialScrollTop",
      alignToBottom: "alignToBottom",
      useWindowScroll: "useWindowScroll",
      customScrollParent: "customScrollParent",
      scrollerRef: "scrollerRef",
      logLevel: "logLevel"
    },
    methods: {
      scrollToIndex: "scrollToIndex",
      scrollIntoView: "scrollIntoView",
      scrollTo: "scrollTo",
      scrollBy: "scrollBy",
      autoscrollToBottom: "autoscrollToBottom",
      getState: "getState"
    },
    events: {
      isScrolling: "isScrolling",
      endReached: "endReached",
      startReached: "startReached",
      rangeChanged: "rangeChanged",
      atBottomStateChange: "atBottomStateChange",
      atTopStateChange: "atTopStateChange",
      totalListHeightChanged: "totalListHeightChanged",
      itemsRendered: "itemsRendered",
      groupIndices: "groupIndices"
    }
  },
  ListRoot
);
var Scroller$2 = /* @__PURE__ */ buildScroller({ usePublisher: usePublisher$2, useEmitterValue: useEmitterValue$2, useEmitter: useEmitter$2 });
var WindowScroller$2 = /* @__PURE__ */ buildWindowScroller({ usePublisher: usePublisher$2, useEmitterValue: useEmitterValue$2, useEmitter: useEmitter$2 });
var INITIAL_GRID_STATE = {
  items: [],
  offsetBottom: 0,
  offsetTop: 0,
  top: 0,
  bottom: 0,
  itemHeight: 0,
  itemWidth: 0
};
var PROBE_GRID_STATE = {
  items: [{ index: 0 }],
  offsetBottom: 0,
  offsetTop: 0,
  top: 0,
  bottom: 0,
  itemHeight: 0,
  itemWidth: 0
};
var { round, ceil, floor, min, max } = Math;
function buildProbeGridState(items) {
  return {
    ...PROBE_GRID_STATE,
    items
  };
}
function buildItems(startIndex, endIndex, data) {
  return Array.from({ length: endIndex - startIndex + 1 }).map((_7, i2) => {
    const dataItem = data === null ? null : data[i2 + startIndex];
    return { index: i2 + startIndex, data: dataItem };
  });
}
function gapComparator(prev, next) {
  return prev && prev.column === next.column && prev.row === next.row;
}
function dimensionComparator(prev, next) {
  return prev && prev.width === next.width && prev.height === next.height;
}
var gridSystem = /* @__PURE__ */ system(
  ([
    { overscan, visibleRange, listBoundary },
    { scrollTop, viewportHeight, scrollBy, scrollTo, smoothScrollTargetReached, scrollContainerState, footerHeight, headerHeight },
    stateFlags,
    scrollSeek,
    { propsReady, didMount },
    { windowViewportRect, useWindowScroll, customScrollParent, windowScrollContainerState, windowScrollTo },
    log
  ]) => {
    const totalCount = statefulStream(0);
    const initialItemCount = statefulStream(0);
    const gridState = statefulStream(INITIAL_GRID_STATE);
    const viewportDimensions = statefulStream({ height: 0, width: 0 });
    const itemDimensions = statefulStream({ height: 0, width: 0 });
    const scrollToIndex = stream();
    const scrollHeight = stream();
    const deviation = statefulStream(0);
    const data = statefulStream(null);
    const gap = statefulStream({ row: 0, column: 0 });
    const stateChanged = stream();
    const restoreStateFrom = stream();
    const stateRestoreInProgress = statefulStream(false);
    const initialTopMostItemIndex = statefulStream(0);
    const scrolledToInitialItem = statefulStream(true);
    const scrollScheduled = statefulStream(false);
    subscribe(
      pipe(
        didMount,
        withLatestFrom(initialTopMostItemIndex),
        filter(([_7, location]) => !!location)
      ),
      () => {
        publish(scrolledToInitialItem, false);
        publish(initialItemCount, 0);
      }
    );
    subscribe(
      pipe(
        combineLatest(didMount, scrolledToInitialItem, itemDimensions, viewportDimensions, initialTopMostItemIndex, scrollScheduled),
        filter(([didMount2, scrolledToInitialItem2, itemDimensions2, viewportDimensions2, , scrollScheduled2]) => {
          return didMount2 && !scrolledToInitialItem2 && itemDimensions2.height !== 0 && viewportDimensions2.height !== 0 && !scrollScheduled2;
        })
      ),
      ([, , , , initialTopMostItemIndex2]) => {
        publish(scrollScheduled, true);
        skipFrames(1, () => {
          publish(scrollToIndex, initialTopMostItemIndex2);
        });
        handleNext(pipe(scrollTop), () => {
          publish(listBoundary, [0, 0]);
          publish(scrolledToInitialItem, true);
        });
      }
    );
    connect(
      pipe(
        restoreStateFrom,
        filter((value) => value !== void 0 && value !== null && value.scrollTop > 0),
        mapTo(0)
      ),
      initialItemCount
    );
    subscribe(
      pipe(
        didMount,
        withLatestFrom(restoreStateFrom),
        filter(([, snapshot]) => snapshot !== void 0 && snapshot !== null)
      ),
      ([, snapshot]) => {
        if (!snapshot) {
          return;
        }
        publish(viewportDimensions, snapshot.viewport), publish(itemDimensions, snapshot == null ? void 0 : snapshot.item);
        publish(gap, snapshot.gap);
        if (snapshot.scrollTop > 0) {
          publish(stateRestoreInProgress, true);
          handleNext(pipe(scrollTop, skip(1)), (_value) => {
            publish(stateRestoreInProgress, false);
          });
          publish(scrollTo, { top: snapshot.scrollTop });
        }
      }
    );
    connect(
      pipe(
        viewportDimensions,
        map(({ height }) => height)
      ),
      viewportHeight
    );
    connect(
      pipe(
        combineLatest(
          duc(viewportDimensions, dimensionComparator),
          duc(itemDimensions, dimensionComparator),
          duc(gap, (prev, next) => prev && prev.column === next.column && prev.row === next.row),
          duc(scrollTop)
        ),
        map(([viewport, item, gap2, scrollTop2]) => ({
          viewport,
          item,
          gap: gap2,
          scrollTop: scrollTop2
        }))
      ),
      stateChanged
    );
    connect(
      pipe(
        combineLatest(
          duc(totalCount),
          visibleRange,
          duc(gap, gapComparator),
          duc(itemDimensions, dimensionComparator),
          duc(viewportDimensions, dimensionComparator),
          duc(data),
          duc(initialItemCount),
          duc(stateRestoreInProgress),
          duc(scrolledToInitialItem),
          duc(initialTopMostItemIndex)
        ),
        filter(([, , , , , , , stateRestoreInProgress2]) => {
          return !stateRestoreInProgress2;
        }),
        map(
          ([
            totalCount2,
            [startOffset, endOffset],
            gap2,
            item,
            viewport,
            data2,
            initialItemCount2,
            ,
            scrolledToInitialItem2,
            initialTopMostItemIndex2
          ]) => {
            const { row: rowGap, column: columnGap } = gap2;
            const { height: itemHeight, width: itemWidth } = item;
            const { width: viewportWidth } = viewport;
            if (initialItemCount2 === 0 && (totalCount2 === 0 || viewportWidth === 0)) {
              return INITIAL_GRID_STATE;
            }
            if (itemWidth === 0) {
              const startIndex2 = getInitialTopMostItemIndexNumber(initialTopMostItemIndex2, totalCount2);
              const endIndex2 = startIndex2 === 0 ? Math.max(initialItemCount2 - 1, 0) : startIndex2;
              return buildProbeGridState(buildItems(startIndex2, endIndex2, data2));
            }
            const perRow = itemsPerRow(viewportWidth, itemWidth, columnGap);
            let startIndex;
            let endIndex;
            if (!scrolledToInitialItem2) {
              startIndex = 0;
              endIndex = -1;
            } else if (startOffset === 0 && endOffset === 0 && initialItemCount2 > 0) {
              startIndex = 0;
              endIndex = initialItemCount2 - 1;
            } else {
              startIndex = perRow * floor((startOffset + rowGap) / (itemHeight + rowGap));
              endIndex = perRow * ceil((endOffset + rowGap) / (itemHeight + rowGap)) - 1;
              endIndex = min(totalCount2 - 1, max(endIndex, perRow - 1));
              startIndex = min(endIndex, max(0, startIndex));
            }
            const items = buildItems(startIndex, endIndex, data2);
            const { top, bottom } = gridLayout(viewport, gap2, item, items);
            const rowCount = ceil(totalCount2 / perRow);
            const totalHeight = rowCount * itemHeight + (rowCount - 1) * rowGap;
            const offsetBottom = totalHeight - bottom;
            return { items, offsetTop: top, offsetBottom, top, bottom, itemHeight, itemWidth };
          }
        )
      ),
      gridState
    );
    connect(
      pipe(
        data,
        filter((data2) => data2 !== null),
        map((data2) => data2.length)
      ),
      totalCount
    );
    connect(
      pipe(
        combineLatest(viewportDimensions, itemDimensions, gridState, gap),
        filter(([viewportDimensions2, itemDimensions2, { items }]) => {
          return items.length > 0 && itemDimensions2.height !== 0 && viewportDimensions2.height !== 0;
        }),
        map(([viewportDimensions2, itemDimensions2, { items }, gap2]) => {
          const { top, bottom } = gridLayout(viewportDimensions2, gap2, itemDimensions2, items);
          return [top, bottom];
        }),
        distinctUntilChanged(tupleComparator)
      ),
      listBoundary
    );
    const hasScrolled = statefulStream(false);
    connect(
      pipe(
        scrollTop,
        withLatestFrom(hasScrolled),
        map(([scrollTop2, hasScrolled2]) => {
          return hasScrolled2 || scrollTop2 !== 0;
        })
      ),
      hasScrolled
    );
    const endReached = streamFromEmitter(
      pipe(
        duc(gridState),
        filter(({ items }) => items.length > 0),
        withLatestFrom(totalCount, hasScrolled),
        filter(([{ items }, totalCount2, hasScrolled2]) => hasScrolled2 && items[items.length - 1].index === totalCount2 - 1),
        map(([, totalCount2]) => totalCount2 - 1),
        distinctUntilChanged()
      )
    );
    const startReached = streamFromEmitter(
      pipe(
        duc(gridState),
        filter(({ items }) => {
          return items.length > 0 && items[0].index === 0;
        }),
        // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
        mapTo(0),
        distinctUntilChanged()
      )
    );
    const rangeChanged = streamFromEmitter(
      pipe(
        duc(gridState),
        withLatestFrom(stateRestoreInProgress),
        filter(([{ items }, stateRestoreInProgress2]) => items.length > 0 && !stateRestoreInProgress2),
        map(([{ items }]) => {
          return {
            startIndex: items[0].index,
            endIndex: items[items.length - 1].index
          };
        }),
        distinctUntilChanged(rangeComparator),
        throttleTime(0)
      )
    );
    connect(rangeChanged, scrollSeek.scrollSeekRangeChanged);
    connect(
      pipe(
        scrollToIndex,
        withLatestFrom(viewportDimensions, itemDimensions, totalCount, gap),
        map(([location, viewportDimensions2, itemDimensions2, totalCount2, gap2]) => {
          const normalLocation = normalizeIndexLocation(location);
          const { align, behavior, offset } = normalLocation;
          let index = normalLocation.index;
          if (index === "LAST") {
            index = totalCount2 - 1;
          }
          index = max(0, index, min(totalCount2 - 1, index));
          let top = itemTop(viewportDimensions2, gap2, itemDimensions2, index);
          if (align === "end") {
            top = round(top - viewportDimensions2.height + itemDimensions2.height);
          } else if (align === "center") {
            top = round(top - viewportDimensions2.height / 2 + itemDimensions2.height / 2);
          }
          if (offset) {
            top += offset;
          }
          return { top, behavior };
        })
      ),
      scrollTo
    );
    const totalListHeight = statefulStreamFromEmitter(
      pipe(
        gridState,
        map((gridState2) => {
          return gridState2.offsetBottom + gridState2.bottom;
        })
      ),
      0
    );
    connect(
      pipe(
        windowViewportRect,
        map((viewportInfo) => ({ width: viewportInfo.visibleWidth, height: viewportInfo.visibleHeight }))
      ),
      viewportDimensions
    );
    return {
      // input
      data,
      totalCount,
      viewportDimensions,
      itemDimensions,
      scrollTop,
      scrollHeight,
      overscan,
      scrollBy,
      scrollTo,
      scrollToIndex,
      smoothScrollTargetReached,
      windowViewportRect,
      windowScrollTo,
      useWindowScroll,
      customScrollParent,
      windowScrollContainerState,
      deviation,
      scrollContainerState,
      footerHeight,
      headerHeight,
      initialItemCount,
      gap,
      restoreStateFrom,
      ...scrollSeek,
      initialTopMostItemIndex,
      // output
      gridState,
      totalListHeight,
      ...stateFlags,
      startReached,
      endReached,
      rangeChanged,
      stateChanged,
      propsReady,
      stateRestoreInProgress,
      ...log
    };
  },
  tup(sizeRangeSystem, domIOSystem, stateFlagsSystem, scrollSeekSystem, propsReadySystem, windowScrollerSystem, loggerSystem)
);
function gridLayout(viewport, gap, item, items) {
  const { height: itemHeight } = item;
  if (itemHeight === void 0 || items.length === 0) {
    return { top: 0, bottom: 0 };
  }
  const top = itemTop(viewport, gap, item, items[0].index);
  const bottom = itemTop(viewport, gap, item, items[items.length - 1].index) + itemHeight;
  return { top, bottom };
}
function itemTop(viewport, gap, item, index) {
  const perRow = itemsPerRow(viewport.width, item.width, gap.column);
  const rowCount = floor(index / perRow);
  const top = rowCount * item.height + max(0, rowCount - 1) * gap.row;
  return top > 0 ? top + gap.row : top;
}
function itemsPerRow(viewportWidth, itemWidth, gap) {
  return max(1, floor((viewportWidth + gap) / (floor(itemWidth) + gap)));
}
var gridComponentPropsSystem = /* @__PURE__ */ system(() => {
  const itemContent = statefulStream((index) => `Item ${index}`);
  const components = statefulStream({});
  const context = statefulStream(null);
  const itemClassName = statefulStream("virtuoso-grid-item");
  const listClassName = statefulStream("virtuoso-grid-list");
  const computeItemKey = statefulStream(identity);
  const headerFooterTag = statefulStream("div");
  const scrollerRef = statefulStream(noop);
  const distinctProp = (propName, defaultValue = null) => {
    return statefulStreamFromEmitter(
      pipe(
        components,
        map((components2) => components2[propName]),
        distinctUntilChanged()
      ),
      defaultValue
    );
  };
  return {
    context,
    itemContent,
    components,
    computeItemKey,
    itemClassName,
    listClassName,
    headerFooterTag,
    scrollerRef,
    FooterComponent: distinctProp("Footer"),
    HeaderComponent: distinctProp("Header"),
    ListComponent: distinctProp("List", "div"),
    ItemComponent: distinctProp("Item", "div"),
    ScrollerComponent: distinctProp("Scroller", "div"),
    ScrollSeekPlaceholder: distinctProp("ScrollSeekPlaceholder", "div")
  };
});
var combinedSystem$1 = /* @__PURE__ */ system(([gridSystem2, gridComponentPropsSystem2]) => {
  return { ...gridSystem2, ...gridComponentPropsSystem2 };
}, tup(gridSystem, gridComponentPropsSystem));
var GridItems = /* @__PURE__ */ import_react5.default.memo(function GridItems2() {
  const gridState = useEmitterValue$1("gridState");
  const listClassName = useEmitterValue$1("listClassName");
  const itemClassName = useEmitterValue$1("itemClassName");
  const itemContent = useEmitterValue$1("itemContent");
  const computeItemKey = useEmitterValue$1("computeItemKey");
  const isSeeking = useEmitterValue$1("isSeeking");
  const scrollHeightCallback = usePublisher$1("scrollHeight");
  const ItemComponent = useEmitterValue$1("ItemComponent");
  const ListComponent = useEmitterValue$1("ListComponent");
  const ScrollSeekPlaceholder = useEmitterValue$1("ScrollSeekPlaceholder");
  const context = useEmitterValue$1("context");
  const itemDimensions = usePublisher$1("itemDimensions");
  const gridGap = usePublisher$1("gap");
  const log = useEmitterValue$1("log");
  const stateRestoreInProgress = useEmitterValue$1("stateRestoreInProgress");
  const listRef = useSize((el) => {
    const scrollHeight = el.parentElement.parentElement.scrollHeight;
    scrollHeightCallback(scrollHeight);
    const firstItem = el.firstChild;
    if (firstItem) {
      const { width, height } = firstItem.getBoundingClientRect();
      itemDimensions({ width, height });
    }
    gridGap({
      row: resolveGapValue("row-gap", getComputedStyle(el).rowGap, log),
      column: resolveGapValue("column-gap", getComputedStyle(el).columnGap, log)
    });
  });
  if (stateRestoreInProgress) {
    return null;
  }
  return import_react5.default.createElement(
    ListComponent,
    {
      ref: listRef,
      className: listClassName,
      ...contextPropIfNotDomElement(ListComponent, context),
      style: { paddingTop: gridState.offsetTop, paddingBottom: gridState.offsetBottom },
      "data-testid": "virtuoso-item-list"
    },
    gridState.items.map((item) => {
      const key = computeItemKey(item.index, item.data, context);
      return isSeeking ? import_react5.default.createElement(ScrollSeekPlaceholder, {
        key,
        ...contextPropIfNotDomElement(ScrollSeekPlaceholder, context),
        index: item.index,
        height: gridState.itemHeight,
        width: gridState.itemWidth
      }) : import_react5.default.createElement(
        ItemComponent,
        { ...contextPropIfNotDomElement(ItemComponent, context), className: itemClassName, "data-index": item.index, key },
        itemContent(item.index, item.data, context)
      );
    })
  );
});
var Header = import_react5.default.memo(function VirtuosoHeader2() {
  const Header2 = useEmitterValue$1("HeaderComponent");
  const headerHeight = usePublisher$1("headerHeight");
  const headerFooterTag = useEmitterValue$1("headerFooterTag");
  const ref = useSize((el) => headerHeight(correctItemSize(el, "height")));
  const context = useEmitterValue$1("context");
  return Header2 ? import_react5.default.createElement(headerFooterTag, { ref }, import_react5.default.createElement(Header2, contextPropIfNotDomElement(Header2, context))) : null;
});
var Footer = import_react5.default.memo(function VirtuosoGridFooter() {
  const Footer2 = useEmitterValue$1("FooterComponent");
  const footerHeight = usePublisher$1("footerHeight");
  const headerFooterTag = useEmitterValue$1("headerFooterTag");
  const ref = useSize((el) => footerHeight(correctItemSize(el, "height")));
  const context = useEmitterValue$1("context");
  return Footer2 ? import_react5.default.createElement(headerFooterTag, { ref }, import_react5.default.createElement(Footer2, contextPropIfNotDomElement(Footer2, context))) : null;
});
var Viewport$1 = ({ children }) => {
  const ctx = import_react5.default.useContext(VirtuosoGridMockContext);
  const itemDimensions = usePublisher$1("itemDimensions");
  const viewportDimensions = usePublisher$1("viewportDimensions");
  const viewportRef = useSize((el) => {
    viewportDimensions(el.getBoundingClientRect());
  });
  import_react5.default.useEffect(() => {
    if (ctx) {
      viewportDimensions({ height: ctx.viewportHeight, width: ctx.viewportWidth });
      itemDimensions({ height: ctx.itemHeight, width: ctx.itemWidth });
    }
  }, [ctx, viewportDimensions, itemDimensions]);
  return /* @__PURE__ */ import_react5.default.createElement("div", { style: viewportStyle(false), ref: viewportRef }, children);
};
var WindowViewport$1 = ({ children }) => {
  const ctx = import_react5.default.useContext(VirtuosoGridMockContext);
  const windowViewportRect = usePublisher$1("windowViewportRect");
  const itemDimensions = usePublisher$1("itemDimensions");
  const customScrollParent = useEmitterValue$1("customScrollParent");
  const viewportRef = useWindowViewportRectRef(windowViewportRect, customScrollParent);
  import_react5.default.useEffect(() => {
    if (ctx) {
      itemDimensions({ height: ctx.itemHeight, width: ctx.itemWidth });
      windowViewportRect({ offsetTop: 0, visibleHeight: ctx.viewportHeight, visibleWidth: ctx.viewportWidth });
    }
  }, [ctx, windowViewportRect, itemDimensions]);
  return /* @__PURE__ */ import_react5.default.createElement("div", { ref: viewportRef, style: viewportStyle(false) }, children);
};
var GridRoot = /* @__PURE__ */ import_react5.default.memo(function GridRoot2({ ...props }) {
  const useWindowScroll = useEmitterValue$1("useWindowScroll");
  const customScrollParent = useEmitterValue$1("customScrollParent");
  const TheScroller = customScrollParent || useWindowScroll ? WindowScroller$1 : Scroller$1;
  const TheViewport = customScrollParent || useWindowScroll ? WindowViewport$1 : Viewport$1;
  return /* @__PURE__ */ import_react5.default.createElement(TheScroller, { ...props }, /* @__PURE__ */ import_react5.default.createElement(TheViewport, null, /* @__PURE__ */ import_react5.default.createElement(Header, null), /* @__PURE__ */ import_react5.default.createElement(GridItems, null), /* @__PURE__ */ import_react5.default.createElement(Footer, null)));
});
var {
  Component: Grid,
  usePublisher: usePublisher$1,
  useEmitterValue: useEmitterValue$1,
  useEmitter: useEmitter$1
} = /* @__PURE__ */ systemToComponent(
  combinedSystem$1,
  {
    optional: {
      context: "context",
      totalCount: "totalCount",
      overscan: "overscan",
      itemContent: "itemContent",
      components: "components",
      computeItemKey: "computeItemKey",
      data: "data",
      initialItemCount: "initialItemCount",
      scrollSeekConfiguration: "scrollSeekConfiguration",
      headerFooterTag: "headerFooterTag",
      listClassName: "listClassName",
      itemClassName: "itemClassName",
      useWindowScroll: "useWindowScroll",
      customScrollParent: "customScrollParent",
      scrollerRef: "scrollerRef",
      logLevel: "logLevel",
      restoreStateFrom: "restoreStateFrom",
      initialTopMostItemIndex: "initialTopMostItemIndex"
    },
    methods: {
      scrollTo: "scrollTo",
      scrollBy: "scrollBy",
      scrollToIndex: "scrollToIndex"
    },
    events: {
      isScrolling: "isScrolling",
      endReached: "endReached",
      startReached: "startReached",
      rangeChanged: "rangeChanged",
      atBottomStateChange: "atBottomStateChange",
      atTopStateChange: "atTopStateChange",
      stateChanged: "stateChanged"
    }
  },
  GridRoot
);
var Scroller$1 = /* @__PURE__ */ buildScroller({ usePublisher: usePublisher$1, useEmitterValue: useEmitterValue$1, useEmitter: useEmitter$1 });
var WindowScroller$1 = /* @__PURE__ */ buildWindowScroller({ usePublisher: usePublisher$1, useEmitterValue: useEmitterValue$1, useEmitter: useEmitter$1 });
function resolveGapValue(property, value, log) {
  if (value !== "normal" && !(value == null ? void 0 : value.endsWith("px"))) {
    log(`${property} was not resolved to pixel value correctly`, value, LogLevel.WARN);
  }
  if (value === "normal") {
    return 0;
  }
  return parseInt(value != null ? value : "0", 10);
}
var tableComponentPropsSystem = /* @__PURE__ */ system(() => {
  const itemContent = statefulStream((index) => /* @__PURE__ */ import_react5.default.createElement("td", null, "Item $", index));
  const context = statefulStream(null);
  const fixedHeaderContent = statefulStream(null);
  const fixedFooterContent = statefulStream(null);
  const components = statefulStream({});
  const computeItemKey = statefulStream(identity);
  const scrollerRef = statefulStream(noop);
  const distinctProp = (propName, defaultValue = null) => {
    return statefulStreamFromEmitter(
      pipe(
        components,
        map((components2) => components2[propName]),
        distinctUntilChanged()
      ),
      defaultValue
    );
  };
  return {
    context,
    itemContent,
    fixedHeaderContent,
    fixedFooterContent,
    components,
    computeItemKey,
    scrollerRef,
    TableComponent: distinctProp("Table", "table"),
    TableHeadComponent: distinctProp("TableHead", "thead"),
    TableFooterComponent: distinctProp("TableFoot", "tfoot"),
    TableBodyComponent: distinctProp("TableBody", "tbody"),
    TableRowComponent: distinctProp("TableRow", "tr"),
    ScrollerComponent: distinctProp("Scroller", "div"),
    EmptyPlaceholder: distinctProp("EmptyPlaceholder"),
    ScrollSeekPlaceholder: distinctProp("ScrollSeekPlaceholder"),
    FillerRow: distinctProp("FillerRow")
  };
});
var combinedSystem = /* @__PURE__ */ system(([listSystem2, propsSystem]) => {
  return { ...listSystem2, ...propsSystem };
}, tup(listSystem, tableComponentPropsSystem));
var DefaultScrollSeekPlaceholder = ({ height }) => /* @__PURE__ */ import_react5.default.createElement("tr", null, /* @__PURE__ */ import_react5.default.createElement("td", { style: { height } }));
var DefaultFillerRow = ({ height }) => /* @__PURE__ */ import_react5.default.createElement("tr", null, /* @__PURE__ */ import_react5.default.createElement("td", { style: { height, padding: 0, border: 0 } }));
var ITEM_STYLE = { overflowAnchor: "none" };
var Items = /* @__PURE__ */ import_react5.default.memo(function VirtuosoItems2() {
  const listState = useEmitterValue("listState");
  const sizeRanges = usePublisher("sizeRanges");
  const useWindowScroll = useEmitterValue("useWindowScroll");
  const customScrollParent = useEmitterValue("customScrollParent");
  const windowScrollContainerStateCallback = usePublisher("windowScrollContainerState");
  const _scrollContainerStateCallback = usePublisher("scrollContainerState");
  const scrollContainerStateCallback = customScrollParent || useWindowScroll ? windowScrollContainerStateCallback : _scrollContainerStateCallback;
  const itemContent = useEmitterValue("itemContent");
  const trackItemSizes = useEmitterValue("trackItemSizes");
  const itemSize = useEmitterValue("itemSize");
  const log = useEmitterValue("log");
  const { callbackRef, ref } = useChangedListContentsSizes(
    sizeRanges,
    itemSize,
    trackItemSizes,
    scrollContainerStateCallback,
    log,
    void 0,
    customScrollParent
  );
  const [deviation, setDeviation] = import_react5.default.useState(0);
  useEmitter("deviation", (value) => {
    if (deviation !== value) {
      ref.current.style.marginTop = `${value}px`;
      setDeviation(value);
    }
  });
  const EmptyPlaceholder = useEmitterValue("EmptyPlaceholder");
  const ScrollSeekPlaceholder = useEmitterValue("ScrollSeekPlaceholder") || DefaultScrollSeekPlaceholder;
  const FillerRow = useEmitterValue("FillerRow") || DefaultFillerRow;
  const TableBodyComponent = useEmitterValue("TableBodyComponent");
  const TableRowComponent = useEmitterValue("TableRowComponent");
  const computeItemKey = useEmitterValue("computeItemKey");
  const isSeeking = useEmitterValue("isSeeking");
  const paddingTopAddition = useEmitterValue("paddingTopAddition");
  const firstItemIndex = useEmitterValue("firstItemIndex");
  const statefulTotalCount = useEmitterValue("statefulTotalCount");
  const context = useEmitterValue("context");
  if (statefulTotalCount === 0 && EmptyPlaceholder) {
    return import_react5.default.createElement(EmptyPlaceholder, contextPropIfNotDomElement(EmptyPlaceholder, context));
  }
  const paddingTop = listState.offsetTop + paddingTopAddition + deviation;
  const paddingBottom = listState.offsetBottom;
  const paddingTopEl = paddingTop > 0 ? /* @__PURE__ */ import_react5.default.createElement(FillerRow, { height: paddingTop, key: "padding-top", context }) : null;
  const paddingBottomEl = paddingBottom > 0 ? /* @__PURE__ */ import_react5.default.createElement(FillerRow, { height: paddingBottom, key: "padding-bottom", context }) : null;
  const items = listState.items.map((item) => {
    const index = item.originalIndex;
    const key = computeItemKey(index + firstItemIndex, item.data, context);
    if (isSeeking) {
      return import_react5.default.createElement(ScrollSeekPlaceholder, {
        ...contextPropIfNotDomElement(ScrollSeekPlaceholder, context),
        key,
        index: item.index,
        height: item.size,
        type: item.type || "item"
      });
    }
    return import_react5.default.createElement(
      TableRowComponent,
      {
        ...contextPropIfNotDomElement(TableRowComponent, context),
        ...itemPropIfNotDomElement(TableRowComponent, item.data),
        key,
        "data-index": index,
        "data-known-size": item.size,
        "data-item-index": item.index,
        style: ITEM_STYLE
      },
      itemContent(item.index, item.data, context)
    );
  });
  return import_react5.default.createElement(
    TableBodyComponent,
    { ref: callbackRef, "data-testid": "virtuoso-item-list", ...contextPropIfNotDomElement(TableBodyComponent, context) },
    [paddingTopEl, ...items, paddingBottomEl]
  );
});
var Viewport = ({ children }) => {
  const ctx = import_react5.default.useContext(VirtuosoMockContext);
  const viewportHeight = usePublisher("viewportHeight");
  const fixedItemHeight = usePublisher("fixedItemHeight");
  const viewportRef = useSize(compose2(viewportHeight, (el) => correctItemSize(el, "height")));
  import_react5.default.useEffect(() => {
    if (ctx) {
      viewportHeight(ctx.viewportHeight);
      fixedItemHeight(ctx.itemHeight);
    }
  }, [ctx, viewportHeight, fixedItemHeight]);
  return /* @__PURE__ */ import_react5.default.createElement("div", { style: viewportStyle(false), ref: viewportRef, "data-viewport-type": "element" }, children);
};
var WindowViewport = ({ children }) => {
  const ctx = import_react5.default.useContext(VirtuosoMockContext);
  const windowViewportRect = usePublisher("windowViewportRect");
  const fixedItemHeight = usePublisher("fixedItemHeight");
  const customScrollParent = useEmitterValue("customScrollParent");
  const viewportRef = useWindowViewportRectRef(windowViewportRect, customScrollParent);
  import_react5.default.useEffect(() => {
    if (ctx) {
      fixedItemHeight(ctx.itemHeight);
      windowViewportRect({ offsetTop: 0, visibleHeight: ctx.viewportHeight, visibleWidth: 100 });
    }
  }, [ctx, windowViewportRect, fixedItemHeight]);
  return /* @__PURE__ */ import_react5.default.createElement("div", { ref: viewportRef, style: viewportStyle(false), "data-viewport-type": "window" }, children);
};
var TableRoot = /* @__PURE__ */ import_react5.default.memo(function TableVirtuosoRoot(props) {
  const useWindowScroll = useEmitterValue("useWindowScroll");
  const customScrollParent = useEmitterValue("customScrollParent");
  const fixedHeaderHeight = usePublisher("fixedHeaderHeight");
  const fixedFooterHeight = usePublisher("fixedFooterHeight");
  const fixedHeaderContent = useEmitterValue("fixedHeaderContent");
  const fixedFooterContent = useEmitterValue("fixedFooterContent");
  const context = useEmitterValue("context");
  const theadRef = useSize(compose2(fixedHeaderHeight, (el) => correctItemSize(el, "height")));
  const tfootRef = useSize(compose2(fixedFooterHeight, (el) => correctItemSize(el, "height")));
  const TheScroller = customScrollParent || useWindowScroll ? WindowScroller : Scroller;
  const TheViewport = customScrollParent || useWindowScroll ? WindowViewport : Viewport;
  const TheTable = useEmitterValue("TableComponent");
  const TheTHead = useEmitterValue("TableHeadComponent");
  const TheTFoot = useEmitterValue("TableFooterComponent");
  const theHead = fixedHeaderContent ? import_react5.default.createElement(
    TheTHead,
    {
      key: "TableHead",
      style: { zIndex: 2, position: "sticky", top: 0 },
      ref: theadRef,
      ...contextPropIfNotDomElement(TheTHead, context)
    },
    fixedHeaderContent()
  ) : null;
  const theFoot = fixedFooterContent ? import_react5.default.createElement(
    TheTFoot,
    {
      key: "TableFoot",
      style: { zIndex: 1, position: "sticky", bottom: 0 },
      ref: tfootRef,
      ...contextPropIfNotDomElement(TheTFoot, context)
    },
    fixedFooterContent()
  ) : null;
  return /* @__PURE__ */ import_react5.default.createElement(TheScroller, { ...props }, /* @__PURE__ */ import_react5.default.createElement(TheViewport, null, import_react5.default.createElement(
    TheTable,
    { style: { borderSpacing: 0, overflowAnchor: "none" }, ...contextPropIfNotDomElement(TheTable, context) },
    [theHead, /* @__PURE__ */ import_react5.default.createElement(Items, { key: "TableBody" }), theFoot]
  )));
});
var {
  Component: Table,
  usePublisher,
  useEmitterValue,
  useEmitter
} = /* @__PURE__ */ systemToComponent(
  combinedSystem,
  {
    required: {},
    optional: {
      restoreStateFrom: "restoreStateFrom",
      context: "context",
      followOutput: "followOutput",
      firstItemIndex: "firstItemIndex",
      itemContent: "itemContent",
      fixedHeaderContent: "fixedHeaderContent",
      fixedFooterContent: "fixedFooterContent",
      overscan: "overscan",
      increaseViewportBy: "increaseViewportBy",
      totalCount: "totalCount",
      topItemCount: "topItemCount",
      initialTopMostItemIndex: "initialTopMostItemIndex",
      components: "components",
      groupCounts: "groupCounts",
      atBottomThreshold: "atBottomThreshold",
      atTopThreshold: "atTopThreshold",
      computeItemKey: "computeItemKey",
      defaultItemHeight: "defaultItemHeight",
      fixedItemHeight: "fixedItemHeight",
      itemSize: "itemSize",
      scrollSeekConfiguration: "scrollSeekConfiguration",
      data: "data",
      initialItemCount: "initialItemCount",
      initialScrollTop: "initialScrollTop",
      alignToBottom: "alignToBottom",
      useWindowScroll: "useWindowScroll",
      customScrollParent: "customScrollParent",
      scrollerRef: "scrollerRef",
      logLevel: "logLevel"
    },
    methods: {
      scrollToIndex: "scrollToIndex",
      scrollIntoView: "scrollIntoView",
      scrollTo: "scrollTo",
      scrollBy: "scrollBy",
      getState: "getState"
    },
    events: {
      isScrolling: "isScrolling",
      endReached: "endReached",
      startReached: "startReached",
      rangeChanged: "rangeChanged",
      atBottomStateChange: "atBottomStateChange",
      atTopStateChange: "atTopStateChange",
      totalListHeightChanged: "totalListHeightChanged",
      itemsRendered: "itemsRendered",
      groupIndices: "groupIndices"
    }
  },
  TableRoot
);
var Scroller = /* @__PURE__ */ buildScroller({ usePublisher, useEmitterValue, useEmitter });
var WindowScroller = /* @__PURE__ */ buildWindowScroller({ usePublisher, useEmitterValue, useEmitter });
var TableVirtuoso = Table;

// src/react/loom-app/table/index.tsx
var import_lodash8 = __toESM(require_lodash());

// src/shared/spacing/hooks.ts
var useOverflow = (shouldWrap, options) => {
  const { ellipsis = false } = options != null ? options : {};
  if (shouldWrap)
    return "dataloom-overflow--wrap";
  if (ellipsis)
    return "dataloom-overflow--ellipsis";
  return "dataloom-overflow--hide";
};

// src/react/shared/text/index.tsx
var import_jsx_runtime3 = __toESM(require_jsx_runtime());
function Text({
  value,
  variant,
  size = "sm",
  maxWidth,
  whiteSpace,
  shouldWrap = false
}) {
  const overflowClassName = useOverflow(
    shouldWrap || maxWidth !== void 0,
    {
      ellipsis: true
    }
  );
  let className = "dataloom-text";
  if (variant === "faint")
    className += " dataloom-text--faint";
  else if (variant === "muted")
    className += " dataloom-text--muted";
  else if (variant === "semibold")
    className += " dataloom-text--semibold";
  else if (variant === "on-accent")
    className += " dataloom-text--on-accent";
  else if (variant === "error")
    className += " dataloom-text--error";
  className += " " + overflowClassName;
  let fontSize = "";
  if (size === "xs") {
    fontSize = "var(--dataloom-font-size--xs)";
  } else if (size === "sm") {
    fontSize = "var(--dataloom-font-size--sm)";
  } else if (size === "md") {
    fontSize = "var(--dataloom-font-size--md)";
  } else if (size === "lg") {
    fontSize = "var(--dataloom-font-size--lg)";
  } else if (size === "xl") {
    fontSize = "var(--dataloom-font-size--xl)";
  }
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
    "p",
    {
      className,
      style: {
        fontSize,
        whiteSpace,
        maxWidth
      },
      children: value
    }
  );
}

// src/react/shared/menu/index.tsx
var import_react12 = __toESM(require_react());

// src/react/shared/base-menu/index.tsx
var import_react9 = __toESM(require_react());
var import_react_dom3 = __toESM(require_react_dom());

// src/react/shared/menu-provider/hooks.ts
var import_react8 = __toESM(require_react());

// src/react/shared/menu-provider/index.tsx
var import_react6 = __toESM(require_react());

// src/react/shared/menu-provider/factory.ts
var createMenu = (parentComponentId, level, position, options) => {
  const {
    shouldRequestOnClose = false,
    shouldFocusTriggerOnClose = true,
    name
  } = options != null ? options : {};
  return {
    id: "m" + generateUuid(),
    parentComponentId,
    ...name && { name },
    position,
    level,
    shouldRequestOnClose,
    shouldFocusTriggerOnClose
  };
};
var createCloseRequest = (menuId, type) => {
  return {
    menuId,
    type
  };
};

// src/react/shared/menu-provider/utils.ts
var getPositionFromEl = (el) => {
  const { top, left, width, height } = el.getBoundingClientRect();
  return { top, left, width, height };
};
var findMenuTriggerEl = (menuId) => {
  return document.querySelector(
    `[data-menu-id="${menuId}"]`
  );
};

// src/react/shared/menu-provider/index.tsx
var import_js_logger5 = __toESM(require_logger());
var import_jsx_runtime4 = __toESM(require_jsx_runtime());
var MenuContext = import_react6.default.createContext(null);
var useMenuContext = () => {
  const value = import_react6.default.useContext(MenuContext);
  if (value === null) {
    throw new Error(
      "useMenuContext() called without a <MenuProvider /> in the tree."
    );
  }
  return value;
};
var CLASS_NAME2 = "MenuProvider";
function MenuProvider({ children }) {
  const [openMenus, setOpenMenus] = import_react6.default.useState([]);
  const [closeRequests, setCloseRequests] = import_react6.default.useState([]);
  const [focusedMenuTrigger, setFocusedMenuTrigger] = import_react6.default.useState(null);
  const clearMenuTriggerFocus = import_react6.default.useCallback(() => {
    import_js_logger5.default.trace(CLASS_NAME2, "clearMenuTriggerFocus", "called");
    setFocusedMenuTrigger(null);
  }, []);
  import_react6.default.useEffect(() => {
    EventManager.getInstance().on(
      "clear-menu-trigger-focus",
      clearMenuTriggerFocus
    );
    return () => EventManager.getInstance().off(
      "clear-menu-trigger-focus",
      clearMenuTriggerFocus
    );
  }, [clearMenuTriggerFocus]);
  function handleOpen(parentComponentId, level, triggerRef, options) {
    import_js_logger5.default.trace(CLASS_NAME2, "handleOpenMenu", "called");
    const { name, shouldRequestOnClose, shouldFocusTriggerOnClose } = options != null ? options : {};
    if (!triggerRef.current) {
      import_js_logger5.default.debug(
        CLASS_NAME2,
        "handleOpenMenu",
        "No trigger ref. Cannot open menu"
      );
      return;
    }
    if (!canOpen(level)) {
      import_js_logger5.default.debug(
        CLASS_NAME2,
        "handleOpenMenu",
        "Level is too low. Cannot open menu"
      );
      return;
    }
    import_js_logger5.default.trace(
      CLASS_NAME2,
      "handleOpenMenu",
      "MenuProvider opening menu",
      { level }
    );
    const position = getPositionFromEl(triggerRef.current);
    const menu = createMenu(parentComponentId, level, position, {
      name,
      shouldFocusTriggerOnClose,
      shouldRequestOnClose
    });
    clearMenuTriggerFocus();
    setOpenMenus((prevMenus) => [...prevMenus, menu]);
  }
  const focusMenuTrigger = import_react6.default.useCallback(
    (parentComponentId, name) => {
      import_js_logger5.default.trace(CLASS_NAME2, "focusMenuTrigger", "called", {
        parentComponentId,
        name
      });
      setFocusedMenuTrigger({
        parentComponentId,
        name
      });
    },
    []
  );
  const handleClose = import_react6.default.useCallback(
    (id2) => {
      import_js_logger5.default.trace(CLASS_NAME2, "handleClose", "called", { id: id2 });
      const menu = openMenus.find((menu2) => menu2.id === id2);
      if (!menu)
        throw new Error("Menu not found");
      if (menu.shouldFocusTriggerOnClose) {
        focusMenuTrigger(menu.parentComponentId, menu.name);
      }
      setOpenMenus(
        (prevMenus) => prevMenus.filter((menu2) => menu2.id !== id2)
      );
      setCloseRequests(
        (prevRequests) => prevRequests.filter((request) => request.menuId !== id2)
      );
    },
    [openMenus, focusMenuTrigger]
  );
  const handleRequestClose = import_react6.default.useCallback(
    (id2, type) => {
      import_js_logger5.default.trace(CLASS_NAME2, "onRequestClose", "called", { id: id2, type });
      const menu = openMenus.find((menu2) => menu2.id === id2);
      if (!menu)
        return;
      const { shouldRequestOnClose } = menu;
      if (shouldRequestOnClose) {
        const request = createCloseRequest(menu.id, type);
        setCloseRequests((prevRequests) => [...prevRequests, request]);
      } else {
        handleClose(id2);
      }
    },
    [setCloseRequests, handleClose, openMenus]
  );
  const handlePositionUpdate = import_react6.default.useCallback(
    (id2, position) => {
      import_js_logger5.default.trace(CLASS_NAME2, "onPositionUpdate", "called", {
        id: id2,
        position
      });
      setOpenMenus((prevMenus) => {
        return prevMenus.map((menu) => {
          if (menu.id === id2) {
            return { ...menu, position };
          }
          return menu;
        });
      });
    },
    [setOpenMenus]
  );
  function getMenu(parentComponentId, name) {
    var _a2, _b, _c;
    const menu = openMenus.find((m2) => {
      if (m2.parentComponentId === parentComponentId) {
        if (name !== void 0) {
          return m2.name === name;
        }
        return true;
      }
      return false;
    });
    let closeRequest = null;
    if (menu) {
      closeRequest = (_a2 = closeRequests.find((request) => request.menuId === menu.id)) != null ? _a2 : null;
    }
    return {
      id: (_b = menu == null ? void 0 : menu.id) != null ? _b : "",
      isOpen: menu !== void 0,
      closeRequest,
      isTriggerFocused: (focusedMenuTrigger == null ? void 0 : focusedMenuTrigger.parentComponentId) === parentComponentId && (focusedMenuTrigger == null ? void 0 : focusedMenuTrigger.name) === name,
      position: (_c = menu == null ? void 0 : menu.position) != null ? _c : {
        top: 0,
        left: 0,
        width: 0,
        height: 0
      }
    };
  }
  const handleCloseAll = import_react6.default.useCallback(() => {
    import_js_logger5.default.trace(CLASS_NAME2, "handleCloseAll", "called");
    setOpenMenus(
      (prevState) => prevState.filter((menu) => menu.shouldRequestOnClose)
    );
    setCloseRequests(() => {
      return openMenus.map(
        (menu) => createCloseRequest(menu.id, "save-and-close")
      );
    });
  }, [openMenus, setOpenMenus]);
  const getTopMenu = import_react6.default.useCallback(() => {
    var _a2;
    return (_a2 = openMenus[openMenus.length - 1]) != null ? _a2 : null;
  }, [openMenus]);
  const canOpen = import_react6.default.useCallback(
    (level) => {
      const topMenu = getTopMenu();
      if (topMenu === null)
        return true;
      if (level > topMenu.level)
        return true;
      return false;
    },
    [getTopMenu]
  );
  function handleCloseRequestClear(id2) {
    import_js_logger5.default.trace(CLASS_NAME2, "handleCloseRequestClear", "called", { id: id2 });
    setCloseRequests(
      (prevRequests) => prevRequests.filter((request) => request.menuId !== id2)
    );
  }
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
    MenuContext.Provider,
    {
      value: {
        topMenu: getTopMenu(),
        canOpen,
        getMenu,
        onOpen: handleOpen,
        onClose: handleClose,
        onRequestClose: handleRequestClose,
        onPositionUpdate: handlePositionUpdate,
        onCloseAll: handleCloseAll,
        onCloseRequestClear: handleCloseRequestClear,
        onClearMenuTriggerFocus: clearMenuTriggerFocus
      },
      children
    }
  );
}

// src/react/shared/menu/hooks.ts
var import_react7 = __toESM(require_react());
var import_lodash6 = __toESM(require_lodash());

// src/shared/dom-utils.ts
var findAncestorsUntilClassName = (currentEl, className) => {
  const ancestors = [];
  let el = currentEl;
  while (el && !el.classList.contains(className)) {
    ancestors.push(el);
    el = el.parentElement;
  }
  return ancestors;
};

// src/react/shared/menu/hooks.ts
var useMenuPosition = (isOpen, isParentObsidianModal, onPositionUpdate) => {
  const className = isParentObsidianModal ? "modal" : "view-content";
  const ref = useBasePosition(className, isOpen, onPositionUpdate);
  return ref;
};
var useBasePosition = (className, isOpen, onPositionUpdate) => {
  const ref = import_react7.default.useRef(null);
  import_react7.default.useEffect(() => {
    if (!ref.current)
      return;
    const positionEl = ref.current;
    const THROTTLE_TIME_MILLIS = 50;
    const throttleUpdatePosition = import_lodash6.default.throttle(
      updatePosition,
      THROTTLE_TIME_MILLIS
    );
    function updatePosition() {
      const position = getPositionFromEl(positionEl);
      onPositionUpdate(position);
    }
    const ancestors = findAncestorsUntilClassName(positionEl, className);
    if (isOpen) {
      ancestors.forEach((ancestor) => {
        ancestor.addEventListener("scroll", throttleUpdatePosition);
        ancestor.addEventListener("resize", throttleUpdatePosition);
      });
      window.addEventListener("resize", throttleUpdatePosition);
      updatePosition();
    }
    return () => {
      ancestors.forEach((ancestor) => {
        ancestor.removeEventListener("scroll", throttleUpdatePosition);
        ancestor.removeEventListener("resize", throttleUpdatePosition);
      });
      window.removeEventListener("resize", throttleUpdatePosition);
    };
  }, [className, isOpen, onPositionUpdate]);
  return ref;
};

// src/react/shared/menu-provider/hooks.ts
var useMenu = (parentComponentId, options) => {
  const { name, isParentObsidianModal = false } = options || {};
  const { onOpen, getMenu, onClose, onCloseRequestClear, onPositionUpdate } = useMenuContext();
  const { id: id2, isOpen, position, isTriggerFocused, closeRequest } = getMenu(
    parentComponentId,
    name
  );
  const handlePositionUpdate = import_react8.default.useCallback(
    (newPosition) => {
      onPositionUpdate(id2, newPosition);
    },
    [id2, onPositionUpdate]
  );
  const triggerRef = useMenuPosition(
    isOpen,
    isParentObsidianModal,
    handlePositionUpdate
  );
  import_react8.default.useEffect(
    function focusMenuTrigger() {
      var _a2;
      if (!triggerRef.current)
        return;
      if (!isTriggerFocused)
        return;
      (_a2 = triggerRef.current) == null ? void 0 : _a2.focus();
    },
    [isTriggerFocused, triggerRef]
  );
  function handleOpen(level, options2) {
    const { shouldRequestOnClose, shouldFocusTriggerOnClose } = options2 || {};
    onOpen(parentComponentId, level, triggerRef, {
      name,
      shouldRequestOnClose,
      shouldFocusTriggerOnClose
    });
  }
  const handleClose = import_react8.default.useCallback(() => {
    if (!isOpen)
      return;
    onClose(id2);
  }, [id2, isOpen, onClose]);
  const handleCloseRequestClear = import_react8.default.useCallback(() => {
    onCloseRequestClear(id2);
  }, [id2, onCloseRequestClear]);
  return {
    id: id2,
    isOpen,
    closeRequest,
    position,
    triggerRef,
    isTriggerFocused,
    onOpen: handleOpen,
    onClose: handleClose,
    onCloseRequestClear: handleCloseRequestClear
  };
};
var useMenuOperations = () => {
  const {
    topMenu,
    canOpen,
    onCloseAll,
    onRequestClose,
    onClose,
    onClearMenuTriggerFocus
  } = useMenuContext();
  return {
    topMenu,
    canOpen,
    onCloseAll,
    onClose,
    onRequestClose,
    onClearMenuTriggerFocus
  };
};

// src/react/shared/base-menu/index.tsx
var import_js_logger6 = __toESM(require_logger());
var import_jsx_runtime5 = __toESM(require_jsx_runtime());
var BaseMenu = import_react9.default.forwardRef(
  ({
    id: id2,
    isOpen,
    hideBorder = false,
    position,
    width = 0,
    height = 0,
    minWidth = 0,
    maxHeight = 0,
    maxWidth = 0,
    children
  }, ref) => {
    const { topMenu, onRequestClose, onClose } = useMenuOperations();
    function handleClick(e) {
      import_js_logger6.default.trace("Menu handleClick");
      e.stopPropagation();
      if (!topMenu)
        return;
      if (topMenu.id === id2)
        return;
      onRequestClose(topMenu.id, "close-on-save");
    }
    function handleKeyDown(e) {
      import_js_logger6.default.trace("Menu handleKeyDown");
      if (topMenu === null)
        return;
      if (e.key === "Enter") {
        e.stopPropagation();
        onRequestClose(topMenu.id, "close-on-save");
      } else if (e.key === "Escape") {
        e.stopPropagation();
        onClose(topMenu.id);
      }
    }
    if (!isOpen)
      return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, {});
    return import_react_dom3.default.createPortal(
      /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
        "div",
        {
          id: id2,
          className: "dataloom-menu",
          ref,
          style: {
            top: numToPx(position.top),
            left: numToPx(position.left),
            width: width !== 0 ? numToPx(width) : "max-content",
            height: height !== 0 ? numToPx(height) : "max-content",
            minWidth: minWidth !== 0 ? numToPx(minWidth) : void 0,
            maxWidth: maxWidth !== 0 ? numToPx(maxWidth) : void 0,
            maxHeight: maxHeight !== 0 ? numToPx(maxHeight) : void 0,
            overflowY: maxHeight !== 0 ? "scroll" : void 0,
            boxShadow: hideBorder ? void 0 : "0px 0px 0px 2px var(--background-modifier-border)"
          },
          onClick: handleClick,
          onKeyDown: handleKeyDown,
          children
        }
      ),
      document.body
    );
  }
);
var base_menu_default = BaseMenu;

// src/react/shared/base-menu/utils.ts
var import_react11 = __toESM(require_react());

// src/shared/render-utils.ts
var import_react10 = __toESM(require_react());

// src/shared/render/utils.ts
var replaceNewLinesWithBr = (content) => {
  const lines = content.split("\n");
  let updated = "";
  lines.forEach((line) => {
    if (line === "") {
      updated += "<br>";
    } else {
      updated += line + "\n";
    }
  });
  return updated;
};
var appendOrReplaceFirstChild = (container, child) => {
  if (container === null)
    return;
  if (child === null)
    return;
  if (container && !container.firstChild) {
    container.appendChild(child);
  } else if (container.firstChild && container.firstChild !== child) {
    container.replaceChild(child, container.firstChild);
  }
};
var getDynamicSize = (defaultValue, value) => {
  if (value === void 0)
    return defaultValue;
  if (typeof value === "string")
    return value;
  const { base, mobile } = value;
  if (isSmallScreenSize()) {
    return mobile != null ? mobile : base;
  } else {
    return base;
  }
};
var isSmallScreenSize = () => {
  return window.innerWidth <= 480;
};
var hasDarkTheme = () => {
  var _a2;
  const el = document.querySelector("body");
  return (_a2 = el == null ? void 0 : el.className.includes("theme-dark")) != null ? _a2 : false;
};

// src/shared/render-utils.ts
var import_obsidian8 = require("obsidian");

// src/obsidian/dataloom-view.tsx
var import_obsidian6 = require("obsidian");
var import_client = __toESM(require_client());

// src/obsidian/utils.ts
var createAppId = () => {
  return "a" + generateUuid();
};

// src/shared/spacing/index.ts
var getSpacing = (size) => {
  let spacing = "";
  if (size === "sm") {
    spacing = "var(--dataloom-spacing--sm)";
  } else if (size === "md") {
    spacing = "var(--dataloom-spacing--md)";
  } else if (size === "lg") {
    spacing = "var(--dataloom-spacing--lg)";
  } else if (size === "xl") {
    spacing = "var(--dataloom-spacing--xl)";
  } else if (size === "2xl") {
    spacing = "var(--dataloom-spacing--2xl)";
  } else if (size === "3xl") {
    spacing = "var(--dataloom-spacing--3xl)";
  } else if (size === "4xl") {
    spacing = "var(--dataloom-spacing--4xl)";
  }
  return spacing;
};

// src/react/shared/stack/index.tsx
var import_jsx_runtime6 = __toESM(require_jsx_runtime());
function Stack({
  className: customClassName,
  spacing = "md",
  justify,
  align,
  grow,
  overflow,
  children,
  width,
  height,
  minHeight,
  isHorizontal = false,
  onClick
}) {
  let justifyContent = justify;
  if (justifyContent === void 0) {
    if (!isHorizontal)
      justifyContent = "center";
    else
      justifyContent = "flex-start";
  }
  let alignItems = align;
  if (alignItems === void 0) {
    if (isHorizontal)
      alignItems = "center";
    else
      alignItems = "flex-start";
  }
  let className = "dataloom-stack";
  if (customClassName)
    className += " " + customClassName;
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
    "div",
    {
      className,
      style: {
        flexDirection: isHorizontal ? "row" : "column",
        flexGrow: grow ? 1 : 0,
        justifyContent,
        alignItems,
        [isHorizontal ? "columnGap" : "rowGap"]: getSpacing(spacing),
        width,
        height,
        minHeight,
        overflow
      },
      onClick: (e) => onClick == null ? void 0 : onClick(e),
      children
    }
  );
}

// src/react/shared/divider/index.tsx
var import_jsx_runtime7 = __toESM(require_jsx_runtime());
function Divider({
  isVertical = false,
  width = "100%",
  height = "100%"
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
    "hr",
    {
      className: "dataloom-hr",
      style: {
        width: !isVertical ? width : void 0,
        height: isVertical === true ? height : void 0,
        borderTop: isVertical === false ? "1px solid var(--hr-color)" : void 0,
        borderLeft: isVertical === true ? "1px var(--hr-color) solid" : void 0
      }
    }
  );
}

// src/react/shared/error-display/index.tsx
var import_obsidian4 = require("obsidian");

// src/react/shared/padding/index.tsx
var import_jsx_runtime8 = __toESM(require_jsx_runtime());
function Padding({
  width = "100%",
  px,
  py,
  pt,
  pb,
  pl,
  pr,
  p: p2,
  children
}) {
  let renderPt = "";
  let renderPb = "";
  let renderPl = "";
  let renderPr = "";
  if (p2) {
    renderPt = getSpacing(p2);
    renderPb = getSpacing(p2);
    renderPl = getSpacing(p2);
    renderPr = getSpacing(p2);
  }
  if (px) {
    const spacing = getSpacing(px);
    renderPl = spacing;
    renderPr = spacing;
  } else if (pl || pr) {
    if (pl) {
      const spacing = getSpacing(pl);
      renderPl = spacing;
    }
    if (pr) {
      const spacing = getSpacing(pr);
      renderPr = spacing;
    }
  }
  if (py) {
    const spacing = getSpacing(py);
    renderPt = spacing;
    renderPb = spacing;
  } else if (pt || pb) {
    if (pt) {
      const spacing = getSpacing(pt);
      renderPt = spacing;
    }
    if (pb) {
      const spacing = getSpacing(pb);
      renderPb = spacing;
    }
  }
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
    "div",
    {
      className: "dataloom-padding",
      style: {
        width,
        paddingTop: renderPt,
        paddingBottom: renderPb,
        paddingLeft: renderPl,
        paddingRight: renderPr
      },
      children
    }
  );
}

// src/react/shared/error-display/index.tsx
var import_jsx_runtime9 = __toESM(require_jsx_runtime());
function ErrorDisplay({
  title,
  copyErrorMessage,
  errorMessage,
  isEmbeddedApp,
  infoSection,
  helpMessage,
  helpURL
}) {
  function handleCopyClick() {
    navigator.clipboard.writeText(copyErrorMessage);
    new import_obsidian4.Notice("Copied error to clipboard");
  }
  let className = "dataloom-error";
  if (isEmbeddedApp)
    className += " dataloom-error--embedded-app";
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Padding, { p: "2xl", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Stack, { spacing: "xl", children: [
    /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Stack, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { variant: "semibold", size: "xl", value: "Opps" }),
      /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { variant: "semibold", size: "md", value: title })
    ] }),
    /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Divider, {}),
    /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Stack, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
        Text,
        {
          variant: "semibold",
          size: "md",
          value: "Error message"
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "dataloom-error__message", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { value: errorMessage, whiteSpace: "pre-wrap" }) })
    ] }),
    /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Divider, {}),
    infoSection,
    /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Stack, { spacing: "sm", children: [
      /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { value: helpMessage }),
      /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("a", { href: helpURL, children: helpURL })
    ] }),
    /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Stack, { isHorizontal: true, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
      "button",
      {
        className: "dataloom-copy-button",
        onClick: () => handleCopyClick(),
        children: "Copy to clipboard"
      }
    ) })
  ] }) }) });
}

// src/react/error-app/index.tsx
var import_jsx_runtime10 = __toESM(require_jsx_runtime());
function ErrorApp({ error, isEmbeddedApp = false }) {
  const { fileVersion, pluginVersion, failedMigration, message } = error;
  const copyErrorMessage = `Plugin version: ${pluginVersion}
File version: ${fileVersion}
Failed migration: ${failedMigration}
Error message: ${message}`;
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
    ErrorDisplay,
    {
      title: "DataLoom cannot render file",
      errorMessage: message,
      copyErrorMessage,
      isEmbeddedApp,
      helpMessage: "For help fixing this error please visit:",
      helpURL: "https://dataloom.xyz/other/loom-file",
      infoSection: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
        /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Stack, { isHorizontal: true, spacing: "xl", children: [
          /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Stack, { children: [
            /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { variant: "semibold", value: "Plugin version" }),
            /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { value: pluginVersion })
          ] }),
          /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Divider, { isVertical: true, height: "60px" }),
          /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Stack, { children: [
            /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { variant: "semibold", value: "File version" }),
            /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { value: fileVersion })
          ] }),
          /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Divider, { isVertical: true, height: "60px" }),
          /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Stack, { children: [
            /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { variant: "semibold", value: "Failed migration" }),
            /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { value: failedMigration != null ? failedMigration : "None" })
          ] })
        ] }),
        /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Divider, {})
      ] })
    }
  );
}

// src/data/serialize-frontmatter.ts
var import_obsidian5 = require("obsidian");

// src/data/date-utils.ts
var dateTimeToObsidianDateTime = (value, includeTime) => {
  const date = new Date(value);
  const year = date.getFullYear();
  const month = padToTwoDigits(date.getMonth() + 1);
  const day = padToTwoDigits(date.getDate());
  const hours = padToTwoDigits(date.getHours());
  const minutes = padToTwoDigits(date.getMinutes());
  const seconds = padToTwoDigits(date.getSeconds());
  const dateString = `${year}-${month}-${day}`;
  if (!includeTime) {
    return dateString;
  }
  return `${dateString}T${hours}:${minutes}:${seconds}`;
};

// src/shared/frontmatter/obsidian-utils.ts
var updateObsidianPropertyType = (app, name, type) => {
  return app.metadataTypeManager.setType(name, type);
};
var getAllObsidianProperties = (app) => {
  return app.metadataTypeManager.getAllProperties();
};
var getAssignedPropertyType = (app, name) => {
  return app.metadataTypeManager.getAssignedType(name);
};

// src/data/serialize-frontmatter.ts
var serializeFrontmatter = async (app, state) => {
  const { rows, columns, sources } = state.model;
  if (sources.length === 0)
    return;
  const sourceFileColumn = columns.find(
    (column) => column.type === "source-file" /* SOURCE_FILE */
  );
  if (!sourceFileColumn)
    throw new Error("Source file column not found");
  for (const row of rows) {
    const { sourceId, cells } = row;
    if (sourceId === null)
      continue;
    const sourceFileCell = cells.find(
      (cell) => cell.columnId === sourceFileColumn.id
    );
    if (!sourceFileCell)
      throw new Error("Source file cell not found");
    const file = app.vault.getAbstractFileByPath(sourceFileCell.path);
    if (!file)
      throw new Error("Source file not found");
    if (!(file instanceof import_obsidian5.TFile))
      throw new Error("Expected TFile");
    for (const column of columns) {
      const {
        type,
        frontmatterKey,
        tags: columnTags,
        includeTime
      } = column;
      if (type === "source" /* SOURCE */)
        continue;
      if (type === "source-file" /* SOURCE_FILE */)
        continue;
      if (!frontmatterKey)
        continue;
      const cell = cells.find((cell2) => cell2.columnId === column.id);
      if (!cell)
        throw new CellNotFoundError({
          columnId: column.id,
          rowId: row.id
        });
      const { hasValidFrontmatter } = cell;
      if (hasValidFrontmatter === false)
        continue;
      let saveValue = null;
      if (type === "text" /* TEXT */) {
        const { content } = cell;
        saveValue = content;
      } else if (type === "embed" /* EMBED */) {
        const { pathOrUrl } = cell;
        saveValue = pathOrUrl;
      } else if (type === "file" /* FILE */) {
        const { path } = cell;
        saveValue = path;
      } else if (type === "number" /* NUMBER */) {
        const { value } = cell;
        saveValue = value;
      } else if (type === "checkbox" /* CHECKBOX */) {
        const { value } = cell;
        saveValue = value;
      } else if (type === "tag" /* TAG */) {
        const { tagId } = cell;
        if (tagId) {
          const tag = columnTags.find((tag2) => tag2.id === tagId);
          if (!tag)
            throw new TagNotFoundError(tagId);
          saveValue = tag.content;
        }
      } else if (type === "multi-tag" /* MULTI_TAG */) {
        const { tagIds } = cell;
        const cellTags = columnTags.filter(
          (tag) => tagIds.includes(tag.id)
        );
        const cellTagContent = cellTags.map((tag) => tag.content);
        saveValue = cellTagContent;
      } else if (type === "date" /* DATE */) {
        const { dateTime } = cell;
        if (dateTime) {
          saveValue = dateTimeToObsidianDateTime(
            dateTime,
            includeTime
          );
        }
      }
      await app.fileManager.processFrontMatter(file, (frontmatter) => {
        if (!frontmatter[frontmatterKey]) {
          if (!saveValue)
            return;
        }
        frontmatter[frontmatterKey] = saveValue;
      });
      if (type === "date" /* DATE */) {
        await updateObsidianPropertyType(
          app,
          frontmatterKey,
          includeTime ? "datetime" /* DATETIME */ : "date" /* DATE */
        );
      }
    }
  }
};

// src/shared/last-saved-manager.ts
var LastSavedManager = class _LastSavedManager {
  constructor() {
    this.lastSavedFile = "";
    this.lastSavedTime = 0;
  }
  // Ensures only one instance is created
  static getInstance() {
    if (!_LastSavedManager.instance) {
      _LastSavedManager.instance = new _LastSavedManager();
    }
    return _LastSavedManager.instance;
  }
  setLastSavedFile(fileName) {
    this.lastSavedFile = fileName;
    this.lastSavedTime = Date.now();
  }
  getLastSavedFile() {
    return this.lastSavedFile;
  }
  getLastSavedTime() {
    return this.lastSavedTime;
  }
  clearLastSavedFile() {
    this.lastSavedFile = "";
  }
};

// src/obsidian/dataloom-view.tsx
var import_jsx_runtime11 = __toESM(require_jsx_runtime());
var DATA_LOOM_VIEW = "dataloom";
var DataLoomView = class extends import_obsidian6.TextFileView {
  constructor(leaf, pluginId, pluginVersion) {
    super(leaf);
    this.handleSaveLoomState = async (appId, state, shouldSaveFrontmatter) => {
      if (!this.file)
        return;
      if (shouldSaveFrontmatter) {
        await serializeFrontmatter(this.app, state);
      }
      const serialized = serializeState(state);
      LastSavedManager.getInstance().setLastSavedFile(this.file.path);
      this.setViewData(serialized, false);
      this.requestSave();
      EventManager.getInstance().emit(
        "app-refresh-by-state",
        this.file.path,
        appId,
        state
      );
    };
    this.pluginId = pluginId;
    this.pluginVersion = pluginVersion;
    this.root = null;
    this.data = "";
    this.appId = createAppId();
  }
  async onOpen() {
    this.containerEl.style.paddingBottom = "48px";
    this.addAction("settings", "Settings", () => {
      this.app.setting.open();
      this.app.setting.openTabById(this.pluginId);
    });
  }
  async onClose() {
    if (this.root) {
      this.root.unmount();
      this.root = null;
    }
  }
  setViewData(data, clear) {
    this.data = data;
    if (clear) {
      if (this.root) {
        this.root.unmount();
      }
      const container = this.containerEl.children[1];
      const root = (0, import_client.createRoot)(container);
      this.root = root;
      try {
        const state = deserializeState(data, this.pluginVersion);
        this.renderApp(this.appId, state);
      } catch (err) {
        this.renderErrorApp(err);
      }
    }
  }
  clear() {
    this.data = "{}";
  }
  getViewData() {
    return this.data;
  }
  getViewType() {
    return DATA_LOOM_VIEW;
  }
  getDisplayText() {
    if (!this.file)
      return "";
    const fileName = this.file.name;
    const extensionIndex = fileName.lastIndexOf(".");
    return fileName.substring(0, extensionIndex);
  }
  renderApp(appId, state) {
    if (!this.file)
      return;
    if (this.root) {
      this.root.render(
        /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
          LoomApp,
          {
            app: this.app,
            mountLeaf: this.leaf,
            reactAppId: appId,
            loomFile: this.file,
            isMarkdownView: false,
            store,
            loomState: state,
            onSaveState: this.handleSaveLoomState
          }
        )
      );
    }
  }
  renderErrorApp(error) {
    if (this.root) {
      this.root.render(/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ErrorApp, { error }));
    }
  }
};

// src/shared/render/embed.ts
var handleLinkClick = (app, event) => {
  const targetEl = event.target;
  const closestAnchor = targetEl.tagName === "A" ? targetEl : targetEl.closest("a");
  if (!closestAnchor) {
    return;
  }
  if (closestAnchor.hasClass("internal-link")) {
    event.preventDefault();
    const href = closestAnchor.getAttr("href");
    const newLeaf = event.ctrlKey || event.metaKey;
    if (href)
      app.workspace.openLinkText(href, "", newLeaf);
  }
};

// src/shared/render-embed.ts
var import_obsidian7 = require("obsidian");
var renderText = async (app, leaf, value) => {
  var _a2, _b;
  const div = document.createElement("div");
  div.style.width = "100%";
  div.style.height = "100%";
  try {
    const view = leaf.view;
    if (view instanceof import_obsidian7.MarkdownView || view instanceof DataLoomView) {
      await import_obsidian7.MarkdownRenderer.render(
        app,
        value,
        div,
        (_b = (_a2 = view.file) == null ? void 0 : _a2.path) != null ? _b : "",
        view
      );
    }
  } catch (e) {
    console.error(e);
  }
  return div;
};
var renderEmbed = async (app, leaf, value) => {
  return renderText(app, leaf, value);
};

// src/shared/render-utils.ts
var renderMarkdown = async (app, leaf, markdown) => {
  const div = document.createElement("div");
  div.style.height = "100%";
  div.style.width = "100%";
  const view = leaf.view;
  if (view instanceof DataLoomView)
    div.classList.add("markdown-rendered");
  try {
    const formattedMarkdown = replaceNewLinesWithBr(markdown);
    const view2 = leaf == null ? void 0 : leaf.view;
    if (view2 instanceof import_obsidian8.MarkdownView || view2 instanceof DataLoomView) {
      const file = view2.file;
      if (file === null)
        return div;
      await import_obsidian8.MarkdownRenderer.render(
        app,
        formattedMarkdown,
        div,
        file.path,
        view2
      );
      const embeds = div.querySelectorAll(".internal-link");
      embeds.forEach((embed) => {
        const el = embed;
        const href = el.getAttribute("data-href");
        if (!href)
          return;
        const destination = app.metadataCache.getFirstLinkpathDest(
          href,
          file.path
        );
        if (!destination)
          embed.classList.add("is-unresolved");
        el.addEventListener("mouseover", (e) => {
          e.stopPropagation();
          app.workspace.trigger("hover-link", {
            event: e,
            source: DATA_LOOM_VIEW,
            hoverParent: view2.containerEl,
            targetEl: el,
            linktext: href,
            sourcePath: el.href
          });
        });
        el.addEventListener("click", (e) => handleLinkClick(app, e));
      });
    }
  } catch (e) {
    console.error(e);
  }
  return div;
};
var useRenderMarkdown = (markdown, options) => {
  const { app } = useAppMount();
  const { isEmbed = false, isExternalLink: isExternalLink2 = false } = options != null ? options : {};
  const containerRef = import_react10.default.useRef(null);
  const renderRef = import_react10.default.useRef(null);
  const { mountLeaf } = useAppMount();
  import_react10.default.useEffect(() => {
    async function updateContainerRef() {
      let el = null;
      if (isEmbed) {
        el = await renderEmbed(app, mountLeaf, markdown);
      } else {
        el = await renderMarkdown(app, mountLeaf, markdown);
      }
      if (el) {
        renderRef.current = el;
        if (containerRef.current)
          appendOrReplaceFirstChild(containerRef.current, el);
      }
    }
    updateContainerRef();
  }, [app, markdown, mountLeaf, isExternalLink2, isEmbed]);
  return {
    containerRef,
    renderRef
  };
};
var isOnMobile = () => {
  return import_obsidian8.Platform.isMobile;
};
var getResourcePath = (app, filePath) => {
  return app.vault.adapter.getResourcePath(filePath);
};

// src/react/shared/base-menu/utils.ts
var useShiftMenu = (isModalMenu, viewportEl, menuRef, position, isOpen, options) => {
  const {
    openDirection = "normal",
    topOffset = 0,
    leftOffset = 0
  } = options || {};
  import_react11.default.useEffect(() => {
    if (!menuRef.current)
      return;
    if (!isOpen)
      return;
    const menuPosition = getMenuPosition(
      menuRef.current,
      position,
      topOffset,
      leftOffset,
      openDirection
    );
    const viewportPosition = getViewportPosition(viewportEl, isModalMenu);
    const newPosition = shiftElementIntoContainer(
      viewportPosition,
      menuPosition
    );
    menuRef.current.style.top = numToPx(newPosition.top);
    menuRef.current.style.left = numToPx(newPosition.left);
  });
};
var getMenuPosition = (menuEl, position, topOffset, leftOffset, openDirection) => {
  const rect = menuEl.getBoundingClientRect();
  let top = position.top + topOffset;
  let left = position.left + leftOffset;
  if (openDirection === "left") {
    left = left - rect.width;
  } else if (openDirection === "right") {
    left = left + position.width;
  } else if (openDirection === "bottom-left") {
    top = top + position.height;
    left = left - rect.width;
  } else if (openDirection === "bottom-right") {
    top = top + position.height;
    left = left + position.width;
  } else if (openDirection === "bottom") {
    top = top + position.height;
  }
  return {
    top,
    left,
    width: rect.width,
    height: rect.height
  };
};
var getViewportPosition = (viewportEl, isModalMenu) => {
  const rect = viewportEl.getBoundingClientRect();
  const rectRelativeToDocument = getPositionRelativeToDocument(rect);
  let height = rectRelativeToDocument.height;
  if (!isModalMenu) {
    const MOBILE_BAR_HEIGHT = 48;
    if (isOnMobile())
      height -= MOBILE_BAR_HEIGHT;
  }
  return {
    top: rectRelativeToDocument.top,
    left: rectRelativeToDocument.left,
    width: rectRelativeToDocument.width,
    height
  };
};
var getPositionRelativeToDocument = (rect) => {
  const left = rect.left + window.scrollX - document.body.clientLeft;
  const top = rect.top + window.scrollY - document.body.clientTop;
  return {
    top,
    left,
    width: rect.width,
    height: rect.height
  };
};
var shiftElementIntoContainer = (container, element) => {
  const MENU_SHIFT_PADDING = 16;
  let newTop = element.top;
  let newLeft = element.left;
  if (element.top + element.height > container.top + container.height) {
    newTop = container.top + container.height - element.height - MENU_SHIFT_PADDING;
  }
  if (element.left + element.width > container.left + container.width) {
    newLeft = container.left + container.width - element.width - MENU_SHIFT_PADDING;
  }
  if (element.top < container.top) {
    newTop = container.top + MENU_SHIFT_PADDING;
  }
  if (element.left < container.left) {
    newLeft = container.left + MENU_SHIFT_PADDING;
  }
  return {
    top: newTop,
    left: newLeft
  };
};

// src/react/shared/menu/index.tsx
var import_jsx_runtime12 = __toESM(require_jsx_runtime());
function Menu({
  id: id2,
  isOpen,
  hideBorder = false,
  openDirection,
  position,
  minWidth = 0,
  width = 0,
  height = 0,
  leftOffset = 0,
  topOffset = 0,
  maxHeight = 0,
  maxWidth = 0,
  children
}) {
  const ref = import_react12.default.useRef(null);
  const { mountLeaf } = useAppMount();
  useShiftMenu(false, mountLeaf.view.containerEl, ref, position, isOpen, {
    openDirection,
    leftOffset,
    topOffset
  });
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
    base_menu_default,
    {
      ref,
      id: id2,
      isOpen,
      hideBorder,
      position,
      width,
      height,
      minWidth,
      maxHeight,
      maxWidth,
      children
    }
  );
}

// src/react/shared/menu-item/index.tsx
var import_react14 = __toESM(require_react());

// src/react/shared/icon/index.tsx
var import_obsidian9 = require("obsidian");
var import_react13 = __toESM(require_react());
var import_jsx_runtime13 = __toESM(require_jsx_runtime());
function Icon({
  ariaLabel,
  lucideId,
  size = "sm",
  color
}) {
  const ref = import_react13.default.useRef(null);
  let className = "";
  if (size === "sm") {
    className += "dataloom-svg--sm";
  } else if (size === "md") {
    className += "dataloom-svg--md";
  } else if (size === "lg") {
    className += "dataloom-svg--lg";
  } else if (size === "xl") {
    className += "dataloom-svg--xl";
  }
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
    "div",
    {
      "aria-label": ariaLabel,
      ref: (node) => {
        ref.current = node;
        const div = document.createElement("div");
        if (color) {
          div.style.color = color;
        }
        (0, import_obsidian9.setIcon)(div, lucideId);
        const svg = div.querySelector("svg");
        if (svg) {
          svg.addClass("dataloom-svg");
          svg.addClass(className);
        }
        appendOrReplaceFirstChild(node, div);
      }
    }
  );
}

// src/react/shared/flex/index.tsx
var import_jsx_runtime14 = __toESM(require_jsx_runtime());
function Flex({
  grow = false,
  flexDir = "row",
  justify = "flex-start",
  align = "flex-start",
  wrap = "wrap",
  width,
  height,
  children
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
    "div",
    {
      className: "dataloom-flex",
      style: {
        flexGrow: grow ? 1 : 0,
        flexDirection: flexDir,
        justifyContent: justify,
        alignItems: align,
        flexWrap: wrap,
        width,
        height
      },
      children
    }
  );
}

// src/react/shared/menu-item/index.tsx
var import_jsx_runtime15 = __toESM(require_jsx_runtime());
function MenuItem({
  isFocusable = true,
  isDisabled = false,
  lucideId,
  ariaLabel,
  name,
  value,
  onClick,
  isSelected = false
}) {
  const ref = import_react14.default.useRef(null);
  import_react14.default.useEffect(() => {
    if (!ref.current)
      return;
    if (isSelected) {
      ref.current.focus();
    }
  }, [isSelected]);
  function handleClick(e) {
    if (isDisabled)
      return;
    if (!onClick)
      return;
    e.stopPropagation();
    onClick();
  }
  function handleKeyDown(e) {
    if (isDisabled)
      return;
    if (e.key === "Enter") {
      e.stopPropagation();
      onClick == null ? void 0 : onClick();
    }
  }
  let className = "dataloom-menu-item dataloom-selectable";
  if (isSelected) {
    className += " dataloom-selected";
  } else if (isDisabled) {
    className += " dataloom-disabled";
  }
  if (isFocusable)
    className += " dataloom-focusable";
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
    "div",
    {
      ref,
      tabIndex: 0,
      className,
      "aria-label": ariaLabel,
      onClick: handleClick,
      onKeyDown: handleKeyDown,
      children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Flex, { justify: "space-between", align: "center", children: [
        /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Stack, { isHorizontal: true, children: [
          lucideId !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Padding, { width: "unset", pb: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Icon, { lucideId }) }),
          /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { value: name })
        ] }),
        value !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text, { variant: "faint", value })
      ] })
    }
  );
}

// src/shared/match/regex.ts
var NUMBER_REGEX = new RegExp(/^-?\d+\.?\d*$/);
var NUMBER_INPUT_REGEX = new RegExp(/(^$)|(^-$)|(^-?\d+\.?\d*$)/);
var DATE_REGEX = new RegExp(/^\d{4}\/\d{2}\/\d{2}$/);
var CHECKBOX_REGEX = new RegExp(/^\[[x ]{0,1}\]$/);
var CHECKBOX_CHECKED_REGEX2 = new RegExp(/^\[[x]\]$/);
var IMAGE_EXTENSION_REGEX = new RegExp(
  /\.(jpe?g|png|gif|bmp|tiff?|ico|webp)$/i
);
var YOUTUBE_LINK_REGEX = new RegExp(
  /^https?:\/\/(?:www\.)?(?:youtube\.com\/\S+|youtu\.be\/\S+)$/
);
var TWITTER_LINK_REGEX = new RegExp(
  /^https?:\/\/(?:www\.)?twitter\.com\/\S+|\bt\.co\/\S+$/
);

// src/shared/match/index.ts
var isNumber = (value) => {
  return value.match(NUMBER_REGEX) !== null;
};
var isNumberInput = (value) => {
  return value.match(NUMBER_INPUT_REGEX) !== null;
};
var isYouTubeLink = (value) => {
  return value.match(YOUTUBE_LINK_REGEX) !== null;
};
var isTwitterLink = (value) => {
  return value.match(TWITTER_LINK_REGEX) !== null;
};
var isNumberCalcuation = (value) => {
  return Object.values(NumberCalculation).includes(
    value
  );
};

// src/shared/loom-state/type-display-names.ts
var getShortDisplayNameForCalculation = (value) => {
  switch (value) {
    case "count-all" /* COUNT_ALL */:
      return "Count";
    case "count-not-empty" /* COUNT_NOT_EMPTY */:
      return "Not empty";
    case "count-values" /* COUNT_VALUES */:
      return "Values";
    case "count-empty" /* COUNT_EMPTY */:
      return "Empty";
    case "count-unique" /* COUNT_UNIQUE */:
      return "Unique";
    case "none" /* NONE */:
      return "None";
    case "percent-empty" /* PERCENT_EMPTY */:
      return "Empty";
    case "percent-not-empty" /* PERCENT_NOT_EMPTY */:
      return "Not empty";
    default:
      return "";
  }
};
var getShortDisplayNameForCalculationType = (value) => {
  if (isNumberCalcuation(value))
    return getDisplayNameForNumberCalculation(value);
  return getShortDisplayNameForCalculation(value);
};
var getAriaLabelForCalculation = (value) => {
  switch (value) {
    case "count-all" /* COUNT_ALL */:
      return "Counts the total number of rows";
    case "count-empty" /* COUNT_EMPTY */:
      return "Counts the number of rows with an empty cell value";
    case "count-not-empty" /* COUNT_NOT_EMPTY */:
      return "Counts the number of rows with a non-empty cell value";
    case "count-unique" /* COUNT_UNIQUE */:
      return "Counts the number of unique values in the column";
    case "count-values" /* COUNT_VALUES */:
      return "Counts the number of values in the column";
    case "percent-empty" /* PERCENT_EMPTY */:
      return "Displays the percentage of rows with an empty cell value";
    case "percent-not-empty" /* PERCENT_NOT_EMPTY */:
      return "Displays the percentage of rows with a non-empty cell value";
    default:
      return "";
  }
};
var getAriaLabelForNumberCalculation = (value) => {
  switch (value) {
    case "sum" /* SUM */:
      return "Computes the sum of the cells in the column";
    case "avg" /* AVG */:
      return "Computes the average of the cells in the column";
    case "min" /* MIN */:
      return "Computes the minimum of the cells in the column";
    case "max" /* MAX */:
      return "Computes the maximum of the cells in the column";
    case "median" /* MEDIAN */:
      return "Computes the median of the cells in the column";
    case "range" /* RANGE */:
      return "Computes the range (max - min) of the cells in the column";
    default:
      return "";
  }
};
var getDisplayNameForCalculation = (value) => {
  switch (value) {
    case "count-all" /* COUNT_ALL */:
      return "Count all";
    case "count-not-empty" /* COUNT_NOT_EMPTY */:
      return "Count not empty";
    case "count-values" /* COUNT_VALUES */:
      return "Count values";
    case "count-empty" /* COUNT_EMPTY */:
      return "Count empty";
    case "count-unique" /* COUNT_UNIQUE */:
      return "Count unique";
    case "none" /* NONE */:
      return "None";
    case "percent-empty" /* PERCENT_EMPTY */:
      return "Percent empty";
    case "percent-not-empty" /* PERCENT_NOT_EMPTY */:
      return "Percent not empty";
    default:
      return "";
  }
};
var getDisplayNameForNumberCalculation = (value) => {
  switch (value) {
    case "sum" /* SUM */:
      return "Sum";
    case "avg" /* AVG */:
      return "Average";
    case "min" /* MIN */:
      return "Min";
    case "max" /* MAX */:
      return "Max";
    case "median" /* MEDIAN */:
      return "Median";
    case "range" /* RANGE */:
      return "Range";
    default:
      return "";
  }
};
var getDisplayNameForSource = (type) => {
  switch (type) {
    case "folder" /* FOLDER */:
      return "Folder";
    case "frontmatter" /* FRONTMATTER */:
      return "Frontmatter";
    default:
      return "";
  }
};
var getDisplayNameForDateFormat = (format) => {
  switch (format) {
    case "ddmmyyyy" /* DD_MM_YYYY */:
      return "DD MM YYYY";
    case "mmddyyyy" /* MM_DD_YYYY */:
      return "MM DD YYYY";
    case "yyyymmdd" /* YYYY_MM_DD */:
      return "YYYY MM DD";
    default:
      return "";
  }
};
var getDisplayNameForDateFormatSeparator = (format) => {
  switch (format) {
    case "/" /* SLASH */:
      return "Slash";
    case "." /* DOT */:
      return "Dot";
    case "-" /* HYPHEN */:
      return "Hyphen";
    default:
      return "";
  }
};
var getDisplayNameForSortDir = (dir) => {
  switch (dir) {
    case "asc" /* ASC */:
      return "Ascending";
    case "desc" /* DESC */:
      return "Descending";
    default:
      return "Default";
  }
};
var getDisplayNameForCurrencyType = (type) => {
  switch (type) {
    case "USD" /* UNITED_STATES */:
      return "United States Dollar";
    case "CAD" /* CANADA */:
      return "Canadian Dollar";
    case "AUD" /* AUSTRALIA */:
      return "Australian Dollar";
    case "SGB" /* SINGAPORE */:
      return "Singapore Dollar";
    case "KRW" /* SOUTH_KOREA */:
      return "Won";
    case "CNY" /* CHINA */:
      return "Yuan";
    case "JPY" /* JAPAN */:
      return "Yen";
    case "AED" /* UAE */:
      return "Dirham";
    case "SAR" /* SAUDI_ARABIA */:
      return "Riyal";
    case "COP" /* COLOMBIA */:
      return "Colombian Peso";
    case "EUR" /* EUROPE */:
      return "Euro";
    case "SEK" /* SWEDEN */:
      return "Swedish Krona";
    case "DKK" /* DENMARK */:
      return "Danish Krone";
    case "NOK" /* NORWAY */:
      return "Norwegian Krone";
    case "ISK" /* ICELAND */:
      return "Icelandic Kr\xF3na";
    case "BRL" /* BRAZIL */:
      return "Real";
    case "GBP" /* GREAT_BRITAIN */:
      return "Pound";
    case "INR" /* INDIA */:
      return "Rupee";
    case "ARS" /* ARGENTINA */:
      return "Argentine Peso";
    case "MXN" /* MEXICO */:
      return "Mexican Peso";
    case "RUB" /* RUSSIA */:
      return "Ruble";
    case "ILS" /* ISRAEL */:
      return "Israeli Shekel";
    case "CHF" /* SWITZERLAND */:
      return "Swiss Franc";
    default:
      return "";
  }
};
var getDisplayNameForCellType = (type) => {
  switch (type) {
    case "text" /* TEXT */:
      return "Text";
    case "embed" /* EMBED */:
      return "Embed";
    case "file" /* FILE */:
      return "File";
    case "number" /* NUMBER */:
      return "Number";
    case "checkbox" /* CHECKBOX */:
      return "Checkbox";
    case "date" /* DATE */:
      return "Date";
    case "last-edited-time" /* LAST_EDITED_TIME */:
      return "Last edited";
    case "creation-time" /* CREATION_TIME */:
      return "Creation";
    case "tag" /* TAG */:
      return "Tag";
    case "multi-tag" /* MULTI_TAG */:
      return "Multi-tag";
    default:
      return "";
  }
};
var getDisplayNameForFilterCondition = (type) => {
  switch (type) {
    case "is" /* IS */:
    case "is" /* IS */:
      return "Is";
    case "is-not" /* IS_NOT */:
      return "Is not";
    case "contains" /* CONTAINS */:
      return "Contains";
    case "does-not-contain" /* DOES_NOT_CONTAIN */:
      return "Does not contain";
    case "starts-with" /* STARTS_WITH */:
      return "Starts with";
    case "ends-with" /* ENDS_WITH */:
      return "Ends with";
    case "is-equal" /* IS_EQUAL */:
      return "=";
    case "is-not-equal" /* IS_NOT_EQUAL */:
      return "!=";
    case "is-greater" /* IS_GREATER */:
      return ">";
    case "is-greater-or-equal" /* IS_GREATER_OR_EQUAL */:
      return ">=";
    case "is-less" /* IS_LESS */:
      return "<";
    case "is-less-or-equal" /* IS_LESS_OR_EQUAL */:
      return "<=";
    case "is-after" /* IS_AFTER */:
      return "Is after";
    case "is-before" /* IS_BEFORE */:
      return "Is before";
    case "is-empty" /* IS_EMPTY */:
    case "is-empty" /* IS_EMPTY */:
    case "is-empty" /* IS_EMPTY */:
      return "Is empty";
    case "is-not-empty" /* IS_NOT_EMPTY */:
    case "is-not-empty" /* IS_NOT_EMPTY */:
    case "is-not-empty" /* IS_NOT_EMPTY */:
      return "Is not empty";
    default:
      return "";
  }
};
var getDisplayNameForDateFilterOption = (value) => {
  switch (value) {
    case "unselected" /* UNSELECTED */:
      return "Select an option";
    case "today" /* TODAY */:
      return "Today";
    case "tomorrow" /* TOMORROW */:
      return "Tomorrow";
    case "yesterday" /* YESTERDAY */:
      return "Yesterday";
    case "one-week-ago" /* ONE_WEEK_AGO */:
      return "One week ago";
    case "one-week-from-now" /* ONE_WEEK_FROM_NOW */:
      return "One week from now";
    case "one-month-ago" /* ONE_MONTH_AGO */:
      return "One month ago";
    case "one-month-from-now" /* ONE_MONTH_FROM_NOW */:
      return "One month from now";
    default:
      return "";
  }
};

// src/react/loom-app/footer-cell-container/calculation-menu.tsx
var import_jsx_runtime16 = __toESM(require_jsx_runtime());
function CalculationMenu({
  id: id2,
  value,
  cellType,
  isOpen,
  position,
  onClick
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Menu, { id: id2, isOpen, position, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "dataloom-function-menu", children: [
    Object.values(GeneralCalculation).map((type) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
      MenuItem,
      {
        name: getDisplayNameForCalculation(type),
        ariaLabel: getAriaLabelForCalculation(type),
        onClick: () => onClick(type),
        isSelected: type === value
      },
      type
    )),
    cellType === "number" /* NUMBER */ && Object.values(NumberCalculation).map((type) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
      MenuItem,
      {
        ariaLabel: getAriaLabelForNumberCalculation(type),
        name: getDisplayNameForNumberCalculation(type),
        onClick: () => onClick(type),
        isSelected: type === value
      },
      type
    ))
  ] }) });
}

// src/react/shared/menu-trigger/index.tsx
var import_react15 = __toESM(require_react());

// src/shared/keyboard-event.ts
var import_obsidian10 = require("obsidian");
var isWindowsUndoDown = (e) => e.ctrlKey && e.key === "z";
var isWindowsRedoDown = (e) => e.ctrlKey && e.key === "y";
var isMacUndoDown = (e) => e.metaKey && e.key === "z";
var isMacRedoDown = (e) => e.metaKey && e.shiftKey && e.key === "z";
var isInsertLineDown = (e) => {
  return e.shiftKey && e.key === "Enter";
};
var isInsertLineAltDown = (e) => {
  if (import_obsidian10.Platform.isMacOS) {
    return e.metaKey && e.key === "Enter";
  } else if (import_obsidian10.Platform.isWin || import_obsidian10.Platform.isLinux) {
    return e.altKey && e.key === "Enter";
  }
};

// src/react/shared/menu-trigger/index.tsx
var import_js_logger7 = __toESM(require_logger());
var import_jsx_runtime17 = __toESM(require_jsx_runtime());
var MenuTrigger = import_react15.default.forwardRef(
  ({
    ariaLabel,
    menuId,
    level,
    variant,
    isFocused,
    shouldRunTrigger = true,
    children,
    onEnterDown,
    onBackspaceDown,
    onClick,
    onMouseDown,
    onOpen
  }, ref) => {
    const { topMenu, canOpen, onRequestClose } = useMenuOperations();
    function handleKeyDown(e) {
      import_js_logger7.default.trace("MenuTrigger handleKeyDown");
      if (e.key === "Enter") {
        e.stopPropagation();
        onEnterDown == null ? void 0 : onEnterDown();
        e.preventDefault();
        if (shouldRunTrigger) {
          if (canOpen(level)) {
            const tag = e.target.tagName;
            if (tag === "A")
              return;
            onOpen();
            return;
          }
        }
        if (!topMenu)
          return;
        onRequestClose(topMenu == null ? void 0 : topMenu.id, "close-on-save");
      } else if (e.key === "Backspace") {
        e.stopPropagation();
        onBackspaceDown == null ? void 0 : onBackspaceDown();
      } else if (e.key.length === 1) {
        if (isWindowsRedoDown(e) || isWindowsUndoDown(e) || isMacRedoDown(e) || isMacUndoDown(e))
          return;
        if (variant !== "cell")
          return;
        onOpen();
      }
    }
    function handleClick(e) {
      import_js_logger7.default.trace("MenuTrigger handleClick");
      e.stopPropagation();
      onClick == null ? void 0 : onClick(e);
      if (shouldRunTrigger) {
        if (canOpen(level)) {
          const tag = e.target.tagName;
          if (tag === "A")
            return;
          onOpen();
          return;
        }
      }
      if (!topMenu)
        return;
      onRequestClose(topMenu.id, "save-and-close");
    }
    let className = "dataloom-menu-trigger dataloom-focusable";
    if (isFocused) {
      className += " dataloom-focusable--focused";
    }
    return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
      "div",
      {
        "aria-label": ariaLabel,
        "data-menu-id": menuId,
        tabIndex: 0,
        className,
        ref,
        style: {
          width: variant === "cell" ? "100%" : void 0,
          height: variant === "cell" ? "100%" : void 0,
          borderRadius: variant === "button" ? "var(--button-radius)" : void 0
        },
        onMouseDown,
        onKeyDown: handleKeyDown,
        onClick: handleClick,
        children
      }
    );
  }
);
var menu_trigger_default = MenuTrigger;

// src/react/loom-app/footer-cell-container/utils.ts
var NAMESPACE = "fa23ee5e-43ae-45e0-83ed-97c577913416";
var hashString = (value) => {
  return v5_default(value, NAMESPACE);
};
var round2Digits = (value) => {
  if (value.toString().includes("."))
    return parseFloat(value.toFixed(2));
  return value;
};

// src/shared/error/row-not-found-error.ts
var RowNotFoundError = class extends Error {
  constructor(id2) {
    super(`Cannot find row with id: ${id2}`);
    this.name = "RowNotFoundError";
  }
};

// src/shared/date/date-time-conversion.ts
var dateTimeToDateString = (dateTime, format, separator, options) => {
  const {
    locale = navigator.language,
    includeTime = false,
    hour12 = true
  } = options || {};
  const date = new Date(dateTime);
  const year = date.getFullYear();
  const month = padToTwoDigits(date.getMonth() + 1);
  const day = padToTwoDigits(date.getDate());
  let formattedDate = "";
  switch (format) {
    case "mmddyyyy" /* MM_DD_YYYY */:
      formattedDate = month + separator + day + separator + year;
      break;
    case "ddmmyyyy" /* DD_MM_YYYY */:
      formattedDate = day + separator + month + separator + year;
      break;
    case "yyyymmdd" /* YYYY_MM_DD */:
      formattedDate = year + separator + month + separator + day;
      break;
    default:
      throw new Error("Date format not supported.");
  }
  const formattedTime = date.toLocaleString(locale, {
    hour: "numeric",
    minute: "numeric",
    hour12
  });
  if (includeTime) {
    return formattedDate + " " + formattedTime;
  }
  return formattedDate;
};
var dateTimeToTimeString = (dateTime, options) => {
  const { locale = navigator.language, hour12 = true } = options || {};
  const date = new Date(dateTime);
  const time = date.toLocaleString(locale, {
    hour: "numeric",
    minute: "numeric",
    hour12
  });
  return time;
};

// src/shared/loom-state/utils/column-utils.ts
var getColumnCells = (rows, columnId) => {
  return rows.map((row) => {
    const { cells } = row;
    const cell = cells.find((cell2) => cell2.columnId === columnId);
    if (!cell)
      throw new RowNotFoundError(row.id);
    return cell;
  });
};
var mapCellsToColumn = (columns, rows) => {
  const cellsToColumn = /* @__PURE__ */ new Map();
  const cells = rows.flatMap((row) => row.cells);
  cells.forEach((cell) => {
    const column = columns.find((column2) => column2.id === cell.columnId);
    if (!column)
      throw new ColumnNotFoundError({ id: cell.columnId });
    cellsToColumn.set(cell.columnId, column);
  });
  return cellsToColumn;
};

// src/react/loom-app/footer-cell-container/general-calculation.ts
var getGeneralCalculationContent = (columnId, sources, rows, columnTags, cellType, calculationType, dateFormat, dateFormatSeparator) => {
  const columnCells = getColumnCells(rows, columnId);
  return getCalculation(
    sources,
    columnCells,
    rows,
    columnTags,
    cellType,
    calculationType,
    dateFormat,
    dateFormatSeparator
  ).toString();
};
var getCalculation = (sources, columnCells, rows, columnTags, cellType, calculationType, dateFormat, dateFormatSeparator) => {
  if (calculationType === "count-all" /* COUNT_ALL */) {
    return countAll(rows);
  } else if (calculationType === "count-empty" /* COUNT_EMPTY */) {
    return countEmpty(columnCells, cellType);
  } else if (calculationType === "count-not-empty" /* COUNT_NOT_EMPTY */) {
    return countNotEmpty(columnCells, cellType);
  } else if (calculationType === "count-unique" /* COUNT_UNIQUE */) {
    return countUnique(
      sources,
      rows,
      columnCells,
      columnTags,
      cellType,
      dateFormat,
      dateFormatSeparator
    );
  } else if (calculationType === "count-values" /* COUNT_VALUES */) {
    return countValues(columnCells, cellType);
  } else if (calculationType === "percent-empty" /* PERCENT_EMPTY */) {
    return percentEmpty(columnCells, cellType);
  } else if (calculationType === "percent-not-empty" /* PERCENT_NOT_EMPTY */) {
    return percentNotEmpty(columnCells, cellType);
  } else if (calculationType === "none" /* NONE */) {
    return "";
  } else {
    throw new Error("Unhandled calculation type");
  }
};
var countAll = (rows) => {
  return rows.length;
};
var countEmpty = (columnCells, cellType) => {
  return columnCells.map((cell) => isCellEmpty(cell, cellType)).reduce((accum, value) => {
    if (value === true)
      return accum + 1;
    return accum;
  }, 0);
};
var countNotEmpty = (columnCells, type) => {
  return columnCells.map((cell) => isCellEmpty(cell, type)).reduce((accum, value) => {
    if (value === false)
      return accum + 1;
    return accum;
  }, 0);
};
var countUnique = (sources, rows, columnCells, columnTags, cellType, dateFormat, dateFormatSeparator) => {
  const hashes = columnCells.map((cell) => {
    var _a2;
    const row = rows.find((row2) => {
      const { cells } = row2;
      return cells.find((c2) => c2.id === cell.id);
    });
    if (!row)
      throw new RowNotFoundError();
    const source = (_a2 = sources.find((source2) => source2.id === row.sourceId)) != null ? _a2 : null;
    const cellValues = getCellValues(
      cell,
      cellType,
      dateFormat,
      dateFormatSeparator,
      row,
      source,
      columnTags
    );
    return cellValues.filter((value) => value !== "").map((value) => hashString(value));
  }).flat(1);
  const uniqueHashes = new Set(hashes);
  return uniqueHashes.size;
};
var countValues = (columnCells, cellType) => {
  return columnCells.map((cell) => countCellValues(cell, cellType)).reduce((accum, value) => accum + value, 0);
};
var percentEmpty = (columnCells, cellType) => {
  if (columnCells.length === 0)
    return "0%";
  const percent = countEmpty(columnCells, cellType) / columnCells.length * 100;
  return round2Digits(percent) + "%";
};
var percentNotEmpty = (columnCells, cellType) => {
  if (columnCells.length === 0)
    return "0%";
  const percent = countNotEmpty(columnCells, cellType) / columnCells.length * 100;
  return round2Digits(percent) + "%";
};
var getCellValues = (cell, type, dateFormat, dateFormatSeparator, row, source, columnTags) => {
  const { creationDateTime, lastEditedDateTime } = row;
  switch (type) {
    case "text" /* TEXT */: {
      const { content } = cell;
      return [content];
    }
    case "embed" /* EMBED */: {
      const { pathOrUrl } = cell;
      return [pathOrUrl];
    }
    case "number" /* NUMBER */: {
      const { value } = cell;
      if (value)
        return [value.toString()];
      return [];
    }
    case "file" /* FILE */: {
      const { path } = cell;
      const fileName = getFileName(path);
      return [fileName];
    }
    case "source-file" /* SOURCE_FILE */: {
      const { path } = cell;
      const fileName = getFileName(path);
      return [fileName];
    }
    case "checkbox" /* CHECKBOX */: {
      const { value } = cell;
      return [value ? "true" : "false"];
    }
    case "date" /* DATE */: {
      const { dateTime } = cell;
      if (dateTime)
        return [dateTime.toString()];
      return [];
    }
    case "tag" /* TAG */: {
      const { tagId } = cell;
      if (tagId) {
        const tag = columnTags.find((tag2) => tag2.id === tagId);
        if (!tag)
          throw new TagNotFoundError(tagId);
        const { content } = tag;
        return [content];
      }
      return [];
    }
    case "multi-tag" /* MULTI_TAG */: {
      const { tagIds } = cell;
      return tagIds.map((tagId) => {
        const tag = columnTags.find((tag2) => tag2.id === tagId);
        if (!tag)
          throw new TagNotFoundError(tagId);
        const { content } = tag;
        return content;
      });
    }
    case "last-edited-time" /* LAST_EDITED_TIME */: {
      return [
        dateTimeToDateString(
          lastEditedDateTime,
          dateFormat,
          dateFormatSeparator,
          {
            includeTime: true
          }
        )
      ];
    }
    case "creation-time" /* CREATION_TIME */: {
      return [
        dateTimeToDateString(
          creationDateTime,
          dateFormat,
          dateFormatSeparator,
          {
            includeTime: true
          }
        )
      ];
    }
    case "source" /* SOURCE */: {
      return [getSourceCellContent(source)];
    }
    default:
      throw new Error("Unhandled cell type");
  }
};
var countCellValues = (cell, type) => {
  switch (type) {
    case "text" /* TEXT */: {
      const { content } = cell;
      return content === "" ? 0 : 1;
    }
    case "embed" /* EMBED */: {
      const { pathOrUrl } = cell;
      return pathOrUrl === "" ? 0 : 1;
    }
    case "number" /* NUMBER */: {
      const { value } = cell;
      return value === null ? 0 : 1;
    }
    case "file" /* FILE */: {
      const { path } = cell;
      return path === "" ? 0 : 1;
    }
    case "source-file" /* SOURCE_FILE */: {
      const { path } = cell;
      return path === "" ? 0 : 1;
    }
    case "checkbox" /* CHECKBOX */: {
      const { value } = cell;
      return value ? 1 : 0;
    }
    case "date" /* DATE */: {
      const { dateTime } = cell;
      return dateTime == null ? 0 : 1;
    }
    case "tag" /* TAG */: {
      const { tagId } = cell;
      return tagId === null ? 0 : 1;
    }
    case "multi-tag" /* MULTI_TAG */: {
      const { tagIds } = cell;
      return tagIds.length;
    }
    case "last-edited-time" /* LAST_EDITED_TIME */: {
      return 1;
    }
    case "creation-time" /* CREATION_TIME */: {
      return 1;
    }
    case "source" /* SOURCE */: {
      return 1;
    }
    default:
      throw new Error("Unhandled cell type");
  }
};
var isCellEmpty = (cell, type) => {
  switch (type) {
    case "text" /* TEXT */: {
      const { content } = cell;
      return content === "";
    }
    case "embed" /* EMBED */: {
      const { pathOrUrl } = cell;
      return pathOrUrl === "";
    }
    case "number" /* NUMBER */: {
      const { value } = cell;
      return value === null;
    }
    case "file" /* FILE */: {
      const { path } = cell;
      return path === "";
    }
    case "source-file" /* SOURCE_FILE */: {
      const { path } = cell;
      return path === "";
    }
    case "date" /* DATE */: {
      const { dateTime } = cell;
      return dateTime == null;
    }
    case "tag" /* TAG */: {
      const { tagId } = cell;
      return tagId === null;
    }
    case "multi-tag" /* MULTI_TAG */: {
      const { tagIds } = cell;
      return tagIds.length === 0;
    }
    case "checkbox" /* CHECKBOX */: {
      const { value } = cell;
      return value === false;
    }
    case "source" /* SOURCE */: {
      return false;
    }
    case "last-edited-time" /* LAST_EDITED_TIME */: {
      return true;
    }
    case "creation-time" /* CREATION_TIME */: {
      return true;
    }
    default:
      throw new Error("Unhandled cell type");
  }
};

// src/react/loom-app/footer-cell-container/arithmetic.ts
var getAverage = (values) => {
  return getSum(values) / values.length;
};
var getSum = (values) => {
  return values.reduce((sum, a2) => sum + a2, 0);
};
var getMaximum = (values) => {
  return Math.max(...values);
};
var getMinimum = (values) => {
  return Math.min(...values);
};
var getMedian = (values) => {
  const sortedValues = values.sort((a2, b2) => a2 - b2);
  const middle = Math.floor(values.length / 2);
  if (values.length % 2 === 0) {
    return (sortedValues[middle - 1] + sortedValues[middle]) / 2;
  } else {
    return sortedValues[middle];
  }
};
var getRange = (values) => {
  return getMaximum(values) - getMinimum(values);
};

// src/react/loom-app/number-cell/utils.ts
var addThousandsSeparator = (num, separator) => {
  const regex = /\B(?=(\d{3})+(?!\d))/g;
  return num.replace(regex, separator);
};

// src/shared/cell-content/number-cell-content.ts
var getNumberCellContent = (format, value, options) => {
  const { currency, separator, suffix, prefix: prefix2 } = options != null ? options : {};
  if (value === null) {
    return "";
  }
  let formattedValue = value.toString();
  if (format === "currency" /* CURRENCY */) {
    if (!currency) {
      throw new Error(
        "a currency is required when number format is set to currency"
      );
    }
    return toCurrencyString(value, currency);
  }
  if (separator && formattedValue.length > 0)
    formattedValue = addThousandsSeparator(formattedValue, separator);
  if (prefix2 && formattedValue.length > 0)
    formattedValue = `${prefix2} ${value}`;
  if (suffix && formattedValue.length > 0)
    formattedValue = `${value} ${suffix}`;
  return formattedValue;
};
var toCurrencyString = (value, type) => {
  return new Intl.NumberFormat("en-US", {
    style: "currency",
    currency: type
  }).format(value);
};

// src/react/loom-app/footer-cell-container/number-calculation.ts
var getNumberCalculationContent = (values, format, currency, calculation) => {
  const value = getNumberCalculation(values, calculation);
  if (format === "currency" /* CURRENCY */) {
    return getNumberCellContent(format, value, {
      currency
    });
  }
  return value.toString();
};
var getNumberCalculation = (values, type) => {
  if (values.length === 0)
    return 0;
  if (type === "avg" /* AVG */) {
    return round2Digits(getAverage(values));
  } else if (type === "max" /* MAX */) {
    return getMaximum(values);
  } else if (type === "min" /* MIN */) {
    return getMinimum(values);
  } else if (type === "range" /* RANGE */) {
    return round2Digits(getRange(values));
  } else if (type === "sum" /* SUM */) {
    return round2Digits(getSum(values));
  } else if (type === "median" /* MEDIAN */) {
    return round2Digits(getMedian(values));
  } else {
    throw new Error("Unhandled number calculation type");
  }
};

// src/react/loom-app/footer-cell-container/index.tsx
var import_jsx_runtime18 = __toESM(require_jsx_runtime());
function FooterCellContainer({
  sources,
  columnId,
  columnCells,
  columnTags,
  dateFormat,
  dateFormatSeparator,
  numberFormat,
  rows,
  width,
  calculationType,
  currencyType,
  cellType,
  onColumnChange
}) {
  const COMPONENT_ID = `footer-cell-${columnId}`;
  const menu = useMenu(COMPONENT_ID);
  function handleTypeClick(value) {
    if (menu === null)
      return;
    onColumnChange(columnId, {
      calculationType: value
    });
    menu.onClose();
  }
  let content = "";
  if (isNumberCalcuation(calculationType)) {
    const values = columnCells.map((cell) => cell.value).filter((value) => value !== null);
    content = getNumberCalculationContent(
      values,
      numberFormat,
      currencyType,
      calculationType
    );
  } else {
    content = getGeneralCalculationContent(
      columnId,
      sources,
      rows,
      columnTags,
      cellType,
      calculationType,
      dateFormat,
      dateFormatSeparator
    );
  }
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
    /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
      menu_trigger_default,
      {
        ref: menu.triggerRef,
        menuId: menu.id,
        isFocused: menu.isTriggerFocused,
        level: 1 /* ONE */,
        variant: "cell",
        onOpen: () => menu.onOpen(1 /* ONE */),
        children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
          "div",
          {
            className: "dataloom-cell--footer__container dataloom-selectable",
            style: {
              width
            },
            children: [
              calculationType === "none" /* NONE */ && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { value: "Calculate", variant: "faint" }),
              calculationType !== "none" /* NONE */ && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Stack, { spacing: "sm", isHorizontal: true, children: [
                /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
                  Text,
                  {
                    value: getShortDisplayNameForCalculationType(
                      calculationType
                    ),
                    variant: "muted"
                  }
                ),
                /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { value: content, variant: "semibold" })
              ] })
            ]
          }
        )
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
      CalculationMenu,
      {
        id: menu.id,
        isOpen: menu.isOpen,
        position: menu.position,
        cellType,
        value: calculationType,
        onClick: handleTypeClick
      }
    )
  ] });
}

// src/react/loom-app/header-cell-container/use-column-resize.ts
var import_react16 = __toESM(require_react());
var useColumnResize = (columnId, onMove) => {
  const { setResizingColumnId } = useLoomState();
  const mouseDownX = (0, import_react16.useRef)(0);
  function handleMouseMove(e) {
    const dist = e.pageX - mouseDownX.current;
    onMove(dist);
  }
  function handleTouchMove(e) {
    e.stopPropagation();
    const dist = e.touches[0].pageX - mouseDownX.current;
    onMove(dist);
  }
  function handleMouseUp() {
    document.removeEventListener("mousemove", handleMouseMove);
    document.removeEventListener("mouseup", handleMouseUp);
    setTimeout(() => {
      setResizingColumnId(null);
    }, 100);
  }
  function handleTouchEnd() {
    document.removeEventListener("touchmove", handleTouchMove);
    document.removeEventListener("touchend", handleTouchEnd);
    setTimeout(() => {
      setResizingColumnId(null);
    }, 100);
  }
  function handleTouchStart(e) {
    if (e.detail >= 2)
      return;
    document.addEventListener("touchmove", handleTouchMove);
    document.addEventListener("touchend", handleTouchEnd);
    mouseDownX.current = e.touches[0].pageX;
    setResizingColumnId(columnId);
  }
  function handleMouseDown(e) {
    if (e.detail >= 2)
      return;
    e.preventDefault();
    document.addEventListener("mousemove", handleMouseMove);
    document.addEventListener("mouseup", handleMouseUp);
    mouseDownX.current = e.pageX;
    setResizingColumnId(columnId);
  }
  return { handleMouseDown, handleTouchStart };
};

// src/shared/constants.ts
var MIN_COLUMN_WIDTH = 40;

// src/react/loom-app/header-cell-container/column-resize/index.tsx
var import_jsx_runtime19 = __toESM(require_jsx_runtime());
function ColumnResize({
  columnIndex,
  currentResizingId,
  columnId,
  width,
  onWidthChange,
  onMenuClose
}) {
  const { handleMouseDown, handleTouchStart } = useColumnResize(
    columnId,
    (dist) => {
      const oldWidth = pxToNum(width);
      const newWidth = oldWidth + dist;
      if (newWidth < MIN_COLUMN_WIDTH)
        return;
      onWidthChange(columnId, numToPx(newWidth));
    }
  );
  function updateColumnWidth() {
    const columnEl = document.body.querySelector(
      `.dataloom-cell[data-column-id="${columnId}"] .dataloom-cell--header__container`
    );
    if (!columnEl)
      throw new Error("Cannot find column element");
    const width2 = columnEl.getBoundingClientRect().width;
    onWidthChange(columnId, numToPx(width2));
  }
  function toggleAutoWidthClass(selectors, shouldAdd) {
    selectors.forEach((selector) => {
      const container = selector.querySelector(
        ".dataloom-cell--header__container, .dataloom-cell--body__container, .dataloom-cell--footer__container"
      );
      if (!container)
        return;
      const containerEl = container;
      if (shouldAdd) {
        containerEl.classList.add("dataloom-auto-width");
        containerEl.classList.add("dataloom-nowrap");
      } else {
        containerEl.classList.remove("dataloom-auto-width");
        containerEl.classList.remove("dataloom-nowrap");
      }
    });
  }
  const isDragging = columnId === currentResizingId;
  let innerClassName = "dataloom-column-resize__handle";
  if (isDragging)
    innerClassName += " dataloom-column-resize__handle--dragging";
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "dataloom-column-resize", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
    "div",
    {
      className: innerClassName,
      onMouseDown: (e) => {
        onMenuClose();
        handleMouseDown(e);
      },
      onTouchStart: handleTouchStart,
      onClick: (e) => {
        e.stopPropagation();
        if (e.detail === 2) {
          const selectors = document.body.querySelectorAll(
            `.dataloom-cell:nth-child(${columnIndex + 1})`
          );
          toggleAutoWidthClass(selectors, true);
          updateColumnWidth();
          setTimeout(() => {
            toggleAutoWidthClass(selectors, false);
          }, 0);
        }
      }
    }
  ) });
}

// src/react/loom-app/header-menu/index.tsx
var import_react21 = __toESM(require_react());

// src/react/shared/button/index.tsx
var import_js_logger8 = __toESM(require_logger());
var import_jsx_runtime20 = __toESM(require_jsx_runtime());
function Button({
  isDisabled = false,
  variant = "text",
  isFullWidth,
  isFocusable = true,
  size = "md",
  invertFocusColor,
  children,
  ariaLabel = "",
  icon,
  onClick,
  onMouseDown
}) {
  function handleClick() {
    onClick == null ? void 0 : onClick();
  }
  function handleKeyDown(e) {
    import_js_logger8.default.trace("Button handleKeyDown");
    if (e.key === "Enter") {
      e.preventDefault();
      e.stopPropagation();
      onClick == null ? void 0 : onClick();
    }
  }
  let className = "dataloom-button";
  if (isFocusable) {
    className += " dataloom-focusable";
    if (invertFocusColor)
      className += " dataloom-focusable--inverted";
  }
  if (variant == "link")
    className += " dataloom-button--link";
  else if (variant == "text")
    className += " dataloom-button--text";
  if (size == "sm")
    className += " dataloom-button--sm";
  else if (size == "md")
    className += " dataloom-button--md";
  else if (size == "lg")
    className += " dataloom-button--lg";
  if (isFullWidth)
    className += " dataloom-button--full-width";
  return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
    "button",
    {
      disabled: isDisabled,
      tabIndex: isFocusable ? 0 : -1,
      className,
      "aria-label": ariaLabel,
      onKeyDown: handleKeyDown,
      onMouseDown,
      onClick: handleClick,
      children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Stack, { isHorizontal: true, children: [
        icon && icon,
        children
      ] })
    }
  );
}

// src/react/shared/submenu/index.tsx
var import_jsx_runtime21 = __toESM(require_jsx_runtime());
function Submenu({
  title,
  showBackButton = true,
  children,
  onBackClick
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Padding, { p: "sm", children: [
    /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Stack, { spacing: "md", children: [
      /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Stack, { isHorizontal: true, children: [
        showBackButton && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
          Button,
          {
            icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon, { lucideId: "arrow-left" }),
            onClick: () => {
              onBackClick();
            }
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Padding, { pr: "md", children: title })
      ] }),
      /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Divider, {})
    ] }),
    children
  ] });
}

// src/react/loom-app/header-menu/option-submenu.tsx
var import_jsx_runtime22 = __toESM(require_jsx_runtime());
function OptionSubmenu({
  type,
  hour12,
  currencyType,
  numberFormat,
  numberPrefix,
  numberSuffix,
  numberSeparator,
  aspectRatio,
  dateFormatSeparator,
  verticalPadding,
  horizontalPadding,
  title,
  dateFormat,
  multiTagSortDir,
  onBackClick,
  onSubmenuChange
}) {
  const numberFormatDisplayName = numberFormat === "number" /* NUMBER */ ? "Number" : getDisplayNameForCurrencyType(currencyType);
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Submenu, { title, onBackClick, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Padding, { pt: "sm", pb: "lg", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Stack, { spacing: "sm", children: [
    type === "embed" /* EMBED */ && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
      MenuItem,
      {
        name: "Aspect ratio",
        value: aspectRatio,
        onClick: () => onSubmenuChange(8 /* ASPECT_RATIO */)
      }
    ),
    type === "embed" /* EMBED */ && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
      MenuItem,
      {
        name: "Horizontal padding",
        value: horizontalPadding,
        onClick: () => onSubmenuChange(5 /* HORIZONTAL_PADDING */)
      }
    ),
    type === "embed" /* EMBED */ && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
      MenuItem,
      {
        name: "Vertical padding",
        value: verticalPadding,
        onClick: () => onSubmenuChange(7 /* VERTICAL_PADDING */)
      }
    ),
    type === "number" /* NUMBER */ && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
      MenuItem,
      {
        name: "Number format",
        value: numberFormatDisplayName,
        onClick: () => onSubmenuChange(2 /* CURRENCY */)
      }
    ),
    type === "number" /* NUMBER */ && numberFormat == "number" /* NUMBER */ && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
      MenuItem,
      {
        name: "Prefix",
        value: numberPrefix,
        onClick: () => onSubmenuChange(
          9 /* TEXT_INPUT_NUMBER_PREFIX */
        )
      }
    ),
    type === "number" /* NUMBER */ && numberFormat == "number" /* NUMBER */ && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
      MenuItem,
      {
        name: "Suffix",
        value: numberSuffix,
        onClick: () => onSubmenuChange(
          10 /* TEXT_INPUT_NUMBER_SUFFIX */
        )
      }
    ),
    type === "number" /* NUMBER */ && numberFormat == "number" /* NUMBER */ && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
      MenuItem,
      {
        name: "Separator",
        value: numberSeparator,
        onClick: () => onSubmenuChange(
          11 /* TEXT_INPUT_NUMBER_SEPARATOR */
        )
      }
    ),
    (type === "creation-time" /* CREATION_TIME */ || type === "last-edited-time" /* LAST_EDITED_TIME */) && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
        MenuItem,
        {
          name: "Date format",
          value: getDisplayNameForDateFormat(dateFormat),
          onClick: () => onSubmenuChange(3 /* DATE_FORMAT */)
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
        MenuItem,
        {
          name: "Date separator",
          value: getDisplayNameForDateFormatSeparator(
            dateFormatSeparator
          ),
          onClick: () => onSubmenuChange(
            4 /* DATE_FORMAT_SEPARATOR */
          )
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
        MenuItem,
        {
          name: "Time format",
          value: hour12 ? "12 hour" : "24 hour",
          onClick: () => onSubmenuChange(6 /* TIME_FORMAT */)
        }
      )
    ] }),
    type === "multi-tag" /* MULTI_TAG */ && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
      MenuItem,
      {
        name: "Sort",
        value: getDisplayNameForSortDir(multiTagSortDir),
        onClick: () => onSubmenuChange(13 /* CONTENTS_SORT_DIR */)
      }
    )
  ] }) }) });
}

// src/react/shared/icon/utils.tsx
var getIconIdForSourceType = (type, options) => {
  const { propertyType } = options != null ? options : {};
  if (type === "folder" /* FOLDER */) {
    return "folder";
  } else if (type === "frontmatter" /* FRONTMATTER */) {
    switch (propertyType) {
      case "text" /* TEXT */:
        return "text";
      case "aliases" /* ALIASES */:
        return "corner-up-right";
      case "tags" /* TAGS */:
        return "tags";
      case "multitext" /* MULTITEXT */:
        return "list";
      case "date" /* DATE */:
        return "calendar";
      case "datetime" /* DATETIME */:
        return "clock";
      case "checkbox" /* CHECKBOX */:
        return "check-square";
      case "number" /* NUMBER */:
        return "hash";
      default:
        throw new Error(`Property type not handled: ${propertyType}`);
    }
  }
  return "";
};
var getIconIdForCellType = (type) => {
  switch (type) {
    case "text" /* TEXT */:
      return "text";
    case "embed" /* EMBED */:
      return "link";
    case "source-file" /* SOURCE_FILE */:
    case "file" /* FILE */:
      return "file";
    case "number" /* NUMBER */:
      return "hash";
    case "checkbox" /* CHECKBOX */:
      return "check-square";
    case "creation-time" /* CREATION_TIME */:
    case "last-edited-time" /* LAST_EDITED_TIME */:
      return "clock-2";
    case "tag" /* TAG */:
      return "tag";
    case "multi-tag" /* MULTI_TAG */:
      return "tags";
    case "date" /* DATE */:
      return "calendar";
    case "source" /* SOURCE */:
      return "rss";
    default:
      return "text";
  }
};

// src/react/loom-app/header-menu/type-submenu.tsx
var import_jsx_runtime23 = __toESM(require_jsx_runtime());
function TypeSubmenu({
  title,
  value,
  onValueClick,
  onBackClick
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Submenu, { title, onBackClick, children: Object.values(CellType2).filter(
    (type) => type !== "source" /* SOURCE */ && type !== "source-file" /* SOURCE_FILE */
  ).map((type) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
    MenuItem,
    {
      name: getDisplayNameForCellType(type),
      lucideId: getIconIdForCellType(type),
      onClick: () => onValueClick(type),
      isSelected: type === value
    },
    type
  )) });
}

// src/react/loom-app/header-menu/number-format-submenu/index.tsx
var import_jsx_runtime24 = __toESM(require_jsx_runtime());
function NumberFormatSubmenu({
  title,
  format,
  currency,
  onNumberFormatChange,
  onBackClick
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Submenu, { title, onBackClick, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "dataloom-number-format-submenu", children: [
    /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
      MenuItem,
      {
        name: "Number",
        onClick: () => onNumberFormatChange("number" /* NUMBER */),
        isSelected: format === "number" /* NUMBER */
      }
    ),
    Object.values(CurrencyType2).map((type) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
      MenuItem,
      {
        name: getDisplayNameForCurrencyType(type),
        onClick: () => onNumberFormatChange("currency" /* CURRENCY */, {
          currency: type
        }),
        isSelected: type === currency && format === "currency" /* CURRENCY */
      },
      type
    ))
  ] }) });
}

// src/react/loom-app/header-menu/text-input-submenu.tsx
var import_react18 = __toESM(require_react());

// src/react/shared/input/index.tsx
var import_react17 = __toESM(require_react());
var import_jsx_runtime25 = __toESM(require_jsx_runtime());
var Input = import_react17.default.forwardRef(
  ({
    id: id2,
    isTransparent,
    showBorder,
    hasError,
    value,
    autoFocus = true,
    isDisabled = false,
    focusOutline = "accent",
    placeholder,
    isNumeric,
    onChange,
    onKeyDown,
    onBlur
  }, ref) => {
    function handleChange(e) {
      const inputValue = e.target.value;
      if (isNumeric) {
        if (!isNumberInput(inputValue))
          return;
      }
      onChange(inputValue);
    }
    let className = "dataloom-input dataloom-focusable";
    if (isTransparent) {
      className += " dataloom-input--transparent";
    } else if (showBorder) {
      className += " dataloom-input--border";
    }
    if (isNumeric)
      className += " dataloom-input--numeric";
    if (focusOutline === "default") {
      className += " dataloom-input__focus-outline--default";
    } else if (focusOutline === "none") {
      className += " dataloom-input__focus-outline--none";
    }
    if (hasError)
      className += " dataloom-input--error";
    return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
      "input",
      {
        id: id2,
        ref,
        className,
        placeholder,
        disabled: isDisabled,
        type: "text",
        inputMode: isNumeric ? "numeric" : void 0,
        autoFocus,
        value,
        onChange: handleChange,
        onKeyDown,
        onBlur
      }
    );
  }
);
var input_default = Input;

// src/react/loom-app/header-menu/text-input-submenu.tsx
var import_jsx_runtime26 = __toESM(require_jsx_runtime());
function TextInputSubmenu({
  title,
  value,
  onValueChange,
  onBackClick,
  closeRequest,
  onClose
}) {
  const [textValue, setTextValue] = import_react18.default.useState(value);
  import_react18.default.useEffect(() => {
    if (closeRequest !== null) {
      onValueChange(textValue);
      onClose();
    }
  }, [onValueChange, textValue, closeRequest, onClose]);
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Submenu, { title, onBackClick, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(input_default, { value: textValue, onChange: setTextValue }) });
}

// src/react/loom-app/header-menu/date-format-submenu.tsx
var import_jsx_runtime27 = __toESM(require_jsx_runtime());
function DateFormatSubmenu({
  title,
  value,
  onValueClick,
  onBackClick
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Submenu, { title, onBackClick, children: Object.values(DateFormat2).map((format) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
    MenuItem,
    {
      name: getDisplayNameForDateFormat(format),
      onClick: () => onValueClick(format),
      isSelected: format === value
    },
    format
  )) });
}

// src/react/loom-app/header-menu/aspect-ratio-submenu.tsx
var import_jsx_runtime28 = __toESM(require_jsx_runtime());
function AspectRatioSubmenu({
  title,
  value,
  onValueClick,
  onBackClick
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Submenu, { title, onBackClick, children: Object.values(AspectRatio2).map((ratio) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
    MenuItem,
    {
      name: ratio,
      onClick: () => onValueClick(ratio),
      isSelected: ratio === value
    },
    ratio
  )) });
}

// src/react/loom-app/header-menu/padding-submenu.tsx
var import_jsx_runtime29 = __toESM(require_jsx_runtime());
function PaddingSubmenu({
  title,
  value,
  onValueClick,
  onBackClick
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Submenu, { title, onBackClick, children: Object.values(PaddingSize2).map((size) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
    MenuItem,
    {
      name: size,
      onClick: () => onValueClick(size),
      isSelected: size === value
    },
    size
  )) });
}

// src/react/loom-app/header-menu/frontmatter-key-submenu.tsx
var import_jsx_runtime30 = __toESM(require_jsx_runtime());
function FrontmatterKeySubmenu({
  title,
  selectedKey,
  frontmatterKeys,
  onBackClick,
  onFrontmatterKeyChange
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Submenu, { title, onBackClick, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Padding, { pt: "md", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Stack, { spacing: "sm", children: [
    frontmatterKeys.map((key) => {
      const { value, isSelectable } = key;
      const isSelected = selectedKey === value;
      return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
        MenuItem,
        {
          isDisabled: !isSelectable,
          isSelected,
          name: value,
          onClick: () => onFrontmatterKeyChange(value)
        },
        value
      );
    }),
    /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Divider, {}),
    /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
      MenuItem,
      {
        name: "Clear",
        onClick: () => onFrontmatterKeyChange(null)
      }
    )
  ] }) }) });
}

// src/react/loom-app/header-menu/base-submenu.tsx
var import_react20 = __toESM(require_react());

// src/redux/hooks.ts
var useAppSelector = useSelector;

// src/react/shared/switch/index.tsx
var import_jsx_runtime31 = __toESM(require_jsx_runtime());
function Switch({ id: id2, value, ariaLabel, onToggle }) {
  const { isDarkMode } = useAppSelector((state) => state.global);
  function handleKeyDown(e) {
    if (e.key === "Enter") {
      e.stopPropagation();
      onToggle(!value);
    }
  }
  function handleClick(e) {
    e.stopPropagation();
    onToggle(!value);
  }
  let className = "checkbox-container dataloom-switch dataloom-focusable";
  if (value)
    className += " is-enabled";
  if (isDarkMode)
    className += " dataloom-switch--dark";
  return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
    "div",
    {
      tabIndex: 0,
      className,
      "aria-label": ariaLabel,
      onClick: handleClick,
      onKeyDown: handleKeyDown,
      children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("input", { id: id2, type: "checkbox" })
    }
  );
}

// src/shared/hooks.ts
var import_react19 = __toESM(require_react());
var usePrevious = (value) => {
  const ref = import_react19.default.useRef();
  import_react19.default.useEffect(() => {
    ref.current = value;
  });
  return ref.current;
};
var usePlaceCursorAtEnd = (inputRef, value) => {
  import_react19.default.useEffect(() => {
    function setSelection() {
      if (inputRef.current) {
        inputRef.current.selectionStart = value.length;
        inputRef.current.selectionEnd = value.length;
      }
    }
    setSelection();
  }, [inputRef]);
};

// src/react/loom-app/header-menu/base-submenu.tsx
var import_jsx_runtime32 = __toESM(require_jsx_runtime());
function BaseSubmenu({
  index,
  shouldWrapOverflow,
  numFrozenColumns,
  numSources,
  frontmatterKey,
  columnName,
  columnId,
  columnType,
  columnSortDir,
  canDeleteColumn,
  onSortClick,
  onSubmenuChange,
  onWrapOverflowToggle,
  onDeleteClick,
  onColumnNameChange,
  onHideClick,
  onFrozenColumnsChange
}) {
  const inputRef = import_react20.default.useRef(null);
  usePlaceCursorAtEnd(inputRef, columnName);
  import_react20.default.useEffect(() => {
    if (inputRef.current) {
      inputRef.current.focus();
    }
  }, [inputRef]);
  function handleInputChange(inputValue) {
    onColumnNameChange(inputValue);
  }
  const hasOptions = columnType === "embed" /* EMBED */ || columnType === "number" /* NUMBER */ || columnType === "last-edited-time" /* LAST_EDITED_TIME */ || columnType === "creation-time" /* CREATION_TIME */ || columnType === "multi-tag" /* MULTI_TAG */;
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Stack, { spacing: "sm", children: [
    /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Stack, { spacing: "sm", width: "100%", children: [
      /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Padding, { px: "md", py: "sm", width: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
        input_default,
        {
          ref: inputRef,
          isDisabled: columnType === "source" /* SOURCE */ || columnType === "source-file" /* SOURCE_FILE */,
          showBorder: true,
          value: columnName,
          onChange: handleInputChange
        }
      ) }),
      columnType !== "source" /* SOURCE */ && columnType !== "source-file" /* SOURCE_FILE */ && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
        MenuItem,
        {
          lucideId: "list",
          name: "Type",
          value: getDisplayNameForCellType(columnType),
          onClick: () => {
            onSubmenuChange(0 /* TYPE */);
          }
        }
      ),
      numSources > 0 && columnType !== "source" /* SOURCE */ && columnType !== "source-file" /* SOURCE_FILE */ && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
        MenuItem,
        {
          lucideId: "file-key-2",
          name: "Frontmatter key",
          value: frontmatterKey || "No key set",
          onClick: () => {
            onSubmenuChange(12 /* FRONTMATTER_KEY */);
          }
        }
      ),
      hasOptions && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
        MenuItem,
        {
          lucideId: "settings",
          name: "Options",
          onClick: () => {
            onSubmenuChange(1 /* OPTIONS */);
          }
        }
      )
    ] }),
    /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Divider, {}),
    /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
      MenuItem,
      {
        lucideId: "arrow-up",
        name: "Ascending",
        onClick: () => onSortClick("asc" /* ASC */),
        isSelected: columnSortDir === "asc" /* ASC */
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
      MenuItem,
      {
        lucideId: "arrow-down",
        name: "Descending",
        onClick: () => onSortClick("desc" /* DESC */),
        isSelected: columnSortDir === "desc" /* DESC */
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Divider, {}),
    /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
      MenuItem,
      {
        lucideId: "eye-off",
        name: "Hide",
        onClick: () => onHideClick()
      }
    ),
    index < 4 && numFrozenColumns !== index + 1 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
      MenuItem,
      {
        lucideId: "pin",
        name: "Freeze up to column",
        onClick: () => onFrozenColumnsChange(index + 1)
      }
    ),
    numFrozenColumns === index + 1 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
      MenuItem,
      {
        lucideId: "pin-off",
        name: "Unfreeze columns",
        onClick: () => onFrozenColumnsChange(1)
      }
    ),
    canDeleteColumn && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
      MenuItem,
      {
        lucideId: "trash",
        name: "Delete",
        onClick: () => onDeleteClick()
      }
    ),
    columnType !== "embed" /* EMBED */ && columnType !== "number" /* NUMBER */ && columnType !== "source" /* SOURCE */ && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Divider, {}),
      /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Padding, { px: "lg", py: "md", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Flex, { justify: "space-between", align: "center", children: [
        /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Text, { value: "Wrap content" }),
        /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
          Switch,
          {
            value: shouldWrapOverflow,
            onToggle: (value) => onWrapOverflowToggle(columnId, value)
          }
        )
      ] }) })
    ] })
  ] });
}

// src/react/loom-app/header-menu/date-format-separator-submenu.tsx
var import_jsx_runtime33 = __toESM(require_jsx_runtime());
function DateFormatSeparatorSubmenu({
  title,
  value,
  onValueClick,
  onBackClick
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Submenu, { title, onBackClick, children: Object.values(DateFormatSeparator).map((format) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
    MenuItem,
    {
      name: getDisplayNameForDateFormatSeparator(format),
      onClick: () => onValueClick(format),
      isSelected: format === value
    },
    format
  )) });
}

// src/react/loom-app/header-menu/time-format-submenu.tsx
var import_jsx_runtime34 = __toESM(require_jsx_runtime());
function TimeFormatSubmenu({
  title,
  value,
  onValueClick,
  onBackClick
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Submenu, { title, onBackClick, children: [
    /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
      MenuItem,
      {
        name: "12 hour",
        onClick: () => onValueClick(true),
        isSelected: value === true
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
      MenuItem,
      {
        name: "24 hour",
        onClick: () => onValueClick(false),
        isSelected: value === false
      }
    )
  ] });
}

// src/react/loom-app/header-menu/multitag-sort-dir-submenu.tsx
var import_jsx_runtime35 = __toESM(require_jsx_runtime());
function MultiTagSortDirSubmenu({
  title,
  value,
  onValueClick,
  onBackClick
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Submenu, { title, onBackClick, children: [
    /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
      MenuItem,
      {
        name: "Ascending",
        onClick: () => onValueClick("asc" /* ASC */),
        isSelected: value === "asc" /* ASC */
      },
      "asc" /* ASC */
    ),
    /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
      MenuItem,
      {
        name: "Descending",
        onClick: () => onValueClick("desc" /* DESC */),
        isSelected: value === "desc" /* DESC */
      },
      "desc" /* DESC */
    ),
    /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
      MenuItem,
      {
        name: "Default",
        onClick: () => onValueClick("default" /* NONE */),
        isSelected: value === "default" /* NONE */
      },
      "default" /* NONE */
    )
  ] });
}

// src/react/loom-app/header-menu/index.tsx
var import_jsx_runtime36 = __toESM(require_jsx_runtime());
function HeaderMenu({
  index,
  isOpen,
  numSources,
  column,
  id: id2,
  position,
  numFrozenColumns,
  frontmatterKeys,
  canDeleteColumn,
  closeRequest,
  onColumnDeleteClick,
  onClose,
  onFrozenColumnsChange,
  onColumnChange,
  onColumnTypeChange
}) {
  const {
    id: columnId,
    content,
    type,
    sortDir,
    dateFormat,
    aspectRatio,
    hour12,
    dateFormatSeparator,
    verticalPadding,
    horizontalPadding,
    shouldWrapOverflow,
    numberFormat,
    currencyType,
    numberPrefix,
    numberSeparator,
    numberSuffix,
    frontmatterKey,
    multiTagSortDir
  } = column;
  const [submenu, setSubmenu] = import_react21.default.useState(null);
  const [localValue, setLocalValue] = import_react21.default.useState(content);
  const saveLocalValue = import_react21.default.useCallback(() => {
    if (localValue !== content)
      onColumnChange(columnId, { content: localValue });
  }, [columnId, content, localValue, onColumnChange]);
  import_react21.default.useEffect(() => {
    if (closeRequest !== null) {
      saveLocalValue();
      onClose();
    }
  }, [
    content,
    columnId,
    closeRequest,
    saveLocalValue,
    submenu,
    localValue,
    onColumnChange,
    onClose
  ]);
  function handleWrapOverflowToggle() {
    onColumnChange(columnId, { shouldWrapOverflow: !shouldWrapOverflow });
  }
  function handleSortClick(sortDir2) {
    onColumnChange(columnId, { sortDir: sortDir2 }, { shouldSortRows: true });
    saveLocalValue();
    onClose();
  }
  function handleAspectRatioClick(value) {
    onColumnChange(columnId, { aspectRatio: value });
    saveLocalValue();
    onClose();
    setSubmenu(1 /* OPTIONS */);
  }
  function handleHorizontalPaddingClick(value) {
    onColumnChange(columnId, { horizontalPadding: value });
    saveLocalValue();
    onClose();
    setSubmenu(1 /* OPTIONS */);
  }
  function handleVerticalPaddingClick(value) {
    onColumnChange(columnId, { verticalPadding: value });
    saveLocalValue();
    onClose();
    setSubmenu(1 /* OPTIONS */);
  }
  function handleTypeClick(type2) {
    onColumnTypeChange(columnId, type2);
    saveLocalValue();
    onClose();
    setSubmenu(null);
  }
  function handleFrozenColumnsChange(value) {
    onFrozenColumnsChange(value);
    saveLocalValue();
    onClose();
    setSubmenu(null);
  }
  function handleHideClick() {
    onColumnChange(columnId, { isVisible: false });
    saveLocalValue();
    onClose();
    setSubmenu(null);
  }
  function handleDeleteClick() {
    onColumnDeleteClick(columnId);
    saveLocalValue();
    onClose();
    setSubmenu(null);
  }
  function handleNumberFormatChange(value, options) {
    onColumnChange(
      columnId,
      {
        numberFormat: value,
        ...(options == null ? void 0 : options.currency) && {
          currencyType: options.currency
        }
      },
      { shouldSortRows: true }
    );
    setSubmenu(1 /* OPTIONS */);
  }
  function handleNumberOptionChange(value) {
    submenu === 9 /* TEXT_INPUT_NUMBER_PREFIX */ && onColumnChange(
      columnId,
      { numberPrefix: value },
      { shouldSortRows: true }
    );
    submenu === 10 /* TEXT_INPUT_NUMBER_SUFFIX */ && onColumnChange(
      columnId,
      { numberSuffix: value },
      { shouldSortRows: true }
    );
    submenu === 11 /* TEXT_INPUT_NUMBER_SEPARATOR */ && onColumnChange(
      columnId,
      { numberSeparator: value },
      { shouldSortRows: true }
    );
    setSubmenu(null);
  }
  function handleDateFormatClick(value) {
    onColumnChange(columnId, { dateFormat: value });
    setSubmenu(1 /* OPTIONS */);
  }
  function handleDateFormatSeparatorClick(value) {
    onColumnChange(columnId, { dateFormatSeparator: value });
    setSubmenu(1 /* OPTIONS */);
  }
  function handleTimeFormatClick(value) {
    onColumnChange(columnId, { hour12: value });
    setSubmenu(1 /* OPTIONS */);
  }
  function handleFrontmatterKeyChange(frontmatterKey2) {
    onColumnChange(
      columnId,
      {
        frontmatterKey: frontmatterKey2
      },
      {
        shouldSaveFrontmatter: false
      }
    );
    onClose();
  }
  function handleMultiTagSortDirClick(value) {
    onColumnChange(columnId, { multiTagSortDir: value });
    setSubmenu(1 /* OPTIONS */);
  }
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Menu, { isOpen, id: id2, position, width: 190, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "dataloom-header-menu", children: [
    submenu === null && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
      BaseSubmenu,
      {
        index,
        numSources,
        canDeleteColumn,
        shouldWrapOverflow,
        numFrozenColumns,
        frontmatterKey,
        columnId,
        columnName: localValue,
        columnType: type,
        columnSortDir: sortDir,
        onColumnNameChange: setLocalValue,
        onSortClick: handleSortClick,
        onSubmenuChange: setSubmenu,
        onWrapOverflowToggle: handleWrapOverflowToggle,
        onDeleteClick: handleDeleteClick,
        onHideClick: handleHideClick,
        onFrozenColumnsChange: handleFrozenColumnsChange
      }
    ),
    submenu === 1 /* OPTIONS */ && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
      OptionSubmenu,
      {
        title: "Options",
        type,
        hour12,
        horizontalPadding,
        verticalPadding,
        dateFormatSeparator,
        aspectRatio,
        dateFormat,
        numberFormat,
        currencyType,
        numberPrefix,
        numberSuffix,
        numberSeparator,
        multiTagSortDir,
        onBackClick: () => setSubmenu(null),
        onSubmenuChange: setSubmenu
      }
    ),
    submenu === 8 /* ASPECT_RATIO */ && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
      AspectRatioSubmenu,
      {
        title: "Aspect ratio",
        value: aspectRatio,
        onValueClick: handleAspectRatioClick,
        onBackClick: () => setSubmenu(null)
      }
    ),
    submenu === 5 /* HORIZONTAL_PADDING */ && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
      PaddingSubmenu,
      {
        title: "Horizontal padding",
        value: horizontalPadding,
        onValueClick: handleHorizontalPaddingClick,
        onBackClick: () => setSubmenu(null)
      }
    ),
    submenu === 7 /* VERTICAL_PADDING */ && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
      PaddingSubmenu,
      {
        title: "Vertical padding",
        value: verticalPadding,
        onValueClick: handleVerticalPaddingClick,
        onBackClick: () => setSubmenu(null)
      }
    ),
    submenu === 0 /* TYPE */ && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
      TypeSubmenu,
      {
        title: "Type",
        value: type,
        onValueClick: handleTypeClick,
        onBackClick: () => setSubmenu(null)
      }
    ),
    submenu === 3 /* DATE_FORMAT */ && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
      DateFormatSubmenu,
      {
        title: "Date format",
        value: dateFormat,
        onValueClick: handleDateFormatClick,
        onBackClick: () => setSubmenu(1 /* OPTIONS */)
      }
    ),
    submenu === 4 /* DATE_FORMAT_SEPARATOR */ && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
      DateFormatSeparatorSubmenu,
      {
        title: "Date separator",
        value: dateFormatSeparator,
        onValueClick: handleDateFormatSeparatorClick,
        onBackClick: () => setSubmenu(1 /* OPTIONS */)
      }
    ),
    submenu === 6 /* TIME_FORMAT */ && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
      TimeFormatSubmenu,
      {
        title: "Time format",
        value: hour12,
        onValueClick: handleTimeFormatClick,
        onBackClick: () => setSubmenu(1 /* OPTIONS */)
      }
    ),
    submenu === 2 /* CURRENCY */ && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
      NumberFormatSubmenu,
      {
        title: "Number format",
        format: numberFormat,
        currency: currencyType,
        onNumberFormatChange: handleNumberFormatChange,
        onBackClick: () => setSubmenu(1 /* OPTIONS */)
      }
    ),
    submenu === 9 /* TEXT_INPUT_NUMBER_PREFIX */ && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
      TextInputSubmenu,
      {
        title: "Prefix",
        value: numberPrefix,
        closeRequest,
        onValueChange: handleNumberOptionChange,
        onClose,
        onBackClick: () => setSubmenu(1 /* OPTIONS */)
      }
    ),
    submenu === 10 /* TEXT_INPUT_NUMBER_SUFFIX */ && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
      TextInputSubmenu,
      {
        title: "Suffix",
        closeRequest,
        value: numberSuffix,
        onClose,
        onValueChange: handleNumberOptionChange,
        onBackClick: () => setSubmenu(1 /* OPTIONS */)
      }
    ),
    submenu === 11 /* TEXT_INPUT_NUMBER_SEPARATOR */ && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
      TextInputSubmenu,
      {
        title: "Separator",
        closeRequest,
        value: numberSeparator,
        onClose,
        onValueChange: handleNumberOptionChange,
        onBackClick: () => setSubmenu(1 /* OPTIONS */)
      }
    ),
    submenu === 12 /* FRONTMATTER_KEY */ && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
      FrontmatterKeySubmenu,
      {
        title: "Frontmatter key",
        selectedKey: frontmatterKey,
        frontmatterKeys,
        onFrontmatterKeyChange: handleFrontmatterKeyChange,
        onBackClick: () => setSubmenu(null)
      }
    ),
    submenu === 13 /* CONTENTS_SORT_DIR */ && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
      MultiTagSortDirSubmenu,
      {
        title: "Sort",
        value: multiTagSortDir,
        onValueClick: handleMultiTagSortDirClick,
        onBackClick: () => setSubmenu(null)
      }
    )
  ] }) });
}

// src/react/loom-app/header-cell-container/index.tsx
var import_jsx_runtime37 = __toESM(require_jsx_runtime());
function HeaderCellContainer({
  index,
  column,
  numSources,
  numColumns,
  frontmatterKeys,
  numFrozenColumns,
  resizingColumnId,
  onColumnChange,
  onColumnDeleteClick,
  onFrozenColumnsChange,
  onColumnTypeChange
}) {
  const { id: columnId, type, width, content } = column;
  const COMPONENT_ID = `header-cell-${columnId}`;
  const menu = useMenu(COMPONENT_ID);
  const lucideId = getIconIdForCellType(type);
  let contentClassName = "dataloom-cell--header__inner-container";
  if (resizingColumnId == null)
    contentClassName += " dataloom-selectable";
  return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
    /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
      menu_trigger_default,
      {
        ref: menu.triggerRef,
        menuId: menu.id,
        variant: "cell",
        isFocused: menu.isTriggerFocused,
        level: 1 /* ONE */,
        shouldRunTrigger: resizingColumnId === null,
        onOpen: () => menu.onOpen(1 /* ONE */, {
          shouldRequestOnClose: true
        }),
        children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
          "div",
          {
            className: "dataloom-cell--header__container",
            style: {
              width
            },
            children: [
              /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: contentClassName, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Stack, { isHorizontal: true, spacing: "md", align: "center", children: [
                /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Icon, { lucideId, size: "md" }),
                content
              ] }) }),
              /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
                ColumnResize,
                {
                  columnIndex: index,
                  currentResizingId: resizingColumnId,
                  columnId,
                  width,
                  onWidthChange: (id2, value) => {
                    onColumnChange(id2, {
                      width: value
                    });
                  },
                  onMenuClose: menu.onClose
                }
              )
            ]
          }
        )
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
      HeaderMenu,
      {
        id: menu.id,
        index,
        isOpen: menu.isOpen,
        numSources,
        closeRequest: menu.closeRequest,
        frontmatterKeys,
        position: menu.position,
        numFrozenColumns,
        column,
        canDeleteColumn: numColumns > 1 && type !== "source-file" /* SOURCE_FILE */ && type !== "source" /* SOURCE */,
        numColumns,
        onColumnDeleteClick,
        onColumnChange,
        onClose: menu.onClose,
        onFrozenColumnsChange,
        onColumnTypeChange
      }
    )
  ] });
}

// src/shared/dragging/drag-context.tsx
var import_react22 = __toESM(require_react());
var import_jsx_runtime38 = __toESM(require_jsx_runtime());
var DragContext = import_react22.default.createContext(null);
var useDragContext = () => {
  const value = import_react22.default.useContext(DragContext);
  if (value === null) {
    throw new Error(
      "useDragContext() called without a <DragProvider /> in the tree."
    );
  }
  return value;
};
function DragProvider({ children }) {
  const [dragData, setDragData] = import_react22.default.useState(null);
  const [touchDropZone, setTouchDropZone] = import_react22.default.useState(
    null
  );
  return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
    DragContext.Provider,
    {
      value: { dragData, touchDropZone, setDragData, setTouchDropZone },
      children
    }
  );
}

// src/shared/dragging/utils.ts
var getRowId = (rowEl) => {
  const td = rowEl.firstChild;
  if (!td)
    return null;
  const id2 = td.getAttribute("data-row-id");
  return id2 != null ? id2 : null;
};

// src/react/loom-app/table/body-row.tsx
var import_jsx_runtime39 = __toESM(require_jsx_runtime());
function BodyRow({
  style,
  children,
  onRowReorder,
  ...props
}) {
  const { loomState } = useLoomState();
  const { dragData, setDragData } = useDragContext();
  function handleDragStart(e) {
    const el = e.target;
    const rowId = getRowId(el);
    if (!rowId)
      return;
    setDragData({
      type: "row",
      id: rowId
    });
  }
  function handleDragEnd(e) {
    const el = e.target;
    el.draggable = false;
    setDragData(null);
  }
  function handleDrop(e) {
    e.preventDefault();
    const target = e.currentTarget;
    const targetId = getRowId(target);
    if (!targetId)
      return;
    if (dragData === null)
      throw Error("No drag data found");
    if (dragData.type !== "row")
      return;
    if (!confirmSortOrderChange(loomState))
      return;
    onRowReorder(dragData.id, targetId);
  }
  function handleDragOver(e) {
    e.preventDefault();
  }
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
    "div",
    {
      className: "dataloom-row",
      onDrop: handleDrop,
      onDragStart: handleDragStart,
      onDragEnd: handleDragEnd,
      onDragOver: handleDragOver,
      ...props,
      style,
      children
    }
  );
}

// src/react/loom-app/table/header-cell.tsx
var import_react24 = __toESM(require_react());

// src/react/loom-app/table/hooks.tsx
var import_react23 = __toESM(require_react());
var useStickyOffset = (ref, numFrozenColumns, columnIndex) => {
  const [columnWidths, setColumnWidths] = import_react23.default.useState([]);
  import_react23.default.useEffect(() => {
    if (!ref.current)
      return;
    if (columnIndex + 1 > numFrozenColumns)
      return;
    const tableEl = ref.current.closest(".dataloom-table");
    if (!tableEl)
      return;
    const columns = tableEl.querySelectorAll(".dataloom-cell--header");
    if (!columns)
      return;
    const observers = [];
    columns.forEach((column, i2) => {
      if (i2 < columnIndex) {
        const observer = new ResizeObserver(() => {
          const rect = column.getBoundingClientRect();
          setColumnWidths((prevState) => {
            const newState = [...prevState];
            newState[i2] = rect.width;
            return newState;
          });
        });
        observer.observe(column);
        observers.push(observer);
      }
    });
    return () => {
      observers.forEach((observer) => observer.disconnect());
    };
  }, [numFrozenColumns, columnIndex, ref]);
  const offset = columnWidths.reduce((a2, b2) => a2 + b2, 0);
  return offset;
};

// src/react/loom-app/table/header-cell.tsx
var import_jsx_runtime40 = __toESM(require_jsx_runtime());
function HeaderCell({
  index,
  columnId,
  isDraggable,
  numFrozenColumns,
  content,
  onColumnReorder
}) {
  const { dragData, touchDropZone, setDragData, setTouchDropZone } = useDragContext();
  const ref = import_react24.default.useRef(null);
  const leftOffset = useStickyOffset(ref, numFrozenColumns, index);
  const shouldFreeze = index + 1 <= numFrozenColumns;
  function startDrag(el) {
    const columnId2 = getColumnId(el);
    if (!columnId2)
      return;
    setDragData({
      type: "column",
      id: columnId2
    });
  }
  function dropDrag(targetRowId) {
    if (dragData == null)
      throw new Error("No drag data found");
    if (dragData.type !== "column")
      return;
    onColumnReorder(dragData.id, targetRowId);
  }
  function addDragHover(thEl) {
    const child = thEl.firstChild;
    if (!child)
      return;
    if (child.classList.contains("dataloom-focusable"))
      thEl.classList.add("dataloom-th--drag-over");
  }
  function removeDragHover() {
    const el = document.querySelector(".dataloom-th--drag-over");
    if (el)
      el.classList.remove("dataloom-th--drag-over");
  }
  function getColumnId(columnEl) {
    const id2 = columnEl.getAttribute("data-column-id");
    if (!id2)
      return null;
    return id2;
  }
  function handleDragStart(e) {
    const el = e.target;
    startDrag(el);
  }
  function handleDrop(e) {
    e.preventDefault();
    const target = e.currentTarget;
    const targetId = getColumnId(target);
    if (!targetId)
      return;
    dropDrag(targetId);
  }
  function handleDragEnd() {
    setDragData(null);
  }
  function handleDragOver(e) {
    e.preventDefault();
  }
  function handleTouchStart(e) {
    e.stopPropagation();
    const el = e.currentTarget;
    startDrag(el);
  }
  const handleTouchMove = (e) => {
    e.stopPropagation();
    if (dragData == null)
      return;
    const { clientX, clientY } = e.touches[0];
    const elementUnderneath = document.elementFromPoint(clientX, clientY);
    if (!elementUnderneath)
      return;
    const thEl = elementUnderneath.closest(
      ".dataloom-cell--header"
    );
    if (!thEl)
      return;
    const targetId = getColumnId(thEl);
    if (!targetId)
      return;
    if (targetId === dragData.id)
      return;
    const { top, left, bottom, right } = thEl.getBoundingClientRect();
    setTouchDropZone({
      id: targetId,
      top,
      left,
      bottom,
      right
    });
    removeDragHover();
    if (thEl.lastChild)
      addDragHover(thEl);
  };
  function handleTouchEnd(e) {
    if (touchDropZone) {
      const touchX = e.changedTouches[0].clientX;
      const touchY = e.changedTouches[0].clientY;
      const isInsideDropZone = touchX >= touchDropZone.left && touchX <= touchDropZone.right && touchY >= touchDropZone.top && touchY <= touchDropZone.bottom;
      if (isInsideDropZone) {
        dropDrag(touchDropZone.id);
      }
    }
    setDragData(null);
    setTouchDropZone(null);
    removeDragHover();
  }
  function handleTouchCancel() {
    setDragData(null);
    setTouchDropZone(null);
    removeDragHover();
  }
  let className = "dataloom-cell dataloom-cell--header";
  if (shouldFreeze)
    className += " dataloom-cell--freeze dataloom-cell--freeze-header";
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
    "div",
    {
      className,
      ref,
      "data-column-id": columnId,
      style: {
        left: shouldFreeze ? numToPx(leftOffset) : void 0
      },
      ...isDraggable && {
        draggable: true,
        onDrop: handleDrop,
        onDragStart: handleDragStart,
        onDragOver: handleDragOver,
        onDragEnd: handleDragEnd,
        onTouchStart: handleTouchStart,
        onTouchMove: handleTouchMove,
        onTouchEnd: handleTouchEnd,
        onTouchCancel: handleTouchCancel
      },
      children: content
    }
  );
}

// src/react/loom-app/table/body-cell.tsx
var import_react25 = __toESM(require_react());
var import_jsx_runtime41 = __toESM(require_jsx_runtime());
function BodyCell({
  rowId,
  index,
  numFrozenColumns,
  contentNode
}) {
  const ref = import_react25.default.useRef(null);
  const leftOffset = useStickyOffset(ref, numFrozenColumns, index);
  const shouldFreeze = index + 1 <= numFrozenColumns;
  let className = "dataloom-cell dataloom-cell--body";
  if (shouldFreeze)
    className += " dataloom-cell--freeze";
  return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
    "div",
    {
      className,
      ref,
      "data-row-id": index === 0 ? rowId : void 0,
      style: { left: shouldFreeze ? numToPx(leftOffset) : void 0 },
      children: contentNode
    }
  );
}

// src/react/loom-app/table/footer-cell.tsx
var import_react26 = __toESM(require_react());
var import_jsx_runtime42 = __toESM(require_jsx_runtime());
function FooterCell({
  index,
  content,
  numFrozenColumns
}) {
  const ref = import_react26.default.useRef(null);
  const leftOffset = useStickyOffset(ref, numFrozenColumns, index);
  const shouldFreeze = index + 1 <= numFrozenColumns;
  let className = "dataloom-cell dataloom-cell--footer";
  if (shouldFreeze)
    className += " dataloom-cell--freeze dataloom-cell--freeze-footer";
  return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
    "div",
    {
      ref,
      className,
      style: {
        left: shouldFreeze ? numToPx(leftOffset) : void 0
      },
      children: content
    }
  );
}

// src/react/loom-app/new-column-button/index.tsx
var import_jsx_runtime43 = __toESM(require_jsx_runtime());
function NewColumnButton({ onClick }) {
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "dataloom-new-column", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
    Button,
    {
      icon: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Icon, { lucideId: "plus" }),
      ariaLabel: "New column",
      onClick: () => onClick()
    }
  ) });
}

// src/react/shared/menu-button/index.tsx
var import_react27 = __toESM(require_react());
var import_jsx_runtime44 = __toESM(require_jsx_runtime());
var MenuButton = import_react27.default.forwardRef(
  ({
    menuId,
    isDisabled,
    isFocused,
    variant,
    level,
    ariaLabel,
    icon,
    children,
    onClick,
    onMouseDown,
    onOpen
  }, ref) => {
    return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
      menu_trigger_default,
      {
        ref,
        menuId,
        isFocused,
        variant: "button",
        level,
        onClick,
        onMouseDown,
        onOpen,
        children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
          Button,
          {
            isDisabled,
            isFocusable: false,
            variant,
            icon,
            ariaLabel,
            children
          }
        )
      }
    );
  }
);
var menu_button_default = MenuButton;

// src/react/loom-app/row-options/row-menu/index.tsx
var import_jsx_runtime45 = __toESM(require_jsx_runtime());
function RowOptions({
  id: id2,
  isOpen,
  position,
  canDeleteRow,
  onDeleteClick,
  onInsertAboveClick,
  onInsertBelowClick
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
    Menu,
    {
      id: id2,
      isOpen,
      openDirection: "bottom-right",
      position,
      children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "dataloom-row-menu", children: [
        canDeleteRow && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
          MenuItem,
          {
            lucideId: "trash-2",
            name: "Delete",
            onClick: () => onDeleteClick()
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
          MenuItem,
          {
            lucideId: "chevrons-up",
            name: "Insert above",
            onClick: () => onInsertAboveClick()
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
          MenuItem,
          {
            lucideId: "chevrons-down",
            name: "Insert below",
            onClick: () => onInsertBelowClick()
          }
        )
      ] })
    }
  );
}

// src/react/loom-app/row-options/index.tsx
var import_jsx_runtime46 = __toESM(require_jsx_runtime());
function RowOptions2({
  rowId,
  source,
  onDeleteClick,
  onInsertAboveClick,
  onInsertBelowClick,
  onRowReorder
}) {
  const COMPONENT_ID = `row-options-${rowId}`;
  const menu = useMenu(COMPONENT_ID);
  const { dragData, touchDropZone, setDragData, setTouchDropZone } = useDragContext();
  const { loomState } = useLoomState();
  function handleDeleteClick() {
    onDeleteClick(rowId);
    menu.onClose();
  }
  function handleInsertAboveClick() {
    onInsertAboveClick(rowId);
    menu.onClose();
  }
  function handleInsertBelowClick() {
    onInsertBelowClick(rowId);
    menu.onClose();
  }
  function handleMouseDown(e) {
    const el = e.target;
    const row = el.closest(".dataloom-row");
    if (row) {
      row.setAttr("draggable", true);
      const dragStartEvent = new DragEvent("dragstart");
      Object.defineProperty(dragStartEvent, "target", {
        value: row
      });
      row.dispatchEvent(dragStartEvent);
    }
  }
  function handleTouchStart(e) {
    e.stopPropagation();
    const targetEl = e.currentTarget;
    const rowEl = targetEl.closest(".dataloom-row");
    if (!rowEl)
      throw new Error("Row not found");
    const rowId2 = getRowId(rowEl);
    if (!rowId2)
      return;
    setDragData({
      type: "row",
      id: rowId2
    });
  }
  const handleTouchMove = (e) => {
    e.stopPropagation();
    if (dragData == null)
      return;
    const { clientX, clientY } = e.touches[0];
    const elementUnderneath = document.elementFromPoint(clientX, clientY);
    if (!elementUnderneath)
      return;
    const rowEl = elementUnderneath.closest(
      ".dataloom-row"
    );
    if (!rowEl)
      return;
    const targetId = getRowId(rowEl);
    if (!targetId)
      return;
    if (targetId === dragData.id)
      return;
    const { top, left, bottom, right } = rowEl.getBoundingClientRect();
    setTouchDropZone({
      id: targetId,
      top,
      left,
      bottom,
      right
    });
    removeDragHover();
    addDragHover(rowEl);
  };
  function handleTouchCancel() {
    endDrag();
  }
  function handleTouchEnd(e) {
    if (touchDropZone) {
      const touchX = e.changedTouches[0].clientX;
      const touchY = e.changedTouches[0].clientY;
      const isInsideDropZone = touchX >= touchDropZone.left && touchX <= touchDropZone.right && touchY >= touchDropZone.top && touchY <= touchDropZone.bottom;
      if (isInsideDropZone) {
        if (dragData === null)
          throw Error("No drag data found");
        if (dragData.type !== "row")
          return;
        if (!confirmSortOrderChange(loomState))
          return;
        onRowReorder(dragData.id, touchDropZone.id);
      }
    }
    endDrag();
  }
  function endDrag() {
    setDragData(null);
    setTouchDropZone(null);
    removeDragHover();
  }
  function addDragHover(rowEl) {
    const children = rowEl.querySelectorAll(".dataloom-cell");
    for (let i2 = 0; i2 < children.length; i2++) {
      children[i2].classList.add("dataloom-tr--drag-over");
    }
  }
  function removeDragHover() {
    const children = document.querySelectorAll(".dataloom-tr--drag-over");
    for (let i2 = 0; i2 < children.length; i2++) {
      children[i2].classList.remove("dataloom-tr--drag-over");
    }
  }
  return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
    /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "dataloom-row-options", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Padding, { p: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
      "div",
      {
        className: "dataloom-row-options__container",
        onTouchStart: handleTouchStart,
        onTouchMove: handleTouchMove,
        onTouchEnd: handleTouchEnd,
        onTouchCancel: handleTouchCancel,
        children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
          menu_button_default,
          {
            isFocused: menu.isTriggerFocused,
            menuId: menu.id,
            ref: menu.triggerRef,
            level: 1 /* ONE */,
            icon: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Icon, { lucideId: "grip-vertical" }),
            ariaLabel: "Drag to move or click to open",
            onMouseDown: handleMouseDown,
            onOpen: () => menu.onOpen(1 /* ONE */)
          }
        )
      }
    ) }) }),
    /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
      RowOptions,
      {
        id: menu.id,
        isOpen: menu.isOpen,
        position: menu.position,
        canDeleteRow: source === null,
        onDeleteClick: handleDeleteClick,
        onInsertAboveClick: handleInsertAboveClick,
        onInsertBelowClick: handleInsertBelowClick
      }
    )
  ] });
}

// src/react/loom-app/body-cell-container/index.tsx
var import_react38 = __toESM(require_react());
var import_obsidian11 = require("obsidian");

// src/react/loom-app/text-cell/index.tsx
var import_jsx_runtime47 = __toESM(require_jsx_runtime());
function TextCell6({ value }) {
  const { containerRef, renderRef } = useRenderMarkdown(value);
  return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "dataloom-text-cell", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
    "div",
    {
      className: "dataloom-text-cell__container",
      ref: (node) => {
        containerRef.current = node;
        appendOrReplaceFirstChild(node, renderRef.current);
      }
    }
  ) });
}

// src/shared/color.ts
var findColorClassName = (isDarkMode, color) => {
  switch (color) {
    case "light gray" /* LIGHT_GRAY */:
      return isDarkMode ? "dataloom-light-gray--dark" : "dataloom-light-gray--light";
    case "gray" /* GRAY */:
      return isDarkMode ? "dataloom-gray--dark" : "dataloom-gray--light";
    case "brown" /* BROWN */:
      return isDarkMode ? "dataloom-brown--dark" : "dataloom-brown--light";
    case "orange" /* ORANGE */:
      return isDarkMode ? "dataloom-orange--dark" : "dataloom-orange--light";
    case "yellow" /* YELLOW */:
      return isDarkMode ? "dataloom-yellow--dark" : "dataloom-yellow--light";
    case "green" /* GREEN */:
      return isDarkMode ? "dataloom-green--dark" : "dataloom-green--light";
    case "blue" /* BLUE */:
      return isDarkMode ? "dataloom-blue--dark" : "dataloom-blue--light";
    case "purple" /* PURPLE */:
      return isDarkMode ? "dataloom-purple--dark" : "dataloom-purple--light";
    case "pink" /* PINK */:
      return isDarkMode ? "dataloom-pink--dark" : "dataloom-pink--light";
    case "red" /* RED */:
      return isDarkMode ? "dataloom-red--dark" : "dataloom-red--light";
    default:
      return "";
  }
};
var randomColor = () => {
  const index = Math.floor(Math.random() * Object.values(Color).length);
  return Object.values(Color)[index];
};

// src/react/shared/tag/index.tsx
var import_jsx_runtime48 = __toESM(require_jsx_runtime());
function Tag5({
  id: id2,
  color,
  maxWidth,
  content,
  showRemoveButton,
  onRemoveClick
}) {
  const { isDarkMode } = useAppSelector((state) => state.global);
  let tagClassName = "dataloom-tag";
  tagClassName += " " + findColorClassName(isDarkMode, color);
  if (onRemoveClick !== void 0 && id2 === void 0) {
    throw new Error(
      "An id must defined when the onRemoveClick handler is present."
    );
  }
  let contentClassName = "dataloom-tag-content";
  if (maxWidth !== void 0) {
    contentClassName += " dataloom-overflow--ellipsis";
  }
  return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: tagClassName, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(Stack, { spacing: "sm", justify: "center", isHorizontal: true, children: [
    /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
      "div",
      {
        className: contentClassName,
        style: {
          maxWidth
        },
        children: content
      }
    ),
    showRemoveButton && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Padding, { width: "max-content", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
      Button,
      {
        size: "sm",
        icon: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Icon, { lucideId: "x" }),
        onClick: () => {
          if (id2 && onRemoveClick)
            onRemoveClick(id2);
        }
      }
    ) })
  ] }) });
}

// src/react/loom-app/tag-cell/index.tsx
var import_jsx_runtime49 = __toESM(require_jsx_runtime());
function TagCell6({ content, color }) {
  return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "dataloom-tag-cell", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Tag5, { content, color }) });
}

// src/react/loom-app/checkbox-cell/index.tsx
var import_jsx_runtime50 = __toESM(require_jsx_runtime());
function CheckboxCell6({ value }) {
  return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "dataloom-checkbox-cell", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
    "input",
    {
      className: "task-list-item-checkbox",
      type: "checkbox",
      checked: value,
      onChange: () => {
      }
    }
  ) });
}

// src/react/loom-app/date-cell/index.tsx
var import_jsx_runtime51 = __toESM(require_jsx_runtime());
function DateCell6({ content }) {
  return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "dataloom-date-cell", children: content });
}

// src/react/loom-app/number-cell/index.tsx
var import_jsx_runtime52 = __toESM(require_jsx_runtime());
function NumberCell7({ content }) {
  return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "dataloom-number-cell", children: content });
}

// src/react/loom-app/number-cell-edit/index.tsx
var import_react28 = __toESM(require_react());
var import_jsx_runtime53 = __toESM(require_jsx_runtime());
function NumberCellEdit({
  closeRequest,
  value,
  onChange,
  onClose
}) {
  var _a2;
  const initialValue = (_a2 = value == null ? void 0 : value.toString()) != null ? _a2 : "";
  const [localValue, setLocalValue] = import_react28.default.useState(initialValue);
  const inputRef = import_react28.default.useRef(null);
  usePlaceCursorAtEnd(inputRef, localValue);
  import_react28.default.useEffect(() => {
    if (closeRequest !== null) {
      if (localValue !== initialValue) {
        onChange(localValue === "" ? null : parseFloat(localValue));
      }
      onClose();
    }
  }, [initialValue, localValue, closeRequest, onClose, onChange]);
  function handleChange(inputValue) {
    setLocalValue(inputValue);
  }
  return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "dataloom-number-cell-edit", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
    input_default,
    {
      isNumeric: true,
      ref: inputRef,
      focusOutline: "default",
      value: localValue,
      onChange: handleChange,
      onBlur: (e) => {
        e.target.classList.add("dataloom-blur--cell");
      }
    }
  ) });
}

// src/react/loom-app/text-cell-edit/index.tsx
var import_react31 = __toESM(require_react());

// src/react/shared/suggest-list/index.tsx
var import_react30 = __toESM(require_react());
var import_fuzzysort = __toESM(require_fuzzysort());

// src/react/shared/suggest-list/suggest-item/index.tsx
var import_react29 = __toESM(require_react());
var import_js_logger9 = __toESM(require_logger());
var import_jsx_runtime54 = __toESM(require_jsx_runtime());
var SuggestItem = import_react29.default.forwardRef(
  function SuggestItem2({ index, file, isHighlighted, onItemClick }, ref) {
    const handleClick = import_react29.default.useCallback(
      (e) => {
        e.stopPropagation();
        onItemClick(file);
      },
      [file, onItemClick]
    );
    function handleKeyDown(e) {
      import_js_logger9.default.trace("SuggestItem handleKeyDown");
      if (e.key === "Enter") {
        e.preventDefault();
        onItemClick(file);
      }
    }
    let name = "No match found";
    if (file) {
      if (file.extension === "md") {
        name = file.basename;
      } else {
        name = file.name;
      }
    }
    let path = null;
    if (file) {
      if (file.parent && file.parent.path !== "/") {
        path = file.parent.path + "/";
      }
    }
    return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
      "div",
      {
        tabIndex: 0,
        "data-index": index,
        className: "dataloom-suggest-item dataloom-focusable",
        ref,
        style: {
          backgroundColor: isHighlighted ? "var(--background-modifier-hover)" : "var(--background-primary)"
        },
        onClick: handleClick,
        onKeyDown: handleKeyDown,
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
            Text,
            {
              variant: "semibold",
              size: "xs",
              value: name,
              maxWidth: "275px"
            }
          ),
          path && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Text, { value: path, size: "xs" })
        ]
      }
    );
  }
);
var suggest_item_default = SuggestItem;

// src/react/shared/suggest-list/suggest-input/index.tsx
var import_jsx_runtime55 = __toESM(require_jsx_runtime());
function SuggestInput({ value, onChange }) {
  return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "dataloom-suggest-input", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
    input_default,
    {
      isTransparent: true,
      focusOutline: "none",
      placeholder: "Search for a file...",
      value,
      onChange
    }
  ) });
}

// src/react/shared/suggest-list/clear-button.tsx
var import_jsx_runtime56 = __toESM(require_jsx_runtime());
function ClearButton({ onClick }) {
  return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
    /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Divider, {}),
    /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(MenuItem, { name: "Clear", onClick })
  ] });
}

// src/react/shared/suggest-list/create-button.tsx
var import_jsx_runtime57 = __toESM(require_jsx_runtime());
function CreateButton({ value, onClick }) {
  return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
    /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
      MenuItem,
      {
        name: `Create ${value}`,
        onClick: () => onClick == null ? void 0 : onClick(value)
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Divider, {})
  ] });
}

// src/react/shared/suggest-list/index.tsx
var import_js_logger10 = __toESM(require_logger());
var import_jsx_runtime58 = __toESM(require_jsx_runtime());
function SuggestList({
  hiddenExtensions = [],
  showInput,
  showCreate,
  showClear,
  filterValue,
  onItemClick,
  onClearClick,
  onCreateClick
}) {
  const [localFilterValue, setLocalFilterValue] = import_react30.default.useState(
    filterValue != null ? filterValue : ""
  );
  const highlightItemRef = import_react30.default.useRef(null);
  const [highlightIndex, setHighlightIndex] = import_react30.default.useState(-1);
  const { app } = useAppMount();
  import_react30.default.useEffect(() => {
    setLocalFilterValue(filterValue != null ? filterValue : "");
  }, [filterValue]);
  import_react30.default.useEffect(() => {
    if (highlightItemRef.current) {
      highlightItemRef.current.scrollIntoView({
        behavior: "auto",
        block: "nearest"
      });
    }
  }, [highlightIndex]);
  const files = app.vault.getFiles().filter((file) => !hiddenExtensions.includes(file.extension));
  let filteredFiles = [];
  if (localFilterValue !== "") {
    const results = import_fuzzysort.default.go(localFilterValue, files, {
      key: "path",
      limit: 20
    });
    filteredFiles = results.map((result) => result.obj);
  } else {
    filteredFiles = files;
    filteredFiles.sort((a2, b2) => b2.stat.mtime - a2.stat.mtime);
    filteredFiles = filteredFiles.slice(0, 20);
  }
  function handleKeyDown() {
    import_js_logger10.default.trace("SuggestMenuContent handleKeyDown");
    const focusedEl = document.activeElement;
    if (!focusedEl)
      return;
    if (focusedEl.classList.contains("dataloom-suggest-item")) {
      const index = focusedEl.getAttribute("data-index");
      if (!index)
        return;
      setHighlightIndex(parseInt(index));
      return;
    }
    setHighlightIndex(-1);
  }
  const doesFilterFileExist = filteredFiles.map((file) => file.path).includes(localFilterValue);
  return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "dataloom-suggest-menu", onKeyDown: handleKeyDown, children: [
    showInput && files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
        SuggestInput,
        {
          value: localFilterValue,
          onChange: setLocalFilterValue
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Divider, {})
    ] }),
    showCreate && !doesFilterFileExist && localFilterValue !== "" && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
      CreateButton,
      {
        value: localFilterValue,
        onClick: onCreateClick
      }
    ),
    files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "dataloom-suggest-menu__container", children: [
      filteredFiles.length === 0 && !showCreate && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
        suggest_item_default,
        {
          index: 0,
          file: null,
          ref: null,
          isHighlighted: true,
          onItemClick
        }
      ),
      filteredFiles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_jsx_runtime58.Fragment, { children: filteredFiles.map((file, index) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
        suggest_item_default,
        {
          index,
          ref: highlightIndex === index ? highlightItemRef : null,
          file,
          isHighlighted: index === highlightIndex,
          onItemClick
        },
        file.path
      )) })
    ] }),
    files.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Padding, { px: "md", pb: "md", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { value: "No image files found" }) }),
    showClear && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ClearButton, { onClick: onClearClick })
  ] });
}

// src/react/loom-app/text-cell-edit/suggest-menu.tsx
var import_jsx_runtime59 = __toESM(require_jsx_runtime());
function SuggestMenu({
  id: id2,
  isOpen,
  position,
  filterValue,
  onItemClick
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
    Menu,
    {
      id: id2,
      isOpen,
      position,
      width: 275,
      topOffset: 30,
      leftOffset: 30,
      children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(SuggestList, { filterValue, onItemClick })
    }
  );
}

// src/react/loom-app/text-cell-edit/utils.ts
var import_lodash7 = __toESM(require_lodash());

// src/react/loom-app/text-cell-edit/constants.ts
var DOUBLE_BRACKET_REGEX = new RegExp(/\[\[(.*?)]]/g);

// src/react/loom-app/text-cell-edit/utils.ts
var isSurroundedByDoubleBrackets = (inputValue, selectionStart) => {
  let match;
  const regex = (0, import_lodash7.cloneDeep)(DOUBLE_BRACKET_REGEX);
  while ((match = regex.exec(inputValue)) !== null) {
    const innerText2 = match[1];
    const startIndex = match.index + 2;
    const endIndex = startIndex + innerText2.length - 1;
    const index = selectionStart - 1;
    if (innerText2 === "" && index === startIndex - 1)
      return true;
    if (index >= startIndex && index <= endIndex)
      return true;
  }
  return false;
};
var doubleBracketsInnerReplace = (inputValue, selectionStart, replacement) => {
  let match;
  const regex = (0, import_lodash7.cloneDeep)(DOUBLE_BRACKET_REGEX);
  while ((match = regex.exec(inputValue)) !== null) {
    const innerText2 = match[1];
    const startIndex = match.index + 2;
    const endIndex = startIndex + innerText2.length - 1;
    const index = selectionStart - 1;
    if (innerText2 === "" && index === startIndex - 1) {
      return inputValue.slice(0, startIndex) + replacement + inputValue.slice(endIndex + 1);
    }
    if (index >= startIndex && index <= endIndex) {
      return inputValue.slice(0, startIndex) + replacement + inputValue.slice(endIndex + 1);
    }
  }
  return inputValue;
};
var getFilterValue = (inputValue, selectionStart) => {
  let match;
  const regex = (0, import_lodash7.cloneDeep)(DOUBLE_BRACKET_REGEX);
  while ((match = regex.exec(inputValue)) !== null) {
    const innerText2 = match[1];
    const startIndex = match.index + 2;
    const endIndex = startIndex + innerText2.length - 1;
    const index = selectionStart - 1;
    if (innerText2 === "" && index === startIndex - 1) {
      return innerText2;
    }
    if (index >= startIndex && index <= endIndex) {
      return innerText2;
    }
  }
  return null;
};
var addClosingBracket = (value, selectionStart) => {
  const char = value[selectionStart - 1];
  if (char === "[")
    value = value + "]";
  return value;
};
var removeClosingBracket = (previousValue, value, selectionStart) => {
  const previousChar = previousValue[selectionStart];
  const nextChar = value[selectionStart];
  if (previousChar === "[" && nextChar === "]") {
    const updatedValue = value.slice(0, selectionStart) + value.slice(selectionStart + 1);
    value = updatedValue;
  }
  return value;
};

// src/react/loom-app/text-cell-edit/index.tsx
var import_js_logger11 = __toESM(require_logger());
var import_jsx_runtime60 = __toESM(require_jsx_runtime());
function TextCellEdit({
  cellId,
  shouldWrapOverflow,
  closeRequest,
  value,
  onChange,
  onClose
}) {
  var _a2, _b, _c;
  const COMPONENT_ID = `suggest-menu-${cellId}`;
  const menu = useMenu(COMPONENT_ID);
  const [localValue, setLocalValue] = import_react31.default.useState(value);
  const [cursorPosition, setCursorPosition] = import_react31.default.useState(
    null
  );
  const inputRef = import_react31.default.useRef(null);
  usePlaceCursorAtEnd(inputRef, localValue);
  import_react31.default.useEffect(() => {
    if (inputRef.current) {
      const selectionIndex = inputRef.current.selectionStart;
      if (localValue[selectionIndex - 1] === "]" && localValue[selectionIndex - 2] === "[") {
        inputRef.current.selectionStart = selectionIndex - 1;
        inputRef.current.selectionEnd = selectionIndex - 1;
      } else if (localValue[selectionIndex - 1] === "]" && localValue[selectionIndex - 2] === "]" && localValue[selectionIndex - 3] === "[") {
        inputRef.current.selectionStart = selectionIndex - 2;
        inputRef.current.selectionEnd = selectionIndex - 2;
      }
    }
  }, [inputRef, localValue]);
  import_react31.default.useEffect(() => {
    if (closeRequest !== null) {
      import_js_logger11.default.trace("TextCellEdit onClose");
      if (localValue !== value)
        onChange(localValue);
      onClose();
    }
  }, [value, localValue, closeRequest, onClose, onChange]);
  function handleKeyDown(e) {
    const el = e.target;
    import_js_logger11.default.trace("TextCellEdit handleKeyDown");
    if (e.key === "Enter") {
      if (!isInsertLineDown(e) && !isInsertLineAltDown(e)) {
        e.preventDefault();
      }
    }
    if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
      const cursorPosition2 = el.selectionStart;
      if (menu.isOpen) {
        if (!isSurroundedByDoubleBrackets(value, cursorPosition2))
          menu.onClose();
      }
      if (inputRef.current) {
        const inputEl = inputRef.current;
        inputEl.selectionStart = cursorPosition2;
        inputEl.selectionEnd = cursorPosition2;
      }
    }
  }
  import_react31.default.useEffect(() => {
    if (cursorPosition !== null && inputRef.current) {
      inputRef.current.selectionStart = cursorPosition;
      inputRef.current.selectionEnd = cursorPosition;
      setCursorPosition(null);
    }
  }, [cursorPosition, inputRef]);
  function handleMenuOpen() {
    menu.onOpen(2 /* TWO */);
  }
  function handleTextareaChange(e) {
    import_js_logger11.default.trace("TextCellEdit handleTextareaChange");
    const inputValue = e.target.value;
    let newValue = inputValue;
    if (inputRef.current) {
      const inputEl = inputRef.current;
      if (inputValue.length > localValue.length) {
        newValue = addClosingBracket(newValue, inputEl.selectionStart);
      } else {
        newValue = removeClosingBracket(
          localValue,
          inputValue,
          inputEl.selectionStart
        );
      }
      if (isSurroundedByDoubleBrackets(newValue, inputEl.selectionStart)) {
        handleMenuOpen();
      }
    }
    setLocalValue(newValue);
  }
  function handleSuggestItemClick(file) {
    var _a3, _b2;
    if (file) {
      let path = file.path;
      if (isMarkdownFile(path)) {
        path = stripFileExtension(path);
      }
      const newValue = doubleBracketsInnerReplace(
        localValue,
        (_b2 = (_a3 = inputRef.current) == null ? void 0 : _a3.selectionStart) != null ? _b2 : 0,
        path
      );
      onChange(newValue);
    }
    menu.onClose();
  }
  const overflowClassName = useOverflow(shouldWrapOverflow);
  const filterValue = (_c = getFilterValue(localValue, (_b = (_a2 = inputRef.current) == null ? void 0 : _a2.selectionStart) != null ? _b : 0)) != null ? _c : "";
  let className = overflowClassName + " dataloom-focusable";
  if (menu.isTriggerFocused) {
    className += " dataloom-focusable--focused";
  }
  return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
    /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "dataloom-text-cell-edit", ref: menu.triggerRef, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
      "textarea",
      {
        "data-menu-id": menu.id,
        className,
        autoFocus: true,
        ref: inputRef,
        value: localValue,
        onKeyDown: handleKeyDown,
        onChange: handleTextareaChange,
        onBlur: (e) => {
          e.target.classList.add("dataloom-blur--cell");
        }
      }
    ) }),
    /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
      SuggestMenu,
      {
        id: menu.id,
        isOpen: menu.isOpen,
        position: menu.position,
        filterValue,
        onItemClick: handleSuggestItemClick
      }
    )
  ] });
}

// src/react/loom-app/tag-cell-edit/index.tsx
var import_react34 = __toESM(require_react());

// src/react/loom-app/tag-cell-edit/menu-header/index.tsx
var import_react32 = __toESM(require_react());

// src/react/shared/wrap/index.tsx
var import_jsx_runtime61 = __toESM(require_jsx_runtime());
function Wrap({
  justify,
  align = "center",
  spacingX = "md",
  spacingY = "md",
  width,
  children
}) {
  const justifyContent = getDynamicSize("flex-start", justify);
  const renderWidth = getDynamicSize("100%", width);
  return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
    "div",
    {
      className: "dataloom-wrap",
      style: {
        width: renderWidth,
        rowGap: getSpacing(spacingX),
        columnGap: getSpacing(spacingY),
        justifyContent,
        alignItems: align
      },
      children
    }
  );
}

// src/react/loom-app/tag-cell-edit/menu-header/index.tsx
var import_jsx_runtime62 = __toESM(require_jsx_runtime());
function MenuHeader({
  cellTags,
  inputValue,
  onInputValueChange,
  onRemoveTag
}) {
  const inputRef = import_react32.default.useRef(null);
  function handleInputChange(value) {
    if (value.match(/^\s/))
      return;
    onInputValueChange(value);
  }
  return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "dataloom-tag-cell-edit__menu-header", children: [
    cellTags.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Padding, { px: "md", pt: "md", pb: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Wrap, { spacingX: "sm", children: cellTags.map((tag) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
      Tag5,
      {
        id: tag.id,
        color: tag.color,
        content: tag.content,
        maxWidth: "150px",
        showRemoveButton: true,
        onRemoveClick: onRemoveTag
      },
      tag.id
    )) }) }),
    /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
      input_default,
      {
        ref: inputRef,
        isTransparent: true,
        focusOutline: "none",
        placeholder: "Search for a tag...",
        value: inputValue,
        onChange: handleInputChange
      }
    )
  ] });
}

// src/react/loom-app/tag-cell-edit/create-tag/index.tsx
var import_jsx_runtime63 = __toESM(require_jsx_runtime());
function CreateTag({ content, color, onTagAdd }) {
  return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "dataloom-create-tag", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
    Button,
    {
      variant: "text",
      isFullWidth: true,
      onClick: () => onTagAdd(content, color),
      children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Padding, { px: "md", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Stack, { spacing: "sm", isHorizontal: true, children: [
        /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { children: "Create" }),
        /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Tag5, { content, color, maxWidth: "120px" })
      ] }) })
    }
  ) });
}

// src/react/loom-app/tag-color-menu/index.tsx
var import_react33 = __toESM(require_react());

// src/shared/string-utils.ts
var uppercaseFirst = (input) => {
  return input.charAt(0).toUpperCase() + input.slice(1);
};

// src/react/loom-app/tag-color-menu/components/color-item/index.tsx
var import_jsx_runtime64 = __toESM(require_jsx_runtime());
function ColorItem({
  isDarkMode,
  color,
  isSelected,
  onColorClick
}) {
  function handleKeyDown(e) {
    if (e.key === "Enter") {
      e.stopPropagation();
      onColorClick(color);
    }
  }
  let containerClass = "dataloom-color-item dataloom-focusable dataloom-selectable";
  if (isSelected)
    containerClass += " dataloom-selected";
  const colorClass = findColorClassName(isDarkMode, color);
  let squareClass = "dataloom-color-item__square";
  squareClass += " " + colorClass;
  return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
    "div",
    {
      tabIndex: 0,
      className: containerClass,
      onKeyDown: handleKeyDown,
      onClick: () => {
        onColorClick(color);
      },
      children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Padding, { px: "lg", py: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(Stack, { isHorizontal: true, spacing: "lg", children: [
        /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: squareClass }),
        /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Text, { value: uppercaseFirst(color), size: "sm" })
      ] }) })
    }
  );
}

// src/react/loom-app/tag-color-menu/index.tsx
var import_jsx_runtime65 = __toESM(require_jsx_runtime());
function TagColorMenu({
  id: id2,
  isOpen,
  position,
  selectedColor,
  content,
  closeRequest,
  onColorClick,
  onDeleteClick,
  onTagContentChange,
  onClose
}) {
  const { isDarkMode } = useAppSelector((state) => state.global);
  const [localValue, setLocalValue] = import_react33.default.useState(content);
  import_react33.default.useEffect(
    function saveOnCloseRequest() {
      if (closeRequest === null)
        return;
      if (content !== localValue)
        onTagContentChange(localValue);
      onClose();
    },
    [closeRequest, content, localValue, onTagContentChange, onClose]
  );
  return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
    Menu,
    {
      id: id2,
      isOpen,
      position,
      topOffset: -75,
      leftOffset: -50,
      children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "dataloom-tag-color-menu", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(Stack, { spacing: "sm", children: [
        /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Padding, { px: "md", py: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(input_default, { value: localValue, onChange: setLocalValue }) }),
        /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
          MenuItem,
          {
            lucideId: "trash-2",
            name: "Delete",
            onClick: onDeleteClick
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Divider, {}),
        /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Padding, { px: "lg", py: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Text, { value: "Colors" }) }),
        /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "dataloom-tag-color-menu__color-container", children: Object.values(Color).map((color) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
          ColorItem,
          {
            isDarkMode,
            color,
            onColorClick,
            isSelected: selectedColor === color
          },
          color
        )) })
      ] }) })
    }
  );
}

// src/react/loom-app/tag-cell-edit/selectable-tag/index.tsx
var import_jsx_runtime66 = __toESM(require_jsx_runtime());
function SelectableTag({
  id: id2,
  content,
  color,
  onClick,
  onColorChange,
  onDeleteClick,
  onTagContentChange
}) {
  const COMPONENT_ID = `selectable-tag-${id2}`;
  const menu = useMenu(COMPONENT_ID);
  function handleColorChange(color2) {
    onColorChange(id2, color2);
    menu.onClose();
  }
  function handleDeleteClick() {
    onDeleteClick(id2);
    menu.onClose();
  }
  function handleTagContentChange(value) {
    onTagContentChange(id2, value);
    menu.onClose();
  }
  function handleKeyDown(e) {
    if (e.key === "Enter") {
      e.stopPropagation();
      onClick(id2);
    }
  }
  function handleClick(e) {
    const target = e.target;
    if (target.classList.contains("dataloom-menu-trigger"))
      return;
    e.stopPropagation();
    onClick(id2);
  }
  return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
    /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
      "div",
      {
        tabIndex: 0,
        className: "dataloom-selectable-tag dataloom-focusable dataloom-selectable",
        onClick: handleClick,
        onKeyDown: handleKeyDown,
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Tag5, { content, color, maxWidth: "150px" }),
          /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
            menu_button_default,
            {
              isFocused: menu.isTriggerFocused,
              menuId: menu.id,
              ref: menu.triggerRef,
              level: 2 /* TWO */,
              icon: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Icon, { lucideId: "more-horizontal" }),
              onOpen: () => menu.onOpen(2 /* TWO */, {
                shouldRequestOnClose: true
              })
            }
          )
        ]
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
      TagColorMenu,
      {
        isOpen: menu.isOpen,
        id: menu.id,
        position: menu.position,
        closeRequest: menu.closeRequest,
        content,
        selectedColor: color,
        onColorClick: (color2) => handleColorChange(color2),
        onDeleteClick: handleDeleteClick,
        onTagContentChange: handleTagContentChange,
        onClose: menu.onClose
      }
    )
  ] });
}

// src/react/loom-app/tag-cell-edit/menu-body/index.tsx
var import_jsx_runtime67 = __toESM(require_jsx_runtime());
function MenuBody({
  columnTags,
  inputValue,
  newTagColor,
  onTagAdd,
  onTagClick,
  onTagColorChange,
  onTagDelete,
  onTagContentChange
}) {
  const hasTagWithSameCase = columnTags.find((tag) => tag.content === inputValue) !== void 0;
  const filteredTags = columnTags.filter(
    (tag) => tag.content.toLowerCase().includes(inputValue.toLowerCase())
  );
  return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "dataloom-tag-cell-edit__menu-body", children: [
    /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Padding, { px: "lg", py: "md", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Text, { value: "Select a tag or create one" }) }),
    /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "dataloom-tag-cell-edit__menu-body-container", children: [
      !hasTagWithSameCase && inputValue !== "" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
        CreateTag,
        {
          content: inputValue,
          color: newTagColor,
          onTagAdd
        }
      ),
      filteredTags.map((tag) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
        SelectableTag,
        {
          id: tag.id,
          color: tag.color,
          content: tag.content,
          onColorChange: onTagColorChange,
          onClick: onTagClick,
          onDeleteClick: onTagDelete,
          onTagContentChange
        },
        tag.id
      ))
    ] })
  ] });
}

// src/react/loom-app/tag-cell-edit/index.tsx
var import_jsx_runtime68 = __toESM(require_jsx_runtime());
function TagCellEdit({
  isMulti = false,
  columnTags,
  cellTags,
  closeRequest,
  onTagClick,
  onTagAdd,
  onTagColorChange,
  onTagDelete,
  onRemoveTag,
  onTagContentChange,
  onClose
}) {
  const [inputValue, setInputValue] = import_react34.default.useState("");
  const [newTagColor, setNewTagColor] = import_react34.default.useState(randomColor());
  const handleTagAdd = import_react34.default.useCallback(
    (markdown, color) => {
      onTagAdd(markdown, color);
      setInputValue("");
      setNewTagColor(randomColor());
      if (!isMulti)
        onClose();
    },
    [isMulti, onTagAdd, onClose]
  );
  import_react34.default.useEffect(() => {
    if (closeRequest !== null) {
      if (closeRequest.type === "close-on-save") {
        if (inputValue !== "") {
          const doesTagExist = columnTags.find(
            (tag) => tag.content === inputValue
          );
          if (!doesTagExist) {
            handleTagAdd(inputValue, newTagColor);
            return;
          }
        }
      }
      onClose();
    }
  }, [
    handleTagAdd,
    columnTags,
    inputValue,
    newTagColor,
    closeRequest,
    onClose
  ]);
  function handleTagClick(id2) {
    onTagClick(id2);
    if (!isMulti)
      onClose();
  }
  return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "dataloom-tag-cell-edit", children: [
    /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
      MenuHeader,
      {
        inputValue,
        cellTags,
        onInputValueChange: setInputValue,
        onRemoveTag
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
      MenuBody,
      {
        inputValue,
        columnTags,
        newTagColor,
        onTagAdd: handleTagAdd,
        onTagClick: handleTagClick,
        onTagDelete,
        onTagColorChange,
        onTagContentChange
      }
    )
  ] });
}

// src/react/loom-app/date-cell-edit/index.tsx
var import_react35 = __toESM(require_react());

// src/react/loom-app/date-cell-edit/date-format-menu.tsx
var import_jsx_runtime69 = __toESM(require_jsx_runtime());
function DateFormatMenu({
  id: id2,
  position,
  isOpen,
  value,
  onChange
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
    Menu,
    {
      isOpen,
      id: id2,
      position,
      width: 175,
      topOffset: 10,
      leftOffset: 75,
      children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "dataloom-date-format-menu", children: Object.values(DateFormat2).map((format) => /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
        MenuItem,
        {
          name: getDisplayNameForDateFormat(format),
          isSelected: value === format,
          onClick: () => {
            onChange(format);
          }
        },
        format
      )) })
    }
  );
}

// src/react/loom-app/date-cell-edit/date-format-separator-menu.tsx
var import_jsx_runtime70 = __toESM(require_jsx_runtime());
function DateFormatSeparatorMenu({
  id: id2,
  position,
  isOpen,
  value,
  onChange
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
    Menu,
    {
      isOpen,
      id: id2,
      position,
      width: 175,
      topOffset: 10,
      leftOffset: 75,
      children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "dataloom-date-format-separator-menu", children: Object.values(DateFormatSeparator).map((format) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
        MenuItem,
        {
          name: getDisplayNameForDateFormatSeparator(format),
          isSelected: value === format,
          onClick: () => {
            onChange(format);
          }
        },
        format
      )) })
    }
  );
}

// src/shared/date/date-validation.ts
var import_dayjs = __toESM(require_dayjs_min());
var import_customParseFormat = __toESM(require_customParseFormat());
import_dayjs.default.extend(import_customParseFormat.default);
var parseDateTime = (value) => {
  const date = new Date(value);
  if (date instanceof Date && !isNaN(date.getTime())) {
    return date.toISOString();
  }
  return null;
};
var isValidDateString = (value, format, separator) => {
  const dateFormatString = getDateFormatString(format, separator);
  const dayjsDate = (0, import_dayjs.default)(value, dateFormatString, true);
  return dayjsDate.isValid();
};
var isValidTimeString = (value, hour12) => {
  const dayjsDate = (0, import_dayjs.default)(value, hour12 ? "h:mm A" : "HH:mm", true);
  return dayjsDate.isValid();
};

// src/react/loom-app/date-cell-edit/time-format.menu.tsx
var import_jsx_runtime71 = __toESM(require_jsx_runtime());
function TimeFormatMenu({
  id: id2,
  position,
  isOpen,
  value,
  onChange
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
    Menu,
    {
      isOpen,
      id: id2,
      position,
      width: 175,
      topOffset: 10,
      leftOffset: 75,
      children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "dataloom-time-format-menu", children: [
        /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
          MenuItem,
          {
            name: "12 hour",
            isSelected: value,
            onClick: () => {
              onChange(true);
            }
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
          MenuItem,
          {
            name: "24 hour",
            isSelected: !value,
            onClick: () => {
              onChange(false);
            }
          }
        )
      ] })
    }
  );
}

// src/shared/date/date-string-conversion.ts
var import_dayjs2 = __toESM(require_dayjs_min());
var import_customParseFormat2 = __toESM(require_customParseFormat());
import_dayjs2.default.extend(import_customParseFormat2.default);
var dateStringToDateTime = (dateString, format, separator, options) => {
  const { timeString, hour12 = false } = options != null ? options : {};
  let convertString = dateString;
  let dayJSFormat = getDateFormatString(format, separator);
  if (timeString) {
    dayJSFormat += " " + getTimeFormatString(hour12);
    convertString += " " + timeString;
  }
  const dayjsDate = (0, import_dayjs2.default)(convertString, dayJSFormat, true);
  return dayjsDate.toISOString();
};

// src/react/loom-app/date-cell-edit/index.tsx
var import_jsx_runtime72 = __toESM(require_jsx_runtime());
function DateCellEdit({
  cellId,
  value,
  includeTime,
  closeRequest,
  dateFormatSeparator,
  dateFormat,
  hour12,
  onDateTimeChange,
  onClose,
  onCloseRequestClear,
  onDateFormatSeparatorChange,
  onDateFormatChange,
  onIncludeTimeToggle,
  onTimeFormatChange
}) {
  const COMPONENT_ID = `date-format-menu-${cellId}`;
  const dateFormatMenu = useMenu(COMPONENT_ID, { name: "date-format" });
  const dateFormatSeparatorMenu = useMenu(COMPONENT_ID, {
    name: "date-separator"
  });
  const timeFormatMenu = useMenu(COMPONENT_ID, {
    name: "time-format"
  });
  const includeTimeToggleId = import_react35.default.useId();
  let initialDateString = "";
  if (value !== null) {
    initialDateString = dateTimeToDateString(
      value,
      dateFormat,
      dateFormatSeparator
    );
  }
  const [dateString, setDateString] = import_react35.default.useState(initialDateString);
  let initialTimeString = "";
  if (value !== null) {
    initialTimeString = dateTimeToTimeString(value, {
      hour12
    });
  }
  const [timeString, setTimeString] = import_react35.default.useState(initialTimeString);
  const [isDateInputInvalid, setDateInputInvalid] = import_react35.default.useState(false);
  const [isTimeInputInvalid, setTimeInputInvalid] = import_react35.default.useState(false);
  const dateInputRef = import_react35.default.useRef(null);
  const timeInputRef = import_react35.default.useRef(null);
  import_react35.default.useEffect(() => {
    let timeString2 = "";
    if (value !== null) {
      timeString2 = dateTimeToTimeString(value, {
        hour12
      });
    }
    setTimeString(timeString2);
  }, [value, hour12, setTimeString]);
  import_react35.default.useEffect(() => {
    let dateString2 = "";
    if (value !== null) {
      dateString2 = dateTimeToDateString(
        value,
        dateFormat,
        dateFormatSeparator
      );
    }
    setDateString(dateString2);
  }, [value, dateFormat, dateFormatSeparator, setDateString]);
  import_react35.default.useEffect(() => {
    if (closeRequest === null)
      return;
    function validateDateInput(closeRequest2) {
      if (dateString == "")
        return true;
      if (isValidDateString(dateString, dateFormat, dateFormatSeparator))
        return true;
      const { type } = closeRequest2;
      if (type !== "close-on-save") {
        return false;
      }
      setDateInputInvalid(true);
      onCloseRequestClear();
      return false;
    }
    function validateTimeInput(closeRequest2) {
      if (!includeTime)
        return true;
      if (timeString === "")
        return true;
      if (isValidTimeString(timeString, hour12))
        return true;
      const { type } = closeRequest2;
      if (type !== "close-on-save") {
        return false;
      }
      setTimeInputInvalid(true);
      onCloseRequestClear();
      return false;
    }
    function getCurrentDateTime2() {
      if (includeTime) {
        if (dateString !== "" && timeString !== "") {
          return dateStringToDateTime(
            dateString,
            dateFormat,
            dateFormatSeparator,
            {
              timeString,
              hour12
            }
          );
        }
      }
      if (dateString !== "") {
        return dateStringToDateTime(
          dateString,
          dateFormat,
          dateFormatSeparator
        );
      }
      return null;
    }
    if (!validateDateInput(closeRequest)) {
      if (closeRequest.type !== "close-on-save") {
        onClose();
      }
      return;
    }
    if (!validateTimeInput(closeRequest)) {
      if (closeRequest.type !== "close-on-save") {
        onClose();
      }
      return;
    }
    const newValue = getCurrentDateTime2();
    if (newValue !== value) {
      setDateInputInvalid(false);
      setTimeInputInvalid(false);
      onDateTimeChange(newValue);
    }
    onClose();
  }, [
    value,
    dateString,
    includeTime,
    hour12,
    timeString,
    closeRequest,
    dateFormat,
    dateFormatSeparator,
    onDateTimeChange,
    onCloseRequestClear,
    onClose
  ]);
  function handleDateFormatChange(value2) {
    onDateFormatChange(value2);
    dateFormatMenu.onClose();
  }
  function handleDateFormatSeparatorChange(value2) {
    onDateFormatSeparatorChange(value2);
    dateFormatSeparatorMenu.onClose();
  }
  function handleTimeFormatChange(value2) {
    onTimeFormatChange(value2);
    timeFormatMenu.onClose();
  }
  function handleTodayClick() {
    onDateTimeChange(getCurrentDateTime());
    onClose();
  }
  function handleClearClick() {
    onDateTimeChange(null);
    onClose();
  }
  return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
    /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "dataloom-date-cell-edit", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(Stack, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Padding, { p: "md", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(Stack, { isHorizontal: true, spacing: "sm", children: [
        /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
          input_default,
          {
            ref: dateInputRef,
            showBorder: true,
            placeholder: dateTimeToDateString(
              getCurrentDateTime(),
              dateFormat,
              dateFormatSeparator
            ),
            hasError: isDateInputInvalid,
            value: dateString,
            onChange: setDateString
          }
        ),
        includeTime && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
          input_default,
          {
            ref: timeInputRef,
            showBorder: true,
            autoFocus: false,
            placeholder: dateTimeToTimeString(
              getCurrentDateTime(),
              {
                hour12
              }
            ),
            hasError: isTimeInputInvalid,
            value: timeString,
            onChange: setTimeString
          }
        )
      ] }) }),
      /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
        menu_trigger_default,
        {
          ref: dateFormatMenu.triggerRef,
          menuId: dateFormatMenu.id,
          variant: "cell",
          isFocused: dateFormatMenu.isTriggerFocused,
          level: 2 /* TWO */,
          onOpen: () => dateFormatMenu.onOpen(2 /* TWO */),
          children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
            MenuItem,
            {
              isFocusable: false,
              name: "Date format",
              value: getDisplayNameForDateFormat(dateFormat)
            }
          )
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
        menu_trigger_default,
        {
          ref: dateFormatSeparatorMenu.triggerRef,
          menuId: dateFormatSeparatorMenu.id,
          variant: "cell",
          isFocused: dateFormatSeparatorMenu.isTriggerFocused,
          level: 2 /* TWO */,
          onOpen: () => dateFormatSeparatorMenu.onOpen(2 /* TWO */),
          children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
            MenuItem,
            {
              isFocusable: false,
              name: "Date separator",
              value: getDisplayNameForDateFormatSeparator(
                dateFormatSeparator
              )
            }
          )
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Padding, { px: "lg", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(Stack, { spacing: "sm", children: [
        /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("label", { htmlFor: includeTimeToggleId, children: "Include time" }),
        /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
          Switch,
          {
            id: includeTimeToggleId,
            value: includeTime,
            onToggle: onIncludeTimeToggle
          }
        )
      ] }) }),
      includeTime && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
        menu_trigger_default,
        {
          ref: timeFormatMenu.triggerRef,
          menuId: timeFormatMenu.id,
          variant: "cell",
          isFocused: timeFormatMenu.isTriggerFocused,
          level: 2 /* TWO */,
          onOpen: () => timeFormatMenu.onOpen(2 /* TWO */),
          children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
            MenuItem,
            {
              isFocusable: false,
              name: "Time format",
              value: hour12 ? "12 hour" : "24 hour"
            }
          )
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(MenuItem, { name: "Today", onClick: handleTodayClick }),
      /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(MenuItem, { name: "Clear", onClick: handleClearClick })
    ] }) }),
    /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
      DateFormatMenu,
      {
        id: dateFormatMenu.id,
        isOpen: dateFormatMenu.isOpen,
        position: dateFormatMenu.position,
        value: dateFormat,
        onChange: handleDateFormatChange
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
      DateFormatSeparatorMenu,
      {
        id: dateFormatSeparatorMenu.id,
        isOpen: dateFormatSeparatorMenu.isOpen,
        position: dateFormatSeparatorMenu.position,
        value: dateFormatSeparator,
        onChange: handleDateFormatSeparatorChange
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
      TimeFormatMenu,
      {
        id: timeFormatMenu.id,
        isOpen: timeFormatMenu.isOpen,
        position: timeFormatMenu.position,
        value: hour12,
        onChange: handleTimeFormatChange
      }
    )
  ] });
}

// src/react/loom-app/multi-tag-cell/index.tsx
var import_jsx_runtime73 = __toESM(require_jsx_runtime());
function MultiTagCell6({ cellTags }) {
  return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "dataloom-multi-tag-cell", children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Wrap, { children: cellTags.map((tag) => /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Tag5, { content: tag.content, color: tag.color }, tag.id)) }) });
}

// src/react/loom-app/file-cell/index.tsx
var import_jsx_runtime74 = __toESM(require_jsx_runtime());
function FileCell6({ content }) {
  const { containerRef, renderRef } = useRenderMarkdown(content);
  return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "dataloom-file-cell", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
    "div",
    {
      ref: (node) => {
        containerRef.current = node;
        appendOrReplaceFirstChild(node, renderRef.current);
      }
    }
  ) });
}

// src/react/loom-app/file-cell-edit/index.tsx
var import_jsx_runtime75 = __toESM(require_jsx_runtime());
function FileCellEdit({ onChange, onClose }) {
  function handleSuggestItemClick(file) {
    if (file) {
      let path = file.path;
      if (isMarkdownFile(path))
        path = stripFileExtension(path);
      onChange(path);
    }
    onClose();
  }
  function handleClearClick() {
    onChange("");
    onClose();
  }
  function handleCreateClick(value) {
    if (isMarkdownFile(value))
      value = stripFileExtension(value);
    onChange(value);
    onClose();
  }
  return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "dataloom-file-cell-edit", children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
    SuggestList,
    {
      showInput: true,
      showClear: true,
      showCreate: true,
      onItemClick: handleSuggestItemClick,
      onClearClick: handleClearClick,
      onCreateClick: handleCreateClick
    }
  ) });
}

// src/shared/cell-content/embed-cell-content.ts
var getEmbedCellContent = (app, pathOrUrl, options) => {
  const {
    shouldRemoveMarkdown = false,
    isExternal = false,
    isExport = false
  } = options != null ? options : {};
  if (shouldRemoveMarkdown)
    return pathOrUrl;
  if (pathOrUrl === "")
    return pathOrUrl;
  if (isExternal) {
    if (isObsidianLink(pathOrUrl) || isTwitterLink(pathOrUrl) || isYouTubeLink(pathOrUrl)) {
      return `![](${pathOrUrl})`;
    }
    return `<a href="${pathOrUrl}">${pathOrUrl}</a>`;
  }
  if (isExport)
    return `![[${pathOrUrl}]]`;
  return `![](${getResourcePath(app, pathOrUrl)})`;
};

// src/react/loom-app/embed-cell/embed/index.tsx
var import_jsx_runtime76 = __toESM(require_jsx_runtime());
function Embed({
  isExternalLink: isExternalLink2,
  content,
  aspectRatio,
  horizontalPadding,
  verticalPadding
}) {
  const { containerRef, renderRef } = useRenderMarkdown(content, {
    isEmbed: true,
    isExternalLink: isExternalLink2
  });
  const paddingX = getSpacing(horizontalPadding);
  const paddingY = getSpacing(verticalPadding);
  return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
    "div",
    {
      style: {
        aspectRatio,
        paddingLeft: paddingX,
        paddingRight: paddingX,
        paddingTop: paddingY,
        paddingBottom: paddingY
      },
      ref: (node) => {
        containerRef.current = node;
        appendOrReplaceFirstChild(node, renderRef.current);
      }
    }
  );
}

// src/react/loom-app/embed-cell/index.tsx
var import_jsx_runtime77 = __toESM(require_jsx_runtime());
function EmbedCell6({
  isExternal,
  pathOrUrl,
  aspectRatio,
  horizontalPadding,
  verticalPadding
}) {
  const { app } = useAppMount();
  const content = getEmbedCellContent(app, pathOrUrl, {
    isExternal
  });
  return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "dataloom-embed-cell", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
    Embed,
    {
      isExternalLink: isExternal,
      content,
      aspectRatio,
      horizontalPadding,
      verticalPadding
    }
  ) });
}

// src/react/loom-app/embed-cell-edit/index.tsx
var import_react37 = __toESM(require_react());

// src/react/loom-app/embed-cell-edit/external-embed-input.tsx
var import_react36 = __toESM(require_react());
var import_jsx_runtime78 = __toESM(require_jsx_runtime());
function ExternalEmbedInput({ value, onChange }) {
  const ref = import_react36.default.useRef(null);
  usePlaceCursorAtEnd(ref, value);
  return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
    input_default,
    {
      ref,
      showBorder: true,
      placeholder: "Enter a url",
      value,
      onChange
    }
  );
}

// src/react/loom-app/embed-cell-edit/internal-embed-suggest.tsx
var import_jsx_runtime79 = __toESM(require_jsx_runtime());
function InternalEmbedSuggest({ onChange }) {
  return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
    SuggestList,
    {
      showInput: true,
      hiddenExtensions: ["md", LOOM_EXTENSION],
      onItemClick: (item) => {
        var _a2;
        return onChange((_a2 = item == null ? void 0 : item.path) != null ? _a2 : "");
      }
    }
  );
}

// src/react/loom-app/embed-cell-edit/index.tsx
var import_jsx_runtime80 = __toESM(require_jsx_runtime());
function EmbedCellEdit({
  closeRequest,
  isExternalLink: isExternalLink2,
  value,
  onChange,
  onClose,
  onExternalLinkToggle
}) {
  const [externalLink, setExternalLink] = import_react37.default.useState(
    isExternalLink2 ? value : ""
  );
  import_react37.default.useEffect(() => {
    if (closeRequest !== null) {
      if (isExternalLink2) {
        if (externalLink !== value)
          onChange(externalLink);
      }
      onClose();
    }
  }, [isExternalLink2, value, externalLink, closeRequest, onClose, onChange]);
  function handleSuggestChange(value2) {
    onChange(value2);
    onClose();
  }
  return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "dataloom-embed-cell-edit", children: [
    /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Padding, { width: "100%", p: "md", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(Stack, { spacing: "sm", width: "100%", children: [
      /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("label", { htmlFor: "external-switch", children: "External Link" }),
      /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
        Switch,
        {
          id: "external-switch",
          value: isExternalLink2,
          onToggle: onExternalLinkToggle
        }
      )
    ] }) }),
    /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Divider, {}),
    isExternalLink2 && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Padding, { width: "100%", p: "md", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
      ExternalEmbedInput,
      {
        value: externalLink,
        onChange: setExternalLink
      }
    ) }),
    !isExternalLink2 && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(InternalEmbedSuggest, { onChange: handleSuggestChange })
  ] });
}

// src/react/loom-app/last-edited-time-cell/index.tsx
var import_jsx_runtime81 = __toESM(require_jsx_runtime());
function LastEditedTimeCell3({ value }) {
  return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: "dataloom-last-edited-time-cell", children: value });
}

// src/react/loom-app/creation-time-cell/index.tsx
var import_jsx_runtime82 = __toESM(require_jsx_runtime());
function CreationTimeCell3({ value }) {
  return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "dataloom-creation-time-cell", children: value });
}

// src/react/loom-app/source-file-cell/index.tsx
var import_jsx_runtime83 = __toESM(require_jsx_runtime());
function SourceFileCell6({ content }) {
  const { containerRef, renderRef } = useRenderMarkdown(content);
  return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
    "div",
    {
      className: "dataloom-source-file-cell",
      ref: (node) => {
        if (content !== "") {
          containerRef.current = node;
          appendOrReplaceFirstChild(node, renderRef.current);
        }
      },
      children: content === "" && content
    }
  );
}

// src/react/shared/bubble/index.tsx
var import_jsx_runtime84 = __toESM(require_jsx_runtime());
function Bubble({
  variant = "default",
  canRemove,
  icon,
  value,
  onRemoveClick
}) {
  let className = "dataloom-bubble";
  if (variant === "no-fill") {
    className += " dataloom-bubble--no-fill";
  }
  return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(Stack, { spacing: "lg", isHorizontal: true, children: [
    /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(Stack, { spacing: "sm", isHorizontal: true, children: [
      icon,
      /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", { children: value })
    ] }),
    canRemove && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
      Button,
      {
        size: "sm",
        invertFocusColor: true,
        icon: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Icon, { lucideId: "x", color: "var(--text-on-accent)" }),
        ariaLabel: "Remove sort",
        onClick: onRemoveClick
      }
    )
  ] }) });
}

// src/react/loom-app/source-cell/index.tsx
var import_jsx_runtime85 = __toESM(require_jsx_runtime());
function SourceCell3({
  content,
  sourceType,
  propertyType
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "dataloom-source-cell", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
    Bubble,
    {
      variant: "no-fill",
      icon: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
        Icon,
        {
          lucideId: getIconIdForSourceType(sourceType, {
            propertyType
          })
        }
      ),
      value: content
    }
  ) });
}

// src/shared/cell-content/time-content.ts
var getTimeCellContent = (dateTime, format, separator, hour12) => {
  if (dateTime !== null) {
    return dateTimeToDateString(dateTime, format, separator, {
      includeTime: true,
      hour12
    });
  }
  return "";
};

// src/shared/cell-content/source-file-content.ts
var getSourceFileContent = (path, shouldRemoveMarkdown = false) => {
  if (shouldRemoveMarkdown)
    return path;
  if (path === "")
    return "";
  let fileName = stripDirectory(path);
  if (isMarkdownFile(path)) {
    fileName = stripFileExtension(fileName);
  }
  return componentsToWikiLink(fileName, null);
};

// src/shared/cell-content/file-cell-content.ts
var getFileCellContent = (path, shouldRemoveMarkdown) => {
  if (shouldRemoveMarkdown)
    return path;
  if (path === "")
    return "";
  return componentsToWikiLink(path, null);
};

// src/shared/cell-content/date-cell-content.ts
var getDateCellContent = (dateTime, format, separator, includeTime, hour12) => {
  if (dateTime !== null)
    return dateTimeToDateString(dateTime, format, separator, {
      includeTime,
      hour12
    });
  return "";
};

// src/react/loom-app/disabled-cell/index.tsx
var import_jsx_runtime86 = __toESM(require_jsx_runtime());
function DisabledCell({
  hasValidFrontmatter,
  doesColumnHaveFrontmatterKey
}) {
  let ariaLabel = "";
  if (!doesColumnHaveFrontmatterKey) {
    ariaLabel = "This cell is disabled until you choose a frontmatter key for this column";
  } else if (!hasValidFrontmatter) {
    ariaLabel = "This cell has an invalid property value. Please correct it in the source file.";
  }
  return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "dataloom-disabled-cell", "aria-label": ariaLabel, children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Text, { value: hasValidFrontmatter ? "" : "Invalid property value" }) });
}

// src/react/loom-app/body-cell-container/index.tsx
var import_jsx_runtime87 = __toESM(require_jsx_runtime());
function BodyCellContainer(props) {
  const {
    id: id2,
    columnId,
    hasValidFrontmatter,
    source,
    includeTime,
    aspectRatio,
    dateFormatSeparator,
    numberFormat,
    verticalPadding,
    frontmatterKey,
    currencyType,
    horizontalPadding,
    dateFormat,
    hour12,
    numberPrefix,
    numberSuffix,
    numberSeparator,
    type,
    rowCreationTime,
    rowLastEditedTime,
    columnTags,
    width,
    shouldWrapOverflow,
    onCellChange
  } = props;
  const shouldRequestOnClose = type === "text" /* TEXT */ || type === "embed" /* EMBED */ || type === "number" /* NUMBER */ || type === "tag" /* TAG */ || type === "multi-tag" /* MULTI_TAG */ || type === "date" /* DATE */;
  let isDisabled = false;
  if (hasValidFrontmatter === false) {
    isDisabled = true;
  } else if (source !== null && frontmatterKey === null && type !== "source" /* SOURCE */ && type !== "source-file" /* SOURCE_FILE */) {
    isDisabled = true;
  }
  const isUneditable = type === "checkbox" /* CHECKBOX */ || type === "creation-time" /* CREATION_TIME */ || type === "last-edited-time" /* LAST_EDITED_TIME */ || type === "source" /* SOURCE */ || type === "source-file" /* SOURCE_FILE */;
  const COMPONENT_ID = `body-cell-${id2}`;
  const menu = useMenu(COMPONENT_ID);
  async function copyTextToClipboard(value) {
    try {
      await navigator.clipboard.writeText(value);
      new import_obsidian11.Notice("Copied cell content to clipboard");
    } catch (err) {
      console.error(err);
    }
  }
  function onMenuTriggerEnterDown(cellActionCallback) {
    return () => {
      cellActionCallback();
    };
  }
  function onMenuTriggerClick(cellActionCallback) {
    return () => {
      cellActionCallback();
    };
  }
  const handleTextChange = import_react38.default.useCallback(
    (value) => {
      onCellChange(id2, { content: value });
    },
    [id2, onCellChange]
  );
  const handleNumberChange = import_react38.default.useCallback(
    (value) => {
      onCellChange(id2, { value });
    },
    [id2, onCellChange]
  );
  const handleDateTimeChange = import_react38.default.useCallback(
    (value) => {
      onCellChange(id2, { dateTime: value });
    },
    [id2, onCellChange]
  );
  const handleEmbedChange = import_react38.default.useCallback(
    (pathOrUrl) => {
      onCellChange(id2, { pathOrUrl });
    },
    [id2, onCellChange]
  );
  const handleFileChange = import_react38.default.useCallback(
    (path) => {
      onCellChange(id2, { path });
    },
    [id2, onCellChange]
  );
  let menuWidth = menu.position.width;
  if (type === "tag" /* TAG */ || type === "multi-tag" /* MULTI_TAG */ || type === "embed" /* EMBED */) {
    menuWidth = 250;
  } else if (type === "file" /* FILE */) {
    menuWidth = 275;
  } else if (type === "date" /* DATE */) {
    menuWidth = 235;
  }
  let menuHeight = menu.position.height;
  if (type === "tag" /* TAG */ || type === "multi-tag" /* MULTI_TAG */ || type === "date" /* DATE */ || type === "number" /* NUMBER */ || type === "file" /* FILE */ || type === "embed" /* EMBED */) {
    menuHeight = 0;
  }
  let className = "dataloom-cell--body__container";
  const overflowClass = useOverflow(shouldWrapOverflow, {
    ellipsis: type === "date" /* DATE */
  });
  className += " " + overflowClass;
  if (isUneditable) {
    className += " dataloom-cell--uneditable";
  }
  let shouldRunTrigger = true;
  if (isUneditable) {
    shouldRunTrigger = false;
  }
  if (isDisabled) {
    return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
      "div",
      {
        className: className + " dataloom-cell--body__container--no-padding",
        style: {
          width
        },
        children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
          DisabledCell,
          {
            hasValidFrontmatter: hasValidFrontmatter != null ? hasValidFrontmatter : true,
            doesColumnHaveFrontmatterKey: frontmatterKey !== null
          }
        )
      }
    );
  }
  let contentNode = null;
  let menuNode = null;
  let handleCellContextClick = () => void 0;
  let handleMenuTriggerEnterDown = () => void 0;
  let handleMenuTriggerClick = () => void 0;
  let handleMenuTriggerBackspaceDown = () => void 0;
  switch (type) {
    case "text" /* TEXT */: {
      const { content } = props;
      handleMenuTriggerBackspaceDown = () => {
        onCellChange(id2, { content: "" });
      };
      handleCellContextClick = () => {
        copyTextToClipboard(content);
      };
      contentNode = /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(TextCell6, { value: content });
      menuNode = /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
        TextCellEdit,
        {
          cellId: id2,
          closeRequest: menu.closeRequest,
          shouldWrapOverflow,
          value: content,
          onChange: handleTextChange,
          onClose: menu.onClose
        }
      );
      break;
    }
    case "number" /* NUMBER */: {
      const { value } = props;
      const content = getNumberCellContent(numberFormat, value, {
        currency: currencyType,
        prefix: numberPrefix,
        suffix: numberSuffix,
        separator: numberSeparator
      });
      handleMenuTriggerBackspaceDown = () => {
        onCellChange(id2, { value: null });
      };
      handleCellContextClick = () => {
        copyTextToClipboard(content);
      };
      contentNode = /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(NumberCell7, { content });
      menuNode = /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
        NumberCellEdit,
        {
          closeRequest: menu.closeRequest,
          value,
          onChange: handleNumberChange,
          onClose: menu.onClose
        }
      );
      break;
    }
    case "tag" /* TAG */:
    case "multi-tag" /* MULTI_TAG */: {
      let handleTagAdd2 = function(markdown, color) {
        if (markdown === "")
          return;
        onTagAdd(id2, columnId, markdown.trim(), color);
      }, handleRemoveTagClick2 = function(tagId) {
        onTagCellRemove(id2, tagId);
      }, handleTagColorChange2 = function(tagId, value) {
        onTagChange(columnId, tagId, { color: value });
      }, handleTagDeleteClick2 = function(tagId) {
        onTagDeleteClick(columnId, tagId);
      }, handleTagContentChange2 = function(tagId, value) {
        onTagChange(columnId, tagId, { content: value });
      }, handleTagClick2 = function(tagId) {
        onTagCellAdd(id2, tagId);
      };
      var handleTagAdd = handleTagAdd2, handleRemoveTagClick = handleRemoveTagClick2, handleTagColorChange = handleTagColorChange2, handleTagDeleteClick = handleTagDeleteClick2, handleTagContentChange = handleTagContentChange2, handleTagClick = handleTagClick2;
      const {
        onTagCellRemove,
        onTagAdd,
        onTagChange,
        onTagCellAdd,
        onTagDeleteClick,
        onTagCellMultipleRemove
      } = props;
      let cellTags = [];
      if (type === "tag" /* TAG */) {
        const { tagId } = props;
        cellTags = columnTags.filter((tag) => tag.id === tagId);
        handleMenuTriggerBackspaceDown = () => {
          if (tagId !== null) {
            onTagCellRemove(id2, tagId);
          }
        };
      } else {
        const { tagIds, multiTagSortDir } = props;
        cellTags = columnTags.filter((tag) => tagIds.includes(tag.id));
        cellTags.sort((a2, b2) => sortByText(a2.content, b2.content, multiTagSortDir, false));
        handleMenuTriggerBackspaceDown = () => {
          onTagCellMultipleRemove(id2, tagIds);
        };
      }
      handleCellContextClick = () => {
        const content = cellTags.map((tag) => tag.content).join(",");
        copyTextToClipboard(content);
      };
      if (type === "tag" /* TAG */) {
        if (cellTags.length > 0) {
          contentNode = /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
            TagCell6,
            {
              content: cellTags[0].content,
              color: cellTags[0].color
            }
          );
        }
      } else {
        contentNode = /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(MultiTagCell6, { cellTags });
      }
      menuNode = /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
        TagCellEdit,
        {
          isMulti: type === "multi-tag" /* MULTI_TAG */,
          closeRequest: menu.closeRequest,
          columnTags,
          cellTags,
          onTagColorChange: handleTagColorChange2,
          onTagAdd: handleTagAdd2,
          onRemoveTag: handleRemoveTagClick2,
          onTagClick: handleTagClick2,
          onTagDelete: handleTagDeleteClick2,
          onTagContentChange: handleTagContentChange2,
          onClose: menu.onClose
        }
      );
      break;
    }
    case "date" /* DATE */: {
      let handleDateFormatChange2 = function(value) {
        onColumnChange(
          columnId,
          { dateFormat: value },
          { shouldSortRows: true }
        );
      }, handleDateFormatSeparatorChange2 = function(value) {
        onColumnChange(
          columnId,
          { dateFormatSeparator: value },
          { shouldSortRows: true }
        );
      }, handleTimeFormatChange2 = function(value) {
        onColumnChange(
          columnId,
          { hour12: value },
          { shouldSortRows: true }
        );
      };
      var handleDateFormatChange = handleDateFormatChange2, handleDateFormatSeparatorChange = handleDateFormatSeparatorChange2, handleTimeFormatChange = handleTimeFormatChange2;
      const { dateTime, onColumnChange } = props;
      const content = getDateCellContent(
        dateTime,
        dateFormat,
        dateFormatSeparator,
        includeTime,
        hour12
      );
      handleMenuTriggerBackspaceDown = () => {
        onCellChange(id2, { dateTime: null });
      };
      handleCellContextClick = () => {
        copyTextToClipboard(content);
      };
      async function handleIncludeTimeToggle(value) {
        onColumnChange(
          columnId,
          { includeTime: value, frontmatterKey },
          { shouldSortRows: true }
        );
      }
      contentNode = /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(DateCell6, { content });
      menuNode = /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
        DateCellEdit,
        {
          cellId: id2,
          value: dateTime,
          includeTime,
          closeRequest: menu.closeRequest,
          dateFormat,
          hour12,
          dateFormatSeparator,
          onDateTimeChange: handleDateTimeChange,
          onDateFormatChange: handleDateFormatChange2,
          onClose: menu.onClose,
          onCloseRequestClear: menu.onCloseRequestClear,
          onIncludeTimeToggle: handleIncludeTimeToggle,
          onDateFormatSeparatorChange: handleDateFormatSeparatorChange2,
          onTimeFormatChange: handleTimeFormatChange2
        }
      );
      break;
    }
    case "checkbox" /* CHECKBOX */: {
      let handleCheckboxChange2 = function(value2) {
        onCellChange(id2, { value: value2 });
      };
      var handleCheckboxChange = handleCheckboxChange2;
      const { value } = props;
      handleMenuTriggerBackspaceDown = () => {
        onCellChange(id2, { value: false });
      };
      handleCellContextClick = () => {
        copyTextToClipboard(value ? "true" : "false");
      };
      handleMenuTriggerClick = onMenuTriggerClick(() => {
        if (value) {
          handleCheckboxChange2(false);
        } else {
          handleCheckboxChange2(true);
        }
      });
      handleMenuTriggerEnterDown = onMenuTriggerEnterDown(() => {
        if (value) {
          handleCheckboxChange2(false);
        } else {
          handleCheckboxChange2(true);
        }
      });
      contentNode = /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(CheckboxCell6, { value });
      break;
    }
    case "creation-time" /* CREATION_TIME */: {
      const content = getTimeCellContent(
        rowCreationTime,
        dateFormat,
        dateFormatSeparator,
        hour12
      );
      handleCellContextClick = () => {
        copyTextToClipboard(content);
      };
      contentNode = /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(CreationTimeCell3, { value: content });
      break;
    }
    case "last-edited-time" /* LAST_EDITED_TIME */: {
      const content = getTimeCellContent(
        rowLastEditedTime,
        dateFormat,
        dateFormatSeparator,
        hour12
      );
      handleCellContextClick = () => {
        copyTextToClipboard(content);
      };
      contentNode = /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(LastEditedTimeCell3, { value: content });
      break;
    }
    case "source" /* SOURCE */: {
      const content = getSourceCellContent(source);
      handleCellContextClick = () => {
        copyTextToClipboard(content);
      };
      let propertyType = void 0;
      if ((source == null ? void 0 : source.type) === "frontmatter" /* FRONTMATTER */) {
        propertyType = source == null ? void 0 : source.propertyType;
      }
      contentNode = /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
        SourceCell3,
        {
          sourceType: source == null ? void 0 : source.type,
          propertyType,
          content
        }
      );
      break;
    }
    case "source-file" /* SOURCE_FILE */: {
      const { path } = props;
      const content = getSourceFileContent(path);
      handleCellContextClick = () => {
        copyTextToClipboard(content);
      };
      contentNode = /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(SourceFileCell6, { content });
      break;
    }
    case "embed" /* EMBED */: {
      let handleExternalLinkToggle2 = function(value) {
        onCellChange(id2, { isExternal: value });
      };
      var handleExternalLinkToggle = handleExternalLinkToggle2;
      const { pathOrUrl, isExternal } = props;
      handleCellContextClick = () => {
        copyTextToClipboard(pathOrUrl);
      };
      handleMenuTriggerBackspaceDown = () => {
        onCellChange(id2, { pathOrUrl: "", alias: null });
      };
      contentNode = /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
        EmbedCell6,
        {
          isExternal,
          pathOrUrl,
          verticalPadding,
          horizontalPadding,
          aspectRatio
        }
      );
      menuNode = /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
        EmbedCellEdit,
        {
          isExternalLink: isExternal,
          closeRequest: menu.closeRequest,
          value: pathOrUrl,
          onChange: handleEmbedChange,
          onClose: menu.onClose,
          onExternalLinkToggle: handleExternalLinkToggle2
        }
      );
      break;
    }
    case "file" /* FILE */: {
      const { path } = props;
      const content = getFileCellContent(path, false);
      handleMenuTriggerBackspaceDown = () => {
        onCellChange(id2, { path: "", alias: null });
      };
      handleCellContextClick = () => {
        copyTextToClipboard(content);
      };
      contentNode = /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(FileCell6, { content });
      menuNode = /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
        FileCellEdit,
        {
          onChange: handleFileChange,
          onClose: menu.onClose
        }
      );
      break;
    }
    default:
      throw new Error("Unhandled cell type");
  }
  return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_jsx_runtime87.Fragment, { children: [
    /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
      menu_trigger_default,
      {
        ref: menu.triggerRef,
        variant: "cell",
        menuId: menu.id,
        isFocused: menu.isTriggerFocused,
        level: 1 /* ONE */,
        onClick: handleMenuTriggerClick,
        onEnterDown: handleMenuTriggerEnterDown,
        onBackspaceDown: handleMenuTriggerBackspaceDown,
        shouldRunTrigger,
        onOpen: () => menu.onOpen(1 /* ONE */, {
          shouldRequestOnClose
        }),
        children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
          "div",
          {
            onContextMenu: handleCellContextClick,
            className,
            style: {
              width
            },
            children: contentNode
          }
        )
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
      Menu,
      {
        id: menu.id,
        hideBorder: type === "text" /* TEXT */ || type === "number" /* NUMBER */,
        isOpen: menu.isOpen,
        position: menu.position,
        width: menuWidth,
        height: menuHeight,
        children: menuNode
      }
    )
  ] });
}

// src/shared/frontmatter/utils.ts
var getAcceptedFrontmatterTypes = (type) => {
  switch (type) {
    case "text" /* TEXT */:
    case "embed" /* EMBED */:
    case "file" /* FILE */:
    case "tag" /* TAG */:
      return ["text" /* TEXT */];
    case "number" /* NUMBER */:
      return ["number" /* NUMBER */];
    case "date" /* DATE */:
      return ["date" /* DATE */, "datetime" /* DATETIME */];
    case "checkbox" /* CHECKBOX */:
      return ["checkbox" /* CHECKBOX */];
    case "multi-tag" /* MULTI_TAG */:
      return [
        "aliases" /* ALIASES */,
        "multitext" /* MULTITEXT */,
        "tags" /* TAGS */
      ];
    case "creation-time" /* CREATION_TIME */:
    case "last-edited-time" /* LAST_EDITED_TIME */:
    case "source" /* SOURCE */:
    case "source-file" /* SOURCE_FILE */:
      return [];
    default:
      throw new Error(`Cell type ${type} not handled`);
  }
};

// src/shared/frontmatter/frontmatter-cache.ts
var FrontmatterCache = class _FrontmatterCache {
  constructor() {
    this.cache = /* @__PURE__ */ new Map();
  }
  loadProperties(app) {
    this.cache.clear();
    const properties = getAllObsidianProperties(app);
    Object.values(properties).forEach((value) => {
      const { name, type } = value;
      this.cache.set(name, type != null ? type : "text" /* TEXT */);
    });
  }
  getPropertyNames(type) {
    const keys = [];
    for (const [key, value] of this.cache.entries()) {
      if (value === type) {
        keys.push(key);
      }
    }
    return keys;
  }
  getPropertyType(name) {
    return this.cache.get(name);
  }
  setPropertyType(name, type) {
    if (type === null) {
      this.cache.delete(name);
      return;
    }
    this.cache.set(name, type);
  }
  getCache() {
    return this.cache;
  }
  static getInstance() {
    if (!this.instance) {
      this.instance = new _FrontmatterCache();
    }
    return this.instance;
  }
};

// src/react/loom-app/table/index.tsx
var import_jsx_runtime88 = __toESM(require_jsx_runtime());
var Table2 = import_react39.default.forwardRef(function Table3({
  sources,
  rows,
  columns,
  numFrozenColumns,
  resizingColumnId,
  showCalculationRow,
  onColumnDeleteClick,
  onColumnAddClick,
  onColumnTypeChange,
  onFrozenColumnsChange,
  onColumnReorder,
  onRowDeleteClick,
  onRowInsertAboveClick,
  onRowInsertBelowClick,
  onColumnChange,
  onCellChange,
  onTagAdd,
  onTagCellAdd,
  onTagCellRemove,
  onTagCellMultipleRemove,
  onTagChange,
  onTagDeleteClick,
  onRowReorder
}, ref) {
  const previousRowLength = usePrevious(rows.length);
  import_react39.default.useEffect(() => {
    var _a2;
    if (previousRowLength === void 0)
      return;
    if (previousRowLength < rows.length)
      (_a2 = ref.current) == null ? void 0 : _a2.scrollToIndex(rows.length - 1);
  }, [ref, previousRowLength, rows.length]);
  const visibleColumns = columns.filter((column) => column.isVisible);
  return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
    TableVirtuoso,
    {
      ref,
      overscan: 30,
      style: {
        width: "100%",
        height: "100%"
      },
      totalCount: rows.length,
      components: {
        ...Components,
        TableRow: ({ style, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
          BodyRow,
          {
            ...props,
            style,
            onRowReorder
          }
        )
      },
      fixedHeaderContent: () => {
        const tableColumns = [null, ...visibleColumns, null];
        return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "dataloom-row", children: tableColumns.map((column, i2) => {
          let content;
          let key;
          if (column === null) {
            key = `filler-${i2}`;
            if (i2 === 0) {
              content = /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_jsx_runtime88.Fragment, {});
            } else {
              content = /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
                NewColumnButton,
                {
                  onClick: onColumnAddClick
                }
              );
            }
          } else {
            const { id: id2, type } = column;
            const frontmatterTypes = getAcceptedFrontmatterTypes(type);
            let frontmatterKeys = [];
            frontmatterTypes.forEach((frontmatterType) => {
              frontmatterKeys = [
                ...frontmatterKeys,
                ...FrontmatterCache.getInstance().getPropertyNames(
                  frontmatterType
                )
              ];
            });
            const isKeySelectable = (key2) => {
              const columnWithKey = columns.find(
                (column2) => column2.frontmatterKey === key2
              );
              if (!columnWithKey)
                return true;
              if (columnWithKey.id === id2)
                return true;
              return false;
            };
            const columnKeys = frontmatterKeys.map(
              (key2) => ({
                value: key2,
                isSelectable: isKeySelectable(key2)
              })
            );
            key = id2;
            content = /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
              HeaderCellContainer,
              {
                index: i2,
                column,
                frontmatterKeys: columnKeys,
                numColumns: columns.length,
                numSources: sources.length,
                numFrozenColumns,
                resizingColumnId,
                onColumnChange,
                onColumnDeleteClick,
                onColumnTypeChange,
                onFrozenColumnsChange
              },
              id2
            );
          }
          return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
            HeaderCell,
            {
              index: i2,
              numFrozenColumns,
              columnId: column == null ? void 0 : column.id,
              content,
              isDraggable: i2 > 0 && i2 < tableColumns.length - 1,
              onColumnReorder
            },
            key
          );
        }) });
      },
      fixedFooterContent: () => {
        if (!showCalculationRow)
          return void 0;
        const columns2 = [null, ...visibleColumns, null];
        return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "dataloom-row", children: columns2.map((column, i2) => {
          let content;
          let key;
          if (column === null) {
            key = `filler-${i2}`;
            content = /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_jsx_runtime88.Fragment, {});
          } else {
            const {
              id: columnId,
              type,
              currencyType,
              dateFormat,
              dateFormatSeparator,
              numberFormat,
              width,
              tags,
              calculationType
            } = column;
            const columnCells = rows.map((row) => {
              const { id: rowId, cells } = row;
              const cell = cells.find(
                (cell2) => cell2.columnId === columnId
              );
              if (!cell)
                throw new CellNotFoundError({
                  columnId,
                  rowId
                });
              return cell;
            });
            key = columnId;
            content = /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
              FooterCellContainer,
              {
                sources,
                columnId,
                columnTags: tags,
                numberFormat,
                dateFormatSeparator,
                currencyType,
                dateFormat,
                columnCells,
                rows,
                calculationType,
                width,
                cellType: type,
                onColumnChange
              }
            );
          }
          return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
            FooterCell,
            {
              index: i2,
              numFrozenColumns,
              content
            },
            key
          );
        }) });
      },
      itemContent: (index) => {
        var _a2;
        const row = rows[index];
        const {
          id: rowId,
          lastEditedDateTime,
          creationDateTime,
          sourceId
        } = row;
        const source = (_a2 = sources.find((source2) => source2.id === sourceId)) != null ? _a2 : null;
        const columns2 = [null, ...visibleColumns, null];
        return columns2.map((column, i2) => {
          var _a3;
          let contentNode;
          let key;
          if (column === null) {
            key = `filler-${i2}`;
            if (i2 === 0) {
              contentNode = /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
                RowOptions2,
                {
                  source,
                  rowId,
                  onDeleteClick: onRowDeleteClick,
                  onInsertAboveClick: onRowInsertAboveClick,
                  onInsertBelowClick: onRowInsertBelowClick,
                  onRowReorder
                }
              );
            } else {
              contentNode = /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_jsx_runtime88.Fragment, {});
            }
          } else {
            const {
              id: columnId,
              width,
              type,
              shouldWrapOverflow,
              currencyType,
              includeTime,
              dateFormatSeparator,
              numberPrefix,
              numberSeparator,
              numberFormat,
              numberSuffix,
              dateFormat,
              hour12,
              tags,
              verticalPadding,
              horizontalPadding,
              aspectRatio,
              frontmatterKey,
              multiTagSortDir
            } = column;
            const cell = row.cells.find(
              (cell2) => cell2.columnId === columnId
            );
            if (!cell)
              throw new CellNotFoundError({
                columnId,
                rowId
              });
            const source2 = (_a3 = sources.find(
              (source3) => source3.id === row.sourceId
            )) != null ? _a3 : null;
            key = column.id;
            const { id: id2, hasValidFrontmatter } = cell;
            const commonProps = {
              id: id2,
              hasValidFrontmatter,
              columnId,
              frontmatterKey,
              verticalPadding,
              includeTime,
              dateFormatSeparator,
              horizontalPadding,
              aspectRatio,
              columnTags: tags,
              source: source2,
              hour12,
              numberFormat,
              rowCreationTime: creationDateTime,
              dateFormat,
              currencyType,
              numberPrefix,
              numberSuffix,
              numberSeparator,
              rowLastEditedTime: lastEditedDateTime,
              shouldWrapOverflow,
              width,
              onCellChange
            };
            switch (type) {
              case "text" /* TEXT */: {
                const { content } = cell;
                contentNode = /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
                  BodyCellContainer,
                  {
                    ...commonProps,
                    type,
                    content
                  },
                  id2
                );
                break;
              }
              case "number" /* NUMBER */: {
                const { value } = cell;
                contentNode = /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
                  BodyCellContainer,
                  {
                    ...commonProps,
                    type,
                    value
                  },
                  id2
                );
                break;
              }
              case "tag" /* TAG */: {
                const { tagId } = cell;
                contentNode = /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
                  BodyCellContainer,
                  {
                    ...commonProps,
                    type,
                    tagId,
                    onTagAdd,
                    onTagCellAdd,
                    onTagCellRemove,
                    onTagCellMultipleRemove,
                    onTagChange,
                    onTagDeleteClick
                  },
                  id2
                );
                break;
              }
              case "multi-tag" /* MULTI_TAG */: {
                const { tagIds } = cell;
                contentNode = /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
                  BodyCellContainer,
                  {
                    ...commonProps,
                    type,
                    tagIds,
                    multiTagSortDir,
                    onCellChange,
                    onTagAdd,
                    onTagCellAdd,
                    onTagCellRemove,
                    onTagCellMultipleRemove,
                    onTagChange,
                    onTagDeleteClick
                  },
                  id2
                );
                break;
              }
              case "file" /* FILE */: {
                const { path, alias } = cell;
                contentNode = /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
                  BodyCellContainer,
                  {
                    ...commonProps,
                    type,
                    path,
                    alias
                  },
                  id2
                );
                break;
              }
              case "embed" /* EMBED */: {
                const { pathOrUrl, alias, isExternal } = cell;
                contentNode = /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
                  BodyCellContainer,
                  {
                    ...commonProps,
                    type,
                    pathOrUrl,
                    alias,
                    isExternal
                  },
                  id2
                );
                break;
              }
              case "checkbox" /* CHECKBOX */: {
                const { value } = cell;
                contentNode = /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
                  BodyCellContainer,
                  {
                    ...commonProps,
                    type,
                    value
                  },
                  id2
                );
                break;
              }
              case "date" /* DATE */: {
                const { dateTime } = cell;
                contentNode = /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
                  BodyCellContainer,
                  {
                    ...commonProps,
                    type,
                    dateTime,
                    onColumnChange
                  },
                  id2
                );
                break;
              }
              case "creation-time" /* CREATION_TIME */: {
                contentNode = /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
                  BodyCellContainer,
                  {
                    ...commonProps,
                    type
                  },
                  id2
                );
                break;
              }
              case "last-edited-time" /* LAST_EDITED_TIME */: {
                contentNode = /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
                  BodyCellContainer,
                  {
                    ...commonProps,
                    type
                  },
                  id2
                );
                break;
              }
              case "source" /* SOURCE */: {
                contentNode = /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
                  BodyCellContainer,
                  {
                    ...commonProps,
                    type
                  },
                  id2
                );
                break;
              }
              case "source-file" /* SOURCE_FILE */: {
                const { path } = cell;
                contentNode = /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
                  BodyCellContainer,
                  {
                    ...commonProps,
                    type,
                    path
                  },
                  id2
                );
                break;
              }
              default:
                throw new Error(
                  `Cell type ${type} not implemented`
                );
            }
          }
          return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
            BodyCell,
            {
              rowId,
              contentNode,
              index: i2,
              numFrozenColumns
            },
            key
          );
        });
      }
    }
  );
});
var Components = {
  Table: ({ ...props }) => {
    return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "dataloom-table", ...props });
  },
  //Don't apply styles because we want to apply sticky positioning
  //to the cells, not the header container
  TableHead: import_react39.default.forwardRef(({ ...props }, ref) => {
    return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
      "div",
      {
        className: "dataloom-header",
        ...props,
        style: {
          position: void 0,
          top: void 0,
          zIndex: void 0
        },
        ref
      }
    );
  }),
  TableBody: import_react39.default.forwardRef(({ style, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "dataloom-body", ...props, style, ref })),
  TableFoot: import_react39.default.forwardRef(({ ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
    "div",
    {
      className: "dataloom-footer",
      ...props,
      style: {
        position: void 0,
        bottom: void 0,
        zIndex: void 0
      },
      ref
    }
  )),
  FillerRow: ({ height }) => /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "dataloom-row", style: { height } })
};
var areEqual = (prevProps, nextProps) => {
  return import_lodash8.default.isEqual(prevProps, nextProps);
};
var table_default = import_react39.default.memo(Table2, areEqual);

// src/react/loom-app/option-bar/search-bar/index.tsx
var import_jsx_runtime89 = __toESM(require_jsx_runtime());
function SearchBar() {
  const { searchText, setSearchText, isSearchBarVisible, toggleSearchBar } = useLoomState();
  return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "dataloom-search-bar", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(Stack, { spacing: "lg", isHorizontal: true, children: [
    isSearchBarVisible && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
      input_default,
      {
        placeholder: "Type to search...",
        value: searchText,
        onChange: (value) => setSearchText(value)
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
      Button,
      {
        icon: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Icon, { lucideId: "search" }),
        ariaLabel: "Search",
        onClick: () => toggleSearchBar()
      }
    )
  ] }) });
}

// src/react/loom-app/option-bar/active-filter-bubble/index.tsx
var import_jsx_runtime90 = __toESM(require_jsx_runtime());
function ActiveFilterBubble({ numActive }) {
  if (numActive === 0)
    return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_jsx_runtime90.Fragment, {});
  const value = `${numActive} active filter${numActive > 1 ? "s" : ""}`;
  return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: "dataloom-active-filter-bubble", children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Bubble, { value }) });
}

// src/react/loom-app/option-bar/more-menu/index.tsx
var import_react47 = __toESM(require_react());

// src/obsidian/modal/export-modal.tsx
var import_obsidian14 = require("obsidian");
var import_client2 = __toESM(require_client());

// src/react/export-app/index.tsx
var import_react40 = __toESM(require_react());

// src/shared/export/types.ts
var ExportType = /* @__PURE__ */ ((ExportType2) => {
  ExportType2["UNSELECTED"] = "Select an option";
  ExportType2["CSV"] = "CSV";
  ExportType2["MARKDOWN"] = "Markdown";
  return ExportType2;
})(ExportType || {});

// src/react/export-app/export-type-select.tsx
var import_jsx_runtime91 = __toESM(require_jsx_runtime());
function ExportTypeSelect({ value, onChange }) {
  return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(Stack, { spacing: "xl", children: [
    /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("label", { htmlFor: "type-select", children: "File Type" }),
    /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
      "select",
      {
        id: "type-select",
        value,
        onChange: (e) => onChange(e.target.value),
        children: Object.values(ExportType).map((type) => /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("option", { value: type, children: type }, type))
      }
    )
  ] });
}

// src/react/export-app/content-textarea.tsx
var import_jsx_runtime92 = __toESM(require_jsx_runtime());
function ContentTextArea({ value }) {
  return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("textarea", { readOnly: true, value });
}

// node_modules/markdown-table/index.js
function markdownTable(table, options = {}) {
  const align = (options.align || []).concat();
  const stringLength = options.stringLength || defaultStringLength;
  const alignments = [];
  const cellMatrix = [];
  const sizeMatrix = [];
  const longestCellByColumn = [];
  let mostCellsPerRow = 0;
  let rowIndex = -1;
  while (++rowIndex < table.length) {
    const row2 = [];
    const sizes2 = [];
    let columnIndex2 = -1;
    if (table[rowIndex].length > mostCellsPerRow) {
      mostCellsPerRow = table[rowIndex].length;
    }
    while (++columnIndex2 < table[rowIndex].length) {
      const cell = serialize(table[rowIndex][columnIndex2]);
      if (options.alignDelimiters !== false) {
        const size = stringLength(cell);
        sizes2[columnIndex2] = size;
        if (longestCellByColumn[columnIndex2] === void 0 || size > longestCellByColumn[columnIndex2]) {
          longestCellByColumn[columnIndex2] = size;
        }
      }
      row2.push(cell);
    }
    cellMatrix[rowIndex] = row2;
    sizeMatrix[rowIndex] = sizes2;
  }
  let columnIndex = -1;
  if (typeof align === "object" && "length" in align) {
    while (++columnIndex < mostCellsPerRow) {
      alignments[columnIndex] = toAlignment(align[columnIndex]);
    }
  } else {
    const code = toAlignment(align);
    while (++columnIndex < mostCellsPerRow) {
      alignments[columnIndex] = code;
    }
  }
  columnIndex = -1;
  const row = [];
  const sizes = [];
  while (++columnIndex < mostCellsPerRow) {
    const code = alignments[columnIndex];
    let before = "";
    let after = "";
    if (code === 99) {
      before = ":";
      after = ":";
    } else if (code === 108) {
      before = ":";
    } else if (code === 114) {
      after = ":";
    }
    let size = options.alignDelimiters === false ? 1 : Math.max(
      1,
      longestCellByColumn[columnIndex] - before.length - after.length
    );
    const cell = before + "-".repeat(size) + after;
    if (options.alignDelimiters !== false) {
      size = before.length + size + after.length;
      if (size > longestCellByColumn[columnIndex]) {
        longestCellByColumn[columnIndex] = size;
      }
      sizes[columnIndex] = size;
    }
    row[columnIndex] = cell;
  }
  cellMatrix.splice(1, 0, row);
  sizeMatrix.splice(1, 0, sizes);
  rowIndex = -1;
  const lines = [];
  while (++rowIndex < cellMatrix.length) {
    const row2 = cellMatrix[rowIndex];
    const sizes2 = sizeMatrix[rowIndex];
    columnIndex = -1;
    const line = [];
    while (++columnIndex < mostCellsPerRow) {
      const cell = row2[columnIndex] || "";
      let before = "";
      let after = "";
      if (options.alignDelimiters !== false) {
        const size = longestCellByColumn[columnIndex] - (sizes2[columnIndex] || 0);
        const code = alignments[columnIndex];
        if (code === 114) {
          before = " ".repeat(size);
        } else if (code === 99) {
          if (size % 2) {
            before = " ".repeat(size / 2 + 0.5);
            after = " ".repeat(size / 2 - 0.5);
          } else {
            before = " ".repeat(size / 2);
            after = before;
          }
        } else {
          after = " ".repeat(size);
        }
      }
      if (options.delimiterStart !== false && !columnIndex) {
        line.push("|");
      }
      if (options.padding !== false && // Don’t add the opening space if we’re not aligning and the cell is
      // empty: there will be a closing space.
      !(options.alignDelimiters === false && cell === "") && (options.delimiterStart !== false || columnIndex)) {
        line.push(" ");
      }
      if (options.alignDelimiters !== false) {
        line.push(before);
      }
      line.push(cell);
      if (options.alignDelimiters !== false) {
        line.push(after);
      }
      if (options.padding !== false) {
        line.push(" ");
      }
      if (options.delimiterEnd !== false || columnIndex !== mostCellsPerRow - 1) {
        line.push("|");
      }
    }
    lines.push(
      options.delimiterEnd === false ? line.join("").replace(/ +$/, "") : line.join("")
    );
  }
  return lines.join("\n");
}
function serialize(value) {
  return value === null || value === void 0 ? "" : String(value);
}
function defaultStringLength(value) {
  return value.length;
}
function toAlignment(value) {
  const code = typeof value === "string" ? value.codePointAt(0) : 0;
  return code === 67 || code === 99 ? 99 : code === 76 || code === 108 ? 108 : code === 82 || code === 114 ? 114 : 0;
}

// src/shared/cell-content/checkbox-cell-content.ts
var getCheckboxCellContent = (value, shouldRemoveMarkdown) => {
  if (shouldRemoveMarkdown) {
    if (value)
      return "true";
    return "false";
  }
  return value ? CHECKBOX_MARKDOWN_CHECKED : CHECKBOX_MARKDOWN_UNCHECKED;
};

// src/shared/cell-content/text-cell-content.ts
var import_markdown_it = __toESM(require_markdown_it());

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

// node_modules/entities/lib/esm/generated/decode-data-xml.js
var decode_data_xml_default = new Uint16Array(
  // prettier-ignore
  "\u0200aglq	\x1B\u026D\0\0p;\u4026os;\u4027t;\u403Et;\u403Cuot;\u4022".split("").map((c2) => c2.charCodeAt(0))
);

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

// node_modules/entities/lib/esm/decode.js
var CharCodes;
(function(CharCodes3) {
  CharCodes3[CharCodes3["NUM"] = 35] = "NUM";
  CharCodes3[CharCodes3["SEMI"] = 59] = "SEMI";
  CharCodes3[CharCodes3["EQUALS"] = 61] = "EQUALS";
  CharCodes3[CharCodes3["ZERO"] = 48] = "ZERO";
  CharCodes3[CharCodes3["NINE"] = 57] = "NINE";
  CharCodes3[CharCodes3["LOWER_A"] = 97] = "LOWER_A";
  CharCodes3[CharCodes3["LOWER_F"] = 102] = "LOWER_F";
  CharCodes3[CharCodes3["LOWER_X"] = 120] = "LOWER_X";
  CharCodes3[CharCodes3["LOWER_Z"] = 122] = "LOWER_Z";
  CharCodes3[CharCodes3["UPPER_A"] = 65] = "UPPER_A";
  CharCodes3[CharCodes3["UPPER_F"] = 70] = "UPPER_F";
  CharCodes3[CharCodes3["UPPER_Z"] = 90] = "UPPER_Z";
})(CharCodes || (CharCodes = {}));
var TO_LOWER_BIT = 32;
var BinTrieFlags;
(function(BinTrieFlags2) {
  BinTrieFlags2[BinTrieFlags2["VALUE_LENGTH"] = 49152] = "VALUE_LENGTH";
  BinTrieFlags2[BinTrieFlags2["BRANCH_LENGTH"] = 16256] = "BRANCH_LENGTH";
  BinTrieFlags2[BinTrieFlags2["JUMP_TABLE"] = 127] = "JUMP_TABLE";
})(BinTrieFlags || (BinTrieFlags = {}));
function isNumber2(code) {
  return code >= CharCodes.ZERO && code <= CharCodes.NINE;
}
function isHexadecimalCharacter(code) {
  return code >= CharCodes.UPPER_A && code <= CharCodes.UPPER_F || code >= CharCodes.LOWER_A && code <= CharCodes.LOWER_F;
}
function isAsciiAlphaNumeric(code) {
  return code >= CharCodes.UPPER_A && code <= CharCodes.UPPER_Z || code >= CharCodes.LOWER_A && code <= CharCodes.LOWER_Z || isNumber2(code);
}
function isEntityInAttributeInvalidEnd(code) {
  return code === CharCodes.EQUALS || isAsciiAlphaNumeric(code);
}
var EntityDecoderState;
(function(EntityDecoderState2) {
  EntityDecoderState2[EntityDecoderState2["EntityStart"] = 0] = "EntityStart";
  EntityDecoderState2[EntityDecoderState2["NumericStart"] = 1] = "NumericStart";
  EntityDecoderState2[EntityDecoderState2["NumericDecimal"] = 2] = "NumericDecimal";
  EntityDecoderState2[EntityDecoderState2["NumericHex"] = 3] = "NumericHex";
  EntityDecoderState2[EntityDecoderState2["NamedEntity"] = 4] = "NamedEntity";
})(EntityDecoderState || (EntityDecoderState = {}));
var DecodingMode;
(function(DecodingMode2) {
  DecodingMode2[DecodingMode2["Legacy"] = 0] = "Legacy";
  DecodingMode2[DecodingMode2["Strict"] = 1] = "Strict";
  DecodingMode2[DecodingMode2["Attribute"] = 2] = "Attribute";
})(DecodingMode || (DecodingMode = {}));
var EntityDecoder = class {
  constructor(decodeTree, emitCodePoint, errors) {
    this.decodeTree = decodeTree;
    this.emitCodePoint = emitCodePoint;
    this.errors = errors;
    this.state = EntityDecoderState.EntityStart;
    this.consumed = 1;
    this.result = 0;
    this.treeIndex = 0;
    this.excess = 1;
    this.decodeMode = DecodingMode.Strict;
  }
  /** Resets the instance to make it reusable. */
  startEntity(decodeMode) {
    this.decodeMode = decodeMode;
    this.state = EntityDecoderState.EntityStart;
    this.result = 0;
    this.treeIndex = 0;
    this.excess = 1;
    this.consumed = 1;
  }
  /**
   * Write an entity to the decoder. This can be called multiple times with partial entities.
   * If the entity is incomplete, the decoder will return -1.
   *
   * Mirrors the implementation of `getDecoder`, but with the ability to stop decoding if the
   * entity is incomplete, and resume when the next string is written.
   *
   * @param string The string containing the entity (or a continuation of the entity).
   * @param offset The offset at which the entity begins. Should be 0 if this is not the first call.
   * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
   */
  write(str, offset) {
    switch (this.state) {
      case EntityDecoderState.EntityStart: {
        if (str.charCodeAt(offset) === CharCodes.NUM) {
          this.state = EntityDecoderState.NumericStart;
          this.consumed += 1;
          return this.stateNumericStart(str, offset + 1);
        }
        this.state = EntityDecoderState.NamedEntity;
        return this.stateNamedEntity(str, offset);
      }
      case EntityDecoderState.NumericStart: {
        return this.stateNumericStart(str, offset);
      }
      case EntityDecoderState.NumericDecimal: {
        return this.stateNumericDecimal(str, offset);
      }
      case EntityDecoderState.NumericHex: {
        return this.stateNumericHex(str, offset);
      }
      case EntityDecoderState.NamedEntity: {
        return this.stateNamedEntity(str, offset);
      }
    }
  }
  /**
   * Switches between the numeric decimal and hexadecimal states.
   *
   * Equivalent to the `Numeric character reference state` in the HTML spec.
   *
   * @param str The string containing the entity (or a continuation of the entity).
   * @param offset The current offset.
   * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
   */
  stateNumericStart(str, offset) {
    if (offset >= str.length) {
      return -1;
    }
    if ((str.charCodeAt(offset) | TO_LOWER_BIT) === CharCodes.LOWER_X) {
      this.state = EntityDecoderState.NumericHex;
      this.consumed += 1;
      return this.stateNumericHex(str, offset + 1);
    }
    this.state = EntityDecoderState.NumericDecimal;
    return this.stateNumericDecimal(str, offset);
  }
  addToNumericResult(str, start, end, base) {
    if (start !== end) {
      const digitCount = end - start;
      this.result = this.result * Math.pow(base, digitCount) + parseInt(str.substr(start, digitCount), base);
      this.consumed += digitCount;
    }
  }
  /**
   * Parses a hexadecimal numeric entity.
   *
   * Equivalent to the `Hexademical character reference state` in the HTML spec.
   *
   * @param str The string containing the entity (or a continuation of the entity).
   * @param offset The current offset.
   * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
   */
  stateNumericHex(str, offset) {
    const startIdx = offset;
    while (offset < str.length) {
      const char = str.charCodeAt(offset);
      if (isNumber2(char) || isHexadecimalCharacter(char)) {
        offset += 1;
      } else {
        this.addToNumericResult(str, startIdx, offset, 16);
        return this.emitNumericEntity(char, 3);
      }
    }
    this.addToNumericResult(str, startIdx, offset, 16);
    return -1;
  }
  /**
   * Parses a decimal numeric entity.
   *
   * Equivalent to the `Decimal character reference state` in the HTML spec.
   *
   * @param str The string containing the entity (or a continuation of the entity).
   * @param offset The current offset.
   * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
   */
  stateNumericDecimal(str, offset) {
    const startIdx = offset;
    while (offset < str.length) {
      const char = str.charCodeAt(offset);
      if (isNumber2(char)) {
        offset += 1;
      } else {
        this.addToNumericResult(str, startIdx, offset, 10);
        return this.emitNumericEntity(char, 2);
      }
    }
    this.addToNumericResult(str, startIdx, offset, 10);
    return -1;
  }
  /**
   * Validate and emit a numeric entity.
   *
   * Implements the logic from the `Hexademical character reference start
   * state` and `Numeric character reference end state` in the HTML spec.
   *
   * @param lastCp The last code point of the entity. Used to see if the
   *               entity was terminated with a semicolon.
   * @param expectedLength The minimum number of characters that should be
   *                       consumed. Used to validate that at least one digit
   *                       was consumed.
   * @returns The number of characters that were consumed.
   */
  emitNumericEntity(lastCp, expectedLength) {
    var _a2;
    if (this.consumed <= expectedLength) {
      (_a2 = this.errors) === null || _a2 === void 0 ? void 0 : _a2.absenceOfDigitsInNumericCharacterReference(this.consumed);
      return 0;
    }
    if (lastCp === CharCodes.SEMI) {
      this.consumed += 1;
    } else if (this.decodeMode === DecodingMode.Strict) {
      return 0;
    }
    this.emitCodePoint(replaceCodePoint(this.result), this.consumed);
    if (this.errors) {
      if (lastCp !== CharCodes.SEMI) {
        this.errors.missingSemicolonAfterCharacterReference();
      }
      this.errors.validateNumericCharacterReference(this.result);
    }
    return this.consumed;
  }
  /**
   * Parses a named entity.
   *
   * Equivalent to the `Named character reference state` in the HTML spec.
   *
   * @param str The string containing the entity (or a continuation of the entity).
   * @param offset The current offset.
   * @returns The number of characters that were consumed, or -1 if the entity is incomplete.
   */
  stateNamedEntity(str, offset) {
    const { decodeTree } = this;
    let current = decodeTree[this.treeIndex];
    let valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14;
    for (; offset < str.length; offset++, this.excess++) {
      const char = str.charCodeAt(offset);
      this.treeIndex = determineBranch(decodeTree, current, this.treeIndex + Math.max(1, valueLength), char);
      if (this.treeIndex < 0) {
        return this.result === 0 || // If we are parsing an attribute
        this.decodeMode === DecodingMode.Attribute && // We shouldn't have consumed any characters after the entity,
        (valueLength === 0 || // And there should be no invalid characters.
        isEntityInAttributeInvalidEnd(char)) ? 0 : this.emitNotTerminatedNamedEntity();
      }
      current = decodeTree[this.treeIndex];
      valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14;
      if (valueLength !== 0) {
        if (char === CharCodes.SEMI) {
          return this.emitNamedEntityData(this.treeIndex, valueLength, this.consumed + this.excess);
        }
        if (this.decodeMode !== DecodingMode.Strict) {
          this.result = this.treeIndex;
          this.consumed += this.excess;
          this.excess = 0;
        }
      }
    }
    return -1;
  }
  /**
   * Emit a named entity that was not terminated with a semicolon.
   *
   * @returns The number of characters consumed.
   */
  emitNotTerminatedNamedEntity() {
    var _a2;
    const { result, decodeTree } = this;
    const valueLength = (decodeTree[result] & BinTrieFlags.VALUE_LENGTH) >> 14;
    this.emitNamedEntityData(result, valueLength, this.consumed);
    (_a2 = this.errors) === null || _a2 === void 0 ? void 0 : _a2.missingSemicolonAfterCharacterReference();
    return this.consumed;
  }
  /**
   * Emit a named entity.
   *
   * @param result The index of the entity in the decode tree.
   * @param valueLength The number of bytes in the entity.
   * @param consumed The number of characters consumed.
   *
   * @returns The number of characters consumed.
   */
  emitNamedEntityData(result, valueLength, consumed) {
    const { decodeTree } = this;
    this.emitCodePoint(valueLength === 1 ? decodeTree[result] & ~BinTrieFlags.VALUE_LENGTH : decodeTree[result + 1], consumed);
    if (valueLength === 3) {
      this.emitCodePoint(decodeTree[result + 2], consumed);
    }
    return consumed;
  }
  /**
   * Signal to the parser that the end of the input was reached.
   *
   * Remaining data will be emitted and relevant errors will be produced.
   *
   * @returns The number of characters consumed.
   */
  end() {
    var _a2;
    switch (this.state) {
      case EntityDecoderState.NamedEntity: {
        return this.result !== 0 && (this.decodeMode !== DecodingMode.Attribute || this.result === this.treeIndex) ? this.emitNotTerminatedNamedEntity() : 0;
      }
      case EntityDecoderState.NumericDecimal: {
        return this.emitNumericEntity(0, 2);
      }
      case EntityDecoderState.NumericHex: {
        return this.emitNumericEntity(0, 3);
      }
      case EntityDecoderState.NumericStart: {
        (_a2 = this.errors) === null || _a2 === void 0 ? void 0 : _a2.absenceOfDigitsInNumericCharacterReference(this.consumed);
        return 0;
      }
      case EntityDecoderState.EntityStart: {
        return 0;
      }
    }
  }
};
function getDecoder(decodeTree) {
  let ret = "";
  const decoder = new EntityDecoder(decodeTree, (str) => ret += fromCodePoint(str));
  return function decodeWithTrie(str, decodeMode) {
    let lastIndex = 0;
    let offset = 0;
    while ((offset = str.indexOf("&", offset)) >= 0) {
      ret += str.slice(lastIndex, offset);
      decoder.startEntity(decodeMode);
      const len = decoder.write(
        str,
        // Skip the "&"
        offset + 1
      );
      if (len < 0) {
        lastIndex = offset + decoder.end();
        break;
      }
      lastIndex = offset + len;
      offset = len === 0 ? lastIndex + 1 : lastIndex;
    }
    const result = ret + str.slice(lastIndex);
    ret = "";
    return result;
  };
}
function determineBranch(decodeTree, current, nodeIdx, char) {
  const branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;
  const jumpOffset = current & BinTrieFlags.JUMP_TABLE;
  if (branchCount === 0) {
    return jumpOffset !== 0 && char === jumpOffset ? nodeIdx : -1;
  }
  if (jumpOffset) {
    const value = char - jumpOffset;
    return value < 0 || value >= branchCount ? -1 : decodeTree[nodeIdx + value] - 1;
  }
  let lo = nodeIdx;
  let hi = lo + branchCount - 1;
  while (lo <= hi) {
    const mid = lo + hi >>> 1;
    const midVal = decodeTree[mid];
    if (midVal < char) {
      lo = mid + 1;
    } else if (midVal > char) {
      hi = mid - 1;
    } else {
      return decodeTree[mid + branchCount];
    }
  }
  return -1;
}
var htmlDecoder = getDecoder(decode_data_html_default);
var xmlDecoder = getDecoder(decode_data_xml_default);

// node_modules/htmlparser2/lib/esm/Tokenizer.js
var CharCodes2;
(function(CharCodes3) {
  CharCodes3[CharCodes3["Tab"] = 9] = "Tab";
  CharCodes3[CharCodes3["NewLine"] = 10] = "NewLine";
  CharCodes3[CharCodes3["FormFeed"] = 12] = "FormFeed";
  CharCodes3[CharCodes3["CarriageReturn"] = 13] = "CarriageReturn";
  CharCodes3[CharCodes3["Space"] = 32] = "Space";
  CharCodes3[CharCodes3["ExclamationMark"] = 33] = "ExclamationMark";
  CharCodes3[CharCodes3["Number"] = 35] = "Number";
  CharCodes3[CharCodes3["Amp"] = 38] = "Amp";
  CharCodes3[CharCodes3["SingleQuote"] = 39] = "SingleQuote";
  CharCodes3[CharCodes3["DoubleQuote"] = 34] = "DoubleQuote";
  CharCodes3[CharCodes3["Dash"] = 45] = "Dash";
  CharCodes3[CharCodes3["Slash"] = 47] = "Slash";
  CharCodes3[CharCodes3["Zero"] = 48] = "Zero";
  CharCodes3[CharCodes3["Nine"] = 57] = "Nine";
  CharCodes3[CharCodes3["Semi"] = 59] = "Semi";
  CharCodes3[CharCodes3["Lt"] = 60] = "Lt";
  CharCodes3[CharCodes3["Eq"] = 61] = "Eq";
  CharCodes3[CharCodes3["Gt"] = 62] = "Gt";
  CharCodes3[CharCodes3["Questionmark"] = 63] = "Questionmark";
  CharCodes3[CharCodes3["UpperA"] = 65] = "UpperA";
  CharCodes3[CharCodes3["LowerA"] = 97] = "LowerA";
  CharCodes3[CharCodes3["UpperF"] = 70] = "UpperF";
  CharCodes3[CharCodes3["LowerF"] = 102] = "LowerF";
  CharCodes3[CharCodes3["UpperZ"] = 90] = "UpperZ";
  CharCodes3[CharCodes3["LowerZ"] = 122] = "LowerZ";
  CharCodes3[CharCodes3["LowerX"] = 120] = "LowerX";
  CharCodes3[CharCodes3["OpeningSquareBracket"] = 91] = "OpeningSquareBracket";
})(CharCodes2 || (CharCodes2 = {}));
var State;
(function(State2) {
  State2[State2["Text"] = 1] = "Text";
  State2[State2["BeforeTagName"] = 2] = "BeforeTagName";
  State2[State2["InTagName"] = 3] = "InTagName";
  State2[State2["InSelfClosingTag"] = 4] = "InSelfClosingTag";
  State2[State2["BeforeClosingTagName"] = 5] = "BeforeClosingTagName";
  State2[State2["InClosingTagName"] = 6] = "InClosingTagName";
  State2[State2["AfterClosingTagName"] = 7] = "AfterClosingTagName";
  State2[State2["BeforeAttributeName"] = 8] = "BeforeAttributeName";
  State2[State2["InAttributeName"] = 9] = "InAttributeName";
  State2[State2["AfterAttributeName"] = 10] = "AfterAttributeName";
  State2[State2["BeforeAttributeValue"] = 11] = "BeforeAttributeValue";
  State2[State2["InAttributeValueDq"] = 12] = "InAttributeValueDq";
  State2[State2["InAttributeValueSq"] = 13] = "InAttributeValueSq";
  State2[State2["InAttributeValueNq"] = 14] = "InAttributeValueNq";
  State2[State2["BeforeDeclaration"] = 15] = "BeforeDeclaration";
  State2[State2["InDeclaration"] = 16] = "InDeclaration";
  State2[State2["InProcessingInstruction"] = 17] = "InProcessingInstruction";
  State2[State2["BeforeComment"] = 18] = "BeforeComment";
  State2[State2["CDATASequence"] = 19] = "CDATASequence";
  State2[State2["InSpecialComment"] = 20] = "InSpecialComment";
  State2[State2["InCommentLike"] = 21] = "InCommentLike";
  State2[State2["BeforeSpecialS"] = 22] = "BeforeSpecialS";
  State2[State2["BeforeSpecialT"] = 23] = "BeforeSpecialT";
  State2[State2["SpecialStartSequence"] = 24] = "SpecialStartSequence";
  State2[State2["InSpecialTag"] = 25] = "InSpecialTag";
  State2[State2["InEntity"] = 26] = "InEntity";
})(State || (State = {}));
function isWhitespace(c2) {
  return c2 === CharCodes2.Space || c2 === CharCodes2.NewLine || c2 === CharCodes2.Tab || c2 === CharCodes2.FormFeed || c2 === CharCodes2.CarriageReturn;
}
function isEndOfTagSection(c2) {
  return c2 === CharCodes2.Slash || c2 === CharCodes2.Gt || isWhitespace(c2);
}
function isASCIIAlpha(c2) {
  return c2 >= CharCodes2.LowerA && c2 <= CharCodes2.LowerZ || c2 >= CharCodes2.UpperA && c2 <= CharCodes2.UpperZ;
}
var QuoteType;
(function(QuoteType2) {
  QuoteType2[QuoteType2["NoValue"] = 0] = "NoValue";
  QuoteType2[QuoteType2["Unquoted"] = 1] = "Unquoted";
  QuoteType2[QuoteType2["Single"] = 2] = "Single";
  QuoteType2[QuoteType2["Double"] = 3] = "Double";
})(QuoteType || (QuoteType = {}));
var Sequences = {
  Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]),
  // CDATA[
  CdataEnd: new Uint8Array([93, 93, 62]),
  // ]]>
  CommentEnd: new Uint8Array([45, 45, 62]),
  // `-->`
  ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]),
  // `<\/script`
  StyleEnd: new Uint8Array([60, 47, 115, 116, 121, 108, 101]),
  // `</style`
  TitleEnd: new Uint8Array([60, 47, 116, 105, 116, 108, 101]),
  // `</title`
  TextareaEnd: new Uint8Array([
    60,
    47,
    116,
    101,
    120,
    116,
    97,
    114,
    101,
    97
  ])
  // `</textarea`
};
var Tokenizer = class {
  constructor({ xmlMode = false, decodeEntities = true }, cbs) {
    this.cbs = cbs;
    this.state = State.Text;
    this.buffer = "";
    this.sectionStart = 0;
    this.index = 0;
    this.entityStart = 0;
    this.baseState = State.Text;
    this.isSpecial = false;
    this.running = true;
    this.offset = 0;
    this.currentSequence = void 0;
    this.sequenceIndex = 0;
    this.xmlMode = xmlMode;
    this.decodeEntities = decodeEntities;
    this.entityDecoder = new EntityDecoder(xmlMode ? decode_data_xml_default : decode_data_html_default, (cp, consumed) => this.emitCodePoint(cp, consumed));
  }
  reset() {
    this.state = State.Text;
    this.buffer = "";
    this.sectionStart = 0;
    this.index = 0;
    this.baseState = State.Text;
    this.currentSequence = void 0;
    this.running = true;
    this.offset = 0;
  }
  write(chunk) {
    this.offset += this.buffer.length;
    this.buffer = chunk;
    this.parse();
  }
  end() {
    if (this.running)
      this.finish();
  }
  pause() {
    this.running = false;
  }
  resume() {
    this.running = true;
    if (this.index < this.buffer.length + this.offset) {
      this.parse();
    }
  }
  stateText(c2) {
    if (c2 === CharCodes2.Lt || !this.decodeEntities && this.fastForwardTo(CharCodes2.Lt)) {
      if (this.index > this.sectionStart) {
        this.cbs.ontext(this.sectionStart, this.index);
      }
      this.state = State.BeforeTagName;
      this.sectionStart = this.index;
    } else if (this.decodeEntities && c2 === CharCodes2.Amp) {
      this.startEntity();
    }
  }
  stateSpecialStartSequence(c2) {
    const isEnd = this.sequenceIndex === this.currentSequence.length;
    const isMatch = isEnd ? (
      // If we are at the end of the sequence, make sure the tag name has ended
      isEndOfTagSection(c2)
    ) : (
      // Otherwise, do a case-insensitive comparison
      (c2 | 32) === this.currentSequence[this.sequenceIndex]
    );
    if (!isMatch) {
      this.isSpecial = false;
    } else if (!isEnd) {
      this.sequenceIndex++;
      return;
    }
    this.sequenceIndex = 0;
    this.state = State.InTagName;
    this.stateInTagName(c2);
  }
  /** Look for an end tag. For <title> tags, also decode entities. */
  stateInSpecialTag(c2) {
    if (this.sequenceIndex === this.currentSequence.length) {
      if (c2 === CharCodes2.Gt || isWhitespace(c2)) {
        const endOfText = this.index - this.currentSequence.length;
        if (this.sectionStart < endOfText) {
          const actualIndex = this.index;
          this.index = endOfText;
          this.cbs.ontext(this.sectionStart, endOfText);
          this.index = actualIndex;
        }
        this.isSpecial = false;
        this.sectionStart = endOfText + 2;
        this.stateInClosingTagName(c2);
        return;
      }
      this.sequenceIndex = 0;
    }
    if ((c2 | 32) === this.currentSequence[this.sequenceIndex]) {
      this.sequenceIndex += 1;
    } else if (this.sequenceIndex === 0) {
      if (this.currentSequence === Sequences.TitleEnd) {
        if (this.decodeEntities && c2 === CharCodes2.Amp) {
          this.startEntity();
        }
      } else if (this.fastForwardTo(CharCodes2.Lt)) {
        this.sequenceIndex = 1;
      }
    } else {
      this.sequenceIndex = Number(c2 === CharCodes2.Lt);
    }
  }
  stateCDATASequence(c2) {
    if (c2 === Sequences.Cdata[this.sequenceIndex]) {
      if (++this.sequenceIndex === Sequences.Cdata.length) {
        this.state = State.InCommentLike;
        this.currentSequence = Sequences.CdataEnd;
        this.sequenceIndex = 0;
        this.sectionStart = this.index + 1;
      }
    } else {
      this.sequenceIndex = 0;
      this.state = State.InDeclaration;
      this.stateInDeclaration(c2);
    }
  }
  /**
   * When we wait for one specific character, we can speed things up
   * by skipping through the buffer until we find it.
   *
   * @returns Whether the character was found.
   */
  fastForwardTo(c2) {
    while (++this.index < this.buffer.length + this.offset) {
      if (this.buffer.charCodeAt(this.index - this.offset) === c2) {
        return true;
      }
    }
    this.index = this.buffer.length + this.offset - 1;
    return false;
  }
  /**
   * Comments and CDATA end with `-->` and `]]>`.
   *
   * Their common qualities are:
   * - Their end sequences have a distinct character they start with.
   * - That character is then repeated, so we have to check multiple repeats.
   * - All characters but the start character of the sequence can be skipped.
   */
  stateInCommentLike(c2) {
    if (c2 === this.currentSequence[this.sequenceIndex]) {
      if (++this.sequenceIndex === this.currentSequence.length) {
        if (this.currentSequence === Sequences.CdataEnd) {
          this.cbs.oncdata(this.sectionStart, this.index, 2);
        } else {
          this.cbs.oncomment(this.sectionStart, this.index, 2);
        }
        this.sequenceIndex = 0;
        this.sectionStart = this.index + 1;
        this.state = State.Text;
      }
    } else if (this.sequenceIndex === 0) {
      if (this.fastForwardTo(this.currentSequence[0])) {
        this.sequenceIndex = 1;
      }
    } else if (c2 !== this.currentSequence[this.sequenceIndex - 1]) {
      this.sequenceIndex = 0;
    }
  }
  /**
   * HTML only allows ASCII alpha characters (a-z and A-Z) at the beginning of a tag name.
   *
   * XML allows a lot more characters here (@see https://www.w3.org/TR/REC-xml/#NT-NameStartChar).
   * We allow anything that wouldn't end the tag.
   */
  isTagStartChar(c2) {
    return this.xmlMode ? !isEndOfTagSection(c2) : isASCIIAlpha(c2);
  }
  startSpecial(sequence, offset) {
    this.isSpecial = true;
    this.currentSequence = sequence;
    this.sequenceIndex = offset;
    this.state = State.SpecialStartSequence;
  }
  stateBeforeTagName(c2) {
    if (c2 === CharCodes2.ExclamationMark) {
      this.state = State.BeforeDeclaration;
      this.sectionStart = this.index + 1;
    } else if (c2 === CharCodes2.Questionmark) {
      this.state = State.InProcessingInstruction;
      this.sectionStart = this.index + 1;
    } else if (this.isTagStartChar(c2)) {
      const lower = c2 | 32;
      this.sectionStart = this.index;
      if (this.xmlMode) {
        this.state = State.InTagName;
      } else if (lower === Sequences.ScriptEnd[2]) {
        this.state = State.BeforeSpecialS;
      } else if (lower === Sequences.TitleEnd[2]) {
        this.state = State.BeforeSpecialT;
      } else {
        this.state = State.InTagName;
      }
    } else if (c2 === CharCodes2.Slash) {
      this.state = State.BeforeClosingTagName;
    } else {
      this.state = State.Text;
      this.stateText(c2);
    }
  }
  stateInTagName(c2) {
    if (isEndOfTagSection(c2)) {
      this.cbs.onopentagname(this.sectionStart, this.index);
      this.sectionStart = -1;
      this.state = State.BeforeAttributeName;
      this.stateBeforeAttributeName(c2);
    }
  }
  stateBeforeClosingTagName(c2) {
    if (isWhitespace(c2)) {
    } else if (c2 === CharCodes2.Gt) {
      this.state = State.Text;
    } else {
      this.state = this.isTagStartChar(c2) ? State.InClosingTagName : State.InSpecialComment;
      this.sectionStart = this.index;
    }
  }
  stateInClosingTagName(c2) {
    if (c2 === CharCodes2.Gt || isWhitespace(c2)) {
      this.cbs.onclosetag(this.sectionStart, this.index);
      this.sectionStart = -1;
      this.state = State.AfterClosingTagName;
      this.stateAfterClosingTagName(c2);
    }
  }
  stateAfterClosingTagName(c2) {
    if (c2 === CharCodes2.Gt || this.fastForwardTo(CharCodes2.Gt)) {
      this.state = State.Text;
      this.sectionStart = this.index + 1;
    }
  }
  stateBeforeAttributeName(c2) {
    if (c2 === CharCodes2.Gt) {
      this.cbs.onopentagend(this.index);
      if (this.isSpecial) {
        this.state = State.InSpecialTag;
        this.sequenceIndex = 0;
      } else {
        this.state = State.Text;
      }
      this.sectionStart = this.index + 1;
    } else if (c2 === CharCodes2.Slash) {
      this.state = State.InSelfClosingTag;
    } else if (!isWhitespace(c2)) {
      this.state = State.InAttributeName;
      this.sectionStart = this.index;
    }
  }
  stateInSelfClosingTag(c2) {
    if (c2 === CharCodes2.Gt) {
      this.cbs.onselfclosingtag(this.index);
      this.state = State.Text;
      this.sectionStart = this.index + 1;
      this.isSpecial = false;
    } else if (!isWhitespace(c2)) {
      this.state = State.BeforeAttributeName;
      this.stateBeforeAttributeName(c2);
    }
  }
  stateInAttributeName(c2) {
    if (c2 === CharCodes2.Eq || isEndOfTagSection(c2)) {
      this.cbs.onattribname(this.sectionStart, this.index);
      this.sectionStart = this.index;
      this.state = State.AfterAttributeName;
      this.stateAfterAttributeName(c2);
    }
  }
  stateAfterAttributeName(c2) {
    if (c2 === CharCodes2.Eq) {
      this.state = State.BeforeAttributeValue;
    } else if (c2 === CharCodes2.Slash || c2 === CharCodes2.Gt) {
      this.cbs.onattribend(QuoteType.NoValue, this.sectionStart);
      this.sectionStart = -1;
      this.state = State.BeforeAttributeName;
      this.stateBeforeAttributeName(c2);
    } else if (!isWhitespace(c2)) {
      this.cbs.onattribend(QuoteType.NoValue, this.sectionStart);
      this.state = State.InAttributeName;
      this.sectionStart = this.index;
    }
  }
  stateBeforeAttributeValue(c2) {
    if (c2 === CharCodes2.DoubleQuote) {
      this.state = State.InAttributeValueDq;
      this.sectionStart = this.index + 1;
    } else if (c2 === CharCodes2.SingleQuote) {
      this.state = State.InAttributeValueSq;
      this.sectionStart = this.index + 1;
    } else if (!isWhitespace(c2)) {
      this.sectionStart = this.index;
      this.state = State.InAttributeValueNq;
      this.stateInAttributeValueNoQuotes(c2);
    }
  }
  handleInAttributeValue(c2, quote) {
    if (c2 === quote || !this.decodeEntities && this.fastForwardTo(quote)) {
      this.cbs.onattribdata(this.sectionStart, this.index);
      this.sectionStart = -1;
      this.cbs.onattribend(quote === CharCodes2.DoubleQuote ? QuoteType.Double : QuoteType.Single, this.index + 1);
      this.state = State.BeforeAttributeName;
    } else if (this.decodeEntities && c2 === CharCodes2.Amp) {
      this.startEntity();
    }
  }
  stateInAttributeValueDoubleQuotes(c2) {
    this.handleInAttributeValue(c2, CharCodes2.DoubleQuote);
  }
  stateInAttributeValueSingleQuotes(c2) {
    this.handleInAttributeValue(c2, CharCodes2.SingleQuote);
  }
  stateInAttributeValueNoQuotes(c2) {
    if (isWhitespace(c2) || c2 === CharCodes2.Gt) {
      this.cbs.onattribdata(this.sectionStart, this.index);
      this.sectionStart = -1;
      this.cbs.onattribend(QuoteType.Unquoted, this.index);
      this.state = State.BeforeAttributeName;
      this.stateBeforeAttributeName(c2);
    } else if (this.decodeEntities && c2 === CharCodes2.Amp) {
      this.startEntity();
    }
  }
  stateBeforeDeclaration(c2) {
    if (c2 === CharCodes2.OpeningSquareBracket) {
      this.state = State.CDATASequence;
      this.sequenceIndex = 0;
    } else {
      this.state = c2 === CharCodes2.Dash ? State.BeforeComment : State.InDeclaration;
    }
  }
  stateInDeclaration(c2) {
    if (c2 === CharCodes2.Gt || this.fastForwardTo(CharCodes2.Gt)) {
      this.cbs.ondeclaration(this.sectionStart, this.index);
      this.state = State.Text;
      this.sectionStart = this.index + 1;
    }
  }
  stateInProcessingInstruction(c2) {
    if (c2 === CharCodes2.Gt || this.fastForwardTo(CharCodes2.Gt)) {
      this.cbs.onprocessinginstruction(this.sectionStart, this.index);
      this.state = State.Text;
      this.sectionStart = this.index + 1;
    }
  }
  stateBeforeComment(c2) {
    if (c2 === CharCodes2.Dash) {
      this.state = State.InCommentLike;
      this.currentSequence = Sequences.CommentEnd;
      this.sequenceIndex = 2;
      this.sectionStart = this.index + 1;
    } else {
      this.state = State.InDeclaration;
    }
  }
  stateInSpecialComment(c2) {
    if (c2 === CharCodes2.Gt || this.fastForwardTo(CharCodes2.Gt)) {
      this.cbs.oncomment(this.sectionStart, this.index, 0);
      this.state = State.Text;
      this.sectionStart = this.index + 1;
    }
  }
  stateBeforeSpecialS(c2) {
    const lower = c2 | 32;
    if (lower === Sequences.ScriptEnd[3]) {
      this.startSpecial(Sequences.ScriptEnd, 4);
    } else if (lower === Sequences.StyleEnd[3]) {
      this.startSpecial(Sequences.StyleEnd, 4);
    } else {
      this.state = State.InTagName;
      this.stateInTagName(c2);
    }
  }
  stateBeforeSpecialT(c2) {
    const lower = c2 | 32;
    if (lower === Sequences.TitleEnd[3]) {
      this.startSpecial(Sequences.TitleEnd, 4);
    } else if (lower === Sequences.TextareaEnd[3]) {
      this.startSpecial(Sequences.TextareaEnd, 4);
    } else {
      this.state = State.InTagName;
      this.stateInTagName(c2);
    }
  }
  startEntity() {
    this.baseState = this.state;
    this.state = State.InEntity;
    this.entityStart = this.index;
    this.entityDecoder.startEntity(this.xmlMode ? DecodingMode.Strict : this.baseState === State.Text || this.baseState === State.InSpecialTag ? DecodingMode.Legacy : DecodingMode.Attribute);
  }
  stateInEntity() {
    const length = this.entityDecoder.write(this.buffer, this.index - this.offset);
    if (length >= 0) {
      this.state = this.baseState;
      if (length === 0) {
        this.index = this.entityStart;
      }
    } else {
      this.index = this.offset + this.buffer.length - 1;
    }
  }
  /**
   * Remove data that has already been consumed from the buffer.
   */
  cleanup() {
    if (this.running && this.sectionStart !== this.index) {
      if (this.state === State.Text || this.state === State.InSpecialTag && this.sequenceIndex === 0) {
        this.cbs.ontext(this.sectionStart, this.index);
        this.sectionStart = this.index;
      } else if (this.state === State.InAttributeValueDq || this.state === State.InAttributeValueSq || this.state === State.InAttributeValueNq) {
        this.cbs.onattribdata(this.sectionStart, this.index);
        this.sectionStart = this.index;
      }
    }
  }
  shouldContinue() {
    return this.index < this.buffer.length + this.offset && this.running;
  }
  /**
   * Iterates through the buffer, calling the function corresponding to the current state.
   *
   * States that are more likely to be hit are higher up, as a performance improvement.
   */
  parse() {
    while (this.shouldContinue()) {
      const c2 = this.buffer.charCodeAt(this.index - this.offset);
      switch (this.state) {
        case State.Text: {
          this.stateText(c2);
          break;
        }
        case State.SpecialStartSequence: {
          this.stateSpecialStartSequence(c2);
          break;
        }
        case State.InSpecialTag: {
          this.stateInSpecialTag(c2);
          break;
        }
        case State.CDATASequence: {
          this.stateCDATASequence(c2);
          break;
        }
        case State.InAttributeValueDq: {
          this.stateInAttributeValueDoubleQuotes(c2);
          break;
        }
        case State.InAttributeName: {
          this.stateInAttributeName(c2);
          break;
        }
        case State.InCommentLike: {
          this.stateInCommentLike(c2);
          break;
        }
        case State.InSpecialComment: {
          this.stateInSpecialComment(c2);
          break;
        }
        case State.BeforeAttributeName: {
          this.stateBeforeAttributeName(c2);
          break;
        }
        case State.InTagName: {
          this.stateInTagName(c2);
          break;
        }
        case State.InClosingTagName: {
          this.stateInClosingTagName(c2);
          break;
        }
        case State.BeforeTagName: {
          this.stateBeforeTagName(c2);
          break;
        }
        case State.AfterAttributeName: {
          this.stateAfterAttributeName(c2);
          break;
        }
        case State.InAttributeValueSq: {
          this.stateInAttributeValueSingleQuotes(c2);
          break;
        }
        case State.BeforeAttributeValue: {
          this.stateBeforeAttributeValue(c2);
          break;
        }
        case State.BeforeClosingTagName: {
          this.stateBeforeClosingTagName(c2);
          break;
        }
        case State.AfterClosingTagName: {
          this.stateAfterClosingTagName(c2);
          break;
        }
        case State.BeforeSpecialS: {
          this.stateBeforeSpecialS(c2);
          break;
        }
        case State.BeforeSpecialT: {
          this.stateBeforeSpecialT(c2);
          break;
        }
        case State.InAttributeValueNq: {
          this.stateInAttributeValueNoQuotes(c2);
          break;
        }
        case State.InSelfClosingTag: {
          this.stateInSelfClosingTag(c2);
          break;
        }
        case State.InDeclaration: {
          this.stateInDeclaration(c2);
          break;
        }
        case State.BeforeDeclaration: {
          this.stateBeforeDeclaration(c2);
          break;
        }
        case State.BeforeComment: {
          this.stateBeforeComment(c2);
          break;
        }
        case State.InProcessingInstruction: {
          this.stateInProcessingInstruction(c2);
          break;
        }
        case State.InEntity: {
          this.stateInEntity();
          break;
        }
      }
      this.index++;
    }
    this.cleanup();
  }
  finish() {
    if (this.state === State.InEntity) {
      this.entityDecoder.end();
      this.state = this.baseState;
    }
    this.handleTrailingData();
    this.cbs.onend();
  }
  /** Handle any trailing data. */
  handleTrailingData() {
    const endIndex = this.buffer.length + this.offset;
    if (this.sectionStart >= endIndex) {
      return;
    }
    if (this.state === State.InCommentLike) {
      if (this.currentSequence === Sequences.CdataEnd) {
        this.cbs.oncdata(this.sectionStart, endIndex, 0);
      } else {
        this.cbs.oncomment(this.sectionStart, endIndex, 0);
      }
    } else if (this.state === State.InTagName || this.state === State.BeforeAttributeName || this.state === State.BeforeAttributeValue || this.state === State.AfterAttributeName || this.state === State.InAttributeName || this.state === State.InAttributeValueSq || this.state === State.InAttributeValueDq || this.state === State.InAttributeValueNq || this.state === State.InClosingTagName) {
    } else {
      this.cbs.ontext(this.sectionStart, endIndex);
    }
  }
  emitCodePoint(cp, consumed) {
    if (this.baseState !== State.Text && this.baseState !== State.InSpecialTag) {
      if (this.sectionStart < this.entityStart) {
        this.cbs.onattribdata(this.sectionStart, this.entityStart);
      }
      this.sectionStart = this.entityStart + consumed;
      this.index = this.sectionStart - 1;
      this.cbs.onattribentity(cp);
    } else {
      if (this.sectionStart < this.entityStart) {
        this.cbs.ontext(this.sectionStart, this.entityStart);
      }
      this.sectionStart = this.entityStart + consumed;
      this.index = this.sectionStart - 1;
      this.cbs.ontextentity(cp, this.sectionStart);
    }
  }
};

// node_modules/htmlparser2/lib/esm/Parser.js
var formTags = /* @__PURE__ */ new Set([
  "input",
  "option",
  "optgroup",
  "select",
  "button",
  "datalist",
  "textarea"
]);
var pTag = /* @__PURE__ */ new Set(["p"]);
var tableSectionTags = /* @__PURE__ */ new Set(["thead", "tbody"]);
var ddtTags = /* @__PURE__ */ new Set(["dd", "dt"]);
var rtpTags = /* @__PURE__ */ new Set(["rt", "rp"]);
var openImpliesClose = /* @__PURE__ */ new Map([
  ["tr", /* @__PURE__ */ new Set(["tr", "th", "td"])],
  ["th", /* @__PURE__ */ new Set(["th"])],
  ["td", /* @__PURE__ */ new Set(["thead", "th", "td"])],
  ["body", /* @__PURE__ */ new Set(["head", "link", "script"])],
  ["li", /* @__PURE__ */ new Set(["li"])],
  ["p", pTag],
  ["h1", pTag],
  ["h2", pTag],
  ["h3", pTag],
  ["h4", pTag],
  ["h5", pTag],
  ["h6", pTag],
  ["select", formTags],
  ["input", formTags],
  ["output", formTags],
  ["button", formTags],
  ["datalist", formTags],
  ["textarea", formTags],
  ["option", /* @__PURE__ */ new Set(["option"])],
  ["optgroup", /* @__PURE__ */ new Set(["optgroup", "option"])],
  ["dd", ddtTags],
  ["dt", ddtTags],
  ["address", pTag],
  ["article", pTag],
  ["aside", pTag],
  ["blockquote", pTag],
  ["details", pTag],
  ["div", pTag],
  ["dl", pTag],
  ["fieldset", pTag],
  ["figcaption", pTag],
  ["figure", pTag],
  ["footer", pTag],
  ["form", pTag],
  ["header", pTag],
  ["hr", pTag],
  ["main", pTag],
  ["nav", pTag],
  ["ol", pTag],
  ["pre", pTag],
  ["section", pTag],
  ["table", pTag],
  ["ul", pTag],
  ["rt", rtpTags],
  ["rp", rtpTags],
  ["tbody", tableSectionTags],
  ["tfoot", tableSectionTags]
]);
var voidElements = /* @__PURE__ */ new Set([
  "area",
  "base",
  "basefont",
  "br",
  "col",
  "command",
  "embed",
  "frame",
  "hr",
  "img",
  "input",
  "isindex",
  "keygen",
  "link",
  "meta",
  "param",
  "source",
  "track",
  "wbr"
]);
var foreignContextElements = /* @__PURE__ */ new Set(["math", "svg"]);
var htmlIntegrationElements = /* @__PURE__ */ new Set([
  "mi",
  "mo",
  "mn",
  "ms",
  "mtext",
  "annotation-xml",
  "foreignobject",
  "desc",
  "title"
]);
var reNameEnd = /\s|\//;
var Parser = class {
  constructor(cbs, options = {}) {
    var _a2, _b, _c, _d, _e, _f;
    this.options = options;
    this.startIndex = 0;
    this.endIndex = 0;
    this.openTagStart = 0;
    this.tagname = "";
    this.attribname = "";
    this.attribvalue = "";
    this.attribs = null;
    this.stack = [];
    this.buffers = [];
    this.bufferOffset = 0;
    this.writeIndex = 0;
    this.ended = false;
    this.cbs = cbs !== null && cbs !== void 0 ? cbs : {};
    this.htmlMode = !this.options.xmlMode;
    this.lowerCaseTagNames = (_a2 = options.lowerCaseTags) !== null && _a2 !== void 0 ? _a2 : this.htmlMode;
    this.lowerCaseAttributeNames = (_b = options.lowerCaseAttributeNames) !== null && _b !== void 0 ? _b : this.htmlMode;
    this.recognizeSelfClosing = (_c = options.recognizeSelfClosing) !== null && _c !== void 0 ? _c : !this.htmlMode;
    this.tokenizer = new ((_d = options.Tokenizer) !== null && _d !== void 0 ? _d : Tokenizer)(this.options, this);
    this.foreignContext = [!this.htmlMode];
    (_f = (_e = this.cbs).onparserinit) === null || _f === void 0 ? void 0 : _f.call(_e, this);
  }
  // Tokenizer event handlers
  /** @internal */
  ontext(start, endIndex) {
    var _a2, _b;
    const data = this.getSlice(start, endIndex);
    this.endIndex = endIndex - 1;
    (_b = (_a2 = this.cbs).ontext) === null || _b === void 0 ? void 0 : _b.call(_a2, data);
    this.startIndex = endIndex;
  }
  /** @internal */
  ontextentity(cp, endIndex) {
    var _a2, _b;
    this.endIndex = endIndex - 1;
    (_b = (_a2 = this.cbs).ontext) === null || _b === void 0 ? void 0 : _b.call(_a2, fromCodePoint(cp));
    this.startIndex = endIndex;
  }
  /**
   * Checks if the current tag is a void element. Override this if you want
   * to specify your own additional void elements.
   */
  isVoidElement(name) {
    return this.htmlMode && voidElements.has(name);
  }
  /** @internal */
  onopentagname(start, endIndex) {
    this.endIndex = endIndex;
    let name = this.getSlice(start, endIndex);
    if (this.lowerCaseTagNames) {
      name = name.toLowerCase();
    }
    this.emitOpenTag(name);
  }
  emitOpenTag(name) {
    var _a2, _b, _c, _d;
    this.openTagStart = this.startIndex;
    this.tagname = name;
    const impliesClose = this.htmlMode && openImpliesClose.get(name);
    if (impliesClose) {
      while (this.stack.length > 0 && impliesClose.has(this.stack[0])) {
        const element = this.stack.shift();
        (_b = (_a2 = this.cbs).onclosetag) === null || _b === void 0 ? void 0 : _b.call(_a2, element, true);
      }
    }
    if (!this.isVoidElement(name)) {
      this.stack.unshift(name);
      if (this.htmlMode) {
        if (foreignContextElements.has(name)) {
          this.foreignContext.unshift(true);
        } else if (htmlIntegrationElements.has(name)) {
          this.foreignContext.unshift(false);
        }
      }
    }
    (_d = (_c = this.cbs).onopentagname) === null || _d === void 0 ? void 0 : _d.call(_c, name);
    if (this.cbs.onopentag)
      this.attribs = {};
  }
  endOpenTag(isImplied) {
    var _a2, _b;
    this.startIndex = this.openTagStart;
    if (this.attribs) {
      (_b = (_a2 = this.cbs).onopentag) === null || _b === void 0 ? void 0 : _b.call(_a2, this.tagname, this.attribs, isImplied);
      this.attribs = null;
    }
    if (this.cbs.onclosetag && this.isVoidElement(this.tagname)) {
      this.cbs.onclosetag(this.tagname, true);
    }
    this.tagname = "";
  }
  /** @internal */
  onopentagend(endIndex) {
    this.endIndex = endIndex;
    this.endOpenTag(false);
    this.startIndex = endIndex + 1;
  }
  /** @internal */
  onclosetag(start, endIndex) {
    var _a2, _b, _c, _d, _e, _f, _g, _h;
    this.endIndex = endIndex;
    let name = this.getSlice(start, endIndex);
    if (this.lowerCaseTagNames) {
      name = name.toLowerCase();
    }
    if (this.htmlMode && (foreignContextElements.has(name) || htmlIntegrationElements.has(name))) {
      this.foreignContext.shift();
    }
    if (!this.isVoidElement(name)) {
      const pos = this.stack.indexOf(name);
      if (pos !== -1) {
        for (let index = 0; index <= pos; index++) {
          const element = this.stack.shift();
          (_b = (_a2 = this.cbs).onclosetag) === null || _b === void 0 ? void 0 : _b.call(_a2, element, index !== pos);
        }
      } else if (this.htmlMode && name === "p") {
        this.emitOpenTag("p");
        this.closeCurrentTag(true);
      }
    } else if (this.htmlMode && name === "br") {
      (_d = (_c = this.cbs).onopentagname) === null || _d === void 0 ? void 0 : _d.call(_c, "br");
      (_f = (_e = this.cbs).onopentag) === null || _f === void 0 ? void 0 : _f.call(_e, "br", {}, true);
      (_h = (_g = this.cbs).onclosetag) === null || _h === void 0 ? void 0 : _h.call(_g, "br", false);
    }
    this.startIndex = endIndex + 1;
  }
  /** @internal */
  onselfclosingtag(endIndex) {
    this.endIndex = endIndex;
    if (this.recognizeSelfClosing || this.foreignContext[0]) {
      this.closeCurrentTag(false);
      this.startIndex = endIndex + 1;
    } else {
      this.onopentagend(endIndex);
    }
  }
  closeCurrentTag(isOpenImplied) {
    var _a2, _b;
    const name = this.tagname;
    this.endOpenTag(isOpenImplied);
    if (this.stack[0] === name) {
      (_b = (_a2 = this.cbs).onclosetag) === null || _b === void 0 ? void 0 : _b.call(_a2, name, !isOpenImplied);
      this.stack.shift();
    }
  }
  /** @internal */
  onattribname(start, endIndex) {
    this.startIndex = start;
    const name = this.getSlice(start, endIndex);
    this.attribname = this.lowerCaseAttributeNames ? name.toLowerCase() : name;
  }
  /** @internal */
  onattribdata(start, endIndex) {
    this.attribvalue += this.getSlice(start, endIndex);
  }
  /** @internal */
  onattribentity(cp) {
    this.attribvalue += fromCodePoint(cp);
  }
  /** @internal */
  onattribend(quote, endIndex) {
    var _a2, _b;
    this.endIndex = endIndex;
    (_b = (_a2 = this.cbs).onattribute) === null || _b === void 0 ? void 0 : _b.call(_a2, this.attribname, this.attribvalue, quote === QuoteType.Double ? '"' : quote === QuoteType.Single ? "'" : quote === QuoteType.NoValue ? void 0 : null);
    if (this.attribs && !Object.prototype.hasOwnProperty.call(this.attribs, this.attribname)) {
      this.attribs[this.attribname] = this.attribvalue;
    }
    this.attribvalue = "";
  }
  getInstructionName(value) {
    const index = value.search(reNameEnd);
    let name = index < 0 ? value : value.substr(0, index);
    if (this.lowerCaseTagNames) {
      name = name.toLowerCase();
    }
    return name;
  }
  /** @internal */
  ondeclaration(start, endIndex) {
    this.endIndex = endIndex;
    const value = this.getSlice(start, endIndex);
    if (this.cbs.onprocessinginstruction) {
      const name = this.getInstructionName(value);
      this.cbs.onprocessinginstruction(`!${name}`, `!${value}`);
    }
    this.startIndex = endIndex + 1;
  }
  /** @internal */
  onprocessinginstruction(start, endIndex) {
    this.endIndex = endIndex;
    const value = this.getSlice(start, endIndex);
    if (this.cbs.onprocessinginstruction) {
      const name = this.getInstructionName(value);
      this.cbs.onprocessinginstruction(`?${name}`, `?${value}`);
    }
    this.startIndex = endIndex + 1;
  }
  /** @internal */
  oncomment(start, endIndex, offset) {
    var _a2, _b, _c, _d;
    this.endIndex = endIndex;
    (_b = (_a2 = this.cbs).oncomment) === null || _b === void 0 ? void 0 : _b.call(_a2, this.getSlice(start, endIndex - offset));
    (_d = (_c = this.cbs).oncommentend) === null || _d === void 0 ? void 0 : _d.call(_c);
    this.startIndex = endIndex + 1;
  }
  /** @internal */
  oncdata(start, endIndex, offset) {
    var _a2, _b, _c, _d, _e, _f, _g, _h, _j, _k;
    this.endIndex = endIndex;
    const value = this.getSlice(start, endIndex - offset);
    if (!this.htmlMode || this.options.recognizeCDATA) {
      (_b = (_a2 = this.cbs).oncdatastart) === null || _b === void 0 ? void 0 : _b.call(_a2);
      (_d = (_c = this.cbs).ontext) === null || _d === void 0 ? void 0 : _d.call(_c, value);
      (_f = (_e = this.cbs).oncdataend) === null || _f === void 0 ? void 0 : _f.call(_e);
    } else {
      (_h = (_g = this.cbs).oncomment) === null || _h === void 0 ? void 0 : _h.call(_g, `[CDATA[${value}]]`);
      (_k = (_j = this.cbs).oncommentend) === null || _k === void 0 ? void 0 : _k.call(_j);
    }
    this.startIndex = endIndex + 1;
  }
  /** @internal */
  onend() {
    var _a2, _b;
    if (this.cbs.onclosetag) {
      this.endIndex = this.startIndex;
      for (let index = 0; index < this.stack.length; index++) {
        this.cbs.onclosetag(this.stack[index], true);
      }
    }
    (_b = (_a2 = this.cbs).onend) === null || _b === void 0 ? void 0 : _b.call(_a2);
  }
  /**
   * Resets the parser to a blank state, ready to parse a new HTML document
   */
  reset() {
    var _a2, _b, _c, _d;
    (_b = (_a2 = this.cbs).onreset) === null || _b === void 0 ? void 0 : _b.call(_a2);
    this.tokenizer.reset();
    this.tagname = "";
    this.attribname = "";
    this.attribs = null;
    this.stack.length = 0;
    this.startIndex = 0;
    this.endIndex = 0;
    (_d = (_c = this.cbs).onparserinit) === null || _d === void 0 ? void 0 : _d.call(_c, this);
    this.buffers.length = 0;
    this.foreignContext.length = 0;
    this.foreignContext.unshift(!this.htmlMode);
    this.bufferOffset = 0;
    this.writeIndex = 0;
    this.ended = false;
  }
  /**
   * Resets the parser, then parses a complete document and
   * pushes it to the handler.
   *
   * @param data Document to parse.
   */
  parseComplete(data) {
    this.reset();
    this.end(data);
  }
  getSlice(start, end) {
    while (start - this.bufferOffset >= this.buffers[0].length) {
      this.shiftBuffer();
    }
    let slice = this.buffers[0].slice(start - this.bufferOffset, end - this.bufferOffset);
    while (end - this.bufferOffset > this.buffers[0].length) {
      this.shiftBuffer();
      slice += this.buffers[0].slice(0, end - this.bufferOffset);
    }
    return slice;
  }
  shiftBuffer() {
    this.bufferOffset += this.buffers[0].length;
    this.writeIndex--;
    this.buffers.shift();
  }
  /**
   * Parses a chunk of data and calls the corresponding callbacks.
   *
   * @param chunk Chunk to parse.
   */
  write(chunk) {
    var _a2, _b;
    if (this.ended) {
      (_b = (_a2 = this.cbs).onerror) === null || _b === void 0 ? void 0 : _b.call(_a2, new Error(".write() after done!"));
      return;
    }
    this.buffers.push(chunk);
    if (this.tokenizer.running) {
      this.tokenizer.write(chunk);
      this.writeIndex++;
    }
  }
  /**
   * Parses the end of the buffer and clears the stack, calls onend.
   *
   * @param chunk Optional final chunk to parse.
   */
  end(chunk) {
    var _a2, _b;
    if (this.ended) {
      (_b = (_a2 = this.cbs).onerror) === null || _b === void 0 ? void 0 : _b.call(_a2, new Error(".end() after done!"));
      return;
    }
    if (chunk)
      this.write(chunk);
    this.ended = true;
    this.tokenizer.end();
  }
  /**
   * Pauses parsing. The parser won't emit events until `resume` is called.
   */
  pause() {
    this.tokenizer.pause();
  }
  /**
   * Resumes parsing after `pause` was called.
   */
  resume() {
    this.tokenizer.resume();
    while (this.tokenizer.running && this.writeIndex < this.buffers.length) {
      this.tokenizer.write(this.buffers[this.writeIndex++]);
    }
    if (this.ended)
      this.tokenizer.end();
  }
  /**
   * Alias of `write`, for backwards compatibility.
   *
   * @param chunk Chunk to parse.
   * @deprecated
   */
  parseChunk(chunk) {
    this.write(chunk);
  }
  /**
   * Alias of `end`, for backwards compatibility.
   *
   * @param chunk Optional final chunk to parse.
   * @deprecated
   */
  done(chunk) {
    this.end(chunk);
  }
};

// node_modules/domelementtype/lib/esm/index.js
var esm_exports = {};
__export(esm_exports, {
  CDATA: () => CDATA,
  Comment: () => Comment,
  Directive: () => Directive,
  Doctype: () => Doctype,
  ElementType: () => ElementType,
  Root: () => Root2,
  Script: () => Script,
  Style: () => Style,
  Tag: () => Tag7,
  Text: () => Text2,
  isTag: () => isTag
});
var ElementType;
(function(ElementType2) {
  ElementType2["Root"] = "root";
  ElementType2["Text"] = "text";
  ElementType2["Directive"] = "directive";
  ElementType2["Comment"] = "comment";
  ElementType2["Script"] = "script";
  ElementType2["Style"] = "style";
  ElementType2["Tag"] = "tag";
  ElementType2["CDATA"] = "cdata";
  ElementType2["Doctype"] = "doctype";
})(ElementType || (ElementType = {}));
function isTag(elem) {
  return elem.type === ElementType.Tag || elem.type === ElementType.Script || elem.type === ElementType.Style;
}
var Root2 = ElementType.Root;
var Text2 = ElementType.Text;
var Directive = ElementType.Directive;
var Comment = ElementType.Comment;
var Script = ElementType.Script;
var Style = ElementType.Style;
var Tag7 = ElementType.Tag;
var CDATA = ElementType.CDATA;
var Doctype = ElementType.Doctype;

// node_modules/domhandler/lib/esm/node.js
function isTag2(node) {
  return isTag(node);
}
function isCDATA(node) {
  return node.type === ElementType.CDATA;
}
function isText(node) {
  return node.type === ElementType.Text;
}
function isComment(node) {
  return node.type === ElementType.Comment;
}
function isDocument(node) {
  return node.type === ElementType.Root;
}
function hasChildren(node) {
  return Object.prototype.hasOwnProperty.call(node, "children");
}

// node_modules/domutils/lib/esm/index.js
var esm_exports2 = {};
__export(esm_exports2, {
  DocumentPosition: () => DocumentPosition,
  append: () => append,
  appendChild: () => appendChild,
  compareDocumentPosition: () => compareDocumentPosition,
  existsOne: () => existsOne,
  filter: () => filter2,
  find: () => find2,
  findAll: () => findAll,
  findOne: () => findOne,
  findOneChild: () => findOneChild,
  getAttributeValue: () => getAttributeValue,
  getChildren: () => getChildren,
  getElementById: () => getElementById,
  getElements: () => getElements,
  getElementsByTagName: () => getElementsByTagName,
  getElementsByTagType: () => getElementsByTagType,
  getFeed: () => getFeed,
  getInnerHTML: () => getInnerHTML,
  getName: () => getName,
  getOuterHTML: () => getOuterHTML,
  getParent: () => getParent,
  getSiblings: () => getSiblings,
  getText: () => getText,
  hasAttrib: () => hasAttrib,
  hasChildren: () => hasChildren,
  innerText: () => innerText,
  isCDATA: () => isCDATA,
  isComment: () => isComment,
  isDocument: () => isDocument,
  isTag: () => isTag2,
  isText: () => isText,
  nextElementSibling: () => nextElementSibling,
  prepend: () => prepend,
  prependChild: () => prependChild,
  prevElementSibling: () => prevElementSibling,
  removeElement: () => removeElement,
  removeSubsets: () => removeSubsets,
  replaceElement: () => replaceElement,
  testElement: () => testElement,
  textContent: () => textContent,
  uniqueSort: () => uniqueSort
});

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

// node_modules/entities/lib/esm/escape.js
var xmlReplacer = /["&'<>$\x80-\uFFFF]/g;
var xmlCodeMap = /* @__PURE__ */ new Map([
  [34, "&quot;"],
  [38, "&amp;"],
  [39, "&apos;"],
  [60, "&lt;"],
  [62, "&gt;"]
]);
var getCodePoint = (
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
  String.prototype.codePointAt != null ? (str, index) => str.codePointAt(index) : (
    // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
    (c2, index) => (c2.charCodeAt(index) & 64512) === 55296 ? (c2.charCodeAt(index) - 55296) * 1024 + c2.charCodeAt(index + 1) - 56320 + 65536 : c2.charCodeAt(index)
  )
);
function encodeXML(str) {
  let ret = "";
  let lastIdx = 0;
  let match;
  while ((match = xmlReplacer.exec(str)) !== null) {
    const i2 = match.index;
    const char = str.charCodeAt(i2);
    const next = xmlCodeMap.get(char);
    if (next !== void 0) {
      ret += str.substring(lastIdx, i2) + next;
      lastIdx = i2 + 1;
    } else {
      ret += `${str.substring(lastIdx, i2)}&#x${getCodePoint(str, i2).toString(16)};`;
      lastIdx = xmlReplacer.lastIndex += Number((char & 64512) === 55296);
    }
  }
  return ret + str.substr(lastIdx);
}
function getEscaper(regex, map2) {
  return function escape2(data) {
    let match;
    let lastIdx = 0;
    let result = "";
    while (match = regex.exec(data)) {
      if (lastIdx !== match.index) {
        result += data.substring(lastIdx, match.index);
      }
      result += map2.get(match[0].charCodeAt(0));
      lastIdx = match.index + 1;
    }
    return result + data.substring(lastIdx);
  };
}
var escapeUTF8 = getEscaper(/[&<>'"]/g, xmlCodeMap);
var escapeAttribute = getEscaper(/["&\u00A0]/g, /* @__PURE__ */ new Map([
  [34, "&quot;"],
  [38, "&amp;"],
  [160, "&nbsp;"]
]));
var escapeText = getEscaper(/[&<>\u00A0]/g, /* @__PURE__ */ new Map([
  [38, "&amp;"],
  [60, "&lt;"],
  [62, "&gt;"],
  [160, "&nbsp;"]
]));

// node_modules/entities/lib/esm/index.js
var EntityLevel;
(function(EntityLevel2) {
  EntityLevel2[EntityLevel2["XML"] = 0] = "XML";
  EntityLevel2[EntityLevel2["HTML"] = 1] = "HTML";
})(EntityLevel || (EntityLevel = {}));
var EncodingMode;
(function(EncodingMode2) {
  EncodingMode2[EncodingMode2["UTF8"] = 0] = "UTF8";
  EncodingMode2[EncodingMode2["ASCII"] = 1] = "ASCII";
  EncodingMode2[EncodingMode2["Extensive"] = 2] = "Extensive";
  EncodingMode2[EncodingMode2["Attribute"] = 3] = "Attribute";
  EncodingMode2[EncodingMode2["Text"] = 4] = "Text";
})(EncodingMode || (EncodingMode = {}));

// node_modules/dom-serializer/lib/esm/foreignNames.js
var elementNames = new Map([
  "altGlyph",
  "altGlyphDef",
  "altGlyphItem",
  "animateColor",
  "animateMotion",
  "animateTransform",
  "clipPath",
  "feBlend",
  "feColorMatrix",
  "feComponentTransfer",
  "feComposite",
  "feConvolveMatrix",
  "feDiffuseLighting",
  "feDisplacementMap",
  "feDistantLight",
  "feDropShadow",
  "feFlood",
  "feFuncA",
  "feFuncB",
  "feFuncG",
  "feFuncR",
  "feGaussianBlur",
  "feImage",
  "feMerge",
  "feMergeNode",
  "feMorphology",
  "feOffset",
  "fePointLight",
  "feSpecularLighting",
  "feSpotLight",
  "feTile",
  "feTurbulence",
  "foreignObject",
  "glyphRef",
  "linearGradient",
  "radialGradient",
  "textPath"
].map((val) => [val.toLowerCase(), val]));
var attributeNames = new Map([
  "definitionURL",
  "attributeName",
  "attributeType",
  "baseFrequency",
  "baseProfile",
  "calcMode",
  "clipPathUnits",
  "diffuseConstant",
  "edgeMode",
  "filterUnits",
  "glyphRef",
  "gradientTransform",
  "gradientUnits",
  "kernelMatrix",
  "kernelUnitLength",
  "keyPoints",
  "keySplines",
  "keyTimes",
  "lengthAdjust",
  "limitingConeAngle",
  "markerHeight",
  "markerUnits",
  "markerWidth",
  "maskContentUnits",
  "maskUnits",
  "numOctaves",
  "pathLength",
  "patternContentUnits",
  "patternTransform",
  "patternUnits",
  "pointsAtX",
  "pointsAtY",
  "pointsAtZ",
  "preserveAlpha",
  "preserveAspectRatio",
  "primitiveUnits",
  "refX",
  "refY",
  "repeatCount",
  "repeatDur",
  "requiredExtensions",
  "requiredFeatures",
  "specularConstant",
  "specularExponent",
  "spreadMethod",
  "startOffset",
  "stdDeviation",
  "stitchTiles",
  "surfaceScale",
  "systemLanguage",
  "tableValues",
  "targetX",
  "targetY",
  "textLength",
  "viewBox",
  "viewTarget",
  "xChannelSelector",
  "yChannelSelector",
  "zoomAndPan"
].map((val) => [val.toLowerCase(), val]));

// node_modules/dom-serializer/lib/esm/index.js
var unencodedElements = /* @__PURE__ */ new Set([
  "style",
  "script",
  "xmp",
  "iframe",
  "noembed",
  "noframes",
  "plaintext",
  "noscript"
]);
function replaceQuotes(value) {
  return value.replace(/"/g, "&quot;");
}
function formatAttributes(attributes, opts) {
  var _a2;
  if (!attributes)
    return;
  const encode = ((_a2 = opts.encodeEntities) !== null && _a2 !== void 0 ? _a2 : opts.decodeEntities) === false ? replaceQuotes : opts.xmlMode || opts.encodeEntities !== "utf8" ? encodeXML : escapeAttribute;
  return Object.keys(attributes).map((key) => {
    var _a3, _b;
    const value = (_a3 = attributes[key]) !== null && _a3 !== void 0 ? _a3 : "";
    if (opts.xmlMode === "foreign") {
      key = (_b = attributeNames.get(key)) !== null && _b !== void 0 ? _b : key;
    }
    if (!opts.emptyAttrs && !opts.xmlMode && value === "") {
      return key;
    }
    return `${key}="${encode(value)}"`;
  }).join(" ");
}
var singleTag = /* @__PURE__ */ new Set([
  "area",
  "base",
  "basefont",
  "br",
  "col",
  "command",
  "embed",
  "frame",
  "hr",
  "img",
  "input",
  "isindex",
  "keygen",
  "link",
  "meta",
  "param",
  "source",
  "track",
  "wbr"
]);
function render(node, options = {}) {
  const nodes = "length" in node ? node : [node];
  let output = "";
  for (let i2 = 0; i2 < nodes.length; i2++) {
    output += renderNode(nodes[i2], options);
  }
  return output;
}
var esm_default = render;
function renderNode(node, options) {
  switch (node.type) {
    case Root2:
      return render(node.children, options);
    case Doctype:
    case Directive:
      return renderDirective(node);
    case Comment:
      return renderComment(node);
    case CDATA:
      return renderCdata(node);
    case Script:
    case Style:
    case Tag7:
      return renderTag(node, options);
    case Text2:
      return renderText2(node, options);
  }
}
var foreignModeIntegrationPoints = /* @__PURE__ */ new Set([
  "mi",
  "mo",
  "mn",
  "ms",
  "mtext",
  "annotation-xml",
  "foreignObject",
  "desc",
  "title"
]);
var foreignElements = /* @__PURE__ */ new Set(["svg", "math"]);
function renderTag(elem, opts) {
  var _a2;
  if (opts.xmlMode === "foreign") {
    elem.name = (_a2 = elementNames.get(elem.name)) !== null && _a2 !== void 0 ? _a2 : elem.name;
    if (elem.parent && foreignModeIntegrationPoints.has(elem.parent.name)) {
      opts = { ...opts, xmlMode: false };
    }
  }
  if (!opts.xmlMode && foreignElements.has(elem.name)) {
    opts = { ...opts, xmlMode: "foreign" };
  }
  let tag = `<${elem.name}`;
  const attribs = formatAttributes(elem.attribs, opts);
  if (attribs) {
    tag += ` ${attribs}`;
  }
  if (elem.children.length === 0 && (opts.xmlMode ? (
    // In XML mode or foreign mode, and user hasn't explicitly turned off self-closing tags
    opts.selfClosingTags !== false
  ) : (
    // User explicitly asked for self-closing tags, even in HTML mode
    opts.selfClosingTags && singleTag.has(elem.name)
  ))) {
    if (!opts.xmlMode)
      tag += " ";
    tag += "/>";
  } else {
    tag += ">";
    if (elem.children.length > 0) {
      tag += render(elem.children, opts);
    }
    if (opts.xmlMode || !singleTag.has(elem.name)) {
      tag += `</${elem.name}>`;
    }
  }
  return tag;
}
function renderDirective(elem) {
  return `<${elem.data}>`;
}
function renderText2(elem, opts) {
  var _a2;
  let data = elem.data || "";
  if (((_a2 = opts.encodeEntities) !== null && _a2 !== void 0 ? _a2 : opts.decodeEntities) !== false && !(!opts.xmlMode && elem.parent && unencodedElements.has(elem.parent.name))) {
    data = opts.xmlMode || opts.encodeEntities !== "utf8" ? encodeXML(data) : escapeText(data);
  }
  return data;
}
function renderCdata(elem) {
  return `<![CDATA[${elem.children[0].data}]]>`;
}
function renderComment(elem) {
  return `<!--${elem.data}-->`;
}

// node_modules/domutils/lib/esm/stringify.js
function getOuterHTML(node, options) {
  return esm_default(node, options);
}
function getInnerHTML(node, options) {
  return hasChildren(node) ? node.children.map((node2) => getOuterHTML(node2, options)).join("") : "";
}
function getText(node) {
  if (Array.isArray(node))
    return node.map(getText).join("");
  if (isTag2(node))
    return node.name === "br" ? "\n" : getText(node.children);
  if (isCDATA(node))
    return getText(node.children);
  if (isText(node))
    return node.data;
  return "";
}
function textContent(node) {
  if (Array.isArray(node))
    return node.map(textContent).join("");
  if (hasChildren(node) && !isComment(node)) {
    return textContent(node.children);
  }
  if (isText(node))
    return node.data;
  return "";
}
function innerText(node) {
  if (Array.isArray(node))
    return node.map(innerText).join("");
  if (hasChildren(node) && (node.type === ElementType.Tag || isCDATA(node))) {
    return innerText(node.children);
  }
  if (isText(node))
    return node.data;
  return "";
}

// node_modules/domutils/lib/esm/traversal.js
function getChildren(elem) {
  return hasChildren(elem) ? elem.children : [];
}
function getParent(elem) {
  return elem.parent || null;
}
function getSiblings(elem) {
  const parent = getParent(elem);
  if (parent != null)
    return getChildren(parent);
  const siblings = [elem];
  let { prev, next } = elem;
  while (prev != null) {
    siblings.unshift(prev);
    ({ prev } = prev);
  }
  while (next != null) {
    siblings.push(next);
    ({ next } = next);
  }
  return siblings;
}
function getAttributeValue(elem, name) {
  var _a2;
  return (_a2 = elem.attribs) === null || _a2 === void 0 ? void 0 : _a2[name];
}
function hasAttrib(elem, name) {
  return elem.attribs != null && Object.prototype.hasOwnProperty.call(elem.attribs, name) && elem.attribs[name] != null;
}
function getName(elem) {
  return elem.name;
}
function nextElementSibling(elem) {
  let { next } = elem;
  while (next !== null && !isTag2(next))
    ({ next } = next);
  return next;
}
function prevElementSibling(elem) {
  let { prev } = elem;
  while (prev !== null && !isTag2(prev))
    ({ prev } = prev);
  return prev;
}

// node_modules/domutils/lib/esm/manipulation.js
function removeElement(elem) {
  if (elem.prev)
    elem.prev.next = elem.next;
  if (elem.next)
    elem.next.prev = elem.prev;
  if (elem.parent) {
    const childs = elem.parent.children;
    const childsIndex = childs.lastIndexOf(elem);
    if (childsIndex >= 0) {
      childs.splice(childsIndex, 1);
    }
  }
  elem.next = null;
  elem.prev = null;
  elem.parent = null;
}
function replaceElement(elem, replacement) {
  const prev = replacement.prev = elem.prev;
  if (prev) {
    prev.next = replacement;
  }
  const next = replacement.next = elem.next;
  if (next) {
    next.prev = replacement;
  }
  const parent = replacement.parent = elem.parent;
  if (parent) {
    const childs = parent.children;
    childs[childs.lastIndexOf(elem)] = replacement;
    elem.parent = null;
  }
}
function appendChild(parent, child) {
  removeElement(child);
  child.next = null;
  child.parent = parent;
  if (parent.children.push(child) > 1) {
    const sibling = parent.children[parent.children.length - 2];
    sibling.next = child;
    child.prev = sibling;
  } else {
    child.prev = null;
  }
}
function append(elem, next) {
  removeElement(next);
  const { parent } = elem;
  const currNext = elem.next;
  next.next = currNext;
  next.prev = elem;
  elem.next = next;
  next.parent = parent;
  if (currNext) {
    currNext.prev = next;
    if (parent) {
      const childs = parent.children;
      childs.splice(childs.lastIndexOf(currNext), 0, next);
    }
  } else if (parent) {
    parent.children.push(next);
  }
}
function prependChild(parent, child) {
  removeElement(child);
  child.parent = parent;
  child.prev = null;
  if (parent.children.unshift(child) !== 1) {
    const sibling = parent.children[1];
    sibling.prev = child;
    child.next = sibling;
  } else {
    child.next = null;
  }
}
function prepend(elem, prev) {
  removeElement(prev);
  const { parent } = elem;
  if (parent) {
    const childs = parent.children;
    childs.splice(childs.indexOf(elem), 0, prev);
  }
  if (elem.prev) {
    elem.prev.next = prev;
  }
  prev.parent = parent;
  prev.prev = elem.prev;
  prev.next = elem;
  elem.prev = prev;
}

// node_modules/domutils/lib/esm/querying.js
function filter2(test, node, recurse = true, limit = Infinity) {
  return find2(test, Array.isArray(node) ? node : [node], recurse, limit);
}
function find2(test, nodes, recurse, limit) {
  const result = [];
  const nodeStack = [nodes];
  const indexStack = [0];
  for (; ; ) {
    if (indexStack[0] >= nodeStack[0].length) {
      if (indexStack.length === 1) {
        return result;
      }
      nodeStack.shift();
      indexStack.shift();
      continue;
    }
    const elem = nodeStack[0][indexStack[0]++];
    if (test(elem)) {
      result.push(elem);
      if (--limit <= 0)
        return result;
    }
    if (recurse && hasChildren(elem) && elem.children.length > 0) {
      indexStack.unshift(0);
      nodeStack.unshift(elem.children);
    }
  }
}
function findOneChild(test, nodes) {
  return nodes.find(test);
}
function findOne(test, nodes, recurse = true) {
  let elem = null;
  for (let i2 = 0; i2 < nodes.length && !elem; i2++) {
    const node = nodes[i2];
    if (!isTag2(node)) {
      continue;
    } else if (test(node)) {
      elem = node;
    } else if (recurse && node.children.length > 0) {
      elem = findOne(test, node.children, true);
    }
  }
  return elem;
}
function existsOne(test, nodes) {
  return nodes.some((checked) => isTag2(checked) && (test(checked) || existsOne(test, checked.children)));
}
function findAll(test, nodes) {
  const result = [];
  const nodeStack = [nodes];
  const indexStack = [0];
  for (; ; ) {
    if (indexStack[0] >= nodeStack[0].length) {
      if (nodeStack.length === 1) {
        return result;
      }
      nodeStack.shift();
      indexStack.shift();
      continue;
    }
    const elem = nodeStack[0][indexStack[0]++];
    if (!isTag2(elem))
      continue;
    if (test(elem))
      result.push(elem);
    if (elem.children.length > 0) {
      indexStack.unshift(0);
      nodeStack.unshift(elem.children);
    }
  }
}

// node_modules/domutils/lib/esm/legacy.js
var Checks = {
  tag_name(name) {
    if (typeof name === "function") {
      return (elem) => isTag2(elem) && name(elem.name);
    } else if (name === "*") {
      return isTag2;
    }
    return (elem) => isTag2(elem) && elem.name === name;
  },
  tag_type(type) {
    if (typeof type === "function") {
      return (elem) => type(elem.type);
    }
    return (elem) => elem.type === type;
  },
  tag_contains(data) {
    if (typeof data === "function") {
      return (elem) => isText(elem) && data(elem.data);
    }
    return (elem) => isText(elem) && elem.data === data;
  }
};
function getAttribCheck(attrib, value) {
  if (typeof value === "function") {
    return (elem) => isTag2(elem) && value(elem.attribs[attrib]);
  }
  return (elem) => isTag2(elem) && elem.attribs[attrib] === value;
}
function combineFuncs(a2, b2) {
  return (elem) => a2(elem) || b2(elem);
}
function compileTest(options) {
  const funcs = Object.keys(options).map((key) => {
    const value = options[key];
    return Object.prototype.hasOwnProperty.call(Checks, key) ? Checks[key](value) : getAttribCheck(key, value);
  });
  return funcs.length === 0 ? null : funcs.reduce(combineFuncs);
}
function testElement(options, node) {
  const test = compileTest(options);
  return test ? test(node) : true;
}
function getElements(options, nodes, recurse, limit = Infinity) {
  const test = compileTest(options);
  return test ? filter2(test, nodes, recurse, limit) : [];
}
function getElementById(id2, nodes, recurse = true) {
  if (!Array.isArray(nodes))
    nodes = [nodes];
  return findOne(getAttribCheck("id", id2), nodes, recurse);
}
function getElementsByTagName(tagName, nodes, recurse = true, limit = Infinity) {
  return filter2(Checks["tag_name"](tagName), nodes, recurse, limit);
}
function getElementsByTagType(type, nodes, recurse = true, limit = Infinity) {
  return filter2(Checks["tag_type"](type), nodes, recurse, limit);
}

// node_modules/domutils/lib/esm/helpers.js
function removeSubsets(nodes) {
  let idx = nodes.length;
  while (--idx >= 0) {
    const node = nodes[idx];
    if (idx > 0 && nodes.lastIndexOf(node, idx - 1) >= 0) {
      nodes.splice(idx, 1);
      continue;
    }
    for (let ancestor = node.parent; ancestor; ancestor = ancestor.parent) {
      if (nodes.includes(ancestor)) {
        nodes.splice(idx, 1);
        break;
      }
    }
  }
  return nodes;
}
var DocumentPosition;
(function(DocumentPosition2) {
  DocumentPosition2[DocumentPosition2["DISCONNECTED"] = 1] = "DISCONNECTED";
  DocumentPosition2[DocumentPosition2["PRECEDING"] = 2] = "PRECEDING";
  DocumentPosition2[DocumentPosition2["FOLLOWING"] = 4] = "FOLLOWING";
  DocumentPosition2[DocumentPosition2["CONTAINS"] = 8] = "CONTAINS";
  DocumentPosition2[DocumentPosition2["CONTAINED_BY"] = 16] = "CONTAINED_BY";
})(DocumentPosition || (DocumentPosition = {}));
function compareDocumentPosition(nodeA, nodeB) {
  const aParents = [];
  const bParents = [];
  if (nodeA === nodeB) {
    return 0;
  }
  let current = hasChildren(nodeA) ? nodeA : nodeA.parent;
  while (current) {
    aParents.unshift(current);
    current = current.parent;
  }
  current = hasChildren(nodeB) ? nodeB : nodeB.parent;
  while (current) {
    bParents.unshift(current);
    current = current.parent;
  }
  const maxIdx = Math.min(aParents.length, bParents.length);
  let idx = 0;
  while (idx < maxIdx && aParents[idx] === bParents[idx]) {
    idx++;
  }
  if (idx === 0) {
    return DocumentPosition.DISCONNECTED;
  }
  const sharedParent = aParents[idx - 1];
  const siblings = sharedParent.children;
  const aSibling = aParents[idx];
  const bSibling = bParents[idx];
  if (siblings.indexOf(aSibling) > siblings.indexOf(bSibling)) {
    if (sharedParent === nodeB) {
      return DocumentPosition.FOLLOWING | DocumentPosition.CONTAINED_BY;
    }
    return DocumentPosition.FOLLOWING;
  }
  if (sharedParent === nodeA) {
    return DocumentPosition.PRECEDING | DocumentPosition.CONTAINS;
  }
  return DocumentPosition.PRECEDING;
}
function uniqueSort(nodes) {
  nodes = nodes.filter((node, i2, arr) => !arr.includes(node, i2 + 1));
  nodes.sort((a2, b2) => {
    const relative = compareDocumentPosition(a2, b2);
    if (relative & DocumentPosition.PRECEDING) {
      return -1;
    } else if (relative & DocumentPosition.FOLLOWING) {
      return 1;
    }
    return 0;
  });
  return nodes;
}

// node_modules/domutils/lib/esm/feeds.js
function getFeed(doc) {
  const feedRoot = getOneElement(isValidFeed, doc);
  return !feedRoot ? null : feedRoot.name === "feed" ? getAtomFeed(feedRoot) : getRssFeed(feedRoot);
}
function getAtomFeed(feedRoot) {
  var _a2;
  const childs = feedRoot.children;
  const feed = {
    type: "atom",
    items: getElementsByTagName("entry", childs).map((item) => {
      var _a3;
      const { children } = item;
      const entry = { media: getMediaElements(children) };
      addConditionally(entry, "id", "id", children);
      addConditionally(entry, "title", "title", children);
      const href2 = (_a3 = getOneElement("link", children)) === null || _a3 === void 0 ? void 0 : _a3.attribs["href"];
      if (href2) {
        entry.link = href2;
      }
      const description = fetch("summary", children) || fetch("content", children);
      if (description) {
        entry.description = description;
      }
      const pubDate = fetch("updated", children);
      if (pubDate) {
        entry.pubDate = new Date(pubDate);
      }
      return entry;
    })
  };
  addConditionally(feed, "id", "id", childs);
  addConditionally(feed, "title", "title", childs);
  const href = (_a2 = getOneElement("link", childs)) === null || _a2 === void 0 ? void 0 : _a2.attribs["href"];
  if (href) {
    feed.link = href;
  }
  addConditionally(feed, "description", "subtitle", childs);
  const updated = fetch("updated", childs);
  if (updated) {
    feed.updated = new Date(updated);
  }
  addConditionally(feed, "author", "email", childs, true);
  return feed;
}
function getRssFeed(feedRoot) {
  var _a2, _b;
  const childs = (_b = (_a2 = getOneElement("channel", feedRoot.children)) === null || _a2 === void 0 ? void 0 : _a2.children) !== null && _b !== void 0 ? _b : [];
  const feed = {
    type: feedRoot.name.substr(0, 3),
    id: "",
    items: getElementsByTagName("item", feedRoot.children).map((item) => {
      const { children } = item;
      const entry = { media: getMediaElements(children) };
      addConditionally(entry, "id", "guid", children);
      addConditionally(entry, "title", "title", children);
      addConditionally(entry, "link", "link", children);
      addConditionally(entry, "description", "description", children);
      const pubDate = fetch("pubDate", children) || fetch("dc:date", children);
      if (pubDate)
        entry.pubDate = new Date(pubDate);
      return entry;
    })
  };
  addConditionally(feed, "title", "title", childs);
  addConditionally(feed, "link", "link", childs);
  addConditionally(feed, "description", "description", childs);
  const updated = fetch("lastBuildDate", childs);
  if (updated) {
    feed.updated = new Date(updated);
  }
  addConditionally(feed, "author", "managingEditor", childs, true);
  return feed;
}
var MEDIA_KEYS_STRING = ["url", "type", "lang"];
var MEDIA_KEYS_INT = [
  "fileSize",
  "bitrate",
  "framerate",
  "samplingrate",
  "channels",
  "duration",
  "height",
  "width"
];
function getMediaElements(where) {
  return getElementsByTagName("media:content", where).map((elem) => {
    const { attribs } = elem;
    const media = {
      medium: attribs["medium"],
      isDefault: !!attribs["isDefault"]
    };
    for (const attrib of MEDIA_KEYS_STRING) {
      if (attribs[attrib]) {
        media[attrib] = attribs[attrib];
      }
    }
    for (const attrib of MEDIA_KEYS_INT) {
      if (attribs[attrib]) {
        media[attrib] = parseInt(attribs[attrib], 10);
      }
    }
    if (attribs["expression"]) {
      media.expression = attribs["expression"];
    }
    return media;
  });
}
function getOneElement(tagName, node) {
  return getElementsByTagName(tagName, node, true, 1)[0];
}
function fetch(tagName, where, recurse = false) {
  return textContent(getElementsByTagName(tagName, where, recurse, 1)).trim();
}
function addConditionally(obj, prop, tagName, where, recurse = false) {
  const val = fetch(tagName, where, recurse);
  if (val)
    obj[prop] = val;
}
function isValidFeed(value) {
  return value === "rss" || value === "feed" || value === "rdf:RDF";
}

// src/shared/cell-content/text-cell-content.ts
var getInnerHTML2 = (htmlText) => {
  let allInnerText = "";
  const parser = new Parser({
    ontext: (text) => {
      allInnerText += text;
    }
  });
  parser.write(htmlText);
  parser.end();
  return allInnerText.trim();
};
var markdownToHTML = (markdown) => {
  const md = (0, import_markdown_it.default)();
  return md.render(markdown);
};
var getTextCellContent = (content, shouldRemoveMarkdown) => {
  if (shouldRemoveMarkdown) {
    const replaced = content.replace(
      WIKI_LINK_REGEX,
      (_match, path) => path
    );
    const html = markdownToHTML(replaced);
    const innerHTML = getInnerHTML2(html);
    return innerHTML;
  }
  return content;
};

// src/shared/cell-content/index.ts
var getTagCellContent = (column, cell) => {
  const { tagId } = cell;
  if (!tagId)
    return "";
  const tag = column.tags.find((tag2) => tag2.id === tagId);
  if (!tag)
    throw new TagNotFoundError(tagId);
  return tag.content;
};
var getMultiTagCellContent = (column, cell) => {
  return column.tags.filter((tag) => cell.tagIds.includes(tag.id)).map((tag) => tag.content).join(",");
};
var getCellContent = (app, source, column, row, cell, shouldRemoveMarkdown) => {
  const {
    currencyType,
    numberPrefix,
    numberSuffix,
    numberSeparator,
    numberFormat,
    dateFormat,
    dateFormatSeparator,
    includeTime,
    hour12
  } = column;
  const { creationDateTime, lastEditedDateTime } = row;
  switch (column.type) {
    case "text" /* TEXT */: {
      const { content } = cell;
      return getTextCellContent(content, shouldRemoveMarkdown);
    }
    case "file" /* FILE */: {
      const { path } = cell;
      return getTextCellContent(path, shouldRemoveMarkdown);
    }
    case "number" /* NUMBER */: {
      const { value } = cell;
      return getNumberCellContent(numberFormat, value, {
        currency: currencyType,
        prefix: numberPrefix,
        suffix: numberSuffix,
        separator: numberSeparator
      });
    }
    case "embed" /* EMBED */: {
      const { pathOrUrl, isExternal } = cell;
      return getEmbedCellContent(app, pathOrUrl, {
        isExport: true,
        isExternal,
        shouldRemoveMarkdown
      });
    }
    case "checkbox" /* CHECKBOX */: {
      const { value } = cell;
      return getCheckboxCellContent(value, shouldRemoveMarkdown);
    }
    case "tag" /* TAG */:
      return getTagCellContent(column, cell);
    case "multi-tag" /* MULTI_TAG */:
      return getMultiTagCellContent(column, cell);
    case "date" /* DATE */: {
      const { dateTime } = cell;
      return getDateCellContent(
        dateTime,
        dateFormat,
        dateFormatSeparator,
        includeTime,
        hour12
      );
    }
    case "creation-time" /* CREATION_TIME */: {
      return getTimeCellContent(
        creationDateTime,
        dateFormat,
        dateFormatSeparator,
        hour12
      );
    }
    case "last-edited-time" /* LAST_EDITED_TIME */: {
      return getTimeCellContent(
        lastEditedDateTime,
        dateFormat,
        dateFormatSeparator,
        hour12
      );
    }
    case "source" /* SOURCE */: {
      return getSourceCellContent(source);
    }
    case "source-file" /* SOURCE_FILE */: {
      const { path } = cell;
      return getSourceFileContent(path, shouldRemoveMarkdown);
    }
    default:
      throw new Error("Unsupported cell type");
  }
};

// src/shared/export/loom-state-to-array.tsx
var serializeColumns = (columns) => {
  return columns.map((column) => column.content);
};
var serializeCells = (app, sources, columns, rows, shouldRemoveMarkdown) => {
  return rows.map((row) => {
    const { cells } = row;
    return cells.map((cell) => {
      var _a2;
      const column = columns.find(
        (column2) => column2.id === cell.columnId
      );
      if (!column)
        throw new ColumnNotFoundError({ id: cell.columnId });
      const source = (_a2 = sources.find((source2) => source2.id === row.sourceId)) != null ? _a2 : null;
      const content = getCellContent(
        app,
        source,
        column,
        row,
        cell,
        shouldRemoveMarkdown
      );
      return content;
    });
  });
};
var loomStateToArray = (app, loomState, shouldRemoveMarkdown) => {
  const { rows, columns, sources } = loomState.model;
  const serializedColumns = serializeColumns(columns);
  const serializedCells = serializeCells(
    app,
    sources,
    columns,
    rows,
    shouldRemoveMarkdown
  );
  return [serializedColumns, ...serializedCells];
};

// src/shared/export/export-utils.ts
var escapePipeCharacters = (value) => value.replace(/\|/g, "\\|");
var replaceNewLinesWithBreaks = (value) => value.replace(/\n/g, "<br>");

// src/shared/export/export-to-markdown.tsx
var exportToMarkdown = (app, loomState, shouldRemoveMarkdown) => {
  let arr = loomStateToArray(app, loomState, shouldRemoveMarkdown);
  arr = arr.map((row) => row.map((cell) => replaceNewLinesWithBreaks(cell)));
  arr = arr.map((row) => row.map((cell) => escapePipeCharacters(cell)));
  return markdownTable(arr);
};

// src/react/export-app/index.tsx
var import_obsidian13 = require("obsidian");

// src/shared/export/download-utils.ts
var import_obsidian12 = require("obsidian");
var getBlobTypeForExportType = (type) => {
  switch (type) {
    case "CSV" /* CSV */:
      return "text/csv";
    case "Markdown" /* MARKDOWN */:
      return "text/markdown";
    default:
      throw new Error(`Unknown export type: ${type}`);
  }
};
var getExportFileName = (filePath) => {
  const replaceExtension = filePath.replace(`.${LOOM_EXTENSION}`, "");
  const replaceSlash = replaceExtension.replace(/\//g, "-");
  const replaceSpaces = replaceSlash.replace(/ /g, "_");
  const timestamp = (0, import_obsidian12.moment)().format("YYYY_MM_DD-HH_mm_ss");
  return replaceSpaces + "-" + timestamp;
};
var downloadFile = (fileName, blobType, data) => {
  if (blobType === "text/csv") {
    data = "\uFEFF" + data;
  }
  const blob = new Blob([data], { type: blobType });
  const url = window.URL.createObjectURL(blob);
  const el = document.createElement("a");
  el.setAttribute("href", url);
  el.setAttribute("download", fileName);
  el.style.display = "none";
  document.body.appendChild(el);
  el.click();
  document.body.removeChild(el);
};

// src/shared/export/export-to-csv.tsx
var import_papaparse = __toESM(require_papaparse_min());
var exportToCSV = (app, loomState, shouldRemoveMarkdown) => {
  const arr = loomStateToArray(app, loomState, shouldRemoveMarkdown);
  return import_papaparse.default.unparse(arr);
};

// src/react/export-app/index.tsx
var import_jsx_runtime93 = __toESM(require_jsx_runtime());
function ExportApp({ app, loomState, loomFilePath }) {
  const [exportType, setExportType] = import_react40.default.useState(
    "Select an option" /* UNSELECTED */
  );
  const { removeMarkdownOnExport } = useAppSelector(
    (state) => state.global.settings
  );
  const [shouldRemoveMarkdown, setRemoveMarkdown] = import_react40.default.useState(
    removeMarkdownOnExport
  );
  async function handleCopyClick(value) {
    await navigator.clipboard.writeText(value);
    new import_obsidian13.Notice("Copied to clipboard");
  }
  function handleDownloadClick() {
    const fileName = getExportFileName(loomFilePath);
    const blobType = getBlobTypeForExportType(exportType);
    downloadFile(fileName, blobType, content);
  }
  let content = "";
  if (exportType === "Markdown" /* MARKDOWN */) {
    content = exportToMarkdown(app, loomState, shouldRemoveMarkdown);
  } else if (exportType === "CSV" /* CSV */) {
    content = exportToCSV(app, loomState, shouldRemoveMarkdown);
  }
  return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "dataloom-export-app", children: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(Stack, { spacing: "xl", width: "100%", children: [
    /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ExportTypeSelect, { value: exportType, onChange: setExportType }),
    exportType !== "Select an option" /* UNSELECTED */ && /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_jsx_runtime93.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(Stack, { spacing: "sm", children: [
        /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("label", { htmlFor: "remove-markdown", children: "Remove markdown" }),
        /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
          Switch,
          {
            id: "remove-markdown",
            value: shouldRemoveMarkdown,
            onToggle: () => setRemoveMarkdown((prevState) => !prevState)
          }
        )
      ] }),
      /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ContentTextArea, { value: content }),
      /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(Stack, { isHorizontal: true, children: [
        /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
          "button",
          {
            className: "mod-cta",
            onClick: handleDownloadClick,
            children: "Download"
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
          "button",
          {
            className: "dataloom-copy-button",
            onClick: () => handleCopyClick(content),
            children: "Copy to clipboard"
          }
        )
      ] })
    ] })
  ] }) });
}

// src/obsidian/modal/export-modal.tsx
var import_jsx_runtime94 = __toESM(require_jsx_runtime());
var ExportModal = class extends import_obsidian14.Modal {
  constructor(app, loomFile, loomState) {
    super(app);
    this.app = app;
    this.loomFile = loomFile;
    this.loomState = loomState;
  }
  onOpen() {
    const { containerEl } = this;
    setModalTitle(containerEl, "DataLoom Export");
    const { contentEl } = this;
    renderDivider(contentEl);
    const appContainerEl = contentEl.createDiv();
    this.renderApp(appContainerEl);
  }
  async renderApp(contentEl) {
    this.root = (0, import_client2.createRoot)(contentEl);
    this.root.render(
      /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Provider_default, { store, children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
        ExportApp,
        {
          app: this.app,
          loomState: this.loomState,
          loomFilePath: this.loomFile.path
        }
      ) })
    );
  }
  onClose() {
    if (this.root)
      this.root.unmount();
  }
};

// src/obsidian/modal/import-modal.tsx
var import_obsidian15 = require("obsidian");
var import_client3 = __toESM(require_client());

// src/react/import-app/index.tsx
var import_react46 = __toESM(require_react());
var import_papaparse2 = __toESM(require_papaparse_min());

// src/react/import-app/types.ts
var DataType = /* @__PURE__ */ ((DataType3) => {
  DataType3["UNSELECTED"] = "Select an option";
  DataType3["CSV"] = "CSV";
  DataType3["MARKDOWN"] = "Markdown";
  return DataType3;
})(DataType || {});
var DataSource = /* @__PURE__ */ ((DataSource2) => {
  DataSource2["UNSELECTED"] = "Select an option";
  DataSource2["FILE"] = "File";
  DataSource2["PASTE"] = "Paste from clipboard";
  return DataSource2;
})(DataSource || {});

// src/react/import-app/data-type-select.tsx
var import_jsx_runtime95 = __toESM(require_jsx_runtime());
function DataTypeSelect({ value, onChange }) {
  return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: "dataloom-data-type-select", children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Stack, { children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
    "select",
    {
      value,
      onChange: (e) => onChange(e.target.value),
      children: Object.values(DataType).map((type) => /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("option", { value: type, children: type }, type))
    }
  ) }) });
}

// src/react/shared/stepper/index.tsx
var import_react41 = __toESM(require_react());

// src/react/shared/stepper/step-spacer.tsx
var import_jsx_runtime96 = __toESM(require_jsx_runtime());
function StepSpacer() {
  return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { className: "dataloom-step__spacer" });
}

// src/react/shared/stepper/step-content.tsx
var import_jsx_runtime97 = __toESM(require_jsx_runtime());
function StepContent({ content, addTopMargin }) {
  let className = "dataloom-step__content";
  if (addTopMargin) {
    className += " dataloom-step__content--margin-top";
  }
  return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("div", { className, children: content });
}

// src/react/shared/stepper/step-buttons.tsx
var import_jsx_runtime98 = __toESM(require_jsx_runtime());
function StepButtons({
  isFirstStep,
  isLastStep,
  isNextDisabled,
  finishButtonLabel,
  onNextClick,
  onBackClick
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: "dataloom-step__buttons", children: /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Stack, { isHorizontal: true, spacing: "md", children: [
    /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
      Button,
      {
        isDisabled: isNextDisabled,
        variant: "default",
        onClick: onNextClick,
        children: isLastStep ? finishButtonLabel : "Next"
      }
    ),
    !isFirstStep && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Button, { onClick: onBackClick, children: "Back" })
  ] }) });
}

// src/react/shared/stepper/step-indicator.tsx
var import_jsx_runtime99 = __toESM(require_jsx_runtime());
function StepIndicator({ index, isComplete, onClick }) {
  function handleClick() {
    if (!isComplete)
      return;
    onClick();
  }
  let className = "dataloom-step__indicator";
  if (isComplete) {
    className += " dataloom-step__indicator--complete";
  }
  return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className, onClick: handleClick, children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Flex, { justify: "center", align: "center", height: "100%", children: isComplete ? /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Icon, { lucideId: "checkmark", size: "lg" }) : /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Text, { value: index + 1, variant: "semibold", size: "lg" }) }) });
}

// src/react/shared/stepper/step-text.tsx
var import_jsx_runtime100 = __toESM(require_jsx_runtime());
function StepText({
  title,
  description,
  isComplete,
  onClick
}) {
  function handleClick() {
    if (!isComplete)
      return;
    onClick();
  }
  let className = "dataloom-step__text";
  if (isComplete) {
    className += " dataloom-step__text--complete";
  }
  return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(Stack, { spacing: "sm", onClick: handleClick, children: [
    /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Text, { variant: "semibold", size: "lg", value: title }),
    description && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Text, { size: "md", value: description })
  ] }) });
}

// src/react/shared/stepper/step-header.tsx
var import_jsx_runtime101 = __toESM(require_jsx_runtime());
function StepHeader({
  title,
  description,
  index,
  activeIndex,
  onClick
}) {
  let className = "dataloom-step__header";
  if (description === void 0) {
    className += " dataloom-step__header--margin-bottom";
  }
  const isComplete = activeIndex > index;
  return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(Stack, { isHorizontal: true, children: [
    /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
      StepIndicator,
      {
        index,
        isComplete,
        onClick: () => onClick(index)
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
      StepText,
      {
        title,
        description,
        isComplete,
        onClick: () => onClick(index)
      }
    )
  ] }) });
}

// src/react/shared/stepper/step-separator.tsx
var import_jsx_runtime102 = __toESM(require_jsx_runtime());
function StepSeparator({ hideBorder }) {
  let className = "dataloom-step__separator";
  if (hideBorder) {
    className += " dataloom-step__separator--no-border";
  }
  return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className });
}

// src/react/shared/stepper/index.tsx
var import_jsx_runtime103 = __toESM(require_jsx_runtime());
function Stepper({
  steps,
  finishButtonLabel = "Finish",
  onFinishClick
}) {
  const [activeIndex, setActiveIndex] = import_react41.default.useState(0);
  const activeStep = steps[activeIndex];
  function handleStepHeaderClick(index) {
    var _a2, _b;
    for (let i2 = index; i2 < activeIndex; i2++) {
      (_b = (_a2 = steps[i2]).onBack) == null ? void 0 : _b.call(_a2);
    }
    setActiveIndex(index);
  }
  function handleNextClick() {
    if (activeIndex === steps.length - 1) {
      onFinishClick();
      return;
    }
    if (activeStep.onContinue) {
      if (activeStep.onContinue() === false)
        return;
    }
    setActiveIndex((prevState) => prevState + 1);
  }
  function handleBackClick() {
    if (activeIndex === 0)
      return;
    if (activeStep.onBack)
      activeStep.onBack();
    setActiveIndex((prevState) => prevState - 1);
  }
  const isFirstStep = activeIndex === 0;
  const isLastStep = activeIndex === steps.length - 1;
  return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { className: "dataloom-stepper", children: steps.map((step, i2) => {
    const {
      title,
      description,
      content,
      canContinue = true
    } = step;
    return /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: "dataloom-step", children: [
      /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
        StepHeader,
        {
          title,
          description,
          index: i2,
          activeIndex,
          onClick: handleStepHeaderClick
        }
      ),
      i2 === activeIndex && /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(Stack, { isHorizontal: true, children: [
        /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(StepSeparator, { hideBorder: isLastStep }),
        /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(Stack, { spacing: "lg", width: "100%", children: [
          /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
            StepContent,
            {
              content,
              addTopMargin: description !== void 0
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
            StepButtons,
            {
              isNextDisabled: canContinue instanceof Function ? !canContinue() : !canContinue,
              isFirstStep,
              isLastStep,
              finishButtonLabel,
              onNextClick: handleNextClick,
              onBackClick: handleBackClick
            }
          )
        ] })
      ] }),
      i2 < steps.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(StepSpacer, {})
    ] }, i2);
  }) });
}

// src/react/import-app/data-source-select.tsx
var import_jsx_runtime104 = __toESM(require_jsx_runtime());
function DataSourceSelect({ value, onChange }) {
  return /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("div", { className: "dataloom-data-source-select", children: /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(Stack, { children: /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
    "select",
    {
      value,
      onChange: (e) => onChange(e.target.value),
      children: Object.values(DataSource).map((type) => /* @__PURE__ */ (0, import_jsx_runtime104.jsx)("option", { value: type, children: type }, type))
    }
  ) }) });
}

// src/react/import-app/utils.ts
var getAcceptForDataType = (value) => {
  switch (value) {
    case "Markdown" /* MARKDOWN */:
      return ".md";
    case "CSV" /* CSV */:
      return ".csv";
    default:
      return "";
  }
};

// src/react/import-app/upload-data/file-input/index.tsx
var import_jsx_runtime105 = __toESM(require_jsx_runtime());
function FileInput({
  hasHeadersRow,
  fileName,
  dataType,
  onDataChange,
  onHeadersRowToggle
}) {
  function handleUpload(e) {
    var _a2, _b;
    const file = (_b = (_a2 = e.target.files) == null ? void 0 : _a2[0]) != null ? _b : null;
    if (!file)
      return;
    const reader = new FileReader();
    reader.onload = (e2) => {
      var _a3, _b2;
      const rawData = (_b2 = (_a3 = e2.target) == null ? void 0 : _a3.result) != null ? _b2 : "";
      onDataChange(rawData, file.name);
    };
    reader.readAsText(file);
  }
  const accept = getAcceptForDataType(dataType);
  return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)("div", { className: "dataloom-file-input", children: /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(Stack, { spacing: "2xl", children: [
    /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(Stack, { children: [
      /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(Text, { value: fileName != null ? fileName : "No file chosen" }),
      /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
        "input",
        {
          type: "file",
          accept,
          onChange: handleUpload
        }
      )
    ] }),
    accept === ".csv" && /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(Stack, { spacing: "sm", children: [
      /* @__PURE__ */ (0, import_jsx_runtime105.jsx)("label", { htmlFor: "has-headers", children: "First row contains headers" }),
      /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
        Switch,
        {
          id: "has-headers",
          value: hasHeadersRow,
          onToggle: onHeadersRowToggle
        }
      )
    ] })
  ] }) });
}

// src/react/import-app/upload-data/upload-textarea.tsx
var import_jsx_runtime106 = __toESM(require_jsx_runtime());
function UploadTextarea({ value, onChange }) {
  return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)("textarea", { value, onChange: (e) => onChange(e.target.value) });
}

// src/react/import-app/upload-data/index.tsx
var import_jsx_runtime107 = __toESM(require_jsx_runtime());
function UploadData({
  source,
  fileName,
  dataType,
  hasHeadersRow,
  rawData,
  errorText,
  onRawDataChange,
  onHeadersRowToggle
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { className: "dataloom-upload-data", children: [
    source === "Paste from clipboard" /* PASTE */ && /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(UploadTextarea, { value: rawData, onChange: onRawDataChange }),
    source === "File" /* FILE */ && /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
      FileInput,
      {
        fileName,
        dataType,
        hasHeadersRow,
        onHeadersRowToggle,
        onDataChange: onRawDataChange
      }
    ),
    errorText !== null && /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Text, { variant: "error", value: errorText, size: "sm" })
  ] });
}

// src/react/import-app/match-columns/index.tsx
var import_react44 = __toESM(require_react());

// src/react/import-app/match-columns/body-cell.tsx
var import_jsx_runtime108 = __toESM(require_jsx_runtime());
function BodyCell2({ value, isDisabled }) {
  const overflowClassName = useOverflow(false, {
    ellipsis: true
  });
  let className = overflowClassName;
  if (isDisabled)
    className += " dataloom-disabled";
  return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("td", { className, children: value });
}

// src/react/shared/model-menu/index.tsx
var import_react43 = __toESM(require_react());

// src/react/shared/modal-mount-provider/index.tsx
var import_react42 = __toESM(require_react());
var import_jsx_runtime109 = __toESM(require_jsx_runtime());
var MountContext2 = import_react42.default.createContext(null);
var useModalMount = () => {
  const value = import_react42.default.useContext(MountContext2);
  if (value === null) {
    throw new Error(
      "useModalMount() called without a <ModalMountProvider /> in the tree."
    );
  }
  return value;
};
function ModalMountProvider({
  obsidianApp,
  modalEl,
  children
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(MountContext2.Provider, { value: { obsidianApp, modalEl }, children });
}

// src/react/shared/model-menu/index.tsx
var import_jsx_runtime110 = __toESM(require_jsx_runtime());
function ModalMenu({
  id: id2,
  isOpen,
  hideBorder = false,
  openDirection,
  position,
  width = 0,
  height = 0,
  maxHeight = 0,
  maxWidth = 0,
  children
}) {
  const ref = import_react43.default.useRef(null);
  const { modalEl } = useModalMount();
  useShiftMenu(true, modalEl, ref, position, isOpen, {
    openDirection
  });
  return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
    base_menu_default,
    {
      ref,
      id: id2,
      isOpen,
      hideBorder,
      position,
      width,
      height,
      maxHeight,
      maxWidth,
      children
    }
  );
}

// src/react/import-app/constants.ts
var NEW_COLUMN_ID = "new-column";

// src/react/import-app/match-columns/match-column-menu.tsx
var import_jsx_runtime111 = __toESM(require_jsx_runtime());
function MatchColumnMenu({
  id: id2,
  position,
  isOpen,
  columns,
  columnMatches,
  selectedColumnId,
  onColumnClick
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)(
    ModalMenu,
    {
      id: id2,
      isOpen,
      position,
      openDirection: "bottom-left",
      children: [
        columns.filter(
          (column) => column.type !== "source" /* SOURCE */ && column.type !== "source-file" /* SOURCE_FILE */ && column.type !== "last-edited-time" /* LAST_EDITED_TIME */ && column.type !== "creation-time" /* CREATION_TIME */
        ).map((column) => {
          const { id: id3, content, type } = column;
          const isDisabled = columnMatches.some(
            (match) => match.columnId === id3
          );
          return /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
            MenuItem,
            {
              name: content,
              isDisabled,
              lucideId: getIconIdForCellType(type),
              onClick: () => onColumnClick(id3),
              isSelected: id3 === selectedColumnId
            },
            id3
          );
        }),
        /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(Divider, {}),
        /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
          MenuItem,
          {
            name: "Match as new",
            onClick: () => onColumnClick(NEW_COLUMN_ID),
            isSelected: selectedColumnId === NEW_COLUMN_ID
          }
        ),
        selectedColumnId !== null && /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)(import_jsx_runtime111.Fragment, { children: [
          /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(Divider, {}),
          /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
            MenuItem,
            {
              name: "Unmatch",
              onClick: () => onColumnClick(null)
            }
          )
        ] })
      ]
    }
  );
}

// src/react/import-app/match-columns/header-cell.tsx
var import_jsx_runtime112 = __toESM(require_jsx_runtime());
function HeaderCell2({
  isDisabled,
  columns,
  columnMatches,
  index,
  importValue,
  matchId,
  onColumnMatch,
  onColumnEnabledToggle
}) {
  const overflowClassName = useOverflow(false, {
    ellipsis: true
  });
  const COMPONENT_ID = `header-cell-${index}`;
  const menu = useMenu(COMPONENT_ID);
  function handleColumnClick(columnId) {
    onColumnMatch(index, columnId);
    menu.onClose();
  }
  return /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(import_jsx_runtime112.Fragment, { children: [
    /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("th", { className: overflowClassName, children: /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(
      Stack,
      {
        className: isDisabled ? "dataloom-disabled" : void 0,
        isHorizontal: true,
        justify: "space-between",
        spacing: "xl",
        width: "100%",
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(Stack, { isHorizontal: true, spacing: "sm", children: [
            /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(Text, { value: importValue }),
            /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
              Icon,
              {
                color: matchId ? "green" : "red",
                ariaLabel: matchId !== null ? "Matched" : "Unmatched",
                lucideId: matchId !== null ? "shield-check" : "shield-question",
                size: "xl"
              }
            )
          ] }),
          /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(Stack, { isHorizontal: true, spacing: "sm", children: [
            /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
              "input",
              {
                "aria-label": isDisabled ? "Enable column" : "Disable column",
                type: "checkbox",
                checked: !isDisabled,
                onChange: () => onColumnEnabledToggle(index)
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
              menu_button_default,
              {
                ref: menu.triggerRef,
                isFocused: menu.isTriggerFocused,
                menuId: menu.id,
                level: 1 /* ONE */,
                ariaLabel: "Match column",
                icon: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(Icon, { lucideId: "columns", size: "lg" }),
                onOpen: () => menu.onOpen(1 /* ONE */, {
                  shouldFocusTriggerOnClose: false
                })
              }
            )
          ] })
        ]
      }
    ) }),
    /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
      MatchColumnMenu,
      {
        id: menu.id,
        isOpen: menu.isOpen,
        position: menu.position,
        selectedColumnId: matchId,
        columnMatches,
        columns,
        onColumnClick: handleColumnClick
      }
    )
  ] });
}

// src/react/import-app/match-columns/bulk-options-menu.tsx
var import_jsx_runtime113 = __toESM(require_jsx_runtime());
function BulkOptionsMenu({
  id: id2,
  position,
  isOpen,
  onAllColumnsEnabledToggle,
  onAllColumnsMatch
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)(
    ModalMenu,
    {
      id: id2,
      isOpen,
      position,
      openDirection: "bottom",
      children: [
        /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
          MenuItem,
          {
            name: "Match all as new",
            onClick: () => onAllColumnsMatch(NEW_COLUMN_ID)
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
          MenuItem,
          {
            name: "Disable all",
            onClick: () => onAllColumnsEnabledToggle(false)
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
          MenuItem,
          {
            name: "Enable all",
            onClick: () => onAllColumnsEnabledToggle(true)
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
          MenuItem,
          {
            name: "Unmatch all",
            onClick: () => onAllColumnsMatch(null)
          }
        )
      ]
    }
  );
}

// src/react/import-app/match-columns/index.tsx
var import_jsx_runtime114 = __toESM(require_jsx_runtime());
function MatchColumns({
  columns,
  columnMatches,
  data,
  enabledColumnIndices,
  onColumnEnabledToggle,
  onAllColumnsEnabledToggle,
  onAllColumnsMatch,
  onColumnMatch
}) {
  const containerRef = import_react44.default.useRef(null);
  const COMPONENT_ID = "match-columns";
  const menu = useMenu(COMPONENT_ID);
  const menuOperations = useMenuOperations();
  import_react44.default.useEffect(() => {
    function handleScroll() {
      menuOperations.onCloseAll();
    }
    if (!containerRef.current)
      return;
    const containerEl = containerRef.current;
    const appEl = containerEl.closest(".dataloom-import-app");
    if (!appEl)
      return;
    appEl.addEventListener("scroll", handleScroll);
    containerEl.addEventListener("scroll", handleScroll);
    window.addEventListener("resize", handleScroll);
    return () => {
      appEl.removeEventListener("scroll", handleScroll);
      containerEl.removeEventListener("scroll", handleScroll);
      window.removeEventListener("resize", handleScroll);
    };
  }, [menuOperations]);
  function handleAllColumnsMatch(columnId) {
    onAllColumnsMatch(columnId);
    menu.onClose();
  }
  function handleAllColumnsEnabledToggle(isEnabled) {
    onAllColumnsEnabledToggle(isEnabled);
    menu.onClose();
  }
  let numUnmatched = enabledColumnIndices.length - columnMatches.length;
  if (numUnmatched < 0)
    numUnmatched = 0;
  let infoMessage = "";
  if (enabledColumnIndices.length === 0) {
    infoMessage = "You must enable at least one column";
  } else if (numUnmatched === 0) {
    infoMessage = "All columns matched";
  } else if (numUnmatched === 1) {
    infoMessage = `There is 1 unmatched column. Please match it to continue`;
  } else {
    infoMessage = `There are ${numUnmatched} unmatched columns. Please match them to continue`;
  }
  return /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)(import_jsx_runtime114.Fragment, { children: [
    /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)("div", { className: "dataloom-match-columns", children: [
      /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(Padding, { pb: "lg", children: /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
        menu_button_default,
        {
          menuId: menu.id,
          variant: "link",
          isFocused: menu.isTriggerFocused,
          ref: menu.triggerRef,
          level: 1 /* ONE */,
          onOpen: () => menu.onOpen(1 /* ONE */, {
            shouldFocusTriggerOnClose: false
          }),
          children: "Bulk operations"
        }
      ) }) }),
      /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
        "div",
        {
          ref: containerRef,
          className: "dataloom-match-columns__container",
          children: /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)("table", { children: [
            /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("tr", { children: data[0].map((header, i2) => {
              var _a2, _b;
              const matchId = (_b = (_a2 = columnMatches.find(
                (match) => match.importColumnIndex === i2
              )) == null ? void 0 : _a2.columnId) != null ? _b : null;
              return /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
                HeaderCell2,
                {
                  isDisabled: !enabledColumnIndices.includes(
                    i2
                  ),
                  columnMatches,
                  columns,
                  index: i2,
                  matchId,
                  importValue: header,
                  onColumnEnabledToggle,
                  onColumnMatch
                },
                i2
              );
            }) }) }),
            /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("tbody", { children: data.slice(1).map((row, i2) => /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("tr", { children: row.map((cell, j2) => /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
              BodyCell2,
              {
                value: cell,
                isDisabled: !enabledColumnIndices.includes(
                  j2
                )
              },
              j2
            )) }, i2)) })
          ] })
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(Padding, { pt: "3xl", children: /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)(Stack, { spacing: "sm", children: [
        /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
          Text,
          {
            size: "sm",
            variant: "semibold",
            value: `Importing ${enabledColumnIndices.length} of ${data[0].length} columns`
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(Text, { size: "sm", variant: "muted", value: infoMessage })
      ] }) })
    ] }),
    /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
      BulkOptionsMenu,
      {
        id: menu.id,
        isOpen: menu.isOpen,
        position: menu.position,
        onAllColumnsEnabledToggle: handleAllColumnsEnabledToggle,
        onAllColumnsMatch: handleAllColumnsMatch
      }
    )
  ] });
}

// src/react/import-app/table-utils.ts
var import_markdown_it2 = __toESM(require_markdown_it());
var parseMarkdownTableIntoTokens = (markdown) => {
  const md = (0, import_markdown_it2.default)();
  const lines = markdown.split("\n");
  const trimmedLines = lines.map((line) => line.trim());
  const updatedMarkdown = trimmedLines.join("\n");
  return md.parse(updatedMarkdown, {});
};
var tableTokensToArr = (tokens) => {
  const tableData = [];
  for (const token of tokens) {
    if (token.type === "tr_open") {
      tableData.push([]);
    } else if (token.type === "inline") {
      const cellContent = token.content.trim();
      tableData[tableData.length - 1].push(cellContent);
    }
  }
  return tableData;
};
var validateMarkdownTable = (tokens) => {
  let numTables = 0;
  let hasHeaderRow = false;
  let hasDataRows = false;
  for (const token of tokens) {
    if (token.type === "table_open") {
      hasHeaderRow = false;
      hasDataRows = false;
    } else if (token.type === "table_close") {
      if (!hasHeaderRow) {
        throw new Error("Markdown table must have a header row.");
      } else if (!hasDataRows) {
        throw new Error(
          "Markdown table must have at least one data row."
        );
      }
      numTables++;
    } else if (token.type === "thead_open") {
      hasHeaderRow = true;
    } else if (token.type === "tbody_open") {
      hasDataRows = true;
    }
  }
  if (numTables === 0) {
    throw new Error("Markdown must have a table.");
  } else if (numTables > 1) {
    throw new Error("Markdown must have only one table.");
  }
};

// src/shared/loom-state/loom-state-factory.ts
var createFolderSource = (path, includeSubfolders) => {
  return {
    id: generateUuid(),
    type: "folder" /* FOLDER */,
    path,
    includeSubfolders
  };
};
var createFrontmatterSource = (propertyType, propertyKey, options) => {
  const { filterCondition: originalFilterCondition, filterText = "" } = options || {};
  let filterCondition = originalFilterCondition;
  if (!filterCondition) {
    filterCondition = getFilterConditionsForPropertyType(propertyType)[0];
  }
  return {
    id: generateUuid(),
    type: "frontmatter" /* FRONTMATTER */,
    propertyType,
    propertyKey,
    filterCondition,
    filterText
  };
};
var createColumn = (options) => {
  const {
    type = "text" /* TEXT */,
    content = "New Column",
    includeTime = false,
    frontmatterKey = null,
    tags = []
  } = options || {};
  return {
    id: generateUuid(),
    sortDir: "default" /* NONE */,
    isVisible: true,
    width: "140px",
    type,
    numberPrefix: "",
    numberSuffix: "",
    numberSeparator: "",
    content,
    numberFormat: "number" /* NUMBER */,
    currencyType: "USD" /* UNITED_STATES */,
    dateFormat: "mmddyyyy" /* MM_DD_YYYY */,
    dateFormatSeparator: "-" /* HYPHEN */,
    hour12: true,
    includeTime,
    shouldWrapOverflow: true,
    tags,
    calculationType: "none" /* NONE */,
    aspectRatio: "unset" /* UNSET */,
    horizontalPadding: "unset" /* UNSET */,
    verticalPadding: "unset" /* UNSET */,
    frontmatterKey,
    multiTagSortDir: "default" /* NONE */
  };
};
var createRow = (index, options) => {
  const currentDateTime = getCurrentDateTime();
  const {
    cells = [],
    sourceId = null,
    creationDateTime = currentDateTime,
    lastEditedDateTime = currentDateTime
  } = options || {};
  return {
    id: generateUuid(),
    index,
    sourceId,
    creationDateTime,
    lastEditedDateTime,
    cells
  };
};
var createTextCell = (columnId, options) => {
  const { content = "", hasValidFrontmatter = null } = options != null ? options : {};
  return {
    id: generateUuid(),
    columnId,
    content,
    hasValidFrontmatter
  };
};
var createNumberCell = (columnId, options) => {
  const { value = null, hasValidFrontmatter = null } = options != null ? options : {};
  return {
    id: generateUuid(),
    columnId,
    value,
    hasValidFrontmatter
  };
};
var createDateCell = (columnId, options) => {
  const { dateTime = null, hasValidFrontmatter = null } = options != null ? options : {};
  return {
    id: generateUuid(),
    columnId,
    dateTime,
    hasValidFrontmatter
  };
};
var createLastEditedTimeCell = (columnId) => {
  return {
    id: generateUuid(),
    columnId,
    hasValidFrontmatter: null
  };
};
var createCreationTimeCell = (columnId) => {
  return {
    id: generateUuid(),
    columnId,
    hasValidFrontmatter: null
  };
};
var createSourceCell = (columnId) => {
  return {
    id: generateUuid(),
    columnId,
    hasValidFrontmatter: null
  };
};
var createSourceFileCell = (columnId, options) => {
  const { path = "" } = options || {};
  return {
    id: generateUuid(),
    columnId,
    path,
    hasValidFrontmatter: null
  };
};
var createEmbedCell = (columnId, options) => {
  const {
    isExternal = false,
    pathOrUrl = "",
    alias = null,
    hasValidFrontmatter = null
  } = options || {};
  return {
    id: generateUuid(),
    columnId,
    isExternal,
    pathOrUrl,
    alias,
    hasValidFrontmatter
  };
};
var createFileCell = (columnId, options) => {
  const {
    path = "",
    alias = null,
    hasValidFrontmatter = null
  } = options || {};
  return {
    id: generateUuid(),
    columnId,
    path,
    alias,
    hasValidFrontmatter
  };
};
var createCheckboxCell = (columnId, options) => {
  const { value = false, hasValidFrontmatter = null } = options || {};
  return {
    id: generateUuid(),
    columnId,
    value,
    hasValidFrontmatter
  };
};
var createTagCell = (columnId, options) => {
  const { tagId = null, hasValidFrontmatter = null } = options || {};
  return {
    id: generateUuid(),
    columnId,
    tagId,
    hasValidFrontmatter
  };
};
var createMultiTagCell = (columnId, options) => {
  const { tagIds = [], hasValidFrontmatter = null, multiTagSortDir = "default" /* NONE */ } = options || {};
  return {
    id: generateUuid(),
    columnId,
    tagIds,
    hasValidFrontmatter,
    multiTagSortDir
  };
};
var createSourceFileFilter = (columnId, options) => {
  const {
    condition = "is" /* IS */,
    isEnabled = true,
    text = ""
  } = options || {};
  const baseFilter = createBaseFilter2(columnId, {
    isEnabled
  });
  return {
    ...baseFilter,
    type: "source-file" /* SOURCE_FILE */,
    condition,
    text
  };
};
var createTextFilter2 = (columnId, options) => {
  const {
    condition = "is" /* IS */,
    isEnabled = true,
    text = ""
  } = options || {};
  const baseFilter = createBaseFilter2(columnId, {
    isEnabled
  });
  return {
    ...baseFilter,
    type: "text" /* TEXT */,
    condition,
    text
  };
};
var createFileFilter2 = (columnId, options) => {
  const {
    condition = "is" /* IS */,
    isEnabled = true,
    text = ""
  } = options || {};
  const baseFilter = createBaseFilter2(columnId, {
    isEnabled
  });
  return {
    ...baseFilter,
    type: "file" /* FILE */,
    condition,
    text
  };
};
var createCheckboxFilter2 = (columnId, options) => {
  const {
    condition = "is" /* IS */,
    isEnabled = true,
    value = false
  } = options || {};
  const baseFilter = createBaseFilter2(columnId, {
    isEnabled
  });
  return {
    ...baseFilter,
    type: "checkbox" /* CHECKBOX */,
    condition,
    isEnabled,
    value
  };
};
var createTagFilter2 = (columnId, options) => {
  const {
    condition = "is" /* IS */,
    isEnabled = true,
    tagId = ""
  } = options || {};
  const baseFilter = createBaseFilter2(columnId, {
    isEnabled
  });
  return {
    ...baseFilter,
    type: "tag" /* TAG */,
    condition,
    tagId,
    isEnabled
  };
};
var createMultiTagFilter2 = (columnId, options) => {
  const {
    condition = "contains" /* CONTAINS */,
    isEnabled = true,
    tagIds = []
  } = options || {};
  const baseFilter = createBaseFilter2(columnId, {
    isEnabled
  });
  return {
    ...baseFilter,
    type: "multi-tag" /* MULTI_TAG */,
    condition,
    tagIds
  };
};
var createEmbedFilter = (columnId, options) => {
  const {
    condition = "is-empty" /* IS_EMPTY */,
    isEnabled = true,
    text = ""
  } = options || {};
  const baseFilter = createBaseFilter2(columnId, {
    isEnabled
  });
  return {
    ...baseFilter,
    type: "embed" /* EMBED */,
    condition,
    text
  };
};
var createNumberFilter = (columnId, options) => {
  const {
    condition = "is-equal" /* IS_EQUAL */,
    isEnabled = true,
    text = ""
  } = options || {};
  const baseFilter = createBaseFilter2(columnId, {
    isEnabled
  });
  return {
    ...baseFilter,
    type: "number" /* NUMBER */,
    condition,
    text
  };
};
var createDateFilter = (columnId, options) => {
  const {
    condition = "is" /* IS */,
    isEnabled = true,
    dateTime = null,
    option = "unselected" /* UNSELECTED */
  } = options || {};
  const baseFilter = createBaseFilter2(columnId, {
    isEnabled
  });
  return {
    ...baseFilter,
    type: "date" /* DATE */,
    condition,
    option,
    dateTime
  };
};
var createCreationTimeFilter = (columnId, options) => {
  const {
    condition = "is" /* IS */,
    isEnabled = true,
    option = "unselected" /* UNSELECTED */,
    dateTime = null
  } = options || {};
  const baseFilter = createBaseFilter2(columnId, {
    isEnabled
  });
  return {
    ...baseFilter,
    type: "creation-time" /* CREATION_TIME */,
    option,
    condition,
    dateTime
  };
};
var createLastEditedTimeFilter = (columnId, options) => {
  const {
    condition = "is" /* IS */,
    isEnabled = true,
    option = "unselected" /* UNSELECTED */,
    dateTime = null
  } = options || {};
  const baseFilter = createBaseFilter2(columnId, {
    isEnabled
  });
  return {
    ...baseFilter,
    type: "last-edited-time" /* LAST_EDITED_TIME */,
    option,
    condition,
    dateTime
  };
};
var createBaseFilter2 = (columnId, options) => {
  const { isEnabled = true } = options || {};
  return {
    id: generateUuid(),
    columnId,
    operator: "or",
    isEnabled
  };
};
var createTag = (content, options) => {
  const { color = randomColor() } = options || {};
  return {
    id: generateUuid(),
    content,
    color
  };
};
var createCellForType = (columnId, type) => {
  switch (type) {
    case "text" /* TEXT */:
      return createTextCell(columnId);
    case "number" /* NUMBER */:
      return createNumberCell(columnId);
    case "date" /* DATE */:
      return createDateCell(columnId);
    case "creation-time" /* CREATION_TIME */:
      return createCreationTimeCell(columnId);
    case "last-edited-time" /* LAST_EDITED_TIME */:
      return createLastEditedTimeCell(columnId);
    case "embed" /* EMBED */:
      return createEmbedCell(columnId);
    case "file" /* FILE */:
      return createFileCell(columnId);
    case "checkbox" /* CHECKBOX */:
      return createCheckboxCell(columnId);
    case "tag" /* TAG */:
      return createTagCell(columnId);
    case "multi-tag" /* MULTI_TAG */:
      return createMultiTagCell(columnId);
    case "source" /* SOURCE */:
      return createSourceCell(columnId);
    case "source-file" /* SOURCE_FILE */:
      return createSourceFileCell(columnId);
    default:
      throw new Error("Unhandled cell type");
  }
};
var createLoomState = (numColumns, numRows, options) => {
  const {
    type,
    pluginVersion = "1.0.0",
    frozenColumnCount = 1
  } = options || {};
  const columns = [];
  for (let i2 = 0; i2 < numColumns; i2++) {
    columns.push(createColumn({ type }));
  }
  const rows = [];
  for (let i2 = 0; i2 < numRows; i2++) {
    const cells = [];
    for (let j2 = 0; j2 < numColumns; j2++) {
      const newCell = createTextCell(columns[j2].id);
      cells.push(newCell);
    }
    const row = createRow(i2, {
      cells
    });
    rows.push(row);
  }
  return createGenericLoomState({
    columns,
    rows,
    pluginVersion,
    frozenColumnCount
  });
};
var createGenericLoomState = (options) => {
  const {
    pluginVersion = "1.0.0",
    frozenColumnCount = 1,
    filters = [],
    sources = [],
    columns = [],
    rows = []
  } = options || {};
  return {
    model: {
      columns,
      rows,
      filters,
      sources,
      settings: {
        numFrozenColumns: frozenColumnCount,
        showCalculationRow: true
      },
      externalRowOrder: []
    },
    pluginVersion
  };
};

// src/react/import-app/state-utils.ts
var addImportData = (prevState, data, columnMatches, dateFormat, dateFormatSeparator) => {
  const { rows, columns } = prevState.model;
  const importRows = data.slice(1);
  const newColumns = [];
  columnMatches.forEach((match) => {
    if (match.columnId === NEW_COLUMN_ID) {
      const column = createColumn();
      newColumns.push(column);
      match.columnId = column.id;
    }
  });
  const nextColumns = [...columns, ...newColumns];
  const updatedRows = rows.map((row) => {
    const { cells } = row;
    const newCells = [...cells];
    newColumns.forEach((column) => {
      const cell = createTextCell(column.id);
      newCells.push(cell);
    });
    return {
      ...row,
      cells: newCells
    };
  });
  const newRows = Array(importRows.length).fill(null).map((_val, i2) => {
    const newRow = createRow(rows.length + i2);
    const importRow = importRows[i2];
    const nextCells = [];
    nextColumns.forEach((column) => {
      const { id: columnId, type, tags: columnTags } = column;
      const match = columnMatches.find(
        (match2) => match2.columnId === columnId
      );
      let content = "";
      let newCell = null;
      if (match) {
        const { importColumnIndex } = match;
        content = importRow[importColumnIndex];
        if (content !== void 0 && content !== null) {
          content = content.trim();
        }
      }
      if (type === "tag" /* TAG */) {
        const { cell, newTags } = findTagCell(
          columnTags,
          columnId,
          content
        );
        newCell = cell;
        columnTags.push(...newTags);
      } else if (type === "multi-tag" /* MULTI_TAG */) {
        const { cell, newTags } = findMultiTagCell(
          columnTags,
          columnId,
          content
        );
        newCell = cell;
        columnTags.push(...newTags);
      } else if (type === "date" /* DATE */) {
        const cell = findDateCell(
          columnId,
          content,
          dateFormat,
          dateFormatSeparator
        );
        newCell = cell;
      } else if (type === "checkbox" /* CHECKBOX */) {
        newCell = createCheckboxCell(columnId, {
          value: content.toLowerCase() === "true" ? true : false
        });
      } else if (type === "number" /* NUMBER */) {
        newCell = createNumberCell(columnId, {
          value: parseFloat(content)
        });
      } else if (type === "embed" /* EMBED */) {
        newCell = createEmbedCell(columnId, {
          pathOrUrl: content
        });
      } else if (type === "file" /* FILE */) {
        newCell = createFileCell(columnId, {
          path: content
        });
      } else if (type === "creation-time" /* CREATION_TIME */) {
        newCell = createCreationTimeCell(columnId);
      } else if (type === "last-edited-time" /* LAST_EDITED_TIME */) {
        newCell = createLastEditedTimeCell(columnId);
      } else if (type === "source" /* SOURCE */) {
        newCell = createSourceCell(columnId);
      } else if (type === "source-file" /* SOURCE_FILE */) {
        newCell = createSourceFileCell(columnId);
      } else if (type === "text" /* TEXT */) {
        newCell = createTextCell(columnId, {
          content
        });
      } else {
        throw new Error("Unhandled cell type");
      }
      nextCells.push(newCell);
    });
    return {
      ...newRow,
      cells: nextCells
    };
  });
  const nextRows = [...updatedRows, ...newRows];
  return {
    ...prevState,
    model: {
      ...prevState.model,
      columns: nextColumns,
      rows: nextRows
    }
  };
};
var findMultiTagCell = (columnTags, columnId, content) => {
  const newTags = [];
  const tagIds = [];
  const parsedTags = content.split(",").map((tag) => tag.trim());
  if (parsedTags.length !== 0) {
    parsedTags.forEach((tag) => {
      const existingTag = columnTags.find((t2) => {
        return t2.content === tag;
      });
      if (existingTag) {
        tagIds.push(existingTag.id);
      } else {
        const newTag = createTag(tag);
        newTags.push(newTag);
        tagIds.push(newTag.id);
      }
    });
  }
  const cell = createMultiTagCell(columnId, {
    tagIds
  });
  return {
    cell,
    newTags
  };
};
var findTagCell = (columnTags, columnId, content) => {
  const newTags = [];
  let tagId = null;
  const parsedTags = content.split(",").map((tag) => tag.trim());
  if (parsedTags.length !== 0) {
    parsedTags.forEach((tag) => {
      const existingTag = columnTags.find((t2) => t2.content === tag);
      if (existingTag) {
        if (tagId === null) {
          tagId = existingTag.id;
        }
      } else {
        const newTag = createTag(tag);
        newTags.push(newTag);
        if (tagId === null) {
          tagId = newTag.id;
        }
      }
    });
  }
  const cell = createTagCell(columnId, {
    tagId
  });
  return {
    cell,
    newTags
  };
};
var findDateCell = (columnId, content, dateFormat, dateFormatSeparator) => {
  let dateTime = null;
  if (dateFormat && dateFormatSeparator) {
    if (isValidDateString(content, dateFormat, dateFormatSeparator)) {
      dateTime = dateStringToDateTime(
        content,
        dateFormat,
        dateFormatSeparator
      );
    }
  }
  const cell = createDateCell(columnId, {
    dateTime
  });
  return cell;
};

// src/react/import-app/finalize-import.tsx
var import_react45 = __toESM(require_react());

// src/react/shared/select/index.tsx
var import_jsx_runtime115 = __toESM(require_jsx_runtime());
function Select({
  id: id2,
  isDisabled,
  hasError,
  className: customClassName,
  value,
  onChange,
  onKeyDown,
  children
}) {
  let className = "dataloom-select dataloom-focusable";
  if (customClassName) {
    className += " " + customClassName;
  }
  if (hasError) {
    className += " dataloom-select--error";
  }
  return /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
    "select",
    {
      disabled: isDisabled,
      id: id2,
      tabIndex: 0,
      className,
      value,
      onChange: (e) => onChange(e.target.value),
      onKeyDown,
      children
    }
  );
}

// src/react/import-app/finalize-import.tsx
var import_jsx_runtime116 = __toESM(require_jsx_runtime());
function FinalizeImport({
  hasDateColumnMatch,
  dateFormat,
  dateFormatSeparator,
  includeTime,
  onDateFormatChange,
  onDateFormatSeparatorChange,
  onIncludeTimeToggle
}) {
  const dateFormatId = import_react45.default.useId();
  const dateFormatSeparatorId = import_react45.default.useId();
  const includeTimeId = import_react45.default.useId();
  if (!hasDateColumnMatch)
    return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(Text, { value: "Everything looks good!" });
  let expectedDateFormat = "Unknown";
  if (dateFormat && dateFormatSeparator) {
    const EXAMPLE_DATE_TIME = "2020-12-31T23:00:00";
    expectedDateFormat = dateTimeToDateString(
      EXAMPLE_DATE_TIME,
      dateFormat,
      dateFormatSeparator,
      {
        includeTime
      }
    );
  }
  return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("div", { children: hasDateColumnMatch && /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(import_jsx_runtime116.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)(Stack, { spacing: "xl", children: [
    /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)(Stack, { spacing: "sm", children: [
      /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
        Text,
        {
          size: "md",
          variant: "semibold",
          value: "Date format"
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(Padding, { pr: "md", children: /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
        Text,
        {
          shouldWrap: true,
          value: "You have matched one of your import columns to an existing date column. Please specify the date format of the import column."
        }
      ) })
    ] }),
    /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)(Stack, { spacing: "sm", children: [
      /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("label", { htmlFor: dateFormatId, children: "Date format" }),
      /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)(
        Select,
        {
          id: dateFormatId,
          value: dateFormat != null ? dateFormat : "",
          onChange: (value) => onDateFormatChange(
            value || null
          ),
          children: [
            /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("option", { value: "", children: "Select an option" }),
            Object.values(DateFormat2).map((format) => /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("option", { value: format, children: getDisplayNameForDateFormat(format) }, format))
          ]
        }
      )
    ] }),
    /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)(Stack, { spacing: "sm", children: [
      /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("label", { htmlFor: dateFormatSeparatorId, children: "Date format separator" }),
      /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)(
        Select,
        {
          id: dateFormatSeparatorId,
          value: dateFormatSeparator != null ? dateFormatSeparator : "",
          onChange: (value) => onDateFormatSeparatorChange(
            value || null
          ),
          children: [
            /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("option", { value: "", children: "Select an option" }),
            Object.values(DateFormatSeparator).map(
              (format) => /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("option", { value: format, children: format }, format)
            )
          ]
        }
      )
    ] }),
    /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)(Stack, { spacing: "sm", children: [
      /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("label", { htmlFor: includeTimeId, children: "Includes time" }),
      /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
        Switch,
        {
          id: includeTimeId,
          value: includeTime,
          onToggle: onIncludeTimeToggle
        }
      )
    ] }),
    /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)(Stack, { spacing: "sm", children: [
      /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("label", { children: "Expected date format" }),
      /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
        Text,
        {
          variant: "semibold",
          size: "sm",
          value: expectedDateFormat
        }
      )
    ] }),
    /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(Padding, { pr: "md", children: /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
      Text,
      {
        shouldWrap: true,
        value: "If a value in your column does not match this format, its table cell after import will be empty."
      }
    ) })
  ] }) }) });
}

// src/react/import-app/index.tsx
var import_jsx_runtime117 = __toESM(require_jsx_runtime());
function ImportApp({ state, onStateChange }) {
  const menuOperations = useMenuOperations();
  const [dataSource, setDataSource] = import_react46.default.useState("Select an option" /* UNSELECTED */);
  const [dataType, setDataType] = import_react46.default.useState("Select an option" /* UNSELECTED */);
  const [fileName, setFileName] = import_react46.default.useState(null);
  const [rawData, setRawData] = import_react46.default.useState("");
  const [data, setData] = import_react46.default.useState([]);
  const [errorText, setErrorText] = import_react46.default.useState(null);
  const [hasHeadersRow, setHeadersRow] = import_react46.default.useState(true);
  const [enabledColumnIndices, setEnabledColumnIndices] = import_react46.default.useState([]);
  const [dateFormat, setDateFormat] = import_react46.default.useState(null);
  const [dateFormatSeparator, setDateFormatSeparator] = import_react46.default.useState(null);
  const [includeTime, setIncludeTime] = import_react46.default.useState(false);
  const [columnMatches, setColumnMatches] = import_react46.default.useState([]);
  function handleDataTypeChange(value) {
    setDataType(value);
    resetSubsequentSteps(0 /* DATA_TYPE */);
  }
  function handleDataSourceChange(value) {
    setDataSource(value);
    resetSubsequentSteps(1 /* DATA_SOURCE */);
  }
  function handleRawDataChange(rawData2, fileName2) {
    setRawData(rawData2);
    if (fileName2 !== void 0)
      setFileName(fileName2);
  }
  function handleHeadersRowToggle() {
    setHeadersRow((prevState) => !prevState);
  }
  function handleAllColumnsEnabledToggle(value) {
    if (value) {
      setEnabledColumnIndices(data[0].map((_7, i2) => i2));
    } else {
      setEnabledColumnIndices([]);
    }
  }
  function handleColumnMatch(index, columnId) {
    setColumnMatches((prevState) => {
      const filtered = prevState.filter(
        (match2) => match2.importColumnIndex !== index
      );
      if (columnId === null)
        return filtered;
      const match = { importColumnIndex: index, columnId };
      return [...filtered, match];
    });
  }
  function handleAllColumnsMatch(columnId) {
    setColumnMatches(() => {
      if (columnId === null)
        return [];
      return data[0].map((_7, i2) => ({
        importColumnIndex: i2,
        columnId
      }));
    });
  }
  function handleColumnEnabledToggle(index) {
    setEnabledColumnIndices((prevState) => {
      if (prevState.includes(index)) {
        return prevState.filter((i2) => i2 !== index);
      }
      return [...prevState, index];
    });
  }
  function resetSubsequentSteps(currentType) {
    if (currentType !== 1 /* DATA_SOURCE */) {
      setDataSource("Select an option" /* UNSELECTED */);
    }
    if (currentType !== 2 /* UPLOAD_DATA */) {
      setRawData("");
      setErrorText(null);
      setFileName(null);
      setData([]);
    }
    if (currentType !== 3 /* MATCH_COLUMNS */) {
      setEnabledColumnIndices([]);
      setColumnMatches([]);
    }
  }
  const { columns } = state.model;
  const hasDateColumnMatch = columnMatches.some((match) => {
    const { columnId } = match;
    const column = columns.find((column2) => column2.id === columnId);
    if (!column)
      return false;
    return column.type === "date" /* DATE */;
  });
  const steps = [
    {
      title: "Select data type",
      content: /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
        DataTypeSelect,
        {
          value: dataType,
          onChange: handleDataTypeChange
        }
      ),
      canContinue: dataType !== "Select an option" /* UNSELECTED */
    },
    {
      title: "Select data source",
      content: /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
        DataSourceSelect,
        {
          value: dataSource,
          onChange: handleDataSourceChange
        }
      ),
      canContinue: dataSource !== "Select an option" /* UNSELECTED */
    },
    {
      title: "Upload data",
      content: /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
        UploadData,
        {
          hasHeadersRow,
          source: dataSource,
          fileName,
          dataType,
          errorText,
          rawData,
          onRawDataChange: handleRawDataChange,
          onHeadersRowToggle: handleHeadersRowToggle
        }
      ),
      canContinue: rawData !== "",
      onContinue: () => {
        let parsedArr = [];
        if (dataType === "CSV" /* CSV */) {
          const rawDataTrimmed = rawData.trim();
          const { data: data2, errors } = import_papaparse2.default.parse(rawDataTrimmed, {
            skipEmptyLines: true
          });
          parsedArr = data2;
          if (errors.length > 0) {
            setErrorText(errors[0].message);
            return false;
          }
        } else if (dataType === "Markdown" /* MARKDOWN */) {
          try {
            const tokens = parseMarkdownTableIntoTokens(rawData);
            validateMarkdownTable(tokens);
            parsedArr = tableTokensToArr(tokens);
          } catch (err) {
            setErrorText(err.message);
            return false;
          }
        }
        if (!hasHeadersRow) {
          parsedArr.unshift(
            parsedArr[0].map((_7, i2) => `Unnamed ${i2}`)
          );
        }
        setData(parsedArr);
        setEnabledColumnIndices(parsedArr[0].map((_7, i2) => i2));
        return true;
      }
    },
    {
      title: "Match columns",
      content: /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
        MatchColumns,
        {
          data,
          columnMatches,
          columns,
          enabledColumnIndices,
          onColumnEnabledToggle: handleColumnEnabledToggle,
          onAllColumnsEnabledToggle: handleAllColumnsEnabledToggle,
          onAllColumnsMatch: handleAllColumnsMatch,
          onColumnMatch: handleColumnMatch
        }
      ),
      canContinue: () => {
        if (enabledColumnIndices.length === 0)
          return false;
        const everyColumnMatched = enabledColumnIndices.every(
          (index) => {
            var _a2;
            return (_a2 = columnMatches.find(
              (match) => match.importColumnIndex === index
            )) != null ? _a2 : false;
          }
        );
        return everyColumnMatched;
      }
    },
    {
      title: "Finalize import",
      content: /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
        FinalizeImport,
        {
          hasDateColumnMatch,
          dateFormat,
          dateFormatSeparator,
          includeTime,
          onDateFormatSeparatorChange: setDateFormatSeparator,
          onDateFormatChange: setDateFormat,
          onIncludeTimeToggle: setIncludeTime
        }
      ),
      canContinue: () => {
        if (hasDateColumnMatch) {
          if (dateFormat === null || dateFormatSeparator === null) {
            return false;
          }
        }
        return true;
      }
    }
  ];
  function handleModalClick(e) {
    e.stopPropagation();
    menuOperations.onCloseAll();
  }
  function handleFinishClick() {
    const newState = addImportData(
      state,
      data,
      columnMatches,
      dateFormat,
      dateFormatSeparator
    );
    onStateChange(newState);
  }
  return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)("div", { className: "dataloom-import-app", onClick: handleModalClick, children: /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(Stepper, { steps, onFinishClick: handleFinishClick }) });
}

// src/obsidian/modal/import-modal.tsx
var import_jsx_runtime118 = __toESM(require_jsx_runtime());
var ImportModal = class extends import_obsidian15.Modal {
  constructor(app, loomFile, loomState) {
    super(app);
    this.handleStateChange = async (state) => {
      const serialized = serializeState(state);
      await this.app.vault.modify(this.loomFile, serialized);
      EventManager.getInstance().emit(
        "app-refresh-by-state",
        this.loomFile.path,
        "",
        //No app id. Target all views of this file
        state
      );
      new import_obsidian15.Notice("Success! DataLoom import completed.");
      this.close();
    };
    this.loomFile = loomFile;
    this.loomState = loomState;
  }
  onOpen() {
    const { containerEl } = this;
    setModalTitle(containerEl, "DataLoom Import");
    const { contentEl } = this;
    renderDivider(contentEl);
    const appContainerEl = contentEl.createDiv();
    this.renderApp(appContainerEl);
  }
  async renderApp(contentEl) {
    const modalEl = contentEl.closest(".modal");
    if (!modalEl)
      throw new Error("Modal element not found.");
    this.root = (0, import_client3.createRoot)(contentEl);
    this.root.render(
      /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(Provider_default, { store, children: /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(ModalMountProvider, { obsidianApp: this.app, modalEl, children: /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(MenuProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
        ImportApp,
        {
          state: this.loomState,
          onStateChange: this.handleStateChange
        }
      ) }) }) })
    );
  }
  onClose() {
    if (this.root)
      this.root.unmount();
  }
};

// src/react/loom-app/option-bar/more-menu/base-content.tsx
var import_jsx_runtime119 = __toESM(require_jsx_runtime());
function BaseContent({
  onToggleColumnClick,
  onFilterClick,
  onSettingsClick,
  onSourcesClick,
  onClose
}) {
  const { app, loomFile } = useAppMount();
  const { loomState } = useLoomState();
  const isSmallScreen = isSmallScreenSize();
  return /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(Padding, { p: "sm", children: [
    isSmallScreen && /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
      MenuItem,
      {
        lucideId: "filter",
        name: "Sources",
        onClick: onSourcesClick
      }
    ),
    isSmallScreen && /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
      MenuItem,
      {
        lucideId: "filter",
        name: "Filter",
        onClick: onFilterClick
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
      MenuItem,
      {
        lucideId: "eye-off",
        name: "Toggle",
        onClick: onToggleColumnClick
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
      MenuItem,
      {
        lucideId: "import",
        name: "Import",
        onClick: () => {
          onClose();
          new ImportModal(app, loomFile, loomState).open();
        }
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
      MenuItem,
      {
        lucideId: "download",
        name: "Export",
        onClick: () => {
          onClose();
          new ExportModal(app, loomFile, loomState).open();
        }
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
      MenuItem,
      {
        lucideId: "wrench",
        name: "Settings",
        onClick: onSettingsClick
      }
    )
  ] });
}

// src/react/loom-app/option-bar/more-menu/settings-submenu.tsx
var import_jsx_runtime120 = __toESM(require_jsx_runtime());
function SettingsSubmenu({
  showCalculationRow,
  onCalculationRowToggle,
  onBackClick
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(Submenu, { title: "Settings", onBackClick, children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(Padding, { px: "lg", py: "md", children: /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(Stack, { isHorizontal: true, spacing: "lg", children: [
    /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(Text, { value: "Calculation row" }),
    /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
      Switch,
      {
        value: showCalculationRow,
        onToggle: onCalculationRowToggle
      }
    )
  ] }) }) });
}

// src/react/loom-app/option-bar/more-menu/toggle-column-submenu.tsx
var import_jsx_runtime121 = __toESM(require_jsx_runtime());
function ToggleColumnSubmenu({
  columns,
  onColumnToggle,
  onBackClick
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Submenu, { title: "Toggle", onBackClick, children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Padding, { py: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Stack, { spacing: "md", children: columns.map((column) => {
    const { id: id2, content, isVisible } = column;
    return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(
      Wrap,
      {
        justify: "space-between",
        spacingX: "4xl",
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Text, { value: content, maxWidth: "250px" }),
          /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
            Switch,
            {
              value: isVisible,
              onToggle: () => onColumnToggle(id2, !isVisible)
            }
          )
        ]
      },
      id2
    );
  }) }) }) });
}

// src/react/loom-app/option-bar/more-menu/index.tsx
var import_jsx_runtime122 = __toESM(require_jsx_runtime());
function MoreMenu({
  id: id2,
  isOpen,
  position,
  showCalculationRow,
  columns,
  onFilterClick,
  onSourcesClick,
  onClose,
  onCalculationRowToggle,
  onColumnToggle
}) {
  const [submenu, setSubmenu] = import_react47.default.useState(null);
  import_react47.default.useEffect(() => {
    if (!isOpen)
      setSubmenu(null);
  }, [isOpen]);
  return /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(
    Menu,
    {
      id: id2,
      openDirection: "bottom-left",
      isOpen,
      position,
      children: [
        submenu === null && /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
          BaseContent,
          {
            onToggleColumnClick: () => setSubmenu(1 /* TOGGLE_COLUMNS */),
            onFilterClick,
            onSourcesClick,
            onClose,
            onSettingsClick: () => setSubmenu(0 /* SETTINGS */)
          }
        ),
        submenu === 0 /* SETTINGS */ && /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
          SettingsSubmenu,
          {
            showCalculationRow,
            onBackClick: () => setSubmenu(null),
            onCalculationRowToggle
          }
        ),
        submenu === 1 /* TOGGLE_COLUMNS */ && /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
          ToggleColumnSubmenu,
          {
            columns,
            onColumnToggle,
            onBackClick: () => setSubmenu(null)
          }
        )
      ]
    }
  );
}

// src/react/loom-app/option-bar/filter-menu/filter-column-select/index.tsx
var import_jsx_runtime123 = __toESM(require_jsx_runtime());
function FilterColumnSelect({
  id: id2,
  columns,
  value,
  onChange
}) {
  function handleKeyDown(e) {
    if (e.key === "ArrowDown" || e.key === "ArrowUp" || e.key === "Enter") {
      e.stopPropagation();
    }
  }
  return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
    Select,
    {
      className: "dataloom-filter-column-select",
      value,
      onKeyDown: handleKeyDown,
      onChange: (newValue) => onChange(id2, newValue),
      children: columns.filter((column) => column.type !== "source" /* SOURCE */).map((column) => {
        const { id: id3, content } = column;
        return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("option", { value: id3, children: content }, id3);
      })
    }
  );
}

// src/react/loom-app/option-bar/filter-menu/filter-condition-select.tsx
var import_jsx_runtime124 = __toESM(require_jsx_runtime());
function FilterConditionSelect({
  id: id2,
  value,
  options,
  onChange
}) {
  function handleKeyDown(e) {
    if (e.key === "Enter") {
      e.stopPropagation();
    }
  }
  return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
    Select,
    {
      value,
      onKeyDown: handleKeyDown,
      onChange: (newValue) => onChange(id2, newValue),
      children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("option", { value: option, children: getDisplayNameForFilterCondition(option) }, option))
    }
  );
}

// src/react/loom-app/option-bar/filter-menu/filter-operator/index.tsx
var import_jsx_runtime125 = __toESM(require_jsx_runtime());
function FilterOperator({ id: id2, value, onChange }) {
  return /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(
    Select,
    {
      className: "dataloom-filter-operator",
      value,
      onChange: (newValue) => onChange(id2, newValue),
      children: [
        /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("option", { value: "or", children: "Or" }),
        /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("option", { value: "and", children: "And" })
      ]
    }
  );
}

// src/react/loom-app/option-bar/filter-menu/filter-row/index.tsx
var import_jsx_runtime126 = __toESM(require_jsx_runtime());
function FilterRow({
  index,
  id: id2,
  columns,
  useSpacer,
  isEnabled,
  selectedColumnId,
  selectedOperator,
  selectedCondition,
  conditionOptions,
  inputNode,
  onToggle,
  onColumnChange,
  onOperatorChange,
  onConditionChange,
  onDeleteClick
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)("div", { className: "dataloom-filter-row", children: /* @__PURE__ */ (0, import_jsx_runtime126.jsxs)(Wrap, { children: [
    index !== 0 && /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
      FilterOperator,
      {
        id: id2,
        value: selectedOperator,
        onChange: onOperatorChange
      }
    ),
    useSpacer && /* @__PURE__ */ (0, import_jsx_runtime126.jsx)("div", { className: "dataloom-filter-row__spacer" }),
    /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
      FilterColumnSelect,
      {
        id: id2,
        columns,
        value: selectedColumnId,
        onChange: onColumnChange
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
      FilterConditionSelect,
      {
        id: id2,
        options: conditionOptions,
        value: selectedCondition,
        onChange: onConditionChange
      }
    ),
    selectedCondition !== "is-empty" /* IS_EMPTY */ && selectedCondition !== "is-not-empty" /* IS_NOT_EMPTY */ && /* @__PURE__ */ (0, import_jsx_runtime126.jsx)("div", { className: "dataloom-filter-row__input", children: inputNode }),
    /* @__PURE__ */ (0, import_jsx_runtime126.jsxs)(
      Stack,
      {
        grow: true,
        justify: "flex-end",
        align: "center",
        spacing: "lg",
        isHorizontal: true,
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
            Button,
            {
              icon: /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(Icon, { lucideId: "trash-2" }),
              ariaLabel: "Delete filter",
              onClick: () => onDeleteClick(id2)
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
            Switch,
            {
              value: isEnabled,
              ariaLabel: isEnabled ? "Disable filter" : "Enable filter",
              onToggle: () => onToggle(id2)
            }
          )
        ]
      }
    )
  ] }) });
}

// src/react/shared/multi-select/multi-select-option.tsx
var import_jsx_runtime127 = __toESM(require_jsx_runtime());
function MultiSelectOption({
  id: id2,
  isChecked,
  component,
  handleOptionClick
}) {
  function handleKeyDown(e) {
    if (e.key === "Enter") {
      e.stopPropagation();
      handleOptionClick(id2);
    }
  }
  return /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
    "div",
    {
      className: "dataloom-multi-select__option dataloom-focusable dataloom-selectable",
      tabIndex: 0,
      onKeyDown: handleKeyDown,
      onClick: () => handleOptionClick(id2),
      children: /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(Stack, { isHorizontal: true, width: "100%", children: [
        /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
          "input",
          {
            className: "task-list-item-checkbox",
            type: "checkbox",
            checked: isChecked,
            onChange: () => {
            }
          }
        ),
        component
      ] })
    }
  );
}

// src/react/shared/multi-select/multi-select-menu.tsx
var import_react48 = __toESM(require_react());
var import_jsx_runtime128 = __toESM(require_jsx_runtime());
function MultiSelectMenu({
  id: id2,
  isOpen,
  position,
  options,
  selectedOptionIds,
  onChange
}) {
  const [inputValue, setInputValue] = import_react48.default.useState("");
  import_react48.default.useEffect(() => {
    if (!isOpen) {
      setInputValue("");
    }
  }, [isOpen]);
  function handleOptionClick(id3) {
    const isSelected = selectedOptionIds.includes(id3);
    if (isSelected) {
      const filteredOptionIds = selectedOptionIds.filter(
        (selected) => selected !== id3
      );
      onChange(filteredOptionIds);
    } else {
      onChange([...selectedOptionIds, id3]);
    }
  }
  const filteredOptions = options.filter(
    (option) => option.name.toLowerCase().includes(inputValue.toLocaleLowerCase())
  );
  return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(Menu, { id: id2, isOpen, position, topOffset: 35, children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("div", { className: "dataloom-multi-select-menu", children: /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)(Stack, { spacing: "md", children: [
    /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(Padding, { px: "md", pt: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
      input_default,
      {
        value: inputValue,
        placeholder: "Type to filter...",
        onChange: setInputValue
      }
    ) }),
    /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("div", { className: "dataloom-multi-select__options", children: [
      filteredOptions.map((option) => {
        const { id: id3, component } = option;
        const isChecked = selectedOptionIds.includes(id3);
        return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
          MultiSelectOption,
          {
            id: id3,
            isChecked,
            component,
            handleOptionClick
          },
          id3
        );
      }),
      options.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(Padding, { px: "md", pb: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(Text, { value: "No options to select" }) })
    ] })
  ] }) }) });
}

// src/react/shared/multi-select/index.tsx
var import_jsx_runtime129 = __toESM(require_jsx_runtime());
function MultiSelect({
  id: id2,
  title,
  selectedOptionIds,
  options,
  onChange
}) {
  const COMPONENT_ID = `multi-select-${id2}`;
  const menu = useMenu(COMPONENT_ID);
  function openMenu() {
    menu.onOpen(2 /* TWO */);
  }
  return /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(import_jsx_runtime129.Fragment, { children: [
    /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
      menu_trigger_default,
      {
        ref: menu.triggerRef,
        variant: "cell",
        menuId: menu.id,
        level: 2 /* TWO */,
        isFocused: menu.isTriggerFocused,
        onOpen: () => openMenu(),
        children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("div", { className: "dataloom-multi-select", children: /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(
          Stack,
          {
            isHorizontal: true,
            justify: "space-between",
            align: "center",
            height: "100%",
            children: [
              /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(Text, { value: `${selectedOptionIds.length} ${title}` }),
              /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(Icon, { lucideId: "chevron-down" })
            ]
          }
        ) })
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
      MultiSelectMenu,
      {
        id: menu.id,
        isOpen: menu.isOpen,
        position: menu.position,
        options,
        selectedOptionIds,
        onChange
      }
    )
  ] });
}

// src/react/shared/date-filter-select/index.tsx
var import_jsx_runtime130 = __toESM(require_jsx_runtime());
function DateFilterSelect({ value, onChange }) {
  return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
    Select,
    {
      value,
      onChange: (value2) => onChange(value2),
      children: Object.values(DateFilterOption).map((option) => /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("option", { value: option, children: getDisplayNameForDateFilterOption(option) }, option))
    }
  );
}

// src/react/shared/checkbox-filter-select/index.tsx
var import_jsx_runtime131 = __toESM(require_jsx_runtime());
function CheckboxFilterSelect({ value, onChange }) {
  function handleChange(value2) {
    if (value2 === "true") {
      onChange(true);
      return;
    }
    onChange(false);
  }
  return /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(Select, { value: value ? "true" : "false", onChange: handleChange, children: [
    /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("option", { value: "false", children: "Unchecked" }),
    /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("option", { value: "true", children: "Checked" })
  ] });
}

// src/react/loom-app/option-bar/filter-menu/index.tsx
var import_jsx_runtime132 = __toESM(require_jsx_runtime());
function FilterMenu({
  id: id2,
  isOpen,
  position,
  columns,
  filters,
  onAddClick,
  onUpdate,
  onDeleteClick
}) {
  function onColumnChange(id3, columnId) {
    const filter3 = filters.find((filter4) => filter4.id === id3);
    if (!filter3)
      throw new Error("Filter not found");
    const { condition, isEnabled } = filter3;
    const column = columns.find((column2) => column2.id === columnId);
    if (!column)
      throw new ColumnNotFoundError({ id: columnId });
    const { type } = column;
    let newFilter = null;
    if (type === "text" /* TEXT */) {
      let newCondition;
      if (condition !== "is" /* IS */ && condition !== "is-not" /* IS_NOT */ && condition !== "contains" /* CONTAINS */ && condition !== "does-not-contain" /* DOES_NOT_CONTAIN */ && condition !== "starts-with" /* STARTS_WITH */ && condition !== "ends-with" /* ENDS_WITH */ && condition !== "is-empty" /* IS_EMPTY */ && condition !== "is-not-empty" /* IS_NOT_EMPTY */) {
        newCondition = "is" /* IS */;
      } else {
        newCondition = condition;
      }
      newFilter = createTextFilter2(columnId, {
        condition: newCondition,
        isEnabled
      });
    } else if (type === "file" /* FILE */) {
      let newCondition;
      if (condition !== "is" /* IS */ && condition !== "is-not" /* IS_NOT */ && condition !== "contains" /* CONTAINS */ && condition !== "does-not-contain" /* DOES_NOT_CONTAIN */ && condition !== "starts-with" /* STARTS_WITH */ && condition !== "ends-with" /* ENDS_WITH */ && condition !== "is-empty" /* IS_EMPTY */ && condition !== "is-not-empty" /* IS_NOT_EMPTY */) {
        newCondition = "is" /* IS */;
      } else {
        newCondition = condition;
      }
      newFilter = createFileFilter2(columnId, {
        condition: newCondition,
        isEnabled
      });
    } else if (type === "checkbox" /* CHECKBOX */) {
      let newCondition;
      if (condition !== "is" /* IS */ && condition !== "is-not" /* IS_NOT */) {
        newCondition = "is" /* IS */;
      } else {
        newCondition = condition;
      }
      newFilter = createCheckboxFilter2(columnId, {
        condition: newCondition,
        isEnabled
      });
    } else if (type === "tag" /* TAG */) {
      let newCondition;
      if (condition !== "is" /* IS */ && condition !== "is-not" /* IS_NOT */ && condition !== "is-empty" /* IS_EMPTY */ && condition !== "is-not-empty" /* IS_NOT_EMPTY */) {
        newCondition = "is" /* IS */;
      } else {
        newCondition = condition;
      }
      newFilter = createTagFilter2(columnId, {
        condition: newCondition,
        isEnabled
      });
    } else if (type === "multi-tag" /* MULTI_TAG */) {
      let newCondition;
      if (condition !== "contains" /* CONTAINS */ && condition !== "does-not-contain" /* DOES_NOT_CONTAIN */ && condition !== "is-empty" /* IS_EMPTY */ && condition !== "is-not-empty" /* IS_NOT_EMPTY */) {
        newCondition = "contains" /* CONTAINS */;
      } else {
        newCondition = condition;
      }
      newFilter = createMultiTagFilter2(columnId, {
        condition: newCondition,
        isEnabled
      });
    } else if (type === "embed" /* EMBED */) {
      let newCondition;
      if (condition !== "is-empty" /* IS_EMPTY */ && condition !== "is-not-empty" /* IS_NOT_EMPTY */) {
        newCondition = "is-empty" /* IS_EMPTY */;
      } else {
        newCondition = condition;
      }
      newFilter = createEmbedFilter(columnId, {
        condition: newCondition,
        isEnabled
      });
    } else if (type === "number" /* NUMBER */) {
      let newCondition;
      if (condition !== "is-empty" /* IS_EMPTY */ && condition !== "is-not-equal" /* IS_NOT_EQUAL */ && condition !== "is-less-or-equal" /* IS_LESS_OR_EQUAL */ && condition !== "is-less" /* IS_LESS */ && condition !== "is-greater-or-equal" /* IS_GREATER_OR_EQUAL */ && condition !== "is-greater" /* IS_GREATER */ && condition !== "is-equal" /* IS_EQUAL */ && condition !== "is-not-empty" /* IS_NOT_EMPTY */) {
        newCondition = "is-equal" /* IS_EQUAL */;
      } else {
        newCondition = condition;
      }
      newFilter = createNumberFilter(columnId, {
        condition: newCondition,
        isEnabled
      });
    } else if (type === "date" /* DATE */) {
      let newCondition;
      if (condition !== "is" /* IS */ && condition !== "is-before" /* IS_BEFORE */ && condition !== "is-after" /* IS_AFTER */ && condition !== "is-empty" /* IS_EMPTY */ && condition !== "is-not-empty" /* IS_NOT_EMPTY */) {
        newCondition = "is" /* IS */;
      } else {
        newCondition = condition;
      }
      newFilter = createDateFilter(columnId, {
        condition: newCondition,
        isEnabled
      });
    } else if (type === "last-edited-time" /* LAST_EDITED_TIME */) {
      let newCondition;
      if (condition !== "is" /* IS */ && condition !== "is-before" /* IS_BEFORE */ && condition !== "is-after" /* IS_AFTER */) {
        newCondition = "is" /* IS */;
      } else {
        newCondition = condition;
      }
      newFilter = createLastEditedTimeFilter(columnId, {
        condition: newCondition,
        isEnabled
      });
    } else if (type === "creation-time" /* CREATION_TIME */) {
      let newCondition;
      if (condition !== "is" /* IS */ && condition !== "is-before" /* IS_BEFORE */ && condition !== "is-after" /* IS_AFTER */) {
        newCondition = "is" /* IS */;
      } else {
        newCondition = condition;
      }
      newFilter = createCreationTimeFilter(columnId, {
        condition: newCondition,
        isEnabled
      });
    } else if (type === "source-file" /* SOURCE_FILE */) {
      let newCondition;
      if (condition !== "is" /* IS */ && condition !== "is-not" /* IS_NOT */ && condition !== "contains" /* CONTAINS */ && condition !== "does-not-contain" /* DOES_NOT_CONTAIN */ && condition !== "starts-with" /* STARTS_WITH */ && condition !== "ends-with" /* ENDS_WITH */ && condition !== "is-empty" /* IS_EMPTY */ && condition !== "is-not-empty" /* IS_NOT_EMPTY */) {
        newCondition = "is" /* IS */;
      } else {
        newCondition = condition;
      }
      newFilter = createSourceFileFilter(columnId, {
        condition: newCondition,
        isEnabled
      });
    } else {
      throw new Error("Column type not handled");
    }
    onUpdate(id3, newFilter, false);
  }
  function onOperatorChange(id3, operator) {
    onUpdate(id3, { operator });
  }
  function onConditionChange(id3, condition) {
    onUpdate(id3, { condition });
  }
  function onTextChange(id3, text) {
    onUpdate(id3, { text });
  }
  function onCheckboxChange(id3, value) {
    onUpdate(id3, { value });
  }
  function onDateFilterOptionChange(id3, option) {
    onUpdate(id3, { option });
  }
  function onTagChange(id3, tagId) {
    onUpdate(id3, { tagId });
  }
  function onTagsChange(id3, tagIds) {
    onUpdate(id3, { tagIds });
  }
  function onToggle(id3) {
    const filter3 = filters.find((filter4) => filter4.id === id3);
    if (!filter3)
      throw new Error("Filter not found");
    onUpdate(id3, { isEnabled: !filter3.isEnabled });
  }
  return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
    Menu,
    {
      id: id2,
      isOpen,
      position,
      openDirection: "bottom-left",
      maxHeight: 255,
      children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
        "div",
        {
          className: "dataloom-filter-menu",
          style: {
            width: isSmallScreenSize() ? "calc(100vw - 30px)" : void 0
          },
          children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Padding, { p: "md", children: /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(Stack, { spacing: "lg", children: [
            filters.map((filter3, i2) => {
              const {
                id: id3,
                type,
                isEnabled,
                condition,
                columnId,
                operator
              } = filter3;
              const column = columns.find(
                (column2) => column2.id === columnId
              );
              if (!column)
                throw new ColumnNotFoundError({ id: columnId });
              const { tags } = column;
              let inputNode;
              let conditionOptions = [];
              switch (type) {
                case "text" /* TEXT */: {
                  const { text } = filter3;
                  inputNode = /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
                    input_default,
                    {
                      value: text,
                      onChange: (newValue) => onTextChange(id3, newValue)
                    }
                  );
                  conditionOptions = [
                    "is" /* IS */,
                    "is-not" /* IS_NOT */,
                    "contains" /* CONTAINS */,
                    "does-not-contain" /* DOES_NOT_CONTAIN */,
                    "starts-with" /* STARTS_WITH */,
                    "ends-with" /* ENDS_WITH */,
                    "is-empty" /* IS_EMPTY */,
                    "is-not-empty" /* IS_NOT_EMPTY */
                  ];
                  break;
                }
                case "file" /* FILE */: {
                  const { text } = filter3;
                  inputNode = /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
                    input_default,
                    {
                      value: text,
                      onChange: (newValue) => onTextChange(id3, newValue)
                    }
                  );
                  conditionOptions = [
                    "is" /* IS */,
                    "is-not" /* IS_NOT */,
                    "contains" /* CONTAINS */,
                    "does-not-contain" /* DOES_NOT_CONTAIN */,
                    "starts-with" /* STARTS_WITH */,
                    "ends-with" /* ENDS_WITH */,
                    "is-empty" /* IS_EMPTY */,
                    "is-not-empty" /* IS_NOT_EMPTY */
                  ];
                  break;
                }
                case "source-file" /* SOURCE_FILE */: {
                  const { text } = filter3;
                  inputNode = /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
                    input_default,
                    {
                      value: text,
                      onChange: (newValue) => onTextChange(id3, newValue)
                    }
                  );
                  conditionOptions = [
                    "is" /* IS */,
                    "is-not" /* IS_NOT */,
                    "contains" /* CONTAINS */,
                    "does-not-contain" /* DOES_NOT_CONTAIN */,
                    "starts-with" /* STARTS_WITH */,
                    "ends-with" /* ENDS_WITH */,
                    "is-empty" /* IS_EMPTY */,
                    "is-not-empty" /* IS_NOT_EMPTY */
                  ];
                  break;
                }
                case "checkbox" /* CHECKBOX */: {
                  const { value } = filter3;
                  inputNode = /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
                    CheckboxFilterSelect,
                    {
                      value,
                      onChange: (newValue) => onCheckboxChange(id3, newValue)
                    }
                  );
                  conditionOptions = [
                    "is" /* IS */,
                    "is-not" /* IS_NOT */
                  ];
                  break;
                }
                case "tag" /* TAG */: {
                  const { tagId } = filter3;
                  inputNode = /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(
                    Select,
                    {
                      value: tagId,
                      onChange: (newValue) => onTagChange(id3, newValue),
                      children: [
                        /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("option", { value: "", children: "Select an option" }),
                        tags.map((tag) => /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
                          "option",
                          {
                            value: tag.id,
                            children: tag.content
                          },
                          tag.id
                        ))
                      ]
                    }
                  );
                  conditionOptions = [
                    "is" /* IS */,
                    "is-not" /* IS_NOT */,
                    "is-empty" /* IS_EMPTY */,
                    "is-not-empty" /* IS_NOT_EMPTY */
                  ];
                  break;
                }
                case "multi-tag" /* MULTI_TAG */: {
                  const { tagIds } = filter3;
                  inputNode = /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
                    MultiSelect,
                    {
                      id: id3,
                      title: "Tags",
                      options: tags.map((tag) => ({
                        id: tag.id,
                        name: tag.content,
                        component: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
                          Tag5,
                          {
                            content: tag.content,
                            color: tag.color
                          }
                        )
                      })),
                      selectedOptionIds: tagIds,
                      onChange: (value) => onTagsChange(id3, value)
                    }
                  );
                  conditionOptions = [
                    "contains" /* CONTAINS */,
                    "does-not-contain" /* DOES_NOT_CONTAIN */,
                    "is-empty" /* IS_EMPTY */,
                    "is-not-empty" /* IS_NOT_EMPTY */
                  ];
                  break;
                }
                case "embed" /* EMBED */: {
                  conditionOptions = [
                    "is-empty" /* IS_EMPTY */,
                    "is-not-empty" /* IS_NOT_EMPTY */
                  ];
                  break;
                }
                case "number" /* NUMBER */: {
                  const { text } = filter3;
                  inputNode = /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
                    input_default,
                    {
                      isNumeric: true,
                      value: text,
                      onChange: (newValue) => onTextChange(id3, newValue)
                    }
                  );
                  conditionOptions = [
                    "is-equal" /* IS_EQUAL */,
                    "is-not-equal" /* IS_NOT_EQUAL */,
                    "is-greater" /* IS_GREATER */,
                    "is-less" /* IS_LESS */,
                    "is-greater-or-equal" /* IS_GREATER_OR_EQUAL */,
                    "is-less-or-equal" /* IS_LESS_OR_EQUAL */,
                    "is-empty" /* IS_EMPTY */,
                    "is-not-empty" /* IS_NOT_EMPTY */
                  ];
                  break;
                }
                case "date" /* DATE */: {
                  const { option } = filter3;
                  inputNode = /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
                    DateFilterSelect,
                    {
                      value: option,
                      onChange: (newValue) => onDateFilterOptionChange(
                        id3,
                        newValue
                      )
                    }
                  );
                  conditionOptions = [
                    "is" /* IS */,
                    "is-after" /* IS_AFTER */,
                    "is-before" /* IS_BEFORE */,
                    "is-empty" /* IS_EMPTY */,
                    "is-not-empty" /* IS_NOT_EMPTY */
                  ];
                  break;
                }
                case "creation-time" /* CREATION_TIME */: {
                  const { option } = filter3;
                  inputNode = /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
                    DateFilterSelect,
                    {
                      value: option,
                      onChange: (newValue) => onDateFilterOptionChange(
                        id3,
                        newValue
                      )
                    }
                  );
                  conditionOptions = [
                    "is" /* IS */,
                    "is-after" /* IS_AFTER */,
                    "is-before" /* IS_BEFORE */
                  ];
                  break;
                }
                case "last-edited-time" /* LAST_EDITED_TIME */: {
                  const { option } = filter3;
                  inputNode = /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
                    DateFilterSelect,
                    {
                      value: option,
                      onChange: (newValue) => onDateFilterOptionChange(
                        id3,
                        newValue
                      )
                    }
                  );
                  conditionOptions = [
                    "is" /* IS */,
                    "is-after" /* IS_AFTER */,
                    "is-before" /* IS_BEFORE */
                  ];
                  break;
                }
                default:
                  throw new Error("Column type not handled");
              }
              return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
                FilterRow,
                {
                  index: i2,
                  id: id3,
                  useSpacer: filters.length > 1 && i2 === 0,
                  columns,
                  selectedColumnId: columnId,
                  selectedCondition: condition,
                  selectedOperator: operator,
                  conditionOptions,
                  inputNode,
                  isEnabled,
                  onColumnChange,
                  onOperatorChange,
                  onToggle,
                  onDeleteClick,
                  onConditionChange
                },
                id3
              );
            }),
            /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
              Button,
              {
                icon: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Icon, { lucideId: "plus" }),
                ariaLabel: "Add filter",
                onClick: () => onAddClick()
              }
            )
          ] }) })
        }
      )
    }
  );
}

// src/react/loom-app/option-bar/sort-bubble/index.tsx
var import_jsx_runtime133 = __toESM(require_jsx_runtime());
function SortBubble({
  sortDir,
  content,
  onRemoveClick
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("div", { className: "dataloom-sort-bubble", children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
    Bubble,
    {
      canRemove: true,
      value: content,
      icon: sortDir === "asc" /* ASC */ ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Icon, { lucideId: "arrow-up" }) : /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Icon, { lucideId: "arrow-down" }),
      onRemoveClick
    }
  ) });
}

// src/react/loom-app/option-bar/sort-bubble-list.tsx
var import_jsx_runtime134 = __toESM(require_jsx_runtime());
function SortBubbleList({
  sortedColumns,
  onRemoveClick
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(Stack, { spacing: "sm", isHorizontal: true, children: sortedColumns.map((column, i2) => {
    const { id: id2, sortDir, content } = column;
    return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
      SortBubble,
      {
        sortDir,
        content,
        onRemoveClick: () => onRemoveClick(id2)
      },
      i2
    );
  }) });
}

// src/react/loom-app/option-bar/sources-menu/index.tsx
var import_react50 = __toESM(require_react());

// src/react/loom-app/option-bar/sources-menu/add-source-submenu/index.tsx
var import_react49 = __toESM(require_react());

// src/react/loom-app/option-bar/sources-menu/add-source-submenu/folder-source-options.tsx
var import_jsx_runtime135 = __toESM(require_jsx_runtime());
function FolderSourceOptions({
  pathInputId,
  includeSubfoldersInputId,
  error,
  includeSubfolders,
  path,
  onIncludeSubfoldersToggle,
  onPathChange
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(import_jsx_runtime135.Fragment, { children: [
    /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(Stack, { spacing: "sm", children: [
      /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("label", { htmlFor: pathInputId, children: "Path" }),
      /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
        input_default,
        {
          id: pathInputId,
          autoFocus: false,
          hasError: (error == null ? void 0 : error.inputId) === pathInputId,
          value: path,
          onChange: (value) => onPathChange(value)
        }
      )
    ] }),
    /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(Stack, { spacing: "sm", children: [
      /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("label", { htmlFor: includeSubfoldersInputId, children: "Include subfolders" }),
      /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
        Switch,
        {
          value: includeSubfolders,
          onToggle: onIncludeSubfoldersToggle
        }
      )
    ] })
  ] });
}

// src/react/loom-app/option-bar/sources-menu/add-source-submenu/index.tsx
var import_obsidian16 = require("obsidian");

// src/react/loom-app/option-bar/sources-menu/add-source-submenu/frontmatter-source-options.tsx
var import_jsx_runtime136 = __toESM(require_jsx_runtime());
function FrontmatterSourceOptions({
  propertyTypeSelectId,
  propertyKeySelectId,
  selectedPropertyType,
  selectedPropertyKey,
  onPropertyKeyChange,
  onPropertyTypeChange
}) {
  let propertyTypes = [];
  if (selectedPropertyType !== null) {
    propertyTypes = FrontmatterCache.getInstance().getPropertyNames(
      selectedPropertyType
    );
  }
  return /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_jsx_runtime136.Fragment, { children: [
    /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(Stack, { spacing: "sm", children: [
      /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("label", { htmlFor: propertyTypeSelectId, children: "Property Type" }),
      /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(
        Select,
        {
          value: selectedPropertyType != null ? selectedPropertyType : "",
          onChange: (value) => onPropertyTypeChange(
            value || null
          ),
          children: [
            /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("option", { value: "", children: "Select an option" }),
            Object.values(ObsidianPropertyType).map((type) => {
              return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("option", { value: type, children: type }, type);
            })
          ]
        }
      )
    ] }),
    /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(Stack, { spacing: "sm", children: [
      /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("label", { htmlFor: propertyKeySelectId, children: "Property Key" }),
      /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(
        Select,
        {
          isDisabled: selectedPropertyType === null,
          value: selectedPropertyKey != null ? selectedPropertyKey : "",
          onChange: (value) => onPropertyKeyChange(value || null),
          children: [
            /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("option", { value: "", children: "Select an option" }),
            Object.values(propertyTypes).map((type) => {
              return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("option", { value: type, children: type }, type);
            })
          ]
        }
      )
    ] })
  ] });
}

// src/react/loom-app/option-bar/sources-menu/add-source-submenu/index.tsx
var import_jsx_runtime137 = __toESM(require_jsx_runtime());
function AddSourceSubmenu({
  sources,
  onAddSourceClick,
  onBackClick
}) {
  const [type, setType] = import_react49.default.useState(null);
  const [path, setPath] = import_react49.default.useState("");
  const [includeSubfolders, setIncludeSubfolders] = import_react49.default.useState(true);
  const [error, setError] = import_react49.default.useState(null);
  const [propertyType, setPropertyType] = import_react49.default.useState(null);
  const [propertyKey, setPropertyKey] = import_react49.default.useState(null);
  const typeSelectId = import_react49.default.useId();
  const pathInputId = import_react49.default.useId();
  const includeSubfoldersInputId = import_react49.default.useId();
  const propertyKeySelectId = import_react49.default.useId();
  const propertyTypeSelectId = import_react49.default.useId();
  function handleAddClick() {
    const formattedPath = (0, import_obsidian16.normalizePath)(path);
    if (type === null) {
      setError({
        message: "Please select a type",
        inputId: typeSelectId
      });
      return;
    } else if (type === "folder" /* FOLDER */) {
      if (path === "") {
        setError({
          message: "Please enter a path",
          inputId: pathInputId
        });
        return;
      } else if (alreadyHasSource(sources, type, { path: formattedPath })) {
        setError({
          message: "A source with this path already exists",
          inputId: pathInputId
        });
        return;
      }
    } else if (type === "frontmatter" /* FRONTMATTER */) {
      if (propertyType === null) {
        setError({
          message: "Please select a property type",
          inputId: propertyTypeSelectId
        });
        return;
      } else if (propertyKey === null) {
        setError({
          message: "Please select a property key",
          inputId: propertyKeySelectId
        });
        return;
      } else if (alreadyHasSource(sources, type, { key: propertyKey })) {
        setError({
          message: "A source with this key already exists",
          inputId: propertyKeySelectId
        });
        return;
      }
    }
    let source = null;
    if (type === "folder" /* FOLDER */) {
      source = createFolderSource(formattedPath, includeSubfolders);
    } else if (type === "frontmatter" /* FRONTMATTER */) {
      if (propertyType === null || propertyKey === null) {
        throw new Error("Property type or key is null");
      }
      source = createFrontmatterSource(propertyType, propertyKey);
    } else {
      throw new Error("Source type not handled");
    }
    onAddSourceClick(source);
  }
  function alreadyHasSource(sources2, type2, options) {
    const { path: path2, key } = options != null ? options : {};
    if (type2 === "folder" /* FOLDER */) {
      return sources2.find(
        (source) => source.type === type2 && source.path === path2
      );
    } else if (type2 === "frontmatter" /* FRONTMATTER */) {
      return sources2.find(
        (source) => source.type === type2 && source.propertyKey === key
      );
    }
    throw new Error("Source type not handled");
  }
  return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
    Submenu,
    {
      title: "Add source",
      showBackButton: sources.length > 0,
      onBackClick,
      children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(Padding, { py: "md", children: /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)(Stack, { spacing: "lg", children: [
        /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)(Stack, { spacing: "sm", children: [
          /* @__PURE__ */ (0, import_jsx_runtime137.jsx)("label", { htmlFor: "type", children: "Type" }),
          /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)(
            Select,
            {
              id: "type",
              value: type != null ? type : "",
              hasError: (error == null ? void 0 : error.inputId) === typeSelectId,
              onChange: (value) => setType(value || null),
              children: [
                /* @__PURE__ */ (0, import_jsx_runtime137.jsx)("option", { value: "", children: "Select an option" }),
                Object.values(SourceType).map((type2) => {
                  return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)("option", { value: type2, children: getDisplayNameForSource(type2) }, type2);
                })
              ]
            }
          )
        ] }),
        type === "folder" /* FOLDER */ && /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
          FolderSourceOptions,
          {
            pathInputId,
            includeSubfoldersInputId,
            error,
            includeSubfolders,
            path,
            onIncludeSubfoldersToggle: setIncludeSubfolders,
            onPathChange: (value) => setPath(value)
          }
        ),
        type === "frontmatter" /* FRONTMATTER */ && /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
          FrontmatterSourceOptions,
          {
            propertyKeySelectId,
            propertyTypeSelectId,
            error,
            selectedPropertyType: propertyType,
            selectedPropertyKey: propertyKey,
            onPropertyKeyChange: setPropertyKey,
            onPropertyTypeChange: setPropertyType
          }
        ),
        (error == null ? void 0 : error.message) && /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(Text, { value: error.message, variant: "error" }),
        /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(Button, { variant: "default", onClick: () => handleAddClick(), children: "Add" })
      ] }) })
    }
  );
}

// src/react/loom-app/option-bar/sources-menu/source-item/index.tsx
var import_jsx_runtime138 = __toESM(require_jsx_runtime());
function SourceItem({ children }) {
  return /* @__PURE__ */ (0, import_jsx_runtime138.jsx)("div", { className: "dataloom-source-item", children });
}

// src/react/loom-app/option-bar/sources-menu/folder-source-item/index.tsx
var import_jsx_runtime139 = __toESM(require_jsx_runtime());
function FolderSourceItem({
  id: id2,
  content,
  type,
  onDelete
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(SourceItem, { children: /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(Flex, { justify: "space-between", align: "center", height: "100%", children: [
    /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(Stack, { isHorizontal: true, spacing: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
      Bubble,
      {
        icon: /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(Icon, { lucideId: getIconIdForSourceType(type) }),
        variant: "no-fill",
        value: content
      }
    ) }),
    /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
      Button,
      {
        icon: /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(Icon, { lucideId: "trash" }),
        ariaLabel: "Delete source",
        onClick: () => onDelete(id2)
      }
    )
  ] }) });
}

// src/react/loom-app/option-bar/sources-menu/add-source-submenu/filter-input.tsx
var import_jsx_runtime140 = __toESM(require_jsx_runtime());
function FilterInput({
  filterTextId,
  selectedPropertyType,
  filterText,
  onFilterTextChange
}) {
  const showListInput = selectedPropertyType === "aliases" /* ALIASES */ || selectedPropertyType === "tags" /* TAGS */ || selectedPropertyType === "multitext" /* MULTITEXT */;
  const showDateInput = selectedPropertyType === "date" /* DATE */ || selectedPropertyType === "datetime" /* DATETIME */;
  return /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(import_jsx_runtime140.Fragment, { children: [
    selectedPropertyType === "text" /* TEXT */ && /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
      input_default,
      {
        id: filterTextId,
        autoFocus: false,
        value: filterText,
        onChange: (value) => onFilterTextChange(value)
      }
    ),
    selectedPropertyType === "number" /* NUMBER */ && /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
      input_default,
      {
        id: filterTextId,
        isNumeric: true,
        autoFocus: false,
        value: filterText,
        onChange: (value) => onFilterTextChange(value)
      }
    ),
    showDateInput && /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
      DateFilterSelect,
      {
        value: filterText,
        onChange: (value) => onFilterTextChange(value)
      }
    ),
    selectedPropertyType === "checkbox" /* CHECKBOX */ && /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
      CheckboxFilterSelect,
      {
        value: filterText === "true",
        onChange: (value) => onFilterTextChange(value.toString())
      }
    ),
    showListInput && /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
      input_default,
      {
        id: filterTextId,
        autoFocus: false,
        value: filterText,
        onChange: (value) => onFilterTextChange(value)
      }
    )
  ] });
}

// src/react/loom-app/option-bar/sources-menu/frontmatter-source-item/index.tsx
var import_jsx_runtime141 = __toESM(require_jsx_runtime());
function FrontmatterSourceItem({
  filterConditions,
  filterText,
  id: id2,
  title,
  selectedPropertyType,
  selectedFilterCondition,
  type,
  onDelete,
  onFilterConditionChange,
  onFilterTextChange
}) {
  const showFilterInput = selectedFilterCondition !== "is-empty" /* IS_EMPTY */ && selectedFilterCondition !== "is-not-empty" /* IS_NOT_EMPTY */ && selectedFilterCondition !== "is-empty" /* IS_EMPTY */ && selectedFilterCondition !== "is-not-empty" /* IS_NOT_EMPTY */ && selectedFilterCondition !== "is-not-empty" /* IS_NOT_EMPTY */ && selectedFilterCondition !== "is-empty" /* IS_EMPTY */;
  return /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(SourceItem, { children: /* @__PURE__ */ (0, import_jsx_runtime141.jsx)("div", { className: "dataloom-frontmatter-source-item", children: /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)(Wrap, { children: [
    /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
      Bubble,
      {
        icon: /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
          Icon,
          {
            lucideId: getIconIdForSourceType(type, {
              propertyType: selectedPropertyType
            })
          }
        ),
        variant: "no-fill",
        value: title
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
      Select,
      {
        value: selectedFilterCondition != null ? selectedFilterCondition : "",
        onChange: (value) => onFilterConditionChange(
          id2,
          value || null
        ),
        children: Object.values(filterConditions).map((type2) => {
          return /* @__PURE__ */ (0, import_jsx_runtime141.jsx)("option", { value: type2, children: getDisplayNameForFilterCondition(type2) }, type2);
        })
      }
    ),
    showFilterInput && /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
      FilterInput,
      {
        selectedPropertyType,
        filterText,
        onFilterTextChange: (value) => onFilterTextChange(id2, value)
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(Flex, { width: "fit-content", grow: true, justify: "flex-end", children: /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
      Button,
      {
        icon: /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(Icon, { lucideId: "trash" }),
        ariaLabel: "Delete source",
        onClick: () => onDelete(id2)
      }
    ) })
  ] }) }) });
}

// src/react/loom-app/option-bar/sources-menu/base-content/index.tsx
var import_jsx_runtime142 = __toESM(require_jsx_runtime());
function BaseContent2({
  sources,
  onSourceAdd,
  onSourceDelete,
  onSourceFilterConditionChange,
  onSourceFilterTextChange
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)(Stack, { spacing: "md", children: [
    /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(Stack, { spacing: "md", children: sources.map((source) => {
      const { id: id2, type } = source;
      if (type === "folder" /* FOLDER */) {
        const { path } = source;
        return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
          FolderSourceItem,
          {
            id: id2,
            content: path,
            type,
            onDelete: onSourceDelete
          },
          id2
        );
      } else if (type === "frontmatter" /* FRONTMATTER */) {
        const {
          filterCondition,
          filterText,
          propertyType,
          propertyKey
        } = source;
        const filterConditions = getFilterConditionsForPropertyType(propertyType);
        return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
          FrontmatterSourceItem,
          {
            id: id2,
            title: propertyKey,
            type,
            onDelete: onSourceDelete,
            selectedFilterCondition: filterCondition,
            filterConditions,
            filterText,
            selectedPropertyType: propertyType,
            onFilterConditionChange: onSourceFilterConditionChange,
            onFilterTextChange: onSourceFilterTextChange
          },
          id2
        );
      } else {
        throw new Error("Unhandled source type");
      }
    }) }),
    /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
      Button,
      {
        icon: /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(Icon, { lucideId: "plus" }),
        onClick: () => onSourceAdd(),
        ariaLabel: "Add source"
      }
    )
  ] });
}

// src/react/loom-app/option-bar/sources-menu/index.tsx
var import_jsx_runtime143 = __toESM(require_jsx_runtime());
function SourcesMenu({
  id: id2,
  isOpen,
  position,
  sources,
  onSourceAdd,
  onSourceDelete,
  onSourceFilterConditionChange,
  onSourceFilterTextChange
}) {
  const [submenu, setSubmenu] = import_react50.default.useState(
    sources.length === 0 ? 0 /* ADD */ : null
  );
  import_react50.default.useLayoutEffect(() => {
    if (sources.length === 0) {
      setSubmenu(0 /* ADD */);
    }
  }, [sources.length]);
  function handleAddSourceClick(source) {
    onSourceAdd(source);
    setSubmenu(null);
  }
  return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(
    Menu,
    {
      id: id2,
      openDirection: "bottom-left",
      isOpen,
      position,
      children: /* @__PURE__ */ (0, import_jsx_runtime143.jsxs)(Padding, { px: "lg", py: "md", children: [
        submenu === null && /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(
          BaseContent2,
          {
            sources,
            onSourceAdd: () => setSubmenu(0 /* ADD */),
            onSourceDelete,
            onSourceFilterConditionChange,
            onSourceFilterTextChange
          }
        ),
        submenu === 0 /* ADD */ && /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(
          AddSourceSubmenu,
          {
            sources,
            onAddSourceClick: handleAddSourceClick,
            onBackClick: () => setSubmenu(null)
          }
        )
      ] })
    }
  );
}

// src/react/loom-app/option-bar/index.tsx
var import_jsx_runtime144 = __toESM(require_jsx_runtime());
function OptionBar({
  columns,
  filters,
  sources,
  showCalculationRow,
  onFilterUpdate,
  onFilterDeleteClick,
  onFilterAddClick,
  onCalculationRowToggle,
  onSourceAdd,
  onSourceDelete,
  onColumnChange,
  onSourceUpdate
}) {
  const COMPONENT_ID = "option-bar";
  const SOURCE_MENU_ID = "sources-menu";
  const MORE_MENU_ID = "more-menu";
  const FILTER_MENU_ID = "filter-menu";
  const sourcesMenu = useMenu(COMPONENT_ID, { name: SOURCE_MENU_ID });
  const moreMenu = useMenu(COMPONENT_ID, { name: MORE_MENU_ID });
  const filterMenu = useMenu(COMPONENT_ID, { name: FILTER_MENU_ID });
  function handleRemoveClick(columnId) {
    onColumnChange(
      columnId,
      { sortDir: "default" /* NONE */ },
      {
        shouldSortRows: true
      }
    );
  }
  function handleColumnToggle(columnId, isVisible) {
    onColumnChange(columnId, { isVisible });
  }
  function handleSourceFilterConditionChange(sourceId, value) {
    onSourceUpdate(sourceId, { filterCondition: value });
  }
  function handleSourceFilterTextChange(sourceId, value) {
    onSourceUpdate(sourceId, { filterText: value });
  }
  function handleSourceMenuOpen() {
    sourcesMenu.onOpen(1 /* ONE */);
  }
  function handleFilterMenuOpen() {
    filterMenu.onOpen(1 /* ONE */);
    if (filters.length === 0) {
      onFilterAddClick();
    }
  }
  function handleMoreMenuOpen() {
    moreMenu.onOpen(1 /* ONE */);
  }
  function handleFilterDelete(id2) {
    onFilterDeleteClick(id2);
    if (filters.length === 1) {
      filterMenu.onClose();
    }
  }
  const activeFilters = filters.filter((filter3) => filter3.isEnabled);
  const sortedColumns = columns.filter(
    (column) => column.sortDir !== "default" /* NONE */
  );
  const isSmallScreen = isSmallScreenSize();
  return /* @__PURE__ */ (0, import_jsx_runtime144.jsxs)(import_jsx_runtime144.Fragment, { children: [
    /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("div", { className: "dataloom-option-bar", children: /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(Padding, { py: "lg", children: /* @__PURE__ */ (0, import_jsx_runtime144.jsxs)(
      Stack,
      {
        isHorizontal: !isSmallScreen,
        spacing: "sm",
        ...!isSmallScreen && { justify: "space-between" },
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime144.jsxs)(
            Stack,
            {
              isHorizontal: true,
              spacing: "md",
              overflow: "auto",
              ...isSmallScreen && {
                width: "100%",
                justify: "flex-end"
              },
              children: [
                /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
                  SortBubbleList,
                  {
                    sortedColumns,
                    onRemoveClick: handleRemoveClick
                  }
                ),
                /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
                  ActiveFilterBubble,
                  {
                    numActive: activeFilters.length
                  }
                )
              ]
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime144.jsxs)(
            Stack,
            {
              isHorizontal: true,
              spacing: "sm",
              justify: "flex-end",
              ...isSmallScreen && {
                height: "40px",
                width: "100%"
              },
              children: [
                isSmallScreen === false && /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
                  menu_button_default,
                  {
                    isFocused: sourcesMenu.isTriggerFocused,
                    menuId: sourcesMenu.id,
                    ref: sourcesMenu.triggerRef,
                    level: 1 /* ONE */,
                    onOpen: handleSourceMenuOpen,
                    children: "Sources"
                  }
                ),
                isSmallScreen === false && /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
                  menu_button_default,
                  {
                    isFocused: filterMenu.isTriggerFocused,
                    menuId: filterMenu.id,
                    ref: filterMenu.triggerRef,
                    level: 1 /* ONE */,
                    onOpen: handleFilterMenuOpen,
                    children: "Filter"
                  }
                ),
                /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(SearchBar, {}),
                /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
                  menu_button_default,
                  {
                    isFocused: moreMenu.isTriggerFocused,
                    menuId: moreMenu.id,
                    ref: moreMenu.triggerRef,
                    level: 1 /* ONE */,
                    icon: /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(Icon, { lucideId: "more-vertical" }),
                    onOpen: handleMoreMenuOpen
                  }
                )
              ]
            }
          )
        ]
      }
    ) }) }),
    /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
      SourcesMenu,
      {
        id: sourcesMenu.id,
        isOpen: sourcesMenu.isOpen,
        position: sourcesMenu.position,
        sources,
        columns,
        onSourceAdd,
        onSourceDelete,
        onSourceFilterConditionChange: handleSourceFilterConditionChange,
        onSourceFilterTextChange: handleSourceFilterTextChange,
        onClose: sourcesMenu.onClose
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
      MoreMenu,
      {
        id: moreMenu.id,
        isOpen: moreMenu.isOpen,
        showCalculationRow,
        position: moreMenu.position,
        columns,
        onFilterClick: handleFilterMenuOpen,
        onColumnToggle: handleColumnToggle,
        onCalculationRowToggle,
        onClose: moreMenu.onClose,
        onSourcesClick: handleSourceMenuOpen
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
      FilterMenu,
      {
        id: filterMenu.id,
        isOpen: filterMenu.isOpen,
        position: isSmallScreen ? moreMenu.position : filterMenu.position,
        columns,
        filters,
        onUpdate: onFilterUpdate,
        onDeleteClick: handleFilterDelete,
        onAddClick: onFilterAddClick
      }
    )
  ] });
}

// src/react/loom-app/bottom-bar/index.tsx
var import_react51 = __toESM(require_react());
var import_lodash9 = __toESM(require_lodash());

// src/react/loom-app/new-row-button/index.tsx
var import_jsx_runtime145 = __toESM(require_jsx_runtime());
function NewRowButton({ onClick }) {
  return /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
    Button,
    {
      icon: /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(Icon, { lucideId: "plus" }),
      ariaLabel: "New row",
      onClick: () => onClick(),
      children: "New"
    }
  );
}

// src/react/loom-app/bottom-bar/index.tsx
var import_jsx_runtime146 = __toESM(require_jsx_runtime());
function BottomBar({
  onRowAddClick,
  onScrollToTopClick,
  onScrollToBottomClick,
  onUndoClick,
  onRedoClick
}) {
  const ref = import_react51.default.useRef(null);
  const [bottomBarOffset, setBottomBarOffset] = import_react51.default.useState(0);
  const isMobile = isOnMobile();
  import_react51.default.useEffect(() => {
    const el = ref.current;
    if (!el)
      return;
    const appEl = el.closest(".dataloom-app");
    if (!appEl)
      return;
    const tableEl = appEl.querySelector(
      ".dataloom-table"
    );
    if (!tableEl)
      return;
    const tableContainerEl = tableEl.parentElement;
    if (!tableContainerEl)
      return;
    function updateBottomBar(tableEl2, tableContainerEl2) {
      const tableRect = tableEl2.getBoundingClientRect();
      const tableContainerRect = tableContainerEl2.getBoundingClientRect();
      let diff = tableContainerRect.height - tableRect.height;
      if (diff < 0)
        diff = 0;
      setBottomBarOffset(diff);
    }
    const THROTTLE_TIME_MILLIS = 50;
    const throttleUpdate = import_lodash9.default.throttle(
      updateBottomBar,
      THROTTLE_TIME_MILLIS
    );
    const observer = new ResizeObserver(() => {
      throttleUpdate(tableEl, tableContainerEl);
    });
    observer.observe(tableEl);
    return () => {
      observer.disconnect();
    };
  }, []);
  let className = "dataloom-bottom-bar";
  if (isMobile) {
    className += " dataloom-bottom-bar--mobile";
  }
  return /* @__PURE__ */ (0, import_jsx_runtime146.jsx)("div", { ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
    "div",
    {
      style: {
        top: numToPx(-bottomBarOffset)
      },
      children: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(Padding, { pt: "md", width: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)(Stack, { spacing: "sm", children: [
        /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)(Flex, { justify: "space-between", children: [
          /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(NewRowButton, { onClick: onRowAddClick }),
          /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)(Stack, { isHorizontal: true, spacing: "sm", children: [
            /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
              Button,
              {
                ariaLabel: "Scroll to top",
                icon: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(Icon, { lucideId: "chevron-up" }),
                onClick: onScrollToTopClick
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
              Button,
              {
                ariaLabel: "Scroll to bottom",
                onClick: onScrollToBottomClick,
                icon: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(Icon, { lucideId: "chevron-down" })
              }
            )
          ] })
        ] }),
        isMobile && /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)(Flex, { justify: "space-between", children: [
          /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
            Button,
            {
              ariaLabel: "Undo",
              size: "lg",
              icon: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(Icon, { lucideId: "undo" }),
              onClick: onUndoClick
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
            Button,
            {
              ariaLabel: "Redo",
              size: "lg",
              icon: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(Icon, { lucideId: "redo" }),
              onClick: onRedoClick
            }
          )
        ] })
      ] }) })
    }
  ) });
}

// src/react/loom-app/app/filter-by-filters/evaluate-with-precedence.ts
var evaluateWithPrecedence = (expressions) => {
  if (expressions.length === 0) {
    return true;
  }
  let result = expressions[0].value;
  for (let i2 = 1; i2 < expressions.length; i2++) {
    const { operator, value } = expressions[i2];
    if (operator === "or") {
      result = result || value;
    } else {
      result = result && value;
    }
  }
  return result;
};

// src/react/loom-app/app/filter-by-filters/utils.ts
var getDateFromDateFilterOption = (option) => {
  switch (option) {
    case "today" /* TODAY */: {
      const date = /* @__PURE__ */ new Date();
      return date;
    }
    case "tomorrow" /* TOMORROW */: {
      const date = /* @__PURE__ */ new Date();
      date.setDate(date.getDate() + 1);
      return date;
    }
    case "yesterday" /* YESTERDAY */: {
      const date = /* @__PURE__ */ new Date();
      date.setDate(date.getDate() - 1);
      return date;
    }
    case "one-week-ago" /* ONE_WEEK_AGO */: {
      const date = /* @__PURE__ */ new Date();
      date.setDate(date.getDate() - 7);
      return date;
    }
    case "one-week-from-now" /* ONE_WEEK_FROM_NOW */: {
      const date = /* @__PURE__ */ new Date();
      date.setDate(date.getDate() + 7);
      return date;
    }
    case "one-month-ago" /* ONE_MONTH_AGO */: {
      const date = /* @__PURE__ */ new Date();
      date.setMonth(date.getMonth() - 1);
      return date;
    }
    case "one-month-from-now" /* ONE_MONTH_FROM_NOW */: {
      const date = /* @__PURE__ */ new Date();
      date.setMonth(date.getMonth() + 1);
      return date;
    }
    default:
      return null;
  }
};
var getDateAtMidnight = (date) => {
  const newDate = new Date(date);
  newDate.setHours(0, 0, 0, 0);
  return newDate;
};
var getDateJustBeforeMidnight = (date) => {
  const newDate = new Date(date);
  newDate.setHours(23, 59, 59, 999);
  return newDate;
};

// src/shared/filter/filter-match.ts
var doesNumberMatchFilter = (value, condition, filterText, shouldMatchIfNull) => {
  if (filterText === "")
    return shouldMatchIfNull;
  const filterNumber = Number(filterText);
  switch (condition) {
    case "is-equal" /* IS_EQUAL */:
      if (value === null)
        return shouldMatchIfNull;
      return value === filterNumber;
    case "is-greater" /* IS_GREATER */:
      if (value === null)
        return shouldMatchIfNull;
      return value > filterNumber;
    case "is-greater-or-equal" /* IS_GREATER_OR_EQUAL */:
      if (value === null)
        return shouldMatchIfNull;
      return value >= filterNumber;
    case "is-less" /* IS_LESS */:
      if (value === null)
        return shouldMatchIfNull;
      return value < filterNumber;
    case "is-less-or-equal" /* IS_LESS_OR_EQUAL */:
      if (value === null)
        return shouldMatchIfNull;
      return value <= filterNumber;
    case "is-not-equal" /* IS_NOT_EQUAL */:
      if (value === null)
        return shouldMatchIfNull;
      return value !== filterNumber;
    case "is-empty" /* IS_EMPTY */:
      return value === null;
    case "is-not-empty" /* IS_NOT_EMPTY */:
      return value !== null;
    default:
      throw new Error("Filter condition not yet supported");
  }
};
var doesBooleanMatchFilter = (value, condition, filterValue) => {
  switch (condition) {
    case "is" /* IS */:
      return value === filterValue;
    case "is-not" /* IS_NOT */:
      return value !== filterValue;
    default:
      throw new Error("Filter condition not yet supported");
  }
};
var doesTextMatchFilter = (value, condition, filterText, shouldMatchIfNull) => {
  value = value.toLowerCase().trim();
  filterText = filterText.toLowerCase().trim();
  switch (condition) {
    case "is" /* IS */:
      if (filterText === "")
        return shouldMatchIfNull;
      return value === filterText;
    case "is-not" /* IS_NOT */:
      if (filterText === "")
        return shouldMatchIfNull;
      return value !== filterText;
    case "contains" /* CONTAINS */:
      if (filterText === "")
        return shouldMatchIfNull;
      return value.includes(filterText);
    case "does-not-contain" /* DOES_NOT_CONTAIN */:
      if (filterText === "")
        return shouldMatchIfNull;
      return !value.includes(filterText);
    case "starts-with" /* STARTS_WITH */:
      if (filterText === "")
        return shouldMatchIfNull;
      return value.startsWith(filterText);
    case "ends-with" /* ENDS_WITH */:
      if (filterText === "")
        return shouldMatchIfNull;
      return value.endsWith(filterText);
    case "is-empty" /* IS_EMPTY */:
      return value === "";
    case "is-not-empty" /* IS_NOT_EMPTY */:
      return value !== "";
    default:
      throw new Error("Filter condition not yet supported");
  }
};
var doesDateMatchFilter = (valueDateTime, condition, option, filterDateTime, shouldMatchIfNull) => {
  let cellDate = null;
  if (valueDateTime !== null) {
    cellDate = new Date(valueDateTime);
  }
  let compareDate = getDateFromDateFilterOption(option);
  if (compareDate === null) {
    if (filterDateTime !== null) {
      compareDate = new Date(filterDateTime);
    }
  }
  switch (condition) {
    case "is" /* IS */: {
      if (compareDate === null)
        return shouldMatchIfNull;
      if (cellDate === null)
        return false;
      const compareDateMidnight = getDateAtMidnight(compareDate);
      const compareDateJustBeforeMidnight = getDateJustBeforeMidnight(compareDate);
      return cellDate.getTime() >= compareDateMidnight.getTime() && cellDate.getTime() <= compareDateJustBeforeMidnight.getTime();
    }
    case "is-after" /* IS_AFTER */: {
      if (compareDate === null)
        return shouldMatchIfNull;
      if (cellDate === null)
        return false;
      const compareDateBeforeMidnight = getDateJustBeforeMidnight(compareDate);
      return cellDate.getTime() > compareDateBeforeMidnight.getTime();
    }
    case "is-before" /* IS_BEFORE */: {
      if (compareDate === null)
        return shouldMatchIfNull;
      if (cellDate === null)
        return false;
      const compareDateMidnight = getDateAtMidnight(compareDate);
      return cellDate.getTime() < compareDateMidnight.getTime();
    }
    case "is-empty" /* IS_EMPTY */:
      return cellDate === null;
    case "is-not-empty" /* IS_NOT_EMPTY */:
      return cellDate !== null;
    default:
      throw new Error("Filter condition not yet supported");
  }
};

// src/react/loom-app/app/filter-by-filters/index.ts
var filterByFilters = (prevState) => {
  const { columns, rows, filters } = prevState.model;
  const columnIdToColumn = /* @__PURE__ */ new Map();
  columns.forEach((column) => {
    columnIdToColumn.set(column.id, column);
  });
  const cellIdToColumn = /* @__PURE__ */ new Map();
  rows.forEach((row) => {
    const { cells } = row;
    cells.forEach((cell) => {
      const column = columnIdToColumn.get(cell.columnId);
      if (!column)
        throw new ColumnNotFoundError({ id: cell.columnId });
      cellIdToColumn.set(cell.id, column);
    });
  });
  return rows.filter((row) => {
    const { cells } = row;
    return cells.every((cell) => {
      const column = cellIdToColumn.get(cell.id);
      if (!column)
        throw new ColumnNotFoundError({ id: cell.columnId });
      const { type, tags } = column;
      return doesCellMatchFilters(cell, row, type, tags, filters);
    });
  });
};
var doesCellMatchFilters = (cell, row, cellType, columnTags, filters) => {
  const expressions = filters.map((filter3) => ({
    operator: filter3.operator,
    value: doesCellMatchFilter(cell, row, cellType, columnTags, filter3)
  })).filter((expression) => expression.value !== null);
  if (expressions.length === 0)
    return true;
  return evaluateWithPrecedence(expressions);
};
var doesCellMatchFilter = (cell, row, cellType, columnTags, filter3) => {
  var _a2, _b;
  const { columnId, isEnabled, condition } = filter3;
  if (columnId !== cell.columnId)
    return null;
  if (!isEnabled)
    return null;
  switch (cellType) {
    case "text" /* TEXT */: {
      const { content } = cell;
      const { text } = filter3;
      return doesTextMatchFilter(content, condition, text, true);
    }
    case "file" /* FILE */: {
      const { alias, path } = cell;
      const { text } = filter3;
      return doesTextMatchFilter(alias != null ? alias : path, condition, text, true);
    }
    case "checkbox" /* CHECKBOX */: {
      const { value } = cell;
      const { value: filterValue } = filter3;
      return doesBooleanMatchFilter(value, condition, filterValue);
    }
    case "tag" /* TAG */: {
      const { tagId: cellTagId } = cell;
      const { tagId: filterTagId } = filter3;
      const filterTag = (_a2 = columnTags.find((tag) => filterTagId === tag.id)) != null ? _a2 : null;
      const cellTag = (_b = columnTags.find((tag) => cellTagId === tag.id)) != null ? _b : null;
      return doesTagMatch(cellTag, filterTag, condition);
    }
    case "multi-tag" /* MULTI_TAG */: {
      const { tagIds: cellTagIds } = cell;
      const { tagIds: filterTagIds } = filter3;
      const filterTags = columnTags.filter(
        (tag) => filterTagIds.includes(tag.id)
      );
      const cellTags = columnTags.filter(
        (tag) => cellTagIds.includes(tag.id)
      );
      return doTagsMatch(cellTags, filterTags, condition);
    }
    case "number" /* NUMBER */: {
      const { value } = cell;
      const { text } = filter3;
      return doesNumberMatchFilter(value, condition, text, true);
    }
    case "embed" /* EMBED */: {
      const { pathOrUrl } = cell;
      const { text } = filter3;
      let compareValue = pathOrUrl;
      if (isRelativePath(pathOrUrl)) {
        compareValue = getFileName(pathOrUrl);
      }
      return doesTextMatchFilter(compareValue, condition, text, true);
    }
    case "date" /* DATE */: {
      const { dateTime: cellDateTime } = cell;
      const { dateTime: filterDateTime, option } = filter3;
      return doesDateMatchFilter(
        cellDateTime,
        condition,
        option,
        filterDateTime,
        true
      );
    }
    case "creation-time" /* CREATION_TIME */: {
      const { creationDateTime } = row;
      const { dateTime, option } = filter3;
      return doesDateMatchFilter(
        creationDateTime,
        condition,
        option,
        dateTime,
        true
      );
    }
    case "last-edited-time" /* LAST_EDITED_TIME */: {
      const { lastEditedDateTime } = row;
      const { dateTime, option } = filter3;
      return doesDateMatchFilter(
        lastEditedDateTime,
        condition,
        option,
        dateTime,
        true
      );
    }
    case "source-file" /* SOURCE_FILE */: {
      const { text } = filter3;
      const { path } = cell;
      const fileName = getFileName(path);
      return doesTextMatchFilter(fileName != null ? fileName : "", condition, text, true);
    }
    default:
      throw new Error("Unhandled cell type");
  }
};
var doesTagMatch = (cellTag, filterTag, condition) => {
  switch (condition) {
    case "is" /* IS */:
      if (filterTag === null)
        return true;
      return (cellTag == null ? void 0 : cellTag.id) == filterTag.id;
    case "is-not" /* IS_NOT */:
      if (filterTag === null)
        return true;
      return (cellTag == null ? void 0 : cellTag.id) !== filterTag.id;
    case "is-empty" /* IS_EMPTY */:
      return cellTag === null;
    case "is-not-empty" /* IS_NOT_EMPTY */:
      return cellTag !== null;
    default:
      throw new Error("Filter condition not yet supported");
  }
};
var doTagsMatch = (cellTags, filterTags, condition) => {
  switch (condition) {
    case "contains" /* CONTAINS */:
      return filterTags.every(
        (filterTag) => cellTags.some((cellTag) => cellTag.id === filterTag.id)
      );
    case "does-not-contain" /* DOES_NOT_CONTAIN */:
      return filterTags.every(
        (filterTag) => cellTags.every((cellTag) => cellTag.id !== filterTag.id)
      );
    case "is-empty" /* IS_EMPTY */:
      return cellTags.length === 0;
    case "is-not-empty" /* IS_NOT_EMPTY */:
      return cellTags.length !== 0;
    default:
      throw new Error("Filter condition not yet supported");
  }
};

// src/shared/loom-state/commands/loom-state-command.ts
var import_lodash10 = __toESM(require_lodash());

// src/shared/loom-state/commands/error/command-redo-error.ts
var CommandRedoError = class extends Error {
  constructor() {
    super(`undo() must be called before redo() is available`);
    this.name = "CommandRedoError";
  }
};

// src/shared/loom-state/commands/error/command-undo-error.ts
var CommandUndoError = class extends Error {
  constructor() {
    super(`execute() must be called before undo() is available`);
    this.name = "CommandUndoError";
  }
};

// src/shared/loom-state/commands/loom-state-command.ts
var import_jsondiffpatch = __toESM(require_jsondiffpatch_umd());
var LoomStateCommand = class {
  constructor(shouldSortRows, options) {
    this.hasExecuteBeenCalled = false;
    this.hasUndoBeenCalled = false;
    const { shouldSaveFrontmatter = true } = options != null ? options : {};
    this.shouldSortRows = shouldSortRows;
    this.shouldSaveFrontmatter = shouldSaveFrontmatter;
  }
  /**
   * Should be called after the command is executed
   * @param prevState - The state before the command is executed
   * @param nextState - The state after the command is executed
   */
  finishExecute(prevState, nextState) {
    this.hasExecuteBeenCalled = true;
    const patch = import_jsondiffpatch.default.diff(prevState, nextState);
    this.statePatch = patch;
  }
  undo(executeState) {
    if (!this.hasExecuteBeenCalled)
      throw new CommandUndoError();
    this.hasUndoBeenCalled = true;
    if (!this.statePatch)
      return executeState;
    const stateCopy = (0, import_lodash10.cloneDeep)(executeState);
    import_jsondiffpatch.default.unpatch(stateCopy, this.statePatch);
    return stateCopy;
  }
  redo(undoState) {
    if (!this.hasUndoBeenCalled)
      throw new CommandRedoError();
    this.hasUndoBeenCalled = false;
    if (!this.statePatch)
      return undoState;
    const stateCopy = (0, import_lodash10.cloneDeep)(undoState);
    import_jsondiffpatch.default.patch(stateCopy, this.statePatch);
    return stateCopy;
  }
};
var loom_state_command_default = LoomStateCommand;

// src/shared/loom-state/commands/filter-update-command.ts
var FilterUpdateCommand = class extends loom_state_command_default {
  constructor(id2, data, isPartial = true) {
    super(false);
    this.id = id2;
    this.data = data;
    this.isPartial = isPartial;
  }
  execute(prevState) {
    const { filters } = prevState.model;
    const nextFilters = filters.map((filter3) => {
      if (filter3.id === this.id) {
        let newFilter = this.data;
        if (this.isPartial)
          newFilter = { ...filter3, ...this.data };
        return newFilter;
      }
      return filter3;
    });
    const nextState = {
      ...prevState,
      model: {
        ...prevState.model,
        filters: nextFilters
      }
    };
    this.finishExecute(prevState, nextState);
    return nextState;
  }
};

// src/shared/loom-state/commands/filter-add-command.ts
var FilterAddCommand = class extends loom_state_command_default {
  constructor() {
    super(false);
  }
  execute(prevState) {
    const { filters, columns } = prevState.model;
    let column = columns[0];
    if (column.type === "source" /* SOURCE */) {
      column = columns[1];
    }
    const { type, id: id2 } = column;
    let newFilter = null;
    if (type === "text" /* TEXT */) {
      newFilter = createTextFilter2(id2);
    } else if (type === "file" /* FILE */) {
      newFilter = createFileFilter2(id2);
    } else if (type === "checkbox" /* CHECKBOX */) {
      newFilter = createCheckboxFilter2(id2);
    } else if (type === "tag" /* TAG */) {
      newFilter = createTagFilter2(id2);
    } else if (type === "multi-tag" /* MULTI_TAG */) {
      newFilter = createMultiTagFilter2(id2);
    } else if (type === "date" /* DATE */) {
      newFilter = createDateFilter(id2);
    } else if (type === "number" /* NUMBER */) {
      newFilter = createNumberFilter(id2);
    } else if (type === "embed" /* EMBED */) {
      newFilter = createEmbedFilter(id2);
    } else if (type === "creation-time" /* CREATION_TIME */) {
      newFilter = createCreationTimeFilter(id2);
    } else if (type === "last-edited-time" /* LAST_EDITED_TIME */) {
      newFilter = createLastEditedTimeFilter(id2);
    } else if (type === "source-file" /* SOURCE_FILE */) {
      newFilter = createSourceFileFilter(id2);
    } else {
      throw new Error("Unhandled cell type");
    }
    const nextFilters = [...filters, newFilter];
    const nextState = {
      ...prevState,
      model: {
        ...prevState.model,
        filters: nextFilters
      }
    };
    this.finishExecute(prevState, nextState);
    return nextState;
  }
};

// src/shared/loom-state/commands/filter-delete-command.ts
var FilterDeleteCommand = class extends loom_state_command_default {
  constructor(id2) {
    super(false);
    this.id = id2;
  }
  execute(prevState) {
    const { filters } = prevState.model;
    const nextFilters = filters.filter((f3) => f3.id !== this.id);
    const newState = {
      ...prevState,
      model: {
        ...prevState.model,
        filters: nextFilters
      }
    };
    this.finishExecute(prevState, newState);
    return newState;
  }
};

// src/react/loom-app/app/hooks/use-filter.ts
var import_js_logger12 = __toESM(require_logger());
var useFilter = () => {
  const { doCommand } = useLoomState();
  function handleFilterUpdate(id2, data, isPartial) {
    import_js_logger12.default.trace("handleFilterUpdate", { id: id2, data });
    doCommand(new FilterUpdateCommand(id2, data, isPartial));
  }
  function handleFilterAdd() {
    import_js_logger12.default.trace("handleFilterAdd");
    doCommand(new FilterAddCommand());
  }
  function handleFilterDelete(id2) {
    import_js_logger12.default.trace("handleFilterDelete", { id: id2 });
    doCommand(new FilterDeleteCommand(id2));
  }
  return {
    onFilterAdd: handleFilterAdd,
    onFilterUpdate: handleFilterUpdate,
    onFilterDelete: handleFilterDelete,
    filterByFilters
  };
};

// src/react/loom-app/app/filter-by-search.ts
var filterRowsBySearch = (sources, columns, rows, searchText) => {
  if (searchText === "")
    return rows;
  const columnIdToColumn = /* @__PURE__ */ new Map();
  columns.forEach((column) => {
    columnIdToColumn.set(column.id, column);
  });
  const cellIdToColumn = /* @__PURE__ */ new Map();
  rows.forEach((row) => {
    const { cells } = row;
    cells.forEach((cell) => {
      const column = columnIdToColumn.get(cell.columnId);
      if (!column)
        throw new ColumnNotFoundError({ id: cell.columnId });
      cellIdToColumn.set(cell.id, column);
    });
  });
  return rows.filter((row) => {
    const { cells } = row;
    return cells.some((cell) => {
      const column = cellIdToColumn.get(cell.id);
      if (!column)
        throw new ColumnNotFoundError({ id: cell.columnId });
      return doesCellMatch(
        sources,
        cell,
        column,
        row,
        searchText.toLowerCase()
      );
    });
  });
};
var doesCellMatch = (sources, cell, column, row, searchText) => {
  const {
    currencyType,
    type,
    dateFormat,
    numberFormat,
    numberPrefix,
    numberSuffix,
    numberSeparator,
    dateFormatSeparator,
    tags,
    includeTime,
    hour12
  } = column;
  const { lastEditedDateTime, creationDateTime, sourceId } = row;
  switch (type) {
    case "text" /* TEXT */: {
      const { content } = cell;
      return matchTextCell(content, searchText);
    }
    case "embed" /* EMBED */: {
      const { pathOrUrl } = cell;
      let searchValue = "";
      if (isRelativePath(pathOrUrl)) {
        searchValue = getFileName(pathOrUrl);
      }
      return matchTextCell(searchValue, searchText);
    }
    case "file" /* FILE */: {
      const { path } = cell;
      const fileName = getFileName(path);
      return matchTextCell(fileName, searchText);
    }
    case "checkbox" /* CHECKBOX */: {
      const { value } = cell;
      return matchCheckboxCell(value, searchText);
    }
    case "number" /* NUMBER */: {
      const { value } = cell;
      return matchNumberCell(
        numberFormat,
        numberPrefix,
        numberSuffix,
        numberSeparator,
        currencyType,
        value,
        searchText
      );
    }
    case "date" /* DATE */: {
      const { dateTime } = cell;
      return matchDateCell(
        dateTime,
        dateFormat,
        dateFormatSeparator,
        includeTime,
        hour12,
        searchText
      );
    }
    case "creation-time" /* CREATION_TIME */:
      return matchCreationTimeCell(
        creationDateTime,
        dateFormat,
        dateFormatSeparator,
        hour12,
        searchText
      );
    case "last-edited-time" /* LAST_EDITED_TIME */:
      return matchLastEditedTimeCell(
        lastEditedDateTime,
        dateFormat,
        dateFormatSeparator,
        hour12,
        searchText
      );
    case "tag" /* TAG */: {
      const { tagId } = cell;
      return matchTag(tags, tagId, searchText);
    }
    case "multi-tag" /* MULTI_TAG */: {
      const { tagIds } = cell;
      return matchTags(tags, tagIds, searchText);
    }
    case "source" /* SOURCE */: {
      return matchSourceCell(sources, sourceId, searchText);
    }
    case "source-file" /* SOURCE_FILE */: {
      const { path } = cell;
      const fileName = getFileName(path);
      return matchSourceFileCell(fileName, searchText);
    }
    default:
      throw new Error("Unsupported cell type");
  }
};
var matchCheckboxCell = (value, searchText) => {
  const content = getCheckboxCellContent(value, true);
  return content.toLowerCase().includes(searchText);
};
var matchTextCell = (cellContent, searchText) => {
  return cellContent.toLowerCase().includes(searchText);
};
var matchNumberCell = (numberFormat, prefix2, suffix, separator, currencyType, cellValue, searchText) => {
  const content = getNumberCellContent(numberFormat, cellValue, {
    currency: currencyType,
    prefix: prefix2,
    suffix,
    separator
  });
  return content.toLowerCase().includes(searchText.toLowerCase());
};
var matchTag = (columnTags, cellTagId, searchText) => {
  if (!cellTagId)
    return false;
  const tag = columnTags.find((tag2) => tag2.id === cellTagId);
  if (!tag)
    throw new TagNotFoundError(cellTagId);
  return tag.content.toLowerCase().includes(searchText);
};
var matchTags = (columnTags, cellTagIds, searchText) => {
  const cellTags = columnTags.filter((tag) => cellTagIds.includes(tag.id));
  return cellTags.some(
    (tag) => tag.content.toLowerCase().includes(searchText)
  );
};
var matchDateCell = (dateTime, dateFormat, dateFormatSeparator, includeTime, hour12, searchText) => {
  const content = getDateCellContent(
    dateTime,
    dateFormat,
    dateFormatSeparator,
    includeTime,
    hour12
  );
  return content.toLowerCase().includes(searchText);
};
var matchCreationTimeCell = (creationDateTime, dateFormat, dateFormatSeparator, hour12, searchText) => {
  const content = getTimeCellContent(
    creationDateTime,
    dateFormat,
    dateFormatSeparator,
    hour12
  );
  return content.toLowerCase().includes(searchText);
};
var matchLastEditedTimeCell = (lastEditedDateTime, dateFormat, dateFormatSeparator, hour12, searchText) => {
  const content = getTimeCellContent(
    lastEditedDateTime,
    dateFormat,
    dateFormatSeparator,
    hour12
  );
  return content.toLowerCase().includes(searchText);
};
var matchSourceFileCell = (originalContent, searchText) => {
  const content = getSourceFileContent(originalContent, true);
  return content.toLowerCase().includes(searchText);
};
var matchSourceCell = (sources, sourceId, searchText) => {
  var _a2;
  const source = (_a2 = sources.find((source2) => source2.id === sourceId)) != null ? _a2 : null;
  const content = getSourceCellContent(source);
  return content.toLowerCase().includes(searchText);
};

// src/shared/loom-state/commands/column-add-command/utils.ts
var columnAddExecute = (prevColumns, prevRows, options) => {
  const { type = "text" /* TEXT */, insertIndex, content } = options != null ? options : {};
  const nextColumns = [...prevColumns];
  const newColumn = createColumn({
    type,
    content
  });
  nextColumns.splice(insertIndex != null ? insertIndex : prevColumns.length, 0, newColumn);
  const nextRows = prevRows.map((row) => {
    const { cells } = row;
    const newCell = createCellForType(newColumn.id, type);
    const nextCells = [...cells, newCell];
    return {
      ...row,
      cells: nextCells
    };
  });
  return {
    columns: nextColumns,
    rows: nextRows
  };
};

// src/shared/loom-state/commands/column-add-command/index.ts
var ColumnAddCommand = class extends loom_state_command_default {
  constructor(type) {
    super(false);
    this.type = type;
  }
  execute(prevState) {
    const { columns, rows } = prevState.model;
    const result = columnAddExecute(columns, rows, { type: this.type });
    const { columns: nextColumns, rows: nextRows } = result;
    const nextState = {
      ...prevState,
      model: {
        ...prevState.model,
        columns: nextColumns,
        rows: nextRows
      }
    };
    this.finishExecute(prevState, nextState);
    return nextState;
  }
};

// src/shared/loom-state/commands/error/command-arguments-error.ts
var CommandArgumentsError = class extends Error {
  constructor(type) {
    let message = "";
    if (type === "delete") {
      message = "Either 'id' or 'last' must be defined";
    }
    super(message);
    this.name = "CommandArgumentsError";
  }
};

// src/shared/loom-state/commands/column-delete-command/utils.ts
var columnDeleteExecute = (prevColumns, prevRows, prevFilters, id2) => {
  if (prevColumns.length === 1) {
    return null;
  }
  const columnToDelete = prevColumns.find((column) => column.id === id2);
  if (!columnToDelete)
    throw new ColumnNotFoundError({ id: id2 });
  const nextColumns = prevColumns.filter((column) => column.id !== id2);
  const nextRows = prevRows.map((row) => {
    const { cells } = row;
    const cell = row.cells.find((cell2) => cell2.columnId === id2);
    if (!cell)
      throw new CellNotFoundError({
        columnId: id2,
        rowId: row.id
      });
    const nextCells = cells.filter((cell2) => cell2.columnId !== id2);
    return {
      ...row,
      cells: nextCells
    };
  });
  const nextFilters = prevFilters.filter((filter3) => filter3.columnId !== id2);
  return {
    nextColumns,
    nextRows,
    nextFilters
  };
};

// src/shared/loom-state/commands/column-delete-command/index.ts
var ColumnDeleteCommand = class extends loom_state_command_default {
  constructor(options) {
    super(false);
    const { id: id2, last: last2 } = options;
    if (id2 === void 0 && last2 === void 0)
      throw new CommandArgumentsError("delete");
    this.columnId = id2;
    this.last = last2;
  }
  execute(prevState) {
    const { columns, rows, filters } = prevState.model;
    let id2 = this.columnId;
    if (this.last)
      id2 = columns[columns.length - 1].id;
    const result = columnDeleteExecute(columns, rows, filters, id2);
    if (result === null) {
      return prevState;
    }
    const { nextColumns, nextFilters, nextRows } = result;
    const nextState = {
      ...prevState,
      model: {
        ...prevState.model,
        columns: nextColumns,
        rows: nextRows,
        filters: nextFilters
      }
    };
    this.finishExecute(prevState, nextState);
    return nextState;
  }
};

// src/shared/loom-state/commands/column-update-command.ts
var ColumnUpdateCommand = class extends loom_state_command_default {
  constructor(columnId, data, options) {
    const {
      shouldSortRows = false,
      isPartial = true,
      shouldSaveFrontmatter = true
    } = options || {};
    super(shouldSortRows, { shouldSaveFrontmatter });
    this.columnId = columnId;
    this.data = data;
    this.isPartial = isPartial;
  }
  execute(prevState) {
    const { columns } = prevState.model;
    const column = columns.find((column2) => column2.id === this.columnId);
    if (!column)
      throw new ColumnNotFoundError({ id: this.columnId });
    const nextColumns = columns.map((column2) => {
      if (column2.id === this.columnId) {
        let newColumn = this.data;
        if (this.isPartial)
          newColumn = { ...column2, ...this.data };
        return newColumn;
      }
      return column2;
    });
    const nextState = {
      ...prevState,
      model: {
        ...prevState.model,
        columns: nextColumns
      }
    };
    this.finishExecute(prevState, nextState);
    return nextState;
  }
};

// src/shared/loom-state/commands/column-type-update-command.ts
var import_lodash11 = __toESM(require_lodash());
var ColumnTypeUpdateCommand = class extends loom_state_command_default {
  constructor(columnId, type) {
    super(false);
    this.targetColumnId = columnId;
    this.nextType = type;
  }
  execute(prevState) {
    const { columns, rows, filters } = prevState.model;
    const columnsCopy = (0, import_lodash11.cloneDeep)(columns);
    const column = columnsCopy.find(
      (column2) => column2.id === this.targetColumnId
    );
    if (!column)
      throw new ColumnNotFoundError({ id: this.targetColumnId });
    const { type: previousType } = column;
    if (previousType === this.nextType)
      return prevState;
    const nextRows = rows.map((row) => {
      const { cells } = row;
      const nextCells = cells.map((cell) => {
        const { columnId } = cell;
        if (columnId === this.targetColumnId) {
          if (this.nextType === "text" /* TEXT */) {
            if (previousType === "checkbox" /* CHECKBOX */) {
              return this.fromCheckboxToText(
                cell
              );
            } else if (previousType === "date" /* DATE */) {
              return this.fromDateToText(
                column,
                cell
              );
            } else if (previousType === "number" /* NUMBER */) {
              return this.fromNumberToText(cell);
            } else if (previousType === "tag" /* TAG */) {
              return this.fromTagToText(
                column.tags,
                cell
              );
            } else if (previousType === "multi-tag" /* MULTI_TAG */) {
              return this.fromMultiTagToText(
                column.tags,
                cell
              );
            } else if (previousType === "file" /* FILE */) {
              return this.fromFileToText(cell);
            } else if (previousType === "embed" /* EMBED */) {
              return this.fromEmbedToText(cell);
            }
          } else if (this.nextType === "checkbox" /* CHECKBOX */) {
            if (previousType === "text" /* TEXT */) {
              return this.fromTextToCheckbox(cell);
            }
          } else if (this.nextType === "date" /* DATE */) {
            if (previousType === "text" /* TEXT */) {
              return this.fromTextToDate(cell);
            }
          } else if (this.nextType === "number" /* NUMBER */) {
            if (previousType === "text" /* TEXT */) {
              return this.fromTextToNumber(cell);
            }
          } else if (this.nextType === "tag" /* TAG */) {
            if (previousType === "text" /* TEXT */) {
              return this.fromTextToTag(column, cell);
            } else if (previousType === "multi-tag" /* MULTI_TAG */) {
              return this.fromMultiTagToTag(cell);
            }
          } else if (this.nextType === "multi-tag" /* MULTI_TAG */) {
            if (previousType === "text" /* TEXT */) {
              return this.fromTextToMultiTag(
                column,
                cell
              );
            } else if (previousType === "tag" /* TAG */) {
              return this.fromTagToMultiTag(cell);
            }
          } else if (this.nextType === "embed" /* EMBED */) {
            if (previousType === "text" /* TEXT */) {
              return this.fromTextToEmbed(cell);
            }
          } else if (this.nextType === "file" /* FILE */) {
            if (previousType === "text" /* TEXT */) {
              return this.fromTextToFile(cell);
            }
          }
          const newCell = createCellForType(columnId, this.nextType);
          return newCell;
        }
        return cell;
      });
      return {
        ...row,
        cells: nextCells
      };
    });
    const nextColumns = columnsCopy.map((column2) => {
      if (column2.id === this.targetColumnId) {
        return {
          ...column2,
          type: this.nextType,
          frontmatterKey: null
        };
      }
      return column2;
    });
    const nextFilters = filters.filter(
      (filter3) => filter3.columnId !== this.targetColumnId
    );
    const nextState = {
      ...prevState,
      model: {
        ...prevState.model,
        columns: nextColumns,
        rows: nextRows,
        filters: nextFilters
      }
    };
    this.finishExecute(prevState, nextState);
    return nextState;
  }
  fromCheckboxToText(cell) {
    const { columnId, value } = cell;
    const content = value ? "true" : "false";
    const newCell = createTextCell(columnId, {
      content
    });
    return newCell;
  }
  fromNumberToText(cell) {
    var _a2;
    const { columnId, value } = cell;
    const content = (_a2 = value == null ? void 0 : value.toString()) != null ? _a2 : "";
    const newCell = createTextCell(columnId, {
      content
    });
    return newCell;
  }
  fromTagToText(columnTags, cell) {
    var _a2;
    const { columnId, tagId } = cell;
    const tag = columnTags.find((tag2) => tag2.id === tagId);
    const newCell = createTextCell(columnId, {
      content: (_a2 = tag == null ? void 0 : tag.content) != null ? _a2 : ""
    });
    return newCell;
  }
  fromTagToMultiTag(cell) {
    const { columnId, tagId } = cell;
    const newCell = createMultiTagCell(columnId, {
      tagIds: tagId ? [tagId] : []
    });
    return newCell;
  }
  fromMultiTagToText(columnTags, cell) {
    const { columnId, tagIds } = cell;
    const content = tagIds.map((tagId) => {
      var _a2;
      const tag = columnTags.find((tag2) => tag2.id === tagId);
      return (_a2 = tag == null ? void 0 : tag.content) != null ? _a2 : "";
    }).join(",");
    const newCell = createTextCell(columnId, {
      content
    });
    return newCell;
  }
  fromMultiTagToTag(cell) {
    const { columnId, tagIds } = cell;
    let tagId = null;
    if (tagIds.length > 0) {
      tagId = tagIds[0];
    }
    const newCell = createTagCell(columnId, {
      tagId
    });
    return newCell;
  }
  fromDateToText(column, cell) {
    const { includeTime, hour12, dateFormat, dateFormatSeparator } = column;
    const { columnId, dateTime } = cell;
    let content = "";
    if (dateTime !== null) {
      content = dateTimeToDateString(
        dateTime,
        dateFormat,
        dateFormatSeparator,
        {
          includeTime,
          hour12
        }
      );
    }
    const newCell = createTextCell(columnId, {
      content
    });
    return newCell;
  }
  fromFileToText(cell) {
    const { columnId, path } = cell;
    const newCell = createTextCell(columnId, {
      content: path
    });
    return newCell;
  }
  fromEmbedToText(cell) {
    const { columnId, pathOrUrl } = cell;
    const newCell = createTextCell(columnId, {
      content: pathOrUrl
    });
    return newCell;
  }
  fromTextToCheckbox(cell) {
    const { columnId, content } = cell;
    const newCell = createCheckboxCell(columnId, {
      value: content === "true"
    });
    return newCell;
  }
  fromTextToNumber(cell) {
    const { columnId, content } = cell;
    const newCell = createNumberCell(columnId, {
      value: isNumber(content) ? Number(content) : null
    });
    return newCell;
  }
  fromTextToDate(cell) {
    const { columnId, content } = cell;
    const dateTime = parseDateTime(content);
    const newCell = createDateCell(columnId, {
      dateTime
    });
    return newCell;
  }
  fromTextToTag(column, cell) {
    var _a2, _b;
    const { columnId, content } = cell;
    const { tags: columnTags } = column;
    let tagId = (_b = (_a2 = columnTags.find((tag) => tag.content === content)) == null ? void 0 : _a2.id) != null ? _b : null;
    if (content !== "") {
      if (!tagId) {
        const newTag = createTag(content);
        tagId = newTag.id;
        column.tags = [...columnTags, newTag];
      }
    }
    const newCell = createTagCell(columnId, {
      tagId
    });
    return newCell;
  }
  fromTextToMultiTag(column, cell) {
    const { columnId, content } = cell;
    const newTags = [];
    if (content !== "") {
      const { tags: columnTags } = column;
      content.split(",").forEach((tagContent) => {
        var _a2;
        let tag = (_a2 = columnTags.find((tag2) => tag2.content === tagContent)) != null ? _a2 : null;
        if (!tag)
          tag = createTag(tagContent);
        newTags.push(tag);
      });
    }
    const allTags = [...column.tags, ...newTags];
    const uniqueTags = allTags.reduce((acc, current) => {
      if (!acc.find((tag) => tag.id === current.id)) {
        acc.push(current);
      }
      return acc;
    }, []);
    column.tags = uniqueTags;
    const newCell = createMultiTagCell(columnId, {
      tagIds: uniqueTags.map((tag) => tag.id)
    });
    return newCell;
  }
  fromTextToFile(cell) {
    const { columnId, content } = cell;
    const newCell = createFileCell(columnId, {
      path: content
    });
    return newCell;
  }
  fromTextToEmbed(cell) {
    const { columnId, content } = cell;
    const newCell = createEmbedCell(columnId, {
      pathOrUrl: content
    });
    return newCell;
  }
};

// src/shared/loom-state/commands/column-reorder-command.ts
var ColumnReorderCommand = class extends loom_state_command_default {
  constructor(dragId, targetId) {
    super(false);
    this.dragId = dragId;
    this.targetId = targetId;
  }
  execute(prevState) {
    const { columns } = prevState.model;
    const dragIndex = columns.findIndex(
      (column) => column.id === this.dragId
    );
    const targetIndex = columns.findIndex(
      (column) => column.id === this.targetId
    );
    const newColumns = [...columns];
    const draggedEl = newColumns[dragIndex];
    newColumns.splice(dragIndex, 1);
    newColumns.splice(targetIndex, 0, draggedEl);
    const nextRows = this.sortCellsByColumns(
      prevState.model.rows,
      newColumns
    );
    const nextState = {
      ...prevState,
      model: {
        ...prevState.model,
        columns: newColumns,
        rows: nextRows
      }
    };
    this.finishExecute(prevState, nextState);
    return nextState;
  }
  sortCellsByColumns(prevRows, columns) {
    return prevRows.map((row) => {
      const { cells } = row;
      const nextCells = cells.sort((a2, b2) => {
        const aIndex = columns.findIndex(
          (column) => column.id === a2.columnId
        );
        const bIndex = columns.findIndex(
          (column) => column.id === b2.columnId
        );
        return aIndex - bIndex;
      });
      return {
        ...row,
        cells: nextCells
      };
    });
  }
};

// src/react/loom-app/app/hooks/use-column/index.ts
var import_react52 = __toESM(require_react());
var import_js_logger13 = __toESM(require_logger());
var useColumn = () => {
  const { doCommand } = useLoomState();
  const handleNewColumnClick = import_react52.default.useCallback(() => {
    import_js_logger13.default.trace("handleNewColumnClick");
    doCommand(new ColumnAddCommand());
  }, [doCommand]);
  const handleColumnTypeChange = import_react52.default.useCallback(
    (columnId, type) => {
      import_js_logger13.default.trace("handleColumnTypeChange", {
        columnId,
        type
      });
      doCommand(new ColumnTypeUpdateCommand(columnId, type));
    },
    [doCommand]
  );
  const handleColumnChange = import_react52.default.useCallback(
    (columnId, data, options) => {
      import_js_logger13.default.trace("handleColumnChange", {
        columnId,
        data,
        options
      });
      doCommand(new ColumnUpdateCommand(columnId, data, options));
    },
    [doCommand]
  );
  const handleColumnDeleteClick = import_react52.default.useCallback(
    (columnId) => {
      import_js_logger13.default.trace("handleColumnDeleteClick", {
        columnId
      });
      doCommand(new ColumnDeleteCommand({ id: columnId }));
    },
    [doCommand]
  );
  const handleColumnReorder = import_react52.default.useCallback(
    (dragId, targetId) => {
      import_js_logger13.default.trace("handleColumnReorder", {
        dragId,
        targetId
      });
      doCommand(new ColumnReorderCommand(dragId, targetId));
    },
    [doCommand]
  );
  return {
    onColumnAddClick: handleNewColumnClick,
    onColumnTypeChange: handleColumnTypeChange,
    onColumnDeleteClick: handleColumnDeleteClick,
    onColumnChange: handleColumnChange,
    onColumnReorder: handleColumnReorder
  };
};

// src/shared/loom-state/commands/row-add-command.ts
var RowAddCommand = class extends loom_state_command_default {
  constructor() {
    super(true);
  }
  execute(prevState) {
    const { rows, columns } = prevState.model;
    const cells = columns.map((column) => {
      const { id: id2, type } = column;
      return createCellForType(id2, type);
    });
    this.addedRow = createRow(rows.length, { cells });
    const nextState = {
      ...prevState,
      model: {
        ...prevState.model,
        rows: [...rows, this.addedRow]
      }
    };
    this.finishExecute(prevState, nextState);
    return nextState;
  }
};

// src/shared/loom-state/commands/row-delete-command.ts
var RowDeleteCommand = class extends loom_state_command_default {
  constructor(options) {
    super(false);
    const { id: id2, last: last2 } = options;
    if (id2 === void 0 && last2 === void 0)
      throw new CommandArgumentsError("delete");
    this.rowId = id2;
    this.last = last2;
  }
  execute(prevState) {
    const { rows } = prevState.model;
    if (rows.length === 0)
      return prevState;
    let id2 = this.rowId;
    if (this.last)
      id2 = rows[rows.length - 1].id;
    const rowToDelete = rows.find((row) => row.id === id2);
    if (!rowToDelete)
      throw new RowNotFoundError(id2);
    let newRows = rows.filter((row) => row.id !== id2);
    newRows = newRows.map((row) => {
      if (row.index > rows.indexOf(rowToDelete)) {
        return {
          ...row,
          index: row.index - 1
        };
      }
      return row;
    });
    const nextState = {
      ...prevState,
      model: {
        ...prevState.model,
        rows: newRows
      }
    };
    this.finishExecute(prevState, nextState);
    return nextState;
  }
};

// src/react/loom-app/app/hooks/use-row.ts
var import_react53 = __toESM(require_react());

// src/shared/loom-state/commands/row-insert-command.ts
var RowInsertCommand = class extends loom_state_command_default {
  constructor(rowId, insert2) {
    super(false);
    this.rowId = rowId;
    this.insert = insert2;
  }
  execute(prevState) {
    const { rows, columns } = prevState.model;
    const index = rows.findIndex((row) => row.id === this.rowId);
    if (index === -1)
      throw new RowNotFoundError(this.rowId);
    const insertIndex = this.insert === "above" ? index : index + 1;
    const cells = columns.map((column) => {
      const { id: id2, type } = column;
      return createCellForType(id2, type);
    });
    const createdRow = createRow(insertIndex, { cells });
    const updatedRows = [
      ...rows.slice(0, insertIndex),
      createdRow,
      ...rows.slice(insertIndex)
      //Set the current index of all the values to their current positions
      //This will allow us to retain the order of sorted rows
    ].map((row, i2) => ({ ...row, index: i2 }));
    const updatedColumns = columns.map((column) => {
      return {
        ...column,
        sortDir: "default" /* NONE */
      };
    });
    const nextState = {
      ...prevState,
      model: {
        ...prevState.model,
        columns: updatedColumns,
        rows: updatedRows
      }
    };
    this.finishExecute(prevState, nextState);
    return nextState;
  }
};

// src/shared/loom-state/commands/row-reorder-command.ts
var RowReorderCommand = class extends loom_state_command_default {
  constructor(dragId, targetId) {
    super(false);
    this.dragId = dragId;
    this.targetId = targetId;
  }
  execute(prevState) {
    const { rows, columns } = prevState.model;
    const dragIndex = rows.findIndex((row) => row.id === this.dragId);
    const targetIndex = rows.findIndex((row) => row.id === this.targetId);
    let newRows = [...rows];
    const draggedEl = newRows[dragIndex];
    newRows.splice(dragIndex, 1);
    newRows.splice(targetIndex, 0, draggedEl);
    newRows = newRows.map((row, i2) => {
      return {
        ...row,
        index: i2
      };
    });
    const nextColumns = columns.map((column) => {
      return {
        ...column,
        sortDir: "default" /* NONE */
      };
    });
    const nextState = {
      ...prevState,
      model: {
        ...prevState.model,
        rows: newRows,
        columns: nextColumns
      }
    };
    this.finishExecute(prevState, nextState);
    return nextState;
  }
};

// src/react/loom-app/app/hooks/use-row.ts
var import_js_logger14 = __toESM(require_logger());
var useRow = () => {
  const { doCommand, loomState } = useLoomState();
  const handleRowDeleteClick = import_react53.default.useCallback(
    (rowId) => {
      import_js_logger14.default.trace("handleRowDeleteClick", {
        rowId
      });
      doCommand(new RowDeleteCommand({ id: rowId }));
    },
    [doCommand]
  );
  const handleNewRowClick = import_react53.default.useCallback(() => {
    import_js_logger14.default.trace("handleNewRowClick");
    doCommand(new RowAddCommand());
  }, [doCommand]);
  const handleRowInsertAboveClick = import_react53.default.useCallback(
    (rowId) => {
      import_js_logger14.default.trace("handleRowInsertAboveClick", {
        rowId
      });
      if (confirmSortOrderChange(loomState)) {
        doCommand(new RowInsertCommand(rowId, "above"));
      }
    },
    [doCommand, loomState]
  );
  const handleRowInsertBelowClick = import_react53.default.useCallback(
    (rowId) => {
      import_js_logger14.default.trace("handleRowInsertBelowClick", {
        rowId
      });
      if (confirmSortOrderChange(loomState)) {
        doCommand(new RowInsertCommand(rowId, "below"));
      }
    },
    [doCommand, loomState]
  );
  const handleRowReorder = import_react53.default.useCallback(
    (dragId, targetId) => {
      import_js_logger14.default.trace("handleRowReorder", {
        dragId,
        targetId
      });
      doCommand(new RowReorderCommand(dragId, targetId));
    },
    [doCommand]
  );
  return {
    onRowAddClick: handleNewRowClick,
    onRowDeleteClick: handleRowDeleteClick,
    onRowInsertAboveClick: handleRowInsertAboveClick,
    onRowInsertBelowClick: handleRowInsertBelowClick,
    onRowReorder: handleRowReorder
  };
};

// src/shared/loom-state/commands/cell-body-update-command.ts
var CellBodyUpdateCommand = class extends loom_state_command_default {
  constructor(id2, data, isPartial = true) {
    super(true);
    this.id = id2;
    this.data = data;
    this.isPartial = isPartial;
  }
  execute(prevState) {
    const { rows } = prevState.model;
    const row = rows.find(
      (row2) => row2.cells.find((cell) => cell.id === this.id)
    );
    if (!row)
      throw new RowNotFoundError();
    const targetRowId = row.id;
    const nextRows = rows.map((row2) => {
      const { cells } = row2;
      const nextCells = cells.map((cell) => {
        if (cell.id === this.id) {
          let newCell = this.data;
          if (this.isPartial)
            newCell = { ...cell, ...this.data };
          return newCell;
        }
        return cell;
      });
      if (row2.id === targetRowId) {
        return {
          ...row2,
          lastEditedDateTime: getCurrentDateTime(),
          cells: nextCells
        };
      }
      return row2;
    });
    const nextState = {
      ...prevState,
      model: {
        ...prevState.model,
        rows: nextRows
      }
    };
    this.finishExecute(prevState, nextState);
    return nextState;
  }
};

// src/react/loom-app/app/hooks/use-cell/index.ts
var import_react54 = __toESM(require_react());
var import_js_logger15 = __toESM(require_logger());
var useCell = () => {
  const { doCommand } = useLoomState();
  const handleCellChange = import_react54.default.useCallback(
    (id2, value, isPartial = true) => {
      import_js_logger15.default.trace("handleCellChange", {
        id: id2,
        value,
        isPartial
      });
      doCommand(new CellBodyUpdateCommand(id2, value, isPartial));
    },
    [doCommand]
  );
  return {
    onCellChange: handleCellChange
  };
};

// src/shared/loom-state/commands/tag-delete-command.ts
var TagDeleteCommand = class extends loom_state_command_default {
  constructor(columnId, tagId) {
    super(true);
    this.columnId = columnId;
    this.tagId = tagId;
  }
  execute(prevState) {
    const { rows, columns } = prevState.model;
    const nextColumns = columns.map((column) => {
      if (column.id === this.columnId) {
        const tag = column.tags.find((tag2) => tag2.id === this.tagId);
        if (!tag)
          throw new TagNotFoundError(this.tagId);
        const nextTags = column.tags.filter(
          (tag2) => tag2.id !== this.tagId
        );
        return {
          ...column,
          tags: nextTags
        };
      }
      return column;
    });
    const cellsToColumn = /* @__PURE__ */ new Map();
    const cells = rows.flatMap((row) => row.cells);
    cells.forEach((cell) => {
      const column = columns.find(
        (column2) => column2.id === cell.columnId
      );
      if (!column)
        throw new ColumnNotFoundError({ id: cell.columnId });
      cellsToColumn.set(cell.columnId, column);
    });
    const nextRows = rows.map((row) => {
      const { cells: cells2 } = row;
      const nextCells = cells2.map((cell) => {
        const column = cellsToColumn.get(cell.columnId);
        if (!column)
          throw new ColumnNotFoundError({ id: cell.columnId });
        const { type } = column;
        if (type === "tag" /* TAG */) {
          const { tagId } = cell;
          if (tagId === this.tagId) {
            return {
              ...cell,
              tagId: null
            };
          }
        } else if (type === "multi-tag" /* MULTI_TAG */) {
          const { tagIds } = cell;
          if (tagIds.includes(this.tagId)) {
            return {
              ...cell,
              tagIds: tagIds.filter(
                (tagId) => tagId !== this.tagId
              )
            };
          }
        }
        return cell;
      });
      return {
        ...row,
        cells: nextCells
      };
    });
    const nextState = {
      ...prevState,
      model: {
        ...prevState.model,
        columns: nextColumns,
        rows: nextRows
      }
    };
    this.finishExecute(prevState, nextState);
    return nextState;
  }
};

// src/shared/loom-state/commands/tag-update-command.ts
var TagUpdateCommand = class extends loom_state_command_default {
  constructor(columnId, tagId, data, isPartial = true) {
    super(false);
    this.columnId = columnId;
    this.tagId = tagId;
    this.data = data;
    this.isPartial = isPartial;
  }
  execute(prevState) {
    const { columns } = prevState.model;
    const nextColumns = columns.map((column) => {
      if (column.id === this.columnId) {
        const { tags } = column;
        const nextTags = tags.map((tag) => {
          if (tag.id === this.tagId) {
            let newTag = this.data;
            if (this.isPartial)
              newTag = { ...tag, ...this.data };
            return newTag;
          }
          return tag;
        });
        return { ...column, tags: nextTags };
      }
      return column;
    });
    const nextState = {
      ...prevState,
      model: {
        ...prevState.model,
        columns: nextColumns
      }
    };
    this.finishExecute(prevState, nextState);
    return nextState;
  }
};

// src/shared/loom-state/commands/tag-add-command.ts
var TagAddCommand = class extends loom_state_command_default {
  constructor(cellId, columnId, markdown, color) {
    super(true);
    this.cellId = cellId;
    this.columnId = columnId;
    this.markdown = markdown;
    this.color = color;
  }
  execute(prevState) {
    const { rows, columns } = prevState.model;
    const row = rows.find(
      (row2) => row2.cells.find((cell) => cell.id === this.cellId)
    );
    if (!row)
      throw new RowNotFoundError();
    const targetRowId = row.id;
    const newTag = createTag(this.markdown, {
      color: this.color
    });
    const nextColumns = columns.map((column) => {
      if (column.id === this.columnId) {
        return {
          ...column,
          tags: [...column.tags, newTag]
        };
      }
      return column;
    });
    const cellsToColumn = mapCellsToColumn(columns, rows);
    const nextRows = rows.map((row2) => {
      const { cells } = row2;
      const nextCells = cells.map((cell) => {
        const { id: id2 } = cell;
        if (id2 === this.cellId) {
          const column = cellsToColumn.get(cell.columnId);
          if (!column)
            throw new ColumnNotFoundError({
              id: cell.columnId
            });
          const { type } = column;
          if (type === "tag" /* TAG */) {
            return {
              ...cell,
              tagId: newTag.id
            };
          } else if (type === "multi-tag" /* MULTI_TAG */) {
            const { tagIds } = cell;
            return {
              ...cell,
              tagIds: [...tagIds, newTag.id]
            };
          } else {
            throw new Error("Cell type is not a tag or multi tag");
          }
        }
        return cell;
      });
      if (row2.id === targetRowId) {
        return {
          ...row2,
          lastEditedDateTime: getCurrentDateTime(),
          cells: nextCells
        };
      }
      return row2;
    });
    const nextState = {
      ...prevState,
      model: {
        ...prevState.model,
        columns: nextColumns,
        rows: nextRows
      }
    };
    this.finishExecute(prevState, nextState);
    return nextState;
  }
};

// src/shared/loom-state/commands/tag-cell-remove-command.ts
var TagCellRemoveCommand = class extends loom_state_command_default {
  constructor(cellId, tagId) {
    super(true);
    this.cellId = cellId;
    this.tagId = tagId;
  }
  execute(prevState) {
    const { columns, rows } = prevState.model;
    const row = rows.find(
      (row2) => row2.cells.find((cell) => cell.id === this.cellId)
    );
    if (!row)
      throw new RowNotFoundError();
    const targetRowId = row.id;
    const cellsToColumn = mapCellsToColumn(columns, rows);
    const nextRows = rows.map((row2) => {
      const { cells } = row2;
      const nextCells = cells.map((cell) => {
        const { id: id2 } = cell;
        if (id2 === this.cellId) {
          const column = cellsToColumn.get(cell.columnId);
          if (!column)
            throw new ColumnNotFoundError({
              id: cell.columnId
            });
          const { type } = column;
          if (type === "tag" /* TAG */) {
            return {
              ...cell,
              tagId: null
            };
          } else if (type === "multi-tag" /* MULTI_TAG */) {
            const { tagIds } = cell;
            const nextTagIds = tagIds.filter(
              (id3) => id3 !== this.tagId
            );
            return {
              ...cell,
              tagIds: nextTagIds
            };
          } else {
            throw new Error("Cell type is not a tag or multi tag");
          }
        }
        return cell;
      });
      if (row2.id === targetRowId) {
        return {
          ...row2,
          lastEditedDateTime: getCurrentDateTime(),
          cells: nextCells
        };
      }
      return row2;
    });
    const nextState = {
      ...prevState,
      model: {
        ...prevState.model,
        rows: nextRows
      }
    };
    this.finishExecute(prevState, nextState);
    return nextState;
  }
};

// src/shared/loom-state/commands/tag-cell-add-command.ts
var TagCellAddCommand = class extends loom_state_command_default {
  constructor(cellId, tagId) {
    super(true);
    this.cellId = cellId;
    this.tagId = tagId;
  }
  execute(prevState) {
    const { rows, columns } = prevState.model;
    const row = rows.find(
      (row2) => row2.cells.find((cell) => cell.id === this.cellId)
    );
    if (!row)
      throw new RowNotFoundError();
    const targetRowId = row.id;
    const cellsToColumn = mapCellsToColumn(columns, rows);
    const nextRows = rows.map((row2) => {
      const { cells } = row2;
      const nextCells = cells.map((cell) => {
        const { id: id2 } = cell;
        if (id2 === this.cellId) {
          const column = cellsToColumn.get(cell.columnId);
          if (!column)
            throw new ColumnNotFoundError({
              id: cell.columnId
            });
          const { type } = column;
          if (type === "tag" /* TAG */) {
            return {
              ...cell,
              tagId: this.tagId
            };
          } else if (type === "multi-tag" /* MULTI_TAG */) {
            const { tagIds } = cell;
            return {
              ...cell,
              tagIds: [...tagIds, this.tagId]
            };
          } else {
            throw new Error("Cell type is not a tag or multi tag");
          }
        }
        return cell;
      });
      if (row2.id === targetRowId) {
        return {
          ...row2,
          lastEditedDateTime: getCurrentDateTime(),
          cells: nextCells
        };
      }
      return row2;
    });
    const newState = {
      ...prevState,
      model: {
        ...prevState.model,
        rows: nextRows
      }
    };
    this.finishExecute(prevState, newState);
    return newState;
  }
};

// src/shared/loom-state/commands/tag-cell-multiple-remove-command.ts
var TagCellMultipleRemoveCommand = class extends loom_state_command_default {
  constructor(cellId, tagIds) {
    super(true);
    this.cellId = cellId;
    this.tagIds = tagIds;
  }
  execute(prevState) {
    const { columns, rows } = prevState.model;
    const row = rows.find(
      (row2) => row2.cells.find((cell) => cell.id === this.cellId)
    );
    if (!row)
      throw new RowNotFoundError();
    const targetRowId = row.id;
    const cellsToColumn = mapCellsToColumn(columns, rows);
    const nextRows = rows.map((row2) => {
      const { cells } = row2;
      const nextCells = cells.map((cell) => {
        const { id: id2 } = cell;
        if (id2 === this.cellId) {
          const column = cellsToColumn.get(cell.columnId);
          if (!column)
            throw new ColumnNotFoundError({
              id: cell.columnId
            });
          const { type } = column;
          if (type === "multi-tag" /* MULTI_TAG */) {
            const { tagIds } = cell;
            const updatedTagIds = tagIds.filter(
              (id3) => !this.tagIds.includes(id3)
            );
            return {
              ...cell,
              tagIds: updatedTagIds
            };
          } else {
            throw new Error("Cell type is not multi tag.");
          }
        }
        return cell;
      });
      if (row2.id === targetRowId) {
        return {
          ...row2,
          lastEditedDateTime: getCurrentDateTime(),
          cells: nextCells
        };
      }
      return row2;
    });
    const newState = {
      ...prevState,
      model: {
        ...prevState.model,
        rows: nextRows
      }
    };
    this.finishExecute(prevState, newState);
    return newState;
  }
};

// src/react/loom-app/app/hooks/use-tag/index.ts
var import_react55 = __toESM(require_react());
var import_js_logger16 = __toESM(require_logger());
var useTag = () => {
  const { doCommand } = useLoomState();
  const handleTagAdd = import_react55.default.useCallback(
    (cellId, columnId, markdown, color) => {
      import_js_logger16.default.trace("handleTagAdd", {
        cellId,
        columnId,
        markdown,
        color
      });
      doCommand(new TagAddCommand(cellId, columnId, markdown, color));
    },
    [doCommand]
  );
  const handleTagCellAdd = import_react55.default.useCallback(
    (cellId, tagId) => {
      import_js_logger16.default.trace("handleTagCellAdd", {
        cellId,
        tagId
      });
      doCommand(new TagCellAddCommand(cellId, tagId));
    },
    [doCommand]
  );
  const handleTagCellRemove = import_react55.default.useCallback(
    (cellId, tagId) => {
      import_js_logger16.default.trace("handleTagCellRemove", {
        cellId,
        tagId
      });
      doCommand(new TagCellRemoveCommand(cellId, tagId));
    },
    [doCommand]
  );
  const handleTagChange = import_react55.default.useCallback(
    (columnId, tagId, data, isPartial = true) => {
      import_js_logger16.default.trace("handleTagChange", {
        columnId,
        tagId,
        data
      });
      doCommand(new TagUpdateCommand(columnId, tagId, data, isPartial));
    },
    [doCommand]
  );
  const handleTagCellMultipleRemove = import_react55.default.useCallback(
    (cellId, tagIds) => {
      import_js_logger16.default.trace("handleTagCellMultipleRemove", {
        cellId,
        tagIds
      });
      doCommand(new TagCellMultipleRemoveCommand(cellId, tagIds));
    },
    [doCommand]
  );
  const handleTagDeleteClick = import_react55.default.useCallback(
    (columnId, tagId) => {
      import_js_logger16.default.trace("handleTagDeleteClick", {
        columnId,
        tagId
      });
      doCommand(new TagDeleteCommand(columnId, tagId));
    },
    [doCommand]
  );
  return {
    onTagCellAdd: handleTagCellAdd,
    onTagAdd: handleTagAdd,
    onTagCellRemove: handleTagCellRemove,
    onTagChange: handleTagChange,
    onTagCellMultipleRemove: handleTagCellMultipleRemove,
    onTagDeleteClick: handleTagDeleteClick
  };
};

// src/react/loom-app/app/hooks/use-export-events.ts
var import_react56 = __toESM(require_react());

// src/shared/event/utils.ts
var isEventForThisApp = (appId, allowOutsideEvents = false) => {
  const activeEl = document.activeElement;
  if (!activeEl)
    return false;
  const appEl = activeEl.closest(".dataloom-app");
  if (appEl)
    return appEl.id === appId;
  if (allowOutsideEvents)
    return true;
  const menuEl = activeEl.closest(".dataloom-menu");
  if (menuEl) {
    const menuId = menuEl.id;
    const menuTrigger = findMenuTriggerEl(menuId);
    if (!menuTrigger)
      return false;
    const appEl2 = menuTrigger.closest(".dataloom-app");
    if (appEl2)
      return appEl2.id === appId;
  }
  return false;
};

// src/react/loom-app/app/hooks/use-export-events.ts
var useExportEvents = (state) => {
  const { reactAppId, loomFile, app } = useAppMount();
  const { removeMarkdownOnExport } = useAppSelector(
    (state2) => state2.global.settings
  );
  const filePath = loomFile.path;
  import_react56.default.useEffect(() => {
    function handleDownloadCSV() {
      if (isEventForThisApp(reactAppId)) {
        setTimeout(() => {
          const data = exportToCSV(
            app,
            state,
            removeMarkdownOnExport
          );
          const exportFileName = getExportFileName(filePath);
          const blobType = getBlobTypeForExportType("CSV" /* CSV */);
          downloadFile(exportFileName, blobType, data);
        }, 100);
      }
    }
    function handleDownloadMarkdown() {
      if (isEventForThisApp(reactAppId)) {
        setTimeout(() => {
          const data = exportToMarkdown(
            app,
            state,
            removeMarkdownOnExport
          );
          const exportFileName = getExportFileName(filePath);
          const blobType = getBlobTypeForExportType(
            "Markdown" /* MARKDOWN */
          );
          downloadFile(exportFileName, blobType, data);
        }, 100);
      }
    }
    EventManager.getInstance().on("download-csv", handleDownloadCSV);
    EventManager.getInstance().on(
      "download-markdown",
      handleDownloadMarkdown
    );
    return () => {
      EventManager.getInstance().off("download-csv", handleDownloadCSV);
      EventManager.getInstance().off(
        "download-markdown",
        handleDownloadMarkdown
      );
    };
  }, [filePath, state, reactAppId, removeMarkdownOnExport, app]);
};

// src/react/loom-app/app/hooks/use-row-events.ts
var import_react57 = __toESM(require_react());
var useRowEvents = () => {
  const { reactAppId, app } = useAppMount();
  const { doCommand } = useLoomState();
  import_react57.default.useEffect(() => {
    function handleRowAddEvent() {
      if (isEventForThisApp(reactAppId))
        doCommand(new RowAddCommand());
    }
    function handleRowDeleteEvent() {
      if (isEventForThisApp(reactAppId))
        doCommand(new RowDeleteCommand({ last: true }));
    }
    EventManager.getInstance().on("add-row", handleRowAddEvent);
    EventManager.getInstance().on("delete-row", handleRowDeleteEvent);
    return () => {
      EventManager.getInstance().off("add-row", handleRowAddEvent);
      EventManager.getInstance().off("delete-row", handleRowDeleteEvent);
    };
  }, [doCommand, app, reactAppId]);
};

// src/react/loom-app/app/hooks/use-column-events.ts
var import_react58 = __toESM(require_react());
var import_js_logger17 = __toESM(require_logger());
var useColumnEvents = () => {
  const { reactAppId, app } = useAppMount();
  const { doCommand } = useLoomState();
  import_react58.default.useEffect(() => {
    function handleColumnAddEvent() {
      if (isEventForThisApp(reactAppId)) {
        import_js_logger17.default.trace("handleColumnAddEvent");
        doCommand(new ColumnAddCommand());
      }
    }
    function handleColumnDeleteEvent() {
      if (isEventForThisApp(reactAppId)) {
        import_js_logger17.default.trace("handleColumnDeleteEvent");
        doCommand(new ColumnDeleteCommand({ last: true }));
      }
    }
    EventManager.getInstance().on("add-column", handleColumnAddEvent);
    EventManager.getInstance().on("delete-column", handleColumnDeleteEvent);
    return () => {
      EventManager.getInstance().off("add-column", handleColumnAddEvent);
      EventManager.getInstance().off(
        "delete-column",
        handleColumnDeleteEvent
      );
    };
  }, [doCommand, reactAppId, app]);
};

// src/shared/loom-state/commands/table-settings-update-command.ts
var TableSettingsUpdateCommand = class extends loom_state_command_default {
  constructor(key, value) {
    super(false);
    this.key = key;
    this.value = value;
  }
  execute(prevState) {
    const { settings } = prevState.model;
    const nextState = {
      ...prevState,
      model: {
        ...prevState.model,
        settings: {
          ...settings,
          [this.key]: this.value
        }
      }
    };
    this.finishExecute(prevState, nextState);
    return nextState;
  }
};

// src/react/loom-app/app/hooks/use-table-settings.ts
var import_react59 = __toESM(require_react());
var import_js_logger18 = __toESM(require_logger());
var useTableSettings = () => {
  const { doCommand } = useLoomState();
  const handleFrozenColumnsChange = import_react59.default.useCallback(
    (numColumns) => {
      import_js_logger18.default.trace("handleFrozenColumnsChange", { numColumns });
      doCommand(
        new TableSettingsUpdateCommand("numFrozenColumns", numColumns)
      );
    },
    [doCommand]
  );
  function handleCalculationRowToggle(value) {
    import_js_logger18.default.trace("handleCalculationRowToggle");
    doCommand(new TableSettingsUpdateCommand("showCalculationRow", value));
  }
  return {
    onFrozenColumnsChange: handleFrozenColumnsChange,
    onCalculationRowToggle: handleCalculationRowToggle
  };
};

// src/react/loom-app/app/hooks/use-focus/utils.ts
var getFocusLayerEl = (topMenu, appId) => {
  if (topMenu) {
    const topMenuEl = document.getElementById(topMenu.id);
    if (!topMenuEl)
      throw Error("No top menu element found");
    return topMenuEl;
  }
  const appEl = document.getElementById(appId);
  if (!appEl)
    throw Error("No app element found");
  return appEl;
};
var getFocusableEls = (layerEl) => {
  const focusableEls = layerEl.querySelectorAll(".dataloom-focusable");
  const arr = Array.from(focusableEls);
  if (isMenuEl(layerEl)) {
    const menuId = layerEl.id;
    const menuTrigger = findMenuTriggerEl(menuId);
    if (menuTrigger) {
      return [menuTrigger, ...arr];
    }
  }
  return arr;
};
var focusNextElement = (layerEl, focusableEls) => {
  const focusedEl = document.activeElement;
  if (focusedEl) {
    const currentIndex = Array.from(focusableEls).indexOf(focusedEl);
    if (currentIndex !== -1) {
      let index = currentIndex + 1;
      if (index > focusableEls.length - 1)
        index = 0;
      focusableEls[index].focus();
      return;
    }
  }
  const selectedEl = layerEl.querySelector(".dataloom-selected");
  if (selectedEl) {
    selectedEl.focus();
  } else {
    focusableEls[0].focus();
  }
};
var getNumOptionBarFocusableEls = (appEl) => {
  const el = appEl.querySelector(
    ".dataloom-option-bar"
  );
  if (!el)
    throw Error("No option bar found");
  return getFocusableEls(el).length;
};
var getNumBottomBarFocusableEl = (appEl) => {
  const el = appEl.querySelector(
    ".dataloom-bottom-bar"
  );
  if (!el)
    throw Error("No bottom bar found");
  return getFocusableEls(el).length;
};
var isArrowKeyPressed = (e, isMenuOpen) => {
  if (isMenuOpen) {
    return e.key === "ArrowDown" || e.key === "ArrowUp";
  }
  return e.key === "ArrowDown" || e.key === "ArrowUp" || e.key === "ArrowLeft" || e.key === "ArrowRight";
};
var isMenuEl = (el) => {
  return el.classList.contains("dataloom-menu");
};

// src/react/loom-app/app/hooks/use-focus/move-focus.ts
var moveMenuFocusUp = (focusableEls, currentIndex) => {
  let index = currentIndex - 1;
  if (index < 0)
    index = focusableEls.length - 1;
  return focusableEls[index];
};
var moveMenuFocusDown = (focusableEls, currentIndex) => {
  let index = currentIndex + 1;
  if (index > focusableEls.length - 1)
    index = 0;
  return focusableEls[index];
};
var moveFocusLeft = (focusableEls, currentIndex) => {
  let index = currentIndex - 1;
  if (index < 0)
    index = focusableEls.length - 1;
  return focusableEls[index];
};
var moveFocusRight = (focusableEls, currentIndex) => {
  let index = currentIndex + 1;
  if (index > focusableEls.length - 1)
    index = 0;
  return focusableEls[index];
};
var moveFocusUp = (focusableEls, numOptionBarFocusableEls, numBottomBarFocusableEls, numColumns, numBodyRows, currentIndex) => {
  const optionBarIndexEnd = numOptionBarFocusableEls - 1;
  const bottomBarIndexStart = focusableEls.length - numBottomBarFocusableEls;
  if (currentIndex <= optionBarIndexEnd + numColumns) {
    return focusableEls[0];
  }
  if (currentIndex >= bottomBarIndexStart - numColumns && currentIndex < bottomBarIndexStart) {
    if (numBodyRows === 0)
      return focusableEls[currentIndex - numColumns - 1];
    return focusableEls[currentIndex - numColumns];
  }
  if (currentIndex >= bottomBarIndexStart && currentIndex < focusableEls.length)
    return focusableEls[bottomBarIndexStart - numColumns];
  if (currentIndex === optionBarIndexEnd + numColumns + 2)
    return focusableEls[currentIndex - 1 - numColumns];
  if (currentIndex > optionBarIndexEnd + numColumns + 2 && currentIndex <= optionBarIndexEnd + numColumns + 2 + numColumns)
    return focusableEls[currentIndex - 2 - numColumns];
  return focusableEls[currentIndex - 1 - numColumns];
};
var moveFocusDown = (focusableEls, numOptionBarFocusableEls, numBottomBarFocusableEls, numColumns, numBodyRows, currentIndex) => {
  const optionBarIndexEnd = numOptionBarFocusableEls - 1;
  const firstColumnIndex = optionBarIndexEnd + 1;
  const bottomBarIndexStart = focusableEls.length - numBottomBarFocusableEls;
  if (currentIndex >= bottomBarIndexStart)
    return focusableEls[focusableEls.length - 1];
  if (currentIndex >= 0 && currentIndex <= optionBarIndexEnd)
    return focusableEls[firstColumnIndex];
  if (currentIndex >= bottomBarIndexStart - numColumns && currentIndex < bottomBarIndexStart)
    return focusableEls[bottomBarIndexStart];
  if (currentIndex > optionBarIndexEnd && currentIndex <= optionBarIndexEnd + numColumns) {
    if (numBodyRows === 0)
      return focusableEls[currentIndex + numColumns + 1];
    return focusableEls[currentIndex + numColumns + 2];
  }
  if (currentIndex >= bottomBarIndexStart - numColumns - numColumns && currentIndex < bottomBarIndexStart - numColumns)
    return focusableEls[currentIndex + numColumns];
  if (currentIndex === optionBarIndexEnd + numColumns + 1)
    return focusableEls[currentIndex + numColumns + 1];
  return focusableEls[currentIndex + numColumns + 1];
};

// src/react/loom-app/app/hooks/use-focus/index.tsx
var import_js_logger19 = __toESM(require_logger());
function useFocus() {
  const { reactAppId } = useAppMount();
  const { loomState } = useLoomState();
  const { topMenu, onClearMenuTriggerFocus } = useMenuOperations();
  function handleKeyDown(e) {
    import_js_logger19.default.trace("useFocus handleKeyDown");
    if (e.key === "Tab") {
      onClearMenuTriggerFocus();
      e.preventDefault();
      const layerEl = getFocusLayerEl(topMenu, reactAppId);
      const focusableEls = getFocusableEls(layerEl);
      if (focusableEls.length === 0)
        return;
      focusNextElement(layerEl, focusableEls);
    } else if (isArrowKeyPressed(e, topMenu !== null)) {
      const layerEl = getFocusLayerEl(topMenu, reactAppId);
      const focusableEls = getFocusableEls(layerEl);
      if (focusableEls.length === 0)
        return;
      e.preventDefault();
      const focusedEl = document.activeElement;
      let index = -1;
      if (focusedEl)
        index = Array.from(focusableEls).indexOf(focusedEl);
      const numVisibleColumns = loomState.model.columns.filter(
        (column) => column.isVisible
      ).length;
      const numRows = loomState.model.rows.length;
      let elementToFocus = null;
      switch (e.key) {
        case "ArrowLeft":
          elementToFocus = moveFocusLeft(focusableEls, index);
          break;
        case "ArrowRight":
          elementToFocus = moveFocusRight(focusableEls, index);
          break;
        case "ArrowUp":
          if (topMenu !== null) {
            elementToFocus = moveMenuFocusUp(focusableEls, index);
          } else {
            const numOptionBarFocusableEls = getNumOptionBarFocusableEls(layerEl);
            const numBottomBarFocusableEls = getNumBottomBarFocusableEl(layerEl);
            elementToFocus = moveFocusUp(
              focusableEls,
              numOptionBarFocusableEls,
              numBottomBarFocusableEls,
              numVisibleColumns,
              numRows,
              index
            );
          }
          break;
        case "ArrowDown":
          if (topMenu !== null) {
            elementToFocus = moveMenuFocusDown(focusableEls, index);
          } else {
            const numOptionBarFocusableEls = getNumOptionBarFocusableEls(layerEl);
            const numBottomBarFocusableEls = getNumBottomBarFocusableEl(layerEl);
            elementToFocus = moveFocusDown(
              focusableEls,
              numOptionBarFocusableEls,
              numBottomBarFocusableEls,
              numVisibleColumns,
              numRows,
              index
            );
            break;
          }
      }
      if (elementToFocus !== null) {
        onClearMenuTriggerFocus();
        elementToFocus.focus();
      }
    }
  }
  return {
    onFocusKeyDown: handleKeyDown
  };
}

// src/react/loom-app/app/hooks/use-source/index.ts
var import_react60 = __toESM(require_react());

// src/shared/loom-state/commands/source-add-command.ts
var import_lodash12 = __toESM(require_lodash());
var SourceAddCommand = class extends loom_state_command_default {
  constructor(source) {
    super(false);
    this.newSource = source;
  }
  execute(prevState) {
    const { sources, columns, rows } = prevState.model;
    let nextColumns = (0, import_lodash12.cloneDeep)(columns);
    let nextRows = (0, import_lodash12.cloneDeep)(rows);
    const nextSources = [...sources, this.newSource];
    const sourceFileColumn = columns.find(
      (column) => column.type === "source-file" /* SOURCE_FILE */
    );
    if (!sourceFileColumn) {
      const result = columnAddExecute(nextColumns, nextRows, {
        type: "source-file" /* SOURCE_FILE */,
        content: "Source File",
        insertIndex: 0
      });
      const { columns: columns2, rows: rows2 } = result;
      nextColumns = columns2;
      nextRows = rows2;
    }
    const sourceColumn = columns.find(
      (column) => column.type === "source" /* SOURCE */
    );
    if (!sourceColumn) {
      const result = columnAddExecute(nextColumns, nextRows, {
        type: "source" /* SOURCE */,
        content: "Source",
        insertIndex: 0
      });
      const { columns: columns2, rows: rows2 } = result;
      nextColumns = columns2;
      nextRows = rows2;
    }
    const nextState = {
      ...prevState,
      model: {
        ...prevState.model,
        columns: nextColumns,
        sources: nextSources,
        rows: nextRows
      }
    };
    this.finishExecute(prevState, nextState);
    return nextState;
  }
};

// src/shared/loom-state/commands/source-delete-command.ts
var import_lodash13 = __toESM(require_lodash());
var SourceDeleteCommand = class extends loom_state_command_default {
  constructor(id2) {
    super(false);
    this.id = id2;
  }
  execute(prevState) {
    const { sources, rows, columns, filters } = prevState.model;
    let nextColumns = (0, import_lodash13.cloneDeep)(columns);
    let nextRows = (0, import_lodash13.cloneDeep)(rows);
    let nextFilters = (0, import_lodash13.cloneDeep)(filters);
    const isLastSource = sources.length === 1;
    if (isLastSource) {
      const sourceColumn = nextColumns.find(
        (column) => column.type === "source" /* SOURCE */
      );
      if (!sourceColumn)
        throw new ColumnNotFoundError({ type: "source" /* SOURCE */ });
      const result1 = columnDeleteExecute(
        nextColumns,
        nextRows,
        nextFilters,
        sourceColumn.id
      );
      if (result1 === null) {
        throw new Error("Cannot delete source column");
      }
      const {
        nextColumns: nextColumns1,
        nextFilters: nextFilters1,
        nextRows: nextRows1
      } = result1;
      nextRows = nextRows1;
      nextColumns = nextColumns1;
      nextFilters = nextFilters1;
      const sourceFileColumn = columns.find(
        (column) => column.type === "source-file" /* SOURCE_FILE */
      );
      if (!sourceFileColumn)
        throw new ColumnNotFoundError({ type: "file" /* FILE */ });
      const result2 = columnDeleteExecute(
        nextColumns,
        nextRows,
        nextFilters,
        sourceFileColumn.id
      );
      if (result2 === null) {
        throw new Error("Cannot delete source file column");
      }
      const {
        nextColumns: nextColumns2,
        nextRows: nextRows2,
        nextFilters: nextFilters2
      } = result2;
      nextColumns = nextColumns2;
      nextRows = nextRows2;
      nextFilters = nextFilters2;
    }
    const nextSources = sources.filter((source) => {
      if (source.id === this.id)
        return false;
      return true;
    });
    nextRows = nextRows.filter((row) => {
      const { sourceId } = row;
      if (sourceId === this.id) {
        return false;
      }
      return true;
    });
    const nextState = {
      ...prevState,
      model: {
        ...prevState.model,
        sources: nextSources,
        rows: nextRows,
        columns: nextColumns,
        filters: nextFilters
      }
    };
    this.finishExecute(prevState, nextState);
    return nextState;
  }
};

// src/shared/frontmatter/index.ts
var deserializeFrontmatterForCell = (app, column, path) => {
  var _a2;
  const { frontmatterKey } = column;
  if (!frontmatterKey)
    return null;
  const fileMetadata = app.metadataCache.getCache(path);
  if (!fileMetadata)
    return null;
  const frontmatter = fileMetadata.frontmatter;
  if (!frontmatter)
    return null;
  const frontmatterValue = frontmatter[frontmatterKey];
  if (!frontmatterValue)
    return null;
  const assignedType = (_a2 = getAssignedPropertyType(app, frontmatterKey)) != null ? _a2 : "text" /* TEXT */;
  const { id: id2, tags, type } = column;
  switch (type) {
    case "text" /* TEXT */: {
      if (typeof frontmatterValue !== "string")
        return {
          newCell: createTextCell(id2, {
            hasValidFrontmatter: false
          })
        };
      const newCell = createTextCell(id2, {
        content: frontmatterValue,
        hasValidFrontmatter: true
      });
      return {
        newCell
      };
    }
    case "embed" /* EMBED */: {
      if (typeof frontmatterValue !== "string")
        return {
          newCell: createEmbedCell(id2, {
            hasValidFrontmatter: false
          })
        };
      const isExternal = isExternalLink(frontmatterValue);
      let pathOrUrl = "";
      let pathAlias = null;
      if (isUrlLink(frontmatterValue)) {
        pathOrUrl = frontmatterValue;
      } else {
        const { path: path2, alias } = extractWikiLinkComponents(frontmatterValue);
        if (path2 !== null) {
          pathOrUrl = path2;
          pathAlias = alias;
        }
      }
      const newCell = createEmbedCell(id2, {
        isExternal,
        pathOrUrl,
        alias: pathAlias,
        hasValidFrontmatter: true
      });
      return {
        newCell
      };
    }
    case "file" /* FILE */: {
      if (typeof frontmatterValue !== "string")
        return {
          newCell: createFileCell(id2, {
            hasValidFrontmatter: false
          })
        };
      const { path: path2, alias } = extractWikiLinkComponents(frontmatterValue);
      const newCell = createFileCell(id2, {
        path: path2 != null ? path2 : "",
        alias: alias != null ? alias : "",
        hasValidFrontmatter: true
      });
      return {
        newCell
      };
    }
    case "number" /* NUMBER */: {
      if (typeof frontmatterValue !== "number")
        return {
          newCell: createNumberCell(id2, {
            hasValidFrontmatter: false
          })
        };
      const newCell = createNumberCell(id2, {
        value: frontmatterValue,
        hasValidFrontmatter: true
      });
      return {
        newCell
      };
    }
    case "checkbox" /* CHECKBOX */: {
      if (typeof frontmatterValue !== "boolean")
        return {
          newCell: createCheckboxCell(id2, {
            hasValidFrontmatter: true
          })
        };
      const newCell = createCheckboxCell(id2, {
        value: frontmatterValue,
        hasValidFrontmatter: true
      });
      return {
        newCell
      };
    }
    case "date" /* DATE */: {
      if (typeof frontmatterValue !== "string" || parseDateTime(frontmatterValue) === null)
        return {
          newCell: createDateCell(id2, {
            hasValidFrontmatter: false
          })
        };
      let dateString = frontmatterValue;
      const DATE_WITHOUT_TIME_REGEX = /^\d{4}-\d{2}-\d{2}$/;
      if (dateString.match(DATE_WITHOUT_TIME_REGEX)) {
        dateString += "T00:00:00";
      }
      const newCell = createDateCell(id2, {
        dateTime: new Date(dateString).toISOString(),
        hasValidFrontmatter: true
      });
      const includeTime = assignedType === "datetime" /* DATETIME */;
      return {
        newCell,
        includeTime
      };
    }
    case "tag" /* TAG */: {
      if (typeof frontmatterValue !== "string")
        return {
          newCell: createTagCell(id2, {
            hasValidFrontmatter: false
          })
        };
      let newTag = null;
      let cellTagId = null;
      if (frontmatterValue !== "") {
        const existingTag = tags.find(
          (tag) => tag.content === frontmatterValue
        );
        if (existingTag) {
          cellTagId = existingTag.id;
        } else {
          const tag = createTag(frontmatterValue);
          cellTagId = tag.id;
          newTag = tag;
        }
      }
      const newCell = createTagCell(id2, {
        tagId: cellTagId,
        hasValidFrontmatter: true
      });
      const nextTags = [...column.tags, ...newTag ? [newTag] : []];
      return {
        newCell,
        nextTags
      };
    }
    case "multi-tag" /* MULTI_TAG */: {
      if (typeof frontmatterValue !== "object") {
        return {
          newCell: createMultiTagCell(id2, {
            hasValidFrontmatter: false,
            multiTagSortDir: column.multiTagSortDir
          })
        };
      }
      const newTags = [];
      const cellTagIds = [];
      frontmatterValue.forEach((tagContent) => {
        if (tagContent !== "") {
          const existingTag = tags.find(
            (tag) => tag.content === tagContent
          );
          if (existingTag) {
            cellTagIds.push(existingTag.id);
          } else {
            const newTag = createTag(tagContent);
            cellTagIds.push(newTag.id);
            newTags.push(newTag);
          }
        }
      });
      const newCell = createMultiTagCell(id2, {
        tagIds: cellTagIds,
        hasValidFrontmatter: true,
        multiTagSortDir: column.multiTagSortDir
      });
      const nextTags = [...column.tags, ...newTags];
      return {
        newCell,
        nextTags
      };
    }
    default:
      return null;
  }
};

// src/shared/loom-state/update-state-from-sources.tsx
var import_lodash14 = __toESM(require_lodash());
function updateStateFromSources(app, sources, columns, numRows) {
  const sourceFileMap = /* @__PURE__ */ new Map();
  sources.forEach((source) => {
    const { id: id2, type } = source;
    let sourceFiles = [];
    switch (type) {
      case "folder" /* FOLDER */: {
        sourceFiles = findRowsFromFolderSource(
          app,
          source
        );
        break;
      }
      case "frontmatter" /* FRONTMATTER */:
        sourceFiles = findRowsFromFrontmatterSource(app, source);
        break;
      default:
        throw new Error(`Source type not handled: ${type}`);
    }
    sourceFiles.forEach((file) => {
      sourceFileMap.set(file, id2);
    });
  });
  const newRows = [];
  const nextColumns = (0, import_lodash14.cloneDeep)(columns);
  const uniqueMap = /* @__PURE__ */ new Map();
  const seenValues = /* @__PURE__ */ new Set();
  sourceFileMap.forEach((value, key) => {
    const { path } = key;
    if (!seenValues.has(path)) {
      seenValues.add(path);
      uniqueMap.set(key, value);
    }
  });
  uniqueMap.forEach((sourceId, file) => {
    const cells = [];
    nextColumns.forEach((column) => {
      const { path } = file;
      const { id: id2, type, frontmatterKey } = column;
      let newCell = null;
      if (type === "source-file" /* SOURCE_FILE */) {
        newCell = createSourceFileCell(id2, { path });
      } else if (frontmatterKey !== null) {
        const result = deserializeFrontmatterForCell(app, column, path);
        if (result !== null) {
          const { newCell: cell, nextTags, includeTime } = result;
          newCell = cell;
          if (nextTags)
            column.tags = nextTags;
          if (includeTime)
            column.includeTime = true;
        }
      }
      if (newCell === null)
        newCell = createCellForType(id2, type);
      cells.push(newCell);
    });
    const row = createRow(numRows + newRows.length, {
      cells,
      sourceId,
      creationDateTime: getDateTimeFromUnixTime(file.stat.ctime),
      lastEditedDateTime: getDateTimeFromUnixTime(file.stat.mtime)
    });
    newRows.push(row);
  });
  return {
    newRows,
    nextColumns
  };
}
var findRowsFromFolderSource = (app, source) => {
  const { path, includeSubfolders } = source;
  const folder = app.vault.getAbstractFileByPath(path);
  if (!folder)
    return [];
  const files = app.vault.getMarkdownFiles().filter((file) => {
    var _a2, _b;
    if (includeSubfolders) {
      return (_a2 = file.parent) == null ? void 0 : _a2.path.startsWith(folder.path);
    }
    return ((_b = file.parent) == null ? void 0 : _b.path) === folder.path;
  });
  return files;
};
var findRowsFromFrontmatterSource = (app, source) => {
  const { propertyKey, propertyType, filterCondition, filterText } = source;
  const files = app.vault.getMarkdownFiles().filter((file) => {
    const { path } = file;
    const fileMetadata = app.metadataCache.getCache(path);
    if (!fileMetadata)
      return false;
    const frontmatter = fileMetadata.frontmatter;
    if (!frontmatter)
      return false;
    const propertyValue = frontmatter[propertyKey];
    if (propertyValue === void 0 || propertyValue === null)
      return false;
    if (filterCondition === null)
      return false;
    if (!doesMatchFilterCondition(
      propertyType,
      propertyValue,
      filterCondition,
      filterText
    ))
      return false;
    return true;
  });
  return files;
};
var doesMatchFilterCondition = (propertyType, propertyValue, filterCondition, filterText) => {
  switch (propertyType) {
    case "text" /* TEXT */: {
      const value = propertyValue;
      return doesTextMatchFilter(
        value,
        filterCondition,
        filterText,
        false
      );
    }
    case "checkbox" /* CHECKBOX */: {
      const value = propertyValue;
      return doesBooleanMatchFilter(
        value,
        filterCondition,
        filterText === "true" ? true : false
      );
    }
    case "number" /* NUMBER */: {
      const value = propertyValue;
      return doesNumberMatchFilter(
        value,
        filterCondition,
        filterText,
        false
      );
    }
    case "date" /* DATE */:
    case "datetime" /* DATETIME */: {
      const value = propertyValue;
      return doesDateMatchFilter(
        value,
        filterCondition,
        filterText,
        null,
        false
      );
    }
    case "aliases" /* ALIASES */:
    case "tags" /* TAGS */:
    case "multitext" /* MULTITEXT */: {
      const value = propertyValue;
      return doesListMatchFilter(value, filterCondition, filterText);
    }
    default:
      return false;
  }
};
var doesListMatchFilter = (values, condition, filterText) => {
  const filterTextValues = filterText.split(",").map((text) => text.trim());
  switch (condition) {
    case "contains" /* CONTAINS */:
      return filterTextValues.every((v2) => values.includes(v2));
    case "does-not-contain" /* DOES_NOT_CONTAIN */:
      return filterTextValues.every((v2) => !values.includes(v2));
    case "is-empty" /* IS_EMPTY */:
      return values.length === 0;
    case "is-not-empty" /* IS_NOT_EMPTY */:
      return values.length !== 0;
    default:
      return false;
  }
};

// src/shared/loom-state/commands/source-update-command.ts
var SourceUpdateCommand = class extends loom_state_command_default {
  constructor(id2, data, isPartial = true) {
    super(false);
    this.id = id2;
    this.data = data;
    this.isPartial = isPartial;
  }
  execute(prevState) {
    const { sources } = prevState.model;
    const nextSources = sources.map((source) => {
      if (source.id === this.id) {
        let newSource = this.data;
        if (this.isPartial)
          newSource = { ...source, ...this.data };
        return newSource;
      }
      return source;
    });
    const nextState = {
      ...prevState,
      model: {
        ...prevState.model,
        sources: nextSources
      }
    };
    this.finishExecute(prevState, nextState);
    return nextState;
  }
};

// src/react/loom-app/app/hooks/use-source/index.ts
var import_js_logger20 = __toESM(require_logger());
var HOOK_NAME = "useSource";
var useSource = () => {
  const { app } = useAppMount();
  const { doCommand, loomState, setLoomState } = useLoomState();
  const { sources, columns } = loomState.model;
  const frontmatterKeyHash = JSON.stringify(columns.map((column) => column.frontmatterKey));
  const sourcesHash = JSON.stringify(sources);
  const updateRowsFromSources = import_react60.default.useCallback(
    (fromObsidianEvent = true) => {
      import_js_logger20.default.trace(HOOK_NAME, "updateRowsFromSources", "called");
      setLoomState((prevState) => {
        if (fromObsidianEvent) {
          if (Date.now() - prevState.time < 1e3) {
            import_js_logger20.default.trace(HOOK_NAME, "updateRowsFromSource", "event ignored because it was called in the last 1000ms.");
            return prevState;
          }
        }
        const { sources: sources2, columns: columns2, rows } = prevState.state.model;
        const result = updateStateFromSources(
          app,
          sources2,
          columns2,
          rows.length
        );
        const { newRows, nextColumns } = result;
        const internalRows = rows.filter(
          (row) => row.sourceId === null
        );
        const nextRows = [...internalRows, ...newRows];
        return {
          state: {
            ...prevState.state,
            model: {
              ...prevState.state.model,
              rows: nextRows,
              columns: nextColumns
            }
          },
          shouldSaveToDisk: false,
          shouldSaveFrontmatter: true,
          time: Date.now()
        };
      });
    },
    [app, setLoomState]
  );
  import_react60.default.useEffect(() => {
    updateRowsFromSources(false);
  }, [sourcesHash, frontmatterKeyHash, updateRowsFromSources]);
  import_react60.default.useEffect(() => {
    EventManager.getInstance().on("file-create", updateRowsFromSources);
    EventManager.getInstance().on(
      "file-frontmatter-change",
      updateRowsFromSources
    );
    EventManager.getInstance().on(
      "property-type-change",
      updateRowsFromSources
    );
    EventManager.getInstance().on("file-delete", updateRowsFromSources);
    EventManager.getInstance().on("folder-delete", updateRowsFromSources);
    EventManager.getInstance().on("folder-rename", updateRowsFromSources);
    EventManager.getInstance().on("file-rename", updateRowsFromSources);
    return () => {
      EventManager.getInstance().off(
        "file-create",
        updateRowsFromSources
      );
      EventManager.getInstance().off(
        "file-frontmatter-change",
        updateRowsFromSources
      );
      EventManager.getInstance().off(
        "property-type-change",
        updateRowsFromSources
      );
      EventManager.getInstance().off(
        "folder-rename",
        updateRowsFromSources
      );
      EventManager.getInstance().off(
        "file-rename",
        updateRowsFromSources
      );
      EventManager.getInstance().off(
        "file-delete",
        updateRowsFromSources
      );
      EventManager.getInstance().off(
        "folder-delete",
        updateRowsFromSources
      );
    };
  }, [updateRowsFromSources, app]);
  function handleSourceAdd(source) {
    import_js_logger20.default.trace("handleSourceAdd");
    doCommand(new SourceAddCommand(source));
  }
  function handleSourceDelete(id2) {
    import_js_logger20.default.trace("handleSourceDelete", { id: id2 });
    doCommand(new SourceDeleteCommand(id2));
  }
  function handleSourceUpdate(id2, data) {
    import_js_logger20.default.trace("handleSourceUpdate", {
      id: id2,
      data
    });
    doCommand(new SourceUpdateCommand(id2, data));
  }
  return {
    onSourceAdd: handleSourceAdd,
    onSourceDelete: handleSourceDelete,
    onSourceUpdate: handleSourceUpdate
  };
};

// src/react/loom-app/app/hooks/use-app-events/index.tsx
var import_js_logger21 = __toESM(require_logger());
var import_react61 = __toESM(require_react());
var useAppEvents = () => {
  const { topMenu, onRequestClose, onClearMenuTriggerFocus } = useMenuOperations();
  const handleClick = import_react61.default.useCallback(
    (e) => {
      import_js_logger21.default.trace("App handleClick");
      e.stopPropagation();
      if (!topMenu) {
        onClearMenuTriggerFocus();
        return;
      }
      onRequestClose(topMenu.id, "save-and-close");
    },
    [topMenu, onRequestClose, onClearMenuTriggerFocus]
  );
  return {
    onClick: handleClick
  };
};

// src/react/loom-app/app/hooks/use-menu-events.ts
var import_react62 = __toESM(require_react());
var import_lodash15 = __toESM(require_lodash());
var import_js_logger22 = __toESM(require_logger());
var useMenuEvents = () => {
  useCloseOnOutsideClick();
  useCloseOnObsidianModalOpen();
  useCloseOnMarkdownViewScroll();
  useLockTableScroll();
};
var useLockTableScroll = () => {
  const { reactAppId } = useAppMount();
  const { topMenu } = useMenuOperations();
  const hasLockRef = import_react62.default.useRef(false);
  import_react62.default.useEffect(() => {
    const appEl = document.getElementById(reactAppId);
    if (!appEl)
      return;
    const tableContainerEl = appEl.querySelector(
      '[data-virtuoso-scroller="true"]'
    );
    if (!tableContainerEl)
      return;
    if (topMenu) {
      if (hasLockRef.current)
        return;
      hasLockRef.current = true;
      const { parentComponentId } = topMenu;
      if (!(parentComponentId == null ? void 0 : parentComponentId.includes("cell")))
        return;
      import_js_logger22.default.debug("useLockTableScroll cell menu opened. locking table scroll");
      tableContainerEl.style.overflow = "hidden";
    } else {
      hasLockRef.current = false;
      import_js_logger22.default.debug(
        "useLockTableScroll cell menu closed. unlocking table scroll"
      );
      tableContainerEl.style.overflow = "auto";
    }
  }, [topMenu, reactAppId]);
};
var useCloseOnMarkdownViewScroll = () => {
  const { reactAppId, isMarkdownView } = useAppMount();
  const { onCloseAll } = useMenuOperations();
  import_react62.default.useEffect(() => {
    var _a2;
    let pageScrollerEl;
    const THROTTLE_TIME_MILLIS = 100;
    const throttleHandleScroll = import_lodash15.default.throttle(
      handleScroll,
      THROTTLE_TIME_MILLIS
    );
    function handleScroll() {
      const openMenus = document.querySelectorAll(".dataloom-menu");
      if (openMenus.length === 0)
        return;
      for (const menu of openMenus) {
        menu.style.display = "none";
      }
      onCloseAll();
    }
    if (isMarkdownView) {
      const appEl = document.getElementById(reactAppId);
      if (!appEl)
        return;
      pageScrollerEl = (_a2 = appEl.closest(".markdown-preview-view")) != null ? _a2 : appEl.closest(".cm-scroller");
      pageScrollerEl == null ? void 0 : pageScrollerEl.addEventListener("scroll", throttleHandleScroll);
    }
    return () => pageScrollerEl == null ? void 0 : pageScrollerEl.removeEventListener("scroll", throttleHandleScroll);
  }, [onCloseAll, isMarkdownView, reactAppId]);
};
var useCloseOnOutsideClick = () => {
  const { app } = useAppMount();
  const { onCloseAll } = useMenuOperations();
  import_react62.default.useEffect(() => {
    function handleGlobalClick() {
      import_js_logger22.default.trace("handleGlobalClick");
      onCloseAll();
    }
    EventManager.getInstance().on("global-click", handleGlobalClick);
    return () => EventManager.getInstance().off("global-click", handleGlobalClick);
  }, [app, onCloseAll]);
};
var useCloseOnObsidianModalOpen = () => {
  const hasCloseLock = import_react62.default.useRef(false);
  const { topMenu, onCloseAll } = useMenuOperations();
  import_react62.default.useEffect(() => {
    if (!topMenu)
      hasCloseLock.current = false;
  }, [topMenu]);
  import_react62.default.useEffect(() => {
    function hasOpenModal() {
      return document.querySelector("body > .modal-container") !== null;
    }
    const observer = new MutationObserver((entries) => {
      if (hasCloseLock.current)
        return;
      for (const entry of entries) {
        if (entry.target === document.body) {
          if (hasOpenModal()) {
            import_js_logger22.default.info("obsidian modal opened. closing all menus");
            hasCloseLock.current = true;
            onCloseAll();
            break;
          }
        }
      }
    });
    observer.observe(document.body, { childList: true });
    return () => observer.disconnect();
  }, [onCloseAll]);
};

// src/react/loom-app/app/index.tsx
var import_js_logger23 = __toESM(require_logger());
var import_jsx_runtime147 = __toESM(require_jsx_runtime());
function App9() {
  const { reactAppId, isMarkdownView } = useAppMount();
  const { loomState, resizingColumnId, searchText, onRedo, onUndo } = useLoomState();
  const tableRef = import_react63.default.useRef(null);
  const appRef = import_react63.default.useRef(null);
  useExportEvents(loomState);
  useRowEvents();
  useColumnEvents();
  useMenuEvents();
  const { onClick } = useAppEvents();
  const { onSourceAdd, onSourceDelete, onSourceUpdate } = useSource();
  const { onFocusKeyDown } = useFocus();
  const { onFrozenColumnsChange, onCalculationRowToggle } = useTableSettings();
  const { onFilterAdd, onFilterUpdate, onFilterDelete, filterByFilters: filterByFilters2 } = useFilter();
  const {
    onColumnDeleteClick,
    onColumnAddClick,
    onColumnTypeChange,
    onColumnChange,
    onColumnReorder
  } = useColumn();
  const {
    onRowAddClick,
    onRowDeleteClick,
    onRowInsertAboveClick,
    onRowInsertBelowClick,
    onRowReorder
  } = useRow();
  const { onCellChange } = useCell();
  const {
    onTagCellAdd,
    onTagAdd,
    onTagCellRemove,
    onTagCellMultipleRemove,
    onTagDeleteClick,
    onTagChange
  } = useTag();
  const { columns, filters, settings, sources } = loomState.model;
  const { numFrozenColumns, showCalculationRow } = settings;
  function handleScrollToTopClick() {
    var _a2;
    (_a2 = tableRef.current) == null ? void 0 : _a2.scrollToIndex(0);
  }
  function handleScrollToBottomClick() {
    var _a2;
    (_a2 = tableRef.current) == null ? void 0 : _a2.scrollToIndex(filteredRows.length - 1);
  }
  function handleKeyDown(e) {
    import_js_logger23.default.trace("App handleKeyDown");
    e.stopPropagation();
    if (isWindowsRedoDown(e) || isMacRedoDown(e)) {
      e.preventDefault();
      onRedo();
    } else if (isWindowsUndoDown(e) || isMacUndoDown(e)) {
      e.preventDefault();
      onUndo();
    } else {
      onFocusKeyDown(e);
    }
  }
  let filteredRows = filterByFilters2(loomState);
  filteredRows = filterRowsBySearch(
    sources,
    columns,
    filteredRows,
    searchText
  );
  let className = "dataloom-app";
  if (isMarkdownView)
    className += " dataloom-app--markdown-view";
  return /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)(
    "div",
    {
      ref: appRef,
      tabIndex: 0,
      id: reactAppId,
      className,
      onKeyDown: handleKeyDown,
      onClick,
      children: [
        /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
          OptionBar,
          {
            columns,
            sources,
            filters,
            showCalculationRow,
            onColumnChange,
            onFilterAddClick: onFilterAdd,
            onFilterDeleteClick: onFilterDelete,
            onFilterUpdate,
            onCalculationRowToggle,
            onSourceAdd,
            onSourceDelete,
            onSourceUpdate
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
          table_default,
          {
            ref: tableRef,
            sources,
            rows: filteredRows,
            columns,
            numFrozenColumns,
            resizingColumnId,
            showCalculationRow,
            onColumnDeleteClick,
            onColumnAddClick,
            onColumnTypeChange,
            onFrozenColumnsChange,
            onColumnReorder,
            onRowDeleteClick,
            onRowInsertAboveClick,
            onRowInsertBelowClick,
            onColumnChange,
            onCellChange,
            onTagAdd,
            onTagCellAdd,
            onTagCellRemove,
            onTagCellMultipleRemove,
            onTagChange,
            onTagDeleteClick,
            onRowReorder
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
          BottomBar,
          {
            onRowAddClick,
            onScrollToTopClick: handleScrollToTopClick,
            onScrollToBottomClick: handleScrollToBottomClick,
            onUndoClick: onUndo,
            onRedoClick: onRedo
          }
        )
      ]
    }
  );
}

// src/react/shared/error-boundary/index.tsx
var import_react64 = __toESM(require_react());
var import_jsx_runtime148 = __toESM(require_jsx_runtime());
var ErrorBoundary = class extends import_react64.default.Component {
  constructor(props) {
    super(props);
    this.state = { hasError: false };
  }
  componentDidCatch(error, errorInfo) {
    this.setState({
      hasError: true,
      errorInfo,
      errorMessage: error.message
    });
  }
  render() {
    var _a2, _b;
    let copyErrorMessage = "";
    if (this.state.hasError) {
      copyErrorMessage = `Error message: ${this.state.errorMessage}
Error info: ${(_a2 = this.state.errorInfo) == null ? void 0 : _a2.componentStack}`;
      return /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
        ErrorDisplay,
        {
          title: "DataLoom experienced an error",
          errorMessage: (_b = this.state.errorMessage) != null ? _b : "",
          copyErrorMessage,
          helpMessage: "For help fixing this error please make a bug issue in the GitHub repository",
          helpURL: "https://github.com/decaf-dev/obsidian-dataloom/issues/new?assignees=&labels=bug&projects=&template=BUG.yml"
        }
      );
    }
    return this.props.children;
  }
};
var error_boundary_default = ErrorBoundary;

// src/react/loom-app/index.tsx
var import_jsx_runtime149 = __toESM(require_jsx_runtime());
function LoomApp({
  app,
  reactAppId,
  mountLeaf,
  isMarkdownView,
  store: store2,
  loomFile,
  loomState,
  onSaveState
}) {
  return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(error_boundary_default, { children: /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
    AppMountProvider,
    {
      app,
      mountLeaf,
      reactAppId,
      isMarkdownView,
      loomFile,
      children: /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(Provider_default, { store: store2, children: /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
        LoomStateProvider,
        {
          initialState: loomState,
          onSaveState,
          children: /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(DragProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(MenuProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(App9, {}) }) })
        }
      ) })
    }
  ) });
}

// src/obsidian/embedded/embedded-app-manager.tsx
var import_jsx_runtime150 = __toESM(require_jsx_runtime());
var embeddedApps = [];
var loadPreviewModeApps = (app, markdownLeaves, pluginVersion) => {
  for (let i2 = 0; i2 < markdownLeaves.length; i2++) {
    const leaf = markdownLeaves[i2];
    const view = leaf.view;
    let mode = "";
    if (view instanceof import_obsidian17.MarkdownView) {
      mode = view.getMode();
    }
    if (mode === "preview")
      loadEmbeddedLoomApps(app, pluginVersion, leaf, "preview");
  }
};
var loadEmbeddedLoomApps = (app, pluginVersion, markdownLeaf, mode) => {
  const view = markdownLeaf.view;
  const linkEls = getEmbeddedLoomLinkEls(view, mode);
  linkEls.forEach(
    (linkEl) => processLinkEl(app, pluginVersion, markdownLeaf, linkEl, mode)
  );
};
var purgeEmbeddedLoomApps = (leaves) => {
  embeddedApps = embeddedApps.filter(
    (app) => leaves.find(
      (l2) => {
        var _a2;
        return ((_a2 = l2.view.file) == null ? void 0 : _a2.path) === app.leafFilePath;
      }
    )
  );
};
var processLinkEl = async (app, pluginVersion, leaf, linkEl, mode) => {
  var _a2, _b;
  setLinkSize(linkEl);
  if (hasLoadedEmbeddedLoom(linkEl))
    return;
  const sourcePath = (_b = (_a2 = leaf.view.file) == null ? void 0 : _a2.path) != null ? _b : "";
  const file = findEmbeddedLoomFile(app, linkEl, sourcePath);
  if (!file)
    return;
  resetLinkStyles(linkEl);
  const containerEl = renderContainerEl(linkEl);
  const data = await app.vault.read(file);
  const appId = createAppId();
  const embeddedApp = {
    id: appId,
    leaf,
    leafFilePath: sourcePath,
    containerEl,
    file,
    mode
  };
  embeddedApps.push(embeddedApp);
  const root = (0, import_client4.createRoot)(containerEl);
  embeddedApp.root = root;
  try {
    const state = deserializeState(data, pluginVersion);
    renderApp(app, appId, leaf, file, root, state);
  } catch (err) {
    renderErrorApp(root, err);
  }
};
var renderApp = (app, reactAppId, leaf, file, root, state) => {
  const THROTTLE_TIME_MILLIS = 2e3;
  const throttleHandleSave = import_lodash16.default.throttle(handleSave, THROTTLE_TIME_MILLIS);
  root.render(
    /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
      LoomApp,
      {
        app,
        reactAppId,
        isMarkdownView: true,
        loomFile: file,
        mountLeaf: leaf,
        store,
        loomState: state,
        onSaveState: (appId, state2, shouldSaveFrontmatter) => throttleHandleSave(
          app,
          file,
          appId,
          state2,
          shouldSaveFrontmatter
        )
      }
    )
  );
};
var renderErrorApp = (root, error) => {
  root.render(/* @__PURE__ */ (0, import_jsx_runtime150.jsx)(ErrorApp, { error, isEmbeddedApp: true }));
};
var handleSave = async (app, file, appId, state, shouldSaveFrontmatter) => {
  LastSavedManager.getInstance().setLastSavedFile(file.path);
  if (shouldSaveFrontmatter) {
    await serializeFrontmatter(app, state);
  }
  const serialized = serializeState(state);
  await app.vault.modify(file, serialized);
  EventManager.getInstance().emit(
    "app-refresh-by-state",
    file.path,
    appId,
    state
  );
};
var renderContainerEl = (linkEl) => {
  const containerEl = linkEl.createDiv({
    cls: "dataloom-embedded-container"
  });
  containerEl.style.height = "100%";
  containerEl.style.width = "100%";
  containerEl.style.padding = "10px 0px";
  containerEl.addEventListener("click", (e) => {
    e.stopPropagation();
  });
  return containerEl;
};
var resetLinkStyles = (linkEl) => {
  linkEl.empty();
  linkEl.style.backgroundColor = "var(--color-primary)";
  linkEl.style.cursor = "unset";
  linkEl.style.margin = "0px";
  linkEl.style.padding = "0px";
};
var setLinkSize = (linkEl) => {
  const { defaultEmbedWidth, defaultEmbedHeight } = store.getState().global.settings;
  const width = getLinkWidth(linkEl, defaultEmbedWidth);
  const height = getLinkHeight(linkEl, defaultEmbedHeight);
  linkEl.style.width = width;
  linkEl.style.height = height;
};

// src/obsidian/editing-view-plugin.tsx
function EditingViewPlugin(app, pluginVersion) {
  return import_view.ViewPlugin.fromClass(
    /**
     * This plugin is responsible for rendering the loom app in live preview mode.
     * It is instantiated for each open leaf
     */
    class EditingViewPlugin {
      /**
       * Called whenever the markdown of the current leaf is updated.
       */
      update(update) {
        const markdownLeaves = app.workspace.getLeavesOfType("markdown");
        const activeLeaf = markdownLeaves.find(
          //@ts-expect-error - private property
          (leaf) => leaf.view.editor.cm === update.view
        );
        if (!activeLeaf)
          return;
        loadEmbeddedLoomApps(app, pluginVersion, activeLeaf, "source");
      }
    }
  );
}

// src/data/loom-file.ts
var import_obsidian18 = require("obsidian");

// src/data/file-operations.ts
var createFolder = async (app, folderPath) => {
  try {
    await app.vault.createFolder(folderPath);
  } catch (err) {
    const error = err;
    if (error.message.includes("already exists"))
      return;
    throw err;
  }
};
var createFile = async (app, filePath, data, numExisting = 0) => {
  try {
    const filePathExtension = splitFileExtension(filePath);
    if (filePathExtension == null)
      throw new SyntaxError("File must include an extension");
    const numIterations = numExisting > 0 ? " " + numExisting : "";
    const filePathWithIteration = filePathExtension[0] + numIterations + filePathExtension[1];
    const file = await app.vault.create(filePathWithIteration, data);
    return file;
  } catch (err) {
    const error = err;
    if (error.message.includes("already exists")) {
      return createFile(app, filePath, data, numExisting + 1);
    }
    throw err;
  }
};
var splitFileExtension = (filePath) => {
  if (filePath.match(EXTENSION_REGEX)) {
    const periodIndex = filePath.lastIndexOf(".");
    return [
      filePath.substring(0, periodIndex),
      filePath.substring(periodIndex)
    ];
  }
  return null;
};

// src/data/loom-file.ts
var createLoomFile = async (app, pluginVersion, defaultFrozenColumnCount, folderOptions) => {
  const {
    contextMenuFolderPath,
    createAtAttachmentsFolder,
    customFolderForNewFiles
  } = folderOptions;
  try {
    const fileName = getFileName2();
    const folderPath = await getFolderForNewLoomFile(app, {
      contextMenuFolderPath,
      createAtAttachmentsFolder,
      customFolderForNewFiles
    });
    await createFolder(app, folderPath);
    const filePath = (0, import_obsidian18.normalizePath)(folderPath + "/" + fileName);
    const formattedPath = removeLeadingPeriod(filePath);
    const loomState = createLoomState(1, 1, {
      pluginVersion,
      frozenColumnCount: defaultFrozenColumnCount
    });
    const serializedState = serializeState(loomState);
    const file = await createFile(app, formattedPath, serializedState);
    return file;
  } catch (err) {
    new import_obsidian18.Notice("Could not create loom file");
    throw err;
  }
};
var getFolderForNewLoomFile = async (app, options) => {
  const {
    contextMenuFolderPath,
    createAtAttachmentsFolder,
    customFolderForNewFiles
  } = options;
  let folderPath = "";
  if (contextMenuFolderPath) {
    folderPath = contextMenuFolderPath;
  } else if (createAtAttachmentsFolder) {
    const openFile = app.workspace.getActiveFile();
    folderPath = await app.vault.getAvailablePathForAttachments(
      "",
      "",
      openFile
    );
  } else {
    folderPath = customFolderForNewFiles;
  }
  const normalized = (0, import_obsidian18.normalizePath)(folderPath);
  return normalized;
};
var getFileName2 = () => {
  return `${DEFAULT_LOOM_NAME}.${LOOM_EXTENSION}`;
};
var removeLeadingPeriod = (path) => {
  if (path.startsWith(".")) {
    return path.substring(1);
  }
  return path;
};

// src/data/main-utils.ts
var import_obsidian19 = require("obsidian");
var handleFileRename = async (app, file, oldPath, currentAppVersion) => {
  const loomFiles = getAllVaultLoomFiles(app);
  let totalLinksUpdated = 0;
  let numFilesUpdated = 0;
  for (const loomFile of loomFiles) {
    const { updatedState, didUpdate, numLinksUpdated } = await updateLoomFileState(
      app,
      loomFile,
      oldPath,
      file.path,
      currentAppVersion
    );
    if (didUpdate) {
      totalLinksUpdated += numLinksUpdated;
      numFilesUpdated++;
      await file.vault.modify(loomFile, serializeState(updatedState));
      EventManager.getInstance().emit(
        "app-refresh-by-state",
        loomFile.path,
        -1,
        //update all looms that match this path
        updatedState
      );
    }
  }
  if (totalLinksUpdated > 0) {
    new import_obsidian19.Notice(
      `Updated ${totalLinksUpdated} link${totalLinksUpdated > 1 ? "s" : ""} in ${numFilesUpdated} loom file${numFilesUpdated > 1 ? "s" : ""}.`
    );
  }
};
var updateLoomFileState = async (app, loomFile, oldPath, newPath, currentAppVersion) => {
  let numLinksUpdated = 0;
  const data = await app.vault.read(loomFile);
  const state = deserializeState(data, currentAppVersion);
  if (isMarkdownFile(oldPath)) {
    oldPath = stripFileExtension(oldPath);
  }
  if (isMarkdownFile(newPath)) {
    newPath = stripFileExtension(newPath);
  }
  const { columns, rows } = state.model;
  const cellsToColumn = mapCellsToColumn(columns, rows);
  const nextRows = rows.map((row) => {
    const { cells } = row;
    const nextCells = cells.map((cell) => {
      const { columnId } = cell;
      const column = cellsToColumn.get(columnId);
      if (!column)
        throw new ColumnNotFoundError({ id: columnId });
      const { type } = column;
      switch (type) {
        case "text" /* TEXT */: {
          const { nextCell, didUpdate } = updateTextCell(
            cell,
            oldPath,
            newPath
          );
          if (didUpdate)
            numLinksUpdated++;
          return nextCell;
        }
        case "file" /* FILE */: {
          const { nextCell, didUpdate } = updateFileCell(
            cell,
            oldPath,
            newPath
          );
          if (didUpdate)
            numLinksUpdated++;
          return nextCell;
        }
        case "embed" /* EMBED */: {
          const { nextCell, didUpdate } = updateEmbedCell(
            cell,
            oldPath,
            newPath
          );
          if (didUpdate)
            numLinksUpdated++;
          return nextCell;
        }
        default:
          return cell;
      }
    });
    return {
      ...row,
      cells: nextCells
    };
  });
  const nextState = {
    ...state,
    model: {
      ...state.model,
      rows: nextRows
    }
  };
  return {
    updatedState: nextState,
    didUpdate: JSON.stringify(state) !== JSON.stringify(nextState),
    numLinksUpdated
  };
};
var updateTextCell = (cell, oldPath, newPath) => {
  const { content } = cell;
  const { replacedString, replacementCount } = replaceWikiLinks(
    content,
    (path, alias) => {
      if (path === oldPath) {
        return componentsToWikiLink(newPath, alias);
      }
      return componentsToWikiLink(path, alias);
    }
  );
  if (replacementCount > 0) {
    const nextCell = {
      ...cell,
      content: replacedString
    };
    return { nextCell, didUpdate: true };
  }
  return { nextCell: cell, didUpdate: false };
};
var updateEmbedCell = (cell, oldPath, newPath) => {
  const { pathOrUrl } = cell;
  if (pathOrUrl === oldPath) {
    const nextCell = {
      ...cell,
      pathOrUrl: newPath
    };
    return { nextCell, didUpdate: true };
  }
  return { nextCell: cell, didUpdate: false };
};
var updateFileCell = (cell, oldPath, newPath) => {
  const { path } = cell;
  if (path === oldPath) {
    const nextCell = {
      ...cell,
      path: newPath
    };
    return { nextCell, didUpdate: true };
  }
  return { nextCell: cell, didUpdate: false };
};
var replaceWikiLinks = (str, replaceFunction) => {
  let replacementCount = 0;
  const replacedString = str.replace(
    WIKI_LINK_REGEX,
    (_match, path, _7, alias) => {
      replacementCount++;
      return replaceFunction(path, alias || null);
    }
  );
  return { replacedString, replacementCount };
};
var getAllVaultLoomFiles = (app) => {
  return app.vault.getFiles().filter((file) => file.extension === LOOM_EXTENSION);
};

// src/main.ts
var import_js_logger24 = __toESM(require_logger());
var DEFAULT_SETTINGS = {
  logLevel: LOG_LEVEL_OFF,
  createAtObsidianAttachmentFolder: false,
  customFolderForNewFiles: "",
  removeMarkdownOnExport: true,
  defaultEmbedWidth: "100%",
  defaultEmbedHeight: "340px",
  hasMigratedTo800: false,
  showWelcomeModal: true,
  defaultFrozenColumnCount: 1,
  pluginVersion: ""
};
var FILE_NAME = "main.ts";
var DataLoomPlugin = class extends import_obsidian20.Plugin {
  /**
   * Called on plugin load.
   * This can be when the plugin is enabled or Obsidian is first opened.
   */
  async onload() {
    await this.loadSettings();
    import_js_logger24.default.useDefaults();
    import_js_logger24.default.setHandler(function(messages) {
      const { message, data } = formatMessageForLogger(...messages);
      console.log(message);
      if (data) {
        console.log(data);
      }
    });
    const logLevel = stringToLogLevel(this.settings.logLevel);
    import_js_logger24.default.setLevel(logLevel);
    this.registerView(
      DATA_LOOM_VIEW,
      (leaf) => new DataLoomView(leaf, this.manifest.id, this.manifest.version)
    );
    this.registerExtensions([LOOM_EXTENSION], DATA_LOOM_VIEW);
    this.addRibbonIcon("table", "Create loom", async () => {
      await this.newLoomFile(null);
    });
    this.addSettingTab(new DataLoomSettingsTab(this.app, this));
    this.registerEditorExtension(
      EditingViewPlugin(this.app, this.manifest.version)
    );
    this.setModalDisplay();
    this.registerCommands();
    this.registerEvents();
    this.registerDOMEvents();
    this.app.workspace.onLayoutReady(async () => {
      import_js_logger24.default.trace(FILE_NAME, "onLayoutReady", "called");
      import_js_logger24.default.debug(FILE_NAME, "onLayoutReady", "workspace layout is ready");
      const isDark = hasDarkTheme();
      store.dispatch(setDarkMode(isDark));
      await this.migrateLoomFiles();
      FrontmatterCache.getInstance().loadProperties(this.app);
      EventManager.getInstance().emit("file-frontmatter-change");
      this.registerEvent(
        this.app.vault.on("create", (file) => {
          if (file instanceof import_obsidian20.TFile) {
            import_js_logger24.default.trace(FILE_NAME, "registerEvent", "vault.create event called");
            EventManager.getInstance().emit("file-create");
          }
        })
      );
    });
    if (this.settings.showWelcomeModal) {
      new WelcomeModal(this.app).open();
      this.settings.showWelcomeModal = false;
      await this.saveSettings();
    }
    this.settings.pluginVersion = this.manifest.version;
    await this.saveSettings();
    store.dispatch(setPluginVersion(this.manifest.version));
  }
  setModalDisplay() {
    if (this.settings.pluginVersion !== this.manifest.version) {
      if (this.settings.pluginVersion !== "") {
        this.displayModalsOnLoomOpen = true;
        return;
      }
    }
    this.displayModalsOnLoomOpen = false;
  }
  //TODO remove this in future versions
  async migrateLoomFiles() {
    if (!this.settings.hasMigratedTo800) {
      import_js_logger24.default.info(FILE_NAME, "migrateLoomFiles", "migrating to 8.0.0");
      const loomFiles = this.app.vault.getFiles().filter(
        (file) => file.extension === "dashboard" || file.extension === "table"
      );
      for (let i2 = 0; i2 < loomFiles.length; i2++) {
        const file = loomFiles[i2];
        const data = await this.app.vault.read(file);
        const parsedState = JSON.parse(data);
        if (!parsedState.model)
          return;
        const newFilePath = file.path.replace(
          `.${file.extension}`,
          `.${LOOM_EXTENSION}`
        );
        try {
          await this.app.vault.rename(file, newFilePath);
        } catch (err) {
          new import_obsidian20.Notice(
            `Failed renaming ${file.path} to ${newFilePath}`
          );
          new import_obsidian20.Notice("Please rename this file manually");
        }
      }
      this.settings.hasMigratedTo800 = true;
      await this.saveSettings();
    }
  }
  async newLoomFile(contextMenuFolderPath, embedded) {
    const file = await createLoomFile(
      this.app,
      this.manifest.version,
      this.settings.defaultFrozenColumnCount,
      {
        contextMenuFolderPath,
        createAtAttachmentsFolder: this.settings.createAtObsidianAttachmentFolder,
        customFolderForNewFiles: this.settings.customFolderForNewFiles
      }
    );
    if (embedded)
      return file.path;
    await this.app.workspace.getLeaf(true).openFile(file);
  }
  registerDOMEvents() {
    this.registerDomEvent(document, "click", () => {
      import_js_logger24.default.trace(FILE_NAME, "registerDomEvent", "click event called");
      EventManager.getInstance().emit("clear-menu-trigger-focus");
      EventManager.getInstance().emit("global-click");
    });
    this.registerDomEvent(document, "keydown", (e) => {
      import_js_logger24.default.trace(FILE_NAME, "registerDomEvent", "keydown event called");
      EventManager.getInstance().emit("global-keydown", e);
    });
  }
  registerEvents() {
    this.registerEvent(
      this.app.workspace.on("css-change", () => {
        import_js_logger24.default.trace(FILE_NAME, "registerEvent", "css-change event called");
        const isDark = hasDarkTheme();
        store.dispatch(setDarkMode(isDark));
      })
    );
    this.registerEvent(
      this.app.workspace.on("layout-change", () => {
        import_js_logger24.default.trace("main.ts", "registerEvent", "layout-change event called");
        const leaves = this.app.workspace.getLeavesOfType("markdown");
        purgeEmbeddedLoomApps(leaves);
        setTimeout(() => {
          loadPreviewModeApps(
            this.app,
            leaves,
            this.manifest.version
          );
        }, 2);
      })
    );
    this.registerEvent(
      this.app.workspace.on("file-menu", (menu, file) => {
        import_js_logger24.default.trace(FILE_NAME, "registerEvent", "file-menu event called");
        if (file instanceof import_obsidian20.TFolder) {
          menu.addItem((item) => {
            item.setTitle("New loom").setIcon("document").onClick(async () => {
              await this.newLoomFile(file.path);
            });
          });
        }
      })
    );
    this.registerEvent(
      this.app.workspace.on("file-open", async (file) => {
        import_js_logger24.default.trace(FILE_NAME, "registerEvent", "file-open event called");
        if (!file)
          return;
        if (!this.displayModalsOnLoomOpen)
          return;
        let shouldOpen = false;
        if (file.extension === LOOM_EXTENSION) {
          shouldOpen = true;
        } else {
          const data = await this.app.vault.cachedRead(file);
          const loomEmbedRegex = new RegExp(
            /!\[\[[^\]]+\.loom(?:\|[0-9]+(?:x[0-9]+)?)?\]\]/
          );
          if (data.match(loomEmbedRegex)) {
            shouldOpen = true;
          }
        }
        if (shouldOpen) {
          this.displayModalsOnLoomOpen = false;
        }
      })
    );
    this.registerEvent(
      this.app.vault.on(
        "rename",
        async (file, oldPath) => {
          import_js_logger24.default.trace(FILE_NAME, "registerEvent", "rename event called");
          if (file instanceof import_obsidian20.TFile) {
            handleFileRename(
              this.app,
              file,
              oldPath,
              this.manifest.version
            );
          }
        }
      )
    );
    this.registerEvent(
      this.app.vault.on("modify", async (file) => {
        import_js_logger24.default.trace(FILE_NAME, "registerEvent", "vault.modify event called", file);
        if (file instanceof import_obsidian20.TFile) {
          if (file.extension === LOOM_EXTENSION) {
            const lastSavedFile = LastSavedManager.getInstance().getLastSavedFile();
            if (lastSavedFile === file.path) {
              const now = Date.now();
              const lastTime = LastSavedManager.getInstance().getLastSavedTime();
              if (now - lastTime < 5e3) {
                import_js_logger24.default.debug(FILE_NAME, "registerEvent", "vault.modify event ignored because it file was saved less than 5 seconds ago");
                return;
              }
            }
            EventManager.getInstance().emit("app-refresh-by-file", file, this.manifest.version);
          }
        }
      })
    );
    this.registerSourceEvents();
  }
  /**
   * Register events that are needed for updating the rows created by sources
   */
  registerSourceEvents() {
    this.registerEvent(
      this.app.vault.on("rename", (file) => {
        import_js_logger24.default.trace(FILE_NAME, "registerEvent", "vault.rename event called");
        if (file instanceof import_obsidian20.TFile) {
          EventManager.getInstance().emit("file-rename");
        } else {
          EventManager.getInstance().emit("folder-rename");
        }
      })
    );
    this.registerEvent(
      this.app.vault.on("delete", (file) => {
        import_js_logger24.default.trace(FILE_NAME, "registerEvent", "vault.delete event called");
        if (file instanceof import_obsidian20.TFile) {
          EventManager.getInstance().emit("file-delete");
        } else {
          EventManager.getInstance().emit("folder-delete");
        }
      })
    );
    this.registerEvent(
      this.app.metadataTypeManager.on(
        "changed",
        async (propertyName) => {
          import_js_logger24.default.trace(FILE_NAME, "registerEvent", "metadataTypeManager.changed event called");
          const updatedType = getAssignedPropertyType(
            this.app,
            propertyName
          );
          FrontmatterCache.getInstance().setPropertyType(
            propertyName,
            updatedType
          );
          EventManager.getInstance().emit("property-type-change");
        }
      )
    );
    this.registerEvent(
      this.app.metadataCache.on(
        "changed",
        async (file) => {
          if (file instanceof import_obsidian20.TFile) {
            import_js_logger24.default.trace(FILE_NAME, "registerEvent", "metadataCache.changed event called");
            await new Promise(
              (resolve) => setTimeout(resolve, 100)
            );
            FrontmatterCache.getInstance().loadProperties(this.app);
            EventManager.getInstance().emit(
              "file-frontmatter-change"
            );
          }
        }
      )
    );
  }
  registerCommands() {
    this.addCommand({
      id: "create",
      name: "Create loom",
      hotkeys: [{ modifiers: ["Mod", "Shift"], key: "=" }],
      callback: async () => {
        await this.newLoomFile(null);
      }
    });
    this.addCommand({
      id: "create-and-embed",
      name: "Create loom and embed it into current file",
      hotkeys: [{ modifiers: ["Mod", "Shift"], key: "+" }],
      editorCallback: async (editor) => {
        const filePath = await this.newLoomFile(null, true);
        if (!filePath)
          return;
        const useMarkdownLinks = this.app.vault.getConfig(
          "useMarkdownLinks"
        );
        const linkText = useMarkdownLinks ? `![${getBasename(filePath)}](${encodeURI(filePath)})` : `![[${filePath}]]`;
        editor.replaceRange(linkText, editor.getCursor());
        editor.setCursor(
          editor.getCursor().line,
          editor.getCursor().ch + linkText.length
        );
      }
    });
    this.addCommand({
      id: "add-column",
      name: "Add column",
      hotkeys: [{ modifiers: ["Mod", "Shift"], key: "\\" }],
      checkCallback: (checking) => {
        const loomView = this.app.workspace.getActiveViewOfType(DataLoomView);
        const markdownView = this.app.workspace.getActiveViewOfType(import_obsidian20.MarkdownView);
        if (loomView || markdownView) {
          if (!checking) {
            EventManager.getInstance().emit("add-column");
          }
          return true;
        }
        return false;
      }
    });
    this.addCommand({
      id: "delete-column",
      name: "Delete column",
      hotkeys: [{ modifiers: ["Mod", "Shift"], key: "Backspace" }],
      checkCallback: (checking) => {
        const loomView = this.app.workspace.getActiveViewOfType(DataLoomView);
        const markdownView = this.app.workspace.getActiveViewOfType(import_obsidian20.MarkdownView);
        if (loomView || markdownView) {
          if (!checking) {
            EventManager.getInstance().emit("delete-column");
          }
          return true;
        }
        return false;
      }
    });
    this.addCommand({
      id: "add-row",
      name: "Add row",
      hotkeys: [{ modifiers: ["Mod", "Shift"], key: "Enter" }],
      checkCallback: (checking) => {
        const loomView = this.app.workspace.getActiveViewOfType(DataLoomView);
        const markdownView = this.app.workspace.getActiveViewOfType(import_obsidian20.MarkdownView);
        if (loomView || markdownView) {
          if (!checking)
            EventManager.getInstance().emit("add-row");
          return true;
        }
        return false;
      }
    });
    this.addCommand({
      id: "delete-row",
      name: "Delete row",
      hotkeys: [{ modifiers: ["Alt", "Shift"], key: "Backspace" }],
      checkCallback: (checking) => {
        const loomView = this.app.workspace.getActiveViewOfType(DataLoomView);
        const markdownView = this.app.workspace.getActiveViewOfType(import_obsidian20.MarkdownView);
        if (loomView || markdownView) {
          if (!checking) {
            EventManager.getInstance().emit("delete-row");
          }
          return true;
        }
        return false;
      }
    });
    this.addCommand({
      id: "export-markdown",
      name: "Export as markdown",
      checkCallback: (checking) => {
        const loomView = this.app.workspace.getActiveViewOfType(DataLoomView);
        const markdownView = this.app.workspace.getActiveViewOfType(import_obsidian20.MarkdownView);
        if (loomView || markdownView) {
          if (!checking) {
            EventManager.getInstance().emit("download-markdown");
          }
          return true;
        }
        return false;
      }
    });
    this.addCommand({
      id: "export-csv",
      name: "Export as CSV",
      checkCallback: (checking) => {
        const loomView = this.app.workspace.getActiveViewOfType(DataLoomView);
        const markdownView = this.app.workspace.getActiveViewOfType(import_obsidian20.MarkdownView);
        if (loomView || markdownView) {
          if (!checking) {
            EventManager.getInstance().emit("download-csv");
          }
          return true;
        }
        return false;
      }
    });
  }
  async loadSettings() {
    import_js_logger24.default.trace(FILE_NAME, "loadSettings", "called");
    this.settings = Object.assign(
      {},
      DEFAULT_SETTINGS,
      await this.loadData()
    );
    store.dispatch(setSettings({ ...this.settings }));
  }
  async saveSettings() {
    import_js_logger24.default.trace(FILE_NAME, "saveSettings", "called");
    await this.saveData(this.settings);
    store.dispatch(setSettings({ ...this.settings }));
  }
  /**
   * Called on plugin unload.
   * This can be when the plugin is disabled or Obsidian is closed.
   */
  async onunload() {
    this.app.workspace.detachLeavesOfType(DATA_LOOM_VIEW);
  }
};
/*! Bundled license information:

js-logger/src/logger.js:
  (*!
   * js-logger - http://github.com/jonnyreeves/js-logger
   * Jonny Reeves, http://jonnyreeves.co.uk/
   * js-logger may be freely distributed under the MIT license.
   *)

react/cjs/react.development.js:
  (**
   * @license React
   * react.development.js
   *
   * Copyright (c) Facebook, Inc. and its affiliates.
   *
   * This source code is licensed under the MIT license found in the
   * LICENSE file in the root directory of this source tree.
   *)

scheduler/cjs/scheduler.development.js:
  (**
   * @license React
   * scheduler.development.js
   *
   * Copyright (c) Facebook, Inc. and its affiliates.
   *
   * This source code is licensed under the MIT license found in the
   * LICENSE file in the root directory of this source tree.
   *)

react-dom/cjs/react-dom.development.js:
  (**
   * @license React
   * react-dom.development.js
   *
   * Copyright (c) Facebook, Inc. and its affiliates.
   *
   * This source code is licensed under the MIT license found in the
   * LICENSE file in the root directory of this source tree.
   *)
  (**
   * Checks if an event is supported in the current execution environment.
   *
   * NOTE: This will not work correctly for non-generic events such as `change`,
   * `reset`, `load`, `error`, and `select`.
   *
   * Borrows from Modernizr.
   *
   * @param {string} eventNameSuffix Event name, e.g. "click".
   * @return {boolean} True if the event is supported.
   * @internal
   * @license Modernizr 3.0.0pre (Custom Build) | MIT
   *)

lodash/lodash.js:
  (**
   * @license
   * Lodash <https://lodash.com/>
   * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
   * Released under MIT license <https://lodash.com/license>
   * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
   * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
   *)

use-sync-external-store/cjs/use-sync-external-store-shim.development.js:
  (**
   * @license React
   * use-sync-external-store-shim.development.js
   *
   * Copyright (c) Facebook, Inc. and its affiliates.
   *
   * This source code is licensed under the MIT license found in the
   * LICENSE file in the root directory of this source tree.
   *)

use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js:
  (**
   * @license React
   * use-sync-external-store-shim/with-selector.development.js
   *
   * Copyright (c) Facebook, Inc. and its affiliates.
   *
   * This source code is licensed under the MIT license found in the
   * LICENSE file in the root directory of this source tree.
   *)

react-is/cjs/react-is.development.js:
  (** @license React v16.13.1
   * react-is.development.js
   *
   * Copyright (c) Facebook, Inc. and its affiliates.
   *
   * This source code is licensed under the MIT license found in the
   * LICENSE file in the root directory of this source tree.
   *)

react-is/cjs/react-is.development.js:
  (**
   * @license React
   * react-is.development.js
   *
   * Copyright (c) Facebook, Inc. and its affiliates.
   *
   * This source code is licensed under the MIT license found in the
   * LICENSE file in the root directory of this source tree.
   *)

react/cjs/react-jsx-runtime.development.js:
  (**
   * @license React
   * react-jsx-runtime.development.js
   *
   * Copyright (c) Facebook, Inc. and its affiliates.
   *
   * This source code is licensed under the MIT license found in the
   * LICENSE file in the root directory of this source tree.
   *)

papaparse/papaparse.min.js:
  (* @license
  Papa Parse
  v5.4.1
  https://github.com/mholt/PapaParse
  License: MIT
  *)
*/
