Viewing File: /usr/local/cpanel/ui/web-components/dist/custom-elements/index.js

import { HTMLElement, h, Host, createEvent, getRenderingRef, forceUpdate, getAssetPath, proxyCustomElement } from '@stencil/core/internal/client';
export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';

/** Detect free variable `global` from Node.js. */
var freeGlobal$1 = typeof global == 'object' && global && global.Object === Object && global;

/** Detect free variable `self`. */
var freeSelf$1 = typeof self == 'object' && self && self.Object === Object && self;

/** Used as a reference to the global object. */
var root$1 = freeGlobal$1 || freeSelf$1 || Function('return this')();

/** Built-in value references. */
var Symbol$1 = root$1.Symbol;

/** Used for built-in method references. */
var objectProto$4 = Object.prototype;

/** Used to check objects for own properties. */
var hasOwnProperty$3 = objectProto$4.hasOwnProperty;

/**
 * Used to resolve the
 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
 * of values.
 */
var nativeObjectToString$3 = objectProto$4.toString;

/** Built-in value references. */
var symToStringTag$3 = Symbol$1 ? Symbol$1.toStringTag : undefined;

/**
 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
 *
 * @private
 * @param {*} value The value to query.
 * @returns {string} Returns the raw `toStringTag`.
 */
function getRawTag$1(value) {
  var isOwn = hasOwnProperty$3.call(value, symToStringTag$3),
      tag = value[symToStringTag$3];

  try {
    value[symToStringTag$3] = undefined;
    var unmasked = true;
  } catch (e) {}

  var result = nativeObjectToString$3.call(value);
  if (unmasked) {
    if (isOwn) {
      value[symToStringTag$3] = tag;
    } else {
      delete value[symToStringTag$3];
    }
  }
  return result;
}

/** Used for built-in method references. */
var objectProto$3 = Object.prototype;

/**
 * Used to resolve the
 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
 * of values.
 */
var nativeObjectToString$2 = objectProto$3.toString;

/**
 * Converts `value` to a string using `Object.prototype.toString`.
 *
 * @private
 * @param {*} value The value to convert.
 * @returns {string} Returns the converted string.
 */
function objectToString$1(value) {
  return nativeObjectToString$2.call(value);
}

/** `Object#toString` result references. */
var nullTag$1 = '[object Null]',
    undefinedTag$1 = '[object Undefined]';

/** Built-in value references. */
var symToStringTag$2 = Symbol$1 ? Symbol$1.toStringTag : undefined;

/**
 * The base implementation of `getTag` without fallbacks for buggy environments.
 *
 * @private
 * @param {*} value The value to query.
 * @returns {string} Returns the `toStringTag`.
 */
function baseGetTag$1(value) {
  if (value == null) {
    return value === undefined ? undefinedTag$1 : nullTag$1;
  }
  return (symToStringTag$2 && symToStringTag$2 in Object(value))
    ? getRawTag$1(value)
    : objectToString$1(value);
}

/**
 * Checks if `value` is object-like. A value is object-like if it's not `null`
 * and has a `typeof` result of "object".
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
 * @example
 *
 * _.isObjectLike({});
 * // => true
 *
 * _.isObjectLike([1, 2, 3]);
 * // => true
 *
 * _.isObjectLike(_.noop);
 * // => false
 *
 * _.isObjectLike(null);
 * // => false
 */
function isObjectLike$2(value) {
  return value != null && typeof value == 'object';
}

/** `Object#toString` result references. */
var symbolTag$1 = '[object Symbol]';

/**
 * Checks if `value` is classified as a `Symbol` primitive or object.
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
 * @example
 *
 * _.isSymbol(Symbol.iterator);
 * // => true
 *
 * _.isSymbol('abc');
 * // => false
 */
function isSymbol$1(value) {
  return typeof value == 'symbol' ||
    (isObjectLike$2(value) && baseGetTag$1(value) == symbolTag$1);
}

/**
 * A specialized version of `_.map` for arrays without support for iteratee
 * shorthands.
 *
 * @private
 * @param {Array} [array] The array to iterate over.
 * @param {Function} iteratee The function invoked per iteration.
 * @returns {Array} Returns the new mapped array.
 */
function arrayMap$1(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;
}

/**
 * Checks if `value` is classified as an `Array` object.
 *
 * @static
 * @memberOf _
 * @since 0.1.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is an array, else `false`.
 * @example
 *
 * _.isArray([1, 2, 3]);
 * // => true
 *
 * _.isArray(document.body.children);
 * // => false
 *
 * _.isArray('abc');
 * // => false
 *
 * _.isArray(_.noop);
 * // => false
 */
var isArray$2 = Array.isArray;

/** Used as references for various `Number` constants. */
var INFINITY$3 = 1 / 0;

/** Used to convert symbols to primitives and strings. */
var symbolProto$1 = Symbol$1 ? Symbol$1.prototype : undefined,
    symbolToString$1 = symbolProto$1 ? symbolProto$1.toString : undefined;

/**
 * The base implementation of `_.toString` which doesn't convert nullish
 * values to empty strings.
 *
 * @private
 * @param {*} value The value to process.
 * @returns {string} Returns the string.
 */
function baseToString$2(value) {
  // Exit early for strings to avoid a performance hit in some environments.
  if (typeof value == 'string') {
    return value;
  }
  if (isArray$2(value)) {
    // Recursively convert values (susceptible to call stack limits).
    return arrayMap$1(value, baseToString$2) + '';
  }
  if (isSymbol$1(value)) {
    return symbolToString$1 ? symbolToString$1.call(value) : '';
  }
  var result = (value + '');
  return (result == '0' && (1 / value) == -INFINITY$3) ? '-0' : result;
}

/** Used to match a single whitespace character. */
var reWhitespace$1 = /\s/;

/**
 * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
 * character of `string`.
 *
 * @private
 * @param {string} string The string to inspect.
 * @returns {number} Returns the index of the last non-whitespace character.
 */
function trimmedEndIndex$1(string) {
  var index = string.length;

  while (index-- && reWhitespace$1.test(string.charAt(index))) {}
  return index;
}

/** Used to match leading whitespace. */
var reTrimStart$1 = /^\s+/;

/**
 * The base implementation of `_.trim`.
 *
 * @private
 * @param {string} string The string to trim.
 * @returns {string} Returns the trimmed string.
 */
function baseTrim$1(string) {
  return string
    ? string.slice(0, trimmedEndIndex$1(string) + 1).replace(reTrimStart$1, '')
    : string;
}

/**
 * Checks if `value` is the
 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
 *
 * @static
 * @memberOf _
 * @since 0.1.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
 * @example
 *
 * _.isObject({});
 * // => true
 *
 * _.isObject([1, 2, 3]);
 * // => true
 *
 * _.isObject(_.noop);
 * // => true
 *
 * _.isObject(null);
 * // => false
 */
function isObject$2(value) {
  var type = typeof value;
  return value != null && (type == 'object' || type == 'function');
}

/** Used as references for various `Number` constants. */
var NAN$1 = 0 / 0;

/** Used to detect bad signed hexadecimal string values. */
var reIsBadHex$1 = /^[-+]0x[0-9a-f]+$/i;

/** Used to detect binary string values. */
var reIsBinary$1 = /^0b[01]+$/i;

/** Used to detect octal string values. */
var reIsOctal$1 = /^0o[0-7]+$/i;

/** Built-in method references without a dependency on `root`. */
var freeParseInt$1 = parseInt;

/**
 * Converts `value` to a number.
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to process.
 * @returns {number} Returns the number.
 * @example
 *
 * _.toNumber(3.2);
 * // => 3.2
 *
 * _.toNumber(Number.MIN_VALUE);
 * // => 5e-324
 *
 * _.toNumber(Infinity);
 * // => Infinity
 *
 * _.toNumber('3.2');
 * // => 3.2
 */
function toNumber$1(value) {
  if (typeof value == 'number') {
    return value;
  }
  if (isSymbol$1(value)) {
    return NAN$1;
  }
  if (isObject$2(value)) {
    var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
    value = isObject$2(other) ? (other + '') : other;
  }
  if (typeof value != 'string') {
    return value === 0 ? value : +value;
  }
  value = baseTrim$1(value);
  var isBinary = reIsBinary$1.test(value);
  return (isBinary || reIsOctal$1.test(value))
    ? freeParseInt$1(value.slice(2), isBinary ? 2 : 8)
    : (reIsBadHex$1.test(value) ? NAN$1 : +value);
}

/**
 * Converts `value` to a string. An empty string is returned for `null`
 * and `undefined` values. The sign of `-0` is preserved.
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to convert.
 * @returns {string} Returns the converted string.
 * @example
 *
 * _.toString(null);
 * // => ''
 *
 * _.toString(-0);
 * // => '-0'
 *
 * _.toString([1, 2, 3]);
 * // => '1,2,3'
 */
function toString$3(value) {
  return value == null ? '' : baseToString$2(value);
}

/**
 * The base implementation of `_.propertyOf` without support for deep paths.
 *
 * @private
 * @param {Object} object The object to query.
 * @returns {Function} Returns the new accessor function.
 */
function basePropertyOf$1(object) {
  return function(key) {
    return object == null ? undefined : object[key];
  };
}

/**
 * Gets the timestamp of the number of milliseconds that have elapsed since
 * the Unix epoch (1 January 1970 00:00:00 UTC).
 *
 * @static
 * @memberOf _
 * @since 2.4.0
 * @category Date
 * @returns {number} Returns the timestamp.
 * @example
 *
 * _.defer(function(stamp) {
 *   console.log(_.now() - stamp);
 * }, _.now());
 * // => Logs the number of milliseconds it took for the deferred invocation.
 */
var now = function() {
  return root$1.Date.now();
};

/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';

/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax = Math.max,
    nativeMin = Math.min;

/**
 * Creates a debounced function that delays invoking `func` until after `wait`
 * milliseconds have elapsed since the last time the debounced function was
 * invoked. The debounced function comes with a `cancel` method to cancel
 * delayed `func` invocations and a `flush` method to immediately invoke them.
 * Provide `options` to indicate whether `func` should be invoked on the
 * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
 * with the last arguments provided to the debounced function. Subsequent
 * calls to the debounced function return the result of the last `func`
 * invocation.
 *
 * **Note:** If `leading` and `trailing` options are `true`, `func` is
 * invoked on the trailing edge of the timeout only if the debounced function
 * is invoked more than once during the `wait` timeout.
 *
 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
 * until to the next tick, similar to `setTimeout` with a timeout of `0`.
 *
 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
 * for details over the differences between `_.debounce` and `_.throttle`.
 *
 * @static
 * @memberOf _
 * @since 0.1.0
 * @category Function
 * @param {Function} func The function to debounce.
 * @param {number} [wait=0] The number of milliseconds to delay.
 * @param {Object} [options={}] The options object.
 * @param {boolean} [options.leading=false]
 *  Specify invoking on the leading edge of the timeout.
 * @param {number} [options.maxWait]
 *  The maximum time `func` is allowed to be delayed before it's invoked.
 * @param {boolean} [options.trailing=true]
 *  Specify invoking on the trailing edge of the timeout.
 * @returns {Function} Returns the new debounced function.
 * @example
 *
 * // Avoid costly calculations while the window size is in flux.
 * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
 *
 * // Invoke `sendMail` when clicked, debouncing subsequent calls.
 * jQuery(element).on('click', _.debounce(sendMail, 300, {
 *   'leading': true,
 *   'trailing': false
 * }));
 *
 * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
 * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
 * var source = new EventSource('/stream');
 * jQuery(source).on('message', debounced);
 *
 * // Cancel the trailing debounced invocation.
 * jQuery(window).on('popstate', debounced.cancel);
 */
function debounce$1(func, wait, options) {
  var lastArgs,
      lastThis,
      maxWait,
      result,
      timerId,
      lastCallTime,
      lastInvokeTime = 0,
      leading = false,
      maxing = false,
      trailing = true;

  if (typeof func != 'function') {
    throw new TypeError(FUNC_ERROR_TEXT);
  }
  wait = toNumber$1(wait) || 0;
  if (isObject$2(options)) {
    leading = !!options.leading;
    maxing = 'maxWait' in options;
    maxWait = maxing ? nativeMax(toNumber$1(options.maxWait) || 0, wait) : maxWait;
    trailing = 'trailing' in options ? !!options.trailing : trailing;
  }

  function invokeFunc(time) {
    var args = lastArgs,
        thisArg = lastThis;

    lastArgs = lastThis = undefined;
    lastInvokeTime = time;
    result = func.apply(thisArg, args);
    return result;
  }

  function leadingEdge(time) {
    // Reset any `maxWait` timer.
    lastInvokeTime = time;
    // Start the timer for the trailing edge.
    timerId = setTimeout(timerExpired, wait);
    // Invoke the leading edge.
    return leading ? invokeFunc(time) : result;
  }

  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;

    // Either this is the first call, activity has stopped and we're at the
    // trailing edge, the system time has gone backwards and we're treating
    // it as the trailing edge, or we've hit the `maxWait` limit.
    return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
      (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  }

  function timerExpired() {
    var time = now();
    if (shouldInvoke(time)) {
      return trailingEdge(time);
    }
    // Restart the timer.
    timerId = setTimeout(timerExpired, remainingWait(time));
  }

  function trailingEdge(time) {
    timerId = undefined;

    // Only invoke if we have `lastArgs` which means `func` has been
    // debounced at least once.
    if (trailing && lastArgs) {
      return invokeFunc(time);
    }
    lastArgs = lastThis = undefined;
    return result;
  }

  function cancel() {
    if (timerId !== undefined) {
      clearTimeout(timerId);
    }
    lastInvokeTime = 0;
    lastArgs = lastCallTime = lastThis = timerId = undefined;
  }

  function flush() {
    return timerId === undefined ? result : trailingEdge(now());
  }

  function debounced() {
    var time = now(),
        isInvoking = shouldInvoke(time);

    lastArgs = arguments;
    lastThis = this;
    lastCallTime = time;

    if (isInvoking) {
      if (timerId === undefined) {
        return leadingEdge(lastCallTime);
      }
      if (maxing) {
        // Handle invocations in a tight loop.
        clearTimeout(timerId);
        timerId = setTimeout(timerExpired, wait);
        return invokeFunc(lastCallTime);
      }
    }
    if (timerId === undefined) {
      timerId = setTimeout(timerExpired, wait);
    }
    return result;
  }
  debounced.cancel = cancel;
  debounced.flush = flush;
  return debounced;
}

/** Used to map characters to HTML entities. */
var htmlEscapes = {
  '&': '&amp;',
  '<': '&lt;',
  '>': '&gt;',
  '"': '&quot;',
  "'": '&#39;'
};

/**
 * Used by `_.escape` to convert characters to HTML entities.
 *
 * @private
 * @param {string} chr The matched character to escape.
 * @returns {string} Returns the escaped character.
 */
var escapeHtmlChar = basePropertyOf$1(htmlEscapes);

/** Used to match HTML entities and HTML characters. */
var reUnescapedHtml = /[&<>"']/g,
    reHasUnescapedHtml = RegExp(reUnescapedHtml.source);

/**
 * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
 * corresponding HTML entities.
 *
 * **Note:** No other characters are escaped. To escape additional
 * characters use a third-party library like [_he_](https://mths.be/he).
 *
 * Though the ">" character is escaped for symmetry, characters like
 * ">" and "/" don't need escaping in HTML and have no special meaning
 * unless they're part of a tag or unquoted attribute value. See
 * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
 * (under "semi-related fun fact") for more details.
 *
 * When working with HTML you should always
 * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
 * XSS vectors.
 *
 * @static
 * @since 0.1.0
 * @memberOf _
 * @category String
 * @param {string} [string=''] The string to escape.
 * @returns {string} Returns the escaped string.
 * @example
 *
 * _.escape('fred, barney, & pebbles');
 * // => 'fred, barney, &amp; pebbles'
 */
function escape(string) {
  string = toString$3(string);
  return (string && reHasUnescapedHtml.test(string))
    ? string.replace(reUnescapedHtml, escapeHtmlChar)
    : string;
}

/** Used to map HTML entities to characters. */
var htmlUnescapes = {
  '&amp;': '&',
  '&lt;': '<',
  '&gt;': '>',
  '&quot;': '"',
  '&#39;': "'"
};

/**
 * Used by `_.unescape` to convert HTML entities to characters.
 *
 * @private
 * @param {string} chr The matched character to unescape.
 * @returns {string} Returns the unescaped character.
 */
var unescapeHtmlChar = basePropertyOf$1(htmlUnescapes);

/** Used to match HTML entities and HTML characters. */
var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
    reHasEscapedHtml = RegExp(reEscapedHtml.source);

/**
 * The inverse of `_.escape`; this method converts the HTML entities
 * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
 * their corresponding characters.
 *
 * **Note:** No other HTML entities are unescaped. To unescape additional
 * HTML entities use a third-party library like [_he_](https://mths.be/he).
 *
 * @static
 * @memberOf _
 * @since 0.6.0
 * @category String
 * @param {string} [string=''] The string to unescape.
 * @returns {string} Returns the unescaped string.
 * @example
 *
 * _.unescape('fred, barney, &amp; pebbles');
 * // => 'fred, barney, & pebbles'
 */
function unescape(string) {
  string = toString$3(string);
  return (string && reHasEscapedHtml.test(string))
    ? string.replace(reEscapedHtml, unescapeHtmlChar)
    : string;
}

const cpAppCss = "";

const CpApp$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    /**
     * When true, make whole thing clickable to favorite, otherwise link to the application.
     */
    this.editMode = false;
    /**
     * The optional target window. Defaults to `_self`.
     */
    this.target = "_self";
  }
  /**
   * Set the edit mode for the control.
   *
   * @param mode - The mode, true when editing is enabled, false otherwise.
   */
  async setEditMode(mode) {
    this.editMode = mode;
  }
  /**
   * Event handler for the click event, this allows the whole link to trigger the cp-favorite-selector 'click' event
   * which helps with users having trouble precision clicking the star.
   */
  handleClick() {
    if (this.editMode) {
      const selector = document.querySelector("cp-favorite-selector[name=" + escape(this.name) + "]");
      if (selector) {
        selector.click();
      }
    }
  }
  render() {
    return (h(Host, null, h("a", { href: !this.editMode ? this.url : "javascript:void(0)", target: !this.editMode ? this.target : "_self", id: `tools-${this.uniquekey}` }, h("img", { class: "cp-app__image", src: this.iconurl, role: "presentation" }), h("span", null, this.description))));
  }
  static get style() { return cpAppCss; }
};

var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};

function createCommonjsModule(fn, basedir, module) {
	return module = {
		path: basedir,
		exports: {},
		require: function (path, base) {
			return commonjsRequire();
		}
	}, fn(module, module.exports), module.exports;
}

function commonjsRequire () {
	throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
}

var Html = createCommonjsModule(function (module, exports) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.htmlEscape = exports.entityMap = void 0;
exports.entityMap = {
    "&": `&amp;`,
    "<": `&lt;`,
    ">": "&gt;",
    '"': "&quot;",
    "'": "&#39;",
    "/": "&#x2F;",
};
/**
 * Escape a string with html entities.
 * @example
 *      htmlEscape("<cPanel & WHM>") // => &lt;cPanel &amp; WHM&gt;
 *
 * @param {string} text plain text value
 * @returns {string} html escaped string
 */
function htmlEscape(text) {
    // eslint-disable-next-line no-useless-escape -- this is a regex, not a string
    return String(text).replace(/[&<>"'\/]/g, (key) => exports.entityMap[key]);
}
exports.htmlEscape = htmlEscape;
//# sourceMappingURL=Html.js.map
});

var listToObject_1 = createCommonjsModule(function (module, exports) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.listToObject = void 0;
/**
 * Validates associative list can be converted into object
 * @example
 *      validate(['a', 1, 'b', 2]) // => {a:1, b:2}
 * @return {boolean} if associative list can be converted into object.
 */
function validate(keyValues) {
    const len = keyValues.length;
    if (len % 2 > 0) {
        throw new Error("An associative list must have an even number of parts: {name1}, {value1}, {name2}, {value2} ...");
    }
    for (let i = 0, l = keyValues.length; i < l; i = i + 2) {
        const name = keyValues[i];
        if (typeof name !== "string" || name === "") {
            throw new Error("An associative list must provide non-empty string names in the 1st, 3rd, ... positions.");
        }
    }
    return true;
}
/**
 * Retrieve the object representation of the associative list
 * @example
 *      arrayToObject(['a', 1, 'b', 2]) // => {a:1, b:2}
 * @return {Object} with the name/value pairs setup.
 */
function arrayToObject(keyValues) {
    const len = keyValues.length;
    const obj = {};
    let pos = 0, key, value;
    while (pos < len) {
        key = keyValues[pos];
        value = keyValues[++pos];
        obj[key] = value;
        pos++;
    }
    return obj;
}
/**
 * converts associative list to object
 * @example
 *     listToObject('a', 1, 'b', 2) // => {a:1, b:2}
 *
 * @param {string} text plain text value
 * @returns {string} html escaped string
 */
function listToObject(...nameValues) {
    let obj = {};
    if (validate(nameValues)) {
        obj = arrayToObject(nameValues);
    }
    return obj;
}
exports.listToObject = listToObject;
//# sourceMappingURL=list-to-object.js.map
});

var output_1 = createCommonjsModule(function (module, exports) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.functions = exports.output = void 0;


/**
 * Output operator for bracket notation. Acts as "dispatch" function for the
 * output methods below.
 * @example
 *      output({args:["chr",65]}) // => "A"
 * @param  {string} func     Name of the output function to process
 * @param  {any[]}    rest     Any additional arguments to pass to the transform
 * @return {string}          Processed output.
 */
function output({ args: [func, ...rest], }) {
    // Implementation of the chr() and amp() embeddable methods
    // [output,strong,cat amp() dog] => <strong>cat &amp; dog</strong>
    // [output,strong,cat chr(38) dog] => <strong>cat &amp; dog</strong>
    if (rest && typeof rest[0] === "string") {
        rest[0] = rest[0].replace(/chr\((\d+)\)/g, function (template, p1) {
            return exports.functions.chr(Number(p1));
        });
        rest[0] = rest[0].replace(/amp\(\)/g, function (template) {
            return exports.functions.amp();
        });
    }
    if (typeof exports.functions[func] === "function") {
        return exports.functions[func](...rest);
    }
    else {
        throw new Error(`Locale output function '${func}' is not implemented.`);
    }
}
exports.output = output;
exports.functions = {
    /**
     * Output the HTML escaped version of an ampersand.
     * @example
     *      amp() // => "&amp;"
     * @return {string} HTML safe value of &
     */
    amp() {
        return Html.htmlEscape("&");
    },
    /**
     * Output an HTML safe apostrophe
     * @example
     *      apos() // => "&#39;"
     * @return {string} HTML safe apostrophe
     */
    apos() {
        return Html.htmlEscape("'");
    },
    /**
     * Output an HTML safe quote mark
     * @example
     *      quot() // => "&quot;"
     * @return {string} HTML safe quote
     */
    quot() {
        return Html.htmlEscape('"');
    },
    /**
     * Output the string wrapped in a <u> HTML tag
     * @example
     *      underline("text") //=> <u>text</u>
     * @param  {string} str
     * @return {string} string wrapped in <u> HTML tag
     */
    underline(str) {
        return `<u>${str}</u>`;
    },
    /**
     * Output the string wrapped in a <strong> HTML tag
     * @example
     *      strong("text") // => <strong>text</strong>
     * @param  {string} str
     * @return {string} string wrapped in <strong> HTML tag
     */
    strong(str) {
        return `<strong>${str}</strong>`;
    },
    /**
     * Output the string wrapped in a <em> HTML tag
     * @example
     *      em("text") // => <em>text</em>
     * @param  {string} str
     * @return {string} string wrapped in <em> HTML tag
     */
    em(str) {
        return `<em>${str}</em>`;
    },
    /**
     * Output the string wrapped in a <abbr> HTML tag
     *
     * @example
     *      abbr("WHO", "World Health Organization"); // => <abbr title="World Health Organization">WHO</abbr>
     * @param  {string} abbr Abbreviation
     * @param  {string} full Full version of the abbreviation
     * @return {string} string wrapped in <abbr> HTML tag
     */
    abbr(abbr, full) {
        return `<abbr title="${full}">${abbr}</abbr>`;
    },
    /**
     * Output the string wrapped in a <abbr> HTML tag with special markings
     * @example
     *      acronym("WHO", "World Health Organization"); // => <abbr title="World Health Organization" class="initialism">WHO</abbr>
     * @param  {string} abbr Acronym
     * @param  {string} full Full version of the acronym
     * @return {string} string wrapped in <abbr>
     */
    acronym(abbr, full) {
        return `<abbr title="${full}" class="initialism">${abbr}</abbr>`;
    },
    /**
     * Output the string wrapped in a <span> HTML tag with the provided classes
     * @example
     *      class("text","text-bold","text-underline") // => <span class="text-bold text-underline">text</span>
     * @param {string} str String to embed in the span.
     * @param {...string} classes class names as arguments.
     * @return {string} span with classnames
     */
    class(str, ...classes) {
        const classNames = classes.join(" ");
        return `<span class="${classNames}">${str}</span>`;
    },
    /**
     * Output the requested character encoded as an HTML character.
     * @example
     *      chr(65) // => "A"
     * @param  {number|string} num Character code to output.
     * @return {string} requested character encoded as an HTML character.
     */
    chr(num) {
        if (typeof num === "string") {
            num = Number(num);
        }
        if (typeof num !== "number" || isNaN(num)) {
            throw new Error("chr needs a number as argument");
        }
        return Html.htmlEscape(String.fromCharCode(num));
    },
    /**
     * Output HTML anchor link based on input provided.
     * Note: The special key/value _type,offsite can be used to make an offsite link.
     *
     * @example
     *  url("https://somewhere.tld") // => <a href="https://somewhere.tld">https://somewhere.tld</a>
     *  url("https://somewhere.tld", "Click Here") // => <a href="https://somewhere.tld">Click Here</a>
     *  url("https://somewhere.tld", "Click Here", { "_type": "offsite" }) // => <a href="https://somewhere.tld" class="offsite" target="_blank">Click Here</a>
     *  url("https://somewhere.tld", "Click Here", "class", "class1 class2"]) // => <a href="https://somewhere.tld" class="class1 class2">Click Here</a>
     *  url("https://somewhere.tld", { html: "Click Here" }) // => <a href="https://somewhere.tld">Click Here</a>
     *
     * @param {string} dest href value.
     * @param {...any} [rest] additional parameters
     * @return {string} HTML anchor link
     */
    url(dest, ...rest) {
        let config, text;
        if (typeof rest[rest.length - 1] === "object") {
            // when config object is provided as parameter
            config = rest[rest.length - 1]; // config object is the last item in arguments
            if (rest.length === 2) {
                // addresses url( dest, text, { "class": "class1 class2" } )
                if (config.html) {
                    throw new Error("Cannot provide both text and configuration with html attribute");
                }
                text = rest[0];
            }
            else if (config && config.html) {
                // addresses url( dest, { "html": "text", "class": "class1 class2" } )
                text = config.html;
                delete config.html;
            }
            else {
                // addresses url( dest, { "class": "class1 class2" } )
                text = dest;
            }
        }
        else if (rest.length % 2 === 0) {
            // when no object is provided. example: url(dest,"html", "Click Here")
            config = listToObject_1.listToObject(...rest);
            if (config && "html" in config && config.html !== "") {
                // url(dest,"html", "Click Here")
                text = config.html;
                delete config.html;
            }
            else {
                // url(dest,"class", "class1 class2")
                text = dest;
            }
        }
        else {
            // addresses url(dest, "Click Here", "class", "class1 class2")
            text = rest.shift();
            config = listToObject_1.listToObject(...rest);
        }
        // Special handle offsite links
        if ("_type" in config && config._type === "offsite") {
            config["class"] = "offsite";
            config.target = "_blank";
            delete config._type;
        }
        // Generates anchor tag
        let html = `<a href="${dest}"`;
        if (typeof config === "object") {
            for (const key in config) {
                if (Object.prototype.hasOwnProperty.call(config, key)) {
                    html += ` ${key}="${config[key]}"`;
                }
            }
        }
        html += `>${text}</a>`;
        return html;
    },
};
//# sourceMappingURL=output.js.map
});

var asis_1 = createCommonjsModule(function (module, exports) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.asis = void 0;

/**
 * Returns a string asis without any translation.
 * NOTE: asis function only takes one non translatable string
 * @example
 *      asis({args:["cPanel"]}); // => cPanel
 * @param {string} nonTranslatableString The string that should not be translated.
 * @returns {string} string that should not be translated.
 */
function asis({ args: [nonTranslatableString, ...rejectedArgs], }) {
    if (!nonTranslatableString ||
        rejectedArgs.length > 0 ||
        typeof nonTranslatableString !== "string") {
        throw new Error("asis function accepts one non translatable string.");
    }
    // Implementation of embeddable methods chr()
    // [asis,cat chr(38) dog] => cat &amp; dog
    nonTranslatableString = nonTranslatableString.replace(/chr\((\d+)\)/g, function (template, p1) {
        return output_1.functions.chr(Number(p1));
    });
    // Implementation of embeddable method amp()
    // [asis,cat amp() dog] => cat &amp; dog
    nonTranslatableString = nonTranslatableString.replace(/amp\(\)/g, function (template) {
        return output_1.functions.amp();
    });
    return nonTranslatableString;
}
exports.asis = asis;
//# sourceMappingURL=asis.js.map
});

var comment_1 = createCommonjsModule(function (module, exports) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.comment = void 0;
/**
 * Ensures comments are not translated
 *
 * @example
 *      comment({args:["some random comment"]}) // => ""
 * @param {string} [commentText] Comment
 * @returns {string} empty string
 */
function comment({ args: [commentText] }) {
    return "";
}
exports.comment = comment;
//# sourceMappingURL=comment.js.map
});

var boolean_1 = createCommonjsModule(function (module, exports) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.boolean = void 0;
/**
 * Returns a string based on the truthy value of a condition.
 *
 * Perl has undef, but JavaScript has both null *and* undefined.
 * Let's treat null as undefined since JSON doesn't know what
 * undefined is, so serializers use null instead.
 *
 * @example
 *      boolean({args: [true,"yes","no", "maybe"]}); // => "yes"
 *      boolean({args: [false,"yes","no"]}) // => "no"
 *      boolean({args: [null,"yes","no", "maybe"]}); // => "maybe"
 * @param {any} condition      The value to test.
 * @param {string} whenTrue    The string to return when the condition is true.
 * @param {string} whenFalse   The string to return when the condition is false.
 * @param {string} [whenNull]   The string to return when the condition is null or undefined.
 */
function boolean({ args: [condition, whenTrue, whenFalse, whenNull], }) {
    if (whenTrue == null ||
        whenTrue.length === 0 ||
        whenFalse == null ||
        whenFalse.length === 0) {
        throw new Error("boolean function needs a valid whenTrue, whenFalse arguments.");
    }
    if (typeof condition !== "undefined" && condition) {
        return String(whenTrue);
    }
    else if (whenNull && condition == null) {
        return String(whenNull);
    }
    return String(whenFalse);
}
exports.boolean = boolean;
//# sourceMappingURL=boolean.js.map
});

var cldr = createCommonjsModule(function (module, exports) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.CLDR = void 0;
class CLDR {
    /**
     * Creates a new instance of cldr object.
     */
    constructor(cldr) {
        this.rawData = cldr;
        this.validateCLDR(this.rawData);
    }
    /**
     * validates CLDR data passed in
     * @param {RawCLDR} rawCLDR CLDR passed
     * @returns {boolean} returns true if cldr is valid.
     *                    Throws exception when cldr is missing required data
     */
    validateCLDR(rawCLDR) {
        const validCLDR = true;
        if (rawCLDR) {
            if (!rawCLDR.locale) {
                throw new Error("CLDR data is missing locale information");
            }
            if (!Object.prototype.hasOwnProperty.call(rawCLDR, "functions") ||
                Object.prototype.hasOwnProperty.call(rawCLDR, "get_plural_form") ||
                typeof rawCLDR.functions.get_plural_form !== "function") {
                throw new Error("CLDR data is missing function get_plural_form");
            }
            if (!Object.prototype.hasOwnProperty.call(rawCLDR, "datetime_info")) {
                throw new Error("CLDR data is missing datetime_info");
            }
            if (Object.prototype.hasOwnProperty.call(rawCLDR, "misc_info")) {
                if (!Object.prototype.hasOwnProperty.call(rawCLDR.misc_info, "cldr_formats")) {
                    throw new Error("CLDR data is missing cldr_formats");
                }
                if (!Object.prototype.hasOwnProperty.call(rawCLDR.misc_info, "orientation") ||
                    !Object.prototype.hasOwnProperty.call(rawCLDR.misc_info.orientation, "characters")) {
                    throw new Error("CLDR data is missing orientation information");
                }
                if (!Object.prototype.hasOwnProperty.call(rawCLDR.misc_info, "delimiters")) {
                    throw new Error("CLDR data is missing delimiter information");
                }
            }
            else {
                throw new Error("CLDR data is missing misc_info");
            }
        }
        else {
            throw new Error("CLDR data cannot be null");
        }
        return validCLDR;
    }
    /**
     * Gets the locale associated with CLDR
     *
     * @returns {string} the locale associated with CLDR
     */
    getLocale() {
        return this.rawData.locale;
    }
    /**
     * Choose the correct string variation based on the number provided
     *
     * @example
     *      getPluralForm(2, "bottle", "bottles") // => ["bottles",0]
     *      getPluralForm(0) // => ['other',0]
     *
     * @param {Number} num number based on which the string variation is determined
     * @param {...string} stringVariations string variations
     * @returns {any[] | undefined } The plural form of the statement.
     */
    getPluralForm(num, ...stringVariations) {
        const fn = this.rawData.functions.get_plural_form;
        return fn(num, ...stringVariations);
    }
    /**
     * Gets the datetime information from the CLDR data. Includes date format presets and abbriviations
     *
     * @returns {Object} Date time information
     */
    getDateTimeInfo() {
        return this.rawData.datetime_info;
    }
    /**
     * Gets the CLDR formats from the CLDR data.
     * Provides locale specific list and decimal.
     *
     * @returns {Object} cldr formats
     */
    getFormats() {
        return this.rawData.misc_info.cldr_formats;
    }
    /**
     * Gets the locale specific delimites from the CLDR data.
     * Provides quotation marks for the locale
     *
     * @returns {Object} delimiters
     */
    getDelimiters() {
        return this.rawData.misc_info.delimiters;
    }
    /**
     * Checks if the locale is right to left oriented.
     *
     * @returns {boolean} orientation
     */
    isRtl() {
        return this.rawData.misc_info.orientation.characters === "right-to-left";
    }
    /**
     * Checks if the locale is left to right oriented.
     *
     * @returns {boolean} orientation
     */
    isLtr() {
        return this.rawData.misc_info.orientation.characters === "left-to-right";
    }
}
exports.CLDR = CLDR;
//# sourceMappingURL=cldr.js.map
});

var quant_1 = createCommonjsModule(function (module, exports) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.format_bytes = exports.numf = exports.quant = exports.numerate = void 0;

/**
 * This returns the given noun form which is appropriate for the quantity according to this language's conventions.
 * numerate is used internally by quant to quantify nouns.
 *
 * @example
 *   numerate({cldr: cldr, args: [-1,"have one banana", "have many bananas", "owe you a banana"]}) // => owe you a banana
 *   numerate({cldr: cldr, args: [1,"have one banana", "have many bananas", "owe you a banana"]}) // => I have one banana
 *   numerate({cldr: cldr, args: [1,"have one banana", "have many bananas", "owe you a banana"]}) // => I have many bananas
 *
 * @param  {CLDR} cldr CLDR data
 * @param  {number} number quantity
 * @param  {string[]} rest Singular, Plural and Negative string
 * @return {string} formatted string
 */
function numerate({ cldr: cldr$1, args: [num, ...rest], }) {
    if (!(cldr$1 instanceof cldr.CLDR)) {
        throw new Error("`numerate` function requires a valid CLDR instance for the `cldr` parameter.");
    }
    const pluralForms = cldr$1.getPluralForm(num, ...rest);
    const numerated = pluralForms ? pluralForms[0] : rest[rest.length - 1];
    return numerated;
}
exports.numerate = numerate;
/**
 * Used for quantifying a noun.
 * Provides a variant of the string based on the absolute value of the number provided.
 *
 * @example
 *      quant({cldr: cldr, args:[10000, "test","tests"]}) // => "10,000 tests"
 *      quant({cldr: cldr, args:[0, "singular","plural", "nothing"]}) // => "nothing"
 *      quant({cldr: cldr, args:[[13.45789,2], "unit", "units"}) // => "13.46 units"
 * @param {CLDR} cldr cldr data
 * @param  {number|number[]} num Quantity on which the output depends.
 * @param  {string[]} rest singular, plural, zero string
 * @return {string} formatted string
 */
function quant({ cldr: cldr$1, args: [num, ...rest], }) {
    if (!(cldr$1 instanceof cldr.CLDR)) {
        throw new Error("`quant` function requires a valid CLDR instance for the `cldr` parameter.");
    }
    let quantity, decimalPlaces = 3;
    if (num instanceof Array) {
        decimalPlaces = num[1];
        quantity = num[0];
    }
    else {
        quantity = num;
    }
    const pluralForms = cldr$1.getPluralForm(quantity, ...rest);
    // If there's a mismatch between the actual number of forms
    // (singular, plural, etc.) and the real number, this can be
    // undefined, which can break code.  We pick the rightmost, or
    // "most plural," form as a fallback.
    const numerated = pluralForms
        ? pluralForms[0]
        : rest[rest.length - 1];
    const isSpecialZero = pluralForms && pluralForms.length >= 2 ? pluralForms[1] : 0;
    if (isSpecialZero) {
        return numerated;
    }
    const formatted = numf({ cldr: cldr$1, args: [quantity, decimalPlaces] });
    if (numerated.indexOf("%s") !== -1) {
        return numerated.replace(/%s/g, formatted);
    }
    return cldr$1.isRtl()
        ? numerated + " " + formatted
        : formatted + " " + numerated;
}
exports.quant = quant;
/**
 * Gets CLDR Decimal Format information
 *
 * @param {CLDR} cldr cldr information
 */
function getCLDRDecimalFormatInfo(cldr) {
    const decimalFormatInfo = {};
    const formats = cldr.getFormats();
    if (Object.prototype.hasOwnProperty.call(formats, "decimal")) {
        decimalFormatInfo.decimalFormat = formats.decimal;
    }
    if (Object.prototype.hasOwnProperty.call(formats, "_decimal_format_group")) {
        decimalFormatInfo.decimalGroup = formats._decimal_format_group;
    }
    if (Object.prototype.hasOwnProperty.call(formats, "_decimal_format_decimal")) {
        decimalFormatInfo.decimalDecimal = formats._decimal_format_decimal;
    }
    return decimalFormatInfo;
}
/**
 * Returns the given number formatted nicely according to this language's conventions.
 * Does not localize exponential formats
 *  @example
 *      numf({cldr, args:[1000.0012,3]}) // => 1,000.001
 *      numf({cldr, args:[6.022e23]}) // => "6.022e+23"
 *
 * @param {CLDR} cldr CLDR data
 * @param {number} num number to be formatted
 * @param {number} [decimalPlaces=6] decimal places
 * @return {string} formatted string
 */
function numf({ cldr: cldr$1, args: [num, decimalPlaces = 6], }) {
    if (!(cldr$1 instanceof cldr.CLDR)) {
        throw new Error("`numf` function requires a valid CLDR instance for the `cldr` parameter.");
    }
    // exponential -> don't know how to deal
    if (/e/.test(num.toString())) {
        return String(num);
    }
    const { decimalFormat, decimalGroup, decimalDecimal, } = getCLDRDecimalFormatInfo(cldr$1);
    if (!decimalFormat || !decimalGroup || !decimalDecimal) {
        throw new Error("CLDR Data is missing information related to formatting decimals.");
    }
    const isNegative = num < 0;
    num = Math.abs(num);
    // Trim the decimal part and round
    let whole = Math.floor(num);
    let fraction;
    if (/(?!')\.(?!')/.test(num.toString())) {
        // This weirdness is necessary to avoid floating-point
        // errors that can crop up with large-ish numbers.
        // Convert to a simple fraction.
        fraction = String(num).replace(/^[^.]+/, "0");
        // Now round to the desired precision.
        fraction = Number(fraction).toFixed(decimalPlaces);
        // e.g., 1.9999 when only 3 decimal places are desired.
        if (/^1/.test(fraction)) {
            whole++;
            num = whole;
            fraction = undefined;
        }
        else {
            // removes trailing 0's and returns fraction
            fraction = fraction.replace(/^.*\./, "").replace(/0+$/, "");
        }
    }
    let patternWithOutsideSymbols;
    // If language uses different formats for negative numbers than just adding "-" at the front,
    // you can put in two patterns, separated by a semicolon.
    // The first will be used for zero and positive values, while the second will be used for negative values.
    // http://cldr.unicode.org/translation/number-patterns
    if (/(?!');(?!')/.test(decimalFormat)) {
        patternWithOutsideSymbols = decimalFormat.split(/(?!');(?!')/)[isNegative ? 1 : 0];
    }
    else {
        patternWithOutsideSymbols = (isNegative ? "-" : "") + decimalFormat;
    }
    const innerPattern = patternWithOutsideSymbols.match(/[0#].*[0#]/)[0];
    // Applying the integer part of the pattern is much easier if it's
    // done with the strings reversed.
    const patternSplit = innerPattern.split(/(?!')\.(?!')/);
    const intPatternSplit = patternSplit[0]
        .split("")
        .reverse()
        .join("")
        .split(/(?!'),(?!')/);
    // If there is only one part of the int pattern, then set the "joiner"
    // to empty string. (http://unicode.org/cldr/trac/ticket/4094)
    let groupJoiner;
    if (intPatternSplit.length === 1) {
        groupJoiner = "";
    }
    else {
        // Most patterns look like #,##0.###, for which the leftmost # is
        // just a placeholder so we know where to put the group separator.
        intPatternSplit.pop();
        groupJoiner = decimalGroup;
    }
    const wholeReverse = String(whole).split("").reverse();
    const wholeAssembled = []; // reversed
    let pattern;
    const replacer = function (chr) {
        switch (chr) {
            case "#":
                return wholeReverse.shift() || "";
            case "0":
                return wholeReverse.shift() || "0";
        }
    };
    while (wholeReverse.length) {
        if (intPatternSplit.length) {
            pattern = intPatternSplit.shift();
        }
        // Since this is reversed, we can just replace a character
        // at a time, in regular forward order. Make sure we leave quoted
        // stuff alone while paying attention to stuff *by* quoted stuff.
        const assembleChunk = pattern
            .replace(/(?!')[0#]|[0#](?!')/g, replacer)
            .replace(/'([.,0#;¤%E])'$/, "")
            .replace(/'([.,0#;¤%E])'/, "$1");
        wholeAssembled.push(assembleChunk);
    }
    const formattedNumber = wholeAssembled.join(groupJoiner).split("").reverse().join("") +
        (fraction ? decimalDecimal + fraction : "");
    return patternWithOutsideSymbols.replace(/[0#].*[0#]/, formattedNumber);
}
exports.numf = numf;
/**
 * Formats bytes with the specific decimal places.
 * This depends on locale-specific overrides of base functionality
 * but should not itself need an override.
 *
 * @example
 * format_bytes({cldr, args: [22]}) // => 22 bytes
 * format_bytes({cldr, args: [1045, 2]}) // => 1.02 KB
 *
 * @param {number} bytes
 * @param {number} [decimalPlaces] Number of decimal places. Defaults to 2.
 * @return {string}
 */
function format_bytes({ cldr: cldr$1, args: [bytes, decimalPlaces = 2], }) {
    if (!(cldr$1 instanceof cldr.CLDR)) {
        throw new Error("`format_bytes` function requires a valid CLDR instance for the `cldr` parameter.");
    }
    // NOTE: There is no widely accepted consensus of exactly how to measure data
    // and which units to use for it. For example, some bodies define "B" to mean
    // bytes, while others don't. (NB: SI defines "B" to mean bels.) Some folks
    // use k for kilo; others use K. Some say kilo should be 1,024; others say
    // it's 1,000 (and "kibi" would be 1,024). What we do here is at least in
    // longstanding use at cPanel.
    const dataAbbreviations = [
        "KB",
        "MB",
        "GB",
        "TB",
        "PB",
        "EB",
        "ZB",
        "YB",
    ];
    const NBSP = "\u00a0";
    const exponent = bytes &&
        Math.min(Math.floor(Math.log(bytes) / Math.log(1024)), dataAbbreviations.length);
    if (!exponent) {
        return quant({ cldr: cldr$1, args: [bytes, "%s\u00a0byte", "%s\u00a0bytes"] }); // \u00a0 is a non breaking space
    }
    else {
        const quantity = bytes / Math.pow(1024, exponent);
        const formattedNumber = numf({
            cldr: cldr$1,
            args: [quantity, decimalPlaces],
        });
        return formattedNumber + NBSP + dataAbbreviations[exponent - 1];
    }
}
exports.format_bytes = format_bytes;
//# sourceMappingURL=quant.js.map
});

var datetime_1 = createCommonjsModule(function (module, exports) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.local_datetime = exports.datetime = exports.dateToLocalDayNum = void 0;

/**
 * Given a date object, this function returns the index needed for days-of-the-week
 * lookups in CLDR arrays. CLDR arrays start with Monday, not Sunday.
 *
 * @param  {Date} date   The date to look up.
 * @return {number}   The CLDR index corresponding to the date provided.
 */
const getCldrDayIndex = function (date) {
    // getUTCDay() starts from Sunday, but CLDR starts from Monday.
    const num = date.getUTCDay() - 1;
    return num < 0 ? 6 : num;
};
/**
 * This is a simple map from the return value of date.getUTCDay() to the standard
 * CLDR day of the week.
 *
 * UTC day numbers of the week start with Sunday and range 0-6.
 * CLDR day numbers of the week start with Monday and range from 1-7:
 *
 *     Mon   Tue   Wed   Thu   Fri   Sat   Sun
 *      1     2     3     4     5     6     7
 */
const utcToCldrMap = [7, 1, 2, 3, 4, 5, 6];
/**
 * Given a date object and the first day of the locale's week, this function
 * will return the CLDR numerical day of the week for the date.
 *
 * When referring to days of the week, CLDR uses the numbers 1-7, with 1 being
 * the first day of the week and 7 being the last.
 *
 * @example
 *   const tuesdayDate = new Date('Tue Dec 19 1995 00:00:00 UTC');
 *
 *   // When Sunday is the first day of week => Sun, Mon, Tue (3)
 *   dateToLocalDayNum( tuesdayDate, 7 ) // => 3
 *
 *   // When Monday is the first day of week => Mon, Tue (2)
 *   dateToLocalDayNum( tuesdayDate, 1 ) // => 2
 *
 * @example
 *   const sundayDate = new Date('Sun Dec 17 1995 00:00:00 UTC');
 *
 *   // When Sunday is the first day of week => Sun (1)
 *   dateToLocalDayNum( sundayDate, 7 ) // => 1
 *
 *   // When Monday is the first day of week => Mon, Tue, Wed, Thu, Fri, Sat, Sun (7)
 *   dateToLocalDayNum( sundayDate, 1 ) // => 7
 *
 * @export
 * @param {Date}   targetDate       The date we want to process.
 * @param {number} firstDayOfWeek   The locale's first day of the week, in CLDR's 1-7 notation (Mon = 1, Sun = 7).
 * @returns {number} The numerical day of the week for the date, in CLDR notation (1-7).
 */
function dateToLocalDayNum(targetDate, firstDayOfWeek) {
    // Convert the targetDate to the CLDR day number (1-7) to get it and firstDayOfWeek on the same scale.
    const targetDay = utcToCldrMap[targetDate.getUTCDay()];
    // Add a week to targetDay for simpler math. We normalize back down using the modulus.
    const offset = (targetDay + 7 - firstDayOfWeek) % 7;
    // We add 1 to the offset, because CLDR days of the week are numbered 1-7.
    return offset + 1;
}
exports.dateToLocalDayNum = dateToLocalDayNum;
/**
 * Given a string, this function will ensure that it reaches the specified length
 * with the specified filler character.
 *
 * @param {string} originalString   String that needs padding
 * @param {number} len              Required length of string
 * @param {string} fillerChar       Filler character
 * @returns {string} padded string
 */
const padStart = function (originalString, len, fillerChar) {
    let fill = "", toFill = 0;
    len = len || 0;
    fillerChar = String(fillerChar === undefined ? " " : fillerChar);
    toFill = len - String(originalString).length;
    if (toFill > 0) {
        fill = [...Array(toFill)]
            .map(String.prototype.valueOf, fillerChar)
            .join("");
    }
    return fill + originalString;
};
/**
 * The maketext datetime operator implementation. This function takes in a date or
 * unix timestamp (as an integer) along with an optional format string and returns
 * the given date and/or the current time in the format specified. If no format is
 * provided, the default long format date for the locale is used.
 *
 * The format string can use various presets or provide a custom string that uses
 * patterns for replacement. You can find a list of patterns at the following link,
 * though not all of them are implemented:
 *
 * https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
 *
 * Note: All times are in UTC. If you need localized time, use the local_datetime
 * function instead.
 *
 * @example
 *   // Format the current date using the default date format
 *   datetime({ cldr, args: [] })
 *
 * @example
 *   // Format the given unix timestamp (December 1, 1995 00:00:00 UTC) using the datetime_format_short preset
 *   datetime({ cldr, args: [817776000, 'datetime_format_short'] })
 *
 * @example
 *   // Format the given Date instance (December 1, 1995 00:00:00 UTC) using a custom pattern
 *   datetime({ cldr, args: [new Date(817776000 * 1000), 'MM/dd - HH:mm'] }) // => 12/1 - 00:00
 *
 * @param {CLDR}        cldr                  The CLDR data to be used.
 * @param {any[]}       args                  The array of args for the function.
 * @param {Date|number} args.[date]           The date to be formatted. If using a number, it should be the unix timestamp in seconds.
 * @param {string}      args.[formatString=date_format_long]   The format preset or template to follow.
 * @param {string}      [tzString]            An optional time zone string, mainly used by local_datetime(). Defaults to 'UTC', since
 *                                            all of the underlying JS time/date functions used by this method are the UTC variants.
 * @returns {string}   The formatted datetime.
 */
function datetime({ cldr: cldr$1, args: [date = new Date(), formatString], tzString = "UTC", }) {
    // Accept unix timestamps as well (integers only)
    if (typeof date === "number" && /^-?\d+$/.test(date.toString())) {
        date = new Date(date * 1000);
    }
    if (!(date instanceof Date)) {
        throw new Error("The datetime function only accepts Date instances or integer values (unix timestamps) for the `date` parameter.");
    }
    if (!(cldr$1 instanceof cldr.CLDR)) {
        throw new Error("The datetime function requires a valid CLDR instance for the `cldr` parameter.");
    }
    const dateTimeInfo = cldr$1.getDateTimeInfo();
    // Make sure we don't just grab any random CLDR datetime key.
    if (typeof formatString === "string" &&
        /^(?:date|time|datetime|special)_format_/.test(formatString)) {
        formatString = dateTimeInfo[formatString];
    }
    // Use the default format if one wasn't provided or the preset didn't exist.
    if (!formatString) {
        formatString = dateTimeInfo.date_format_long;
    }
    return formatString.replace(/('[^']+')|(([a-zA-Z])\3*)/g, 
    /**
     * A replacement function that will replace quoted strings and pattern strings in the formatString.
     * Each match will have either a quotedString or patternString defined.
     *
     * @param {string} substring       The substring of the main string that matched. Unused by this function.
     * @param {string} quotedString    The value of the first capture group. This capture group checks for
     *                                 strings enclosed in single quotes so they are passed through without
     *                                 transformation via pattern substitution.
     * @param {string} patternString   The value of the second capture group. This capture group checks for
     *                                 alphabetic characters for replacement patterns.
     * @returns {string}   The replacement string.
     */
    function (substring, quotedString, patternString) {
        if (quotedString) {
            return quoteSubstituter(quotedString);
        }
        else {
            return patternSubstituter(date, dateTimeInfo, patternString, tzString);
        }
    });
}
exports.datetime = datetime;
/**
 * This function strips quotation marks and returns the contained string as-is.
 * It is meant for ensuring that text within the quotes are not tested for pattern
 * substitutions.
 *
 * @param {string} quotedString   The quoted string to be processed.
 * @returns {string}   The contained string.
 */
function quoteSubstituter(quotedString) {
    return quotedString.substr(1, quotedString.length - 2);
}
/**
 * This function checks the matched patternString against all known patterns
 * and substitutes them for their datetime equivalents, following CLDR conventions.
 *
 * Pattern references:
 *   https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
 *   https://metacpan.org/pod/DateTime#CLDR-Patterns
 *
 * @param {Date}   date           The date being processed.
 * @param {Object} dateTimeInfo   The dateTimeInfo from the locale's CLDR data.
 * @param {string} patternString  The pattern that has been matched.
 * @returns {string}   Substitution string
 */
function patternSubstituter(date, dateTimeInfo, patternString, tzString) {
    switch (patternString) {
        case "yy":
            // 2 digit year
            return Math.abs(date.getUTCFullYear()).toString().slice(-2);
        case "y":
        case "yyy":
        case "yyyy":
            // Year
            return String(Math.abs(date.getUTCFullYear()));
        case "MMMMM":
            // Narrow month
            return dateTimeInfo.month_format_narrow[date.getUTCMonth()];
        case "LLLLL":
            // Narrow standalone month
            return dateTimeInfo.month_stand_alone_narrow[date.getUTCMonth()];
        case "MMMM":
            // Wide month
            return dateTimeInfo.month_format_wide[date.getUTCMonth()];
        case "LLLL":
            // Wide standalone month
            return dateTimeInfo.month_stand_alone_wide[date.getUTCMonth()];
        case "MMM":
            // Abbreviated month
            return dateTimeInfo.month_format_abbreviated[date.getUTCMonth()];
        case "LLL":
            // Abbreviated standalone month
            return dateTimeInfo.month_stand_alone_abbreviated[date.getUTCMonth()];
        case "MM":
        case "LL":
            // 2 digit, padded numeric month
            return padStart((date.getUTCMonth() + 1).toString(), 2, "0");
        case "M":
        case "L":
            // Unpadded numeric month
            return String(date.getUTCMonth() + 1);
        case "EEEE":
            // Wide day of the week
            return dateTimeInfo.day_format_wide[getCldrDayIndex(date)];
        case "EEE":
        case "EE":
        case "E":
            // Abbreviated day of the week
            return dateTimeInfo.day_format_abbreviated[getCldrDayIndex(date)];
        case "EEEEE":
            // Narrow day of the week
            return dateTimeInfo.day_format_narrow[getCldrDayIndex(date)];
        case "cccc":
            // Wide day of the week
            return dateTimeInfo.day_stand_alone_wide[getCldrDayIndex(date)];
        case "ccc":
            // Abbreviated day of the week
            return dateTimeInfo.day_stand_alone_abbreviated[getCldrDayIndex(date)];
        case "cc":
        case "c":
            // Numeric day of the week (1-7)
            return String(dateToLocalDayNum(date, Number(dateTimeInfo.first_day_of_week)));
        case "ccccc":
            // Narrow day of the week
            return dateTimeInfo.day_stand_alone_narrow[getCldrDayIndex(date)];
        case "dd":
            // 2 digit, padded numeric day of the month
            return padStart(date.getUTCDate().toString(), 2, "0");
        case "d":
            // Unpadded numeric day of the month
            return String(date.getUTCDate());
        case "h":
        case "hh": {
            // Padded and unpadded hours on the 12 hour clock
            let twelve_hours = date.getUTCHours();
            if (twelve_hours > 12) {
                twelve_hours -= 12;
            }
            // The midnight hour is represented as 12:XX in 12 hour format
            if (twelve_hours === 0) {
                twelve_hours = 12;
            }
            const result = patternString === "hh"
                ? padStart(twelve_hours.toString(), 2, "0")
                : twelve_hours;
            return String(result);
        }
        case "H":
            // Unpadded hours on the 24 hour clock
            return String(date.getUTCHours());
        case "HH":
            // 2 digit, padded hours on the 24 hour clock
            return padStart(date.getUTCHours().toString(), 2, "0");
        case "m":
            // Unpadded minutes
            return String(date.getUTCMinutes());
        case "mm":
            // 2 digit, padded minutes
            return padStart(date.getUTCMinutes().toString(), 2, "0");
        case "s":
            // Unpadded seconds
            return String(date.getUTCSeconds());
        case "ss":
            // 2 digit, padded seconds
            return padStart(date.getUTCSeconds().toString(), 2, "0");
        case "a": {
            // AM/PM
            const hours = date.getUTCHours();
            if (hours < 12) {
                return dateTimeInfo.am_pm_abbreviated[0];
            }
            else if (hours > 12) {
                return dateTimeInfo.am_pm_abbreviated[1];
            }
            // CLDR defines "noon", but CPAN DateTime::Locale doesn't have it, so we just use PM.
            return dateTimeInfo.am_pm_abbreviated[1];
        }
        case "z":
        case "zzzz":
        case "v":
        case "vvvv":
            // Time zone string. Defaults to UTC, unless you're coming through local_datetime.
            return tzString;
        case "G":
        case "GG":
        case "GGG":
            // Abbreviated era (AD/BC)
            return dateTimeInfo.era_abbreviated[date.getUTCFullYear() < 0 ? 0 : 1];
        case "GGGGG":
            // Narrow era
            return dateTimeInfo.era_narrow[date.getUTCFullYear() < 0 ? 0 : 1];
        case "GGGG":
            // Wide era
            return dateTimeInfo.era_wide[date.getUTCFullYear() < 0 ? 0 : 1];
    }
    return patternString;
}
/**
 * The maketext local_datetime operator implementation. This function mimics the
 * datetime operator, except that it also takes into account the local time zone.
 *
 * See datetime for more information on its usage.
 *
 * @example
 *   // Format the given Date instance using a custom pattern in the local time zone.
 *   // Fri Dec 1 1995 00:00:00 UTC => Thu Nov 30 1995 18:00:00 CST
 *   datetime({ cldr, args: [new Date(817776000 * 1000), 'MM/dd - HH:mm'] }) // => 11/30 - 18:00
 *
 * @param {CLDR}        cldr                  The CLDR data to be used.
 * @param {any[]}       args                  The array of args for the function.
 * @param {Date|number} args.[date]           The date to be formatted. If using a number, it should be the unix timestamp in seconds.
 * @param {string}      args.[formatString]   The format preset or template to follow.
 * @returns {string}   The formatted datetime in the local time zone.
 */
function local_datetime({ cldr: cldr$1, args: [date = new Date(), formatString], }) {
    // Accept unix timestamps as well (integers only)
    if (typeof date === "number" && /^-?\d+$/.test(date.toString())) {
        date = new Date(date * 1000);
    }
    if (!(date instanceof Date)) {
        throw new Error("The datetime function only accepts Date instances or integer values (unix timestamps) for the `date` parameter.");
    }
    if (!(cldr$1 instanceof cldr.CLDR)) {
        throw new Error("The datetime function requires a valid CLDR instance for the `cldr` parameter.");
    }
    /**
     * Because all of the datetime substitutions rely on UTC time functions,
     * we need to manually adjust the base UTC time of the date object by the
     * local offset to get the final results in local time.
     *
     * (This has to happen on the passed-in object because of the tests’
     * use of spyOn().)
     */
    const tzOffset = date.getTimezoneOffset();
    // Now that we’ve grabbed the TZ offset, clone the date so that we
    // don’t affect the caller.
    date = new Date(date);
    date.setMinutes(date.getMinutes() - tzOffset);
    // Process the time zone string that datetime() will use in place of 'UTC'
    const offsetSign = tzOffset > 0 ? "-" : "+";
    const offsetHours = Math.floor(Math.abs(tzOffset) / 60);
    const offsetMinutes = Math.abs(tzOffset % 60);
    const tzString = "GMT" +
        offsetSign +
        padStart(offsetHours.toString(), 2, "0") +
        padStart(offsetMinutes.toString(), 2, "0");
    return datetime({
        cldr: cldr$1,
        args: [date, formatString],
        tzString,
    });
}
exports.local_datetime = local_datetime;
//# sourceMappingURL=datetime.js.map
});

var list = createCommonjsModule(function (module, exports) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.list_or = exports.list_and = exports.list_or_quoted = exports.list_and_quoted = void 0;
/**
 * Quote a string based on CLDR quoting rules
 *
 * @private
 * @param {CLDR} cldr cldr data
 * @param {string} str string to be quoted
 * @returns {string}
 */
function _quote(cldr, str) {
    const delimiters = cldr.getDelimiters();
    if (delimiters &&
        Object.prototype.hasOwnProperty.call(delimiters, "quotation_start") &&
        Object.prototype.hasOwnProperty.call(delimiters, "quotation_end")) {
        return delimiters.quotation_start + str + delimiters.quotation_end;
    }
    return str;
}
/**
 * Helper to build a quoted list via the list_and or list_or functions.
 *
 * @param {CLDR} cldr
 * @param {string} joinFnName Name of the method used to join the elements of the args.
 * @param {...any} args List of arguments.
 * @returns {string}
 */
function _list_quoted(cldr, joinFnName, ...args) {
    let list = args.slice();
    if (list.length === 1 && Array.isArray(list[0])) {
        list = list[0].slice();
    }
    // Emulate Locales.pm _quote_get_list_items() list_quote_mode 'all'.
    // list_or(), currently not implemented in JS (no reason for it not to be), will need to behave the same
    if (typeof list === "undefined" || list.length === 0) {
        list = [""];
    }
    list = list.map((el) => {
        return _quote(cldr, el);
    });
    switch (joinFnName) {
        case "list_and":
            return list_and({ cldr: cldr, args: list });
        case "list_or":
            return list_or({ cldr: cldr, args: list });
        default:
            throw new Error("Did you mean list_and_quoted or list_or_quoted?");
    }
}
/**
 * Quotes each value and then returns a localized “and”-list of them.
 *
 * @example
 *  list_and_quoted({cldr, args:["foo"]}) // => “foo”
 *  list_and_quoted({cldr, args:["foo", "bar"]}) // => “foo” and “bar”
 *  list_and_quoted({cldr, args:["foo", "bar", "baz"]}) // => “foo”, “bar”, and “baz”
 *
 * @param {string[]} list list of items to generated from.
 * @return {string} The localized list of quoted items.
 */
function list_and_quoted({ cldr, args: [...list], }) {
    return _list_quoted(cldr, "list_and", ...list);
}
exports.list_and_quoted = list_and_quoted;
/**
 * Quotes each value and then returns a localized “or”-list of them.
 *
 * @example
 *  list_or_quoted({cldr, args:["foo"]}) // => “foo”
 *  list_or_quoted({cldr, args:["foo", "bar"]}) // => “foo” or “bar”
 *  list_or_quoted({cldr, args:["foo", "bar", "baz"]}) // => “foo”, “bar”, or “baz”
 *
 * @param {string[]} list list of items to generated from.
 * @return {string} The localized list of quoted items.
 */
function list_or_quoted({ cldr, args: [...list], }) {
    return _list_quoted(cldr, "list_or", ...list);
}
exports.list_or_quoted = list_or_quoted;
/**
 * Joins list based on cldr rules
 *
 * @param {CLDR} cldr
 * @param {string} templateName
 * @param {...string} args
 *
 * @returns {string} Returned joined list
 */
function _list_join_cldr(cldr, templateName, ...args) {
    let list = args.slice();
    if (list.length === 1 && Array.isArray(list[0])) {
        list = list[0].slice();
    }
    const len = list.length;
    let cldr_list, pattern, text, i;
    try {
        cldr_list = cldr.getFormats()[templateName];
    }
    catch (e) {
        throw new Error("CLDR Data is missing information related to formatting list.");
    }
    const replacer = function (str, p1) {
        switch (p1) {
            case "0":
                return text;
            case "1":
                return list[i++];
        }
    };
    switch (len) {
        case 0:
            return "";
        case 1:
            return String(list[0]);
        default:
            if (len === 2) {
                text = cldr_list["2"];
            }
            else {
                text = cldr_list.start;
            }
            text = text.replace(/\{([01])\}/g, function (all, bit) {
                return list[bit];
            });
            if (len === 2) {
                return text;
            }
            i = 2;
            while (i < len) {
                pattern = cldr_list[i === len - 1 ? "end" : "middle"];
                text = pattern.replace(/\{([01])\}/g, replacer);
            }
            return text;
    }
}
/**
 * Generates an and style string from the list.
 *
 * @example
 *  list_and({cldr, args:["foo"]}) // => "foo"
 *  list_and({cldr, args:["foo", "bar"]}) // => "foo and bar"
 *  list_and({cldr, arg:["foo", "bar", "baz"]}) // => "foo, bar, and baz"
 *
 * @param {CLDR} cldr
 * @param {string[]} list
 * @return {string} Generates an and style string from the list.
 */
function list_and({ cldr, args: [...list], }) {
    return _list_join_cldr(cldr, "list", ...list);
}
exports.list_and = list_and;
/**
 * Generates an or style string from the list.
 *
 * @example
 *  list_or({cldr, args:["foo"]}) // => "foo"
 *  list_or({cldr, args:["foo", "bar"]}) // => "foo or bar"
 *  list_or({cldr, arg:["foo", "bar", "baz"]}) // => "foo, bar, or baz"
 *
 * @param {CLDR} cldr
 * @param {string[]} list
 * @return {string} Generates an or style string from the list.
 */
function list_or({ cldr, args: [...list], }) {
    return _list_join_cldr(cldr, "list_or", ...list);
}
exports.list_or = list_or;
//# sourceMappingURL=list.js.map
});

var functions = createCommonjsModule(function (module, exports) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.functions = void 0;







exports.functions = {
    asis: asis_1.asis,
    output: output_1.output,
    comment: comment_1.comment,
    boolean: boolean_1.boolean,
    numf: quant_1.numf,
    numerate: quant_1.numerate,
    quant: quant_1.quant,
    format_bytes: quant_1.format_bytes,
    datetime: datetime_1.datetime,
    local_datetime: datetime_1.local_datetime,
    list_and: list.list_and,
    list_or: list.list_or,
    list_or_quoted: list.list_or_quoted,
    list_and_quoted: list.list_and_quoted,
};
//# sourceMappingURL=index.js.map
});

var maketext_1 = createCommonjsModule(function (module, exports) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.maketext = exports.functions = exports.config = void 0;

const fauxComma = "\x07";
exports.config = {
    // eslint-disable-next-line no-useless-escape -- ignore for regex
    bracketRe: /([^~\[\]]+|~.|\[|\]|~)/g,
    underscoreDigitRe: /^_(\d+)$/,
    // This character (the bell) will be used as a replacement for escaped
    // commas so we can split out the string of bracket args by commas.
    fauxComma: fauxComma,
    fauxCommaRe: new RegExp(fauxComma, "g"),
    // These are the only characters that will be escaped by a tilde outside
    // of a bracket group.
    tildeChars: new Set(["[", "]", "~"]),
};
exports.functions = {
    ...functions.functions,
};
/**
 * Generate a string using the template and the arguments in the current locale.
 *
 * @param {CLDR} cldr CLDR data
 * @param {Lexicon} lexicon   The set of translated strings to use in place of the ones used by the original template.
 * @param {string} template   The string template to process.
 * @param {any[]} params      The arguments to use during template processing.
 */
function maketext({ cldr, lexicon, template, args: params, }) {
    if (typeof template !== "string") {
        throw "You must pass a string template to the maketext function.";
    }
    // Use the translated version of the template, if available.
    template = (lexicon && lexicon[template]) || template;
    // No bracket notation in the template, so there's no need to parse it.
    if (template.indexOf("[") === -1) {
        return template;
    }
    /**
     * Split the template string into chunks that are ready for parsing and
     * executing bracket notation, substituting variables, and heeding escape
     * characters.
     *
     * @example
     *   const template = 'Setting applied to [numf,_1] files.';
     *   // pieces => [ 'Setting applied to ', '[', 'numf,_1', ']', ' files.' ]
     *
     * @example
     *   const template = 'The files were [boolean,_1,found,lost~, corrupted~, or deleted].';
     *   // pieces => [ 'The files were ', '[', 'boolean,_1,found,lost', '~,', ' corrupted', '~,', 'or deleted', ']', '.' ]
     *
     *   // Note: This is a contrived example, and you should use list_or
     *   // instead of hard-coding the commas in the boolean bracket function.
     */
    const pieces = template.match(exports.config.bracketRe) || [];
    // The finalized string pieces that will be joined together to form the ultimate string.
    const processedStringPieces = [];
    let inBracketGroup = false;
    let bracketArgs = "";
    pieces.forEach((currentPiece) => {
        if (currentPiece === "[") {
            // This should be the start of a bracket group.
            if (inBracketGroup) {
                throw Error(`Invalid maketext string: ${template} \nThe string contains nested brackets.`);
            }
            inBracketGroup = true;
        }
        else if (currentPiece === "]") {
            // This should be the end of a bracket group.
            if (!inBracketGroup) {
                throw Error(`Invalid maketext string: ${template} \nThe string contains an unmatched closing bracket character (]).`);
            }
            if (!bracketArgs) {
                throw Error(`Invalid maketext string: ${template} \nThe string contains empty brackets. Use the escape character (~) if the bracket characters were meant to be printed literally.`);
            }
            inBracketGroup = false;
            /**
             * Since we're at the end of the bracket and have transformed any
             * escaped characters, we will finally proceed with processing the
             * bracket function.
             */
            let processedBracket;
            try {
                processedBracket = processBracket(cldr, bracketArgs, params);
            }
            catch (error) {
                throw Error(`Invalid maketext string: ${template} \n${error}`);
            }
            bracketArgs = "";
            processedStringPieces.push(processedBracket);
        }
        else if (currentPiece.charAt(0) === "~") {
            // Tilde is our escape character.
            const realChar = currentPiece.charAt(1) || "~"; // The fallback handles tildes at the ends of strings.
            if (inBracketGroup) {
                if (realChar === ",") {
                    // Commas are a special case because we will split the bracketArgs string by
                    // commas later. To avoid that conflict, we will use a stand-in character instead.
                    bracketArgs += exports.config.fauxComma;
                }
                else {
                    // All other escaped characters are inserted as-is.
                    bracketArgs += realChar;
                }
            }
            else if (exports.config.tildeChars.has(realChar)) {
                // We only escape certain characters outside of brackets.
                processedStringPieces.push(realChar);
            }
            else {
                processedStringPieces.push(currentPiece);
            }
        }
        else if (inBracketGroup) {
            bracketArgs += currentPiece;
        }
        else {
            processedStringPieces.push(currentPiece);
        }
    });
    if (inBracketGroup) {
        throw Error(`Invalid maketext string: ${template} \nThe string contains an unmatched opening bracket character ([).`);
    }
    return processedStringPieces.join("");
}
exports.maketext = maketext;
/**
 * Executes the function or substitution expressed by the bracketString. This string can
 * be comma-delimited to use arguments, so any literal commas must be replaced by the
 * fuaxComma stand-in.
 *
 * @param {CLDR}   cldr            The CLDR data for the locale.
 * @param {string} bracketString   The contents of the bracket as a single string.
 * @param {any[]}  maketextArgs    The array of arguments that were passed to the maketext function. These values
                                   will be used for any substitions specified by the bracketString.
 * @returns {string}   The resulting string from executing the substitution or bracket function.
 */
function processBracket(cldr, bracketString, maketextArgs) {
    let bracketArgs = bracketString.split(",");
    // Change our placeholders for escaped commas back to actual commas, now that we've performed our split.
    bracketArgs = bracketArgs.map((currentBracketArg) => currentBracketArg.replace(exports.config.fauxCommaRe, ","));
    // If there is only one item in the bracket, it must be a basic arg substitution.
    if (bracketArgs.length === 1) {
        if (!exports.config.underscoreDigitRe.test(bracketArgs[0])) {
            throw "A bracket must contain more than one argument, unless it is a pure substition.\n Example: Number of accounts: [_1]";
        }
        const [result] = substituteBracketArgs(bracketArgs, maketextArgs);
        return String(result);
    }
    // Otherwise, we are using a function, so get the function name first.
    const fnName = bracketArgs.shift();
    if (!fnName || typeof exports.functions[fnName] !== "function") {
        throw `Invalid function "${fnName}" in maketext string.`;
    }
    const finalBracketArgs = substituteBracketArgs(bracketArgs, maketextArgs);
    return exports.functions[fnName]({
        cldr,
        args: finalBracketArgs,
    });
}
/**
 * Takes an array of arguments to a bracket function and substitutes in any values
 * from the arguments that were passed to the maketext function for _N or _* bracket
 * arguments.
 *
 * Note: Bracket functions do not accept both _N and _* arguments for the same call.
 *
 * @param {string[]} bracketArgs    The arguments for the bracket function.
 * @param {any[]}    maketextArgs   The array of arguments that were passed to the maketext function.
 * @returns {any[]}   The same list of bracketArgs, with any variable substitutions performed.
 */
function substituteBracketArgs(bracketArgs, maketextArgs) {
    const finalBracketArgs = [];
    let hasWildcardSubs = false;
    let hasNumericSubs = false;
    bracketArgs.forEach((currentBracketArg, currentBracketArgIndex) => {
        if (currentBracketArg.charAt(0) === "_") {
            if (currentBracketArg === "_*") {
                if (hasNumericSubs) {
                    throw `You cannot combine wildcard substitution (_*) with a numeric substitution (e.g. _1) in the same bracket.`;
                }
                // _* takes all arguments and passes them straight through. The _* substitution will always be the last one.
                finalBracketArgs.push(...maketextArgs);
                hasWildcardSubs = true;
            }
            else {
                // Try to match _1, _2, etc.
                const match = currentBracketArg.match(exports.config.underscoreDigitRe);
                if (match) {
                    if (hasWildcardSubs) {
                        throw `You cannot combine wildcard substitution (_*) with a numeric substitution (e.g. _1) in the same bracket.`;
                    }
                    const [substitionText, maketextArgNumber] = match;
                    const maketextArgIndex = Number(maketextArgNumber) - 1; // Maketext numeric substitutions are 1-based instead of 0-based.
                    // Check to make sure that the arg we want was actually passed.
                    if (maketextArgIndex in maketextArgs) {
                        // Sub out the values.
                        finalBracketArgs.push(maketextArgs[maketextArgIndex]);
                        hasNumericSubs = true;
                    }
                    else {
                        throw `The "${substitionText}" substitution argument was not passed to the maketext function.`;
                    }
                }
            }
        }
        else {
            finalBracketArgs.push(currentBracketArg);
        }
    });
    return finalBracketArgs;
}
//# sourceMappingURL=index.js.map
});

var locale$x = createCommonjsModule(function (module, exports) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.Locale = void 0;





class Locale {
    /**
     * Create a new locale object based on some external environments.
     *
     * @param {RawCLDR}    rawCLDR locale specific CLDR functions and data
     * @param {Lexicon}    [lexicon]  Strings in the current locale for the application. Stored as a hash/object. Defaults to an empty hash/object.
     */
    constructor(rawCLDR, lexicon = {}) {
        this.lexicon = lexicon;
        this._cldr = new cldr.CLDR(rawCLDR);
    }
    /**
     * Generate a string using the template and the arguments in the current locale.
     *
     * @param {string} template maketext template
     * @param {any[]} params any additional arguments needed by maketext template
     * @returns {string} Generated string based on maketext template
     */
    maketext(template, ...params) {
        const localeData = {
            cldr: this._cldr,
            lexicon: this.lexicon,
            template: template,
            args: params,
        };
        return maketext_1.maketext(localeData);
    }
    /**
     * Localizes a date to the local timezone. Equivalent to (but cleaner than)
     * `maketext('[local_datetime,_1,my_fave_format]', date)`.
     *
     * @param {Date|number} [date=new Date()]            The date to be formatted. If using a number, it should be the unix timestamp in seconds.
     * @param {string}      [formatString=date_format_long]    The format preset (e.g., `datetime_format_medium`) or template to follow. Should be one of the string format options documented for Perl’s Locale::Maketext::Utils’s [datetime()](https://metacpan.org/dist/Locale-Maketext-Utils/view/lib/Locale/Maketext/Utils.pod#datetime%28%29) method.
     *
     * @returns {string} The localized date in the user’s timezone.
     */
    localDatetime(date, formatString) {
        return this._datetimeWrapper(datetime_1.local_datetime, date, formatString);
    }
    /**
     * **STOP!** Are you sure you don’t want `local_datetime`?
     *
     * Like `localDatetime()` but localizes a date to UTC rather than
     * the user’s timezone.
     *
     * If you use this function, be sure to tell the user that the
     * time displayed is UTC, not local time. Since most users will
     * expect local time, it’s generally better to use `local_datetime`
     * than to use this function. (Some users won’t know what UTC is!)
     *
     * @param {Date|number} [date=new Date()]            The date to be formatted. If using a number, it should be the unix timestamp in seconds.
     * @param {string}      [formatString=date_format_long]    The format preset (e.g., `datetime_format_medium`) or template to follow. See `localDatetime()` for more details.
     *
     * @returns {string} The localized date in UTC timezone.
     */
    datetime(date, formatString) {
        return this._datetimeWrapper(datetime_1.datetime, date, formatString);
    }
    _datetimeWrapper(datetimeFunc, date, formatString) {
        const localeData = {
            cldr: this._cldr,
            args: [date, formatString],
        };
        return datetimeFunc(localeData);
    }
    /**
     * Returns current locale
     *
     * @returns {string} Current locale
     */
    getCurrentLocale() {
        return this._cldr.getLocale();
    }
    /**
     * Returns true if the locale is right to left based. Returns false otherwise.
     */
    get isRtl() {
        return this._cldr.isRtl();
    }
    /**
     * Returns true if the locale is left to right based. Returns false otherwise.
     */
    get isLtr() {
        return this._cldr.isLtr();
    }
    /**
     * Returns the current cldr object for the locale.
     */
    get cldr() {
        return this._cldr;
    }
    /**
     * Returns the given number formatted nicely according to this language's conventions.
     * Does not localize exponential formats
     *  @example
     *      numf(1000.0012,3) // => 1,000.001
     *      numf(6.022e23) // => "6.022e+23"
     *
     * @param {number} num number to be formatted
     * @param {number} [decimalPlaces=6] decimal places
     * @return {string} formatted string
     */
    numf(num, decimalPlaces) {
        return this._formatNumber(quant_1.numf, num, decimalPlaces);
    }
    /**
     * Formats bytes with the specific decimal places.
     * This depends on locale-specific overrides of base functionality
     * but should not itself need an override.
     *
     * @example
     * format_bytes(22) // => 22 bytes
     * format_bytes(1045, 2) // => 1.02 KB
     *
     * @param {number} bytes
     * @param {number} [decimalPlaces] Number of decimal places. Defaults to 2.
     * @return {string}
     */
    format_bytes(num, decimalPlaces) {
        return this._formatNumber(quant_1.format_bytes, num, decimalPlaces);
    }
    _formatNumber(func, ...args) {
        return this._callCLDRFunc(func, args);
    }
    /**
     * Generates an and style string from the list.
     *
     * @example
     *  list_and("foo") // => "foo"
     *  list_and("foo", "bar") // => "foo and bar"
     *  list_and("foo", "bar", "baz") // => "foo, bar, and baz"
     *
     * @param {...string} list
     * @return {string} The localized output.
     */
    list_and(...args) {
        return this._callCLDRFunc(list.list_and, args);
    }
    /**
     * Like `list_and()` but quotes each list item.
     *
     * @param {...string} list
     * @return {string} The localized output.
     */
    list_and_quoted(...args) {
        return this._callCLDRFunc(list.list_and_quoted, args);
    }
    /**
     * Like `list_and()` but expresses an “or” instead of “and”.
     *
     * @param {...string} list
     * @return {string} The localized output.
     */
    list_or(...args) {
        return this._callCLDRFunc(list.list_or, args);
    }
    /**
     * Like `list_or()` but quotes each list item.
     *
     * @param {...string} list
     * @return {string} The localized output.
     */
    list_or_quoted(...args) {
        return this._callCLDRFunc(list.list_or_quoted, args);
    }
    _callCLDRFunc(func, args) {
        return func({
            cldr: this._cldr,
            args: args,
        });
    }
}
exports.Locale = Locale;
//# sourceMappingURL=locale.js.map
});

var dist = createCommonjsModule(function (module, exports) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.Locale = void 0;

Object.defineProperty(exports, "Locale", { enumerable: true, get: function () { return locale$x.Locale; } });
//# sourceMappingURL=index.js.map
});

/**
# cpanel - ui/web-components/src/utils/locale.ts   Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
 */
let localeInstance;
function getLocaleInstance() {
  if (typeof localeInstance !== "undefined") {
    return localeInstance;
  }
  const { LEXICON, CLDR } = window;
  if (!LEXICON || !CLDR) {
    throw new Error("The window object is missing keys required for localization!");
  }
  localeInstance = new dist.Locale(CLDR, LEXICON);
  return localeInstance;
}
/**
 * Ideally we might give the Locale object’s locale ID (e.g., `de`) to
 * .toLocaleLowerCase() in order to ensure parity between the browser’s
 * localization and our own. This is here so that, if we make that
 * change in the future, we’ll just have to update one place rather
 * than everywhere that we do this.
 */
function toLocaleLowerCase(input) {
  return input.toLocaleLowerCase();
}

const cpConsentPrivacySettingsCss = "@charset \"UTF-8\";:root{--cp-font-weight-semi-bold:600}:root{--bs-blue:#0d6efd;--bs-indigo:#6610f2;--bs-purple:#6f42c1;--bs-pink:#d63384;--bs-red:#dc3545;--bs-orange:#fd7e14;--bs-yellow:#ffc107;--bs-green:#198754;--bs-teal:#20c997;--bs-cyan:#0dcaf0;--bs-white:#fff;--bs-gray:#6c757d;--bs-gray-dark:#343a40;--bs-gray-100:#f8f9fa;--bs-gray-200:#e9ecef;--bs-gray-300:#dee2e6;--bs-gray-400:#ced4da;--bs-gray-500:#adb5bd;--bs-gray-600:#6c757d;--bs-gray-700:#495057;--bs-gray-800:#343a40;--bs-gray-900:#212529;--bs-primary:#0d6efd;--bs-secondary:#6c757d;--bs-success:#198754;--bs-info:#0dcaf0;--bs-warning:#ffc107;--bs-danger:#dc3545;--bs-light:#f8f9fa;--bs-dark:#212529;--bs-primary-rgb:13, 110, 253;--bs-secondary-rgb:108, 117, 125;--bs-success-rgb:25, 135, 84;--bs-info-rgb:13, 202, 240;--bs-warning-rgb:255, 193, 7;--bs-danger-rgb:220, 53, 69;--bs-light-rgb:248, 249, 250;--bs-dark-rgb:33, 37, 41;--bs-white-rgb:255, 255, 255;--bs-black-rgb:0, 0, 0;--bs-body-color-rgb:8, 25, 62;--bs-body-bg-rgb:247, 248, 250;--bs-font-sans-serif:system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, \"Noto Sans\", \"Liberation Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\";--bs-font-monospace:SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;--bs-gradient:linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));--bs-body-font-family:var(--cp-font-family-roboto);--bs-body-font-size:1rem;--bs-body-font-weight:400;--bs-body-line-height:1.5;--bs-body-color:#08193e;--bs-body-bg:#F7F8FA}:root{--cp-font-family-roboto:“Roboto”, -apple-system, BlinkMacSystemFont, “Segoe UI”, “Oxygen”, “Ubuntu”, “Cantarell”, “Fira Sans”, “Droid Sans”, “Helvetica Neue”, sans-serif;--cp-spacer-0:0;--cp-spacer-1:0.25rem;--cp-spacer-2:0.5rem;--cp-spacer-3:1rem;--cp-spacer-4:1.5rem;--cp-spacer-5:2rem;--cp-spacer-6:3rem;--cp-border-width-1:1px;--cp-border-width-2:2px;--cp-border-width-3:3px;--cp-border-width-4:4px;--cp-border-width-5:5px;--cp-small-font-size:0.875em;--cp-main-menu-width:clamp(240px, 14.8vw, 320px);--cp-header-height:60px;--cp-stat-header-height:50px;--cp-current-viewport:xs}@media (min-width: 576px){:root{--cp-current-viewport:sm}}@media (min-width: 768px){:root{--cp-current-viewport:md}}@media (min-width: 992px){:root{--cp-current-viewport:lg}}@media (min-width: 1200px){:root{--cp-current-viewport:xl}}*,*::before,*::after{box-sizing:border-box}@media (prefers-reduced-motion: no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:var(--bs-body-font-family);font-size:var(--bs-body-font-size);font-weight:var(--bs-body-font-weight);line-height:var(--bs-body-line-height);color:var(--bs-body-color);text-align:var(--bs-body-text-align);background-color:var(--bs-body-bg);-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:rgba(0, 0, 0, 0)}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:0.25}hr:not([size]){height:1px}h6,h5,h4,h3,h2,h1{margin-top:0;margin-bottom:0.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.3125rem + 0.75vw)}@media (min-width: 1200px){h1{font-size:1.875rem}}h2{font-size:calc(1.2875rem + 0.45vw)}@media (min-width: 1200px){h2{font-size:1.625rem}}h3{font-size:calc(1.275rem + 0.3vw)}@media (min-width: 1200px){h3{font-size:1.5rem}}h4{font-size:calc(1.2625rem + 0.15vw)}@media (min-width: 1200px){h4{font-size:1.375rem}}h5{font-size:1.25rem}h6{font-size:1.125rem}p{margin-top:0;margin-bottom:1rem}abbr[title],abbr[data-bs-original-title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}[dir=\"ltr\"] ol,[dir=\"ltr\"] ul{padding-left:2rem}[dir=\"rtl\"] ol,[dir=\"rtl\"] ul{padding-right:2rem}ol,ul,dl{margin-top:0;margin-bottom:1rem}ol ol,ul ul,ol ul,ul ol{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:0.5rem}[dir=\"ltr\"] dd{margin-left:0}[dir=\"rtl\"] dd{margin-right:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:0.875em}mark{padding:0.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:0.75em;line-height:0;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}pre,code,kbd,samp{font-family:var(--cp-font-monospace);font-size:1em;direction:ltr ;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:0.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:0.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:0.2rem 0.4rem;font-size:0.875em;color:#fff;background-color:#212529;border-radius:0.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:0.5rem;padding-bottom:0.5rem;color:#6c757d}[dir=\"ltr\"] caption{text-align:left}[dir=\"rtl\"] caption{text-align:right}th{text-align:inherit;text-align:-webkit-match-parent}thead,tbody,tfoot,tr,td,th{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}input,button,select,optgroup,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button:not(:disabled),[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{width:100%;padding:0;margin-bottom:0.5rem;font-size:calc(1.275rem + 0.3vw);line-height:inherit}[dir=\"ltr\"] legend{float:left}[dir=\"rtl\"] legend{float:right}@media (min-width: 1200px){legend{font-size:1.5rem}}[dir=\"ltr\"] legend+*{clear:left}[dir=\"rtl\"] legend+*{clear:right}::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-text,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}[dir=\"rtl\"] [type=\"tel\"],[dir=\"rtl\"] [type=\"url\"],[dir=\"rtl\"] [type=\"email\"],[dir=\"rtl\"] [type=\"number\"]{direction:ltr}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::-webkit-file-upload-button{font:inherit}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none !important}:root{--cp-font-weight-semi-bold:600}a{color:#4259ed;text-decoration:none}a:hover{color:#384cc9;text-decoration:underline}input{font-size:1rem}h1{font-weight:300;margin-bottom:var(--cp-spacer-4)}h2{font-weight:400;margin-bottom:var(--cp-spacer-3)}h3,h4,h5{font-weight:500;margin-bottom:var(--cp-spacer-3)}h6{font-weight:700}.container,.container-fluid,.container-xxl,.container-xl,.container-lg,.container-md,.container-sm{width:100%;padding-right:var(--bs-gutter-x, 0.75rem);padding-left:var(--bs-gutter-x, 0.75rem);margin-right:auto;margin-left:auto}@media (min-width: 576px){.container-sm,.container{max-width:540px}}@media (min-width: 768px){.container-md,.container-sm,.container{max-width:720px}}@media (min-width: 992px){.container-lg,.container-md,.container-sm,.container{max-width:960px}}@media (min-width: 1200px){.container-xl,.container-lg,.container-md,.container-sm,.container{max-width:1140px}}@media (min-width: 1400px){.container-xxl,.container-xl,.container-lg,.container-md,.container-sm,.container{max-width:1320px}}.row{--bs-gutter-x:1.5rem;--bs-gutter-y:0;display:flex;flex-wrap:wrap;margin-top:calc(-1 * var(--bs-gutter-y));margin-right:calc(-0.5 * var(--bs-gutter-x));margin-left:calc(-0.5 * var(--bs-gutter-x))}.row>*{flex-shrink:0;width:100%;max-width:100%;padding-right:calc(var(--bs-gutter-x) * 0.5);padding-left:calc(var(--bs-gutter-x) * 0.5);margin-top:var(--bs-gutter-y)}.col{flex:1 0 0%}.row-cols-auto>*{flex:0 0 auto;width:auto}.row-cols-1>*{flex:0 0 auto;width:100%}.row-cols-2>*{flex:0 0 auto;width:50%}.row-cols-3>*{flex:0 0 auto;width:33.3333333333%}.row-cols-4>*{flex:0 0 auto;width:25%}.row-cols-5>*{flex:0 0 auto;width:20%}.row-cols-6>*{flex:0 0 auto;width:16.6666666667%}.col-auto{flex:0 0 auto;width:auto}.col-1{flex:0 0 auto;width:8.33333333%}.col-2{flex:0 0 auto;width:16.66666667%}.col-3{flex:0 0 auto;width:25%}.col-4{flex:0 0 auto;width:33.33333333%}.col-5{flex:0 0 auto;width:41.66666667%}.col-6{flex:0 0 auto;width:50%}.col-7{flex:0 0 auto;width:58.33333333%}.col-8{flex:0 0 auto;width:66.66666667%}.col-9{flex:0 0 auto;width:75%}.col-10{flex:0 0 auto;width:83.33333333%}.col-11{flex:0 0 auto;width:91.66666667%}.col-12{flex:0 0 auto;width:100%}[dir=\"ltr\"] .offset-1{margin-left:8.33333333%}[dir=\"rtl\"] .offset-1{margin-right:8.33333333%}[dir=\"ltr\"] .offset-2{margin-left:16.66666667%}[dir=\"rtl\"] .offset-2{margin-right:16.66666667%}[dir=\"ltr\"] .offset-3{margin-left:25%}[dir=\"rtl\"] .offset-3{margin-right:25%}[dir=\"ltr\"] .offset-4{margin-left:33.33333333%}[dir=\"rtl\"] .offset-4{margin-right:33.33333333%}[dir=\"ltr\"] .offset-5{margin-left:41.66666667%}[dir=\"rtl\"] .offset-5{margin-right:41.66666667%}[dir=\"ltr\"] .offset-6{margin-left:50%}[dir=\"rtl\"] .offset-6{margin-right:50%}[dir=\"ltr\"] .offset-7{margin-left:58.33333333%}[dir=\"rtl\"] .offset-7{margin-right:58.33333333%}[dir=\"ltr\"] .offset-8{margin-left:66.66666667%}[dir=\"rtl\"] .offset-8{margin-right:66.66666667%}[dir=\"ltr\"] .offset-9{margin-left:75%}[dir=\"rtl\"] .offset-9{margin-right:75%}[dir=\"ltr\"] .offset-10{margin-left:83.33333333%}[dir=\"rtl\"] .offset-10{margin-right:83.33333333%}[dir=\"ltr\"] .offset-11{margin-left:91.66666667%}[dir=\"rtl\"] .offset-11{margin-right:91.66666667%}.g-0,.gx-0{--bs-gutter-x:0}.g-0,.gy-0{--bs-gutter-y:0}.g-1,.gx-1{--bs-gutter-x:0.25rem}.g-1,.gy-1{--bs-gutter-y:0.25rem}.g-2,.gx-2{--bs-gutter-x:0.5rem}.g-2,.gy-2{--bs-gutter-y:0.5rem}.g-3,.gx-3{--bs-gutter-x:1rem}.g-3,.gy-3{--bs-gutter-y:1rem}.g-4,.gx-4{--bs-gutter-x:1.5rem}.g-4,.gy-4{--bs-gutter-y:1.5rem}.g-5,.gx-5{--bs-gutter-x:2rem}.g-5,.gy-5{--bs-gutter-y:2rem}.g-6,.gx-6{--bs-gutter-x:3rem}.g-6,.gy-6{--bs-gutter-y:3rem}@media (min-width: 576px){.col-sm{flex:1 0 0%}.row-cols-sm-auto>*{flex:0 0 auto;width:auto}.row-cols-sm-1>*{flex:0 0 auto;width:100%}.row-cols-sm-2>*{flex:0 0 auto;width:50%}.row-cols-sm-3>*{flex:0 0 auto;width:33.3333333333%}.row-cols-sm-4>*{flex:0 0 auto;width:25%}.row-cols-sm-5>*{flex:0 0 auto;width:20%}.row-cols-sm-6>*{flex:0 0 auto;width:16.6666666667%}.col-sm-auto{flex:0 0 auto;width:auto}.col-sm-1{flex:0 0 auto;width:8.33333333%}.col-sm-2{flex:0 0 auto;width:16.66666667%}.col-sm-3{flex:0 0 auto;width:25%}.col-sm-4{flex:0 0 auto;width:33.33333333%}.col-sm-5{flex:0 0 auto;width:41.66666667%}.col-sm-6{flex:0 0 auto;width:50%}.col-sm-7{flex:0 0 auto;width:58.33333333%}.col-sm-8{flex:0 0 auto;width:66.66666667%}.col-sm-9{flex:0 0 auto;width:75%}.col-sm-10{flex:0 0 auto;width:83.33333333%}.col-sm-11{flex:0 0 auto;width:91.66666667%}.col-sm-12{flex:0 0 auto;width:100%}[dir=\"ltr\"] .offset-sm-0{margin-left:0}[dir=\"rtl\"] .offset-sm-0{margin-right:0}[dir=\"ltr\"] .offset-sm-1{margin-left:8.33333333%}[dir=\"rtl\"] .offset-sm-1{margin-right:8.33333333%}[dir=\"ltr\"] .offset-sm-2{margin-left:16.66666667%}[dir=\"rtl\"] .offset-sm-2{margin-right:16.66666667%}[dir=\"ltr\"] .offset-sm-3{margin-left:25%}[dir=\"rtl\"] .offset-sm-3{margin-right:25%}[dir=\"ltr\"] .offset-sm-4{margin-left:33.33333333%}[dir=\"rtl\"] .offset-sm-4{margin-right:33.33333333%}[dir=\"ltr\"] .offset-sm-5{margin-left:41.66666667%}[dir=\"rtl\"] .offset-sm-5{margin-right:41.66666667%}[dir=\"ltr\"] .offset-sm-6{margin-left:50%}[dir=\"rtl\"] .offset-sm-6{margin-right:50%}[dir=\"ltr\"] .offset-sm-7{margin-left:58.33333333%}[dir=\"rtl\"] .offset-sm-7{margin-right:58.33333333%}[dir=\"ltr\"] .offset-sm-8{margin-left:66.66666667%}[dir=\"rtl\"] .offset-sm-8{margin-right:66.66666667%}[dir=\"ltr\"] .offset-sm-9{margin-left:75%}[dir=\"rtl\"] .offset-sm-9{margin-right:75%}[dir=\"ltr\"] .offset-sm-10{margin-left:83.33333333%}[dir=\"rtl\"] .offset-sm-10{margin-right:83.33333333%}[dir=\"ltr\"] .offset-sm-11{margin-left:91.66666667%}[dir=\"rtl\"] .offset-sm-11{margin-right:91.66666667%}.g-sm-0,.gx-sm-0{--bs-gutter-x:0}.g-sm-0,.gy-sm-0{--bs-gutter-y:0}.g-sm-1,.gx-sm-1{--bs-gutter-x:0.25rem}.g-sm-1,.gy-sm-1{--bs-gutter-y:0.25rem}.g-sm-2,.gx-sm-2{--bs-gutter-x:0.5rem}.g-sm-2,.gy-sm-2{--bs-gutter-y:0.5rem}.g-sm-3,.gx-sm-3{--bs-gutter-x:1rem}.g-sm-3,.gy-sm-3{--bs-gutter-y:1rem}.g-sm-4,.gx-sm-4{--bs-gutter-x:1.5rem}.g-sm-4,.gy-sm-4{--bs-gutter-y:1.5rem}.g-sm-5,.gx-sm-5{--bs-gutter-x:2rem}.g-sm-5,.gy-sm-5{--bs-gutter-y:2rem}.g-sm-6,.gx-sm-6{--bs-gutter-x:3rem}.g-sm-6,.gy-sm-6{--bs-gutter-y:3rem}}@media (min-width: 768px){.col-md{flex:1 0 0%}.row-cols-md-auto>*{flex:0 0 auto;width:auto}.row-cols-md-1>*{flex:0 0 auto;width:100%}.row-cols-md-2>*{flex:0 0 auto;width:50%}.row-cols-md-3>*{flex:0 0 auto;width:33.3333333333%}.row-cols-md-4>*{flex:0 0 auto;width:25%}.row-cols-md-5>*{flex:0 0 auto;width:20%}.row-cols-md-6>*{flex:0 0 auto;width:16.6666666667%}.col-md-auto{flex:0 0 auto;width:auto}.col-md-1{flex:0 0 auto;width:8.33333333%}.col-md-2{flex:0 0 auto;width:16.66666667%}.col-md-3{flex:0 0 auto;width:25%}.col-md-4{flex:0 0 auto;width:33.33333333%}.col-md-5{flex:0 0 auto;width:41.66666667%}.col-md-6{flex:0 0 auto;width:50%}.col-md-7{flex:0 0 auto;width:58.33333333%}.col-md-8{flex:0 0 auto;width:66.66666667%}.col-md-9{flex:0 0 auto;width:75%}.col-md-10{flex:0 0 auto;width:83.33333333%}.col-md-11{flex:0 0 auto;width:91.66666667%}.col-md-12{flex:0 0 auto;width:100%}[dir=\"ltr\"] .offset-md-0{margin-left:0}[dir=\"rtl\"] .offset-md-0{margin-right:0}[dir=\"ltr\"] .offset-md-1{margin-left:8.33333333%}[dir=\"rtl\"] .offset-md-1{margin-right:8.33333333%}[dir=\"ltr\"] .offset-md-2{margin-left:16.66666667%}[dir=\"rtl\"] .offset-md-2{margin-right:16.66666667%}[dir=\"ltr\"] .offset-md-3{margin-left:25%}[dir=\"rtl\"] .offset-md-3{margin-right:25%}[dir=\"ltr\"] .offset-md-4{margin-left:33.33333333%}[dir=\"rtl\"] .offset-md-4{margin-right:33.33333333%}[dir=\"ltr\"] .offset-md-5{margin-left:41.66666667%}[dir=\"rtl\"] .offset-md-5{margin-right:41.66666667%}[dir=\"ltr\"] .offset-md-6{margin-left:50%}[dir=\"rtl\"] .offset-md-6{margin-right:50%}[dir=\"ltr\"] .offset-md-7{margin-left:58.33333333%}[dir=\"rtl\"] .offset-md-7{margin-right:58.33333333%}[dir=\"ltr\"] .offset-md-8{margin-left:66.66666667%}[dir=\"rtl\"] .offset-md-8{margin-right:66.66666667%}[dir=\"ltr\"] .offset-md-9{margin-left:75%}[dir=\"rtl\"] .offset-md-9{margin-right:75%}[dir=\"ltr\"] .offset-md-10{margin-left:83.33333333%}[dir=\"rtl\"] .offset-md-10{margin-right:83.33333333%}[dir=\"ltr\"] .offset-md-11{margin-left:91.66666667%}[dir=\"rtl\"] .offset-md-11{margin-right:91.66666667%}.g-md-0,.gx-md-0{--bs-gutter-x:0}.g-md-0,.gy-md-0{--bs-gutter-y:0}.g-md-1,.gx-md-1{--bs-gutter-x:0.25rem}.g-md-1,.gy-md-1{--bs-gutter-y:0.25rem}.g-md-2,.gx-md-2{--bs-gutter-x:0.5rem}.g-md-2,.gy-md-2{--bs-gutter-y:0.5rem}.g-md-3,.gx-md-3{--bs-gutter-x:1rem}.g-md-3,.gy-md-3{--bs-gutter-y:1rem}.g-md-4,.gx-md-4{--bs-gutter-x:1.5rem}.g-md-4,.gy-md-4{--bs-gutter-y:1.5rem}.g-md-5,.gx-md-5{--bs-gutter-x:2rem}.g-md-5,.gy-md-5{--bs-gutter-y:2rem}.g-md-6,.gx-md-6{--bs-gutter-x:3rem}.g-md-6,.gy-md-6{--bs-gutter-y:3rem}}@media (min-width: 992px){.col-lg{flex:1 0 0%}.row-cols-lg-auto>*{flex:0 0 auto;width:auto}.row-cols-lg-1>*{flex:0 0 auto;width:100%}.row-cols-lg-2>*{flex:0 0 auto;width:50%}.row-cols-lg-3>*{flex:0 0 auto;width:33.3333333333%}.row-cols-lg-4>*{flex:0 0 auto;width:25%}.row-cols-lg-5>*{flex:0 0 auto;width:20%}.row-cols-lg-6>*{flex:0 0 auto;width:16.6666666667%}.col-lg-auto{flex:0 0 auto;width:auto}.col-lg-1{flex:0 0 auto;width:8.33333333%}.col-lg-2{flex:0 0 auto;width:16.66666667%}.col-lg-3{flex:0 0 auto;width:25%}.col-lg-4{flex:0 0 auto;width:33.33333333%}.col-lg-5{flex:0 0 auto;width:41.66666667%}.col-lg-6{flex:0 0 auto;width:50%}.col-lg-7{flex:0 0 auto;width:58.33333333%}.col-lg-8{flex:0 0 auto;width:66.66666667%}.col-lg-9{flex:0 0 auto;width:75%}.col-lg-10{flex:0 0 auto;width:83.33333333%}.col-lg-11{flex:0 0 auto;width:91.66666667%}.col-lg-12{flex:0 0 auto;width:100%}[dir=\"ltr\"] .offset-lg-0{margin-left:0}[dir=\"rtl\"] .offset-lg-0{margin-right:0}[dir=\"ltr\"] .offset-lg-1{margin-left:8.33333333%}[dir=\"rtl\"] .offset-lg-1{margin-right:8.33333333%}[dir=\"ltr\"] .offset-lg-2{margin-left:16.66666667%}[dir=\"rtl\"] .offset-lg-2{margin-right:16.66666667%}[dir=\"ltr\"] .offset-lg-3{margin-left:25%}[dir=\"rtl\"] .offset-lg-3{margin-right:25%}[dir=\"ltr\"] .offset-lg-4{margin-left:33.33333333%}[dir=\"rtl\"] .offset-lg-4{margin-right:33.33333333%}[dir=\"ltr\"] .offset-lg-5{margin-left:41.66666667%}[dir=\"rtl\"] .offset-lg-5{margin-right:41.66666667%}[dir=\"ltr\"] .offset-lg-6{margin-left:50%}[dir=\"rtl\"] .offset-lg-6{margin-right:50%}[dir=\"ltr\"] .offset-lg-7{margin-left:58.33333333%}[dir=\"rtl\"] .offset-lg-7{margin-right:58.33333333%}[dir=\"ltr\"] .offset-lg-8{margin-left:66.66666667%}[dir=\"rtl\"] .offset-lg-8{margin-right:66.66666667%}[dir=\"ltr\"] .offset-lg-9{margin-left:75%}[dir=\"rtl\"] .offset-lg-9{margin-right:75%}[dir=\"ltr\"] .offset-lg-10{margin-left:83.33333333%}[dir=\"rtl\"] .offset-lg-10{margin-right:83.33333333%}[dir=\"ltr\"] .offset-lg-11{margin-left:91.66666667%}[dir=\"rtl\"] .offset-lg-11{margin-right:91.66666667%}.g-lg-0,.gx-lg-0{--bs-gutter-x:0}.g-lg-0,.gy-lg-0{--bs-gutter-y:0}.g-lg-1,.gx-lg-1{--bs-gutter-x:0.25rem}.g-lg-1,.gy-lg-1{--bs-gutter-y:0.25rem}.g-lg-2,.gx-lg-2{--bs-gutter-x:0.5rem}.g-lg-2,.gy-lg-2{--bs-gutter-y:0.5rem}.g-lg-3,.gx-lg-3{--bs-gutter-x:1rem}.g-lg-3,.gy-lg-3{--bs-gutter-y:1rem}.g-lg-4,.gx-lg-4{--bs-gutter-x:1.5rem}.g-lg-4,.gy-lg-4{--bs-gutter-y:1.5rem}.g-lg-5,.gx-lg-5{--bs-gutter-x:2rem}.g-lg-5,.gy-lg-5{--bs-gutter-y:2rem}.g-lg-6,.gx-lg-6{--bs-gutter-x:3rem}.g-lg-6,.gy-lg-6{--bs-gutter-y:3rem}}@media (min-width: 1200px){.col-xl{flex:1 0 0%}.row-cols-xl-auto>*{flex:0 0 auto;width:auto}.row-cols-xl-1>*{flex:0 0 auto;width:100%}.row-cols-xl-2>*{flex:0 0 auto;width:50%}.row-cols-xl-3>*{flex:0 0 auto;width:33.3333333333%}.row-cols-xl-4>*{flex:0 0 auto;width:25%}.row-cols-xl-5>*{flex:0 0 auto;width:20%}.row-cols-xl-6>*{flex:0 0 auto;width:16.6666666667%}.col-xl-auto{flex:0 0 auto;width:auto}.col-xl-1{flex:0 0 auto;width:8.33333333%}.col-xl-2{flex:0 0 auto;width:16.66666667%}.col-xl-3{flex:0 0 auto;width:25%}.col-xl-4{flex:0 0 auto;width:33.33333333%}.col-xl-5{flex:0 0 auto;width:41.66666667%}.col-xl-6{flex:0 0 auto;width:50%}.col-xl-7{flex:0 0 auto;width:58.33333333%}.col-xl-8{flex:0 0 auto;width:66.66666667%}.col-xl-9{flex:0 0 auto;width:75%}.col-xl-10{flex:0 0 auto;width:83.33333333%}.col-xl-11{flex:0 0 auto;width:91.66666667%}.col-xl-12{flex:0 0 auto;width:100%}[dir=\"ltr\"] .offset-xl-0{margin-left:0}[dir=\"rtl\"] .offset-xl-0{margin-right:0}[dir=\"ltr\"] .offset-xl-1{margin-left:8.33333333%}[dir=\"rtl\"] .offset-xl-1{margin-right:8.33333333%}[dir=\"ltr\"] .offset-xl-2{margin-left:16.66666667%}[dir=\"rtl\"] .offset-xl-2{margin-right:16.66666667%}[dir=\"ltr\"] .offset-xl-3{margin-left:25%}[dir=\"rtl\"] .offset-xl-3{margin-right:25%}[dir=\"ltr\"] .offset-xl-4{margin-left:33.33333333%}[dir=\"rtl\"] .offset-xl-4{margin-right:33.33333333%}[dir=\"ltr\"] .offset-xl-5{margin-left:41.66666667%}[dir=\"rtl\"] .offset-xl-5{margin-right:41.66666667%}[dir=\"ltr\"] .offset-xl-6{margin-left:50%}[dir=\"rtl\"] .offset-xl-6{margin-right:50%}[dir=\"ltr\"] .offset-xl-7{margin-left:58.33333333%}[dir=\"rtl\"] .offset-xl-7{margin-right:58.33333333%}[dir=\"ltr\"] .offset-xl-8{margin-left:66.66666667%}[dir=\"rtl\"] .offset-xl-8{margin-right:66.66666667%}[dir=\"ltr\"] .offset-xl-9{margin-left:75%}[dir=\"rtl\"] .offset-xl-9{margin-right:75%}[dir=\"ltr\"] .offset-xl-10{margin-left:83.33333333%}[dir=\"rtl\"] .offset-xl-10{margin-right:83.33333333%}[dir=\"ltr\"] .offset-xl-11{margin-left:91.66666667%}[dir=\"rtl\"] .offset-xl-11{margin-right:91.66666667%}.g-xl-0,.gx-xl-0{--bs-gutter-x:0}.g-xl-0,.gy-xl-0{--bs-gutter-y:0}.g-xl-1,.gx-xl-1{--bs-gutter-x:0.25rem}.g-xl-1,.gy-xl-1{--bs-gutter-y:0.25rem}.g-xl-2,.gx-xl-2{--bs-gutter-x:0.5rem}.g-xl-2,.gy-xl-2{--bs-gutter-y:0.5rem}.g-xl-3,.gx-xl-3{--bs-gutter-x:1rem}.g-xl-3,.gy-xl-3{--bs-gutter-y:1rem}.g-xl-4,.gx-xl-4{--bs-gutter-x:1.5rem}.g-xl-4,.gy-xl-4{--bs-gutter-y:1.5rem}.g-xl-5,.gx-xl-5{--bs-gutter-x:2rem}.g-xl-5,.gy-xl-5{--bs-gutter-y:2rem}.g-xl-6,.gx-xl-6{--bs-gutter-x:3rem}.g-xl-6,.gy-xl-6{--bs-gutter-y:3rem}}@media (min-width: 1400px){.col-xxl{flex:1 0 0%}.row-cols-xxl-auto>*{flex:0 0 auto;width:auto}.row-cols-xxl-1>*{flex:0 0 auto;width:100%}.row-cols-xxl-2>*{flex:0 0 auto;width:50%}.row-cols-xxl-3>*{flex:0 0 auto;width:33.3333333333%}.row-cols-xxl-4>*{flex:0 0 auto;width:25%}.row-cols-xxl-5>*{flex:0 0 auto;width:20%}.row-cols-xxl-6>*{flex:0 0 auto;width:16.6666666667%}.col-xxl-auto{flex:0 0 auto;width:auto}.col-xxl-1{flex:0 0 auto;width:8.33333333%}.col-xxl-2{flex:0 0 auto;width:16.66666667%}.col-xxl-3{flex:0 0 auto;width:25%}.col-xxl-4{flex:0 0 auto;width:33.33333333%}.col-xxl-5{flex:0 0 auto;width:41.66666667%}.col-xxl-6{flex:0 0 auto;width:50%}.col-xxl-7{flex:0 0 auto;width:58.33333333%}.col-xxl-8{flex:0 0 auto;width:66.66666667%}.col-xxl-9{flex:0 0 auto;width:75%}.col-xxl-10{flex:0 0 auto;width:83.33333333%}.col-xxl-11{flex:0 0 auto;width:91.66666667%}.col-xxl-12{flex:0 0 auto;width:100%}[dir=\"ltr\"] .offset-xxl-0{margin-left:0}[dir=\"rtl\"] .offset-xxl-0{margin-right:0}[dir=\"ltr\"] .offset-xxl-1{margin-left:8.33333333%}[dir=\"rtl\"] .offset-xxl-1{margin-right:8.33333333%}[dir=\"ltr\"] .offset-xxl-2{margin-left:16.66666667%}[dir=\"rtl\"] .offset-xxl-2{margin-right:16.66666667%}[dir=\"ltr\"] .offset-xxl-3{margin-left:25%}[dir=\"rtl\"] .offset-xxl-3{margin-right:25%}[dir=\"ltr\"] .offset-xxl-4{margin-left:33.33333333%}[dir=\"rtl\"] .offset-xxl-4{margin-right:33.33333333%}[dir=\"ltr\"] .offset-xxl-5{margin-left:41.66666667%}[dir=\"rtl\"] .offset-xxl-5{margin-right:41.66666667%}[dir=\"ltr\"] .offset-xxl-6{margin-left:50%}[dir=\"rtl\"] .offset-xxl-6{margin-right:50%}[dir=\"ltr\"] .offset-xxl-7{margin-left:58.33333333%}[dir=\"rtl\"] .offset-xxl-7{margin-right:58.33333333%}[dir=\"ltr\"] .offset-xxl-8{margin-left:66.66666667%}[dir=\"rtl\"] .offset-xxl-8{margin-right:66.66666667%}[dir=\"ltr\"] .offset-xxl-9{margin-left:75%}[dir=\"rtl\"] .offset-xxl-9{margin-right:75%}[dir=\"ltr\"] .offset-xxl-10{margin-left:83.33333333%}[dir=\"rtl\"] .offset-xxl-10{margin-right:83.33333333%}[dir=\"ltr\"] .offset-xxl-11{margin-left:91.66666667%}[dir=\"rtl\"] .offset-xxl-11{margin-right:91.66666667%}.g-xxl-0,.gx-xxl-0{--bs-gutter-x:0}.g-xxl-0,.gy-xxl-0{--bs-gutter-y:0}.g-xxl-1,.gx-xxl-1{--bs-gutter-x:0.25rem}.g-xxl-1,.gy-xxl-1{--bs-gutter-y:0.25rem}.g-xxl-2,.gx-xxl-2{--bs-gutter-x:0.5rem}.g-xxl-2,.gy-xxl-2{--bs-gutter-y:0.5rem}.g-xxl-3,.gx-xxl-3{--bs-gutter-x:1rem}.g-xxl-3,.gy-xxl-3{--bs-gutter-y:1rem}.g-xxl-4,.gx-xxl-4{--bs-gutter-x:1.5rem}.g-xxl-4,.gy-xxl-4{--bs-gutter-y:1.5rem}.g-xxl-5,.gx-xxl-5{--bs-gutter-x:2rem}.g-xxl-5,.gy-xxl-5{--bs-gutter-y:2rem}.g-xxl-6,.gx-xxl-6{--bs-gutter-x:3rem}.g-xxl-6,.gy-xxl-6{--bs-gutter-y:3rem}}:host{display:block}.cp-consent-privacy__container-text{margin-bottom:var(--cp-spacer-4);padding:0 var(--cp-spacer-3)}.cp-consent-privacy__container{padding:0 var(--cp-spacer-3)}[dir=\"ltr\"] .form-input-checkbox{margin-right:var(--cp-spacer-1)}[dir=\"rtl\"] .form-input-checkbox{margin-left:var(--cp-spacer-1)}.form-input-select{margin-top:var(--cp-spacer-2);margin-bottom:var(--cp-spacer-2);padding:var(--cp-spacer-1);border-radius:var(--cp-spacer-1)}.external-link::after{font-family:remixicon;content:\" \\ecaf\"}.checkbox-label{white-space:normal}.checkbox-text{vertical-align:text-bottom}@media (min-width: 768px){.checkbox-label{white-space:nowrap}}";

const locale$w = getLocaleInstance();
const CpConsentPrivacySettings$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.consentValueChanged = createEvent(this, "consentValueChanged", 7);
  }
  /**
   * Handles checkbox change event.
   */
  captureCheckedState(event) {
    const el = event.target;
    this.consentValueChanged.emit(el.checked);
  }
  render() {
    return (h("div", { class: "cp-consent-privacy__container" }, h("div", { class: "row" }, h("div", { class: "col-xs-12 cp-consent-privacy__container-text", innerHTML: locale$w.maketext("WebPros International, LLC d.b.a cPanel is asking for your consent to participate in user activity tracking using third-party software for the purpose of understanding the performance of Webpros products. Information will be used pursuant to the [output,url,_1,cPanel and WHM Privacy Policy,title,cPanel and WHM Privacy Policy,data-testid,_2,target,_3,class,_4] and may be shared internally within the Webpros group. You can update your preferences at any time from the analytics slideout.", "https://go.cpanel.net/privacy", "privacy-policy", "privacy-policy", "external-link") }), h("div", { class: "col-xs-12" }, h("div", { class: "checkbox" }, h("label", { class: "checkbox-label" }, h("input", { type: "checkbox", name: "consent_setting", id: "consent-setting", class: "form-input-checkbox", "data-testid": "chkConsentSetting", onChange: e => this.captureCheckedState(e) }), h("span", { class: "checkbox-text", innerHTML: locale$w.maketext("By checking this box, you agree that we may collect your usage statistics. [output,url,_1,Learn more here.,title,cPanel Analytics Documentation,class,_2,target,_3,id,_4,data-testid,_5]", "https://go.cpanel.net/analytics", "external-link", "analytics", "learnLink", "learnAnalyticsLink") })))))));
  }
  static get style() { return cpConsentPrivacySettingsCss; }
};

const CpDir$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
  }
  /**
   * Stencil lifecycle component.
   */
  componentWillLoad() {
    this.documentDirection = document.dir;
    this.documentLanguage = document.documentElement.lang;
  }
  render() {
    return (h(Host, null, h("span", { dir: this.documentDirection, lang: this.documentLanguage }, h("slot", null))));
  }
};

const cpDnsOnlyCss = ":root{--cp-font-weight-semi-bold:600}:host{display:block}.dns-only__text{color:inherit;font-size:0.875rem;font-style:italic;font-weight:700}[dir=\"ltr\"] .dns-only__text{margin-right:var(--cp-spacer-2)}[dir=\"rtl\"] .dns-only__text{margin-left:var(--cp-spacer-2)}";

const CpDnsOnly$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
  }
  render() {
    return (h(Host, null, h("small", { class: "dns-only__text" }, "DNSOnly\u00AE")));
  }
  static get style() { return cpDnsOnlyCss; }
};

/**
# cpanel - ui/web-components/src/utils/cp-tool-identifier.ts
#                                                  Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
 */
class CpToolIdentifier {
  /**
   * Constructor for the CpToolIdentifer.
   *
   * @param group The category for the tool.
   * @param key The application key for the tool.
   */
  constructor(group, key) {
    this.group = group;
    this.key = key;
  }
  /**
   * Build a string representation fo the unique id.
   *
   * @returns The unique key for the tool.
   */
  toString() {
    return this.group + "$" + this.key;
  }
}

const cpFavoriteCss = ":host{display:block}.cp-app__compressed{align-items:center}.cp-app__compressed .cp-app__details-title{margin-bottom:0}.card{height:100%}.move{cursor:move}.remove-button{cursor:default}[dir=\"ltr\"] .remove-button{margin-left:auto}[dir=\"rtl\"] .remove-button{margin-right:auto}@media (max-width: 992px){.mobile-card-link{width:100%}}";

const CpFavorite$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.removeFavorite = createEvent(this, "removeFavorite", 7);
    /**
     * When true show the edit controls, otherwise, hide the edit controls.
     */
    this.editMode = false;
    /**
     * Close button title.
     */
    this.removeDescription = "Remove";
    /**
     * The optional target window. Defaults to `_self`.
     */
    this.target = "_self";
    /**
     * The optional description of the tool.
     */
    this.description = "";
    /**
     * When true, the description will show, when false, the description will be hidden.
     */
    this.showDescription = true;
  }
  /**
   * Raise the remove event to the parent application so they can remove the item from the list.
   *
   * @param id - the unique identifier for the selected element.
   */
  removeHandler(id) {
    this.removeFavorite.emit(id);
  }
  /**
   * Set the edit mode for the control.
   *
   * @param mode - The mode, true when editing is enabled, false otherwise.
   */
  async setEditMode(mode) {
    this.editMode = mode;
  }
  render() {
    return (h(Host, null, h("div", { class: "card" }, h("a", { class: {
        "mobile-card-link": true,
        "move": this.editMode,
      }, href: !this.editMode ? this.url : "javascript:void(0)", target: !this.editMode ? this.target : "_self" }, h("div", { class: `cp-card cp-app ${!this.showDescription ? "cp-app__compressed" : ""}` }, h("img", { src: this.icon, alt: "", class: "cp-card__image-top-tools" }), h("div", { class: "cp-app__details" }, h("span", { class: "cp-app__details-title" }, this.displayName, h("i", { class: "ri-close-line remove-button " + (this.editMode ? "" : "hidden"), title: this.removeDescription, onClick: () => this.removeHandler(new CpToolIdentifier(this.group, this.name)) })), this.showDescription ? (h("span", { class: "cp-app__details-description" }, this.description)) : ("")))))));
  }
  static get style() { return cpFavoriteCss; }
};

const cpFavoriteListCss = ":host{display:block}";

const CpFavoriteList$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.favoritesLoaded = createEvent(this, "favoritesLoaded", 7);
    /**
     * The list of favorites to show in the list.
     */
    this.favorites = [];
  }
  /**
   * Update the options when in edit mode.
   */
  async updateOptions(options) {
    this.showDescriptions = options.showDescriptions;
  }
  componentDidLoad() {
    this.favoritesLoaded.emit();
  }
  componentDidUpdate() {
    this.favoritesLoaded.emit();
  }
  render() {
    return (h(Host, null, this.favorites.map(favorite => (h("cp-favorite", { group: favorite.group, name: favorite.key, url: favorite.url, target: favorite.target || "_self", icon: favorite.iconUrl, displayName: favorite.name, description: favorite.description, showDescription: this.showDescriptions })))));
  }
  static get style() { return cpFavoriteListCss; }
};

/**
# cpanel - ui/web-components/src/utils/cp-tool-select.ts
#                                                  Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
 */
class CpToolSelect extends CpToolIdentifier {
  /**
   * Constructor for the CpToolSelect.
   *
   * @param group The category for the tool.
   * @param key The application key for the tool.
   * @param selected true if the tool is selected, false otherwise.
   */
  constructor(group, key, selected) {
    super(group, key);
    this.selected = selected;
  }
}

const cpFavoriteSelectorCss = ":host{display:inline-block;width:1rem;height:1rem}.hidden{display:none}.cp-favorite-selector--selected svg{fill:#ff6c2c}.cp-favorite-selector--unselected svg{fill:#ff6c2c}";

const CpFavoriteSelector$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
    this.changeFavorite = createEvent(this, "changeFavorite", 7);
    /**
     * Whether the favorite is selected or not.
     */
    this.checked = false;
    /**
     * When true show the edit controls, otherwise, hide the edit controls.
     */
    this.showEditControls = false;
  }
  /**
   * Set the edit mode for the control.
   *
   * @param mode - The mode, true when editing is enabled, false otherwise.
   */
  async setEditMode(mode) {
    this.showEditControls = mode;
  }
  /**
   * Event handler for the click event
   *
   * @param e
   */
  handleClick() {
    this.checked = !this.checked;
    this.changeFavorite.emit(new CpToolSelect(this.group, this.name, this.checked));
  }
  /**
   * Getter/setter for the current selected state.
   *
   * @param checked - If defined, allows you to set the selected state of the element.
   * @returns The current value of the checked state for the component.
   */
  async selected(checked) {
    if (checked === true || checked === false) {
      this.checked = checked;
    }
    return this.checked;
  }
  /**
   * Get the unique id set on the item.
   *
   * @returns The unique id use to coorelate the control to one of the applications.
   */
  async uniqueId() {
    return new CpToolIdentifier(this.group, this.name);
  }
  // cp-favorite-selector--selected: remixicon.com ri-star-solid
  // cp-favorite-selector--unselected: remixicon.com ri-star-line
  render() {
    return (h(Host, null, h("label", { class: this.showEditControls ? "" : "hidden" }, h("i", { class: "cp-favorite-selector--selected" + (this.checked ? "" : " hidden") }, h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "24", height: "24" }, h("path", { fill: "none", d: "M0 0h24v24H0z" }), h("path", { d: "M12 18.26l-7.053 3.948 1.575-7.928L.587 8.792l8.027-.952L12 .5l3.386 7.34 8.027.952-5.935 5.488 1.575 7.928z" }))), h("i", { class: "cp-favorite-selector--unselected" + (!this.checked ? "" : " hidden") }, h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "24", height: "24" }, h("path", { fill: "none", d: "M0 0h24v24H0z" }), h("path", { d: "M12 18.26l-7.053 3.948 1.575-7.928L.587 8.792l8.027-.952L12 .5l3.386 7.34 8.027.952-5.935 5.488 1.575 7.928L12 18.26zm0-2.292l4.247 2.377-.949-4.773 3.573-3.305-4.833-.573L12 5.275l-2.038 4.42-4.833.572 3.573 3.305-.949 4.773L12 15.968z" }))))));
  }
  static get style() { return cpFavoriteSelectorCss; }
};

/**
# cpanel - ui/web-components/src/utils/app-name.ts Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
 */
var AppName;
(function (AppName) {
  AppName["Cpanel"] = "cpanel";
  AppName["Whm"] = "whm";
  AppName["Webmail"] = "webmail";
})(AppName || (AppName = {}));

const appendToMap = (map, propName, value) => {
    const items = map.get(propName);
    if (!items) {
        map.set(propName, [value]);
    }
    else if (!items.includes(value)) {
        items.push(value);
    }
};
const debounce = (fn, ms) => {
    let timeoutId;
    return (...args) => {
        if (timeoutId) {
            clearTimeout(timeoutId);
        }
        timeoutId = setTimeout(() => {
            timeoutId = 0;
            fn(...args);
        }, ms);
    };
};

/**
 * Check if a possible element isConnected.
 * The property might not be there, so we check for it.
 *
 * We want it to return true if isConnected is not a property,
 * otherwise we would remove these elements and would not update.
 *
 * Better leak in Edge than to be useless.
 */
const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
const cleanupElements = debounce((map) => {
    for (let key of map.keys()) {
        map.set(key, map.get(key).filter(isConnected));
    }
}, 2000);
const stencilSubscription = () => {
    if (typeof getRenderingRef !== 'function') {
        // If we are not in a stencil project, we do nothing.
        // This function is not really exported by @stencil/core.
        return {};
    }
    const elmsToUpdate = new Map();
    return {
        dispose: () => elmsToUpdate.clear(),
        get: (propName) => {
            const elm = getRenderingRef();
            if (elm) {
                appendToMap(elmsToUpdate, propName, elm);
            }
        },
        set: (propName) => {
            const elements = elmsToUpdate.get(propName);
            if (elements) {
                elmsToUpdate.set(propName, elements.filter(forceUpdate));
            }
            cleanupElements(elmsToUpdate);
        },
        reset: () => {
            elmsToUpdate.forEach((elms) => elms.forEach(forceUpdate));
            cleanupElements(elmsToUpdate);
        },
    };
};

const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
    let states = new Map(Object.entries(defaultState !== null && defaultState !== void 0 ? defaultState : {}));
    const handlers = {
        dispose: [],
        get: [],
        set: [],
        reset: [],
    };
    const reset = () => {
        states = new Map(Object.entries(defaultState !== null && defaultState !== void 0 ? defaultState : {}));
        handlers.reset.forEach((cb) => cb());
    };
    const dispose = () => {
        // Call first dispose as resetting the state would
        // cause less updates ;)
        handlers.dispose.forEach((cb) => cb());
        reset();
    };
    const get = (propName) => {
        handlers.get.forEach((cb) => cb(propName));
        return states.get(propName);
    };
    const set = (propName, value) => {
        const oldValue = states.get(propName);
        if (shouldUpdate(value, oldValue, propName)) {
            states.set(propName, value);
            handlers.set.forEach((cb) => cb(propName, value, oldValue));
        }
    };
    const state = (typeof Proxy === 'undefined'
        ? {}
        : new Proxy(defaultState, {
            get(_, propName) {
                return get(propName);
            },
            ownKeys(_) {
                return Array.from(states.keys());
            },
            getOwnPropertyDescriptor() {
                return {
                    enumerable: true,
                    configurable: true,
                };
            },
            has(_, propName) {
                return states.has(propName);
            },
            set(_, propName, value) {
                set(propName, value);
                return true;
            },
        }));
    const on = (eventName, callback) => {
        handlers[eventName].push(callback);
        return () => {
            removeFromArray(handlers[eventName], callback);
        };
    };
    const onChange = (propName, cb) => {
        const unSet = on('set', (key, newValue) => {
            if (key === propName) {
                cb(newValue);
            }
        });
        const unReset = on('reset', () => cb(defaultState[propName]));
        return () => {
            unSet();
            unReset();
        };
    };
    const use = (...subscriptions) => {
        const unsubs = subscriptions.reduce((unsubs, subscription) => {
            if (subscription.set) {
                unsubs.push(on('set', subscription.set));
            }
            if (subscription.get) {
                unsubs.push(on('get', subscription.get));
            }
            if (subscription.reset) {
                unsubs.push(on('reset', subscription.reset));
            }
            if (subscription.dispose) {
                unsubs.push(on('dispose', subscription.dispose));
            }
            return unsubs;
        }, []);
        return () => unsubs.forEach((unsub) => unsub());
    };
    const forceUpdate = (key) => {
        const oldValue = states.get(key);
        handlers.set.forEach((cb) => cb(key, oldValue, oldValue));
    };
    return {
        state,
        get,
        set,
        on,
        onChange,
        use,
        dispose,
        reset,
        forceUpdate,
    };
};
const removeFromArray = (array, item) => {
    const index = array.indexOf(item);
    if (index >= 0) {
        array[index] = array[array.length - 1];
        array.length--;
    }
};

const createStore = (defaultState, shouldUpdate) => {
    const map = createObservableMap(defaultState, shouldUpdate);
    map.use(stencilSubscription());
    return map;
};

// MIT License
//
// Copyright 2021 cPanel L.L.C.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
/**
 * Common http verbs
 */
var HttpVerb;
(function (HttpVerb) {
    /**
     * Get request
     */
    HttpVerb[HttpVerb["GET"] = 0] = "GET";
    /**
     * Head request
     */
    HttpVerb[HttpVerb["HEAD"] = 1] = "HEAD";
    /**
     * Post request
     */
    HttpVerb[HttpVerb["POST"] = 2] = "POST";
    /**
     * Put request
     */
    HttpVerb[HttpVerb["PUT"] = 3] = "PUT";
    /**
     * Delete request
     */
    HttpVerb[HttpVerb["DELETE"] = 4] = "DELETE";
    /**
     * Connect request
     */
    HttpVerb[HttpVerb["CONNECT"] = 5] = "CONNECT";
    /**
     * Options request
     */
    HttpVerb[HttpVerb["OPTIONS"] = 6] = "OPTIONS";
    /**
     * Trace request
     */
    HttpVerb[HttpVerb["TRACE"] = 7] = "TRACE";
    /**
     * Patch request
     */
    HttpVerb[HttpVerb["PATCH"] = 8] = "PATCH";
})(HttpVerb || (HttpVerb = {}));

// MIT License
/**
 * Default argument serialization rules for each well known HTTP verb.
 */
class DefaultArgumentSerializationRules {
    /**
     * Construct the lookup table for well know verbs.
     */
    constructor() {
        this.map = {};
        // fallback rule if the verb is not defined.
        this.map["DEFAULT"] = {
            verb: "DEFAULT",
            dataInBody: true,
        };
        [HttpVerb.GET, HttpVerb.DELETE, HttpVerb.HEAD].forEach((verb) => {
            const label = HttpVerb[verb].toString();
            this.map[label] = {
                verb: label,
                dataInBody: false,
            };
        });
        [HttpVerb.POST, HttpVerb.PUT, HttpVerb.PATCH].forEach((verb) => {
            const label = HttpVerb[verb].toString();
            this.map[label] = {
                verb: label,
                dataInBody: true,
            };
        });
    }
    /**
     * Get a rule for serialization of arguments. This tells the generators where
     * argument data is packaged in a request. Arguments can be located in one of
     * the following:
     *
     *   Body,
     *   Url
     *
     * @param verb verb to lookup.
     */
    getRule(verb) {
        const name = typeof verb === "string" ? verb : HttpVerb[verb].toString();
        let rule = this.map[name];
        if (!rule) {
            rule = this.map["DEFAULT"];
        }
        return rule;
    }
}
/**
 * Singleton with the default argument serialization rules in it.
 */
const argumentSerializationRules = new DefaultArgumentSerializationRules();

// MIT License
//
// Copyright 2021 cPanel L.L.C.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
/**
 * Convert from a JavaScript boolean to a Perl boolean.
 */
function fromBoolean(value) {
    return value ? "1" : "0";
}
const perlFalse = new Set(["", "0", 0]);
/**
 * Convert from a Perl boolean to a JavaScript boolean
 */
function toBoolean(value) {
    if (perlFalse.has(value)) {
        return false;
    }
    return true;
}

// MIT License
/**
 * An name/value pair argument
 */
class Argument {
    /**
     * Build a new Argument.
     *
     * @param name Name of the argument
     * @param value Value of the argument.
     */
    constructor(name, value) {
        if (!name) {
            throw new Error("You must provide a name when creating a name/value argument");
        }
        this.name = name;
        this.value = value;
    }
}

// MIT License
//
// Copyright 2021 cPanel L.L.C.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
/**
 * The filter operator defines the rule used to compare data in a column with the passed-in value. It
 * behaves something like:
 *
 *   const value = 1;
 *   data.map(item => item[column])
 *       .filter(itemValue => operator(itemValue, value));
 *
 * where item is the data from the column
 */
var FilterOperator;
(function (FilterOperator) {
    /**
     * String contains value
     */
    FilterOperator[FilterOperator["Contains"] = 0] = "Contains";
    /**
     * String begins with value
     */
    FilterOperator[FilterOperator["Begins"] = 1] = "Begins";
    /**
     * String ends with value
     */
    FilterOperator[FilterOperator["Ends"] = 2] = "Ends";
    /**
     * String matches pattern in value
     */
    FilterOperator[FilterOperator["Matches"] = 3] = "Matches";
    /**
     * Column value equals value
     */
    FilterOperator[FilterOperator["Equal"] = 4] = "Equal";
    /**
     * Column value not equal value
     */
    FilterOperator[FilterOperator["NotEqual"] = 5] = "NotEqual";
    /**
     * Column value is less than value
     */
    FilterOperator[FilterOperator["LessThan"] = 6] = "LessThan";
    /**
     * Column value is less than value using unlimited rules.
     */
    FilterOperator[FilterOperator["LessThanUnlimited"] = 7] = "LessThanUnlimited";
    /**
     * Column value is greater than value.
     */
    FilterOperator[FilterOperator["GreaterThan"] = 8] = "GreaterThan";
    /**
     * Column value is greater than value using unlimited rules.
     */
    FilterOperator[FilterOperator["GreaterThanUnlimited"] = 9] = "GreaterThanUnlimited";
    /**
     * Column value is defined. Value is ignored in this case.
     */
    FilterOperator[FilterOperator["Defined"] = 10] = "Defined";
    /**
     * Column value is undefined. Value is ignored in this case.
     */
    FilterOperator[FilterOperator["Undefined"] = 11] = "Undefined";
})(FilterOperator || (FilterOperator = {}));
/**
 * Defines a filter request for a Api call.
 */
class Filter {
    /**
     * Construct a new Filter object.
     *
     * @param column Column name requests. Must be non-empty and exist on the related backend collection.
     * @param operator Comparison operator to use when applying the filter.
     * @param value Value to compare the columns value too.
     */
    constructor(column, operator, value) {
        if (!column) {
            throw new Error("You must define a non-empty column name.");
        }
        this.column = column;
        this.operator = operator;
        this.value = value;
    }
}

// MIT License
//
// Copyright 2021 cPanel L.L.C.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
const DEFAULT_PAGE_SIZE = 20;
/**
 * When passed in the pageSize, will request all available records in a single page. Note: The backend process may not honor this request.
 */
const ALL = Number.POSITIVE_INFINITY;
/**
 * Defines a pagination request for an API.
 */
class Pager {
    /**
     * Create a new pagination object.
     *
     * @param page Page to request. From 1 .. n where n is the set.length % pageSize. Defaults to 1.
     * @param pageSize Number of records to request in a page of data. Defaults to DEFAULT_PAGE_SIZE.
     *                          If the string 'all' is passed, then all the records are requested. Note: The backend
     *                          system may still impose page size limits in this case.
     */
    constructor(page = 1, pageSize = DEFAULT_PAGE_SIZE) {
        if (page <= 0) {
            throw new Error("The page must be 1 or greater. This is the logical page, not a programming index.");
        }
        if (pageSize <= 0) {
            throw new Error("The pageSize must be set to 'ALL' or a number > 0");
        }
        this.page = page;
        this.pageSize = pageSize;
    }
    /**
     * Check if the pagesize is set to ALL.
     *
     * @return true if requesting all records, false otherwise.
     */
    all() {
        return this.pageSize === ALL;
    }
}

// MIT License
//
// Copyright 2021 cPanel L.L.C.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
/**
 * Sorting direction. The SortType and SortDirection combine to define the sorting for collections returned.
 */
var SortDirection;
(function (SortDirection) {
    /**
     * Records are sorted from low value to high value based on the SortType
     */
    SortDirection[SortDirection["Ascending"] = 0] = "Ascending";
    /**
     * Records are sorted from high value to low value based on the SortType
     */
    SortDirection[SortDirection["Descending"] = 1] = "Descending";
})(SortDirection || (SortDirection = {}));
/**
 * Sorting type. Defines how values are compared.
 */
var SortType;
(function (SortType) {
    /**
     * Uses character-by-character comparison.
     */
    SortType[SortType["Lexicographic"] = 0] = "Lexicographic";
    /**
     * Special rule for handing IPv4 comparison. This takes into account the segments.
     */
    SortType[SortType["Ipv4"] = 1] = "Ipv4";
    /**
     * Assumes the values are numeric and compares them using number rules.
     */
    SortType[SortType["Numeric"] = 2] = "Numeric";
    /**
     * Special rule for certain data where 0 is considered unlimited.
     */
    SortType[SortType["NumericZeroAsMax"] = 3] = "NumericZeroAsMax";
})(SortType || (SortType = {}));
/**
 * Defines a sort rule. These can be combined into a list to define a complex sort for a list dataset.
 */
class Sort {
    /**
     * Create a new instance of a Sort
     *
     * @param column Column to sort
     * @param direction Optional sort direction. Defaults to Ascending
     * @param type Optional sort type. Defaults to Lexicographic
     */
    constructor(column, direction = SortDirection.Ascending, type = SortType.Lexicographic) {
        if (!column) {
            throw new Error("You must provide a non-empty column name for a Sort rule.");
        }
        this.column = column;
        this.direction = direction;
        this.type = type;
    }
}

// MIT License
//
// Copyright 2021 cPanel L.L.C.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
/**
 * HTTP Headers Collection Abstraction
 *
 * The abstraction is an adapter to allow easy transformation of the headers array
 * into various formats for external HTTP libraries.
 */
class Headers {
    /**
     * Create the adapter.
     *
     * @param headers - List of headers.
     */
    constructor(headers = []) {
        this.headers = headers;
    }
    /**
     * Push a header into the collection.
     *
     * @param header - A header to add to the collection
     */
    push(header) {
        this.headers.push(header);
    }
    /**
     * Iterator for the headers collection.
     *
     * @param fn - Transform for the forEach
     * @param thisArg - Optional reference to `this` to apply to the transform function.
     */
    forEach(fn, thisArg) {
        this.headers.forEach(fn, thisArg);
    }
    /**
     * Retrieve the headers as an array of Headers
     */
    toArray() {
        const copy = [];
        this.headers.forEach((h) => copy.push({ name: h.name, value: h.value }));
        return copy;
    }
    /**
     * Retrieve the headers as an object
     */
    toObject() {
        return this.headers.reduce((o, header) => {
            o[header.name] = header.value;
            return o;
        }, {});
    }
}
class CustomHeader {
    constructor(_header) {
        this._header = _header;
    }
    get name() {
        return this._header.name;
    }
    get value() {
        return this._header.value;
    }
}
class CpanelApiTokenInvalidError extends Error {
    constructor(m) {
        super(m);
        this.name = "CpanelApiTokenInvalidError";
        // Set the prototype explicitly. This fixes unit tests.
        Object.setPrototypeOf(this, CpanelApiTokenInvalidError.prototype);
    }
}
class CpanelApiTokenMismatchError extends Error {
    constructor(m) {
        super(m);
        this.name = "CpanelApiTokenMismatchError";
        // Set the prototype explicitly. This fixes unit tests.
        Object.setPrototypeOf(this, CpanelApiTokenMismatchError.prototype);
    }
}
class CpanelApiTokenHeader extends CustomHeader {
    constructor(token, user) {
        if (!token) {
            throw new CpanelApiTokenInvalidError("You must pass a valid token to the constructor.");
        }
        if (!user && !/^.+[:]/.test(token)) {
            throw new CpanelApiTokenInvalidError("You must pass a cPanel username associated with the cPanel API token.");
        }
        if (!user && !/[:].+$/.test(token)) {
            throw new CpanelApiTokenInvalidError("You must pass a valid cPanel API token.");
        }
        super({
            name: "Authorization",
            value: `cpanel ${user ? user + ":" : ""}${token}`,
        });
    }
}
class WhmApiTokenInvalidError extends Error {
    constructor(m) {
        super(m);
        this.name = "WhmApiTokenInvalidError";
        // Set the prototype explicitly. This fixes unit tests.
        Object.setPrototypeOf(this, WhmApiTokenInvalidError.prototype);
    }
}
class WhmApiTokenMismatchError extends Error {
    constructor(m) {
        super(m);
        this.name = "WhmApiTokenMismatchError";
        // Set the prototype explicitly. This fixes unit tests.
        Object.setPrototypeOf(this, WhmApiTokenMismatchError.prototype);
    }
}
class WhmApiTokenHeader extends CustomHeader {
    constructor(token, user) {
        if (!token) {
            throw new WhmApiTokenInvalidError("You must pass a valid token to the constructor.");
        }
        if (!user && !/^.+:/.test(token)) {
            throw new WhmApiTokenInvalidError("You must pass a WHM username associated with the WHM API token.");
        }
        if (!user && !/:.+$/.test(token)) {
            throw new WhmApiTokenInvalidError("You must pass a valid WHM API token.");
        }
        super({
            name: "Authorization",
            value: `whm ${user ? user + ":" : ""}${token}`,
        });
    }
}

// MIT License
/**
 * Abstract base class for all Request objects. Developers should
 * create a subclass of this that implements the generate() method.
 */
class Request$1 {
    /**
     * Create a new request.
     *
     * @param init   Optional request object used to initialize this object.
     */
    constructor(init) {
        /**
         * Namespace where the API call lives
         * @type {string}
         */
        this.namespace = "";
        /**
         * Method name of the API call.
         * @type {string}
         */
        this.method = "";
        /**
         * Optional list of arguments for the API call.
         * @type {IArgument[]}
         */
        this.arguments = [];
        /**
         * Optional list of sorting rules to pass to the API call.
         */
        this.sorts = [];
        /**
         * Optional list of filter rules to pass to the API call.
         */
        this.filters = [];
        /**
         * Optional list of columns to include with the response to the API call.
         */
        this.columns = [];
        /**
         * Optional pager rule to pass to the API.
         */
        this.pager = new Pager();
        /**
         * Optional custom headers collection
         */
        this.headers = new Headers();
        this._usePager = false;
        /**
         * Default configuration object.
         */
        this.defaultConfig = {
            analytics: false,
            json: false,
        };
        /**
         * Optional configuration information
         */
        this.config = this.defaultConfig;
        if (init) {
            this.method = init.method;
            if (init.namespace) {
                this.namespace = init.namespace;
            }
            if (init.arguments) {
                init.arguments.forEach((argument) => {
                    this.addArgument(argument);
                });
            }
            if (init.sorts) {
                init.sorts.forEach((sort) => {
                    this.addSort(sort);
                });
            }
            if (init.filters) {
                init.filters.forEach((filter) => {
                    this.addFilter(filter);
                });
            }
            if (init.columns) {
                init.columns.forEach((column) => this.addColumn(column));
            }
            if (init.pager) {
                this.paginate(init.pager);
            }
            if (init.config) {
                this.config = init.config;
            }
            else {
                this.config = this.defaultConfig;
            }
            if (init.headers) {
                init.headers.forEach((header) => {
                    this.addHeader(header);
                });
            }
        }
    }
    /**
     * Use the pager only if true.
     */
    get usePager() {
        return this._usePager;
    }
    /**
     * Add an argument to the request.
     *
     * @param argument
     * @return Updated Request object.
     */
    addArgument(argument) {
        if (argument instanceof Argument) {
            this.arguments.push(argument);
        }
        else {
            this.arguments.push(new Argument(argument.name, argument.value));
        }
        return this;
    }
    /**
     * Add sorting rule to the request.
     *
     * @param sort Sort object with sorting information.
     * @return Updated Request object.
     */
    addSort(sort) {
        if (sort instanceof Sort) {
            this.sorts.push(sort);
        }
        else {
            this.sorts.push(new Sort(sort.column, sort.direction, sort.type));
        }
        return this;
    }
    /**
     * Add a filter to the request.
     *
     * @param filter Filter object with filter information.
     * @return Updated Request object.
     */
    addFilter(filter) {
        if (filter instanceof Filter) {
            this.filters.push(filter);
        }
        else {
            this.filters.push(new Filter(filter.column, filter.operator, filter.value));
        }
        return this;
    }
    /**
     * Add a column to include in the request. If no columns are specified, all columns are retrieved.
     *
     * @param name Name of a column
     * @return Updated Request object.
     */
    addColumn(column) {
        this.columns.push(column);
        return this;
    }
    /**
     * Add a custom http header to the request
     *
     * @param name Name of a column
     * @return Updated Request object.
     */
    addHeader(header) {
        if (header instanceof CustomHeader) {
            this.headers.push(header);
        }
        else {
            this.headers.push(new CustomHeader(header));
        }
        return this;
    }
    /**
     * Set the pager setting for the request.
     *
     * @param pager Pager object with pagination information.
     * @return Updated Request object.
     */
    paginate(pager) {
        if (pager instanceof Pager) {
            this.pager = pager;
        }
        else {
            this.pager = new Pager(pager.page, pager.pageSize || 20);
        }
        this._usePager = true;
        return this;
    }
}

/**
 * Checks if `value` is `undefined`.
 *
 * @static
 * @since 0.1.0
 * @memberOf _
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
 * @example
 *
 * _.isUndefined(void 0);
 * // => true
 *
 * _.isUndefined(null);
 * // => false
 */
function isUndefined(value) {
  return value === undefined;
}

var isUndefined_1 = isUndefined;

/**
 * Checks if `value` is `null`.
 *
 * @static
 * @memberOf _
 * @since 0.1.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
 * @example
 *
 * _.isNull(null);
 * // => true
 *
 * _.isNull(void 0);
 * // => false
 */
function isNull(value) {
  return value === null;
}

var isNull_1 = isNull;

// MIT License
/**
 * Types of message that can be in a response.
 */
var MessageType;
(function (MessageType) {
    /**
     * Message is an error.
     */
    MessageType[MessageType["Error"] = 0] = "Error";
    /**
     * Message is a warning.
     */
    MessageType[MessageType["Warning"] = 1] = "Warning";
    /**
     * Message is informational.
     */
    MessageType[MessageType["Information"] = 2] = "Information";
    /**
     * The message type is unknown.
     */
    MessageType[MessageType["Unknown"] = 3] = "Unknown";
})(MessageType || (MessageType = {}));
const DefaultMetaData = {
    isPaged: false,
    isFiltered: false,
    record: 0,
    page: 0,
    pageSize: 0,
    totalRecords: 0,
    totalPages: 0,
    recordsBeforeFilter: 0,
    batch: false,
    properties: {},
};
/**
 * Deep cloning of a object to avoid reference overwritting.
 *
 * @param data Metadata object to be cloned.
 * @returns Cloned Metadata object.
 */
function clone(data) {
    return JSON.parse(JSON.stringify(data));
}
/**
 * Base class for all response. Must be sub-classed by a real implementation.
 */
class Response {
    /**
     * Build a new response object from the response. Note, this class should not be called
     * directly.
     * @param response Complete data passed from the server. Probably it's been parsed using JSON.parse().
     * @param options for how to handle the processing of the response data.
     */
    constructor(response, options) {
        /**
         * The status code returned by the API. Usually 1 for success, 0 for failure.
         */
        this.status = 0;
        /**
         * List of messages related to the response.
         */
        this.messages = [];
        /**
         * Additional data returned about the request. Paging, filtering, and maybe other custom properties.
         */
        this.meta = clone(DefaultMetaData);
        /**
         * Options about how to handle the response processing.
         */
        this.options = {
            keepUnprocessedResponse: false,
        };
        if (isUndefined_1(response) || isNull_1(response)) {
            throw new Error("The response was unexpectedly undefined or null");
        }
        if (options) {
            this.options = options;
        }
        if (this.options.keepUnprocessedResponse) {
            this.raw = JSON.parse(JSON.stringify(response)); // deep clone
        }
    }
    /**
     * Checks if the API was successful.
     *
     * @return true if successful, false if failure.
     */
    get success() {
        return this.status > 0;
    }
    /**
     * Checks if the api failed.
     *
     * @return true if the API reports failure, false otherwise.
     */
    get failed() {
        return this.status === 0;
    }
    /**
     * Get the list of messages based on the requested type.
     *
     * @param type Type of the message to look up.
     * @return List of messages that match the filter.
     */
    _getMessages(type) {
        return this.messages.filter((message) => message.type === type);
    }
    /**
     * Get the list of error messages.
     *
     * @return List of errors.
     */
    get errors() {
        return this._getMessages(MessageType.Error);
    }
    /**
     * Get the list of warning messages.
     *
     * @return List of warnings.
     */
    get warnings() {
        return this._getMessages(MessageType.Warning);
    }
    /**
     * Get the list of informational messages.
     *
     * @return List of informational messages.
     */
    get infoMessages() {
        return this._getMessages(MessageType.Information);
    }
    /**
     * Checks if there are any messages of a given type.
     * @param type Type of the message to check for.
     * @return true if there are messages of the requested type. false otherwise.
     */
    _hasMessages(type) {
        return this.messages.filter((message) => message.type === type).length > 0;
    }
    /**
     * Checks if there are any error messages in the response.
     *
     * @return true if there are error messages, false otherwise.
     */
    get hasErrors() {
        return this._hasMessages(MessageType.Error);
    }
    /**
     * Checks if there are any warnings in the response.
     *
     * @return true if there are warnings, false otherwise.
     */
    get hasWarnings() {
        return this._hasMessages(MessageType.Warning);
    }
    /**
     * Checks if there are any informational messages in the response.
     *
     * @return true if there are informational messages, false otherwise.
     */
    get hasInfoMessages() {
        return this._hasMessages(MessageType.Information);
    }
    /**
     * Check if the response was paginated by the backend.
     *
     * @return true if the backend returned a page of the total records.
     */
    get isPaged() {
        return this.meta.isPaged;
    }
    /**
     * Check if the response was filtered by the backend.
     *
     * @return true if the backend filtered the records.
     */
    get isFiltered() {
        return this.meta.isFiltered;
    }
}

/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;

var _freeGlobal = freeGlobal;

/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;

/** Used as a reference to the global object. */
var root = _freeGlobal || freeSelf || Function('return this')();

var _root = root;

/** Built-in value references. */
var Symbol = _root.Symbol;

var _Symbol = Symbol;

/** Used for built-in method references. */
var objectProto$2 = Object.prototype;

/** Used to check objects for own properties. */
var hasOwnProperty$2 = objectProto$2.hasOwnProperty;

/**
 * Used to resolve the
 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
 * of values.
 */
var nativeObjectToString$1 = objectProto$2.toString;

/** Built-in value references. */
var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;

/**
 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
 *
 * @private
 * @param {*} value The value to query.
 * @returns {string} Returns the raw `toStringTag`.
 */
function getRawTag(value) {
  var isOwn = hasOwnProperty$2.call(value, symToStringTag$1),
      tag = value[symToStringTag$1];

  try {
    value[symToStringTag$1] = undefined;
    var unmasked = true;
  } catch (e) {}

  var result = nativeObjectToString$1.call(value);
  if (unmasked) {
    if (isOwn) {
      value[symToStringTag$1] = tag;
    } else {
      delete value[symToStringTag$1];
    }
  }
  return result;
}

var _getRawTag = getRawTag;

/** Used for built-in method references. */
var objectProto$1 = Object.prototype;

/**
 * Used to resolve the
 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
 * of values.
 */
var nativeObjectToString = objectProto$1.toString;

/**
 * Converts `value` to a string using `Object.prototype.toString`.
 *
 * @private
 * @param {*} value The value to convert.
 * @returns {string} Returns the converted string.
 */
function objectToString(value) {
  return nativeObjectToString.call(value);
}

var _objectToString = objectToString;

/** `Object#toString` result references. */
var nullTag = '[object Null]',
    undefinedTag = '[object Undefined]';

/** Built-in value references. */
var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;

/**
 * The base implementation of `getTag` without fallbacks for buggy environments.
 *
 * @private
 * @param {*} value The value to query.
 * @returns {string} Returns the `toStringTag`.
 */
function baseGetTag(value) {
  if (value == null) {
    return value === undefined ? undefinedTag : nullTag;
  }
  return (symToStringTag && symToStringTag in Object(value))
    ? _getRawTag(value)
    : _objectToString(value);
}

var _baseGetTag = baseGetTag;

/**
 * Checks if `value` is object-like. A value is object-like if it's not `null`
 * and has a `typeof` result of "object".
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
 * @example
 *
 * _.isObjectLike({});
 * // => true
 *
 * _.isObjectLike([1, 2, 3]);
 * // => true
 *
 * _.isObjectLike(_.noop);
 * // => false
 *
 * _.isObjectLike(null);
 * // => false
 */
function isObjectLike$1(value) {
  return value != null && typeof value == 'object';
}

var isObjectLike_1 = isObjectLike$1;

/** `Object#toString` result references. */
var boolTag = '[object Boolean]';

/**
 * Checks if `value` is classified as a boolean primitive or object.
 *
 * @static
 * @memberOf _
 * @since 0.1.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
 * @example
 *
 * _.isBoolean(false);
 * // => true
 *
 * _.isBoolean(null);
 * // => false
 */
function isBoolean$1(value) {
  return value === true || value === false ||
    (isObjectLike_1(value) && _baseGetTag(value) == boolTag);
}

var isBoolean_1 = isBoolean$1;

/** `Object#toString` result references. */
var numberTag = '[object Number]';

/**
 * Checks if `value` is classified as a `Number` primitive or object.
 *
 * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
 * classified as numbers, use the `_.isFinite` method.
 *
 * @static
 * @memberOf _
 * @since 0.1.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a number, else `false`.
 * @example
 *
 * _.isNumber(3);
 * // => true
 *
 * _.isNumber(Number.MIN_VALUE);
 * // => true
 *
 * _.isNumber(Infinity);
 * // => true
 *
 * _.isNumber('3');
 * // => false
 */
function isNumber$1(value) {
  return typeof value == 'number' ||
    (isObjectLike_1(value) && _baseGetTag(value) == numberTag);
}

var isNumber_1 = isNumber$1;

/**
 * Checks if `value` is classified as an `Array` object.
 *
 * @static
 * @memberOf _
 * @since 0.1.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is an array, else `false`.
 * @example
 *
 * _.isArray([1, 2, 3]);
 * // => true
 *
 * _.isArray(document.body.children);
 * // => false
 *
 * _.isArray('abc');
 * // => false
 *
 * _.isArray(_.noop);
 * // => false
 */
var isArray$1 = Array.isArray;

var isArray_1 = isArray$1;

/** `Object#toString` result references. */
var stringTag = '[object String]';

/**
 * Checks if `value` is classified as a `String` primitive or object.
 *
 * @static
 * @since 0.1.0
 * @memberOf _
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a string, else `false`.
 * @example
 *
 * _.isString('abc');
 * // => true
 *
 * _.isString(1);
 * // => false
 */
function isString$1(value) {
  return typeof value == 'string' ||
    (!isArray_1(value) && isObjectLike_1(value) && _baseGetTag(value) == stringTag);
}

var isString_1 = isString$1;

/**
 * Creates a unary function that invokes `func` with its argument transformed.
 *
 * @private
 * @param {Function} func The function to wrap.
 * @param {Function} transform The argument transform.
 * @returns {Function} Returns the new function.
 */
function overArg(func, transform) {
  return function(arg) {
    return func(transform(arg));
  };
}

var _overArg = overArg;

/** Built-in value references. */
var getPrototype = _overArg(Object.getPrototypeOf, Object);

var _getPrototype = getPrototype;

/** `Object#toString` result references. */
var objectTag = '[object Object]';

/** Used for built-in method references. */
var funcProto = Function.prototype,
    objectProto = Object.prototype;

/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;

/** Used to check objects for own properties. */
var hasOwnProperty$1 = objectProto.hasOwnProperty;

/** Used to infer the `Object` constructor. */
var objectCtorString = funcToString.call(Object);

/**
 * Checks if `value` is a plain object, that is, an object created by the
 * `Object` constructor or one with a `[[Prototype]]` of `null`.
 *
 * @static
 * @memberOf _
 * @since 0.8.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
 * @example
 *
 * function Foo() {
 *   this.a = 1;
 * }
 *
 * _.isPlainObject(new Foo);
 * // => false
 *
 * _.isPlainObject([1, 2, 3]);
 * // => false
 *
 * _.isPlainObject({ 'x': 0, 'y': 0 });
 * // => true
 *
 * _.isPlainObject(Object.create(null));
 * // => true
 */
function isPlainObject(value) {
  if (!isObjectLike_1(value) || _baseGetTag(value) != objectTag) {
    return false;
  }
  var proto = _getPrototype(value);
  if (proto === null) {
    return true;
  }
  var Ctor = hasOwnProperty$1.call(proto, 'constructor') && proto.constructor;
  return typeof Ctor == 'function' && Ctor instanceof Ctor &&
    funcToString.call(Ctor) == objectCtorString;
}

var isPlainObject_1 = isPlainObject;

// MIT License
/**
 * Verify if the value can be serialized to JSON
 *
 * @param value Value to check.
 * @source https://stackoverflow.com/questions/30579940/reliable-way-to-check-if-objects-is-serializable-in-javascript#answer-30712764
 */
function isSerializable(value) {
    if (isUndefined_1(value) ||
        isNull_1(value) ||
        isBoolean_1(value) ||
        isNumber_1(value) ||
        isString_1(value)) {
        return true;
    }
    if (!isPlainObject_1(value) && !isArray_1(value)) {
        return false;
    }
    for (const key in value) {
        if (!isSerializable(value[key])) {
            return false;
        }
    }
    return true;
}

// MIT License
/**
 * Encode parameters using application/x-www-form-urlencoded
 */
class WwwFormUrlArgumentEncoder {
    constructor() {
        this.contentType = "application/x-www-form-urlencoded";
        this.separatorStart = "";
        this.separatorEnd = "";
        this.recordSeparator = "&";
    }
    /**
     * Encode a given value into the application/x-www-form-urlencoded.
     *
     * @param name Name of the field, may be empty string.
     * @param value Value to serialize
     * @param last True if this is the last argument being serialized.
     * @return Encoded version of the argument.
     */
    encode(name, value, last) {
        if (!name) {
            throw new Error("Name must have a non-empty value");
        }
        return (`${name}=${encodeURIComponent(value.toString())}` +
            (!last ? this.recordSeparator : ""));
    }
}
/**
 * Encode the parameter into JSON
 */
class JsonArgumentEncoder {
    constructor() {
        this.contentType = "application/json";
        this.separatorStart = "{";
        this.separatorEnd = "}";
        this.recordSeparator = ",";
    }
    /**
     * Encode a given value into the JSON application/json body.
     *
     * @param name Name of the field.
     * @param value Value to serialize
     * @param last True if this is the last argument being serialized.
     * @return {string}        Encoded version of the argument.
     */
    encode(name, value, last) {
        if (!name) {
            throw new Error("Name must have a non-empty value");
        }
        if (!isSerializable(value)) {
            throw new Error("The passed in value can not be serialized to JSON");
        }
        return (JSON.stringify(name) +
            ":" +
            JSON.stringify(value) +
            (!last ? this.recordSeparator : ""));
    }
}

// MIT License
//
// Copyright 2021 cPanel L.L.C.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
/**
 * Check if the protocol is https.
 * @param  protocol Protocol to test
 * @return true if its https: in any case, false otherwise.
 */
function isHttps(protocol) {
    return /^https:$/i.test(protocol);
}
/**
 * Check if the protocol is http.
 * @param  protocol Protocol to test
 * @return true if its http: in any case, false otherwise.
 */
function isHttp(protocol) {
    return /^http:$/i.test(protocol);
}
/**
 * Strip any trailing slashes from a string.
 *
 * @method stripTrailingSlash
 * @param  path The path string to process.
 * @return The path string without a trailing slash.
 */
function stripTrailingSlash(path) {
    return path && path.replace(/\/?$/, "");
}
// This will work in any context except a proxy URL to cPanel or Webmail
// that accesses a URL outside /frontend (cPanel) or /webmail (Webmail),
// but URLs like that are non-production by definition.
const PortToApplicationMap = {
    "80": "other",
    "443": "other",
    "2082": "cpanel",
    "2083": "cpanel",
    "2086": "whostmgr",
    "2087": "whostmgr",
    "2095": "webmail",
    "2096": "webmail",
    "9876": "unittest",
    "9877": "unittest",
    "9878": "unittest",
    "9879": "unittest",
    frontend: "cpanel",
    webmail: "webmail",
};
/**
 * Helper class used to calculate paths within cPanel applications.
 */
class ApplicationPath {
    /**
     * Create the PathHelper. This class is used to help generate paths
     * within an application. It has special knowledge about how paths are
     * constructed in the cPanel family of applications.
     *
     * @param location Abstraction for the window.location object to aid in unit testing this module.
     */
    constructor(location) {
        this.unprotectedPaths = ["/resetpass", "/invitation"];
        this.protocol = location.protocol;
        let port = location.port;
        if (!port) {
            // Since some browsers won't fill this in, we have to derive it from
            // the protocol if it's not provided in the window.location object.
            if (isHttps(this.protocol)) {
                port = "443";
            }
            else if (isHttp(this.protocol)) {
                port = "80";
            }
        }
        this.domain = location.hostname;
        this.port = parseInt(port, 10);
        this.path = location.pathname;
        const pathMatch = 
        // eslint-disable-next-line no-useless-escape -- regex, not a string
        this.path.match(/((?:\/cpsess\d+)?)(?:\/([^\/]+))?/) || [];
        // For proxy subdomains, we look at the first subdomain to identify the application.
        if (/^whm\./.test(this.domain)) {
            this.applicationName = PortToApplicationMap["2087"];
        }
        else if (/^cpanel\./.test(this.domain)) {
            this.applicationName = PortToApplicationMap["2083"];
        }
        else if (/^webmail\./.test(this.domain)) {
            this.applicationName = PortToApplicationMap["2095"];
        }
        else {
            this.applicationName =
                PortToApplicationMap[port.toString()] ||
                    PortToApplicationMap[pathMatch[2]] ||
                    "whostmgr";
        }
        this.securityToken = pathMatch[1] || "";
        this.applicationPath = this.securityToken
            ? this.path.replace(this.securityToken, "")
            : this.path;
        this.theme = "";
        if (!this.isUnprotected && (this.isCpanel || this.isWebmail)) {
            const folders = this.path.split("/");
            this.theme = folders[3];
        }
        this.themePath = "";
        let themePath = this.securityToken + "/";
        if (this.isUnprotected) {
            themePath = "/";
        }
        else if (this.isCpanel) {
            themePath += "frontend/" + this.theme + "/";
        }
        else if (this.isWebmail) {
            themePath += "webmail/" + this.theme + "/";
        }
        else if (this.isOther) {
            // For unrecognized applications, use the path passed in PAGE.THEME_PATH
            themePath = "/";
        }
        this.themePath = themePath;
        this.rootUrl = this.protocol + "//" + this.domain + ":" + this.port;
    }
    /**
     * Return whether we are running inside some other framework or application
     *
     * @return true if this is an unrecognized application or framework; false otherwise
     */
    get isOther() {
        return /other/i.test(this.applicationName);
    }
    /**
     * Return whether we are running inside an unprotected path
     *
     * @return true if this is unprotected; false otherwise
     */
    get isUnprotected() {
        return (!this.securityToken &&
            this.unprotectedPaths.indexOf(stripTrailingSlash(this.applicationPath)) !== -1);
    }
    /**
     * Return whether we are running inside cPanel or something else (e.g., WHM)
     *
     * @return true if this is cPanel; false otherwise
     */
    get isCpanel() {
        return /cpanel/i.test(this.applicationName);
    }
    /**
     * Return whether we are running inside WHM or something else (e.g., WHM)
     *
     * @return true if this is WHM; false otherwise
     */
    get isWhm() {
        return /whostmgr/i.test(this.applicationName);
    }
    /**
     * Return whether we are running inside WHM or something else (e.g., WHM)
     *
     * @return true if this is Webmail; false otherwise
     */
    get isWebmail() {
        return /webmail/i.test(this.applicationName);
    }
    /**
     * Get the domain relative path for the relative URL path.
     *
     * @param relative Relative path to the resource.
     * @return Domain relative URL path including theme, if applicable, for the application to the file.
     */
    buildPath(relative) {
        return this.themePath + relative;
    }
    /**
     * Get the full url path for the relative URL path.
     *
     * @param relative Relative path to the resource.
     * @return Full URL path including theme, if applicable, for the application to the file.
     */
    buildFullPath(relative) {
        return (this.protocol +
            "//" +
            this.domain +
            ":" +
            this.port +
            this.buildPath(relative));
    }
    /**
     * Build a path relative to the security token
     *
     * @param relative Relative path to the resource.
     * @return Full path to the token relative resource.
     */
    buildTokenPath(relative) {
        return (this.protocol +
            "//" +
            this.domain +
            ":" +
            this.port +
            this.securityToken +
            relative);
    }
}

// MIT License
//
// Copyright 2021 cPanel L.L.C.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
/**
 * Provides a mockable layer between the tools below and window.location.
 */
class LocationService {
    /**
     * The pathname part of the URL.
     */
    get pathname() {
        return window.location.pathname;
    }
    /**
     * The port part of the URL.
     */
    get port() {
        return window.location.port;
    }
    /**
     * The hostname part of the URL.
     */
    get hostname() {
        return window.location.hostname;
    }
    /**
     * The protocol part of the URL.
     */
    get protocol() {
        return window.location.protocol;
    }
}

/**
 * A specialized version of `_.reduce` for arrays without support for
 * iteratee shorthands.
 *
 * @private
 * @param {Array} [array] The array to iterate over.
 * @param {Function} iteratee The function invoked per iteration.
 * @param {*} [accumulator] The initial value.
 * @param {boolean} [initAccum] Specify using the first element of `array` as
 *  the initial value.
 * @returns {*} Returns the accumulated value.
 */
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;
}

var _arrayReduce = arrayReduce;

/**
 * The base implementation of `_.propertyOf` without support for deep paths.
 *
 * @private
 * @param {Object} object The object to query.
 * @returns {Function} Returns the new accessor function.
 */
function basePropertyOf(object) {
  return function(key) {
    return object == null ? undefined : object[key];
  };
}

var _basePropertyOf = basePropertyOf;

/** Used to map Latin Unicode letters to basic Latin letters. */
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'
};

/**
 * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
 * letters to basic Latin letters.
 *
 * @private
 * @param {string} letter The matched letter to deburr.
 * @returns {string} Returns the deburred letter.
 */
var deburrLetter = _basePropertyOf(deburredLetters);

var _deburrLetter = deburrLetter;

/**
 * A specialized version of `_.map` for arrays without support for iteratee
 * shorthands.
 *
 * @private
 * @param {Array} [array] The array to iterate over.
 * @param {Function} iteratee The function invoked per iteration.
 * @returns {Array} Returns the new mapped array.
 */
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;
}

var _arrayMap = arrayMap;

/** `Object#toString` result references. */
var symbolTag = '[object Symbol]';

/**
 * Checks if `value` is classified as a `Symbol` primitive or object.
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
 * @example
 *
 * _.isSymbol(Symbol.iterator);
 * // => true
 *
 * _.isSymbol('abc');
 * // => false
 */
function isSymbol(value) {
  return typeof value == 'symbol' ||
    (isObjectLike_1(value) && _baseGetTag(value) == symbolTag);
}

var isSymbol_1 = isSymbol;

/** Used as references for various `Number` constants. */
var INFINITY$2 = 1 / 0;

/** Used to convert symbols to primitives and strings. */
var symbolProto = _Symbol ? _Symbol.prototype : undefined,
    symbolToString = symbolProto ? symbolProto.toString : undefined;

/**
 * The base implementation of `_.toString` which doesn't convert nullish
 * values to empty strings.
 *
 * @private
 * @param {*} value The value to process.
 * @returns {string} Returns the string.
 */
function baseToString$1(value) {
  // Exit early for strings to avoid a performance hit in some environments.
  if (typeof value == 'string') {
    return value;
  }
  if (isArray_1(value)) {
    // Recursively convert values (susceptible to call stack limits).
    return _arrayMap(value, baseToString$1) + '';
  }
  if (isSymbol_1(value)) {
    return symbolToString ? symbolToString.call(value) : '';
  }
  var result = (value + '');
  return (result == '0' && (1 / value) == -INFINITY$2) ? '-0' : result;
}

var _baseToString = baseToString$1;

/**
 * Converts `value` to a string. An empty string is returned for `null`
 * and `undefined` values. The sign of `-0` is preserved.
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to convert.
 * @returns {string} Returns the converted string.
 * @example
 *
 * _.toString(null);
 * // => ''
 *
 * _.toString(-0);
 * // => '-0'
 *
 * _.toString([1, 2, 3]);
 * // => '1,2,3'
 */
function toString$2(value) {
  return value == null ? '' : _baseToString(value);
}

var toString_1 = toString$2;

/** Used to match Latin Unicode letters (excluding mathematical operators). */
var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;

/** Used to compose unicode character classes. */
var rsComboMarksRange$4 = '\\u0300-\\u036f',
    reComboHalfMarksRange$4 = '\\ufe20-\\ufe2f',
    rsComboSymbolsRange$4 = '\\u20d0-\\u20ff',
    rsComboRange$4 = rsComboMarksRange$4 + reComboHalfMarksRange$4 + rsComboSymbolsRange$4;

/** Used to compose unicode capture groups. */
var rsCombo$3 = '[' + rsComboRange$4 + ']';

/**
 * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
 * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
 */
var reComboMark = RegExp(rsCombo$3, 'g');

/**
 * Deburrs `string` by converting
 * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
 * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
 * letters to basic Latin letters and removing
 * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
 *
 * @static
 * @memberOf _
 * @since 3.0.0
 * @category String
 * @param {string} [string=''] The string to deburr.
 * @returns {string} Returns the deburred string.
 * @example
 *
 * _.deburr('déjà vu');
 * // => 'deja vu'
 */
function deburr(string) {
  string = toString_1(string);
  return string && string.replace(reLatin, _deburrLetter).replace(reComboMark, '');
}

var deburr_1 = deburr;

/** Used to match words composed of alphanumeric characters. */
var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;

/**
 * Splits an ASCII `string` into an array of its words.
 *
 * @private
 * @param {string} The string to inspect.
 * @returns {Array} Returns the words of `string`.
 */
function asciiWords(string) {
  return string.match(reAsciiWord) || [];
}

var _asciiWords = asciiWords;

/** Used to detect strings that need a more robust regexp to match words. */
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 ]/;

/**
 * Checks if `string` contains a word composed of Unicode symbols.
 *
 * @private
 * @param {string} string The string to inspect.
 * @returns {boolean} Returns `true` if a word is found, else `false`.
 */
function hasUnicodeWord(string) {
  return reHasUnicodeWord.test(string);
}

var _hasUnicodeWord = hasUnicodeWord;

/** Used to compose unicode character classes. */
var rsAstralRange$3 = '\\ud800-\\udfff',
    rsComboMarksRange$3 = '\\u0300-\\u036f',
    reComboHalfMarksRange$3 = '\\ufe20-\\ufe2f',
    rsComboSymbolsRange$3 = '\\u20d0-\\u20ff',
    rsComboRange$3 = rsComboMarksRange$3 + reComboHalfMarksRange$3 + rsComboSymbolsRange$3,
    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$3 = '\\ufe0e\\ufe0f',
    rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;

/** Used to compose unicode capture groups. */
var rsApos$1 = "['\u2019]",
    rsBreak = '[' + rsBreakRange + ']',
    rsCombo$2 = '[' + rsComboRange$3 + ']',
    rsDigits = '\\d+',
    rsDingbat = '[' + rsDingbatRange + ']',
    rsLower = '[' + rsLowerRange + ']',
    rsMisc = '[^' + rsAstralRange$3 + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
    rsFitz$2 = '\\ud83c[\\udffb-\\udfff]',
    rsModifier$2 = '(?:' + rsCombo$2 + '|' + rsFitz$2 + ')',
    rsNonAstral$2 = '[^' + rsAstralRange$3 + ']',
    rsRegional$2 = '(?:\\ud83c[\\udde6-\\uddff]){2}',
    rsSurrPair$2 = '[\\ud800-\\udbff][\\udc00-\\udfff]',
    rsUpper = '[' + rsUpperRange + ']',
    rsZWJ$3 = '\\u200d';

/** Used to compose unicode regexes. */
var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
    rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
    rsOptContrLower = '(?:' + rsApos$1 + '(?:d|ll|m|re|s|t|ve))?',
    rsOptContrUpper = '(?:' + rsApos$1 + '(?:D|LL|M|RE|S|T|VE))?',
    reOptMod$2 = rsModifier$2 + '?',
    rsOptVar$2 = '[' + rsVarRange$3 + ']?',
    rsOptJoin$2 = '(?:' + rsZWJ$3 + '(?:' + [rsNonAstral$2, rsRegional$2, rsSurrPair$2].join('|') + ')' + rsOptVar$2 + reOptMod$2 + ')*',
    rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
    rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
    rsSeq$2 = rsOptVar$2 + reOptMod$2 + rsOptJoin$2,
    rsEmoji = '(?:' + [rsDingbat, rsRegional$2, rsSurrPair$2].join('|') + ')' + rsSeq$2;

/** Used to match complex or compound words. */
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');

/**
 * Splits a Unicode `string` into an array of its words.
 *
 * @private
 * @param {string} The string to inspect.
 * @returns {Array} Returns the words of `string`.
 */
function unicodeWords(string) {
  return string.match(reUnicodeWord) || [];
}

var _unicodeWords = unicodeWords;

/**
 * Splits `string` into an array of its words.
 *
 * @static
 * @memberOf _
 * @since 3.0.0
 * @category String
 * @param {string} [string=''] The string to inspect.
 * @param {RegExp|string} [pattern] The pattern to match words.
 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
 * @returns {Array} Returns the words of `string`.
 * @example
 *
 * _.words('fred, barney, & pebbles');
 * // => ['fred', 'barney', 'pebbles']
 *
 * _.words('fred, barney, & pebbles', /[^, ]+/g);
 * // => ['fred', 'barney', '&', 'pebbles']
 */
function words(string, pattern, guard) {
  string = toString_1(string);
  pattern = guard ? undefined : pattern;

  if (pattern === undefined) {
    return _hasUnicodeWord(string) ? _unicodeWords(string) : _asciiWords(string);
  }
  return string.match(pattern) || [];
}

var words_1 = words;

/** Used to compose unicode capture groups. */
var rsApos = "['\u2019]";

/** Used to match apostrophes. */
var reApos = RegExp(rsApos, 'g');

/**
 * Creates a function like `_.camelCase`.
 *
 * @private
 * @param {Function} callback The function to combine each word.
 * @returns {Function} Returns the new compounder function.
 */
function createCompounder(callback) {
  return function(string) {
    return _arrayReduce(words_1(deburr_1(string).replace(reApos, '')), callback, '');
  };
}

var _createCompounder = createCompounder;

/**
 * Converts `string` to
 * [snake case](https://en.wikipedia.org/wiki/Snake_case).
 *
 * @static
 * @memberOf _
 * @since 3.0.0
 * @category String
 * @param {string} [string=''] The string to convert.
 * @returns {string} Returns the snake cased string.
 * @example
 *
 * _.snakeCase('Foo Bar');
 * // => 'foo_bar'
 *
 * _.snakeCase('fooBar');
 * // => 'foo_bar'
 *
 * _.snakeCase('--FOO-BAR--');
 * // => 'foo_bar'
 */
var snakeCase = _createCompounder(function(result, word, index) {
  return result + (index ? '_' : '') + word.toLowerCase();
});

var snakeCase_1 = snakeCase;

// MIT License
class UapiRequest extends Request$1 {
    /**
     * Add a custom HTTP header to the request
     *
     * @param name Name of a column
     * @return Updated Request object.
     */
    addHeader(header) {
        if (header instanceof WhmApiTokenHeader) {
            throw new WhmApiTokenMismatchError("A WhmApiTokenHeader cannot be used on a CpanelApiRequest");
        }
        super.addHeader(header);
        return this;
    }
    /**
     * Build a fragment of the parameter list based on the list of name/value pairs.
     *
     * @param params  Parameters to serialize.
     * @param encoder Encoder to use to serialize the each parameter.
     * @return Fragment with the serialized parameters
     */
    _build(params, encoder) {
        let fragment = "";
        params.forEach((arg, index, array) => {
            const isLast = index === array.length - 1;
            fragment += encoder.encode(arg.name, arg.value, isLast);
        });
        return encoder.separatorStart + fragment + encoder.separatorEnd;
    }
    /**
     * Generates the arguments for the request.
     *
     * @param params List of parameters to adjust based on the sort rules in the Request.
     */
    _generateArguments(params) {
        this.arguments.forEach((argument) => params.push(argument));
    }
    /**
     * Generates the sort parameters for the request.
     *
     * @param params List of parameters to adjust based on the sort rules in the Request.
     */
    _generateSorts(params) {
        this.sorts.forEach((sort, index) => {
            if (index === 0) {
                params.push({ name: "api.sort", value: fromBoolean(true) });
            }
            params.push({ name: "api.sort_column_" + index, value: sort.column });
            params.push({
                name: "api.sort_reverse_" + index,
                value: fromBoolean(sort.direction !== SortDirection.Ascending),
            });
            params.push({
                name: "api.sort_method_" + index,
                value: snakeCase_1(SortType[sort.type]),
            });
        });
    }
    /**
     * Look up the correct name for the filter operator
     *
     * @param operator Type of filter operator to use to filter the items
     * @returns The string counter part for the filter operator.
     * @throws Will throw an error if an unrecognized FilterOperator is provided.
     */
    _lookupFilterOperator(operator) {
        switch (operator) {
            case FilterOperator.GreaterThanUnlimited:
                return "gt_handle_unlimited";
            case FilterOperator.GreaterThan:
                return "gt";
            case FilterOperator.LessThanUnlimited:
                return "lt_handle_unlimited";
            case FilterOperator.LessThan:
                return "lt";
            case FilterOperator.NotEqual:
                return "ne";
            case FilterOperator.Equal:
                return "eq";
            case FilterOperator.Defined:
                return "defined";
            case FilterOperator.Undefined:
                return "undefined";
            case FilterOperator.Matches:
                return "matches";
            case FilterOperator.Ends:
                return "ends";
            case FilterOperator.Begins:
                return "begins";
            case FilterOperator.Contains:
                return "contains";
            default:
                // eslint-disable-next-line no-case-declarations -- just used for readability
                const key = FilterOperator[operator];
                throw new Error(`Unrecognized FilterOperator ${key} for UAPI`);
        }
    }
    /**
     * Generate the filter parameters if any.
     *
     * @param params List of parameters to adjust based on the filter rules provided.
     */
    _generateFilters(params) {
        this.filters.forEach((filter, index) => {
            params.push({ name: "api.filter_column_" + index, value: filter.column });
            params.push({
                name: "api.filter_type_" + index,
                value: this._lookupFilterOperator(filter.operator),
            });
            params.push({ name: "api.filter_term_" + index, value: filter.value });
        });
    }
    /**
     * In UAPI, we request the starting record, not the starting page. This translates
     * the page and page size into the correct starting record.
     */
    _traslatePageToStart(pager) {
        return (pager.page - 1) * pager.pageSize + 1;
    }
    /**
     * Generate the pager request parameters, if any.
     *
     * @param params List of parameters to adjust based on the pagination rules.
     */
    _generatePagination(params) {
        if (!this.usePager) {
            return;
        }
        const allPages = this.pager.all();
        params.push({
            name: "api.paginate",
            value: fromBoolean(true),
        });
        params.push({
            name: "api.paginate_start",
            value: allPages ? -1 : this._traslatePageToStart(this.pager),
        });
        if (!allPages) {
            params.push({
                name: "api.paginate_size",
                value: this.pager.pageSize,
            });
        }
    }
    /**
     * Generate any additional parameters from the configuration data.
     *
     * @param params List of parameters to adjust based on the configuration.
     */
    _generateConfiguration(params) {
        if (this.config && this.config["analytics"]) {
            params.push({
                name: "api.analytics",
                value: fromBoolean(this.config.analytics),
            });
        }
    }
    /**
     * Create a new uapi request.
     *
     * @param init  Optional request objects used to initialize this object.
     */
    constructor(init) {
        super(init);
    }
    /**
     * Generate the interchange object that has the pre-encoded
     * request using UAPI formatting.
     *
     * @param rule Optional parameter to specify a specific Rule we want the Request to be generated for.
     * @return Request information ready to be used by a remoting layer
     */
    generate(rule) {
        // Needed for pure JS clients, since they don't get the compiler checks
        if (!this.namespace) {
            throw new Error("You must define a namespace for the UAPI call before you generate a request");
        }
        if (!this.method) {
            throw new Error("You must define a method for the UAPI call before you generate a request");
        }
        if (!rule) {
            rule = {
                verb: HttpVerb.POST,
                encoder: this.config.json
                    ? new JsonArgumentEncoder()
                    : new WwwFormUrlArgumentEncoder(),
            };
        }
        if (!rule.encoder) {
            rule.encoder = this.config.json
                ? new JsonArgumentEncoder()
                : new WwwFormUrlArgumentEncoder();
        }
        const argumentRule = argumentSerializationRules.getRule(rule.verb);
        const info = {
            headers: new Headers([
                {
                    name: "Content-Type",
                    value: rule.encoder.contentType,
                },
            ]),
            url: ["", "execute", this.namespace, this.method]
                .map(encodeURIComponent)
                .join("/"),
            body: "",
        };
        const params = [];
        this._generateArguments(params);
        this._generateSorts(params);
        this._generateFilters(params);
        this._generatePagination(params);
        this._generateConfiguration(params);
        const encoded = this._build(params, rule.encoder);
        if (argumentRule.dataInBody) {
            info["body"] = encoded;
        }
        else {
            if (rule.verb === HttpVerb.GET) {
                info["url"] += `?${encoded}`;
            }
            else {
                info["url"] += encoded;
            }
        }
        this.headers.forEach((header) => {
            info.headers.push({
                name: header.name,
                value: header.value,
            });
        });
        return info;
    }
}

// MIT License
/**
 * This class will extract the available metadata from the UAPI format into a standard format for JavaScript developers.
 */
class UapiMetaData {
    /**
     * Build a new MetaData object from the metadata response from the server.
     *
     * @param meta UAPI metadata object.
     */
    constructor(meta) {
        /**
         * Indicates if the data is paged.
         */
        this.isPaged = false;
        /**
         * The record number of the first record of a page.
         */
        this.record = 0;
        /**
         * The current page.
         */
        this.page = 0;
        /**
         * The page size of the returned set.
         */
        this.pageSize = 0;
        /**
         * The total number of records available on the backend.
         */
        this.totalRecords = 0;
        /**
         * The total number of pages of records on the backend.
         */
        this.totalPages = 0;
        /**
         * Indicates if the data set if filtered.
         */
        this.isFiltered = false;
        /**
         * Number of records available before the filter was processed.
         */
        this.recordsBeforeFilter = 0;
        /**
         * Indicates the response was the result of a batch API.
         */
        this.batch = false;
        /**
         * A collection of the other less common or custom UAPI metadata properties.
         */
        this.properties = {};
        // Handle pagination
        if (meta.paginate) {
            this.isPaged = true;
            this.record = parseInt(meta.paginate.start_result, 10) || 0;
            this.page = parseInt(meta.paginate.current_page, 10) || 0;
            this.pageSize = parseInt(meta.paginate.results_per_page, 10) || 0;
            this.totalPages = parseInt(meta.paginate.total_pages, 10) || 0;
            this.totalRecords = parseInt(meta.paginate.total_results, 10) || 0;
        }
        // Handle filtering
        if (meta.filter) {
            this.isFiltered = true;
            this.recordsBeforeFilter =
                parseInt(meta.filter.records_before_filter, 10) || 0;
        }
        // Get any other custom metadata properties off the object
        const builtinSet = new Set(["paginate", "filter"]);
        Object.keys(meta)
            .filter((key) => !builtinSet.has(key))
            .forEach((key) => {
            this.properties[key] = meta[key];
        });
    }
}
/**
 * Parser that will convert a UAPI wire-formated object into a standard response object for JavaScript developers.
 */
class UapiResponse extends Response {
    /**
     * Parse out the status from the response.
     *
     * @param  response Raw response object from the backend. Already passed through JSON.parse().
     * @return Number indicating success or failure. > 1 success, 0 failure.
     */
    _parseStatus(response) {
        this.status = 0; // Assume it failed.
        if (typeof response.status === "undefined") {
            throw new Error("The response should have a numeric status property indicating the API succeeded (>0) or failed (=0)");
        }
        this.status = parseInt(response.status, 10);
    }
    /**
     * Parse out the messages from the response.
     *
     * @param response The response object sent by the API method.
     */
    _parseMessages(response) {
        if ("errors" in response) {
            const errors = response.errors;
            if (errors && errors.length) {
                errors.forEach((error) => {
                    this.messages.push({
                        type: MessageType.Error,
                        message: error,
                    });
                });
            }
        }
        if ("messages" in response) {
            const messages = response.messages;
            if (messages) {
                messages.forEach((message) => {
                    this.messages.push({
                        type: MessageType.Information,
                        message: message,
                    });
                });
            }
        }
    }
    /**
     * Parse out the status, data and metadata from a UAPI response into the abstract Response and IMetaData structures.
     *
     * @param response  Raw response from the server. It's just been JSON.parse() at this point.
     * @param Options on how to handle parsing of the response.
     */
    constructor(response, options) {
        super(response, options);
        this._parseStatus(response);
        this._parseMessages(response);
        if (!response || !Object.prototype.hasOwnProperty.call(response, "data")) {
            throw new Error("Expected response to contain a data property, but it is missing");
        }
        // TODO: Add parsing by specific types to take care of renames and type coercion.
        this.data = response.data;
        if (response.metadata) {
            this.meta = new UapiMetaData(response.metadata);
        }
    }
}

/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;

/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeFloor = Math.floor;

/**
 * The base implementation of `_.repeat` which doesn't coerce arguments.
 *
 * @private
 * @param {string} string The string to repeat.
 * @param {number} n The number of times to repeat the string.
 * @returns {string} Returns the repeated string.
 */
function baseRepeat(string, n) {
  var result = '';
  if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
    return result;
  }
  // Leverage the exponentiation by squaring algorithm for a faster repeat.
  // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  do {
    if (n % 2) {
      result += string;
    }
    n = nativeFloor(n / 2);
    if (n) {
      string += string;
    }
  } while (n);

  return result;
}

var _baseRepeat = baseRepeat;

/**
 * The base implementation of `_.slice` without an iteratee call guard.
 *
 * @private
 * @param {Array} array The array to slice.
 * @param {number} [start=0] The start position.
 * @param {number} [end=array.length] The end position.
 * @returns {Array} Returns the slice of `array`.
 */
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 result = Array(length);
  while (++index < length) {
    result[index] = array[index + start];
  }
  return result;
}

var _baseSlice = baseSlice;

/**
 * Casts `array` to a slice if it's needed.
 *
 * @private
 * @param {Array} array The array to inspect.
 * @param {number} start The start position.
 * @param {number} [end=array.length] The end position.
 * @returns {Array} Returns the cast slice.
 */
function castSlice(array, start, end) {
  var length = array.length;
  end = end === undefined ? length : end;
  return (!start && end >= length) ? array : _baseSlice(array, start, end);
}

var _castSlice = castSlice;

/** Used to compose unicode character classes. */
var rsAstralRange$2 = '\\ud800-\\udfff',
    rsComboMarksRange$2 = '\\u0300-\\u036f',
    reComboHalfMarksRange$2 = '\\ufe20-\\ufe2f',
    rsComboSymbolsRange$2 = '\\u20d0-\\u20ff',
    rsComboRange$2 = rsComboMarksRange$2 + reComboHalfMarksRange$2 + rsComboSymbolsRange$2,
    rsVarRange$2 = '\\ufe0e\\ufe0f';

/** Used to compose unicode capture groups. */
var rsZWJ$2 = '\\u200d';

/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
var reHasUnicode = RegExp('[' + rsZWJ$2 + rsAstralRange$2  + rsComboRange$2 + rsVarRange$2 + ']');

/**
 * Checks if `string` contains Unicode symbols.
 *
 * @private
 * @param {string} string The string to inspect.
 * @returns {boolean} Returns `true` if a symbol is found, else `false`.
 */
function hasUnicode(string) {
  return reHasUnicode.test(string);
}

var _hasUnicode = hasUnicode;

/**
 * The base implementation of `_.property` without support for deep paths.
 *
 * @private
 * @param {string} key The key of the property to get.
 * @returns {Function} Returns the new accessor function.
 */
function baseProperty(key) {
  return function(object) {
    return object == null ? undefined : object[key];
  };
}

var _baseProperty = baseProperty;

/**
 * Gets the size of an ASCII `string`.
 *
 * @private
 * @param {string} string The string inspect.
 * @returns {number} Returns the string size.
 */
var asciiSize = _baseProperty('length');

var _asciiSize = asciiSize;

/** Used to compose unicode character classes. */
var rsAstralRange$1 = '\\ud800-\\udfff',
    rsComboMarksRange$1 = '\\u0300-\\u036f',
    reComboHalfMarksRange$1 = '\\ufe20-\\ufe2f',
    rsComboSymbolsRange$1 = '\\u20d0-\\u20ff',
    rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1,
    rsVarRange$1 = '\\ufe0e\\ufe0f';

/** Used to compose unicode capture groups. */
var rsAstral$1 = '[' + rsAstralRange$1 + ']',
    rsCombo$1 = '[' + rsComboRange$1 + ']',
    rsFitz$1 = '\\ud83c[\\udffb-\\udfff]',
    rsModifier$1 = '(?:' + rsCombo$1 + '|' + rsFitz$1 + ')',
    rsNonAstral$1 = '[^' + rsAstralRange$1 + ']',
    rsRegional$1 = '(?:\\ud83c[\\udde6-\\uddff]){2}',
    rsSurrPair$1 = '[\\ud800-\\udbff][\\udc00-\\udfff]',
    rsZWJ$1 = '\\u200d';

/** Used to compose unicode regexes. */
var reOptMod$1 = rsModifier$1 + '?',
    rsOptVar$1 = '[' + rsVarRange$1 + ']?',
    rsOptJoin$1 = '(?:' + rsZWJ$1 + '(?:' + [rsNonAstral$1, rsRegional$1, rsSurrPair$1].join('|') + ')' + rsOptVar$1 + reOptMod$1 + ')*',
    rsSeq$1 = rsOptVar$1 + reOptMod$1 + rsOptJoin$1,
    rsSymbol$1 = '(?:' + [rsNonAstral$1 + rsCombo$1 + '?', rsCombo$1, rsRegional$1, rsSurrPair$1, rsAstral$1].join('|') + ')';

/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
var reUnicode$1 = RegExp(rsFitz$1 + '(?=' + rsFitz$1 + ')|' + rsSymbol$1 + rsSeq$1, 'g');

/**
 * Gets the size of a Unicode `string`.
 *
 * @private
 * @param {string} string The string inspect.
 * @returns {number} Returns the string size.
 */
function unicodeSize(string) {
  var result = reUnicode$1.lastIndex = 0;
  while (reUnicode$1.test(string)) {
    ++result;
  }
  return result;
}

var _unicodeSize = unicodeSize;

/**
 * Gets the number of symbols in `string`.
 *
 * @private
 * @param {string} string The string to inspect.
 * @returns {number} Returns the string size.
 */
function stringSize(string) {
  return _hasUnicode(string)
    ? _unicodeSize(string)
    : _asciiSize(string);
}

var _stringSize = stringSize;

/**
 * Converts an ASCII `string` to an array.
 *
 * @private
 * @param {string} string The string to convert.
 * @returns {Array} Returns the converted array.
 */
function asciiToArray(string) {
  return string.split('');
}

var _asciiToArray = asciiToArray;

/** Used to compose unicode character classes. */
var rsAstralRange = '\\ud800-\\udfff',
    rsComboMarksRange = '\\u0300-\\u036f',
    reComboHalfMarksRange = '\\ufe20-\\ufe2f',
    rsComboSymbolsRange = '\\u20d0-\\u20ff',
    rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
    rsVarRange = '\\ufe0e\\ufe0f';

/** Used to compose unicode capture groups. */
var rsAstral = '[' + rsAstralRange + ']',
    rsCombo = '[' + rsComboRange + ']',
    rsFitz = '\\ud83c[\\udffb-\\udfff]',
    rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
    rsNonAstral = '[^' + rsAstralRange + ']',
    rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
    rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
    rsZWJ = '\\u200d';

/** Used to compose unicode regexes. */
var reOptMod = rsModifier + '?',
    rsOptVar = '[' + rsVarRange + ']?',
    rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
    rsSeq = rsOptVar + reOptMod + rsOptJoin,
    rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';

/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');

/**
 * Converts a Unicode `string` to an array.
 *
 * @private
 * @param {string} string The string to convert.
 * @returns {Array} Returns the converted array.
 */
function unicodeToArray(string) {
  return string.match(reUnicode) || [];
}

var _unicodeToArray = unicodeToArray;

/**
 * Converts `string` to an array.
 *
 * @private
 * @param {string} string The string to convert.
 * @returns {Array} Returns the converted array.
 */
function stringToArray(string) {
  return _hasUnicode(string)
    ? _unicodeToArray(string)
    : _asciiToArray(string);
}

var _stringToArray = stringToArray;

/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeCeil = Math.ceil;

/**
 * Creates the padding for `string` based on `length`. The `chars` string
 * is truncated if the number of characters exceeds `length`.
 *
 * @private
 * @param {number} length The padding length.
 * @param {string} [chars=' '] The string used as padding.
 * @returns {string} Returns the padding for `string`.
 */
function createPadding(length, chars) {
  chars = chars === undefined ? ' ' : _baseToString(chars);

  var charsLength = chars.length;
  if (charsLength < 2) {
    return charsLength ? _baseRepeat(chars, length) : chars;
  }
  var result = _baseRepeat(chars, nativeCeil(length / _stringSize(chars)));
  return _hasUnicode(chars)
    ? _castSlice(_stringToArray(result), 0, length).join('')
    : result.slice(0, length);
}

var _createPadding = createPadding;

/** Used to match a single whitespace character. */
var reWhitespace = /\s/;

/**
 * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
 * character of `string`.
 *
 * @private
 * @param {string} string The string to inspect.
 * @returns {number} Returns the index of the last non-whitespace character.
 */
function trimmedEndIndex(string) {
  var index = string.length;

  while (index-- && reWhitespace.test(string.charAt(index))) {}
  return index;
}

var _trimmedEndIndex = trimmedEndIndex;

/** Used to match leading whitespace. */
var reTrimStart = /^\s+/;

/**
 * The base implementation of `_.trim`.
 *
 * @private
 * @param {string} string The string to trim.
 * @returns {string} Returns the trimmed string.
 */
function baseTrim(string) {
  return string
    ? string.slice(0, _trimmedEndIndex(string) + 1).replace(reTrimStart, '')
    : string;
}

var _baseTrim = baseTrim;

/**
 * Checks if `value` is the
 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
 *
 * @static
 * @memberOf _
 * @since 0.1.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
 * @example
 *
 * _.isObject({});
 * // => true
 *
 * _.isObject([1, 2, 3]);
 * // => true
 *
 * _.isObject(_.noop);
 * // => true
 *
 * _.isObject(null);
 * // => false
 */
function isObject$1(value) {
  var type = typeof value;
  return value != null && (type == 'object' || type == 'function');
}

var isObject_1 = isObject$1;

/** Used as references for various `Number` constants. */
var NAN = 0 / 0;

/** Used to detect bad signed hexadecimal string values. */
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;

/** Used to detect binary string values. */
var reIsBinary = /^0b[01]+$/i;

/** Used to detect octal string values. */
var reIsOctal = /^0o[0-7]+$/i;

/** Built-in method references without a dependency on `root`. */
var freeParseInt = parseInt;

/**
 * Converts `value` to a number.
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to process.
 * @returns {number} Returns the number.
 * @example
 *
 * _.toNumber(3.2);
 * // => 3.2
 *
 * _.toNumber(Number.MIN_VALUE);
 * // => 5e-324
 *
 * _.toNumber(Infinity);
 * // => Infinity
 *
 * _.toNumber('3.2');
 * // => 3.2
 */
function toNumber(value) {
  if (typeof value == 'number') {
    return value;
  }
  if (isSymbol_1(value)) {
    return NAN;
  }
  if (isObject_1(value)) {
    var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
    value = isObject_1(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);
}

var toNumber_1 = toNumber;

/** Used as references for various `Number` constants. */
var INFINITY$1 = 1 / 0,
    MAX_INTEGER = 1.7976931348623157e+308;

/**
 * Converts `value` to a finite number.
 *
 * @static
 * @memberOf _
 * @since 4.12.0
 * @category Lang
 * @param {*} value The value to convert.
 * @returns {number} Returns the converted number.
 * @example
 *
 * _.toFinite(3.2);
 * // => 3.2
 *
 * _.toFinite(Number.MIN_VALUE);
 * // => 5e-324
 *
 * _.toFinite(Infinity);
 * // => 1.7976931348623157e+308
 *
 * _.toFinite('3.2');
 * // => 3.2
 */
function toFinite(value) {
  if (!value) {
    return value === 0 ? value : 0;
  }
  value = toNumber_1(value);
  if (value === INFINITY$1 || value === -INFINITY$1) {
    var sign = (value < 0 ? -1 : 1);
    return sign * MAX_INTEGER;
  }
  return value === value ? value : 0;
}

var toFinite_1 = toFinite;

/**
 * Converts `value` to an integer.
 *
 * **Note:** This method is loosely based on
 * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to convert.
 * @returns {number} Returns the converted integer.
 * @example
 *
 * _.toInteger(3.2);
 * // => 3
 *
 * _.toInteger(Number.MIN_VALUE);
 * // => 0
 *
 * _.toInteger(Infinity);
 * // => 1.7976931348623157e+308
 *
 * _.toInteger('3.2');
 * // => 3
 */
function toInteger(value) {
  var result = toFinite_1(value),
      remainder = result % 1;

  return result === result ? (remainder ? result - remainder : result) : 0;
}

var toInteger_1 = toInteger;

/**
 * Pads `string` on the left side if it's shorter than `length`. Padding
 * characters are truncated if they exceed `length`.
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category String
 * @param {string} [string=''] The string to pad.
 * @param {number} [length=0] The padding length.
 * @param {string} [chars=' '] The string used as padding.
 * @returns {string} Returns the padded string.
 * @example
 *
 * _.padStart('abc', 6);
 * // => '   abc'
 *
 * _.padStart('abc', 6, '_-');
 * // => '_-_abc'
 *
 * _.padStart('abc', 3);
 * // => 'abc'
 */
function padStart(string, length, chars) {
  string = toString_1(string);
  length = toInteger_1(length);

  var strLength = length ? _stringSize(string) : 0;
  return (length && strLength < length)
    ? (_createPadding(length - strLength, chars) + string)
    : string;
}

var padStart_1 = padStart;

// MIT License
/**
 * Type of response format for WHM API 1. The data can be requested to be sent back
 * either in JSON format or XML format.
 */
var WhmApiType;
(function (WhmApiType) {
    /**
     * Json-Api request
     */
    WhmApiType["JsonApi"] = "json-api";
    /**
     * Xml-Api request
     */
    WhmApiType["XmlApi"] = "xml-api";
})(WhmApiType || (WhmApiType = {}));
class WhmApiRequest extends Request$1 {
    /**
     * Create a new UAPI request.
     *
     * @param init Optional request object used to initialize this object.
     */
    constructor(apiType, init) {
        super(init);
        /**
         * The API output format the request should be generated for.
         */
        this.apiType = WhmApiType.JsonApi;
        // Needed for or pure js clients since they don't get the compiler checks
        if (apiType != WhmApiType.JsonApi && apiType != WhmApiType.XmlApi) {
            throw new Error("You must define the API type for the whmapi call before you generate a request.");
        }
        else {
            this.apiType = apiType;
        }
        if (!this.method) {
            throw new Error("You must define a method for the WHM API call before you generate a request");
        }
    }
    /**
     * Add a custom HTTP header to the request
     *
     * @param name Name of a column
     * @return Updated Request object.
     */
    addHeader(header) {
        if (header instanceof CpanelApiTokenHeader) {
            throw new CpanelApiTokenMismatchError("A CpanelApiTokenHeader cannot be used on a WhmApiRequest");
        }
        super.addHeader(header);
        return this;
    }
    /**
     * Build a fragment of the parameter list based on the list of name/value pairs.
     *
     * @param params  Parameters to serialize.
     * @param encoder Encoder to use to serialize the each parameter.
     * @return Fragment with the serialized parameters
     */
    _build(params, encoder) {
        let fragment = "";
        params.forEach((arg, index, array) => {
            const isLast = index === array.length - 1;
            fragment += encoder.encode(arg.name, arg.value, isLast);
        });
        return encoder.separatorStart + fragment + encoder.separatorEnd;
    }
    /**
     * Convert from a number into a string that WHM API 1 will sort
     * in the same order as the numbers; e.g.: 26=>"za", 52=>"zza", ...
     * @method  _make_whm_api_fieldspec_from_number
     * @private
     * @param num Index of sort item
     * @return letter combination for the index of the sort item.
     */
    _make_whm_api_fieldspec_from_number(num) {
        const left = padStart_1("", Math.floor(num / 26), "z");
        return left + "abcdefghijklmnopqrstuvwxyz".charAt(num % 26);
    }
    /**
     * Generates the arguments for the request.
     *
     * @param params List of parameters to adjust based on the sort rules in the Request.
     */
    _generateArguments(params) {
        // For any WHM API call, the API version must be specified as an argument. It is required.
        // Adding it first before everything.
        const apiVersionParam = { name: "api.version", value: 1 };
        params.push(apiVersionParam);
        this.arguments.forEach((argument) => params.push(argument));
    }
    /**
     * Generates the sort parameters for the request.
     *
     * @param params List of parameters to adjust based on the sort rules in the Request.
     */
    _generateSorts(params) {
        this.sorts.forEach((sort, index) => {
            if (index === 0) {
                params.push({ name: "api.sort.enable", value: fromBoolean(true) });
            }
            const sortPrefix = `api.sort.${this._make_whm_api_fieldspec_from_number(index)}`;
            params.push({ name: `${sortPrefix}.field`, value: sort.column });
            params.push({
                name: `${sortPrefix}.reverse`,
                value: fromBoolean(sort.direction !== SortDirection.Ascending),
            });
            params.push({
                name: `${sortPrefix}.method`,
                value: snakeCase_1(SortType[sort.type]),
            });
        });
    }
    /**
     * Look up the correct name for the filter operator
     *
     * @param operator Type of filter operator to use to filter the items
     * @returns The string counter part for the filter operator.
     * @throws Will throw an error if an unrecognized FilterOperator is provided.
     */
    _lookupFilterOperator(operator) {
        switch (operator) {
            case FilterOperator.GreaterThanUnlimited:
                return "gt_handle_unlimited";
            case FilterOperator.GreaterThan:
                return "gt";
            case FilterOperator.LessThanUnlimited:
                return "lt_handle_unlimited";
            case FilterOperator.LessThan:
                return "lt";
            case FilterOperator.Equal:
                return "eq";
            case FilterOperator.Begins:
                return "begins";
            case FilterOperator.Contains:
                return "contains";
            default:
                // eslint-disable-next-line no-case-declarations -- improves readability
                const key = FilterOperator[operator];
                throw new Error(`Unrecoginzed FilterOperator ${key} for WHM API 1`);
        }
    }
    /**
     * Generate the filter parameters, if any.
     *
     * @param params List of parameters to adjust based on the filter rules provided.
     */
    _generateFilters(params) {
        this.filters.forEach((filter, index) => {
            if (index === 0) {
                params.push({
                    name: "api.filter.enable",
                    value: fromBoolean(true),
                });
                params.push({
                    name: "api.filter.verbose",
                    value: fromBoolean(true),
                });
            }
            const filterPrefix = `api.filter.${this._make_whm_api_fieldspec_from_number(index)}`;
            params.push({ name: `${filterPrefix}.field`, value: filter.column });
            params.push({
                name: `${filterPrefix}.type`,
                value: this._lookupFilterOperator(filter.operator),
            });
            params.push({ name: `${filterPrefix}.arg0`, value: filter.value });
        });
    }
    /**
     * In UAPI, we request the starting record, not the starting page. This translates
     * the page and page size into the correct starting record.
     *
     * @param pager Object containing pager settings.
     */
    _translatePageToStart(pager) {
        return (pager.page - 1) * pager.pageSize + 1;
    }
    /**
     * Generate the pager request parameters, if any.
     *
     * @param params List of parameters to adjust based on the pagination rules.
     */
    _generatePagination(params) {
        if (!this.usePager) {
            return;
        }
        const allPages = this.pager.all();
        params.push({ name: "api.chunk.enable", value: fromBoolean(true) });
        params.push({ name: "api.chunk.verbose", value: fromBoolean(true) });
        params.push({
            name: "api.chunk.start",
            value: allPages ? -1 : this._translatePageToStart(this.pager),
        });
        if (!allPages) {
            params.push({
                name: "api.chunk.size",
                value: this.pager.pageSize,
            });
        }
    }
    /**
     * Generate the interchange object that has the pre-encoded
     * request using UAPI formatting.
     *
     * @param rule Optional parameter to specify a specific Rule we want the Request to be generated for.
     * @return {RequestInfo} Request information ready to be used by a remoting layer
     */
    generate(rule) {
        if (!rule) {
            rule = {
                verb: HttpVerb.POST,
                encoder: this.config.json
                    ? new JsonArgumentEncoder()
                    : new WwwFormUrlArgumentEncoder(),
            };
        }
        if (!rule.encoder) {
            rule.encoder = this.config.json
                ? new JsonArgumentEncoder()
                : new WwwFormUrlArgumentEncoder();
        }
        const argumentRule = argumentSerializationRules.getRule(rule.verb);
        const info = {
            headers: new Headers([
                {
                    name: "Content-Type",
                    value: rule.encoder.contentType,
                },
            ]),
            url: ["", this.apiType, this.method].map(encodeURIComponent).join("/"),
            body: "",
        };
        const params = [];
        this._generateArguments(params);
        this._generateSorts(params);
        this._generateFilters(params);
        this._generatePagination(params);
        const encoded = this._build(params, rule.encoder);
        if (argumentRule.dataInBody) {
            info["body"] = encoded;
        }
        else {
            if (rule.verb === HttpVerb.GET) {
                info["url"] += `?${encoded}`;
            }
            else {
                info["url"] += encoded;
            }
        }
        this.headers.forEach((header) => {
            info.headers.push({
                name: header.name,
                value: header.value,
            });
        });
        return info;
    }
}

/**
# cpanel - ui/web-components/src/components/header/cp-header-search/account-access-tweak-setting.enum.ts
#                                                  Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
 */
var AccountAccessTweakSetting;
(function (AccountAccessTweakSetting) {
  AccountAccessTweakSetting["OWNER_ROOT"] = "owner_root";
  AccountAccessTweakSetting["OWNER_ONLY"] = "owner";
  AccountAccessTweakSetting["USER"] = "user";
  // This is here just as a dummy value to set in cPanel,
  // which doesn’t actually need the account-access check logic.
  AccountAccessTweakSetting["NONE"] = "";
})(AccountAccessTweakSetting || (AccountAccessTweakSetting = {}));

/**
# cpanel - ui/web-components/src/components/shared/interfaces/permissions.ts
#                                                  Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
 */
class Permissions {
  constructor(permissions) {
    this.basicWHMFunctions = (permissions === null || permissions === void 0 ? void 0 : permissions.basicWHMFunctions) ? toBoolean(permissions.basicWHMFunctions) : false;
    this.listAccounts = (permissions === null || permissions === void 0 ? void 0 : permissions.listAccounts) ? toBoolean(permissions.listAccounts) : false;
    this.modifyAccount = (permissions === null || permissions === void 0 ? void 0 : permissions.modifyAccount) ? toBoolean(permissions.modifyAccount) : false;
    this.all = (permissions === null || permissions === void 0 ? void 0 : permissions.all) ? toBoolean(permissions.all) : false;
    this.impersonateAccountTweakSettingValue = (permissions === null || permissions === void 0 ? void 0 : permissions.impersonateAccountTweakSettingValue)
      ? permissions.impersonateAccountTweakSettingValue
      : AccountAccessTweakSetting.NONE;
  }
}

/**
# cpanel - ui/web-components/src/components/header/ui-overlay.ts
#                                                  Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
 */
// This is the class that marks the overlay as “shown”.
const CP_OVERLAY_ACTIVE_CLASS = "cp-overlay--cover-content-area";
/**
 * @class
 *
 * This class manages a document overlay element for multiple components.
 * Having a class that manages the overlay prevents one component from
 * “stepping on” another component’s use of the overlay; consider:
 *
 * - Component A shows overlay
 * - Component B shows overlay (no visible change)
 * - Component A hides overlay
 *
 * At this time the overlay is hidden, despite that component B still
 * wants it shown.
 *
 * This module implements logic whereby the overlay is shown if and only
 * if at least 1 caller has “claimed” the overlay.
 */
class UIOverlay {
  /**
   * @constructor
   * @param {overlayEl} - The overlay element
   */
  constructor(overlayEl) {
    this.element = overlayEl;
    this.claims = {};
  }
  /**
   * “Claims” the overlay for the `name`d component. The overlay will
   * be shown if it’s not already.
   *
   * **IMPORTANT:** Nothing prevents two components from giving the
   * same `name`. The integrity of this, though, depends on each
   * caller/component giving a _different_ name.
   */
  claim(name) {
    this.claims[name] = true;
    this.element.classList.add(CP_OVERLAY_ACTIVE_CLASS);
  }
  /**
   * Releases the `name`d component’s “claim” on the overlay.
   * If no “claims” are left, then this hides the overlay.
   */
  release(name) {
    delete this.claims[name];
    if (!Object.keys(this.claims).length) {
      this.element.classList.remove(CP_OVERLAY_ACTIVE_CLASS);
    }
  }
}

/**
# cpanel - ui/web-components/src/utils/store.ts    Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
 */
const { state, dispose } = createStore({
  // directory prefix for cpanel code base
  directoryPrefix: "",
  // cpanel and whm application list
  appList: [],
  mainMenuLinks: [],
  // if the app is cpanel, whm or webmail
  appName: "",
  categoryList: [],
  hostName: "",
  serverEnvironment: "",
  user: "",
  favorites: [],
  /**
   * Display friendly cpanel version.
   */
  version: "",
  /**
   * The full version of cPanel.
   */
  cpanelFullVersion: "",
  plugins: [],
  whmNotifications: [],
  licenseType: "",
  // cPanel users primary domain
  primaryDomain: "",
  permissions: new Permissions(),
  appSearchResultsLimit: 0,
  /**
   * A dummy object, to be replaced at DOMContentLoaded time.
   */
  uiOverlay: new UIOverlay(document.documentElement),
  initialNavUrl: "",
  /**
   * The logo name (cf. Whostmgr::UI::Logos) and its URL path.
   * (MagicRevision is applied.)
   */
  whmLogos: {},
  /**
   * The company id as provided by the cPanel license.
   */
  companyId: "",
  /**
   * The application key
   */
  cpanelAppKey: "",
});

//                                      Copyright 2025 WebPros International, LLC
const locale$v = getLocaleInstance();
class SharedUtilsService {
  /**
   * Constructs a url that can be used by the users of the cPanel interface to give feedback.
   * Returns the url including it's associated data.
   */
  getFeedbackLinkDataForCpanel(cpanelFullVersion, companyId, cpanelAppKey) {
    const url = "https://surveys.webpros.com/to/efKeF6N7", source = "cpanel-feedback";
    return {
      url: `${url}?utm_source=${source}&cpanel_productversion=${cpanelFullVersion}&companyid=${companyId}&cpanel_appkey=${cpanelAppKey}`,
      target: source,
      title: locale$v.maketext("Give Feedback"),
    };
  }
}
const sharedUtils = new SharedUtilsService();

/**
# cpanel - ui/web-components/src/components/footer/footer-links.ts
#                                                  Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
 */
const locale$u = getLocaleInstance();
function getFooterLinks(appName, directoryPrefix, docLink, helpLink) {
  return appName === AppName.Cpanel
    ? getcPanelLinks(directoryPrefix, docLink, helpLink)
    : getWHMLinks(directoryPrefix);
}
function getLogoTitle(appName) {
  return appName === AppName.Cpanel ? locale$u.maketext("cPanel") : locale$u.maketext("WHM");
}
const COMMON_LINKS = [
  {
    id: "lnkFooterPrivacy",
    href: "https://go.cpanel.net/privacy",
    target: "privacyPolicy",
    title: locale$u.maketext("Privacy Policy"),
  },
];
function getcPanelLinks(prefix, docLink, helpLink) {
  const feedbackLinkData = sharedUtils.getFeedbackLinkDataForCpanel(state.cpanelFullVersion, state.companyId, state.cpanelAppKey);
  let links = [
    {
      id: "lnkFooterHome",
      href: prefix + "index.html",
      title: locale$u.maketext("Home"),
      target: "_self",
    },
    {
      id: "lnkFooterTrademark",
      href: prefix + "trademarks.html",
      title: locale$u.maketext("Trademarks"),
      target: "_self",
    },
    ...COMMON_LINKS,
    {
      id: "lnkFooterDocs",
      href: docLink || "https://go.cpanel.net/cpaneldocsHome",
      target: "docs",
      title: locale$u.maketext("Documentation"),
    },
    {
      id: "lnkFooterFeedback",
      href: feedbackLinkData.url,
      target: feedbackLinkData.target,
      title: feedbackLinkData.title,
    },
  ];
  if (helpLink) {
    links.push({
      id: "lnkFooterHelp",
      href: helpLink,
      target: "help",
      title: locale$u.maketext("Help"),
    });
  }
  return links;
}
function getWHMLinks(prefix) {
  return [
    {
      id: "lnkFooterHome",
      href: prefix,
      title: locale$u.maketext("Home"),
      target: "_self",
    },
    {
      id: "lnkFooterTrademark",
      href: `${prefix}/scripts10/trademarks`,
      title: locale$u.maketext("Trademarks"),
      target: "_self",
    },
    ...COMMON_LINKS,
    {
      id: "lnkFooterDocs",
      href: "https://go.cpanel.net/whmdocs",
      target: "docs",
      title: locale$u.maketext("Documentation"),
    },
    {
      id: "lnkFooterFaq",
      href: "https://go.cpanel.net/allfaq",
      target: "support_faq",
      title: locale$u.maketext("[asis,cPanel amp() WHM] FAQ[comment,footer link text]"),
    },
    {
      id: "lnkFooterSupport",
      href: "https://go.cpanel.net/cpforum",
      target: "support_forums",
      title: locale$u.maketext("Support Forums"),
    },
    {
      id: "lnkFootercPUniversity",
      href: "https://university.cpanel.net/",
      target: "cp_university",
      title: locale$u.maketext("[asis,cPanel] University"),
    },
  ];
}

const cpFooterCss = ":root{--cp-font-weight-semi-bold:600}:host{display:block}.footer__version{font-size:0.75rem;color:#1b366f}.footer__logo-section{display:flex;flex-direction:row;align-items:center}[dir=\"ltr\"] .footer__logo-section{padding:0 var(--cp-spacer-3) var(--cp-spacer-2) 0}[dir=\"rtl\"] .footer__logo-section{padding:0 0 var(--cp-spacer-2) var(--cp-spacer-3)}.footer{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap}.footer-links{display:flex;list-style:none;padding:0;flex-wrap:wrap}@media (max-width: 767.98px){.footer-links{flex-wrap:wrap}}.footer-links li{margin-bottom:var(--cp-spacer-2)}@media (max-width: 767.98px){.footer-links li{margin-bottom:var(--cp-spacer-2)}}.footer-links__item{display:inline-block;white-space:nowrap;color:#4259ed;text-decoration:none}[dir=\"ltr\"] .footer-links__item{padding:var(--cp-spacer-2) var(--cp-spacer-3) var(--cp-spacer-2) 0}[dir=\"rtl\"] .footer-links__item{padding:var(--cp-spacer-2) 0 var(--cp-spacer-2) var(--cp-spacer-3)}.footer-links__item:hover,.footer-links__item:active,.footer-links__item:focus{text-decoration:underline;color:#384cc9}";

const CpFooter$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
    /**
     * Source of the logo to be passed into the cp-logo component.
     */
    this.logoSrc = "";
  }
  componentWillLoad() {
    this._appName = state.appName;
    this._directoryPrefix = state.directoryPrefix;
    this._footerLinks = getFooterLinks(this._appName, this._directoryPrefix, this.docLink, this.helpLink);
    this._logoTitle = getLogoTitle(this._appName);
    if (this._appName === AppName.Whm) {
      this.logoSrc = state.whmLogos.WhmDarkLg;
    }
  }
  render() {
    return (h(Host, null, h("cp-style-reset", null, h("cp-dir", null, h("div", { class: "footer" }, h("div", { class: "footer__logo-section" }, h("cp-logo", { id: "cp-logo", class: "footer__logo", "link-target": "_blank", "logo-src": this.logoSrc, "logo-link-href": "https://www.cpanel.net", "logo-id": "imgPoweredByCpanel", "logo-title": this._logoTitle }), h("span", { class: "footer__version", id: "txtCpanelVersion" }, this.version)), h("div", null, h("ul", { class: "footer-links" }, this._footerLinks.map(footerLink => (h("li", null, h("a", { id: footerLink.id, href: footerLink.href, class: "footer-links__item", target: footerLink.target, innerHTML: footerLink.title })))))))))));
  }
  static get style() { return cpFooterCss; }
};

var IconMode;
(function (IconMode) {
  IconMode[IconMode["Inline"] = 0] = "Inline";
  IconMode[IconMode["Centered"] = 1] = "Centered";
})(IconMode || (IconMode = {}));

var IconSize;
(function (IconSize) {
  IconSize["xs"] = "ri-xs";
  IconSize["sm"] = "ri-sm";
  IconSize["lg"] = "ri-lg";
  IconSize["xl"] = "ri-xl";
})(IconSize || (IconSize = {}));

/*
# cpanel - ui/web-components/src/utils/dns-only.ts Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
*/
/**
 * Returns true if it is a DNS only cPanel installation and the app being accessed is WHM.
 */
function isDnsOnly() {
  var _a;
  return ((_a = window["COMMON"]) === null || _a === void 0 ? void 0 : _a.isDnsOnly) && state.appName === AppName.Whm;
}

const cpHeaderCss = ":root{--cp-font-weight-semi-bold:600}:host{display:block;background:#ffffff;height:100%;box-shadow:0 0.125rem 0.25rem rgba(0, 0, 0, 0.075)}.header{height:100%;display:flex;justify-content:flex-end;align-items:center;padding:0 var(--cp-spacer-5)}@media (max-width: 767.98px){.header{justify-content:space-between;padding:0 var(--cp-spacer-4)}}@media (max-width: 575.98px){.header{padding:0 var(--cp-spacer-2)}}.header--with-logo{justify-content:space-between}.header__logo-section{display:none}@media (max-width: 767.98px){.header__logo-section{display:flex;align-items:baseline;padding:var(--cp-spacer-2)}[dir=\"ltr\"] .header__logo-section>*:not(:last-child){margin-right:var(--cp-spacer-3)}[dir=\"rtl\"] .header__logo-section>*:not(:last-child){margin-left:var(--cp-spacer-3)}}.header__logo-section--full-width{display:flex;align-items:baseline}.header__controls,.header__controls--whm{display:flex;width:100%;min-width:315px;justify-content:flex-end}@media (max-width: 575.98px){.header__controls,.header__controls--whm{min-width:140px}}[dir=\"ltr\"] .header__controls>*:not(:last-child),[dir=\"ltr\"] .header__controls--whm>*:not(:last-child){margin-right:var(--cp-spacer-3)}[dir=\"rtl\"] .header__controls>*:not(:last-child),[dir=\"rtl\"] .header__controls--whm>*:not(:last-child){margin-left:var(--cp-spacer-3)}@media (max-width: 575.98px){.header__controls--whm{min-width:175px}}.header-controls__search{max-width:400px}.header-controls__button{border:1px solid var(--cp-primary-color);text-decoration:none;cursor:pointer;color:inherit;background:transparent;height:100%;width:100%;padding:var(--cp-spacer-2);display:flex;align-items:center;justify-content:center;box-sizing:border-box;border-radius:50%}[dir=\"ltr\"] .cp-header__dns-only{margin-left:calc(-1 * var(--cp-spacer-3))}[dir=\"rtl\"] .cp-header__dns-only{margin-right:calc(-1 * var(--cp-spacer-3))}@media (max-width: 575.98px){.hide-on-sm{display:none}[dir=\"ltr\"] .hide-on-sm{margin-right:var(--cp-spacer-0)}[dir=\"rtl\"] .hide-on-sm{margin-left:var(--cp-spacer-0)}}@media (min-width: 576px){.only-show-sm{display:none}}@media (max-width: 767.98px){.hide-on-md{display:none}[dir=\"ltr\"] .hide-on-md{margin-right:var(--cp-spacer-0)}[dir=\"rtl\"] .hide-on-md{margin-left:var(--cp-spacer-0)}}.mobile-search-flex{flex-grow:1;justify-content:flex-start}[dir=\"ltr\"] .mobile-search-flex>*:not(:last-child){margin-right:var(--cp-spacer-0)}[dir=\"rtl\"] .mobile-search-flex>*:not(:last-child){margin-left:var(--cp-spacer-0)}[dir=\"ltr\"] .header__more-controls{text-align:right}[dir=\"rtl\"] .header__more-controls{text-align:left}.header__more-controls .header__whm__load-average__link{text-decoration:none;color:var(--cp-primary-color)}";

const locale$t = getLocaleInstance();
const CpHeader$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
    /**
     * Flags if the header should display the input for searching. Only used in mobile displays
     */
    this.isMobileSearch = false;
    /**
     * base64-encoded SVG or an url
     */
    this.logoSrc = "";
    /**
     * Optional logo description. This is needed because the logo can be custom and the alt
     * text needs to accurately describe the logo displayed.
     * Note: header only displays logo on mobile.
     */
    this.logoAltText = "";
    /**
     * Show the mobile search elements and hide the rest of the header.
     */
    this.showMobileSearch = () => {
      this.isMobileSearch = true;
      this.focusSearch = true;
    };
  }
  componentWillLoad() {
    this._appName = state.appName;
    if (this._appName === AppName.Whm) {
      this.logoSrc = state.whmLogos.WhmDarkLg;
    }
  }
  /**
   * Update the state of the header on mobile, and triggers search input focus, if required.
   */
  toggleMobileSearch() {
    this.isMobileSearch = !this.isMobileSearch;
    if (this.isMobileSearch) {
      this.focusSearch = true;
    }
  }
  /**
   * Clear out the focus trigger when necessary.
   */
  searchInputFocusChange(e) {
    // If the search input is focused, we no longer need to trigger the focus
    if (e.detail.isFocused) {
      this.focusSearch = false;
    }
  }
  /**
   * CSS class to append to a DOM element for mobile search functionality.
   */
  get mobileSearchClass() {
    return this.isMobileSearch ? "hide-on-sm" : "";
  }
  /**
   * CSS classes to append to search control that change based on the viewport.
   */
  get mobileSearchControlClass() {
    return (this.isMobileSearch ? "" : "hide-on-sm") + " mobile-search-flex header-controls__search";
  }
  /**
   * CSS classes for the header control section
   */
  get headerControlClasses() {
    const mobileSearchClass = this.isMobileSearch ? "mobile-search-flex" : "";
    const headerControls = `header__controls${this._appName === AppName.Whm ? "--whm" : ""}`;
    return `${mobileSearchClass} ${headerControls}`;
  }
  /**
   * Get the product specific header body components
   */
  get headerBodyProductComponent() {
    return this._appName === AppName.Cpanel ? (h("cpanel-header", { "is-mobile-search": this.isMobileSearch, "integrations-info": this.integrationsInfo })) : (h("whm-header", { "is-mobile-search": this.isMobileSearch }));
  }
  render() {
    return (h(Host, null, h("cp-style-reset", null, h("cp-dir", null, h("div", { class: "header" }, h("div", { class: this.mobileSearchClass + " header__logo-section" }, h("cp-main-menu-header-control", null)), h("div", { class: this.mobileSearchClass + " header__logo-section" }, h("cp-logo", { "logo-link-href": this._appName === AppName.Whm ? "/" : null, "logo-src": this.logoSrc, "logo-alt-text": this.logoAltText }), isDnsOnly() && h("cp-dns-only", { class: "cp-header__dns-only hide-on-sm" })), h("div", { class: this.headerControlClasses }, h("cp-header-control", { class: this.mobileSearchClass + " only-show-sm header-controls" }, h("button", { id: "search-button", class: "header-controls__button", "aria-label": locale$t.maketext("Search"), onClick: this.showMobileSearch }, h("cp-icon", { name: "search-line", size: IconSize.sm, mode: IconMode.Centered }))), h("cp-header-search-control", { "focus-search": this.focusSearch, "is-mobile-search": this.isMobileSearch, class: this.mobileSearchControlClass }), this.headerBodyProductComponent))))));
  }
  get el() { return this; }
  static get style() { return cpHeaderCss; }
};

const cpHeaderControlCss = ":root{--cp-font-weight-semi-bold:600}:host{display:block;color:var(--cp-body-color);background:var(--cp-primary-action-opacity-10);border-radius:50%;position:relative;min-width:32px;min-height:32px;width:1px;height:1px}:host(:hover),:host(:focus),:host(:active){background:var(--cp-primary-action-opacity-20)}.badge{display:none;width:0.5em;height:0.5em;position:absolute;top:0;border-radius:50%;border:1px solid #ffffff;background:var(--cp-error-border-color)}[dir=\"ltr\"] .badge{right:0}[dir=\"rtl\"] .badge{left:0}.badge.show{display:block}";

const CpHeaderControl$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
    /**
     * Set to true if we need to draw the user's attention
     */
    this.showBadge = false;
  }
  render() {
    return (h(Host, null, h("cp-dir", null, h("slot", null), h("div", { class: this.showBadge ? "badge show" : "badge" }))));
  }
  static get style() { return cpHeaderControlCss; }
};

/**
 * Get the current notification count for the logged in user.
 * @returns A promise that resolves with the number of notifications for the logged in user.
 */
async function fetchNotificationCount() {
  const request = new UapiRequest({
    namespace: "Notifications",
    method: "get_notifications_count",
  }).generate();
  const pathBuilder = new ApplicationPath(new LocationService());
  const fullRequestUrl = pathBuilder.buildTokenPath(request.url);
  return fetch(fullRequestUrl)
    .then(response => response.json())
    .then(response => {
    const resp = new UapiResponse(response);
    if (!resp.status) {
      throw resp.messages.map(message => message.message);
    }
    return resp.data;
  })
    .catch(errors => {
    if (!Array.isArray(errors)) {
      errors = [errors];
    }
    errors.forEach(message => console.warn(`Error loading notifications: ${message}`));
  });
}

const cpHeaderNotificationsControlCss = ":host{display:block}a{border:1px solid var(--cp-primary-color);text-decoration:none;cursor:pointer;color:inherit;background:transparent;height:100%;width:100%;padding:var(--cp-spacer-2);display:flex;align-items:center;justify-content:center;box-sizing:border-box;border-radius:50%}";

const locale$s = getLocaleInstance();
const CpNotificationsHeaderControl = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
    /**
     * Used to determine if the badge appears on the "Notifications" badge
     */
    this.hasNotifications = false;
  }
  componentWillRender() {
    this.directoryPrefix = state.directoryPrefix;
  }
  render() {
    return (h(Host, null, h("cp-dir", null, h("cp-header-control", { "show-badge": this.hasNotifications }, h("a", { id: "notifications-link", href: this.directoryPrefix + "notifications/index.html.tt", "aria-label": locale$s.maketext("Notifications") }, h("cp-icon", { name: "notification-3-line", size: IconSize.sm, mode: IconMode.Centered }))))));
  }
  // We are intentionally not returning the promise or using async/await because
  // either case will trigger Stencil to wait until the promise has resolved before
  // rendering. There is no need to delay component rendering and we will add the
  // badge once the information is available.
  componentWillLoad() {
    fetchNotificationCount().then(notificationCount => (this.hasNotifications = !!notificationCount));
  }
  static get style() { return cpHeaderNotificationsControlCss; }
};

/**
 * Fuse.js v6.6.2 - Lightweight fuzzy-search (http://fusejs.io)
 *
 * Copyright (c) 2022 Kiro Risk (http://kiro.me)
 * All Rights Reserved. Apache Software License 2.0
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 */

function isArray(value) {
  return !Array.isArray
    ? getTag(value) === '[object Array]'
    : Array.isArray(value)
}

// Adapted from: https://github.com/lodash/lodash/blob/master/.internal/baseToString.js
const INFINITY = 1 / 0;
function baseToString(value) {
  // Exit early for strings to avoid a performance hit in some environments.
  if (typeof value == 'string') {
    return value
  }
  let result = value + '';
  return result == '0' && 1 / value == -INFINITY ? '-0' : result
}

function toString$1(value) {
  return value == null ? '' : baseToString(value)
}

function isString(value) {
  return typeof value === 'string'
}

function isNumber(value) {
  return typeof value === 'number'
}

// Adapted from: https://github.com/lodash/lodash/blob/master/isBoolean.js
function isBoolean(value) {
  return (
    value === true ||
    value === false ||
    (isObjectLike(value) && getTag(value) == '[object Boolean]')
  )
}

function isObject(value) {
  return typeof value === 'object'
}

// Checks if `value` is object-like.
function isObjectLike(value) {
  return isObject(value) && value !== null
}

function isDefined(value) {
  return value !== undefined && value !== null
}

function isBlank(value) {
  return !value.trim().length
}

// Gets the `toStringTag` of `value`.
// Adapted from: https://github.com/lodash/lodash/blob/master/.internal/getTag.js
function getTag(value) {
  return value == null
    ? value === undefined
      ? '[object Undefined]'
      : '[object Null]'
    : Object.prototype.toString.call(value)
}

const EXTENDED_SEARCH_UNAVAILABLE = 'Extended search is not available';

const INCORRECT_INDEX_TYPE = "Incorrect 'index' type";

const LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY = (key) =>
  `Invalid value for key ${key}`;

const PATTERN_LENGTH_TOO_LARGE = (max) =>
  `Pattern length exceeds max of ${max}.`;

const MISSING_KEY_PROPERTY = (name) => `Missing ${name} property in key`;

const INVALID_KEY_WEIGHT_VALUE = (key) =>
  `Property 'weight' in key '${key}' must be a positive integer`;

const hasOwn = Object.prototype.hasOwnProperty;

class KeyStore {
  constructor(keys) {
    this._keys = [];
    this._keyMap = {};

    let totalWeight = 0;

    keys.forEach((key) => {
      let obj = createKey(key);

      totalWeight += obj.weight;

      this._keys.push(obj);
      this._keyMap[obj.id] = obj;

      totalWeight += obj.weight;
    });

    // Normalize weights so that their sum is equal to 1
    this._keys.forEach((key) => {
      key.weight /= totalWeight;
    });
  }
  get(keyId) {
    return this._keyMap[keyId]
  }
  keys() {
    return this._keys
  }
  toJSON() {
    return JSON.stringify(this._keys)
  }
}

function createKey(key) {
  let path = null;
  let id = null;
  let src = null;
  let weight = 1;
  let getFn = null;

  if (isString(key) || isArray(key)) {
    src = key;
    path = createKeyPath(key);
    id = createKeyId(key);
  } else {
    if (!hasOwn.call(key, 'name')) {
      throw new Error(MISSING_KEY_PROPERTY('name'))
    }

    const name = key.name;
    src = name;

    if (hasOwn.call(key, 'weight')) {
      weight = key.weight;

      if (weight <= 0) {
        throw new Error(INVALID_KEY_WEIGHT_VALUE(name))
      }
    }

    path = createKeyPath(name);
    id = createKeyId(name);
    getFn = key.getFn;
  }

  return { path, id, weight, src, getFn }
}

function createKeyPath(key) {
  return isArray(key) ? key : key.split('.')
}

function createKeyId(key) {
  return isArray(key) ? key.join('.') : key
}

function get$1(obj, path) {
  let list = [];
  let arr = false;

  const deepGet = (obj, path, index) => {
    if (!isDefined(obj)) {
      return
    }
    if (!path[index]) {
      // If there's no path left, we've arrived at the object we care about.
      list.push(obj);
    } else {
      let key = path[index];

      const value = obj[key];

      if (!isDefined(value)) {
        return
      }

      // If we're at the last value in the path, and if it's a string/number/bool,
      // add it to the list
      if (
        index === path.length - 1 &&
        (isString(value) || isNumber(value) || isBoolean(value))
      ) {
        list.push(toString$1(value));
      } else if (isArray(value)) {
        arr = true;
        // Search each item in the array.
        for (let i = 0, len = value.length; i < len; i += 1) {
          deepGet(value[i], path, index + 1);
        }
      } else if (path.length) {
        // An object. Recurse further.
        deepGet(value, path, index + 1);
      }
    }
  };

  // Backwards compatibility (since path used to be a string)
  deepGet(obj, isString(path) ? path.split('.') : path, 0);

  return arr ? list : list[0]
}

const MatchOptions = {
  // Whether the matches should be included in the result set. When `true`, each record in the result
  // set will include the indices of the matched characters.
  // These can consequently be used for highlighting purposes.
  includeMatches: false,
  // When `true`, the matching function will continue to the end of a search pattern even if
  // a perfect match has already been located in the string.
  findAllMatches: false,
  // Minimum number of characters that must be matched before a result is considered a match
  minMatchCharLength: 1
};

const BasicOptions = {
  // When `true`, the algorithm continues searching to the end of the input even if a perfect
  // match is found before the end of the same input.
  isCaseSensitive: false,
  // When true, the matching function will continue to the end of a search pattern even if
  includeScore: false,
  // List of properties that will be searched. This also supports nested properties.
  keys: [],
  // Whether to sort the result list, by score
  shouldSort: true,
  // Default sort function: sort by ascending score, ascending index
  sortFn: (a, b) =>
    a.score === b.score ? (a.idx < b.idx ? -1 : 1) : a.score < b.score ? -1 : 1
};

const FuzzyOptions = {
  // Approximately where in the text is the pattern expected to be found?
  location: 0,
  // At what point does the match algorithm give up. A threshold of '0.0' requires a perfect match
  // (of both letters and location), a threshold of '1.0' would match anything.
  threshold: 0.6,
  // Determines how close the match must be to the fuzzy location (specified above).
  // An exact letter match which is 'distance' characters away from the fuzzy location
  // would score as a complete mismatch. A distance of '0' requires the match be at
  // the exact location specified, a threshold of '1000' would require a perfect match
  // to be within 800 characters of the fuzzy location to be found using a 0.8 threshold.
  distance: 100
};

const AdvancedOptions = {
  // When `true`, it enables the use of unix-like search commands
  useExtendedSearch: false,
  // The get function to use when fetching an object's properties.
  // The default will search nested paths *ie foo.bar.baz*
  getFn: get$1,
  // When `true`, search will ignore `location` and `distance`, so it won't matter
  // where in the string the pattern appears.
  // More info: https://fusejs.io/concepts/scoring-theory.html#fuzziness-score
  ignoreLocation: false,
  // When `true`, the calculation for the relevance score (used for sorting) will
  // ignore the field-length norm.
  // More info: https://fusejs.io/concepts/scoring-theory.html#field-length-norm
  ignoreFieldNorm: false,
  // The weight to determine how much field length norm effects scoring.
  fieldNormWeight: 1
};

var Config$1 = {
  ...BasicOptions,
  ...MatchOptions,
  ...FuzzyOptions,
  ...AdvancedOptions
};

const SPACE = /[^ ]+/g;

// Field-length norm: the shorter the field, the higher the weight.
// Set to 3 decimals to reduce index size.
function norm(weight = 1, mantissa = 3) {
  const cache = new Map();
  const m = Math.pow(10, mantissa);

  return {
    get(value) {
      const numTokens = value.match(SPACE).length;

      if (cache.has(numTokens)) {
        return cache.get(numTokens)
      }

      // Default function is 1/sqrt(x), weight makes that variable
      const norm = 1 / Math.pow(numTokens, 0.5 * weight);

      // In place of `toFixed(mantissa)`, for faster computation
      const n = parseFloat(Math.round(norm * m) / m);

      cache.set(numTokens, n);

      return n
    },
    clear() {
      cache.clear();
    }
  }
}

class FuseIndex {
  constructor({
    getFn = Config$1.getFn,
    fieldNormWeight = Config$1.fieldNormWeight
  } = {}) {
    this.norm = norm(fieldNormWeight, 3);
    this.getFn = getFn;
    this.isCreated = false;

    this.setIndexRecords();
  }
  setSources(docs = []) {
    this.docs = docs;
  }
  setIndexRecords(records = []) {
    this.records = records;
  }
  setKeys(keys = []) {
    this.keys = keys;
    this._keysMap = {};
    keys.forEach((key, idx) => {
      this._keysMap[key.id] = idx;
    });
  }
  create() {
    if (this.isCreated || !this.docs.length) {
      return
    }

    this.isCreated = true;

    // List is Array<String>
    if (isString(this.docs[0])) {
      this.docs.forEach((doc, docIndex) => {
        this._addString(doc, docIndex);
      });
    } else {
      // List is Array<Object>
      this.docs.forEach((doc, docIndex) => {
        this._addObject(doc, docIndex);
      });
    }

    this.norm.clear();
  }
  // Adds a doc to the end of the index
  add(doc) {
    const idx = this.size();

    if (isString(doc)) {
      this._addString(doc, idx);
    } else {
      this._addObject(doc, idx);
    }
  }
  // Removes the doc at the specified index of the index
  removeAt(idx) {
    this.records.splice(idx, 1);

    // Change ref index of every subsquent doc
    for (let i = idx, len = this.size(); i < len; i += 1) {
      this.records[i].i -= 1;
    }
  }
  getValueForItemAtKeyId(item, keyId) {
    return item[this._keysMap[keyId]]
  }
  size() {
    return this.records.length
  }
  _addString(doc, docIndex) {
    if (!isDefined(doc) || isBlank(doc)) {
      return
    }

    let record = {
      v: doc,
      i: docIndex,
      n: this.norm.get(doc)
    };

    this.records.push(record);
  }
  _addObject(doc, docIndex) {
    let record = { i: docIndex, $: {} };

    // Iterate over every key (i.e, path), and fetch the value at that key
    this.keys.forEach((key, keyIndex) => {
      let value = key.getFn ? key.getFn(doc) : this.getFn(doc, key.path);

      if (!isDefined(value)) {
        return
      }

      if (isArray(value)) {
        let subRecords = [];
        const stack = [{ nestedArrIndex: -1, value }];

        while (stack.length) {
          const { nestedArrIndex, value } = stack.pop();

          if (!isDefined(value)) {
            continue
          }

          if (isString(value) && !isBlank(value)) {
            let subRecord = {
              v: value,
              i: nestedArrIndex,
              n: this.norm.get(value)
            };

            subRecords.push(subRecord);
          } else if (isArray(value)) {
            value.forEach((item, k) => {
              stack.push({
                nestedArrIndex: k,
                value: item
              });
            });
          } else ;
        }
        record.$[keyIndex] = subRecords;
      } else if (isString(value) && !isBlank(value)) {
        let subRecord = {
          v: value,
          n: this.norm.get(value)
        };

        record.$[keyIndex] = subRecord;
      }
    });

    this.records.push(record);
  }
  toJSON() {
    return {
      keys: this.keys,
      records: this.records
    }
  }
}

function createIndex(
  keys,
  docs,
  { getFn = Config$1.getFn, fieldNormWeight = Config$1.fieldNormWeight } = {}
) {
  const myIndex = new FuseIndex({ getFn, fieldNormWeight });
  myIndex.setKeys(keys.map(createKey));
  myIndex.setSources(docs);
  myIndex.create();
  return myIndex
}

function parseIndex(
  data,
  { getFn = Config$1.getFn, fieldNormWeight = Config$1.fieldNormWeight } = {}
) {
  const { keys, records } = data;
  const myIndex = new FuseIndex({ getFn, fieldNormWeight });
  myIndex.setKeys(keys);
  myIndex.setIndexRecords(records);
  return myIndex
}

function computeScore$1(
  pattern,
  {
    errors = 0,
    currentLocation = 0,
    expectedLocation = 0,
    distance = Config$1.distance,
    ignoreLocation = Config$1.ignoreLocation
  } = {}
) {
  const accuracy = errors / pattern.length;

  if (ignoreLocation) {
    return accuracy
  }

  const proximity = Math.abs(expectedLocation - currentLocation);

  if (!distance) {
    // Dodge divide by zero error.
    return proximity ? 1.0 : accuracy
  }

  return accuracy + proximity / distance
}

function convertMaskToIndices(
  matchmask = [],
  minMatchCharLength = Config$1.minMatchCharLength
) {
  let indices = [];
  let start = -1;
  let end = -1;
  let i = 0;

  for (let len = matchmask.length; i < len; i += 1) {
    let match = matchmask[i];
    if (match && start === -1) {
      start = i;
    } else if (!match && start !== -1) {
      end = i - 1;
      if (end - start + 1 >= minMatchCharLength) {
        indices.push([start, end]);
      }
      start = -1;
    }
  }

  // (i-1 - start) + 1 => i - start
  if (matchmask[i - 1] && i - start >= minMatchCharLength) {
    indices.push([start, i - 1]);
  }

  return indices
}

// Machine word size
const MAX_BITS = 32;

function search(
  text,
  pattern,
  patternAlphabet,
  {
    location = Config$1.location,
    distance = Config$1.distance,
    threshold = Config$1.threshold,
    findAllMatches = Config$1.findAllMatches,
    minMatchCharLength = Config$1.minMatchCharLength,
    includeMatches = Config$1.includeMatches,
    ignoreLocation = Config$1.ignoreLocation
  } = {}
) {
  if (pattern.length > MAX_BITS) {
    throw new Error(PATTERN_LENGTH_TOO_LARGE(MAX_BITS))
  }

  const patternLen = pattern.length;
  // Set starting location at beginning text and initialize the alphabet.
  const textLen = text.length;
  // Handle the case when location > text.length
  const expectedLocation = Math.max(0, Math.min(location, textLen));
  // Highest score beyond which we give up.
  let currentThreshold = threshold;
  // Is there a nearby exact match? (speedup)
  let bestLocation = expectedLocation;

  // Performance: only computer matches when the minMatchCharLength > 1
  // OR if `includeMatches` is true.
  const computeMatches = minMatchCharLength > 1 || includeMatches;
  // A mask of the matches, used for building the indices
  const matchMask = computeMatches ? Array(textLen) : [];

  let index;

  // Get all exact matches, here for speed up
  while ((index = text.indexOf(pattern, bestLocation)) > -1) {
    let score = computeScore$1(pattern, {
      currentLocation: index,
      expectedLocation,
      distance,
      ignoreLocation
    });

    currentThreshold = Math.min(score, currentThreshold);
    bestLocation = index + patternLen;

    if (computeMatches) {
      let i = 0;
      while (i < patternLen) {
        matchMask[index + i] = 1;
        i += 1;
      }
    }
  }

  // Reset the best location
  bestLocation = -1;

  let lastBitArr = [];
  let finalScore = 1;
  let binMax = patternLen + textLen;

  const mask = 1 << (patternLen - 1);

  for (let i = 0; i < patternLen; i += 1) {
    // Scan for the best match; each iteration allows for one more error.
    // Run a binary search to determine how far from the match location we can stray
    // at this error level.
    let binMin = 0;
    let binMid = binMax;

    while (binMin < binMid) {
      const score = computeScore$1(pattern, {
        errors: i,
        currentLocation: expectedLocation + binMid,
        expectedLocation,
        distance,
        ignoreLocation
      });

      if (score <= currentThreshold) {
        binMin = binMid;
      } else {
        binMax = binMid;
      }

      binMid = Math.floor((binMax - binMin) / 2 + binMin);
    }

    // Use the result from this iteration as the maximum for the next.
    binMax = binMid;

    let start = Math.max(1, expectedLocation - binMid + 1);
    let finish = findAllMatches
      ? textLen
      : Math.min(expectedLocation + binMid, textLen) + patternLen;

    // Initialize the bit array
    let bitArr = Array(finish + 2);

    bitArr[finish + 1] = (1 << i) - 1;

    for (let j = finish; j >= start; j -= 1) {
      let currentLocation = j - 1;
      let charMatch = patternAlphabet[text.charAt(currentLocation)];

      if (computeMatches) {
        // Speed up: quick bool to int conversion (i.e, `charMatch ? 1 : 0`)
        matchMask[currentLocation] = +!!charMatch;
      }

      // First pass: exact match
      bitArr[j] = ((bitArr[j + 1] << 1) | 1) & charMatch;

      // Subsequent passes: fuzzy match
      if (i) {
        bitArr[j] |=
          ((lastBitArr[j + 1] | lastBitArr[j]) << 1) | 1 | lastBitArr[j + 1];
      }

      if (bitArr[j] & mask) {
        finalScore = computeScore$1(pattern, {
          errors: i,
          currentLocation,
          expectedLocation,
          distance,
          ignoreLocation
        });

        // This match will almost certainly be better than any existing match.
        // But check anyway.
        if (finalScore <= currentThreshold) {
          // Indeed it is
          currentThreshold = finalScore;
          bestLocation = currentLocation;

          // Already passed `loc`, downhill from here on in.
          if (bestLocation <= expectedLocation) {
            break
          }

          // When passing `bestLocation`, don't exceed our current distance from `expectedLocation`.
          start = Math.max(1, 2 * expectedLocation - bestLocation);
        }
      }
    }

    // No hope for a (better) match at greater error levels.
    const score = computeScore$1(pattern, {
      errors: i + 1,
      currentLocation: expectedLocation,
      expectedLocation,
      distance,
      ignoreLocation
    });

    if (score > currentThreshold) {
      break
    }

    lastBitArr = bitArr;
  }

  const result = {
    isMatch: bestLocation >= 0,
    // Count exact matches (those with a score of 0) to be "almost" exact
    score: Math.max(0.001, finalScore)
  };

  if (computeMatches) {
    const indices = convertMaskToIndices(matchMask, minMatchCharLength);
    if (!indices.length) {
      result.isMatch = false;
    } else if (includeMatches) {
      result.indices = indices;
    }
  }

  return result
}

function createPatternAlphabet(pattern) {
  let mask = {};

  for (let i = 0, len = pattern.length; i < len; i += 1) {
    const char = pattern.charAt(i);
    mask[char] = (mask[char] || 0) | (1 << (len - i - 1));
  }

  return mask
}

class BitapSearch {
  constructor(
    pattern,
    {
      location = Config$1.location,
      threshold = Config$1.threshold,
      distance = Config$1.distance,
      includeMatches = Config$1.includeMatches,
      findAllMatches = Config$1.findAllMatches,
      minMatchCharLength = Config$1.minMatchCharLength,
      isCaseSensitive = Config$1.isCaseSensitive,
      ignoreLocation = Config$1.ignoreLocation
    } = {}
  ) {
    this.options = {
      location,
      threshold,
      distance,
      includeMatches,
      findAllMatches,
      minMatchCharLength,
      isCaseSensitive,
      ignoreLocation
    };

    this.pattern = isCaseSensitive ? pattern : pattern.toLowerCase();

    this.chunks = [];

    if (!this.pattern.length) {
      return
    }

    const addChunk = (pattern, startIndex) => {
      this.chunks.push({
        pattern,
        alphabet: createPatternAlphabet(pattern),
        startIndex
      });
    };

    const len = this.pattern.length;

    if (len > MAX_BITS) {
      let i = 0;
      const remainder = len % MAX_BITS;
      const end = len - remainder;

      while (i < end) {
        addChunk(this.pattern.substr(i, MAX_BITS), i);
        i += MAX_BITS;
      }

      if (remainder) {
        const startIndex = len - MAX_BITS;
        addChunk(this.pattern.substr(startIndex), startIndex);
      }
    } else {
      addChunk(this.pattern, 0);
    }
  }

  searchIn(text) {
    const { isCaseSensitive, includeMatches } = this.options;

    if (!isCaseSensitive) {
      text = text.toLowerCase();
    }

    // Exact match
    if (this.pattern === text) {
      let result = {
        isMatch: true,
        score: 0
      };

      if (includeMatches) {
        result.indices = [[0, text.length - 1]];
      }

      return result
    }

    // Otherwise, use Bitap algorithm
    const {
      location,
      distance,
      threshold,
      findAllMatches,
      minMatchCharLength,
      ignoreLocation
    } = this.options;

    let allIndices = [];
    let totalScore = 0;
    let hasMatches = false;

    this.chunks.forEach(({ pattern, alphabet, startIndex }) => {
      const { isMatch, score, indices } = search(text, pattern, alphabet, {
        location: location + startIndex,
        distance,
        threshold,
        findAllMatches,
        minMatchCharLength,
        includeMatches,
        ignoreLocation
      });

      if (isMatch) {
        hasMatches = true;
      }

      totalScore += score;

      if (isMatch && indices) {
        allIndices = [...allIndices, ...indices];
      }
    });

    let result = {
      isMatch: hasMatches,
      score: hasMatches ? totalScore / this.chunks.length : 1
    };

    if (hasMatches && includeMatches) {
      result.indices = allIndices;
    }

    return result
  }
}

class BaseMatch {
  constructor(pattern) {
    this.pattern = pattern;
  }
  static isMultiMatch(pattern) {
    return getMatch(pattern, this.multiRegex)
  }
  static isSingleMatch(pattern) {
    return getMatch(pattern, this.singleRegex)
  }
  search(/*text*/) {}
}

function getMatch(pattern, exp) {
  const matches = pattern.match(exp);
  return matches ? matches[1] : null
}

// Token: 'file

class ExactMatch extends BaseMatch {
  constructor(pattern) {
    super(pattern);
  }
  static get type() {
    return 'exact'
  }
  static get multiRegex() {
    return /^="(.*)"$/
  }
  static get singleRegex() {
    return /^=(.*)$/
  }
  search(text) {
    const isMatch = text === this.pattern;

    return {
      isMatch,
      score: isMatch ? 0 : 1,
      indices: [0, this.pattern.length - 1]
    }
  }
}

// Token: !fire

class InverseExactMatch extends BaseMatch {
  constructor(pattern) {
    super(pattern);
  }
  static get type() {
    return 'inverse-exact'
  }
  static get multiRegex() {
    return /^!"(.*)"$/
  }
  static get singleRegex() {
    return /^!(.*)$/
  }
  search(text) {
    const index = text.indexOf(this.pattern);
    const isMatch = index === -1;

    return {
      isMatch,
      score: isMatch ? 0 : 1,
      indices: [0, text.length - 1]
    }
  }
}

// Token: ^file

class PrefixExactMatch extends BaseMatch {
  constructor(pattern) {
    super(pattern);
  }
  static get type() {
    return 'prefix-exact'
  }
  static get multiRegex() {
    return /^\^"(.*)"$/
  }
  static get singleRegex() {
    return /^\^(.*)$/
  }
  search(text) {
    const isMatch = text.startsWith(this.pattern);

    return {
      isMatch,
      score: isMatch ? 0 : 1,
      indices: [0, this.pattern.length - 1]
    }
  }
}

// Token: !^fire

class InversePrefixExactMatch extends BaseMatch {
  constructor(pattern) {
    super(pattern);
  }
  static get type() {
    return 'inverse-prefix-exact'
  }
  static get multiRegex() {
    return /^!\^"(.*)"$/
  }
  static get singleRegex() {
    return /^!\^(.*)$/
  }
  search(text) {
    const isMatch = !text.startsWith(this.pattern);

    return {
      isMatch,
      score: isMatch ? 0 : 1,
      indices: [0, text.length - 1]
    }
  }
}

// Token: .file$

class SuffixExactMatch extends BaseMatch {
  constructor(pattern) {
    super(pattern);
  }
  static get type() {
    return 'suffix-exact'
  }
  static get multiRegex() {
    return /^"(.*)"\$$/
  }
  static get singleRegex() {
    return /^(.*)\$$/
  }
  search(text) {
    const isMatch = text.endsWith(this.pattern);

    return {
      isMatch,
      score: isMatch ? 0 : 1,
      indices: [text.length - this.pattern.length, text.length - 1]
    }
  }
}

// Token: !.file$

class InverseSuffixExactMatch extends BaseMatch {
  constructor(pattern) {
    super(pattern);
  }
  static get type() {
    return 'inverse-suffix-exact'
  }
  static get multiRegex() {
    return /^!"(.*)"\$$/
  }
  static get singleRegex() {
    return /^!(.*)\$$/
  }
  search(text) {
    const isMatch = !text.endsWith(this.pattern);
    return {
      isMatch,
      score: isMatch ? 0 : 1,
      indices: [0, text.length - 1]
    }
  }
}

class FuzzyMatch extends BaseMatch {
  constructor(
    pattern,
    {
      location = Config$1.location,
      threshold = Config$1.threshold,
      distance = Config$1.distance,
      includeMatches = Config$1.includeMatches,
      findAllMatches = Config$1.findAllMatches,
      minMatchCharLength = Config$1.minMatchCharLength,
      isCaseSensitive = Config$1.isCaseSensitive,
      ignoreLocation = Config$1.ignoreLocation
    } = {}
  ) {
    super(pattern);
    this._bitapSearch = new BitapSearch(pattern, {
      location,
      threshold,
      distance,
      includeMatches,
      findAllMatches,
      minMatchCharLength,
      isCaseSensitive,
      ignoreLocation
    });
  }
  static get type() {
    return 'fuzzy'
  }
  static get multiRegex() {
    return /^"(.*)"$/
  }
  static get singleRegex() {
    return /^(.*)$/
  }
  search(text) {
    return this._bitapSearch.searchIn(text)
  }
}

// Token: 'file

class IncludeMatch extends BaseMatch {
  constructor(pattern) {
    super(pattern);
  }
  static get type() {
    return 'include'
  }
  static get multiRegex() {
    return /^'"(.*)"$/
  }
  static get singleRegex() {
    return /^'(.*)$/
  }
  search(text) {
    let location = 0;
    let index;

    const indices = [];
    const patternLen = this.pattern.length;

    // Get all exact matches
    while ((index = text.indexOf(this.pattern, location)) > -1) {
      location = index + patternLen;
      indices.push([index, location - 1]);
    }

    const isMatch = !!indices.length;

    return {
      isMatch,
      score: isMatch ? 0 : 1,
      indices
    }
  }
}

// ❗Order is important. DO NOT CHANGE.
const searchers = [
  ExactMatch,
  IncludeMatch,
  PrefixExactMatch,
  InversePrefixExactMatch,
  InverseSuffixExactMatch,
  SuffixExactMatch,
  InverseExactMatch,
  FuzzyMatch
];

const searchersLen = searchers.length;

// Regex to split by spaces, but keep anything in quotes together
const SPACE_RE = / +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/;
const OR_TOKEN = '|';

// Return a 2D array representation of the query, for simpler parsing.
// Example:
// "^core go$ | rb$ | py$ xy$" => [["^core", "go$"], ["rb$"], ["py$", "xy$"]]
function parseQuery(pattern, options = {}) {
  return pattern.split(OR_TOKEN).map((item) => {
    let query = item
      .trim()
      .split(SPACE_RE)
      .filter((item) => item && !!item.trim());

    let results = [];
    for (let i = 0, len = query.length; i < len; i += 1) {
      const queryItem = query[i];

      // 1. Handle multiple query match (i.e, once that are quoted, like `"hello world"`)
      let found = false;
      let idx = -1;
      while (!found && ++idx < searchersLen) {
        const searcher = searchers[idx];
        let token = searcher.isMultiMatch(queryItem);
        if (token) {
          results.push(new searcher(token, options));
          found = true;
        }
      }

      if (found) {
        continue
      }

      // 2. Handle single query matches (i.e, once that are *not* quoted)
      idx = -1;
      while (++idx < searchersLen) {
        const searcher = searchers[idx];
        let token = searcher.isSingleMatch(queryItem);
        if (token) {
          results.push(new searcher(token, options));
          break
        }
      }
    }

    return results
  })
}

// These extended matchers can return an array of matches, as opposed
// to a singl match
const MultiMatchSet = new Set([FuzzyMatch.type, IncludeMatch.type]);

/**
 * Command-like searching
 * ======================
 *
 * Given multiple search terms delimited by spaces.e.g. `^jscript .python$ ruby !java`,
 * search in a given text.
 *
 * Search syntax:
 *
 * | Token       | Match type                 | Description                            |
 * | ----------- | -------------------------- | -------------------------------------- |
 * | `jscript`   | fuzzy-match                | Items that fuzzy match `jscript`       |
 * | `=scheme`   | exact-match                | Items that are `scheme`                |
 * | `'python`   | include-match              | Items that include `python`            |
 * | `!ruby`     | inverse-exact-match        | Items that do not include `ruby`       |
 * | `^java`     | prefix-exact-match         | Items that start with `java`           |
 * | `!^earlang` | inverse-prefix-exact-match | Items that do not start with `earlang` |
 * | `.js$`      | suffix-exact-match         | Items that end with `.js`              |
 * | `!.go$`     | inverse-suffix-exact-match | Items that do not end with `.go`       |
 *
 * A single pipe character acts as an OR operator. For example, the following
 * query matches entries that start with `core` and end with either`go`, `rb`,
 * or`py`.
 *
 * ```
 * ^core go$ | rb$ | py$
 * ```
 */
class ExtendedSearch {
  constructor(
    pattern,
    {
      isCaseSensitive = Config$1.isCaseSensitive,
      includeMatches = Config$1.includeMatches,
      minMatchCharLength = Config$1.minMatchCharLength,
      ignoreLocation = Config$1.ignoreLocation,
      findAllMatches = Config$1.findAllMatches,
      location = Config$1.location,
      threshold = Config$1.threshold,
      distance = Config$1.distance
    } = {}
  ) {
    this.query = null;
    this.options = {
      isCaseSensitive,
      includeMatches,
      minMatchCharLength,
      findAllMatches,
      ignoreLocation,
      location,
      threshold,
      distance
    };

    this.pattern = isCaseSensitive ? pattern : pattern.toLowerCase();
    this.query = parseQuery(this.pattern, this.options);
  }

  static condition(_, options) {
    return options.useExtendedSearch
  }

  searchIn(text) {
    const query = this.query;

    if (!query) {
      return {
        isMatch: false,
        score: 1
      }
    }

    const { includeMatches, isCaseSensitive } = this.options;

    text = isCaseSensitive ? text : text.toLowerCase();

    let numMatches = 0;
    let allIndices = [];
    let totalScore = 0;

    // ORs
    for (let i = 0, qLen = query.length; i < qLen; i += 1) {
      const searchers = query[i];

      // Reset indices
      allIndices.length = 0;
      numMatches = 0;

      // ANDs
      for (let j = 0, pLen = searchers.length; j < pLen; j += 1) {
        const searcher = searchers[j];
        const { isMatch, indices, score } = searcher.search(text);

        if (isMatch) {
          numMatches += 1;
          totalScore += score;
          if (includeMatches) {
            const type = searcher.constructor.type;
            if (MultiMatchSet.has(type)) {
              allIndices = [...allIndices, ...indices];
            } else {
              allIndices.push(indices);
            }
          }
        } else {
          totalScore = 0;
          numMatches = 0;
          allIndices.length = 0;
          break
        }
      }

      // OR condition, so if TRUE, return
      if (numMatches) {
        let result = {
          isMatch: true,
          score: totalScore / numMatches
        };

        if (includeMatches) {
          result.indices = allIndices;
        }

        return result
      }
    }

    // Nothing was matched
    return {
      isMatch: false,
      score: 1
    }
  }
}

const registeredSearchers = [];

function register(...args) {
  registeredSearchers.push(...args);
}

function createSearcher(pattern, options) {
  for (let i = 0, len = registeredSearchers.length; i < len; i += 1) {
    let searcherClass = registeredSearchers[i];
    if (searcherClass.condition(pattern, options)) {
      return new searcherClass(pattern, options)
    }
  }

  return new BitapSearch(pattern, options)
}

const LogicalOperator = {
  AND: '$and',
  OR: '$or'
};

const KeyType = {
  PATH: '$path',
  PATTERN: '$val'
};

const isExpression = (query) =>
  !!(query[LogicalOperator.AND] || query[LogicalOperator.OR]);

const isPath = (query) => !!query[KeyType.PATH];

const isLeaf = (query) =>
  !isArray(query) && isObject(query) && !isExpression(query);

const convertToExplicit = (query) => ({
  [LogicalOperator.AND]: Object.keys(query).map((key) => ({
    [key]: query[key]
  }))
});

// When `auto` is `true`, the parse function will infer and initialize and add
// the appropriate `Searcher` instance
function parse(query, options, { auto = true } = {}) {
  const next = (query) => {
    let keys = Object.keys(query);

    const isQueryPath = isPath(query);

    if (!isQueryPath && keys.length > 1 && !isExpression(query)) {
      return next(convertToExplicit(query))
    }

    if (isLeaf(query)) {
      const key = isQueryPath ? query[KeyType.PATH] : keys[0];

      const pattern = isQueryPath ? query[KeyType.PATTERN] : query[key];

      if (!isString(pattern)) {
        throw new Error(LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY(key))
      }

      const obj = {
        keyId: createKeyId(key),
        pattern
      };

      if (auto) {
        obj.searcher = createSearcher(pattern, options);
      }

      return obj
    }

    let node = {
      children: [],
      operator: keys[0]
    };

    keys.forEach((key) => {
      const value = query[key];

      if (isArray(value)) {
        value.forEach((item) => {
          node.children.push(next(item));
        });
      }
    });

    return node
  };

  if (!isExpression(query)) {
    query = convertToExplicit(query);
  }

  return next(query)
}

// Practical scoring function
function computeScore(
  results,
  { ignoreFieldNorm = Config$1.ignoreFieldNorm }
) {
  results.forEach((result) => {
    let totalScore = 1;

    result.matches.forEach(({ key, norm, score }) => {
      const weight = key ? key.weight : null;

      totalScore *= Math.pow(
        score === 0 && weight ? Number.EPSILON : score,
        (weight || 1) * (ignoreFieldNorm ? 1 : norm)
      );
    });

    result.score = totalScore;
  });
}

function transformMatches(result, data) {
  const matches = result.matches;
  data.matches = [];

  if (!isDefined(matches)) {
    return
  }

  matches.forEach((match) => {
    if (!isDefined(match.indices) || !match.indices.length) {
      return
    }

    const { indices, value } = match;

    let obj = {
      indices,
      value
    };

    if (match.key) {
      obj.key = match.key.src;
    }

    if (match.idx > -1) {
      obj.refIndex = match.idx;
    }

    data.matches.push(obj);
  });
}

function transformScore(result, data) {
  data.score = result.score;
}

function format(
  results,
  docs,
  {
    includeMatches = Config$1.includeMatches,
    includeScore = Config$1.includeScore
  } = {}
) {
  const transformers = [];

  if (includeMatches) transformers.push(transformMatches);
  if (includeScore) transformers.push(transformScore);

  return results.map((result) => {
    const { idx } = result;

    const data = {
      item: docs[idx],
      refIndex: idx
    };

    if (transformers.length) {
      transformers.forEach((transformer) => {
        transformer(result, data);
      });
    }

    return data
  })
}

class Fuse {
  constructor(docs, options = {}, index) {
    this.options = { ...Config$1, ...options };

    if (
      this.options.useExtendedSearch &&
      !true
    ) {
      throw new Error(EXTENDED_SEARCH_UNAVAILABLE)
    }

    this._keyStore = new KeyStore(this.options.keys);

    this.setCollection(docs, index);
  }

  setCollection(docs, index) {
    this._docs = docs;

    if (index && !(index instanceof FuseIndex)) {
      throw new Error(INCORRECT_INDEX_TYPE)
    }

    this._myIndex =
      index ||
      createIndex(this.options.keys, this._docs, {
        getFn: this.options.getFn,
        fieldNormWeight: this.options.fieldNormWeight
      });
  }

  add(doc) {
    if (!isDefined(doc)) {
      return
    }

    this._docs.push(doc);
    this._myIndex.add(doc);
  }

  remove(predicate = (/* doc, idx */) => false) {
    const results = [];

    for (let i = 0, len = this._docs.length; i < len; i += 1) {
      const doc = this._docs[i];
      if (predicate(doc, i)) {
        this.removeAt(i);
        i -= 1;
        len -= 1;

        results.push(doc);
      }
    }

    return results
  }

  removeAt(idx) {
    this._docs.splice(idx, 1);
    this._myIndex.removeAt(idx);
  }

  getIndex() {
    return this._myIndex
  }

  search(query, { limit = -1 } = {}) {
    const {
      includeMatches,
      includeScore,
      shouldSort,
      sortFn,
      ignoreFieldNorm
    } = this.options;

    let results = isString(query)
      ? isString(this._docs[0])
        ? this._searchStringList(query)
        : this._searchObjectList(query)
      : this._searchLogical(query);

    computeScore(results, { ignoreFieldNorm });

    if (shouldSort) {
      results.sort(sortFn);
    }

    if (isNumber(limit) && limit > -1) {
      results = results.slice(0, limit);
    }

    return format(results, this._docs, {
      includeMatches,
      includeScore
    })
  }

  _searchStringList(query) {
    const searcher = createSearcher(query, this.options);
    const { records } = this._myIndex;
    const results = [];

    // Iterate over every string in the index
    records.forEach(({ v: text, i: idx, n: norm }) => {
      if (!isDefined(text)) {
        return
      }

      const { isMatch, score, indices } = searcher.searchIn(text);

      if (isMatch) {
        results.push({
          item: text,
          idx,
          matches: [{ score, value: text, norm, indices }]
        });
      }
    });

    return results
  }

  _searchLogical(query) {

    const expression = parse(query, this.options);

    const evaluate = (node, item, idx) => {
      if (!node.children) {
        const { keyId, searcher } = node;

        const matches = this._findMatches({
          key: this._keyStore.get(keyId),
          value: this._myIndex.getValueForItemAtKeyId(item, keyId),
          searcher
        });

        if (matches && matches.length) {
          return [
            {
              idx,
              item,
              matches
            }
          ]
        }

        return []
      }

      const res = [];
      for (let i = 0, len = node.children.length; i < len; i += 1) {
        const child = node.children[i];
        const result = evaluate(child, item, idx);
        if (result.length) {
          res.push(...result);
        } else if (node.operator === LogicalOperator.AND) {
          return []
        }
      }
      return res
    };

    const records = this._myIndex.records;
    const resultMap = {};
    const results = [];

    records.forEach(({ $: item, i: idx }) => {
      if (isDefined(item)) {
        let expResults = evaluate(expression, item, idx);

        if (expResults.length) {
          // Dedupe when adding
          if (!resultMap[idx]) {
            resultMap[idx] = { idx, item, matches: [] };
            results.push(resultMap[idx]);
          }
          expResults.forEach(({ matches }) => {
            resultMap[idx].matches.push(...matches);
          });
        }
      }
    });

    return results
  }

  _searchObjectList(query) {
    const searcher = createSearcher(query, this.options);
    const { keys, records } = this._myIndex;
    const results = [];

    // List is Array<Object>
    records.forEach(({ $: item, i: idx }) => {
      if (!isDefined(item)) {
        return
      }

      let matches = [];

      // Iterate over every key (i.e, path), and fetch the value at that key
      keys.forEach((key, keyIndex) => {
        matches.push(
          ...this._findMatches({
            key,
            value: item[keyIndex],
            searcher
          })
        );
      });

      if (matches.length) {
        results.push({
          idx,
          item,
          matches
        });
      }
    });

    return results
  }
  _findMatches({ key, value, searcher }) {
    if (!isDefined(value)) {
      return []
    }

    let matches = [];

    if (isArray(value)) {
      value.forEach(({ v: text, i: idx, n: norm }) => {
        if (!isDefined(text)) {
          return
        }

        const { isMatch, score, indices } = searcher.searchIn(text);

        if (isMatch) {
          matches.push({
            score,
            key,
            value: text,
            idx,
            norm,
            indices
          });
        }
      });
    } else {
      const { v: text, n: norm } = value;

      const { isMatch, score, indices } = searcher.searchIn(text);

      if (isMatch) {
        matches.push({ score, key, value: text, norm, indices });
      }
    }

    return matches
  }
}

Fuse.version = '6.6.2';
Fuse.createIndex = createIndex;
Fuse.parseIndex = parseIndex;
Fuse.config = Config$1;

{
  Fuse.parseQuery = parse;
}

{
  register(ExtendedSearch);
}

/* NOTE: tabindex attribute is required for Safari otherwise
    the links do not work and clicking one dismisses the dropdown. */
const toolSearchResult = (appEntry, index, directoryPrefix) => (h("li", null,
  h("a", { role: "row", class: "list-group-item list-group-item-action tool-result__container", href: appEntry.url_is_absolute ? appEntry.url : directoryPrefix + appEntry.url, target: appEntry.target, tabindex: "-1" },
    h("div", { id: "app-result" + index + "x0", role: "gridcell", class: "tool-result__main" },
      h("span", { class: "tool-result__heading", innerHTML: appEntry.name }),
      h("p", { class: "tool-result__description" }, appEntry.description)),
    h("p", { class: "tool-result__category" },
      h("span", { id: "app-result" + index + "x1", role: "gridcell" }, appEntry.category)))));

/* NOTE: tabindex attribute is required for Safari otherwise
the links do not work and clicking one dismisses the dropdown. */
const accountSearchResult = (account, cpSecurityToken, permissions, whmUser) => {
  let canWhmUserAccessAccount = false;
  if (whmUser) {
    if ((permissions === null || permissions === void 0 ? void 0 : permissions.impersonateAccountTweakSettingValue) === "owner_root" &&
      (whmUser === "root" || whmUser === account.owner)) {
      canWhmUserAccessAccount = true;
    }
    else if ((permissions === null || permissions === void 0 ? void 0 : permissions.impersonateAccountTweakSettingValue) === "owner" && whmUser === account.owner) {
      canWhmUserAccessAccount = true;
    }
  }
  return (h("li", { role: "row", class: "list-group-item account-result__container" },
    h("div", { class: "account-result__main_section" },
      h("p", { class: "account-result__username" }, account.user),
      h("a", { tabindex: "0", class: "account-result__domain", target: "_blank", href: "https://" + account.domain }, account.domain)),
    h("div", { class: "account-result__action-section" },
      (permissions === null || permissions === void 0 ? void 0 : permissions.modifyAccount) && (h("form", { tabindex: "-1", class: "text-center", method: "GET", action: cpSecurityToken + "/scripts/edituser" },
        h("input", { type: "hidden", name: "user", value: account.user }),
        h("input", { type: "hidden", name: "domain", value: account.domain }),
        h("button", { tabindex: "0", id: "account-result__modify-" + account.user, class: "button--rounded", role: "gridcell" },
          h("cp-icon", { class: "button__pencil-icon", name: "pencil-fill", size: IconSize.xl, mode: IconMode.Centered })))),
      canWhmUserAccessAccount && (h("form", { tabindex: "-1", class: "text-center", method: "POST", target: "_blank", action: "/xfercpanel" },
        h("input", { type: "hidden", name: "token", value: cpSecurityToken.replace(/\/+$/, "") }),
        h("input", { type: "hidden", name: "user", value: account.user }),
        h("button", { tabindex: "0", id: "account-result__impersonate" + account.user, type: "submit", class: "button--rounded button__image-container", role: "gridcell" },
          h("img", { class: "button__image", src: getAssetPath("./assets/cp-logo.svg"), alt: "cpanel logo" })))))));
};

/**
# cpanel - ui/web-components/src/components/header/cp-header-search/fuzzy-search.config.ts
#                                                  Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
 */
const SEARCH_OPTIONS = {
  keys: [
    {
      name: "name",
      weight: 3,
    },
    {
      name: "searchText",
      weight: 3,
    },
    {
      name: "category",
      weight: 1,
    },
    {
      name: "description",
      weight: 1,
    },
  ],
  includeMatches: true,
};
const WHM_MAIN_MENU_SEARCH_OPTIONS = Object.assign(Object.assign({}, SEARCH_OPTIONS), { 
  // Reduce threshold to tighten up the search relevance. This helps in reducing the number of
  // non-relevant matches.
  threshold: 0.3 });

/**
# cpanel - ui/web-components/src/components/shared/services/whm/list-accounts.service.ts
#                                                  Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
 */
const LIST_ACCOUNTS_FN = "listaccts";
const DEFAULT_MAX_RESULTS = 5;
const SEARCH_ARGUMENT_NAME = "search";
const LIST_ACCOUNTS_PATH = "scripts4/listaccts";
const WANT_ARGUMENT = new Argument("want", "user,domain,owner");
const SEARCH_TYPE_ARGUMENT = new Argument("searchtype", "domain_and_user");
/**
 * Can be used to fetch Account data and generate a path to the list account page.
 */
const ListAccountsService = {
  /**
   * Fetches the accounts for the search value provided.
   */
  getAccounts(searchValue, resultsToDisplayCount = DEFAULT_MAX_RESULTS) {
    const pager = new Pager(1, resultsToDisplayCount);
    const request = new WhmApiRequest(WhmApiType.JsonApi, {
      method: LIST_ACCOUNTS_FN,
      arguments: [SEARCH_TYPE_ARGUMENT, WANT_ARGUMENT, new Argument(SEARCH_ARGUMENT_NAME, searchValue)],
      pager,
    });
    const requestInfo = request.generate({
      verb: HttpVerb.GET,
      encoder: new WwwFormUrlArgumentEncoder(),
    });
    const pathBuilder = new ApplicationPath(new LocationService());
    const requestUrl = pathBuilder.buildTokenPath(requestInfo.url);
    let resultP = fetch(requestUrl)
      .then(response => response.json())
      .then(data => {
      var _a, _b, _c;
      if (!data.metadata.result) {
        throw data.metadata.reason;
      }
      let accounts = (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.acct.map(a => {
        return Object.assign(Object.assign({}, a), { name: a.user });
      });
      return {
        accounts: accounts || [],
        records: (_c = (_b = data === null || data === void 0 ? void 0 : data.metadata) === null || _b === void 0 ? void 0 : _b.chunk) === null || _c === void 0 ? void 0 : _c.records,
      };
    });
    resultP.catch(console.error);
    return resultP;
  },
  /**
   * The link to the list accounts page with the user's query preselected.
   */
  getRelativePathToListAccountsPage(searchValue) {
    const pathBuilder = new ApplicationPath(new LocationService());
    const searchParams = new URLSearchParams({
      [SEARCH_ARGUMENT_NAME]: searchValue,
      [SEARCH_TYPE_ARGUMENT.name]: SEARCH_TYPE_ARGUMENT.value,
    }).toString();
    return `${pathBuilder.securityToken}/${LIST_ACCOUNTS_PATH}?${searchParams}`;
  },
};

/**
# cpanel - ui/web-components/src/components/shared/classes/combobox.ts
#                                                  Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
 */
class Combobox {
  constructor(el) {
    this.el = el;
  }
  get elements() {
    return Array.from(this.el.querySelectorAll("[role=row], [role=gridcell]"));
  }
  get activeElementId() {
    return this.el.getAttribute("aria-activedecendant");
  }
  get currentIndex() {
    return this.elements.findIndex(el => el.id == this.activeElementId);
  }
  get currentRow() {
    if (!this.currentGridcell) {
      return;
    }
    return this.previous(is_row);
  }
  render() {
    var _a, _b;
    (_a = this.currentGridcell) === null || _a === void 0 ? void 0 : _a.classList.add("active");
    (_b = this.currentRow) === null || _b === void 0 ? void 0 : _b.classList.add("active");
  }
  clearActive() {
    var _a, _b;
    (_a = this.currentGridcell) === null || _a === void 0 ? void 0 : _a.classList.remove("active");
    (_b = this.currentRow) === null || _b === void 0 ? void 0 : _b.classList.remove("active");
  }
  /**
   * Sets the element as the focused element for the grid popup
   * and updates the DOM to reflect the changes. If the element has
   * a role of row, it will search for the first gridcell and set that
   * as the focused element.
   * @param element HTMLElement
   */
  goTo(element) {
    this.clearActive();
    if (!element) {
      this.el.removeAttribute("aria-activedecendant");
    }
    if (is_row(element)) {
      const gridcell = element.querySelector("[role=gridcell]");
      this.el.setAttribute("aria-activedecendant", gridcell.id);
    }
    if (is_gridcell(element)) {
      this.el.setAttribute("aria-activedecendant", element.id);
    }
    this.render();
  }
  /**
   * returns the currently focused gridcell
   * or undefined if you havent specified a row or gridcell
   * with the goTo function
   * @returns HTMLElement | undefined
   */
  get currentGridcell() {
    return this.elements.find(el => el.id == this.activeElementId);
  }
  next(predicate) {
    const element = this.elements.slice(this.currentIndex + 1).find(predicate);
    if (element) {
      return element;
    }
    return this.elements.find(predicate);
  }
  previous(predicate) {
    const element = this.elements.slice(0, this.currentIndex).reverse().find(predicate);
    if (element) {
      return element;
    }
    return this.elements.reverse().find(predicate);
  }
  /**
   * return the next gridcell element of the grid popup
   * based on the currently focused gridcell.
   * If the currenlty focused gridcell is the last one, it then
   * returns the first one.
   * @returns HTMLElement
   */
  get nextGridcell() {
    return this.next(is_gridcell);
  }
  /**
   * return the previous gridcell element of the grid popup
   * based on the currently focused gridcell.
   * If the currenlty focused gridcell is the first one, it then
   * returns the last one.
   * @returns HTMLElement
   */
  get previousGridcell() {
    return this.previous(is_gridcell);
  }
  /**
   * return the next row element of the grid popup
   * based on the currently focused gridcell.
   * If the currenlty focused row is the first one, it then
   * returns the last one.
   * @returns HTMLElement
   */
  get nextRow() {
    return this.next(is_row);
  }
  /**
   * return the previous row element of the grid popup
   * based on the currently focused gridcell.
   * If the currenlty focused row is the last one, it then
   * returns the first one.
   * @returns HTMLElement
   */
  get previousRow() {
    return this.previous(e => is_row(e) && this.currentRow != e);
  }
  /**
   * return the first element of the grid popup, usually
   * an element with a role of 'row'
   * @returns HTMLElement
   */
  get firstElement() {
    return this.elements[0];
  }
}
/**
 * Checks whether the element passed contains the
 * attribute role set to 'row'
 * @param element HTMLElement
 * @returns boolean
 */
function is_row(element) {
  return (element === null || element === void 0 ? void 0 : element.getAttribute("role")) == "row";
}
/**
 * Checks whether the element passed contains the
 * attribute role set to 'gridcell'
 * @param element HTMLElement
 * @returns boolean
 */
function is_gridcell(element) {
  return (element === null || element === void 0 ? void 0 : element.getAttribute("role")) == "gridcell";
}

/**
# cpanel - ui/web-components/src/utils/dom-utils.ts
#                                                  Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
 */
/**
 * A recursive funtion that will return the internal element that has focus, even if it's inside a shadow root.
 *
 * Note: Due to how active element is retargeted in shadow DOM, it becomes difficult to access the actual element that is focussed at any instant.
 * So we had to use the recursive function to traverse through the element DOM to find the right one.
 * Reference URL: https://www.abeautifulsite.net/posts/finding-the-active-element-in-a-shadow-root/
 */
function getActiveElement(root = document) {
  const activeEl = root.activeElement;
  if (!activeEl) {
    return null;
  }
  if (activeEl.shadowRoot) {
    return getActiveElement(activeEl.shadowRoot);
  }
  else {
    return activeEl;
  }
}

const cpHeaderSearchCss = "@charset \"UTF-8\";:root{--cp-font-weight-semi-bold:600}:root{--cp-font-weight-semi-bold:600}a{color:#4259ed;text-decoration:none}a:hover{color:#384cc9;text-decoration:underline}input{font-size:1rem}h1{font-weight:300;margin-bottom:var(--cp-spacer-4)}h2{font-weight:400;margin-bottom:var(--cp-spacer-3)}h3,h4,h5{font-weight:500;margin-bottom:var(--cp-spacer-3)}h6{font-weight:700}:root{--cp-font-weight-semi-bold:600}.list-group{display:flex;flex-direction:column;margin-bottom:0;border-radius:0.25rem}[dir=\"ltr\"] .list-group{padding-left:0}[dir=\"rtl\"] .list-group{padding-right:0}.list-group-numbered{list-style-type:none;counter-reset:section}.list-group-numbered>li::before{content:counters(section, \".\") \". \";counter-increment:section}.list-group-item-action{width:100%;color:#495057;text-align:inherit}.list-group-item-action:hover,.list-group-item-action:focus{z-index:1;color:#495057;text-decoration:none;background-color:#f5f6f7}.list-group-item-action:active{color:#08193e;background-color:#e9ecef}.list-group-item{position:relative;display:block;padding:0.5rem 1rem;color:#08193e;text-decoration:none;background-color:#fff;border:1px solid rgba(0, 0, 0, 0.125)}.list-group-item:first-child{border-top-left-radius:inherit;border-top-right-radius:inherit}.list-group-item:last-child{border-bottom-right-radius:inherit;border-bottom-left-radius:inherit}.list-group-item.disabled,.list-group-item:disabled{color:#6c757d;pointer-events:none;background-color:#fff}.list-group-item.active{z-index:2;color:#fff;background-color:#0d6efd;border-color:#0d6efd}.list-group-item+.list-group-item{border-top-width:0}.list-group-item+.list-group-item.active{margin-top:-1px;border-top-width:1px}.list-group-horizontal{flex-direction:row}[dir=\"ltr\"] .list-group-horizontal>.list-group-item:first-child{border-bottom-left-radius:0.25rem;border-top-right-radius:0}[dir=\"rtl\"] .list-group-horizontal>.list-group-item:first-child{border-bottom-right-radius:0.25rem;border-top-left-radius:0}[dir=\"ltr\"] .list-group-horizontal>.list-group-item:last-child{border-top-right-radius:0.25rem;border-bottom-left-radius:0}[dir=\"rtl\"] .list-group-horizontal>.list-group-item:last-child{border-top-left-radius:0.25rem;border-bottom-right-radius:0}.list-group-horizontal>.list-group-item.active{margin-top:0}.list-group-horizontal>.list-group-item+.list-group-item{border-top-width:1px}[dir=\"ltr\"] .list-group-horizontal>.list-group-item+.list-group-item{border-left-width:0}[dir=\"rtl\"] .list-group-horizontal>.list-group-item+.list-group-item{border-right-width:0}[dir=\"ltr\"] .list-group-horizontal>.list-group-item+.list-group-item.active{margin-left:-1px;border-left-width:1px}[dir=\"rtl\"] .list-group-horizontal>.list-group-item+.list-group-item.active{margin-right:-1px;border-right-width:1px}@media (min-width: 576px){.list-group-horizontal-sm{flex-direction:row}[dir=\"ltr\"] .list-group-horizontal-sm>.list-group-item:first-child{border-bottom-left-radius:0.25rem;border-top-right-radius:0}[dir=\"rtl\"] .list-group-horizontal-sm>.list-group-item:first-child{border-bottom-right-radius:0.25rem;border-top-left-radius:0}[dir=\"ltr\"] .list-group-horizontal-sm>.list-group-item:last-child{border-top-right-radius:0.25rem;border-bottom-left-radius:0}[dir=\"rtl\"] .list-group-horizontal-sm>.list-group-item:last-child{border-top-left-radius:0.25rem;border-bottom-right-radius:0}.list-group-horizontal-sm>.list-group-item.active{margin-top:0}.list-group-horizontal-sm>.list-group-item+.list-group-item{border-top-width:1px}[dir=\"ltr\"] .list-group-horizontal-sm>.list-group-item+.list-group-item{border-left-width:0}[dir=\"rtl\"] .list-group-horizontal-sm>.list-group-item+.list-group-item{border-right-width:0}[dir=\"ltr\"] .list-group-horizontal-sm>.list-group-item+.list-group-item.active{margin-left:-1px;border-left-width:1px}[dir=\"rtl\"] .list-group-horizontal-sm>.list-group-item+.list-group-item.active{margin-right:-1px;border-right-width:1px}}@media (min-width: 768px){.list-group-horizontal-md{flex-direction:row}[dir=\"ltr\"] .list-group-horizontal-md>.list-group-item:first-child{border-bottom-left-radius:0.25rem;border-top-right-radius:0}[dir=\"rtl\"] .list-group-horizontal-md>.list-group-item:first-child{border-bottom-right-radius:0.25rem;border-top-left-radius:0}[dir=\"ltr\"] .list-group-horizontal-md>.list-group-item:last-child{border-top-right-radius:0.25rem;border-bottom-left-radius:0}[dir=\"rtl\"] .list-group-horizontal-md>.list-group-item:last-child{border-top-left-radius:0.25rem;border-bottom-right-radius:0}.list-group-horizontal-md>.list-group-item.active{margin-top:0}.list-group-horizontal-md>.list-group-item+.list-group-item{border-top-width:1px}[dir=\"ltr\"] .list-group-horizontal-md>.list-group-item+.list-group-item{border-left-width:0}[dir=\"rtl\"] .list-group-horizontal-md>.list-group-item+.list-group-item{border-right-width:0}[dir=\"ltr\"] .list-group-horizontal-md>.list-group-item+.list-group-item.active{margin-left:-1px;border-left-width:1px}[dir=\"rtl\"] .list-group-horizontal-md>.list-group-item+.list-group-item.active{margin-right:-1px;border-right-width:1px}}@media (min-width: 992px){.list-group-horizontal-lg{flex-direction:row}[dir=\"ltr\"] .list-group-horizontal-lg>.list-group-item:first-child{border-bottom-left-radius:0.25rem;border-top-right-radius:0}[dir=\"rtl\"] .list-group-horizontal-lg>.list-group-item:first-child{border-bottom-right-radius:0.25rem;border-top-left-radius:0}[dir=\"ltr\"] .list-group-horizontal-lg>.list-group-item:last-child{border-top-right-radius:0.25rem;border-bottom-left-radius:0}[dir=\"rtl\"] .list-group-horizontal-lg>.list-group-item:last-child{border-top-left-radius:0.25rem;border-bottom-right-radius:0}.list-group-horizontal-lg>.list-group-item.active{margin-top:0}.list-group-horizontal-lg>.list-group-item+.list-group-item{border-top-width:1px}[dir=\"ltr\"] .list-group-horizontal-lg>.list-group-item+.list-group-item{border-left-width:0}[dir=\"rtl\"] .list-group-horizontal-lg>.list-group-item+.list-group-item{border-right-width:0}[dir=\"ltr\"] .list-group-horizontal-lg>.list-group-item+.list-group-item.active{margin-left:-1px;border-left-width:1px}[dir=\"rtl\"] .list-group-horizontal-lg>.list-group-item+.list-group-item.active{margin-right:-1px;border-right-width:1px}}@media (min-width: 1200px){.list-group-horizontal-xl{flex-direction:row}[dir=\"ltr\"] .list-group-horizontal-xl>.list-group-item:first-child{border-bottom-left-radius:0.25rem;border-top-right-radius:0}[dir=\"rtl\"] .list-group-horizontal-xl>.list-group-item:first-child{border-bottom-right-radius:0.25rem;border-top-left-radius:0}[dir=\"ltr\"] .list-group-horizontal-xl>.list-group-item:last-child{border-top-right-radius:0.25rem;border-bottom-left-radius:0}[dir=\"rtl\"] .list-group-horizontal-xl>.list-group-item:last-child{border-top-left-radius:0.25rem;border-bottom-right-radius:0}.list-group-horizontal-xl>.list-group-item.active{margin-top:0}.list-group-horizontal-xl>.list-group-item+.list-group-item{border-top-width:1px}[dir=\"ltr\"] .list-group-horizontal-xl>.list-group-item+.list-group-item{border-left-width:0}[dir=\"rtl\"] .list-group-horizontal-xl>.list-group-item+.list-group-item{border-right-width:0}[dir=\"ltr\"] .list-group-horizontal-xl>.list-group-item+.list-group-item.active{margin-left:-1px;border-left-width:1px}[dir=\"rtl\"] .list-group-horizontal-xl>.list-group-item+.list-group-item.active{margin-right:-1px;border-right-width:1px}}@media (min-width: 1400px){.list-group-horizontal-xxl{flex-direction:row}[dir=\"ltr\"] .list-group-horizontal-xxl>.list-group-item:first-child{border-bottom-left-radius:0.25rem;border-top-right-radius:0}[dir=\"rtl\"] .list-group-horizontal-xxl>.list-group-item:first-child{border-bottom-right-radius:0.25rem;border-top-left-radius:0}[dir=\"ltr\"] .list-group-horizontal-xxl>.list-group-item:last-child{border-top-right-radius:0.25rem;border-bottom-left-radius:0}[dir=\"rtl\"] .list-group-horizontal-xxl>.list-group-item:last-child{border-top-left-radius:0.25rem;border-bottom-right-radius:0}.list-group-horizontal-xxl>.list-group-item.active{margin-top:0}.list-group-horizontal-xxl>.list-group-item+.list-group-item{border-top-width:1px}[dir=\"ltr\"] .list-group-horizontal-xxl>.list-group-item+.list-group-item{border-left-width:0}[dir=\"rtl\"] .list-group-horizontal-xxl>.list-group-item+.list-group-item{border-right-width:0}[dir=\"ltr\"] .list-group-horizontal-xxl>.list-group-item+.list-group-item.active{margin-left:-1px;border-left-width:1px}[dir=\"rtl\"] .list-group-horizontal-xxl>.list-group-item+.list-group-item.active{margin-right:-1px;border-right-width:1px}}.list-group-flush{border-radius:0}.list-group-flush>.list-group-item{border-width:0 0 1px}.list-group-flush>.list-group-item:last-child{border-bottom-width:0}.list-group-item-primary{color:#084298;background-color:#cfe2ff}.list-group-item-primary.list-group-item-action:hover,.list-group-item-primary.list-group-item-action:focus{color:#084298;background-color:#bacbe6}.list-group-item-primary.list-group-item-action.active{color:#fff;background-color:#084298;border-color:#084298}.list-group-item-secondary{color:#41464b;background-color:#e2e3e5}.list-group-item-secondary.list-group-item-action:hover,.list-group-item-secondary.list-group-item-action:focus{color:#41464b;background-color:#cbccce}.list-group-item-secondary.list-group-item-action.active{color:#fff;background-color:#41464b;border-color:#41464b}.list-group-item-success{color:#0f5132;background-color:#d1e7dd}.list-group-item-success.list-group-item-action:hover,.list-group-item-success.list-group-item-action:focus{color:#0f5132;background-color:#bcd0c7}.list-group-item-success.list-group-item-action.active{color:#fff;background-color:#0f5132;border-color:#0f5132}.list-group-item-info{color:#055160;background-color:#cff4fc}.list-group-item-info.list-group-item-action:hover,.list-group-item-info.list-group-item-action:focus{color:#055160;background-color:#badce3}.list-group-item-info.list-group-item-action.active{color:#fff;background-color:#055160;border-color:#055160}.list-group-item-warning{color:#664d03;background-color:#fff3cd}.list-group-item-warning.list-group-item-action:hover,.list-group-item-warning.list-group-item-action:focus{color:#664d03;background-color:#e6dbb9}.list-group-item-warning.list-group-item-action.active{color:#fff;background-color:#664d03;border-color:#664d03}.list-group-item-danger{color:#842029;background-color:#f8d7da}.list-group-item-danger.list-group-item-action:hover,.list-group-item-danger.list-group-item-action:focus{color:#842029;background-color:#dfc2c4}.list-group-item-danger.list-group-item-action.active{color:#fff;background-color:#842029;border-color:#842029}.list-group-item-light{color:#636464;background-color:#fefefe}.list-group-item-light.list-group-item-action:hover,.list-group-item-light.list-group-item-action:focus{color:#636464;background-color:#e5e5e5}.list-group-item-light.list-group-item-action.active{color:#fff;background-color:#636464;border-color:#636464}.list-group-item-dark{color:#141619;background-color:#d3d3d4}.list-group-item-dark.list-group-item-action:hover,.list-group-item-dark.list-group-item-action:focus{color:#141619;background-color:#bebebf}.list-group-item-dark.list-group-item-action.active{color:#fff;background-color:#141619;border-color:#141619}.list-group{background-color:var(--cp-secondary-background)}.list-group-item,.list-group-item-action{box-sizing:border-box;border:0px solid transparent}.list-group-item.active,.list-group-item-action.active{background-color:var(--cp-primary-action-opacity-10);color:var(--cp-body-color);border:0px solid transparent}:host{display:block}.header__search-wrapper,.header__search-input{background:transparent;position:relative;height:2rem}@media (max-width: 575.98px){.header__search-input::-ms-clear{display:none;width:0;height:0}.header__search-input::-ms-reveal{display:none;width:0;height:0}.header__search-input::-webkit-search-decoration,.header__search-input::-webkit-search-cancel-button,.header__search-input::-webkit-search-results-button,.header__search-input::-webkit-search-results-decoration{display:none}}[role=gridcell]{border:var(--cp-border-width-1) dashed transparent}[role=gridcell].active{border:var(--cp-border-width-1) dashed var(--cp-primary-color)}.header__search-wrapper{width:100%}@media (max-width: 575.98px){.header__search-wrapper{display:flex;flex-direction:row;position:relative}}.header__search-clear-search-button{display:none}@media (max-width: 575.98px){.header__search-clear-search-button{display:initial;border:none;background-color:transparent;color:#1b366f;position:absolute;cursor:pointer;height:100%;padding-top:0;padding-bottom:0}[dir=\"ltr\"] .header__search-clear-search-button{right:var(--cp-spacer-0)}[dir=\"rtl\"] .header__search-clear-search-button{left:var(--cp-spacer-0)}}.header__search-input{padding:var(--cp-spacer-1) var(--cp-spacer-2);background-color:transparent;border:var(--cp-border-width-1) solid #b3bccf;border-radius:0.25rem;width:100%;box-sizing:border-box}@media (max-width: 575.98px){.header__search-input{flex-grow:1}}.header__search-wrapper.empty::after{font-family:\"remixicon\" !important;color:#1b366f;content:\"\\f0d1\";position:absolute;top:50%;transform:translateY(-50%)}[dir=\"ltr\"] .header__search-wrapper.empty::after{right:var(--cp-spacer-2)}[dir=\"rtl\"] .header__search-wrapper.empty::after{left:var(--cp-spacer-2)}@media (max-width: 575.98px){.header__search-wrapper.empty::after{display:none}}.header__search-input:focus{border:var(--cp-border-width-1) solid var(--cp-primary-color);outline:var(--cp-primary-color)}.header__search-list{width:100%;min-width:30rem;position:absolute;top:50px;max-height:calc(100vh - 60px - 50px);overflow-y:auto;z-index:1032}[dir=\"ltr\"] .header__search-list{right:0}[dir=\"rtl\"] .header__search-list{left:0}@media (max-width: 575.98px){.header__search-list{width:98vw;top:52px;min-width:15rem;position:absolute}[dir=\"ltr\"] .header__search-list{left:-54px;right:0}[dir=\"rtl\"] .header__search-list{right:-54px;left:0}}figure{margin:0;padding:0}figcaption{font-weight:800;font-size:0.875rem;padding:var(--cp-spacer-3) var(--cp-spacer-3) var(--cp-spacer-1) var(--cp-spacer-3);border-bottom:1px solid #e6e9ef;margin-bottom:var(--cp-spacer-1)}ul{margin:0;padding:0;list-style-type:none}.tool-result__container{position:relative;display:grid;grid-template-columns:2.5fr 1fr;grid-template-rows:2fr;gap:0px 0px;grid-template-areas:\"main category\"}.tool-result__main{grid-area:main;display:flex;flex-direction:column}.tool-result__heading{grid-area:heading;color:black}.tool-result__heading:hover{color:inherit;text-decoration:none}.tool-result__heading::before{content:\" \";position:absolute;top:0;width:100%;height:100%}[dir=\"ltr\"] .tool-result__heading::before{left:0}[dir=\"rtl\"] .tool-result__heading::before{right:0}.tool-result__description{font-size:0.75rem;margin:0}.tool-result__category{font-size:0.75rem;margin:0;text-align:end}.account-result__container{position:relative;display:flex;justify-content:space-between}.account-result__main_section{display:flex;flex-direction:column}.account-result__action-section{display:flex}.account-result__domain{font-size:0.875rem}.account-result__username{margin:0}.accounts__show-more-link{display:block;font-size:0.75rem}[dir=\"ltr\"] .accounts__show-more-link{padding:var(--cp-spacer-3) 0 var(--cp-spacer-3) var(--cp-spacer-3)}[dir=\"rtl\"] .accounts__show-more-link{padding:var(--cp-spacer-3) var(--cp-spacer-3) var(--cp-spacer-3) 0}.button--rounded{cursor:pointer;border-radius:100%;width:40px;height:40px;border:0}[dir=\"ltr\"] .button--rounded{margin-left:var(--cp-spacer-3)}[dir=\"rtl\"] .button--rounded{margin-right:var(--cp-spacer-3)}.button__pencil-icon{color:#17A2B8}.button__image-container{display:flex;align-items:center;justify-content:center}.button__image{width:90%;height:90%}";

const locale$r = getLocaleInstance();
const UI_OVERLAY_CLAIM_NAME$2 = "cp-header-search";
const MINIMUM_SEARCH_STRING_LENGTH = 2;
const RESULTS_TO_DISPLAY_COUNT = 5;
const CpHeaderSearch$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
    this.searchInputFocusChange = createEvent(this, "searchInputFocusChange", 7);
    /**
     * List of sorted applications when the user is searching.
     */
    this.matchedApplicationList = [];
    /**
     * If the search menu is open
     */
    this.menuIsOpen = false;
    /**
     * The list account service used for fetching account data.
     */
    this.listAccountsService = ListAccountsService;
    /**
     * The fetched account results from the list accounts API.
     */
    this.accountResults = [];
    /**
     * Handles input from user into the input element. Calls helper functions to update properties.
     * @param event Event from input
     */
    this.handleInputChange = (event) => {
      var _a;
      this.inputText = event.target.value.trim();
      const result = this.searchService.search(this.inputText, { limit: state.appSearchResultsLimit });
      this.matchedApplicationList = result.map(app => {
        return app.item;
      });
      (_a = this.combobox) === null || _a === void 0 ? void 0 : _a.goTo(undefined);
      // This is not ideal but this is the current logic of checking if the menu is open during input handling, just exposing it here.
      this.menuIsOpen = this.inputText.length > 0;
    };
    /**
     * Clears previous account search results, for better UX.
     */
    this.clearPreviousAccountSearchResults = () => {
      this.accountResults = [];
      this.listAccountsPageLink = null;
    };
    /**
     *  Fetches list accounts based on the input text and updates the local variables for accountResults and listAccountsPageLink.
     */
    this.fetchListAccounts = () => {
      if (!state.permissions.listAccounts)
        return;
      this.clearPreviousAccountSearchResults();
      if (this.inputText.length < MINIMUM_SEARCH_STRING_LENGTH)
        return;
      this.listAccountsService
        .getAccounts(this.inputText, RESULTS_TO_DISPLAY_COUNT)
        .then((data) => {
        this.accountResults = data.accounts;
        if (data.records > RESULTS_TO_DISPLAY_COUNT) {
          this.listAccountsPageLink = this.listAccountsService.getRelativePathToListAccountsPage(this.inputText);
        }
      });
    };
    /**
     * Handles keyboard navigation on the list of items.
     * @param event keyboard event from the user input
     * @returns void
     */
    this.delegateHotKeyHandling = (event) => {
      var _a, _b, _c, _d, _e, _f, _g;
      if (!((_a = this.combobox) === null || _a === void 0 ? void 0 : _a.currentGridcell) && ["ArrowRight", "ArrowLeft"].includes(event.key)) {
        return;
      }
      switch (event.key) {
        case "ArrowDown":
          (_b = this.combobox) === null || _b === void 0 ? void 0 : _b.goTo(this.combobox.nextRow);
          break;
        case "ArrowUp":
          (_c = this.combobox) === null || _c === void 0 ? void 0 : _c.goTo(this.combobox.previousRow);
          break;
        case "ArrowRight":
          (_d = this.combobox) === null || _d === void 0 ? void 0 : _d.goTo(this.combobox.nextGridcell);
          break;
        case "ArrowLeft":
          (_e = this.combobox) === null || _e === void 0 ? void 0 : _e.goTo(this.combobox.previousGridcell);
          break;
        case "Enter":
          (_g = (_f = this.combobox) === null || _f === void 0 ? void 0 : _f.currentGridcell) === null || _g === void 0 ? void 0 : _g.click();
          break;
        case "Esc": // IE/Edge specific value
        case "Escape":
          this.inputText = "";
          this.closeMenu();
          break;
        default:
          return; // Quit when this doesn't handle the key event.
      }
      event.preventDefault();
    };
    /**
     * Closes the list group and resets necessary properties.
     */
    this.closeMenu = () => {
      this.matchedApplicationList = [];
      this.menuIsOpen = false;
    };
    /**
     * Focuses the search input.
     */
    this.focusSearchInput = () => {
      // timeout needed to focus the search on load in Safari.
      // https://stackoverflow.com/questions/54229359/why-does-select-not-work-on-safari-with-reactjs
      setTimeout(() => { var _a; return (_a = this.searchInput) === null || _a === void 0 ? void 0 : _a.focus(); }, 0);
    };
    this.handleSearchInputFocus = (event) => {
      this.searchInputFocusChange.emit({ isFocused: true });
      this.handleInputChange(event);
    };
    /**
     * Focuses the search when the wrapper div is clicked. This is needed due to the search icon being a dead area when clicking on the input element.
     * This ensures the input will get focused even if the search icon is clicked.
     * On mobile viewports, the function will return as the icon is not present on mobile and will allow
     * the X icon to reset inputText's state.
     */
    this.onWrapperClick = () => {
      var _a;
      const viewportSize = getComputedStyle(document.documentElement).getPropertyValue("--cp-current-viewport");
      if (/xs/.test(viewportSize)) {
        return;
      }
      else {
        (_a = this.searchInput) === null || _a === void 0 ? void 0 : _a.focus();
      }
    };
    /**
     * When mobile styles are present, handles the click input for the 'X' on the input.
     */
    this.clearMobileSearch = () => {
      this.inputText = "";
      this.closeMenu();
    };
    this.fetchListAccounts = debounce$1(this.fetchListAccounts, 500).bind(this);
  }
  /**
   * Listens for the keyboard shortcut to focus the search input.
   */
  handleKeydown(event) {
    // Firefox listens to the "/" and "Cmd + F" to trigger the browser search.
    // We are overriding the "/" here to focus our search.
    // To do that, we must listen on the keydown instead of the keyup event.
    const tag = event.target.tagName.toLowerCase();
    if (tag === "input" || tag === "select" || tag === "textarea") {
      return;
    }
    // Listen for either numberpad or left of shift / key
    // Don't focus this element if the control key and / is pressed.
    // Control + / focuses the main menu filter
    // Ignore if '/' is pressed inside the main menu navigation. That allows the user to use / inside that search box as part of their search string.
    if (!(event.key === "/" && event.ctrlKey) &&
      (event.key === "/" || event.key === "Divide") &&
      !this._searchIsFocused() &&
      !this._mainMenuSearchIsFocused()) {
      event.preventDefault();
      this.focusSearchInput();
    }
  }
  /**
   * Handles when a user moves away from the search component, either via click-out
   * or keyboard navigation
   */
  handleFocusOut() {
    this.closeMenu();
    this.searchInputFocusChange.emit({ isFocused: false });
  }
  /**
   * StencilJS lifecycle. Gets values from state.
   */
  componentWillLoad() {
    this.directoryPrefix = state.appName === AppName.Whm ? state.directoryPrefix + "/" : state.directoryPrefix;
    this.applicationList = state.appList;
    this.searchService = new Fuse(this.applicationList, SEARCH_OPTIONS);
  }
  /**
   * StencilJS lifecycle. Initializes all needed variables.
   */
  componentDidLoad() {
    var _a;
    (_a = this.searchInput) === null || _a === void 0 ? void 0 : _a.addEventListener("input", e => {
      this.handleInputChange(e);
      this.fetchListAccounts();
    });
  }
  /**
   * StencilJS lifecycle. Called after a render.
   */
  componentDidRender() {
    if (this.focusSearch) {
      this.focusSearchInput();
    }
    if (!this.combobox) {
      this.combobox = this.getCombobox();
    }
  }
  /**
   * StencilJS lifecycle. Handles the overlay.
   */
  componentWillUpdate() {
    this.updateOverlay();
  }
  getCombobox() {
    var _a;
    const el = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById("search-combobox");
    if (!el) {
      return;
    }
    return new Combobox(el);
  }
  /**
   * Adds and removes the overlay based on the list of available items in search list.
   * If there are no items in the list, the overlay will not be present.
   * @returns void
   */
  updateOverlay() {
    if (this.inputText && this._searchIsFocused()) {
      state.uiOverlay.claim(UI_OVERLAY_CLAIM_NAME$2);
    }
    else {
      state.uiOverlay.release(UI_OVERLAY_CLAIM_NAME$2);
    }
  }
  _searchIsFocused() {
    var _a;
    return this.searchInput === ((_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.activeElement);
  }
  /**
   * This function finds the search input in the main menu navigation and checks if it is the current active element.
   */
  _mainMenuSearchIsFocused() {
    var _a, _b, _c, _d;
    const activeElement = getActiveElement(document);
    const mainMenuSearchEl = (_d = (_c = (_b = (_a = document
      .querySelector("cp-main-menu")) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector("cp-main-menu-nav-whm")) === null || _c === void 0 ? void 0 : _c.shadowRoot) === null || _d === void 0 ? void 0 : _d.querySelector(".cp-main-menu__filter-input");
    return activeElement === mainMenuSearchEl;
  }
  /**
   * Whether the search results component should display the 'No results found' element. The array of results must be empty and a search input must exist
   */
  get showNoSearchResults() {
    return !this.matchedApplicationList.length && !!this.inputText && this._searchIsFocused();
  }
  showAccountResults() {
    return state.appName === AppName.Whm && this.accountResults.length > 0;
  }
  /**
   * The DOM element that will be visible based on whether there are search results visible or not. When there are no results to display an element that shows 'No results found.' is visible. When there are results to display a list of applications is shown, with the top of list highlighted and focused. If a URL exists for the application object then an anchor tag is used for the list element.
   */
  get searchResultsDisplay() {
    return this.showNoSearchResults ? (
    /* NOTE: tabindex attribute is required on <a> tags to make them focusable in Safari.
    Without this attribute, the links do not work and clicking one dismisses the dropdown. */
    h("div", { tabindex: "0", class: "list-group-item list-group-item-action active", "aria-current": "true", key: "no-results-option", role: "row" }, locale$r.maketext("No results found."))) : (this.matchedApplicationList.map((app, i) => {
      return toolSearchResult(app, i, this.directoryPrefix);
    }));
  }
  _wrapperClass() {
    return "header__search-wrapper " + (this.inputText ? "" : "empty");
  }
  /**
   * Takes as input the appname and returns the correct placeholder text for the text.
   * Cpanel does not support account searching whereas WHM does.
   * @returns string
   */
  getSearchPlaceholder(appName) {
    if (appName === AppName.Cpanel || isDnsOnly()) {
      return locale$r.maketext("Search Tools (/)[comment,placeholder text]");
    }
    if (appName === AppName.Whm) {
      return locale$r.maketext("Search Tools and Accounts (/)[comment,placeholder text]");
    }
    return locale$r.maketext("Search");
  }
  render() {
    return (h(Host, null, h("cp-dir", null, h("div", { class: this._wrapperClass(), role: "combobox", id: "search-combobox", "aria-expanded": this.menuIsOpen ? "true" : "false", "aria-haspopup": "grid", "aria-owns": "search-results", onClick: this.onWrapperClick }, h("input", { id: "search-input", "aria-autocomplete": "list", "aria-controls": "search-results", class: "header__search-input", type: "search", autocomplete: "off", spellcheck: false, placeholder: this.getSearchPlaceholder(state.appName), "aria-label": this.getSearchPlaceholder(state.appName), value: this.inputText || "", onFocus: ev => this.handleSearchInputFocus(ev), onKeyDown: this.delegateHotKeyHandling, ref: input => {
        this.searchInput = input;
      } }), h("button", { onClick: this.clearMobileSearch, class: "header__search-clear-search-button" }, h("cp-icon", { name: "close-line", mode: IconMode.Centered })), h("div", Object.assign({ id: "search-results", class: "list-group header__search-list" }, (this.menuIsOpen ? { role: "grid" } : {})), this.menuIsOpen && (h("div", null, h("figure", null, h("figcaption", null, locale$r.maketext("Tools")), h("ul", null, this.searchResultsDisplay)), this.showAccountResults() && (h("figure", null, h("figcaption", null, locale$r.maketext("Accounts")), h("ul", null, this.accountResults.map(account => accountSearchResult(account, state.directoryPrefix, state.permissions, state.user))), this.listAccountsPageLink && (h("a", { tabindex: "0", class: "accounts__show-more-link", href: this.listAccountsPageLink }, locale$r.maketext("See more account results for “[_1]”.", this.inputText))))))))))));
  }
  get el() { return this; }
  static get style() { return cpHeaderSearchCss; }
};

// Copyright 2022 cPanel, L.L.C. - All rights reserved.
// copyright@cpanel.net
// https://cpanel.net
// This code is subject to the cPanel license. Unauthorized copying is prohibited
/**
 * Viewport sizes as defined by Bootstrap
 */
var ViewportSize;
(function (ViewportSize) {
  ViewportSize["xs"] = "xs";
  ViewportSize["sm"] = "sm";
  ViewportSize["md"] = "md";
  ViewportSize["lg"] = "lg";
  ViewportSize["xl"] = "xl";
})(ViewportSize || (ViewportSize = {}));

const cpHeaderSearchControlCss = ":root{--cp-font-weight-semi-bold:600}:host{display:block}.header-controls__search-component{flex-grow:1}[dir=\"ltr\"] .header-controls__search-component{margin-left:var(--cp-spacer-3)}[dir=\"rtl\"] .header-controls__search-component{margin-right:var(--cp-spacer-3)}.search-controls{display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between}.search-controls__back-button{display:none}.search-controls__back-button:hover{cursor:pointer}@media (max-width: 575.98px){.search-controls__back-button{display:initial;background-color:transparent;border:none;padding-top:2px;color:#1b366f}[dir=\"ltr\"] .search-controls__back-button{padding-left:var(--cp-spacer-0)}[dir=\"rtl\"] .search-controls__back-button{padding-right:var(--cp-spacer-0)}}@media (max-width: 575.98px){.hide-on-mobile{display:none}}";

const locale$q = getLocaleInstance();
const CpSearchHeaderControl = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
    this.toggleMobileSearch = createEvent(this, "toggleMobileSearch", 7);
    /**
     * Emits an a custom event outside the component.
     * @param e Event
     */
    this.toggleMobileSearchHandler = (e) => {
      this.toggleMobileSearch.emit(e);
      this.focusSearch = false;
    };
    /**
     * Gets the current viewport size.
     */
    this.getViewportSize = () => {
      const viewportSize = getComputedStyle(document.documentElement).getPropertyValue("--cp-current-viewport");
      return ViewportSize[viewportSize];
    };
    /**
     * Determines if the current viewport is a mobile view.
     * @param viewportSize ViewportSize
     */
    this.isMobileViewport = (viewportSize) => {
      const isMobile = /xs|sm/.test(viewportSize);
      return isMobile;
    };
  }
  onResize(event) {
    const isMobile = this.isMobileViewport(this.getViewportSize());
    if (this.isMobileSearch && !isMobile) {
      this.toggleMobileSearchHandler(event);
    }
  }
  render() {
    return (h(Host, null, h("cp-dir", null, h("div", { class: (!this.isMobileSearch ? "hide-on-mobile" : "") + " search-controls" }, h("button", { class: "search-controls__back-button", "aria-label": locale$q.maketext("Back to header"), onClick: this.toggleMobileSearchHandler }, h("cp-icon", { name: "arrow-left-line", size: IconSize.xl, mode: IconMode.Inline, class: "search-controls__back-arrow" })), h("cp-header-search", { class: "header-controls__search-component", "focus-search": this.focusSearch, isVisible: this.isMobileSearch })))));
  }
  get el() { return this; }
  static get style() { return cpHeaderSearchControlCss; }
};

const cpHeaderUserAccountControlCss = ":root{--cp-font-weight-semi-bold:600}:host{display:block}button{border:1px solid var(--cp-primary-color);text-decoration:none;cursor:pointer;color:inherit;background:transparent;height:100%;width:100%;padding:var(--cp-spacer-2);display:flex;align-items:center;justify-content:center;box-sizing:border-box;border-radius:50%}.user-menu--expanded{background:var(--cp-primary-action-color);color:var(--cp-primary-action-contrast-text)}";

const locale$p = getLocaleInstance();
const CpUserAccountHeaderControl = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
    this.toggleExpand = createEvent(this, "toggleExpand", 7);
  }
  /**
   * Listens for clicks and flips the menu expanded state.
   */
  toggleMenu(e) {
    e.stopPropagation();
    this.toggleExpand.emit(!this.isMenuExpanded);
  }
  /**
   * Handles when a user moves away from the account menu component.
   */
  handleFocusOut() {
    this.toggleExpand.emit(false);
  }
  render() {
    return (h(Host, null, h("cp-dir", null, h("cp-header-control", { "show-badge": false }, h("button", { tabindex: "0", id: "user-menu-button", class: this.isMenuExpanded ? "header__control user-menu--expanded" : "header__control", title: locale$p.maketext("User Menu"), "aria-label": locale$p.maketext("User Menu") }, h("cp-icon", { name: "user-line", size: IconSize.sm, mode: IconMode.Centered }))), this.isMenuExpanded && (h("cp-header-user-account-dropdown", { menuItems: this.menuItems })))));
  }
  get el() { return this; }
  static get style() { return cpHeaderUserAccountControlCss; }
};

const cpHeaderUserAccountDropdownCss = ":root{--cp-font-weight-semi-bold:600}:root{--cp-font-weight-semi-bold:600}.list-group{display:flex;flex-direction:column;margin-bottom:0;border-radius:0.25rem}[dir=\"ltr\"] .list-group{padding-left:0}[dir=\"rtl\"] .list-group{padding-right:0}.list-group-numbered{list-style-type:none;counter-reset:section}.list-group-numbered>li::before{content:counters(section, \".\") \". \";counter-increment:section}.list-group-item-action{width:100%;color:#495057;text-align:inherit}.list-group-item-action:hover,.list-group-item-action:focus{z-index:1;color:#495057;text-decoration:none;background-color:#f5f6f7}.list-group-item-action:active{color:#08193e;background-color:#e9ecef}.list-group-item{position:relative;display:block;padding:0.5rem 1rem;color:#08193e;text-decoration:none;background-color:#fff;border:1px solid rgba(0, 0, 0, 0.125)}.list-group-item:first-child{border-top-left-radius:inherit;border-top-right-radius:inherit}.list-group-item:last-child{border-bottom-right-radius:inherit;border-bottom-left-radius:inherit}.list-group-item.disabled,.list-group-item:disabled{color:#6c757d;pointer-events:none;background-color:#fff}.list-group-item.active{z-index:2;color:#fff;background-color:#0d6efd;border-color:#0d6efd}.list-group-item+.list-group-item{border-top-width:0}.list-group-item+.list-group-item.active{margin-top:-1px;border-top-width:1px}.list-group-horizontal{flex-direction:row}[dir=\"ltr\"] .list-group-horizontal>.list-group-item:first-child{border-bottom-left-radius:0.25rem;border-top-right-radius:0}[dir=\"rtl\"] .list-group-horizontal>.list-group-item:first-child{border-bottom-right-radius:0.25rem;border-top-left-radius:0}[dir=\"ltr\"] .list-group-horizontal>.list-group-item:last-child{border-top-right-radius:0.25rem;border-bottom-left-radius:0}[dir=\"rtl\"] .list-group-horizontal>.list-group-item:last-child{border-top-left-radius:0.25rem;border-bottom-right-radius:0}.list-group-horizontal>.list-group-item.active{margin-top:0}.list-group-horizontal>.list-group-item+.list-group-item{border-top-width:1px}[dir=\"ltr\"] .list-group-horizontal>.list-group-item+.list-group-item{border-left-width:0}[dir=\"rtl\"] .list-group-horizontal>.list-group-item+.list-group-item{border-right-width:0}[dir=\"ltr\"] .list-group-horizontal>.list-group-item+.list-group-item.active{margin-left:-1px;border-left-width:1px}[dir=\"rtl\"] .list-group-horizontal>.list-group-item+.list-group-item.active{margin-right:-1px;border-right-width:1px}@media (min-width: 576px){.list-group-horizontal-sm{flex-direction:row}[dir=\"ltr\"] .list-group-horizontal-sm>.list-group-item:first-child{border-bottom-left-radius:0.25rem;border-top-right-radius:0}[dir=\"rtl\"] .list-group-horizontal-sm>.list-group-item:first-child{border-bottom-right-radius:0.25rem;border-top-left-radius:0}[dir=\"ltr\"] .list-group-horizontal-sm>.list-group-item:last-child{border-top-right-radius:0.25rem;border-bottom-left-radius:0}[dir=\"rtl\"] .list-group-horizontal-sm>.list-group-item:last-child{border-top-left-radius:0.25rem;border-bottom-right-radius:0}.list-group-horizontal-sm>.list-group-item.active{margin-top:0}.list-group-horizontal-sm>.list-group-item+.list-group-item{border-top-width:1px}[dir=\"ltr\"] .list-group-horizontal-sm>.list-group-item+.list-group-item{border-left-width:0}[dir=\"rtl\"] .list-group-horizontal-sm>.list-group-item+.list-group-item{border-right-width:0}[dir=\"ltr\"] .list-group-horizontal-sm>.list-group-item+.list-group-item.active{margin-left:-1px;border-left-width:1px}[dir=\"rtl\"] .list-group-horizontal-sm>.list-group-item+.list-group-item.active{margin-right:-1px;border-right-width:1px}}@media (min-width: 768px){.list-group-horizontal-md{flex-direction:row}[dir=\"ltr\"] .list-group-horizontal-md>.list-group-item:first-child{border-bottom-left-radius:0.25rem;border-top-right-radius:0}[dir=\"rtl\"] .list-group-horizontal-md>.list-group-item:first-child{border-bottom-right-radius:0.25rem;border-top-left-radius:0}[dir=\"ltr\"] .list-group-horizontal-md>.list-group-item:last-child{border-top-right-radius:0.25rem;border-bottom-left-radius:0}[dir=\"rtl\"] .list-group-horizontal-md>.list-group-item:last-child{border-top-left-radius:0.25rem;border-bottom-right-radius:0}.list-group-horizontal-md>.list-group-item.active{margin-top:0}.list-group-horizontal-md>.list-group-item+.list-group-item{border-top-width:1px}[dir=\"ltr\"] .list-group-horizontal-md>.list-group-item+.list-group-item{border-left-width:0}[dir=\"rtl\"] .list-group-horizontal-md>.list-group-item+.list-group-item{border-right-width:0}[dir=\"ltr\"] .list-group-horizontal-md>.list-group-item+.list-group-item.active{margin-left:-1px;border-left-width:1px}[dir=\"rtl\"] .list-group-horizontal-md>.list-group-item+.list-group-item.active{margin-right:-1px;border-right-width:1px}}@media (min-width: 992px){.list-group-horizontal-lg{flex-direction:row}[dir=\"ltr\"] .list-group-horizontal-lg>.list-group-item:first-child{border-bottom-left-radius:0.25rem;border-top-right-radius:0}[dir=\"rtl\"] .list-group-horizontal-lg>.list-group-item:first-child{border-bottom-right-radius:0.25rem;border-top-left-radius:0}[dir=\"ltr\"] .list-group-horizontal-lg>.list-group-item:last-child{border-top-right-radius:0.25rem;border-bottom-left-radius:0}[dir=\"rtl\"] .list-group-horizontal-lg>.list-group-item:last-child{border-top-left-radius:0.25rem;border-bottom-right-radius:0}.list-group-horizontal-lg>.list-group-item.active{margin-top:0}.list-group-horizontal-lg>.list-group-item+.list-group-item{border-top-width:1px}[dir=\"ltr\"] .list-group-horizontal-lg>.list-group-item+.list-group-item{border-left-width:0}[dir=\"rtl\"] .list-group-horizontal-lg>.list-group-item+.list-group-item{border-right-width:0}[dir=\"ltr\"] .list-group-horizontal-lg>.list-group-item+.list-group-item.active{margin-left:-1px;border-left-width:1px}[dir=\"rtl\"] .list-group-horizontal-lg>.list-group-item+.list-group-item.active{margin-right:-1px;border-right-width:1px}}@media (min-width: 1200px){.list-group-horizontal-xl{flex-direction:row}[dir=\"ltr\"] .list-group-horizontal-xl>.list-group-item:first-child{border-bottom-left-radius:0.25rem;border-top-right-radius:0}[dir=\"rtl\"] .list-group-horizontal-xl>.list-group-item:first-child{border-bottom-right-radius:0.25rem;border-top-left-radius:0}[dir=\"ltr\"] .list-group-horizontal-xl>.list-group-item:last-child{border-top-right-radius:0.25rem;border-bottom-left-radius:0}[dir=\"rtl\"] .list-group-horizontal-xl>.list-group-item:last-child{border-top-left-radius:0.25rem;border-bottom-right-radius:0}.list-group-horizontal-xl>.list-group-item.active{margin-top:0}.list-group-horizontal-xl>.list-group-item+.list-group-item{border-top-width:1px}[dir=\"ltr\"] .list-group-horizontal-xl>.list-group-item+.list-group-item{border-left-width:0}[dir=\"rtl\"] .list-group-horizontal-xl>.list-group-item+.list-group-item{border-right-width:0}[dir=\"ltr\"] .list-group-horizontal-xl>.list-group-item+.list-group-item.active{margin-left:-1px;border-left-width:1px}[dir=\"rtl\"] .list-group-horizontal-xl>.list-group-item+.list-group-item.active{margin-right:-1px;border-right-width:1px}}@media (min-width: 1400px){.list-group-horizontal-xxl{flex-direction:row}[dir=\"ltr\"] .list-group-horizontal-xxl>.list-group-item:first-child{border-bottom-left-radius:0.25rem;border-top-right-radius:0}[dir=\"rtl\"] .list-group-horizontal-xxl>.list-group-item:first-child{border-bottom-right-radius:0.25rem;border-top-left-radius:0}[dir=\"ltr\"] .list-group-horizontal-xxl>.list-group-item:last-child{border-top-right-radius:0.25rem;border-bottom-left-radius:0}[dir=\"rtl\"] .list-group-horizontal-xxl>.list-group-item:last-child{border-top-left-radius:0.25rem;border-bottom-right-radius:0}.list-group-horizontal-xxl>.list-group-item.active{margin-top:0}.list-group-horizontal-xxl>.list-group-item+.list-group-item{border-top-width:1px}[dir=\"ltr\"] .list-group-horizontal-xxl>.list-group-item+.list-group-item{border-left-width:0}[dir=\"rtl\"] .list-group-horizontal-xxl>.list-group-item+.list-group-item{border-right-width:0}[dir=\"ltr\"] .list-group-horizontal-xxl>.list-group-item+.list-group-item.active{margin-left:-1px;border-left-width:1px}[dir=\"rtl\"] .list-group-horizontal-xxl>.list-group-item+.list-group-item.active{margin-right:-1px;border-right-width:1px}}.list-group-flush{border-radius:0}.list-group-flush>.list-group-item{border-width:0 0 1px}.list-group-flush>.list-group-item:last-child{border-bottom-width:0}.list-group-item-primary{color:#084298;background-color:#cfe2ff}.list-group-item-primary.list-group-item-action:hover,.list-group-item-primary.list-group-item-action:focus{color:#084298;background-color:#bacbe6}.list-group-item-primary.list-group-item-action.active{color:#fff;background-color:#084298;border-color:#084298}.list-group-item-secondary{color:#41464b;background-color:#e2e3e5}.list-group-item-secondary.list-group-item-action:hover,.list-group-item-secondary.list-group-item-action:focus{color:#41464b;background-color:#cbccce}.list-group-item-secondary.list-group-item-action.active{color:#fff;background-color:#41464b;border-color:#41464b}.list-group-item-success{color:#0f5132;background-color:#d1e7dd}.list-group-item-success.list-group-item-action:hover,.list-group-item-success.list-group-item-action:focus{color:#0f5132;background-color:#bcd0c7}.list-group-item-success.list-group-item-action.active{color:#fff;background-color:#0f5132;border-color:#0f5132}.list-group-item-info{color:#055160;background-color:#cff4fc}.list-group-item-info.list-group-item-action:hover,.list-group-item-info.list-group-item-action:focus{color:#055160;background-color:#badce3}.list-group-item-info.list-group-item-action.active{color:#fff;background-color:#055160;border-color:#055160}.list-group-item-warning{color:#664d03;background-color:#fff3cd}.list-group-item-warning.list-group-item-action:hover,.list-group-item-warning.list-group-item-action:focus{color:#664d03;background-color:#e6dbb9}.list-group-item-warning.list-group-item-action.active{color:#fff;background-color:#664d03;border-color:#664d03}.list-group-item-danger{color:#842029;background-color:#f8d7da}.list-group-item-danger.list-group-item-action:hover,.list-group-item-danger.list-group-item-action:focus{color:#842029;background-color:#dfc2c4}.list-group-item-danger.list-group-item-action.active{color:#fff;background-color:#842029;border-color:#842029}.list-group-item-light{color:#636464;background-color:#fefefe}.list-group-item-light.list-group-item-action:hover,.list-group-item-light.list-group-item-action:focus{color:#636464;background-color:#e5e5e5}.list-group-item-light.list-group-item-action.active{color:#fff;background-color:#636464;border-color:#636464}.list-group-item-dark{color:#141619;background-color:#d3d3d4}.list-group-item-dark.list-group-item-action:hover,.list-group-item-dark.list-group-item-action:focus{color:#141619;background-color:#bebebf}.list-group-item-dark.list-group-item-action.active{color:#fff;background-color:#141619;border-color:#141619}.list-group{background-color:var(--cp-secondary-background)}.list-group-item,.list-group-item-action{box-sizing:border-box;border:0px solid transparent}.list-group-item.active,.list-group-item-action.active{background-color:var(--cp-primary-action-opacity-10);color:var(--cp-body-color);border:0px solid transparent}:host{display:block;z-index:1032;position:relative}.list-group{background-color:var(--cp-secondary-background);z-index:1032}.user-account-menu__list{position:absolute;top:0.8rem;border-radius:0.25rem;border:1px solid #e6e9ef;box-shadow:0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);overflow:hidden;list-style-type:none;padding:0;margin:var(--cp-spacer-1);background:#ffffff;min-width:248px;overflow-y:auto;max-height:calc(100vh - 60px)}[dir=\"ltr\"] .user-account-menu__list{right:0}[dir=\"rtl\"] .user-account-menu__list{left:0}@media (max-width: 575.98px){.user-account-menu__list{top:0.8rem;width:100%;border:none;box-shadow:none;margin-right:0;margin-left:0}}.user-account-menu__list-item{padding:var(--cp-spacer-3);border-top:none;border-left:none;border-right:none;border-bottom:1px solid #e6e9ef;width:unset;display:flex;align-items:center}li:nth-last-child(2) .user-account-menu__list-item{border-bottom:1px solid #b3bccf}.user-account-menu__list-icons{text-decoration:none;vertical-align:middle}[dir=\"ltr\"] .user-account-menu__list-icons{padding:0 var(--cp-spacer-3) 0 0}[dir=\"rtl\"] .user-account-menu__list-icons{padding:0 0 0 var(--cp-spacer-3)}.user-account-menu__list-icons:focus,.user-account-menu__list-icons:hover{text-decoration:none}";

const CpHeaderUserDropdown = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
    this.menuItemPress = createEvent(this, "menuItemPress", 7);
  }
  /**
   * Handles the menu item click event.
   * @param menuItem The menu item pressed
   */
  menuItemPressHandler(menuItem) {
    this.menuItemPress.emit(menuItem);
    this.clearSessionOnLogout(menuItem);
  }
  /**
   * Check if the logout menu item is selected and clear sessionStorage.
   * @param menuItem
   */
  clearSessionOnLogout(menuItem) {
    if (menuItem.id === "menu-logout-link") {
      sessionStorage.clear();
    }
  }
  render() {
    return (h(Host, null, h("cp-dir", null, h("ul", { class: "user-account-menu__list list-group" }, this.menuItems &&
      this.menuItems.map(item => (h("li", null, h("a", { id: `user-account-menu__link--${item.id}`, href: item.href, target: item.target, "aria-label": item.title, title: item.title, class: "list-group-item list-group-item-action user-account-menu__list-item", onClick: _ => this.menuItemPressHandler(item) }, item.icon && (h("cp-icon", { name: item.icon, class: "user-account-menu__list-icons" })), h("span", { class: "user-account-menu__list-text" }, item.title)))))))));
  }
  static get style() { return cpHeaderUserAccountDropdownCss; }
};

const cpIconCss = ":host([data-mode-centered]) .container{font-size:16px;display:flex;justify-content:center;align-items:center}:host([data-mode-inline]){font-size:16px}:host([data-mode-inline]) [class^=ri-]{vertical-align:middle}";

const CpIcon$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
    /**
     * Determines if the icon is centered or inline
     */
    this.mode = IconMode.Inline;
    /**
     * Determins the icon size. Sizes based on the Remix Icon library.
     */
    this.size = IconSize.xl;
  }
  /**
   * Helper function to get the icon size.
   * @returns IconSize
   */
  getSize() {
    if (IconSize[this.size]) {
      return IconSize[this.size];
    }
    return this.size;
  }
  /**
   * Stencil lifecycle method.
   */
  componentWillLoad() {
    this.reuseExternalStylesheet();
    this.iconDirection();
  }
  /**
   * This component relies on the Remix Icon font, and we have decided that that dependency
   * should be handled externally because icons are needed in many places and we may not always
   * want to employ this web component to use them.
   *
   * Additionally, @font-face definitions don't currently function when defined within web
   * components without dynamically adding the link tag to the <head> via JavaScript, so
   * cloning an existing tag is the best solution available to us at this time.
   *
   * https://bugs.chromium.org/p/chromium/issues/detail?id=336876
   * https://github.com/ionic-team/stencil/issues/2072#issuecomment-588465875
   * https://github.com/ionic-team/stencil/issues/1875#issuecomment-602720766
   * https://stackoverflow.com/questions/60504404/how-to-use-material-design-icons-in-a-web-component
   */
  reuseExternalStylesheet() {
    var _a;
    const externalStylesheet = document.getElementById("custom-fonts-stylesheet");
    if (externalStylesheet) {
      (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.appendChild(externalStylesheet.cloneNode());
      return;
    }
    console.warn("cp-icon: Failed to find the link tag with ID 'custom-fonts-stylesheet'");
  }
  /**
   * Returns the `name` property, altered to suit LTR/RTL as appropriate.
   */
  iconDirection() {
    const pageDir = document.dir;
    if (pageDir === "rtl") {
      if (this.name.includes("right")) {
        return this.name.replace("right", "left");
      }
      if (this.name.includes("left")) {
        return this.name.replace("left", "right");
      }
    }
    return this.name;
  }
  /**
   * Mark up for a centered icon.
   * @returns DOM element
   */
  centeredMarkup() {
    return (h(Host, { "data-mode-centered": true }, h("cp-dir", null, h("div", { class: "container" }, h("i", { class: `ri-${this.iconDirection()} ${this.getSize()}` })))));
  }
  /**
   * Mark up for an inline icon.
   * @returns DOM element
   */
  inlineMarkup() {
    return (h(Host, { "data-mode-inline": true }, h("cp-dir", null, h("i", { class: `ri-${this.iconDirection()} ${this.getSize()}` }))));
  }
  render() {
    return this.mode === IconMode.Centered ? this.centeredMarkup() : this.inlineMarkup();
  }
  get el() { return this; }
  static get style() { return cpIconCss; }
};

/**
# cpanel - ui/web-components/src/utils/base-api.ts Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
 */
/**
 * *DO NOT USE THIS* unless for some reason @cpanel/api doesn’t work for you.
 *
 * Returns the base-url for a cPanel API call.
 */
function buildRequestURL(securityToken, api) {
  return `${securityToken}/json-api/${api}`;
}

/**
# cpanel - ui/web-components/src/components/shared/models/load-average.model.ts
#                                                  Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
 */
/**
 * A single load average data point.
 */
class LoadAverages {
  /**
   * Type safe class for the load average data.
   *
   * @param data - The load average data to plug into the class.
   */
  constructor(data) {
    this.fifteen = +data.fifteen;
    this.five = +data.five;
    this.one = +data.one;
  }
}

/**
# cpanel - ui/web-components/src/components/shared/services/whm/load-average.service.ts
#                                                  Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
 */
let abortController;
function abort() {
  if (abortController) {
    abortController.abort();
    abortController = undefined;
  }
}
/**
 * Fetches a sample of the one, five, and fifteen minute server load averages.
 *
 * @param securityToken The current session token.
 * @returns The latest linux load average sample via an api call back to the server.
 */
function get(securityToken) {
  const url = buildRequestURL(securityToken, "loadavg");
  abortController = new AbortController();
  return fetch(url, {
    method: "GET",
    cache: "no-cache",
    signal: abortController.signal,
  })
    .then(resp => {
    return resp.json();
  })
    .then(data => {
    if (data.cpanelresult && data.cpanelresult.error) {
      throw data.cpanelresult.error;
    }
    return new LoadAverages(data);
  });
}

const refreshInterval = 5000; // 5 sec
var UpdateType;
(function (UpdateType) {
  UpdateType[UpdateType["Start"] = 0] = "Start";
  UpdateType[UpdateType["Sample"] = 1] = "Sample";
  UpdateType[UpdateType["Error"] = 2] = "Error";
})(UpdateType || (UpdateType = {}));
class LoadAverageSamplerController {
  /**
   * Report an error event.
   *
   * @param error - the error returned by the fetch.
   */
  reportError(error) {
    const errorEvent = new CustomEvent("samplingError", { detail: error });
    window.dispatchEvent(errorEvent);
    return;
  }
  /**
   * Trigger the updateSample event with the next data point.
   *
   * @param sample The sample just retrieved.
   */
  reportUpdate(type, sample) {
    // Use native events since the stencil wrappers can
    // only be used with @Components.
    switch (type) {
      case UpdateType.Start:
        const startEvent = new CustomEvent("startSampling");
        window.dispatchEvent(startEvent);
        return;
      case UpdateType.Sample:
        const sampleEvent = new CustomEvent("updateSample", { detail: sample });
        window.dispatchEvent(sampleEvent);
        return;
    }
  }
  /**
   * Start the load average updater.
   */
  start() {
    const session = state.directoryPrefix;
    if (this.intervalHandle) {
      return; // its already running.
    }
    // we only want to sample if the ui is visible to preserve
    // server cycles for other more important work.
    document.addEventListener("visibilitychange", () => {
      if (document.visibilityState === "hidden") {
        this.stop();
      }
      else {
        this.start();
      }
    }, false);
    this.reportUpdate(UpdateType.Start);
    // Get the first one now
    get(session)
      .then(sample => {
      if (sample) {
        this.reportUpdate(UpdateType.Sample, sample);
      }
    })
      .catch(error => {
      this.reportError(error);
    });
    // And set up a periodic polling
    // function to keep it up to date.
    this.intervalHandle = setInterval(() => {
      get(session)
        .then(sample => {
        if (sample) {
          this.reportUpdate(UpdateType.Sample, sample);
        }
      })
        .catch(error => {
        this.reportError(error);
      });
    }, refreshInterval);
  }
  /**
   * Stop the retrieval of load average data.
   */
  stop() {
    if (!this.intervalHandle) {
      return; // Nothing to stop.
    }
    // Stop the polling
    if (this.intervalHandle) {
      clearInterval(this.intervalHandle);
      this.intervalHandle = null;
    }
    // Cancel any intransit requests
    abort();
  }
}
const LoadAverageSampler = new LoadAverageSamplerController();

const cpLoadAveragesCss = ":root{--cp-font-weight-semi-bold:600}:host{display:block;color:var(--cp-primary-text)}th,td{padding-top:0;padding-bottom:0;padding-left:var(--cp-spacer-1);padding-right:var(--cp-spacer-1);text-align:center;font-weight:100}table.inverse td{font-weight:400}th,td{padding-top:0;padding-bottom:0;padding-left:var(--cp-spacer-1);padding-right:var(--cp-spacer-1);text-align:center}th{font-weight:400}td{font-weight:100}.ri-arrow-up-line{color:var(--cp-error-color)}.ri-arrow-down-line{color:var(--cp-information-color)}.ri-rest-time-line{color:var(--cp-information-color)}.border-up{border-radius:50%;background:var(--cp-header-background);position:relative;top:2px;font-size:15px;line-height:15px}.border-down{border-radius:50%;background:var(--cp-header-background);position:relative;top:2px;font-size:15px;line-height:15px}.border-idle{border-radius:50%;background:var(--cp-header-background);position:relative;top:2px;font-size:15px;line-height:15px;border:0.1px solid var(--cp-header-background)}.nan{display:inline-block;padding-left:4px;padding-right:4px}th{font-weight:400}.ri-arrow-up-line{color:var(--cp-error-color)}.ri-arrow-down-line{color:var(--cp-information-color)}.ri-rest-time-line{color:var(--cp-information-color)}.border-up{border-radius:50%;background:var(--cp-header-background);position:relative;top:2px;font-size:15px;line-height:15px}.border-down{border-radius:50%;background:var(--cp-header-background);position:relative;top:2px;font-size:15px;line-height:15px}.border-idle{border-radius:50%;background:var(--cp-header-background);position:relative;top:2px;font-size:15px;line-height:15px;border:0.1px solid var(--cp-header-background)}";

const locale$o = getLocaleInstance();
var Trend;
(function (Trend) {
  Trend[Trend["Unknown"] = 0] = "Unknown";
  Trend[Trend["Idle"] = 1] = "Idle";
  Trend[Trend["Up"] = 2] = "Up";
  Trend[Trend["Down"] = 3] = "Down";
  Trend[Trend["SettlingFromTransientPeak"] = 4] = "SettlingFromTransientPeak";
  Trend[Trend["SettlingFromTransientLow"] = 5] = "SettlingFromTransientLow";
})(Trend || (Trend = {}));
const CpLoadAverages$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
    /**
     * Inverts the font color scheme for high contrast on dark backgrounds.
     */
    this.inverse = false;
    /**
     * Show the header section of the control. Defaults to false.
     */
    this.showHeader = false;
    /**
     * Show the loading panel of the control when the control is intially loading. Defaults to false.
     */
    this.showLoading = false;
    /**
     * When `verbose` is true, the control renders the expanded control with the lable row, stat row and the trend row. When its false, the control renders in a single condensed stats row.
     */
    this.verbose = false;
    /**
     * True when the control is initially loading, false otherwise. When true if showLoading is also true, the loading row will show.
     */
    this.isLoading = true;
  }
  updateSampleHandler(event) {
    this.error = undefined;
    this.isLoading = false;
    this.last = this.current;
    this.current = event.detail;
  }
  samplingErrorHandler(event) {
    this.isLoading = false;
    this.error = event.detail;
  }
  startSamplingHandler() {
    this.error = undefined;
    this.isLoading = true;
  }
  /**
   * This component relies on the Remix Icon font, and we have decided that that dependency
   * should be handled externally because icons are needed in many places and we may not always
   * want to employ this web component to use them.
   *
   * Additionally, @font-face definitions don't currently function when defined within web
   * components without dynamically adding the link tag to the <head> via JavaScript, so
   * cloning an existing tag is the best solution available to us at this time.
   *
   * https://bugs.chromium.org/p/chromium/issues/detail?id=336876
   * https://github.com/ionic-team/stencil/issues/2072#issuecomment-588465875
   * https://github.com/ionic-team/stencil/issues/1875#issuecomment-602720766
   * https://stackoverflow.com/questions/60504404/how-to-use-material-design-icons-in-a-web-component
   */
  reuseExternalStylesheet() {
    var _a;
    const externalStylesheet = document.getElementById("custom-fonts-stylesheet");
    if (externalStylesheet) {
      (_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.appendChild(externalStylesheet.cloneNode());
      return;
    }
    console.warn("cp-load-averages: Failed to find the link tag with ID 'custom-fonts-stylesheet'");
  }
  /**
   * Conditionally render the loading panel.
   */
  renderLoadingRow() {
    if (this.showLoading && this.isLoading) {
      return (h("tr", null, h("td", { colSpan: 3, class: "lavg_loading", id: `${this.host.id}-ldavg-loading` }, locale$o.maketext("Loading…"))));
    }
  }
  /**
   * Conditionally render the header.
   */
  renderHeaderRow() {
    if (this.showHeader && !this.error) {
      return (h("tr", null, h("th", null, "1 min"), h("th", null, "5 min"), h("th", null, "15 min")));
    }
  }
  /**
   * Generate a statistics output.
   *
   * @param number The number to output.
   */
  formatStat(number) {
    return this.error ? h("span", { class: "nan" }, "\u2015") : number.toFixed(2);
  }
  /**
   * Render the averages
   */
  renderAveragesRow() {
    if (this.current) {
      return (h("tr", null, !this.verbose && !this.error ? this.renderTrend() : "", h("td", { id: `${this.host.id}-one` }, this.formatStat(this.current.one)), h("td", { id: `${this.host.id}-five` }, this.formatStat(this.current.five)), h("td", { id: `${this.host.id}-fifteen` }, this.formatStat(this.current.fifteen))));
    }
  }
  /**
   * Calcualte what trend is present in the sample data.
   *
   * @param current The current sample if any.
   * @param last The previous sample if any.
   * @returns The observed trend.
   */
  calculateTrend(current, last) {
    if (!current || !last) {
      return Trend.Unknown;
    }
    if (current.one === 0.0) {
      return Trend.Idle;
    }
    else if (current.one > current.five || current.one > current.fifteen) {
      // Trending up
      if (current.one >= last.one) {
        return Trend.Up;
      }
      else {
        // but returning to the long term average
        return Trend.SettlingFromTransientPeak;
      }
    }
    else if (current.one < current.five || current.one < current.fifteen) {
      // Trending down
      if (current.one <= last.one) {
        return Trend.Down;
      }
      else {
        // but returning to the long term average
        return Trend.SettlingFromTransientLow;
      }
    }
    return Trend.Unknown;
  }
  /**
   * Lookup the message to describe the trend.
   *
   * @param trend The current observed trend in the sample data.
   * @returns The message.
   */
  trendMessage(trend) {
    switch (trend) {
      case Trend.Idle:
        return locale$o.maketext("System Idle[comment, This needs to stay as short as possible so it fits in the narrow panel without wrapping]");
      case Trend.Up:
        return locale$o.maketext("Load Trending Up[comment, This needs to stay as short as possible so it fits in the narrow panel without wrapping]");
      case Trend.Down:
        return locale$o.maketext("Load Trending Down[comment, This needs to stay as short as possible so it fits in the narrow panel without wrapping]");
      case Trend.SettlingFromTransientLow:
        return locale$o.maketext("Load Decline Settling[comment, This needs to stay as short as possible so it fits in the narrow panel without wrapping]");
      case Trend.SettlingFromTransientPeak:
        return locale$o.maketext("Load Spike Settling[comment, This needs to stay as short as possible so it fits in the narrow panel without wrapping]");
    }
    return "";
  }
  /**
   * Lookup the icon to visually represent the currently observed trend in the samples.
   *
   * @param trend The current observed trend in the sample data.
   * @returns The font icon name.
   */
  trendIcon(trend) {
    switch (trend) {
      case Trend.Up:
        return "ri-arrow-up-line";
      case Trend.Down:
        return "ri-arrow-down-line";
      case Trend.SettlingFromTransientLow:
        return "ri-arrow-down-line";
      case Trend.SettlingFromTransientPeak:
        return "ri-arrow-up-line";
      case Trend.Idle:
        return "ri-rest-time-line";
      default:
        return "";
    }
  }
  /**
   * Lookup the border class to make trend easier to see in inverse mode.
   *
   * @param trend The current observed trend in the sample data.
   * @returns The border class name.
   */
  trendIconBorder(trend) {
    switch (trend) {
      case Trend.Up:
        return " border-up";
      case Trend.Down:
        return " border-down";
      case Trend.SettlingFromTransientLow:
        return " border-down";
      case Trend.SettlingFromTransientPeak:
        return " border-up";
      case Trend.Idle:
        return " border-idle";
      default:
        return "";
    }
  }
  /**
   * Lookup the unique id for the currently observed trend. This is
   * primarily so QA can identify which trend is showing without depending
   * on the human readable strings.
   *
   * @param trend The current observed trend in the sample data.
   * @returns The message.
   */
  trendId(trend) {
    switch (trend) {
      case Trend.Up:
        return `${this.host.id}-increasing`;
      case Trend.Down:
        return `${this.host.id}-decreasing`;
      case Trend.SettlingFromTransientLow:
        return `${this.host.id}-settling_from_down`;
      case Trend.SettlingFromTransientPeak:
        return `${this.host.id}-settling_from_up`;
      case Trend.Idle:
        return `${this.host.id}-idle`;
      default:
        return "";
    }
  }
  /**
   * Render the trend row.
   */
  renderTrendRow() {
    if (this.verbose && !this.error) {
      let trend = this.calculateTrend(this.current, this.last);
      if (trend === Trend.Unknown) {
        return;
      }
      return h("tr", null, this.renderTrend(trend));
    }
  }
  /**
   * Render the trend.
   *
   * @param trend - the current trend. Will auto populate is not passed.
   */
  renderTrend(trend) {
    trend || (trend = this.calculateTrend(this.current, this.last));
    if (trend === Trend.Unknown) {
      return;
    }
    let message = this.trendMessage(trend);
    let attributes = {};
    if (!this.verbose) {
      attributes["title"] = message;
    }
    else {
      attributes["colSpan"] = 3;
    }
    return (h("td", Object.assign({}, attributes), h("span", { id: this.trendId(trend) }, h("i", { class: this.trendIcon(trend) + (this.inverse ? this.trendIconBorder(trend) : ""), "aria-hidden": "true" }), this.verbose ? this.trendMessage(trend) : "")));
  }
  /**
   * Lifecycle Hook: render
   * Render the component.
   */
  render() {
    return (h(Host, null, h("cp-dir", null, h("table", { class: this.inverse ? "inverse" : "" }, h("tbody", null, this.renderLoadingRow(), this.renderHeaderRow(), this.renderAveragesRow(), this.renderTrendRow())))));
  }
  /**
   * Lifecycle Hook: componentWillLoad
   * We load the font library before the component renders.
   */
  componentWillLoad() {
    this.reuseExternalStylesheet();
  }
  /**
   * Lifecycle Hook: componentDidRender
   * After the initial render, the trigger loading banner if applicable and start the Load Average sampling.
   */
  componentDidRender() {
    LoadAverageSampler.start();
  }
  get host() { return this; }
  static get style() { return cpLoadAveragesCss; }
};

var Config = {
    DEBUG: false,
    LIB_VERSION: '2.49.0'
};

// since es6 imports are static and we run unit tests from the console, window won't be defined when importing this file
var window$1;
if (typeof(window) === 'undefined') {
    var loc = {
        hostname: ''
    };
    window$1 = {
        navigator: { userAgent: '' },
        document: {
            location: loc,
            referrer: ''
        },
        screen: { width: 0, height: 0 },
        location: loc
    };
} else {
    window$1 = window;
}

/*
 * Saved references to long variable names, so that closure compiler can
 * minimize file size.
 */

var ArrayProto = Array.prototype;
var FuncProto = Function.prototype;
var ObjProto = Object.prototype;
var slice = ArrayProto.slice;
var toString = ObjProto.toString;
var hasOwnProperty = ObjProto.hasOwnProperty;
var windowConsole = window$1.console;
var navigator = window$1.navigator;
var document$1 = window$1.document;
var windowOpera = window$1.opera;
var screen = window$1.screen;
var userAgent = navigator.userAgent;
var nativeBind = FuncProto.bind;
var nativeForEach = ArrayProto.forEach;
var nativeIndexOf = ArrayProto.indexOf;
var nativeMap = ArrayProto.map;
var nativeIsArray = Array.isArray;
var breaker = {};
var _ = {
    trim: function(str) {
        // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill
        return str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
    }
};

// Console override
var console$1 = {
    /** @type {function(...*)} */
    log: function() {
        if (Config.DEBUG && !_.isUndefined(windowConsole) && windowConsole) {
            try {
                windowConsole.log.apply(windowConsole, arguments);
            } catch (err) {
                _.each(arguments, function(arg) {
                    windowConsole.log(arg);
                });
            }
        }
    },
    /** @type {function(...*)} */
    warn: function() {
        if (Config.DEBUG && !_.isUndefined(windowConsole) && windowConsole) {
            var args = ['Mixpanel warning:'].concat(_.toArray(arguments));
            try {
                windowConsole.warn.apply(windowConsole, args);
            } catch (err) {
                _.each(args, function(arg) {
                    windowConsole.warn(arg);
                });
            }
        }
    },
    /** @type {function(...*)} */
    error: function() {
        if (Config.DEBUG && !_.isUndefined(windowConsole) && windowConsole) {
            var args = ['Mixpanel error:'].concat(_.toArray(arguments));
            try {
                windowConsole.error.apply(windowConsole, args);
            } catch (err) {
                _.each(args, function(arg) {
                    windowConsole.error(arg);
                });
            }
        }
    },
    /** @type {function(...*)} */
    critical: function() {
        if (!_.isUndefined(windowConsole) && windowConsole) {
            var args = ['Mixpanel error:'].concat(_.toArray(arguments));
            try {
                windowConsole.error.apply(windowConsole, args);
            } catch (err) {
                _.each(args, function(arg) {
                    windowConsole.error(arg);
                });
            }
        }
    }
};

var log_func_with_prefix = function(func, prefix) {
    return function() {
        arguments[0] = '[' + prefix + '] ' + arguments[0];
        return func.apply(console$1, arguments);
    };
};
var console_with_prefix = function(prefix) {
    return {
        log: log_func_with_prefix(console$1.log, prefix),
        error: log_func_with_prefix(console$1.error, prefix),
        critical: log_func_with_prefix(console$1.critical, prefix)
    };
};


// UNDERSCORE
// Embed part of the Underscore Library
_.bind = function(func, context) {
    var args, bound;
    if (nativeBind && func.bind === nativeBind) {
        return nativeBind.apply(func, slice.call(arguments, 1));
    }
    if (!_.isFunction(func)) {
        throw new TypeError();
    }
    args = slice.call(arguments, 2);
    bound = function() {
        if (!(this instanceof bound)) {
            return func.apply(context, args.concat(slice.call(arguments)));
        }
        var ctor = {};
        ctor.prototype = func.prototype;
        var self = new ctor();
        ctor.prototype = null;
        var result = func.apply(self, args.concat(slice.call(arguments)));
        if (Object(result) === result) {
            return result;
        }
        return self;
    };
    return bound;
};

/**
 * @param {*=} obj
 * @param {function(...*)=} iterator
 * @param {Object=} context
 */
_.each = function(obj, iterator, context) {
    if (obj === null || obj === undefined) {
        return;
    }
    if (nativeForEach && obj.forEach === nativeForEach) {
        obj.forEach(iterator, context);
    } else if (obj.length === +obj.length) {
        for (var i = 0, l = obj.length; i < l; i++) {
            if (i in obj && iterator.call(context, obj[i], i, obj) === breaker) {
                return;
            }
        }
    } else {
        for (var key in obj) {
            if (hasOwnProperty.call(obj, key)) {
                if (iterator.call(context, obj[key], key, obj) === breaker) {
                    return;
                }
            }
        }
    }
};

_.extend = function(obj) {
    _.each(slice.call(arguments, 1), function(source) {
        for (var prop in source) {
            if (source[prop] !== void 0) {
                obj[prop] = source[prop];
            }
        }
    });
    return obj;
};

_.isArray = nativeIsArray || function(obj) {
    return toString.call(obj) === '[object Array]';
};

// from a comment on http://dbj.org/dbj/?p=286
// fails on only one very rare and deliberate custom object:
// var bomb = { toString : undefined, valueOf: function(o) { return "function BOMBA!"; }};
_.isFunction = function(f) {
    try {
        return /^\s*\bfunction\b/.test(f);
    } catch (x) {
        return false;
    }
};

_.isArguments = function(obj) {
    return !!(obj && hasOwnProperty.call(obj, 'callee'));
};

_.toArray = function(iterable) {
    if (!iterable) {
        return [];
    }
    if (iterable.toArray) {
        return iterable.toArray();
    }
    if (_.isArray(iterable)) {
        return slice.call(iterable);
    }
    if (_.isArguments(iterable)) {
        return slice.call(iterable);
    }
    return _.values(iterable);
};

_.map = function(arr, callback, context) {
    if (nativeMap && arr.map === nativeMap) {
        return arr.map(callback, context);
    } else {
        var results = [];
        _.each(arr, function(item) {
            results.push(callback.call(context, item));
        });
        return results;
    }
};

_.keys = function(obj) {
    var results = [];
    if (obj === null) {
        return results;
    }
    _.each(obj, function(value, key) {
        results[results.length] = key;
    });
    return results;
};

_.values = function(obj) {
    var results = [];
    if (obj === null) {
        return results;
    }
    _.each(obj, function(value) {
        results[results.length] = value;
    });
    return results;
};

_.include = function(obj, target) {
    var found = false;
    if (obj === null) {
        return found;
    }
    if (nativeIndexOf && obj.indexOf === nativeIndexOf) {
        return obj.indexOf(target) != -1;
    }
    _.each(obj, function(value) {
        if (found || (found = (value === target))) {
            return breaker;
        }
    });
    return found;
};

_.includes = function(str, needle) {
    return str.indexOf(needle) !== -1;
};

// Underscore Addons
_.inherit = function(subclass, superclass) {
    subclass.prototype = new superclass();
    subclass.prototype.constructor = subclass;
    subclass.superclass = superclass.prototype;
    return subclass;
};

_.isObject = function(obj) {
    return (obj === Object(obj) && !_.isArray(obj));
};

_.isEmptyObject = function(obj) {
    if (_.isObject(obj)) {
        for (var key in obj) {
            if (hasOwnProperty.call(obj, key)) {
                return false;
            }
        }
        return true;
    }
    return false;
};

_.isUndefined = function(obj) {
    return obj === void 0;
};

_.isString = function(obj) {
    return toString.call(obj) == '[object String]';
};

_.isDate = function(obj) {
    return toString.call(obj) == '[object Date]';
};

_.isNumber = function(obj) {
    return toString.call(obj) == '[object Number]';
};

_.isElement = function(obj) {
    return !!(obj && obj.nodeType === 1);
};

_.encodeDates = function(obj) {
    _.each(obj, function(v, k) {
        if (_.isDate(v)) {
            obj[k] = _.formatDate(v);
        } else if (_.isObject(v)) {
            obj[k] = _.encodeDates(v); // recurse
        }
    });
    return obj;
};

_.timestamp = function() {
    Date.now = Date.now || function() {
        return +new Date;
    };
    return Date.now();
};

_.formatDate = function(d) {
    // YYYY-MM-DDTHH:MM:SS in UTC
    function pad(n) {
        return n < 10 ? '0' + n : n;
    }
    return d.getUTCFullYear() + '-' +
        pad(d.getUTCMonth() + 1) + '-' +
        pad(d.getUTCDate()) + 'T' +
        pad(d.getUTCHours()) + ':' +
        pad(d.getUTCMinutes()) + ':' +
        pad(d.getUTCSeconds());
};

_.strip_empty_properties = function(p) {
    var ret = {};
    _.each(p, function(v, k) {
        if (_.isString(v) && v.length > 0) {
            ret[k] = v;
        }
    });
    return ret;
};

/*
 * this function returns a copy of object after truncating it.  If
 * passed an Array or Object it will iterate through obj and
 * truncate all the values recursively.
 */
_.truncate = function(obj, length) {
    var ret;

    if (typeof(obj) === 'string') {
        ret = obj.slice(0, length);
    } else if (_.isArray(obj)) {
        ret = [];
        _.each(obj, function(val) {
            ret.push(_.truncate(val, length));
        });
    } else if (_.isObject(obj)) {
        ret = {};
        _.each(obj, function(val, key) {
            ret[key] = _.truncate(val, length);
        });
    } else {
        ret = obj;
    }

    return ret;
};

_.JSONEncode = (function() {
    return function(mixed_val) {
        var value = mixed_val;
        var quote = function(string) {
            var escapable = /[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; // eslint-disable-line no-control-regex
            var meta = { // table of character substitutions
                '\b': '\\b',
                '\t': '\\t',
                '\n': '\\n',
                '\f': '\\f',
                '\r': '\\r',
                '"': '\\"',
                '\\': '\\\\'
            };

            escapable.lastIndex = 0;
            return escapable.test(string) ?
                '"' + string.replace(escapable, function(a) {
                    var c = meta[a];
                    return typeof c === 'string' ? c :
                        '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
                }) + '"' :
                '"' + string + '"';
        };

        var str = function(key, holder) {
            var gap = '';
            var indent = '    ';
            var i = 0; // The loop counter.
            var k = ''; // The member key.
            var v = ''; // The member value.
            var length = 0;
            var mind = gap;
            var partial = [];
            var value = holder[key];

            // If the value has a toJSON method, call it to obtain a replacement value.
            if (value && typeof value === 'object' &&
                typeof value.toJSON === 'function') {
                value = value.toJSON(key);
            }

            // What happens next depends on the value's type.
            switch (typeof value) {
                case 'string':
                    return quote(value);

                case 'number':
                    // JSON numbers must be finite. Encode non-finite numbers as null.
                    return isFinite(value) ? String(value) : 'null';

                case 'boolean':
                case 'null':
                    // If the value is a boolean or null, convert it to a string. Note:
                    // typeof null does not produce 'null'. The case is included here in
                    // the remote chance that this gets fixed someday.

                    return String(value);

                case 'object':
                    // If the type is 'object', we might be dealing with an object or an array or
                    // null.
                    // Due to a specification blunder in ECMAScript, typeof null is 'object',
                    // so watch out for that case.
                    if (!value) {
                        return 'null';
                    }

                    // Make an array to hold the partial results of stringifying this object value.
                    gap += indent;
                    partial = [];

                    // Is the value an array?
                    if (toString.apply(value) === '[object Array]') {
                        // The value is an array. Stringify every element. Use null as a placeholder
                        // for non-JSON values.

                        length = value.length;
                        for (i = 0; i < length; i += 1) {
                            partial[i] = str(i, value) || 'null';
                        }

                        // Join all of the elements together, separated with commas, and wrap them in
                        // brackets.
                        v = partial.length === 0 ? '[]' :
                            gap ? '[\n' + gap +
                            partial.join(',\n' + gap) + '\n' +
                            mind + ']' :
                                '[' + partial.join(',') + ']';
                        gap = mind;
                        return v;
                    }

                    // Iterate through all of the keys in the object.
                    for (k in value) {
                        if (hasOwnProperty.call(value, k)) {
                            v = str(k, value);
                            if (v) {
                                partial.push(quote(k) + (gap ? ': ' : ':') + v);
                            }
                        }
                    }

                    // Join all of the member texts together, separated with commas,
                    // and wrap them in braces.
                    v = partial.length === 0 ? '{}' :
                        gap ? '{' + partial.join(',') + '' +
                        mind + '}' : '{' + partial.join(',') + '}';
                    gap = mind;
                    return v;
            }
        };

        // Make a fake root object containing our value under the key of ''.
        // Return the result of stringifying the value.
        return str('', {
            '': value
        });
    };
})();

/**
 * From https://github.com/douglascrockford/JSON-js/blob/master/json_parse.js
 * Slightly modified to throw a real Error rather than a POJO
 */
_.JSONDecode = (function() {
    var at, // The index of the current character
        ch, // The current character
        escapee = {
            '"': '"',
            '\\': '\\',
            '/': '/',
            'b': '\b',
            'f': '\f',
            'n': '\n',
            'r': '\r',
            't': '\t'
        },
        text,
        error = function(m) {
            var e = new SyntaxError(m);
            e.at = at;
            e.text = text;
            throw e;
        },
        next = function(c) {
            // If a c parameter is provided, verify that it matches the current character.
            if (c && c !== ch) {
                error('Expected \'' + c + '\' instead of \'' + ch + '\'');
            }
            // Get the next character. When there are no more characters,
            // return the empty string.
            ch = text.charAt(at);
            at += 1;
            return ch;
        },
        number = function() {
            // Parse a number value.
            var number,
                string = '';

            if (ch === '-') {
                string = '-';
                next('-');
            }
            while (ch >= '0' && ch <= '9') {
                string += ch;
                next();
            }
            if (ch === '.') {
                string += '.';
                while (next() && ch >= '0' && ch <= '9') {
                    string += ch;
                }
            }
            if (ch === 'e' || ch === 'E') {
                string += ch;
                next();
                if (ch === '-' || ch === '+') {
                    string += ch;
                    next();
                }
                while (ch >= '0' && ch <= '9') {
                    string += ch;
                    next();
                }
            }
            number = +string;
            if (!isFinite(number)) {
                error('Bad number');
            } else {
                return number;
            }
        },

        string = function() {
            // Parse a string value.
            var hex,
                i,
                string = '',
                uffff;
            // When parsing for string values, we must look for " and \ characters.
            if (ch === '"') {
                while (next()) {
                    if (ch === '"') {
                        next();
                        return string;
                    }
                    if (ch === '\\') {
                        next();
                        if (ch === 'u') {
                            uffff = 0;
                            for (i = 0; i < 4; i += 1) {
                                hex = parseInt(next(), 16);
                                if (!isFinite(hex)) {
                                    break;
                                }
                                uffff = uffff * 16 + hex;
                            }
                            string += String.fromCharCode(uffff);
                        } else if (typeof escapee[ch] === 'string') {
                            string += escapee[ch];
                        } else {
                            break;
                        }
                    } else {
                        string += ch;
                    }
                }
            }
            error('Bad string');
        },
        white = function() {
            // Skip whitespace.
            while (ch && ch <= ' ') {
                next();
            }
        },
        word = function() {
            // true, false, or null.
            switch (ch) {
                case 't':
                    next('t');
                    next('r');
                    next('u');
                    next('e');
                    return true;
                case 'f':
                    next('f');
                    next('a');
                    next('l');
                    next('s');
                    next('e');
                    return false;
                case 'n':
                    next('n');
                    next('u');
                    next('l');
                    next('l');
                    return null;
            }
            error('Unexpected "' + ch + '"');
        },
        value, // Placeholder for the value function.
        array = function() {
            // Parse an array value.
            var array = [];

            if (ch === '[') {
                next('[');
                white();
                if (ch === ']') {
                    next(']');
                    return array; // empty array
                }
                while (ch) {
                    array.push(value());
                    white();
                    if (ch === ']') {
                        next(']');
                        return array;
                    }
                    next(',');
                    white();
                }
            }
            error('Bad array');
        },
        object = function() {
            // Parse an object value.
            var key,
                object = {};

            if (ch === '{') {
                next('{');
                white();
                if (ch === '}') {
                    next('}');
                    return object; // empty object
                }
                while (ch) {
                    key = string();
                    white();
                    next(':');
                    if (Object.hasOwnProperty.call(object, key)) {
                        error('Duplicate key "' + key + '"');
                    }
                    object[key] = value();
                    white();
                    if (ch === '}') {
                        next('}');
                        return object;
                    }
                    next(',');
                    white();
                }
            }
            error('Bad object');
        };

    value = function() {
        // Parse a JSON value. It could be an object, an array, a string,
        // a number, or a word.
        white();
        switch (ch) {
            case '{':
                return object();
            case '[':
                return array();
            case '"':
                return string();
            case '-':
                return number();
            default:
                return ch >= '0' && ch <= '9' ? number() : word();
        }
    };

    // Return the json_parse function. It will have access to all of the
    // above functions and variables.
    return function(source) {
        var result;

        text = source;
        at = 0;
        ch = ' ';
        result = value();
        white();
        if (ch) {
            error('Syntax error');
        }

        return result;
    };
})();

_.base64Encode = function(data) {
    var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
    var o1, o2, o3, h1, h2, h3, h4, bits, i = 0,
        ac = 0,
        enc = '',
        tmp_arr = [];

    if (!data) {
        return data;
    }

    data = _.utf8Encode(data);

    do { // pack three octets into four hexets
        o1 = data.charCodeAt(i++);
        o2 = data.charCodeAt(i++);
        o3 = data.charCodeAt(i++);

        bits = o1 << 16 | o2 << 8 | o3;

        h1 = bits >> 18 & 0x3f;
        h2 = bits >> 12 & 0x3f;
        h3 = bits >> 6 & 0x3f;
        h4 = bits & 0x3f;

        // use hexets to index into b64, and append result to encoded string
        tmp_arr[ac++] = b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4);
    } while (i < data.length);

    enc = tmp_arr.join('');

    switch (data.length % 3) {
        case 1:
            enc = enc.slice(0, -2) + '==';
            break;
        case 2:
            enc = enc.slice(0, -1) + '=';
            break;
    }

    return enc;
};

_.utf8Encode = function(string) {
    string = (string + '').replace(/\r\n/g, '\n').replace(/\r/g, '\n');

    var utftext = '',
        start,
        end;
    var stringl = 0,
        n;

    start = end = 0;
    stringl = string.length;

    for (n = 0; n < stringl; n++) {
        var c1 = string.charCodeAt(n);
        var enc = null;

        if (c1 < 128) {
            end++;
        } else if ((c1 > 127) && (c1 < 2048)) {
            enc = String.fromCharCode((c1 >> 6) | 192, (c1 & 63) | 128);
        } else {
            enc = String.fromCharCode((c1 >> 12) | 224, ((c1 >> 6) & 63) | 128, (c1 & 63) | 128);
        }
        if (enc !== null) {
            if (end > start) {
                utftext += string.substring(start, end);
            }
            utftext += enc;
            start = end = n + 1;
        }
    }

    if (end > start) {
        utftext += string.substring(start, string.length);
    }

    return utftext;
};

_.UUID = (function() {

    // Time-based entropy
    var T = function() {
        var time = 1 * new Date(); // cross-browser version of Date.now()
        var ticks;
        if (window$1.performance && window$1.performance.now) {
            ticks = window$1.performance.now();
        } else {
            // fall back to busy loop
            ticks = 0;

            // this while loop figures how many browser ticks go by
            // before 1*new Date() returns a new number, ie the amount
            // of ticks that go by per millisecond
            while (time == 1 * new Date()) {
                ticks++;
            }
        }
        return time.toString(16) + Math.floor(ticks).toString(16);
    };

    // Math.Random entropy
    var R = function() {
        return Math.random().toString(16).replace('.', '');
    };

    // User agent entropy
    // This function takes the user agent string, and then xors
    // together each sequence of 8 bytes.  This produces a final
    // sequence of 8 bytes which it returns as hex.
    var UA = function() {
        var ua = userAgent,
            i, ch, buffer = [],
            ret = 0;

        function xor(result, byte_array) {
            var j, tmp = 0;
            for (j = 0; j < byte_array.length; j++) {
                tmp |= (buffer[j] << j * 8);
            }
            return result ^ tmp;
        }

        for (i = 0; i < ua.length; i++) {
            ch = ua.charCodeAt(i);
            buffer.unshift(ch & 0xFF);
            if (buffer.length >= 4) {
                ret = xor(ret, buffer);
                buffer = [];
            }
        }

        if (buffer.length > 0) {
            ret = xor(ret, buffer);
        }

        return ret.toString(16);
    };

    return function() {
        var se = (screen.height * screen.width).toString(16);
        return (T() + '-' + R() + '-' + UA() + '-' + se + '-' + T());
    };
})();

// _.isBlockedUA()
// This is to block various web spiders from executing our JS and
// sending false tracking data
var BLOCKED_UA_STRS = [
    'ahrefsbot',
    'ahrefssiteaudit',
    'baiduspider',
    'bingbot',
    'bingpreview',
    'chrome-lighthouse',
    'facebookexternal',
    'petalbot',
    'pinterest',
    'screaming frog',
    'yahoo! slurp',
    'yandexbot',

    // a whole bunch of goog-specific crawlers
    // https://developers.google.com/search/docs/advanced/crawling/overview-google-crawlers
    'adsbot-google',
    'apis-google',
    'duplexweb-google',
    'feedfetcher-google',
    'google favicon',
    'google web preview',
    'google-read-aloud',
    'googlebot',
    'googleweblight',
    'mediapartners-google',
    'storebot-google'
];
_.isBlockedUA = function(ua) {
    var i;
    ua = ua.toLowerCase();
    for (i = 0; i < BLOCKED_UA_STRS.length; i++) {
        if (ua.indexOf(BLOCKED_UA_STRS[i]) !== -1) {
            return true;
        }
    }
    return false;
};

/**
 * @param {Object=} formdata
 * @param {string=} arg_separator
 */
_.HTTPBuildQuery = function(formdata, arg_separator) {
    var use_val, use_key, tmp_arr = [];

    if (_.isUndefined(arg_separator)) {
        arg_separator = '&';
    }

    _.each(formdata, function(val, key) {
        use_val = encodeURIComponent(val.toString());
        use_key = encodeURIComponent(key);
        tmp_arr[tmp_arr.length] = use_key + '=' + use_val;
    });

    return tmp_arr.join(arg_separator);
};

_.getQueryParam = function(url, param) {
    // Expects a raw URL

    param = param.replace(/[[]/, '\\[').replace(/[\]]/, '\\]');
    var regexS = '[\\?&]' + param + '=([^&#]*)',
        regex = new RegExp(regexS),
        results = regex.exec(url);
    if (results === null || (results && typeof(results[1]) !== 'string' && results[1].length)) {
        return '';
    } else {
        var result = results[1];
        try {
            result = decodeURIComponent(result);
        } catch(err) {
            console$1.error('Skipping decoding for malformed query param: ' + result);
        }
        return result.replace(/\+/g, ' ');
    }
};


// _.cookie
// Methods partially borrowed from quirksmode.org/js/cookies.html
_.cookie = {
    get: function(name) {
        var nameEQ = name + '=';
        var ca = document$1.cookie.split(';');
        for (var i = 0; i < ca.length; i++) {
            var c = ca[i];
            while (c.charAt(0) == ' ') {
                c = c.substring(1, c.length);
            }
            if (c.indexOf(nameEQ) === 0) {
                return decodeURIComponent(c.substring(nameEQ.length, c.length));
            }
        }
        return null;
    },

    parse: function(name) {
        var cookie;
        try {
            cookie = _.JSONDecode(_.cookie.get(name)) || {};
        } catch (err) {
            // noop
        }
        return cookie;
    },

    set_seconds: function(name, value, seconds, is_cross_subdomain, is_secure, is_cross_site, domain_override) {
        var cdomain = '',
            expires = '',
            secure = '';

        if (domain_override) {
            cdomain = '; domain=' + domain_override;
        } else if (is_cross_subdomain) {
            var domain = extract_domain(document$1.location.hostname);
            cdomain = domain ? '; domain=.' + domain : '';
        }

        if (seconds) {
            var date = new Date();
            date.setTime(date.getTime() + (seconds * 1000));
            expires = '; expires=' + date.toGMTString();
        }

        if (is_cross_site) {
            is_secure = true;
            secure = '; SameSite=None';
        }
        if (is_secure) {
            secure += '; secure';
        }

        document$1.cookie = name + '=' + encodeURIComponent(value) + expires + '; path=/' + cdomain + secure;
    },

    set: function(name, value, days, is_cross_subdomain, is_secure, is_cross_site, domain_override) {
        var cdomain = '', expires = '', secure = '';

        if (domain_override) {
            cdomain = '; domain=' + domain_override;
        } else if (is_cross_subdomain) {
            var domain = extract_domain(document$1.location.hostname);
            cdomain = domain ? '; domain=.' + domain : '';
        }

        if (days) {
            var date = new Date();
            date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
            expires = '; expires=' + date.toGMTString();
        }

        if (is_cross_site) {
            is_secure = true;
            secure = '; SameSite=None';
        }
        if (is_secure) {
            secure += '; secure';
        }

        var new_cookie_val = name + '=' + encodeURIComponent(value) + expires + '; path=/' + cdomain + secure;
        document$1.cookie = new_cookie_val;
        return new_cookie_val;
    },

    remove: function(name, is_cross_subdomain, domain_override) {
        _.cookie.set(name, '', -1, is_cross_subdomain, false, false, domain_override);
    }
};

var _localStorageSupported = null;
var localStorageSupported = function(storage, forceCheck) {
    if (_localStorageSupported !== null && !forceCheck) {
        return _localStorageSupported;
    }

    var supported = true;
    try {
        storage = storage || window.localStorage;
        var key = '__mplss_' + cheap_guid(8),
            val = 'xyz';
        storage.setItem(key, val);
        if (storage.getItem(key) !== val) {
            supported = false;
        }
        storage.removeItem(key);
    } catch (err) {
        supported = false;
    }

    _localStorageSupported = supported;
    return supported;
};

// _.localStorage
_.localStorage = {
    is_supported: function(force_check) {
        var supported = localStorageSupported(null, force_check);
        if (!supported) {
            console$1.error('localStorage unsupported; falling back to cookie store');
        }
        return supported;
    },

    error: function(msg) {
        console$1.error('localStorage error: ' + msg);
    },

    get: function(name) {
        try {
            return window.localStorage.getItem(name);
        } catch (err) {
            _.localStorage.error(err);
        }
        return null;
    },

    parse: function(name) {
        try {
            return _.JSONDecode(_.localStorage.get(name)) || {};
        } catch (err) {
            // noop
        }
        return null;
    },

    set: function(name, value) {
        try {
            window.localStorage.setItem(name, value);
        } catch (err) {
            _.localStorage.error(err);
        }
    },

    remove: function(name) {
        try {
            window.localStorage.removeItem(name);
        } catch (err) {
            _.localStorage.error(err);
        }
    }
};

_.register_event = (function() {
    // written by Dean Edwards, 2005
    // with input from Tino Zijdel - crisp@xs4all.nl
    // with input from Carl Sverre - mail@carlsverre.com
    // with input from Mixpanel
    // http://dean.edwards.name/weblog/2005/10/add-event/
    // https://gist.github.com/1930440

    /**
     * @param {Object} element
     * @param {string} type
     * @param {function(...*)} handler
     * @param {boolean=} oldSchool
     * @param {boolean=} useCapture
     */
    var register_event = function(element, type, handler, oldSchool, useCapture) {
        if (!element) {
            console$1.error('No valid element provided to register_event');
            return;
        }

        if (element.addEventListener && !oldSchool) {
            element.addEventListener(type, handler, !!useCapture);
        } else {
            var ontype = 'on' + type;
            var old_handler = element[ontype]; // can be undefined
            element[ontype] = makeHandler(element, handler, old_handler);
        }
    };

    function makeHandler(element, new_handler, old_handlers) {
        var handler = function(event) {
            event = event || fixEvent(window.event);

            // this basically happens in firefox whenever another script
            // overwrites the onload callback and doesn't pass the event
            // object to previously defined callbacks.  All the browsers
            // that don't define window.event implement addEventListener
            // so the dom_loaded handler will still be fired as usual.
            if (!event) {
                return undefined;
            }

            var ret = true;
            var old_result, new_result;

            if (_.isFunction(old_handlers)) {
                old_result = old_handlers(event);
            }
            new_result = new_handler.call(element, event);

            if ((false === old_result) || (false === new_result)) {
                ret = false;
            }

            return ret;
        };

        return handler;
    }

    function fixEvent(event) {
        if (event) {
            event.preventDefault = fixEvent.preventDefault;
            event.stopPropagation = fixEvent.stopPropagation;
        }
        return event;
    }
    fixEvent.preventDefault = function() {
        this.returnValue = false;
    };
    fixEvent.stopPropagation = function() {
        this.cancelBubble = true;
    };

    return register_event;
})();


var TOKEN_MATCH_REGEX = new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');

_.dom_query = (function() {
    /* document.getElementsBySelector(selector)
    - returns an array of element objects from the current document
    matching the CSS selector. Selectors can contain element names,
    class names and ids and can be nested. For example:

    elements = document.getElementsBySelector('div#main p a.external')

    Will return an array of all 'a' elements with 'external' in their
    class attribute that are contained inside 'p' elements that are
    contained inside the 'div' element which has id="main"

    New in version 0.4: Support for CSS2 and CSS3 attribute selectors:
    See http://www.w3.org/TR/css3-selectors/#attribute-selectors

    Version 0.4 - Simon Willison, March 25th 2003
    -- Works in Phoenix 0.5, Mozilla 1.3, Opera 7, Internet Explorer 6, Internet Explorer 5 on Windows
    -- Opera 7 fails

    Version 0.5 - Carl Sverre, Jan 7th 2013
    -- Now uses jQuery-esque `hasClass` for testing class name
    equality.  This fixes a bug related to '-' characters being
    considered not part of a 'word' in regex.
    */

    function getAllChildren(e) {
        // Returns all children of element. Workaround required for IE5/Windows. Ugh.
        return e.all ? e.all : e.getElementsByTagName('*');
    }

    var bad_whitespace = /[\t\r\n]/g;

    function hasClass(elem, selector) {
        var className = ' ' + selector + ' ';
        return ((' ' + elem.className + ' ').replace(bad_whitespace, ' ').indexOf(className) >= 0);
    }

    function getElementsBySelector(selector) {
        // Attempt to fail gracefully in lesser browsers
        if (!document$1.getElementsByTagName) {
            return [];
        }
        // Split selector in to tokens
        var tokens = selector.split(' ');
        var token, bits, tagName, found, foundCount, i, j, k, elements, currentContextIndex;
        var currentContext = [document$1];
        for (i = 0; i < tokens.length; i++) {
            token = tokens[i].replace(/^\s+/, '').replace(/\s+$/, '');
            if (token.indexOf('#') > -1) {
                // Token is an ID selector
                bits = token.split('#');
                tagName = bits[0];
                var id = bits[1];
                var element = document$1.getElementById(id);
                if (!element || (tagName && element.nodeName.toLowerCase() != tagName)) {
                    // element not found or tag with that ID not found, return false
                    return [];
                }
                // Set currentContext to contain just this element
                currentContext = [element];
                continue; // Skip to next token
            }
            if (token.indexOf('.') > -1) {
                // Token contains a class selector
                bits = token.split('.');
                tagName = bits[0];
                var className = bits[1];
                if (!tagName) {
                    tagName = '*';
                }
                // Get elements matching tag, filter them for class selector
                found = [];
                foundCount = 0;
                for (j = 0; j < currentContext.length; j++) {
                    if (tagName == '*') {
                        elements = getAllChildren(currentContext[j]);
                    } else {
                        elements = currentContext[j].getElementsByTagName(tagName);
                    }
                    for (k = 0; k < elements.length; k++) {
                        found[foundCount++] = elements[k];
                    }
                }
                currentContext = [];
                currentContextIndex = 0;
                for (j = 0; j < found.length; j++) {
                    if (found[j].className &&
                        _.isString(found[j].className) && // some SVG elements have classNames which are not strings
                        hasClass(found[j], className)
                    ) {
                        currentContext[currentContextIndex++] = found[j];
                    }
                }
                continue; // Skip to next token
            }
            // Code to deal with attribute selectors
            var token_match = token.match(TOKEN_MATCH_REGEX);
            if (token_match) {
                tagName = token_match[1];
                var attrName = token_match[2];
                var attrOperator = token_match[3];
                var attrValue = token_match[4];
                if (!tagName) {
                    tagName = '*';
                }
                // Grab all of the tagName elements within current context
                found = [];
                foundCount = 0;
                for (j = 0; j < currentContext.length; j++) {
                    if (tagName == '*') {
                        elements = getAllChildren(currentContext[j]);
                    } else {
                        elements = currentContext[j].getElementsByTagName(tagName);
                    }
                    for (k = 0; k < elements.length; k++) {
                        found[foundCount++] = elements[k];
                    }
                }
                currentContext = [];
                currentContextIndex = 0;
                var checkFunction; // This function will be used to filter the elements
                switch (attrOperator) {
                    case '=': // Equality
                        checkFunction = function(e) {
                            return (e.getAttribute(attrName) == attrValue);
                        };
                        break;
                    case '~': // Match one of space seperated words
                        checkFunction = function(e) {
                            return (e.getAttribute(attrName).match(new RegExp('\\b' + attrValue + '\\b')));
                        };
                        break;
                    case '|': // Match start with value followed by optional hyphen
                        checkFunction = function(e) {
                            return (e.getAttribute(attrName).match(new RegExp('^' + attrValue + '-?')));
                        };
                        break;
                    case '^': // Match starts with value
                        checkFunction = function(e) {
                            return (e.getAttribute(attrName).indexOf(attrValue) === 0);
                        };
                        break;
                    case '$': // Match ends with value - fails with "Warning" in Opera 7
                        checkFunction = function(e) {
                            return (e.getAttribute(attrName).lastIndexOf(attrValue) == e.getAttribute(attrName).length - attrValue.length);
                        };
                        break;
                    case '*': // Match ends with value
                        checkFunction = function(e) {
                            return (e.getAttribute(attrName).indexOf(attrValue) > -1);
                        };
                        break;
                    default:
                        // Just test for existence of attribute
                        checkFunction = function(e) {
                            return e.getAttribute(attrName);
                        };
                }
                currentContext = [];
                currentContextIndex = 0;
                for (j = 0; j < found.length; j++) {
                    if (checkFunction(found[j])) {
                        currentContext[currentContextIndex++] = found[j];
                    }
                }
                // alert('Attribute Selector: '+tagName+' '+attrName+' '+attrOperator+' '+attrValue);
                continue; // Skip to next token
            }
            // If we get here, token is JUST an element (not a class or ID selector)
            tagName = token;
            found = [];
            foundCount = 0;
            for (j = 0; j < currentContext.length; j++) {
                elements = currentContext[j].getElementsByTagName(tagName);
                for (k = 0; k < elements.length; k++) {
                    found[foundCount++] = elements[k];
                }
            }
            currentContext = found;
        }
        return currentContext;
    }

    return function(query) {
        if (_.isElement(query)) {
            return [query];
        } else if (_.isObject(query) && !_.isUndefined(query.length)) {
            return query;
        } else {
            return getElementsBySelector.call(this, query);
        }
    };
})();

var CAMPAIGN_KEYWORDS = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term'];
var CLICK_IDS = ['dclid', 'fbclid', 'gclid', 'ko_click_id', 'li_fat_id', 'msclkid', 'ttclid', 'twclid', 'wbraid'];

_.info = {
    campaignParams: function(default_value) {
        var kw = '',
            params = {};
        _.each(CAMPAIGN_KEYWORDS, function(kwkey) {
            kw = _.getQueryParam(document$1.URL, kwkey);
            if (kw.length) {
                params[kwkey] = kw;
            } else if (default_value !== undefined) {
                params[kwkey] = default_value;
            }
        });

        return params;
    },

    clickParams: function() {
        var id = '',
            params = {};
        _.each(CLICK_IDS, function(idkey) {
            id = _.getQueryParam(document$1.URL, idkey);
            if (id.length) {
                params[idkey] = id;
            }
        });

        return params;
    },

    marketingParams: function() {
        return _.extend(_.info.campaignParams(), _.info.clickParams());
    },

    searchEngine: function(referrer) {
        if (referrer.search('https?://(.*)google.([^/?]*)') === 0) {
            return 'google';
        } else if (referrer.search('https?://(.*)bing.com') === 0) {
            return 'bing';
        } else if (referrer.search('https?://(.*)yahoo.com') === 0) {
            return 'yahoo';
        } else if (referrer.search('https?://(.*)duckduckgo.com') === 0) {
            return 'duckduckgo';
        } else {
            return null;
        }
    },

    searchInfo: function(referrer) {
        var search = _.info.searchEngine(referrer),
            param = (search != 'yahoo') ? 'q' : 'p',
            ret = {};

        if (search !== null) {
            ret['$search_engine'] = search;

            var keyword = _.getQueryParam(referrer, param);
            if (keyword.length) {
                ret['mp_keyword'] = keyword;
            }
        }

        return ret;
    },

    /**
     * This function detects which browser is running this script.
     * The order of the checks are important since many user agents
     * include key words used in later checks.
     */
    browser: function(user_agent, vendor, opera) {
        vendor = vendor || ''; // vendor is undefined for at least IE9
        if (opera || _.includes(user_agent, ' OPR/')) {
            if (_.includes(user_agent, 'Mini')) {
                return 'Opera Mini';
            }
            return 'Opera';
        } else if (/(BlackBerry|PlayBook|BB10)/i.test(user_agent)) {
            return 'BlackBerry';
        } else if (_.includes(user_agent, 'IEMobile') || _.includes(user_agent, 'WPDesktop')) {
            return 'Internet Explorer Mobile';
        } else if (_.includes(user_agent, 'SamsungBrowser/')) {
            // https://developer.samsung.com/internet/user-agent-string-format
            return 'Samsung Internet';
        } else if (_.includes(user_agent, 'Edge') || _.includes(user_agent, 'Edg/')) {
            return 'Microsoft Edge';
        } else if (_.includes(user_agent, 'FBIOS')) {
            return 'Facebook Mobile';
        } else if (_.includes(user_agent, 'Chrome')) {
            return 'Chrome';
        } else if (_.includes(user_agent, 'CriOS')) {
            return 'Chrome iOS';
        } else if (_.includes(user_agent, 'UCWEB') || _.includes(user_agent, 'UCBrowser')) {
            return 'UC Browser';
        } else if (_.includes(user_agent, 'FxiOS')) {
            return 'Firefox iOS';
        } else if (_.includes(vendor, 'Apple')) {
            if (_.includes(user_agent, 'Mobile')) {
                return 'Mobile Safari';
            }
            return 'Safari';
        } else if (_.includes(user_agent, 'Android')) {
            return 'Android Mobile';
        } else if (_.includes(user_agent, 'Konqueror')) {
            return 'Konqueror';
        } else if (_.includes(user_agent, 'Firefox')) {
            return 'Firefox';
        } else if (_.includes(user_agent, 'MSIE') || _.includes(user_agent, 'Trident/')) {
            return 'Internet Explorer';
        } else if (_.includes(user_agent, 'Gecko')) {
            return 'Mozilla';
        } else {
            return '';
        }
    },

    /**
     * This function detects which browser version is running this script,
     * parsing major and minor version (e.g., 42.1). User agent strings from:
     * http://www.useragentstring.com/pages/useragentstring.php
     */
    browserVersion: function(userAgent, vendor, opera) {
        var browser = _.info.browser(userAgent, vendor, opera);
        var versionRegexs = {
            'Internet Explorer Mobile': /rv:(\d+(\.\d+)?)/,
            'Microsoft Edge': /Edge?\/(\d+(\.\d+)?)/,
            'Chrome': /Chrome\/(\d+(\.\d+)?)/,
            'Chrome iOS': /CriOS\/(\d+(\.\d+)?)/,
            'UC Browser' : /(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,
            'Safari': /Version\/(\d+(\.\d+)?)/,
            'Mobile Safari': /Version\/(\d+(\.\d+)?)/,
            'Opera': /(Opera|OPR)\/(\d+(\.\d+)?)/,
            'Firefox': /Firefox\/(\d+(\.\d+)?)/,
            'Firefox iOS': /FxiOS\/(\d+(\.\d+)?)/,
            'Konqueror': /Konqueror:(\d+(\.\d+)?)/,
            'BlackBerry': /BlackBerry (\d+(\.\d+)?)/,
            'Android Mobile': /android\s(\d+(\.\d+)?)/,
            'Samsung Internet': /SamsungBrowser\/(\d+(\.\d+)?)/,
            'Internet Explorer': /(rv:|MSIE )(\d+(\.\d+)?)/,
            'Mozilla': /rv:(\d+(\.\d+)?)/
        };
        var regex = versionRegexs[browser];
        if (regex === undefined) {
            return null;
        }
        var matches = userAgent.match(regex);
        if (!matches) {
            return null;
        }
        return parseFloat(matches[matches.length - 2]);
    },

    os: function() {
        var a = userAgent;
        if (/Windows/i.test(a)) {
            if (/Phone/.test(a) || /WPDesktop/.test(a)) {
                return 'Windows Phone';
            }
            return 'Windows';
        } else if (/(iPhone|iPad|iPod)/.test(a)) {
            return 'iOS';
        } else if (/Android/.test(a)) {
            return 'Android';
        } else if (/(BlackBerry|PlayBook|BB10)/i.test(a)) {
            return 'BlackBerry';
        } else if (/Mac/i.test(a)) {
            return 'Mac OS X';
        } else if (/Linux/.test(a)) {
            return 'Linux';
        } else if (/CrOS/.test(a)) {
            return 'Chrome OS';
        } else {
            return '';
        }
    },

    device: function(user_agent) {
        if (/Windows Phone/i.test(user_agent) || /WPDesktop/.test(user_agent)) {
            return 'Windows Phone';
        } else if (/iPad/.test(user_agent)) {
            return 'iPad';
        } else if (/iPod/.test(user_agent)) {
            return 'iPod Touch';
        } else if (/iPhone/.test(user_agent)) {
            return 'iPhone';
        } else if (/(BlackBerry|PlayBook|BB10)/i.test(user_agent)) {
            return 'BlackBerry';
        } else if (/Android/.test(user_agent)) {
            return 'Android';
        } else {
            return '';
        }
    },

    referringDomain: function(referrer) {
        var split = referrer.split('/');
        if (split.length >= 3) {
            return split[2];
        }
        return '';
    },

    currentUrl: function() {
        return window$1.location.href;
    },

    properties: function(extra_props) {
        if (typeof extra_props !== 'object') {
            extra_props = {};
        }
        return _.extend(_.strip_empty_properties({
            '$os': _.info.os(),
            '$browser': _.info.browser(userAgent, navigator.vendor, windowOpera),
            '$referrer': document$1.referrer,
            '$referring_domain': _.info.referringDomain(document$1.referrer),
            '$device': _.info.device(userAgent)
        }), {
            '$current_url': _.info.currentUrl(),
            '$browser_version': _.info.browserVersion(userAgent, navigator.vendor, windowOpera),
            '$screen_height': screen.height,
            '$screen_width': screen.width,
            'mp_lib': 'web',
            '$lib_version': Config.LIB_VERSION,
            '$insert_id': cheap_guid(),
            'time': _.timestamp() / 1000 // epoch time in seconds
        }, _.strip_empty_properties(extra_props));
    },

    people_properties: function() {
        return _.extend(_.strip_empty_properties({
            '$os': _.info.os(),
            '$browser': _.info.browser(userAgent, navigator.vendor, windowOpera)
        }), {
            '$browser_version': _.info.browserVersion(userAgent, navigator.vendor, windowOpera)
        });
    },

    mpPageViewProperties: function() {
        return _.strip_empty_properties({
            'current_page_title': document$1.title,
            'current_domain': window$1.location.hostname,
            'current_url_path': window$1.location.pathname,
            'current_url_protocol': window$1.location.protocol,
            'current_url_search': window$1.location.search
        });
    }
};

var cheap_guid = function(maxlen) {
    var guid = Math.random().toString(36).substring(2, 10) + Math.random().toString(36).substring(2, 10);
    return maxlen ? guid.substring(0, maxlen) : guid;
};

// naive way to extract domain name (example.com) from full hostname (my.sub.example.com)
var SIMPLE_DOMAIN_MATCH_REGEX = /[a-z0-9][a-z0-9-]*\.[a-z]+$/i;
// this next one attempts to account for some ccSLDs, e.g. extracting oxford.ac.uk from www.oxford.ac.uk
var DOMAIN_MATCH_REGEX = /[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i;
/**
 * Attempts to extract main domain name from full hostname, using a few blunt heuristics. For
 * common TLDs like .com/.org that always have a simple SLD.TLD structure (example.com), we
 * simply extract the last two .-separated parts of the hostname (SIMPLE_DOMAIN_MATCH_REGEX).
 * For others, we attempt to account for short ccSLD+TLD combos (.ac.uk) with the legacy
 * DOMAIN_MATCH_REGEX (kept to maintain backwards compatibility with existing Mixpanel
 * integrations). The only _reliable_ way to extract domain from hostname is with an up-to-date
 * list like at https://publicsuffix.org/ so for cases that this helper fails at, the SDK
 * offers the 'cookie_domain' config option to set it explicitly.
 * @example
 * extract_domain('my.sub.example.com')
 * // 'example.com'
 */
var extract_domain = function(hostname) {
    var domain_regex = DOMAIN_MATCH_REGEX;
    var parts = hostname.split('.');
    var tld = parts[parts.length - 1];
    if (tld.length > 4 || tld === 'com' || tld === 'org') {
        domain_regex = SIMPLE_DOMAIN_MATCH_REGEX;
    }
    var matches = hostname.match(domain_regex);
    return matches ? matches[0] : '';
};

var JSONStringify = null;
var JSONParse = null;
if (typeof JSON !== 'undefined') {
    JSONStringify = JSON.stringify;
    JSONParse = JSON.parse;
}
JSONStringify = JSONStringify || _.JSONEncode;
JSONParse = JSONParse || _.JSONDecode;

// EXPORTS (for closure compiler)
_['toArray']                = _.toArray;
_['isObject']               = _.isObject;
_['JSONEncode']             = _.JSONEncode;
_['JSONDecode']             = _.JSONDecode;
_['isBlockedUA']            = _.isBlockedUA;
_['isEmptyObject']          = _.isEmptyObject;
_['info']                   = _.info;
_['info']['device']         = _.info.device;
_['info']['browser']        = _.info.browser;
_['info']['browserVersion'] = _.info.browserVersion;
_['info']['properties']     = _.info.properties;

/**
 * DomTracker Object
 * @constructor
 */
var DomTracker = function() {};


// interface
DomTracker.prototype.create_properties = function() {};
DomTracker.prototype.event_handler = function() {};
DomTracker.prototype.after_track_handler = function() {};

DomTracker.prototype.init = function(mixpanel_instance) {
    this.mp = mixpanel_instance;
    return this;
};

/**
 * @param {Object|string} query
 * @param {string} event_name
 * @param {Object=} properties
 * @param {function=} user_callback
 */
DomTracker.prototype.track = function(query, event_name, properties, user_callback) {
    var that = this;
    var elements = _.dom_query(query);

    if (elements.length === 0) {
        console$1.error('The DOM query (' + query + ') returned 0 elements');
        return;
    }

    _.each(elements, function(element) {
        _.register_event(element, this.override_event, function(e) {
            var options = {};
            var props = that.create_properties(properties, this);
            var timeout = that.mp.get_config('track_links_timeout');

            that.event_handler(e, this, options);

            // in case the mixpanel servers don't get back to us in time
            window.setTimeout(that.track_callback(user_callback, props, options, true), timeout);

            // fire the tracking event
            that.mp.track(event_name, props, that.track_callback(user_callback, props, options));
        });
    }, this);

    return true;
};

/**
 * @param {function} user_callback
 * @param {Object} props
 * @param {boolean=} timeout_occured
 */
DomTracker.prototype.track_callback = function(user_callback, props, options, timeout_occured) {
    timeout_occured = timeout_occured || false;
    var that = this;

    return function() {
        // options is referenced from both callbacks, so we can have
        // a 'lock' of sorts to ensure only one fires
        if (options.callback_fired) { return; }
        options.callback_fired = true;

        if (user_callback && user_callback(timeout_occured, props) === false) {
            // user can prevent the default functionality by
            // returning false from their callback
            return;
        }

        that.after_track_handler(props, options, timeout_occured);
    };
};

DomTracker.prototype.create_properties = function(properties, element) {
    var props;

    if (typeof(properties) === 'function') {
        props = properties(element);
    } else {
        props = _.extend({}, properties);
    }

    return props;
};

/**
 * LinkTracker Object
 * @constructor
 * @extends DomTracker
 */
var LinkTracker = function() {
    this.override_event = 'click';
};
_.inherit(LinkTracker, DomTracker);

LinkTracker.prototype.create_properties = function(properties, element) {
    var props = LinkTracker.superclass.create_properties.apply(this, arguments);

    if (element.href) { props['url'] = element.href; }

    return props;
};

LinkTracker.prototype.event_handler = function(evt, element, options) {
    options.new_tab = (
        evt.which === 2 ||
        evt.metaKey ||
        evt.ctrlKey ||
        element.target === '_blank'
    );
    options.href = element.href;

    if (!options.new_tab) {
        evt.preventDefault();
    }
};

LinkTracker.prototype.after_track_handler = function(props, options) {
    if (options.new_tab) { return; }

    setTimeout(function() {
        window.location = options.href;
    }, 0);
};

/**
 * FormTracker Object
 * @constructor
 * @extends DomTracker
 */
var FormTracker = function() {
    this.override_event = 'submit';
};
_.inherit(FormTracker, DomTracker);

FormTracker.prototype.event_handler = function(evt, element, options) {
    options.element = element;
    evt.preventDefault();
};

FormTracker.prototype.after_track_handler = function(props, options) {
    setTimeout(function() {
        options.element.submit();
    }, 0);
};

// eslint-disable-line camelcase

var logger$2 = console_with_prefix('lock');

/**
 * SharedLock: a mutex built on HTML5 localStorage, to ensure that only one browser
 * window/tab at a time will be able to access shared resources.
 *
 * Based on the Alur and Taubenfeld fast lock
 * (http://www.cs.rochester.edu/research/synchronization/pseudocode/fastlock.html)
 * with an added timeout to ensure there will be eventual progress in the event
 * that a window is closed in the middle of the callback.
 *
 * Implementation based on the original version by David Wolever (https://github.com/wolever)
 * at https://gist.github.com/wolever/5fd7573d1ef6166e8f8c4af286a69432.
 *
 * @example
 * const myLock = new SharedLock('some-key');
 * myLock.withLock(function() {
 *   console.log('I hold the mutex!');
 * });
 *
 * @constructor
 */
var SharedLock = function(key, options) {
    options = options || {};

    this.storageKey = key;
    this.storage = options.storage || window.localStorage;
    this.pollIntervalMS = options.pollIntervalMS || 100;
    this.timeoutMS = options.timeoutMS || 2000;
};

// pass in a specific pid to test contention scenarios; otherwise
// it is chosen randomly for each acquisition attempt
SharedLock.prototype.withLock = function(lockedCB, errorCB, pid) {
    if (!pid && typeof errorCB !== 'function') {
        pid = errorCB;
        errorCB = null;
    }

    var i = pid || (new Date().getTime() + '|' + Math.random());
    var startTime = new Date().getTime();

    var key = this.storageKey;
    var pollIntervalMS = this.pollIntervalMS;
    var timeoutMS = this.timeoutMS;
    var storage = this.storage;

    var keyX = key + ':X';
    var keyY = key + ':Y';
    var keyZ = key + ':Z';

    var reportError = function(err) {
        errorCB && errorCB(err);
    };

    var delay = function(cb) {
        if (new Date().getTime() - startTime > timeoutMS) {
            logger$2.error('Timeout waiting for mutex on ' + key + '; clearing lock. [' + i + ']');
            storage.removeItem(keyZ);
            storage.removeItem(keyY);
            loop();
            return;
        }
        setTimeout(function() {
            try {
                cb();
            } catch(err) {
                reportError(err);
            }
        }, pollIntervalMS * (Math.random() + 0.1));
    };

    var waitFor = function(predicate, cb) {
        if (predicate()) {
            cb();
        } else {
            delay(function() {
                waitFor(predicate, cb);
            });
        }
    };

    var getSetY = function() {
        var valY = storage.getItem(keyY);
        if (valY && valY !== i) { // if Y == i then this process already has the lock (useful for test cases)
            return false;
        } else {
            storage.setItem(keyY, i);
            if (storage.getItem(keyY) === i) {
                return true;
            } else {
                if (!localStorageSupported(storage, true)) {
                    throw new Error('localStorage support dropped while acquiring lock');
                }
                return false;
            }
        }
    };

    var loop = function() {
        storage.setItem(keyX, i);

        waitFor(getSetY, function() {
            if (storage.getItem(keyX) === i) {
                criticalSection();
                return;
            }

            delay(function() {
                if (storage.getItem(keyY) !== i) {
                    loop();
                    return;
                }
                waitFor(function() {
                    return !storage.getItem(keyZ);
                }, criticalSection);
            });
        });
    };

    var criticalSection = function() {
        storage.setItem(keyZ, '1');
        try {
            lockedCB();
        } finally {
            storage.removeItem(keyZ);
            if (storage.getItem(keyY) === i) {
                storage.removeItem(keyY);
            }
            if (storage.getItem(keyX) === i) {
                storage.removeItem(keyX);
            }
        }
    };

    try {
        if (localStorageSupported(storage, true)) {
            loop();
        } else {
            throw new Error('localStorage support check failed');
        }
    } catch(err) {
        reportError(err);
    }
};

// eslint-disable-line camelcase

var logger$1 = console_with_prefix('batch');

/**
 * RequestQueue: queue for batching API requests with localStorage backup for retries.
 * Maintains an in-memory queue which represents the source of truth for the current
 * page, but also writes all items out to a copy in the browser's localStorage, which
 * can be read on subsequent pageloads and retried. For batchability, all the request
 * items in the queue should be of the same type (events, people updates, group updates)
 * so they can be sent in a single request to the same API endpoint.
 *
 * LocalStorage keying and locking: In order for reloads and subsequent pageloads of
 * the same site to access the same persisted data, they must share the same localStorage
 * key (for instance based on project token and queue type). Therefore access to the
 * localStorage entry is guarded by an asynchronous mutex (SharedLock) to prevent
 * simultaneously open windows/tabs from overwriting each other's data (which would lead
 * to data loss in some situations).
 * @constructor
 */
var RequestQueue = function(storageKey, options) {
    options = options || {};
    this.storageKey = storageKey;
    this.storage = options.storage || window.localStorage;
    this.reportError = options.errorReporter || _.bind(logger$1.error, logger$1);
    this.lock = new SharedLock(storageKey, {storage: this.storage});

    this.pid = options.pid || null; // pass pid to test out storage lock contention scenarios

    this.memQueue = [];
};

/**
 * Add one item to queues (memory and localStorage). The queued entry includes
 * the given item along with an auto-generated ID and a "flush-after" timestamp.
 * It is expected that the item will be sent over the network and dequeued
 * before the flush-after time; if this doesn't happen it is considered orphaned
 * (e.g., the original tab where it was enqueued got closed before it could be
 * sent) and the item can be sent by any tab that finds it in localStorage.
 *
 * The final callback param is called with a param indicating success or
 * failure of the enqueue operation; it is asynchronous because the localStorage
 * lock is asynchronous.
 */
RequestQueue.prototype.enqueue = function(item, flushInterval, cb) {
    var queueEntry = {
        'id': cheap_guid(),
        'flushAfter': new Date().getTime() + flushInterval * 2,
        'payload': item
    };

    this.lock.withLock(_.bind(function lockAcquired() {
        var succeeded;
        try {
            var storedQueue = this.readFromStorage();
            storedQueue.push(queueEntry);
            succeeded = this.saveToStorage(storedQueue);
            if (succeeded) {
                // only add to in-memory queue when storage succeeds
                this.memQueue.push(queueEntry);
            }
        } catch(err) {
            this.reportError('Error enqueueing item', item);
            succeeded = false;
        }
        if (cb) {
            cb(succeeded);
        }
    }, this), _.bind(function lockFailure(err) {
        this.reportError('Error acquiring storage lock', err);
        if (cb) {
            cb(false);
        }
    }, this), this.pid);
};

/**
 * Read out the given number of queue entries. If this.memQueue
 * has fewer than batchSize items, then look for "orphaned" items
 * in the persisted queue (items where the 'flushAfter' time has
 * already passed).
 */
RequestQueue.prototype.fillBatch = function(batchSize) {
    var batch = this.memQueue.slice(0, batchSize);
    if (batch.length < batchSize) {
        // don't need lock just to read events; localStorage is thread-safe
        // and the worst that could happen is a duplicate send of some
        // orphaned events, which will be deduplicated on the server side
        var storedQueue = this.readFromStorage();
        if (storedQueue.length) {
            // item IDs already in batch; don't duplicate out of storage
            var idsInBatch = {}; // poor man's Set
            _.each(batch, function(item) { idsInBatch[item['id']] = true; });

            for (var i = 0; i < storedQueue.length; i++) {
                var item = storedQueue[i];
                if (new Date().getTime() > item['flushAfter'] && !idsInBatch[item['id']]) {
                    item.orphaned = true;
                    batch.push(item);
                    if (batch.length >= batchSize) {
                        break;
                    }
                }
            }
        }
    }
    return batch;
};

/**
 * Remove items with matching 'id' from array (immutably)
 * also remove any item without a valid id (e.g., malformed
 * storage entries).
 */
var filterOutIDsAndInvalid = function(items, idSet) {
    var filteredItems = [];
    _.each(items, function(item) {
        if (item['id'] && !idSet[item['id']]) {
            filteredItems.push(item);
        }
    });
    return filteredItems;
};

/**
 * Remove items with matching IDs from both in-memory queue
 * and persisted queue
 */
RequestQueue.prototype.removeItemsByID = function(ids, cb) {
    var idSet = {}; // poor man's Set
    _.each(ids, function(id) { idSet[id] = true; });

    this.memQueue = filterOutIDsAndInvalid(this.memQueue, idSet);

    var removeFromStorage = _.bind(function() {
        var succeeded;
        try {
            var storedQueue = this.readFromStorage();
            storedQueue = filterOutIDsAndInvalid(storedQueue, idSet);
            succeeded = this.saveToStorage(storedQueue);

            // an extra check: did storage report success but somehow
            // the items are still there?
            if (succeeded) {
                storedQueue = this.readFromStorage();
                for (var i = 0; i < storedQueue.length; i++) {
                    var item = storedQueue[i];
                    if (item['id'] && !!idSet[item['id']]) {
                        this.reportError('Item not removed from storage');
                        return false;
                    }
                }
            }
        } catch(err) {
            this.reportError('Error removing items', ids);
            succeeded = false;
        }
        return succeeded;
    }, this);

    this.lock.withLock(function lockAcquired() {
        var succeeded = removeFromStorage();
        if (cb) {
            cb(succeeded);
        }
    }, _.bind(function lockFailure(err) {
        var succeeded = false;
        this.reportError('Error acquiring storage lock', err);
        if (!localStorageSupported(this.storage, true)) {
            // Looks like localStorage writes have stopped working sometime after
            // initialization (probably full), and so nobody can acquire locks
            // anymore. Consider it temporarily safe to remove items without the
            // lock, since nobody's writing successfully anyway.
            succeeded = removeFromStorage();
            if (!succeeded) {
                // OK, we couldn't even write out the smaller queue. Try clearing it
                // entirely.
                try {
                    this.storage.removeItem(this.storageKey);
                } catch(err) {
                    this.reportError('Error clearing queue', err);
                }
            }
        }
        if (cb) {
            cb(succeeded);
        }
    }, this), this.pid);
};

// internal helper for RequestQueue.updatePayloads
var updatePayloads = function(existingItems, itemsToUpdate) {
    var newItems = [];
    _.each(existingItems, function(item) {
        var id = item['id'];
        if (id in itemsToUpdate) {
            var newPayload = itemsToUpdate[id];
            if (newPayload !== null) {
                item['payload'] = newPayload;
                newItems.push(item);
            }
        } else {
            // no update
            newItems.push(item);
        }
    });
    return newItems;
};

/**
 * Update payloads of given items in both in-memory queue and
 * persisted queue. Items set to null are removed from queues.
 */
RequestQueue.prototype.updatePayloads = function(itemsToUpdate, cb) {
    this.memQueue = updatePayloads(this.memQueue, itemsToUpdate);
    this.lock.withLock(_.bind(function lockAcquired() {
        var succeeded;
        try {
            var storedQueue = this.readFromStorage();
            storedQueue = updatePayloads(storedQueue, itemsToUpdate);
            succeeded = this.saveToStorage(storedQueue);
        } catch(err) {
            this.reportError('Error updating items', itemsToUpdate);
            succeeded = false;
        }
        if (cb) {
            cb(succeeded);
        }
    }, this), _.bind(function lockFailure(err) {
        this.reportError('Error acquiring storage lock', err);
        if (cb) {
            cb(false);
        }
    }, this), this.pid);
};

/**
 * Read and parse items array from localStorage entry, handling
 * malformed/missing data if necessary.
 */
RequestQueue.prototype.readFromStorage = function() {
    var storageEntry;
    try {
        storageEntry = this.storage.getItem(this.storageKey);
        if (storageEntry) {
            storageEntry = JSONParse(storageEntry);
            if (!_.isArray(storageEntry)) {
                this.reportError('Invalid storage entry:', storageEntry);
                storageEntry = null;
            }
        }
    } catch (err) {
        this.reportError('Error retrieving queue', err);
        storageEntry = null;
    }
    return storageEntry || [];
};

/**
 * Serialize the given items array to localStorage.
 */
RequestQueue.prototype.saveToStorage = function(queue) {
    try {
        this.storage.setItem(this.storageKey, JSONStringify(queue));
        return true;
    } catch (err) {
        this.reportError('Error saving queue', err);
        return false;
    }
};

/**
 * Clear out queues (memory and localStorage).
 */
RequestQueue.prototype.clear = function() {
    this.memQueue = [];
    this.storage.removeItem(this.storageKey);
};

// eslint-disable-line camelcase

// maximum interval between request retries after exponential backoff
var MAX_RETRY_INTERVAL_MS = 10 * 60 * 1000; // 10 minutes

var logger = console_with_prefix('batch');

/**
 * RequestBatcher: manages the queueing, flushing, retry etc of requests of one
 * type (events, people, groups).
 * Uses RequestQueue to manage the backing store.
 * @constructor
 */
var RequestBatcher = function(storageKey, options) {
    this.errorReporter = options.errorReporter;
    this.queue = new RequestQueue(storageKey, {
        errorReporter: _.bind(this.reportError, this),
        storage: options.storage
    });

    this.libConfig = options.libConfig;
    this.sendRequest = options.sendRequestFunc;
    this.beforeSendHook = options.beforeSendHook;
    this.stopAllBatching = options.stopAllBatchingFunc;

    // seed variable batch size + flush interval with configured values
    this.batchSize = this.libConfig['batch_size'];
    this.flushInterval = this.libConfig['batch_flush_interval_ms'];

    this.stopped = !this.libConfig['batch_autostart'];
    this.consecutiveRemovalFailures = 0;

    // extra client-side dedupe
    this.itemIdsSentSuccessfully = {};
};

/**
 * Add one item to queue.
 */
RequestBatcher.prototype.enqueue = function(item, cb) {
    this.queue.enqueue(item, this.flushInterval, cb);
};

/**
 * Start flushing batches at the configured time interval. Must call
 * this method upon SDK init in order to send anything over the network.
 */
RequestBatcher.prototype.start = function() {
    this.stopped = false;
    this.consecutiveRemovalFailures = 0;
    this.flush();
};

/**
 * Stop flushing batches. Can be restarted by calling start().
 */
RequestBatcher.prototype.stop = function() {
    this.stopped = true;
    if (this.timeoutID) {
        clearTimeout(this.timeoutID);
        this.timeoutID = null;
    }
};

/**
 * Clear out queue.
 */
RequestBatcher.prototype.clear = function() {
    this.queue.clear();
};

/**
 * Restore batch size configuration to whatever is set in the main SDK.
 */
RequestBatcher.prototype.resetBatchSize = function() {
    this.batchSize = this.libConfig['batch_size'];
};

/**
 * Restore flush interval time configuration to whatever is set in the main SDK.
 */
RequestBatcher.prototype.resetFlush = function() {
    this.scheduleFlush(this.libConfig['batch_flush_interval_ms']);
};

/**
 * Schedule the next flush in the given number of milliseconds.
 */
RequestBatcher.prototype.scheduleFlush = function(flushMS) {
    this.flushInterval = flushMS;
    if (!this.stopped) { // don't schedule anymore if batching has been stopped
        this.timeoutID = setTimeout(_.bind(this.flush, this), this.flushInterval);
    }
};

/**
 * Flush one batch to network. Depending on success/failure modes, it will either
 * remove the batch from the queue or leave it in for retry, and schedule the next
 * flush. In cases of most network or API failures, it will back off exponentially
 * when retrying.
 * @param {Object} [options]
 * @param {boolean} [options.sendBeacon] - whether to send batch with
 * navigator.sendBeacon (only useful for sending batches before page unloads, as
 * sendBeacon offers no callbacks or status indications)
 */
RequestBatcher.prototype.flush = function(options) {
    try {

        if (this.requestInProgress) {
            logger.log('Flush: Request already in progress');
            return;
        }

        options = options || {};
        var timeoutMS = this.libConfig['batch_request_timeout_ms'];
        var startTime = new Date().getTime();
        var currentBatchSize = this.batchSize;
        var batch = this.queue.fillBatch(currentBatchSize);
        var dataForRequest = [];
        var transformedItems = {};
        _.each(batch, function(item) {
            var payload = item['payload'];
            if (this.beforeSendHook && !item.orphaned) {
                payload = this.beforeSendHook(payload);
            }
            if (payload) {
                // mp_sent_by_lib_version prop captures which lib version actually
                // sends each event (regardless of which version originally queued
                // it for sending)
                if (payload['event'] && payload['properties']) {
                    payload['properties'] = _.extend(
                        {},
                        payload['properties'],
                        {'mp_sent_by_lib_version': Config.LIB_VERSION}
                    );
                }
                var addPayload = true;
                var itemId = item['id'];
                if (itemId) {
                    if ((this.itemIdsSentSuccessfully[itemId] || 0) > 5) {
                        this.reportError('[dupe] item ID sent too many times, not sending', {
                            item: item,
                            batchSize: batch.length,
                            timesSent: this.itemIdsSentSuccessfully[itemId]
                        });
                        addPayload = false;
                    }
                } else {
                    this.reportError('[dupe] found item with no ID', {item: item});
                }

                if (addPayload) {
                    dataForRequest.push(payload);
                }
            }
            transformedItems[item['id']] = payload;
        }, this);
        if (dataForRequest.length < 1) {
            this.resetFlush();
            return; // nothing to do
        }

        this.requestInProgress = true;

        var batchSendCallback = _.bind(function(res) {
            this.requestInProgress = false;

            try {

                // handle API response in a try-catch to make sure we can reset the
                // flush operation if something goes wrong

                var removeItemsFromQueue = false;
                if (options.unloading) {
                    // update persisted data to include hook transformations
                    this.queue.updatePayloads(transformedItems);
                } else if (
                    _.isObject(res) &&
                    res.error === 'timeout' &&
                    new Date().getTime() - startTime >= timeoutMS
                ) {
                    this.reportError('Network timeout; retrying');
                    this.flush();
                } else if (
                    _.isObject(res) &&
                    res.xhr_req &&
                    (res.xhr_req['status'] >= 500 || res.xhr_req['status'] === 429 || res.error === 'timeout')
                ) {
                    // network or API error, or 429 Too Many Requests, retry
                    var retryMS = this.flushInterval * 2;
                    var headers = res.xhr_req['responseHeaders'];
                    if (headers) {
                        var retryAfter = headers['Retry-After'];
                        if (retryAfter) {
                            retryMS = (parseInt(retryAfter, 10) * 1000) || retryMS;
                        }
                    }
                    retryMS = Math.min(MAX_RETRY_INTERVAL_MS, retryMS);
                    this.reportError('Error; retry in ' + retryMS + ' ms');
                    this.scheduleFlush(retryMS);
                } else if (_.isObject(res) && res.xhr_req && res.xhr_req['status'] === 413) {
                    // 413 Payload Too Large
                    if (batch.length > 1) {
                        var halvedBatchSize = Math.max(1, Math.floor(currentBatchSize / 2));
                        this.batchSize = Math.min(this.batchSize, halvedBatchSize, batch.length - 1);
                        this.reportError('413 response; reducing batch size to ' + this.batchSize);
                        this.resetFlush();
                    } else {
                        this.reportError('Single-event request too large; dropping', batch);
                        this.resetBatchSize();
                        removeItemsFromQueue = true;
                    }
                } else {
                    // successful network request+response; remove each item in batch from queue
                    // (even if it was e.g. a 400, in which case retrying won't help)
                    removeItemsFromQueue = true;
                }

                if (removeItemsFromQueue) {
                    this.queue.removeItemsByID(
                        _.map(batch, function(item) { return item['id']; }),
                        _.bind(function(succeeded) {
                            if (succeeded) {
                                this.consecutiveRemovalFailures = 0;
                                this.flush(); // handle next batch if the queue isn't empty
                            } else {
                                this.reportError('Failed to remove items from queue');
                                if (++this.consecutiveRemovalFailures > 5) {
                                    this.reportError('Too many queue failures; disabling batching system.');
                                    this.stopAllBatching();
                                } else {
                                    this.resetFlush();
                                }
                            }
                        }, this)
                    );

                    // client-side dedupe
                    _.each(batch, _.bind(function(item) {
                        var itemId = item['id'];
                        if (itemId) {
                            this.itemIdsSentSuccessfully[itemId] = this.itemIdsSentSuccessfully[itemId] || 0;
                            this.itemIdsSentSuccessfully[itemId]++;
                            if (this.itemIdsSentSuccessfully[itemId] > 5) {
                                this.reportError('[dupe] item ID sent too many times', {
                                    item: item,
                                    batchSize: batch.length,
                                    timesSent: this.itemIdsSentSuccessfully[itemId]
                                });
                            }
                        } else {
                            this.reportError('[dupe] found item with no ID while removing', {item: item});
                        }
                    }, this));
                }

            } catch(err) {
                this.reportError('Error handling API response', err);
                this.resetFlush();
            }
        }, this);
        var requestOptions = {
            method: 'POST',
            verbose: true,
            ignore_json_errors: true, // eslint-disable-line camelcase
            timeout_ms: timeoutMS // eslint-disable-line camelcase
        };
        if (options.unloading) {
            requestOptions.transport = 'sendBeacon';
        }
        logger.log('MIXPANEL REQUEST:', dataForRequest);
        this.sendRequest(dataForRequest, requestOptions, batchSendCallback);

    } catch(err) {
        this.reportError('Error flushing request queue', err);
        this.resetFlush();
    }
};

/**
 * Log error to global logger and optional user-defined logger.
 */
RequestBatcher.prototype.reportError = function(msg, err) {
    logger.error.apply(logger.error, arguments);
    if (this.errorReporter) {
        try {
            if (!(err instanceof Error)) {
                err = new Error(msg);
            }
            this.errorReporter(msg, err);
        } catch(err) {
            logger.error(err);
        }
    }
};

/**
 * A function used to track a Mixpanel event (e.g. MixpanelLib.track)
 * @callback trackFunction
 * @param {String} event_name The name of the event. This can be anything the user does - 'Button Click', 'Sign Up', 'Item Purchased', etc.
 * @param {Object} [properties] A set of properties to include with the event you're sending. These describe the user who did the event or details about the event itself.
 * @param {Function} [callback] If provided, the callback function will be called after tracking the event.
 */

/** Public **/

var GDPR_DEFAULT_PERSISTENCE_PREFIX = '__mp_opt_in_out_';

/**
 * Opt the user in to data tracking and cookies/localstorage for the given token
 * @param {string} token - Mixpanel project tracking token
 * @param {Object} [options]
 * @param {trackFunction} [options.track] - function used for tracking a Mixpanel event to record the opt-in action
 * @param {string} [options.trackEventName] - event name to be used for tracking the opt-in action
 * @param {Object} [options.trackProperties] - set of properties to be tracked along with the opt-in action
 * @param {string} [options.persistenceType] Persistence mechanism used - cookie or localStorage
 * @param {string} [options.persistencePrefix=__mp_opt_in_out] - custom prefix to be used in the cookie/localstorage name
 * @param {Number} [options.cookieExpiration] - number of days until the opt-in cookie expires
 * @param {string} [options.cookieDomain] - custom cookie domain
 * @param {boolean} [options.crossSiteCookie] - whether the opt-in cookie is set as cross-site-enabled
 * @param {boolean} [options.crossSubdomainCookie] - whether the opt-in cookie is set as cross-subdomain or not
 * @param {boolean} [options.secureCookie] - whether the opt-in cookie is set as secure or not
 */
function optIn(token, options) {
    _optInOut(true, token, options);
}

/**
 * Opt the user out of data tracking and cookies/localstorage for the given token
 * @param {string} token - Mixpanel project tracking token
 * @param {Object} [options]
 * @param {string} [options.persistenceType] Persistence mechanism used - cookie or localStorage
 * @param {string} [options.persistencePrefix=__mp_opt_in_out] - custom prefix to be used in the cookie/localstorage name
 * @param {Number} [options.cookieExpiration] - number of days until the opt-out cookie expires
 * @param {string} [options.cookieDomain] - custom cookie domain
 * @param {boolean} [options.crossSiteCookie] - whether the opt-in cookie is set as cross-site-enabled
 * @param {boolean} [options.crossSubdomainCookie] - whether the opt-out cookie is set as cross-subdomain or not
 * @param {boolean} [options.secureCookie] - whether the opt-out cookie is set as secure or not
 */
function optOut(token, options) {
    _optInOut(false, token, options);
}

/**
 * Check whether the user has opted in to data tracking and cookies/localstorage for the given token
 * @param {string} token - Mixpanel project tracking token
 * @param {Object} [options]
 * @param {string} [options.persistenceType] Persistence mechanism used - cookie or localStorage
 * @param {string} [options.persistencePrefix=__mp_opt_in_out] - custom prefix to be used in the cookie/localstorage name
 * @returns {boolean} whether the user has opted in to the given opt type
 */
function hasOptedIn(token, options) {
    return _getStorageValue(token, options) === '1';
}

/**
 * Check whether the user has opted out of data tracking and cookies/localstorage for the given token
 * @param {string} token - Mixpanel project tracking token
 * @param {Object} [options]
 * @param {string} [options.persistenceType] Persistence mechanism used - cookie or localStorage
 * @param {string} [options.persistencePrefix=__mp_opt_in_out] - custom prefix to be used in the cookie/localstorage name
 * @param {boolean} [options.ignoreDnt] - flag to ignore browser DNT settings and always return false
 * @returns {boolean} whether the user has opted out of the given opt type
 */
function hasOptedOut(token, options) {
    if (_hasDoNotTrackFlagOn(options)) {
        console$1.warn('This browser has "Do Not Track" enabled. This will prevent the Mixpanel SDK from sending any data. To ignore the "Do Not Track" browser setting, initialize the Mixpanel instance with the config "ignore_dnt: true"');
        return true;
    }
    var optedOut = _getStorageValue(token, options) === '0';
    if (optedOut) {
        console$1.warn('You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data.');
    }
    return optedOut;
}

/**
 * Wrap a MixpanelLib method with a check for whether the user is opted out of data tracking and cookies/localstorage for the given token
 * If the user has opted out, return early instead of executing the method.
 * If a callback argument was provided, execute it passing the 0 error code.
 * @param {function} method - wrapped method to be executed if the user has not opted out
 * @returns {*} the result of executing method OR undefined if the user has opted out
 */
function addOptOutCheckMixpanelLib(method) {
    return _addOptOutCheck(method, function(name) {
        return this.get_config(name);
    });
}

/**
 * Wrap a MixpanelPeople method with a check for whether the user is opted out of data tracking and cookies/localstorage for the given token
 * If the user has opted out, return early instead of executing the method.
 * If a callback argument was provided, execute it passing the 0 error code.
 * @param {function} method - wrapped method to be executed if the user has not opted out
 * @returns {*} the result of executing method OR undefined if the user has opted out
 */
function addOptOutCheckMixpanelPeople(method) {
    return _addOptOutCheck(method, function(name) {
        return this._get_config(name);
    });
}

/**
 * Wrap a MixpanelGroup method with a check for whether the user is opted out of data tracking and cookies/localstorage for the given token
 * If the user has opted out, return early instead of executing the method.
 * If a callback argument was provided, execute it passing the 0 error code.
 * @param {function} method - wrapped method to be executed if the user has not opted out
 * @returns {*} the result of executing method OR undefined if the user has opted out
 */
function addOptOutCheckMixpanelGroup(method) {
    return _addOptOutCheck(method, function(name) {
        return this._get_config(name);
    });
}

/**
 * Clear the user's opt in/out status of data tracking and cookies/localstorage for the given token
 * @param {string} token - Mixpanel project tracking token
 * @param {Object} [options]
 * @param {string} [options.persistenceType] Persistence mechanism used - cookie or localStorage
 * @param {string} [options.persistencePrefix=__mp_opt_in_out] - custom prefix to be used in the cookie/localstorage name
 * @param {Number} [options.cookieExpiration] - number of days until the opt-in cookie expires
 * @param {string} [options.cookieDomain] - custom cookie domain
 * @param {boolean} [options.crossSiteCookie] - whether the opt-in cookie is set as cross-site-enabled
 * @param {boolean} [options.crossSubdomainCookie] - whether the opt-in cookie is set as cross-subdomain or not
 * @param {boolean} [options.secureCookie] - whether the opt-in cookie is set as secure or not
 */
function clearOptInOut(token, options) {
    options = options || {};
    _getStorage(options).remove(
        _getStorageKey(token, options), !!options.crossSubdomainCookie, options.cookieDomain
    );
}

/** Private **/

/**
 * Get storage util
 * @param {Object} [options]
 * @param {string} [options.persistenceType]
 * @returns {object} either _.cookie or _.localstorage
 */
function _getStorage(options) {
    options = options || {};
    return options.persistenceType === 'localStorage' ? _.localStorage : _.cookie;
}

/**
 * Get the name of the cookie that is used for the given opt type (tracking, cookie, etc.)
 * @param {string} token - Mixpanel project tracking token
 * @param {Object} [options]
 * @param {string} [options.persistencePrefix=__mp_opt_in_out] - custom prefix to be used in the cookie/localstorage name
 * @returns {string} the name of the cookie for the given opt type
 */
function _getStorageKey(token, options) {
    options = options || {};
    return (options.persistencePrefix || GDPR_DEFAULT_PERSISTENCE_PREFIX) + token;
}

/**
 * Get the value of the cookie that is used for the given opt type (tracking, cookie, etc.)
 * @param {string} token - Mixpanel project tracking token
 * @param {Object} [options]
 * @param {string} [options.persistencePrefix=__mp_opt_in_out] - custom prefix to be used in the cookie/localstorage name
 * @returns {string} the value of the cookie for the given opt type
 */
function _getStorageValue(token, options) {
    return _getStorage(options).get(_getStorageKey(token, options));
}

/**
 * Check whether the user has set the DNT/doNotTrack setting to true in their browser
 * @param {Object} [options]
 * @param {string} [options.window] - alternate window object to check; used to force various DNT settings in browser tests
 * @param {boolean} [options.ignoreDnt] - flag to ignore browser DNT settings and always return false
 * @returns {boolean} whether the DNT setting is true
 */
function _hasDoNotTrackFlagOn(options) {
    if (options && options.ignoreDnt) {
        return false;
    }
    var win = (options && options.window) || window$1;
    var nav = win['navigator'] || {};
    var hasDntOn = false;

    _.each([
        nav['doNotTrack'], // standard
        nav['msDoNotTrack'],
        win['doNotTrack']
    ], function(dntValue) {
        if (_.includes([true, 1, '1', 'yes'], dntValue)) {
            hasDntOn = true;
        }
    });

    return hasDntOn;
}

/**
 * Set cookie/localstorage for the user indicating that they are opted in or out for the given opt type
 * @param {boolean} optValue - whether to opt the user in or out for the given opt type
 * @param {string} token - Mixpanel project tracking token
 * @param {Object} [options]
 * @param {trackFunction} [options.track] - function used for tracking a Mixpanel event to record the opt-in action
 * @param {string} [options.trackEventName] - event name to be used for tracking the opt-in action
 * @param {Object} [options.trackProperties] - set of properties to be tracked along with the opt-in action
 * @param {string} [options.persistencePrefix=__mp_opt_in_out] - custom prefix to be used in the cookie/localstorage name
 * @param {Number} [options.cookieExpiration] - number of days until the opt-in cookie expires
 * @param {string} [options.cookieDomain] - custom cookie domain
 * @param {boolean} [options.crossSiteCookie] - whether the opt-in cookie is set as cross-site-enabled
 * @param {boolean} [options.crossSubdomainCookie] - whether the opt-in cookie is set as cross-subdomain or not
 * @param {boolean} [options.secureCookie] - whether the opt-in cookie is set as secure or not
 */
function _optInOut(optValue, token, options) {
    if (!_.isString(token) || !token.length) {
        console$1.error('gdpr.' + (optValue ? 'optIn' : 'optOut') + ' called with an invalid token');
        return;
    }

    options = options || {};

    _getStorage(options).set(
        _getStorageKey(token, options),
        optValue ? 1 : 0,
        _.isNumber(options.cookieExpiration) ? options.cookieExpiration : null,
        !!options.crossSubdomainCookie,
        !!options.secureCookie,
        !!options.crossSiteCookie,
        options.cookieDomain
    );

    if (options.track && optValue) { // only track event if opting in (optValue=true)
        options.track(options.trackEventName || '$opt_in', options.trackProperties, {
            'send_immediately': true
        });
    }
}

/**
 * Wrap a method with a check for whether the user is opted out of data tracking and cookies/localstorage for the given token
 * If the user has opted out, return early instead of executing the method.
 * If a callback argument was provided, execute it passing the 0 error code.
 * @param {function} method - wrapped method to be executed if the user has not opted out
 * @param {function} getConfigValue - getter function for the Mixpanel API token and other options to be used with opt-out check
 * @returns {*} the result of executing method OR undefined if the user has opted out
 */
function _addOptOutCheck(method, getConfigValue) {
    return function() {
        var optedOut = false;

        try {
            var token = getConfigValue.call(this, 'token');
            var ignoreDnt = getConfigValue.call(this, 'ignore_dnt');
            var persistenceType = getConfigValue.call(this, 'opt_out_tracking_persistence_type');
            var persistencePrefix = getConfigValue.call(this, 'opt_out_tracking_cookie_prefix');
            var win = getConfigValue.call(this, 'window'); // used to override window during browser tests

            if (token) { // if there was an issue getting the token, continue method execution as normal
                optedOut = hasOptedOut(token, {
                    ignoreDnt: ignoreDnt,
                    persistenceType: persistenceType,
                    persistencePrefix: persistencePrefix,
                    window: win
                });
            }
        } catch(err) {
            console$1.error('Unexpected error when checking tracking opt-out status: ' + err);
        }

        if (!optedOut) {
            return method.apply(this, arguments);
        }

        var callback = arguments[arguments.length - 1];
        if (typeof(callback) === 'function') {
            callback(0);
        }

        return;
    };
}

/** @const */ var SET_ACTION      = '$set';
/** @const */ var SET_ONCE_ACTION = '$set_once';
/** @const */ var UNSET_ACTION    = '$unset';
/** @const */ var ADD_ACTION      = '$add';
/** @const */ var APPEND_ACTION   = '$append';
/** @const */ var UNION_ACTION    = '$union';
/** @const */ var REMOVE_ACTION   = '$remove';
/** @const */ var DELETE_ACTION   = '$delete';

// Common internal methods for mixpanel.people and mixpanel.group APIs.
// These methods shouldn't involve network I/O.
var apiActions = {
    set_action: function(prop, to) {
        var data = {};
        var $set = {};
        if (_.isObject(prop)) {
            _.each(prop, function(v, k) {
                if (!this._is_reserved_property(k)) {
                    $set[k] = v;
                }
            }, this);
        } else {
            $set[prop] = to;
        }

        data[SET_ACTION] = $set;
        return data;
    },

    unset_action: function(prop) {
        var data = {};
        var $unset = [];
        if (!_.isArray(prop)) {
            prop = [prop];
        }

        _.each(prop, function(k) {
            if (!this._is_reserved_property(k)) {
                $unset.push(k);
            }
        }, this);

        data[UNSET_ACTION] = $unset;
        return data;
    },

    set_once_action: function(prop, to) {
        var data = {};
        var $set_once = {};
        if (_.isObject(prop)) {
            _.each(prop, function(v, k) {
                if (!this._is_reserved_property(k)) {
                    $set_once[k] = v;
                }
            }, this);
        } else {
            $set_once[prop] = to;
        }
        data[SET_ONCE_ACTION] = $set_once;
        return data;
    },

    union_action: function(list_name, values) {
        var data = {};
        var $union = {};
        if (_.isObject(list_name)) {
            _.each(list_name, function(v, k) {
                if (!this._is_reserved_property(k)) {
                    $union[k] = _.isArray(v) ? v : [v];
                }
            }, this);
        } else {
            $union[list_name] = _.isArray(values) ? values : [values];
        }
        data[UNION_ACTION] = $union;
        return data;
    },

    append_action: function(list_name, value) {
        var data = {};
        var $append = {};
        if (_.isObject(list_name)) {
            _.each(list_name, function(v, k) {
                if (!this._is_reserved_property(k)) {
                    $append[k] = v;
                }
            }, this);
        } else {
            $append[list_name] = value;
        }
        data[APPEND_ACTION] = $append;
        return data;
    },

    remove_action: function(list_name, value) {
        var data = {};
        var $remove = {};
        if (_.isObject(list_name)) {
            _.each(list_name, function(v, k) {
                if (!this._is_reserved_property(k)) {
                    $remove[k] = v;
                }
            }, this);
        } else {
            $remove[list_name] = value;
        }
        data[REMOVE_ACTION] = $remove;
        return data;
    },

    delete_action: function() {
        var data = {};
        data[DELETE_ACTION] = '';
        return data;
    }
};

/**
 * Mixpanel Group Object
 * @constructor
 */
var MixpanelGroup = function() {};

_.extend(MixpanelGroup.prototype, apiActions);

MixpanelGroup.prototype._init = function(mixpanel_instance, group_key, group_id) {
    this._mixpanel = mixpanel_instance;
    this._group_key = group_key;
    this._group_id = group_id;
};

/**
 * Set properties on a group.
 *
 * ### Usage:
 *
 *     mixpanel.get_group('company', 'mixpanel').set('Location', '405 Howard');
 *
 *     // or set multiple properties at once
 *     mixpanel.get_group('company', 'mixpanel').set({
 *          'Location': '405 Howard',
 *          'Founded' : 2009,
 *     });
 *     // properties can be strings, integers, dates, or lists
 *
 * @param {Object|String} prop If a string, this is the name of the property. If an object, this is an associative array of names and values.
 * @param {*} [to] A value to set on the given property name
 * @param {Function} [callback] If provided, the callback will be called after the tracking event
 */
MixpanelGroup.prototype.set = addOptOutCheckMixpanelGroup(function(prop, to, callback) {
    var data = this.set_action(prop, to);
    if (_.isObject(prop)) {
        callback = to;
    }
    return this._send_request(data, callback);
});

/**
 * Set properties on a group, only if they do not yet exist.
 * This will not overwrite previous group property values, unlike
 * group.set().
 *
 * ### Usage:
 *
 *     mixpanel.get_group('company', 'mixpanel').set_once('Location', '405 Howard');
 *
 *     // or set multiple properties at once
 *     mixpanel.get_group('company', 'mixpanel').set_once({
 *          'Location': '405 Howard',
 *          'Founded' : 2009,
 *     });
 *     // properties can be strings, integers, lists or dates
 *
 * @param {Object|String} prop If a string, this is the name of the property. If an object, this is an associative array of names and values.
 * @param {*} [to] A value to set on the given property name
 * @param {Function} [callback] If provided, the callback will be called after the tracking event
 */
MixpanelGroup.prototype.set_once = addOptOutCheckMixpanelGroup(function(prop, to, callback) {
    var data = this.set_once_action(prop, to);
    if (_.isObject(prop)) {
        callback = to;
    }
    return this._send_request(data, callback);
});

/**
 * Unset properties on a group permanently.
 *
 * ### Usage:
 *
 *     mixpanel.get_group('company', 'mixpanel').unset('Founded');
 *
 * @param {String} prop The name of the property.
 * @param {Function} [callback] If provided, the callback will be called after the tracking event
 */
MixpanelGroup.prototype.unset = addOptOutCheckMixpanelGroup(function(prop, callback) {
    var data = this.unset_action(prop);
    return this._send_request(data, callback);
});

/**
 * Merge a given list with a list-valued group property, excluding duplicate values.
 *
 * ### Usage:
 *
 *     // merge a value to a list, creating it if needed
 *     mixpanel.get_group('company', 'mixpanel').union('Location', ['San Francisco', 'London']);
 *
 * @param {String} list_name Name of the property.
 * @param {Array} values Values to merge with the given property
 * @param {Function} [callback] If provided, the callback will be called after the tracking event
 */
MixpanelGroup.prototype.union = addOptOutCheckMixpanelGroup(function(list_name, values, callback) {
    if (_.isObject(list_name)) {
        callback = values;
    }
    var data = this.union_action(list_name, values);
    return this._send_request(data, callback);
});

/**
 * Permanently delete a group.
 *
 * ### Usage:
 *
 *     mixpanel.get_group('company', 'mixpanel').delete();
 *
 * @param {Function} [callback] If provided, the callback will be called after the tracking event
 */
MixpanelGroup.prototype['delete'] = addOptOutCheckMixpanelGroup(function(callback) {
    // bracket notation above prevents a minification error related to reserved words
    var data = this.delete_action();
    return this._send_request(data, callback);
});

/**
 * Remove a property from a group. The value will be ignored if doesn't exist.
 *
 * ### Usage:
 *
 *     mixpanel.get_group('company', 'mixpanel').remove('Location', 'London');
 *
 * @param {String} list_name Name of the property.
 * @param {Object} value Value to remove from the given group property
 * @param {Function} [callback] If provided, the callback will be called after the tracking event
 */
MixpanelGroup.prototype.remove = addOptOutCheckMixpanelGroup(function(list_name, value, callback) {
    var data = this.remove_action(list_name, value);
    return this._send_request(data, callback);
});

MixpanelGroup.prototype._send_request = function(data, callback) {
    data['$group_key'] = this._group_key;
    data['$group_id'] = this._group_id;
    data['$token'] = this._get_config('token');

    var date_encoded_data = _.encodeDates(data);
    return this._mixpanel._track_or_batch({
        type: 'groups',
        data: date_encoded_data,
        endpoint: this._get_config('api_host') + '/' +  this._get_config('api_routes')['groups'],
        batcher: this._mixpanel.request_batchers.groups
    }, callback);
};

MixpanelGroup.prototype._is_reserved_property = function(prop) {
    return prop === '$group_key' || prop === '$group_id';
};

MixpanelGroup.prototype._get_config = function(conf) {
    return this._mixpanel.get_config(conf);
};

MixpanelGroup.prototype.toString = function() {
    return this._mixpanel.toString() + '.group.' + this._group_key + '.' + this._group_id;
};

// MixpanelGroup Exports
MixpanelGroup.prototype['remove']   = MixpanelGroup.prototype.remove;
MixpanelGroup.prototype['set']      = MixpanelGroup.prototype.set;
MixpanelGroup.prototype['set_once'] = MixpanelGroup.prototype.set_once;
MixpanelGroup.prototype['union']    = MixpanelGroup.prototype.union;
MixpanelGroup.prototype['unset']    = MixpanelGroup.prototype.unset;
MixpanelGroup.prototype['toString'] = MixpanelGroup.prototype.toString;

/**
 * Mixpanel People Object
 * @constructor
 */
var MixpanelPeople = function() {};

_.extend(MixpanelPeople.prototype, apiActions);

MixpanelPeople.prototype._init = function(mixpanel_instance) {
    this._mixpanel = mixpanel_instance;
};

/*
* Set properties on a user record.
*
* ### Usage:
*
*     mixpanel.people.set('gender', 'm');
*
*     // or set multiple properties at once
*     mixpanel.people.set({
*         'Company': 'Acme',
*         'Plan': 'Premium',
*         'Upgrade date': new Date()
*     });
*     // properties can be strings, integers, dates, or lists
*
* @param {Object|String} prop If a string, this is the name of the property. If an object, this is an associative array of names and values.
* @param {*} [to] A value to set on the given property name
* @param {Function} [callback] If provided, the callback will be called after tracking the event.
*/
MixpanelPeople.prototype.set = addOptOutCheckMixpanelPeople(function(prop, to, callback) {
    var data = this.set_action(prop, to);
    if (_.isObject(prop)) {
        callback = to;
    }
    // make sure that the referrer info has been updated and saved
    if (this._get_config('save_referrer')) {
        this._mixpanel['persistence'].update_referrer_info(document.referrer);
    }

    // update $set object with default people properties
    data[SET_ACTION] = _.extend(
        {},
        _.info.people_properties(),
        data[SET_ACTION]
    );
    return this._send_request(data, callback);
});

/*
* Set properties on a user record, only if they do not yet exist.
* This will not overwrite previous people property values, unlike
* people.set().
*
* ### Usage:
*
*     mixpanel.people.set_once('First Login Date', new Date());
*
*     // or set multiple properties at once
*     mixpanel.people.set_once({
*         'First Login Date': new Date(),
*         'Starting Plan': 'Premium'
*     });
*
*     // properties can be strings, integers or dates
*
* @param {Object|String} prop If a string, this is the name of the property. If an object, this is an associative array of names and values.
* @param {*} [to] A value to set on the given property name
* @param {Function} [callback] If provided, the callback will be called after tracking the event.
*/
MixpanelPeople.prototype.set_once = addOptOutCheckMixpanelPeople(function(prop, to, callback) {
    var data = this.set_once_action(prop, to);
    if (_.isObject(prop)) {
        callback = to;
    }
    return this._send_request(data, callback);
});

/*
* Unset properties on a user record (permanently removes the properties and their values from a profile).
*
* ### Usage:
*
*     mixpanel.people.unset('gender');
*
*     // or unset multiple properties at once
*     mixpanel.people.unset(['gender', 'Company']);
*
* @param {Array|String} prop If a string, this is the name of the property. If an array, this is a list of property names.
* @param {Function} [callback] If provided, the callback will be called after tracking the event.
*/
MixpanelPeople.prototype.unset = addOptOutCheckMixpanelPeople(function(prop, callback) {
    var data = this.unset_action(prop);
    return this._send_request(data, callback);
});

/*
* Increment/decrement numeric people analytics properties.
*
* ### Usage:
*
*     mixpanel.people.increment('page_views', 1);
*
*     // or, for convenience, if you're just incrementing a counter by
*     // 1, you can simply do
*     mixpanel.people.increment('page_views');
*
*     // to decrement a counter, pass a negative number
*     mixpanel.people.increment('credits_left', -1);
*
*     // like mixpanel.people.set(), you can increment multiple
*     // properties at once:
*     mixpanel.people.increment({
*         counter1: 1,
*         counter2: 6
*     });
*
* @param {Object|String} prop If a string, this is the name of the property. If an object, this is an associative array of names and numeric values.
* @param {Number} [by] An amount to increment the given property
* @param {Function} [callback] If provided, the callback will be called after tracking the event.
*/
MixpanelPeople.prototype.increment = addOptOutCheckMixpanelPeople(function(prop, by, callback) {
    var data = {};
    var $add = {};
    if (_.isObject(prop)) {
        _.each(prop, function(v, k) {
            if (!this._is_reserved_property(k)) {
                if (isNaN(parseFloat(v))) {
                    console$1.error('Invalid increment value passed to mixpanel.people.increment - must be a number');
                    return;
                } else {
                    $add[k] = v;
                }
            }
        }, this);
        callback = by;
    } else {
        // convenience: mixpanel.people.increment('property'); will
        // increment 'property' by 1
        if (_.isUndefined(by)) {
            by = 1;
        }
        $add[prop] = by;
    }
    data[ADD_ACTION] = $add;

    return this._send_request(data, callback);
});

/*
* Append a value to a list-valued people analytics property.
*
* ### Usage:
*
*     // append a value to a list, creating it if needed
*     mixpanel.people.append('pages_visited', 'homepage');
*
*     // like mixpanel.people.set(), you can append multiple
*     // properties at once:
*     mixpanel.people.append({
*         list1: 'bob',
*         list2: 123
*     });
*
* @param {Object|String} list_name If a string, this is the name of the property. If an object, this is an associative array of names and values.
* @param {*} [value] value An item to append to the list
* @param {Function} [callback] If provided, the callback will be called after tracking the event.
*/
MixpanelPeople.prototype.append = addOptOutCheckMixpanelPeople(function(list_name, value, callback) {
    if (_.isObject(list_name)) {
        callback = value;
    }
    var data = this.append_action(list_name, value);
    return this._send_request(data, callback);
});

/*
* Remove a value from a list-valued people analytics property.
*
* ### Usage:
*
*     mixpanel.people.remove('School', 'UCB');
*
* @param {Object|String} list_name If a string, this is the name of the property. If an object, this is an associative array of names and values.
* @param {*} [value] value Item to remove from the list
* @param {Function} [callback] If provided, the callback will be called after tracking the event.
*/
MixpanelPeople.prototype.remove = addOptOutCheckMixpanelPeople(function(list_name, value, callback) {
    if (_.isObject(list_name)) {
        callback = value;
    }
    var data = this.remove_action(list_name, value);
    return this._send_request(data, callback);
});

/*
* Merge a given list with a list-valued people analytics property,
* excluding duplicate values.
*
* ### Usage:
*
*     // merge a value to a list, creating it if needed
*     mixpanel.people.union('pages_visited', 'homepage');
*
*     // like mixpanel.people.set(), you can append multiple
*     // properties at once:
*     mixpanel.people.union({
*         list1: 'bob',
*         list2: 123
*     });
*
*     // like mixpanel.people.append(), you can append multiple
*     // values to the same list:
*     mixpanel.people.union({
*         list1: ['bob', 'billy']
*     });
*
* @param {Object|String} list_name If a string, this is the name of the property. If an object, this is an associative array of names and values.
* @param {*} [value] Value / values to merge with the given property
* @param {Function} [callback] If provided, the callback will be called after tracking the event.
*/
MixpanelPeople.prototype.union = addOptOutCheckMixpanelPeople(function(list_name, values, callback) {
    if (_.isObject(list_name)) {
        callback = values;
    }
    var data = this.union_action(list_name, values);
    return this._send_request(data, callback);
});

/*
 * Record that you have charged the current user a certain amount
 * of money. Charges recorded with track_charge() will appear in the
 * Mixpanel revenue report.
 *
 * ### Usage:
 *
 *     // charge a user $50
 *     mixpanel.people.track_charge(50);
 *
 *     // charge a user $30.50 on the 2nd of january
 *     mixpanel.people.track_charge(30.50, {
 *         '$time': new Date('jan 1 2012')
 *     });
 *
 * @param {Number} amount The amount of money charged to the current user
 * @param {Object} [properties] An associative array of properties associated with the charge
 * @param {Function} [callback] If provided, the callback will be called when the server responds
 * @deprecated
 */
MixpanelPeople.prototype.track_charge = addOptOutCheckMixpanelPeople(function(amount, properties, callback) {
    if (!_.isNumber(amount)) {
        amount = parseFloat(amount);
        if (isNaN(amount)) {
            console$1.error('Invalid value passed to mixpanel.people.track_charge - must be a number');
            return;
        }
    }

    return this.append('$transactions', _.extend({
        '$amount': amount
    }, properties), callback);
});

/*
 * Permanently clear all revenue report transactions from the
 * current user's people analytics profile.
 *
 * ### Usage:
 *
 *     mixpanel.people.clear_charges();
 *
 * @param {Function} [callback] If provided, the callback will be called after tracking the event.
 * @deprecated
 */
MixpanelPeople.prototype.clear_charges = function(callback) {
    return this.set('$transactions', [], callback);
};

/*
* Permanently deletes the current people analytics profile from
* Mixpanel (using the current distinct_id).
*
* ### Usage:
*
*     // remove the all data you have stored about the current user
*     mixpanel.people.delete_user();
*
*/
MixpanelPeople.prototype.delete_user = function() {
    if (!this._identify_called()) {
        console$1.error('mixpanel.people.delete_user() requires you to call identify() first');
        return;
    }
    var data = {'$delete': this._mixpanel.get_distinct_id()};
    return this._send_request(data);
};

MixpanelPeople.prototype.toString = function() {
    return this._mixpanel.toString() + '.people';
};

MixpanelPeople.prototype._send_request = function(data, callback) {
    data['$token'] = this._get_config('token');
    data['$distinct_id'] = this._mixpanel.get_distinct_id();
    var device_id = this._mixpanel.get_property('$device_id');
    var user_id = this._mixpanel.get_property('$user_id');
    var had_persisted_distinct_id = this._mixpanel.get_property('$had_persisted_distinct_id');
    if (device_id) {
        data['$device_id'] = device_id;
    }
    if (user_id) {
        data['$user_id'] = user_id;
    }
    if (had_persisted_distinct_id) {
        data['$had_persisted_distinct_id'] = had_persisted_distinct_id;
    }

    var date_encoded_data = _.encodeDates(data);

    if (!this._identify_called()) {
        this._enqueue(data);
        if (!_.isUndefined(callback)) {
            if (this._get_config('verbose')) {
                callback({status: -1, error: null});
            } else {
                callback(-1);
            }
        }
        return _.truncate(date_encoded_data, 255);
    }

    return this._mixpanel._track_or_batch({
        type: 'people',
        data: date_encoded_data,
        endpoint: this._get_config('api_host') + '/' +  this._get_config('api_routes')['engage'],
        batcher: this._mixpanel.request_batchers.people
    }, callback);
};

MixpanelPeople.prototype._get_config = function(conf_var) {
    return this._mixpanel.get_config(conf_var);
};

MixpanelPeople.prototype._identify_called = function() {
    return this._mixpanel._flags.identify_called === true;
};

// Queue up engage operations if identify hasn't been called yet.
MixpanelPeople.prototype._enqueue = function(data) {
    if (SET_ACTION in data) {
        this._mixpanel['persistence']._add_to_people_queue(SET_ACTION, data);
    } else if (SET_ONCE_ACTION in data) {
        this._mixpanel['persistence']._add_to_people_queue(SET_ONCE_ACTION, data);
    } else if (UNSET_ACTION in data) {
        this._mixpanel['persistence']._add_to_people_queue(UNSET_ACTION, data);
    } else if (ADD_ACTION in data) {
        this._mixpanel['persistence']._add_to_people_queue(ADD_ACTION, data);
    } else if (APPEND_ACTION in data) {
        this._mixpanel['persistence']._add_to_people_queue(APPEND_ACTION, data);
    } else if (REMOVE_ACTION in data) {
        this._mixpanel['persistence']._add_to_people_queue(REMOVE_ACTION, data);
    } else if (UNION_ACTION in data) {
        this._mixpanel['persistence']._add_to_people_queue(UNION_ACTION, data);
    } else {
        console$1.error('Invalid call to _enqueue():', data);
    }
};

MixpanelPeople.prototype._flush_one_queue = function(action, action_method, callback, queue_to_params_fn) {
    var _this = this;
    var queued_data = _.extend({}, this._mixpanel['persistence'].load_queue(action));
    var action_params = queued_data;

    if (!_.isUndefined(queued_data) && _.isObject(queued_data) && !_.isEmptyObject(queued_data)) {
        _this._mixpanel['persistence']._pop_from_people_queue(action, queued_data);
        _this._mixpanel['persistence'].save();
        if (queue_to_params_fn) {
            action_params = queue_to_params_fn(queued_data);
        }
        action_method.call(_this, action_params, function(response, data) {
            // on bad response, we want to add it back to the queue
            if (response === 0) {
                _this._mixpanel['persistence']._add_to_people_queue(action, queued_data);
            }
            if (!_.isUndefined(callback)) {
                callback(response, data);
            }
        });
    }
};

// Flush queued engage operations - order does not matter,
// and there are network level race conditions anyway
MixpanelPeople.prototype._flush = function(
    _set_callback, _add_callback, _append_callback, _set_once_callback, _union_callback, _unset_callback, _remove_callback
) {
    var _this = this;

    this._flush_one_queue(SET_ACTION, this.set, _set_callback);
    this._flush_one_queue(SET_ONCE_ACTION, this.set_once, _set_once_callback);
    this._flush_one_queue(UNSET_ACTION, this.unset, _unset_callback, function(queue) { return _.keys(queue); });
    this._flush_one_queue(ADD_ACTION, this.increment, _add_callback);
    this._flush_one_queue(UNION_ACTION, this.union, _union_callback);

    // we have to fire off each $append individually since there is
    // no concat method server side
    var $append_queue = this._mixpanel['persistence'].load_queue(APPEND_ACTION);
    if (!_.isUndefined($append_queue) && _.isArray($append_queue) && $append_queue.length) {
        var $append_item;
        var append_callback = function(response, data) {
            if (response === 0) {
                _this._mixpanel['persistence']._add_to_people_queue(APPEND_ACTION, $append_item);
            }
            if (!_.isUndefined(_append_callback)) {
                _append_callback(response, data);
            }
        };
        for (var i = $append_queue.length - 1; i >= 0; i--) {
            $append_queue = this._mixpanel['persistence'].load_queue(APPEND_ACTION);
            $append_item = $append_queue.pop();
            _this._mixpanel['persistence'].save();
            if (!_.isEmptyObject($append_item)) {
                _this.append($append_item, append_callback);
            }
        }
    }

    // same for $remove
    var $remove_queue = this._mixpanel['persistence'].load_queue(REMOVE_ACTION);
    if (!_.isUndefined($remove_queue) && _.isArray($remove_queue) && $remove_queue.length) {
        var $remove_item;
        var remove_callback = function(response, data) {
            if (response === 0) {
                _this._mixpanel['persistence']._add_to_people_queue(REMOVE_ACTION, $remove_item);
            }
            if (!_.isUndefined(_remove_callback)) {
                _remove_callback(response, data);
            }
        };
        for (var j = $remove_queue.length - 1; j >= 0; j--) {
            $remove_queue = this._mixpanel['persistence'].load_queue(REMOVE_ACTION);
            $remove_item = $remove_queue.pop();
            _this._mixpanel['persistence'].save();
            if (!_.isEmptyObject($remove_item)) {
                _this.remove($remove_item, remove_callback);
            }
        }
    }
};

MixpanelPeople.prototype._is_reserved_property = function(prop) {
    return prop === '$distinct_id' || prop === '$token' || prop === '$device_id' || prop === '$user_id' || prop === '$had_persisted_distinct_id';
};

// MixpanelPeople Exports
MixpanelPeople.prototype['set']           = MixpanelPeople.prototype.set;
MixpanelPeople.prototype['set_once']      = MixpanelPeople.prototype.set_once;
MixpanelPeople.prototype['unset']         = MixpanelPeople.prototype.unset;
MixpanelPeople.prototype['increment']     = MixpanelPeople.prototype.increment;
MixpanelPeople.prototype['append']        = MixpanelPeople.prototype.append;
MixpanelPeople.prototype['remove']        = MixpanelPeople.prototype.remove;
MixpanelPeople.prototype['union']         = MixpanelPeople.prototype.union;
MixpanelPeople.prototype['track_charge']  = MixpanelPeople.prototype.track_charge;
MixpanelPeople.prototype['clear_charges'] = MixpanelPeople.prototype.clear_charges;
MixpanelPeople.prototype['delete_user']   = MixpanelPeople.prototype.delete_user;
MixpanelPeople.prototype['toString']      = MixpanelPeople.prototype.toString;

/*
 * Constants
 */
/** @const */ var SET_QUEUE_KEY          = '__mps';
/** @const */ var SET_ONCE_QUEUE_KEY     = '__mpso';
/** @const */ var UNSET_QUEUE_KEY        = '__mpus';
/** @const */ var ADD_QUEUE_KEY          = '__mpa';
/** @const */ var APPEND_QUEUE_KEY       = '__mpap';
/** @const */ var REMOVE_QUEUE_KEY       = '__mpr';
/** @const */ var UNION_QUEUE_KEY        = '__mpu';
// This key is deprecated, but we want to check for it to see whether aliasing is allowed.
/** @const */ var PEOPLE_DISTINCT_ID_KEY = '$people_distinct_id';
/** @const */ var ALIAS_ID_KEY           = '__alias';
/** @const */ var EVENT_TIMERS_KEY       = '__timers';
/** @const */ var RESERVED_PROPERTIES = [
    SET_QUEUE_KEY,
    SET_ONCE_QUEUE_KEY,
    UNSET_QUEUE_KEY,
    ADD_QUEUE_KEY,
    APPEND_QUEUE_KEY,
    REMOVE_QUEUE_KEY,
    UNION_QUEUE_KEY,
    PEOPLE_DISTINCT_ID_KEY,
    ALIAS_ID_KEY,
    EVENT_TIMERS_KEY
];

/**
 * Mixpanel Persistence Object
 * @constructor
 */
var MixpanelPersistence = function(config) {
    this['props'] = {};
    this.campaign_params_saved = false;

    if (config['persistence_name']) {
        this.name = 'mp_' + config['persistence_name'];
    } else {
        this.name = 'mp_' + config['token'] + '_mixpanel';
    }

    var storage_type = config['persistence'];
    if (storage_type !== 'cookie' && storage_type !== 'localStorage') {
        console$1.critical('Unknown persistence type ' + storage_type + '; falling back to cookie');
        storage_type = config['persistence'] = 'cookie';
    }

    if (storage_type === 'localStorage' && _.localStorage.is_supported()) {
        this.storage = _.localStorage;
    } else {
        this.storage = _.cookie;
    }

    this.load();
    this.update_config(config);
    this.upgrade(config);
    this.save();
};

MixpanelPersistence.prototype.properties = function() {
    var p = {};

    this.load();

    // Filter out reserved properties
    _.each(this['props'], function(v, k) {
        if (!_.include(RESERVED_PROPERTIES, k)) {
            p[k] = v;
        }
    });
    return p;
};

MixpanelPersistence.prototype.load = function() {
    if (this.disabled) { return; }

    var entry = this.storage.parse(this.name);

    if (entry) {
        this['props'] = _.extend({}, entry);
    }
};

MixpanelPersistence.prototype.upgrade = function(config) {
    var upgrade_from_old_lib = config['upgrade'],
        old_cookie_name,
        old_cookie;

    if (upgrade_from_old_lib) {
        old_cookie_name = 'mp_super_properties';
        // Case where they had a custom cookie name before.
        if (typeof(upgrade_from_old_lib) === 'string') {
            old_cookie_name = upgrade_from_old_lib;
        }

        old_cookie = this.storage.parse(old_cookie_name);

        // remove the cookie
        this.storage.remove(old_cookie_name);
        this.storage.remove(old_cookie_name, true);

        if (old_cookie) {
            this['props'] = _.extend(
                this['props'],
                old_cookie['all'],
                old_cookie['events']
            );
        }
    }

    if (!config['cookie_name'] && config['name'] !== 'mixpanel') {
        // special case to handle people with cookies of the form
        // mp_TOKEN_INSTANCENAME from the first release of this library
        old_cookie_name = 'mp_' + config['token'] + '_' + config['name'];
        old_cookie = this.storage.parse(old_cookie_name);

        if (old_cookie) {
            this.storage.remove(old_cookie_name);
            this.storage.remove(old_cookie_name, true);

            // Save the prop values that were in the cookie from before -
            // this should only happen once as we delete the old one.
            this.register_once(old_cookie);
        }
    }

    if (this.storage === _.localStorage) {
        old_cookie = _.cookie.parse(this.name);

        _.cookie.remove(this.name);
        _.cookie.remove(this.name, true);

        if (old_cookie) {
            this.register_once(old_cookie);
        }
    }
};

MixpanelPersistence.prototype.save = function() {
    if (this.disabled) { return; }

    this.storage.set(
        this.name,
        _.JSONEncode(this['props']),
        this.expire_days,
        this.cross_subdomain,
        this.secure,
        this.cross_site,
        this.cookie_domain
    );
};

MixpanelPersistence.prototype.load_prop = function(key) {
    this.load();
    return this['props'][key];
};

MixpanelPersistence.prototype.remove = function() {
    // remove both domain and subdomain cookies
    this.storage.remove(this.name, false, this.cookie_domain);
    this.storage.remove(this.name, true, this.cookie_domain);
};

// removes the storage entry and deletes all loaded data
// forced name for tests
MixpanelPersistence.prototype.clear = function() {
    this.remove();
    this['props'] = {};
};

/**
* @param {Object} props
* @param {*=} default_value
* @param {number=} days
*/
MixpanelPersistence.prototype.register_once = function(props, default_value, days) {
    if (_.isObject(props)) {
        if (typeof(default_value) === 'undefined') { default_value = 'None'; }
        this.expire_days = (typeof(days) === 'undefined') ? this.default_expiry : days;

        this.load();

        _.each(props, function(val, prop) {
            if (!this['props'].hasOwnProperty(prop) || this['props'][prop] === default_value) {
                this['props'][prop] = val;
            }
        }, this);

        this.save();

        return true;
    }
    return false;
};

/**
* @param {Object} props
* @param {number=} days
*/
MixpanelPersistence.prototype.register = function(props, days) {
    if (_.isObject(props)) {
        this.expire_days = (typeof(days) === 'undefined') ? this.default_expiry : days;

        this.load();
        _.extend(this['props'], props);
        this.save();

        return true;
    }
    return false;
};

MixpanelPersistence.prototype.unregister = function(prop) {
    this.load();
    if (prop in this['props']) {
        delete this['props'][prop];
        this.save();
    }
};

MixpanelPersistence.prototype.update_search_keyword = function(referrer) {
    this.register(_.info.searchInfo(referrer));
};

// EXPORTED METHOD, we test this directly.
MixpanelPersistence.prototype.update_referrer_info = function(referrer) {
    // If referrer doesn't exist, we want to note the fact that it was type-in traffic.
    this.register_once({
        '$initial_referrer': referrer || '$direct',
        '$initial_referring_domain': _.info.referringDomain(referrer) || '$direct'
    }, '');
};

MixpanelPersistence.prototype.get_referrer_info = function() {
    return _.strip_empty_properties({
        '$initial_referrer': this['props']['$initial_referrer'],
        '$initial_referring_domain': this['props']['$initial_referring_domain']
    });
};

MixpanelPersistence.prototype.update_config = function(config) {
    this.default_expiry = this.expire_days = config['cookie_expiration'];
    this.set_disabled(config['disable_persistence']);
    this.set_cookie_domain(config['cookie_domain']);
    this.set_cross_site(config['cross_site_cookie']);
    this.set_cross_subdomain(config['cross_subdomain_cookie']);
    this.set_secure(config['secure_cookie']);
};

MixpanelPersistence.prototype.set_disabled = function(disabled) {
    this.disabled = disabled;
    if (this.disabled) {
        this.remove();
    } else {
        this.save();
    }
};

MixpanelPersistence.prototype.set_cookie_domain = function(cookie_domain) {
    if (cookie_domain !== this.cookie_domain) {
        this.remove();
        this.cookie_domain = cookie_domain;
        this.save();
    }
};

MixpanelPersistence.prototype.set_cross_site = function(cross_site) {
    if (cross_site !== this.cross_site) {
        this.cross_site = cross_site;
        this.remove();
        this.save();
    }
};

MixpanelPersistence.prototype.set_cross_subdomain = function(cross_subdomain) {
    if (cross_subdomain !== this.cross_subdomain) {
        this.cross_subdomain = cross_subdomain;
        this.remove();
        this.save();
    }
};

MixpanelPersistence.prototype.get_cross_subdomain = function() {
    return this.cross_subdomain;
};

MixpanelPersistence.prototype.set_secure = function(secure) {
    if (secure !== this.secure) {
        this.secure = secure ? true : false;
        this.remove();
        this.save();
    }
};

MixpanelPersistence.prototype._add_to_people_queue = function(queue, data) {
    var q_key = this._get_queue_key(queue),
        q_data = data[queue],
        set_q = this._get_or_create_queue(SET_ACTION),
        set_once_q = this._get_or_create_queue(SET_ONCE_ACTION),
        unset_q = this._get_or_create_queue(UNSET_ACTION),
        add_q = this._get_or_create_queue(ADD_ACTION),
        union_q = this._get_or_create_queue(UNION_ACTION),
        remove_q = this._get_or_create_queue(REMOVE_ACTION, []),
        append_q = this._get_or_create_queue(APPEND_ACTION, []);

    if (q_key === SET_QUEUE_KEY) {
        // Update the set queue - we can override any existing values
        _.extend(set_q, q_data);
        // if there was a pending increment, override it
        // with the set.
        this._pop_from_people_queue(ADD_ACTION, q_data);
        // if there was a pending union, override it
        // with the set.
        this._pop_from_people_queue(UNION_ACTION, q_data);
        this._pop_from_people_queue(UNSET_ACTION, q_data);
    } else if (q_key === SET_ONCE_QUEUE_KEY) {
        // only queue the data if there is not already a set_once call for it.
        _.each(q_data, function(v, k) {
            if (!(k in set_once_q)) {
                set_once_q[k] = v;
            }
        });
        this._pop_from_people_queue(UNSET_ACTION, q_data);
    } else if (q_key === UNSET_QUEUE_KEY) {
        _.each(q_data, function(prop) {

            // undo previously-queued actions on this key
            _.each([set_q, set_once_q, add_q, union_q], function(enqueued_obj) {
                if (prop in enqueued_obj) {
                    delete enqueued_obj[prop];
                }
            });
            _.each(append_q, function(append_obj) {
                if (prop in append_obj) {
                    delete append_obj[prop];
                }
            });

            unset_q[prop] = true;

        });
    } else if (q_key === ADD_QUEUE_KEY) {
        _.each(q_data, function(v, k) {
            // If it exists in the set queue, increment
            // the value
            if (k in set_q) {
                set_q[k] += v;
            } else {
                // If it doesn't exist, update the add
                // queue
                if (!(k in add_q)) {
                    add_q[k] = 0;
                }
                add_q[k] += v;
            }
        }, this);
        this._pop_from_people_queue(UNSET_ACTION, q_data);
    } else if (q_key === UNION_QUEUE_KEY) {
        _.each(q_data, function(v, k) {
            if (_.isArray(v)) {
                if (!(k in union_q)) {
                    union_q[k] = [];
                }
                // We may send duplicates, the server will dedup them.
                union_q[k] = union_q[k].concat(v);
            }
        });
        this._pop_from_people_queue(UNSET_ACTION, q_data);
    } else if (q_key === REMOVE_QUEUE_KEY) {
        remove_q.push(q_data);
        this._pop_from_people_queue(APPEND_ACTION, q_data);
    } else if (q_key === APPEND_QUEUE_KEY) {
        append_q.push(q_data);
        this._pop_from_people_queue(UNSET_ACTION, q_data);
    }

    console$1.log('MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):');
    console$1.log(data);

    this.save();
};

MixpanelPersistence.prototype._pop_from_people_queue = function(queue, data) {
    var q = this['props'][this._get_queue_key(queue)];
    if (!_.isUndefined(q)) {
        _.each(data, function(v, k) {
            if (queue === APPEND_ACTION || queue === REMOVE_ACTION) {
                // list actions: only remove if both k+v match
                // e.g. remove should not override append in a case like
                // append({foo: 'bar'}); remove({foo: 'qux'})
                _.each(q, function(queued_action) {
                    if (queued_action[k] === v) {
                        delete queued_action[k];
                    }
                });
            } else {
                delete q[k];
            }
        }, this);
    }
};

MixpanelPersistence.prototype.load_queue = function(queue) {
    return this.load_prop(this._get_queue_key(queue));
};

MixpanelPersistence.prototype._get_queue_key = function(queue) {
    if (queue === SET_ACTION) {
        return SET_QUEUE_KEY;
    } else if (queue === SET_ONCE_ACTION) {
        return SET_ONCE_QUEUE_KEY;
    } else if (queue === UNSET_ACTION) {
        return UNSET_QUEUE_KEY;
    } else if (queue === ADD_ACTION) {
        return ADD_QUEUE_KEY;
    } else if (queue === APPEND_ACTION) {
        return APPEND_QUEUE_KEY;
    } else if (queue === REMOVE_ACTION) {
        return REMOVE_QUEUE_KEY;
    } else if (queue === UNION_ACTION) {
        return UNION_QUEUE_KEY;
    } else {
        console$1.error('Invalid queue:', queue);
    }
};

MixpanelPersistence.prototype._get_or_create_queue = function(queue, default_val) {
    var key = this._get_queue_key(queue);
    default_val = _.isUndefined(default_val) ? {} : default_val;
    return this['props'][key] || (this['props'][key] = default_val);
};

MixpanelPersistence.prototype.set_event_timer = function(event_name, timestamp) {
    var timers = this.load_prop(EVENT_TIMERS_KEY) || {};
    timers[event_name] = timestamp;
    this['props'][EVENT_TIMERS_KEY] = timers;
    this.save();
};

MixpanelPersistence.prototype.remove_event_timer = function(event_name) {
    var timers = this.load_prop(EVENT_TIMERS_KEY) || {};
    var timestamp = timers[event_name];
    if (!_.isUndefined(timestamp)) {
        delete this['props'][EVENT_TIMERS_KEY][event_name];
        this.save();
    }
    return timestamp;
};

/*
 * Mixpanel JS Library
 *
 * Copyright 2012, Mixpanel, Inc. All Rights Reserved
 * http://mixpanel.com/
 *
 * Includes portions of Underscore.js
 * http://documentcloud.github.com/underscore/
 * (c) 2011 Jeremy Ashkenas, DocumentCloud Inc.
 * Released under the MIT License.
 */

// ==ClosureCompiler==
// @compilation_level ADVANCED_OPTIMIZATIONS
// @output_file_name mixpanel-2.8.min.js
// ==/ClosureCompiler==

/*
SIMPLE STYLE GUIDE:

this.x === public function
this._x === internal - only use within this file
this.__x === private - only use within the class

Globals should be all caps
*/

var init_type;       // MODULE or SNIPPET loader
var mixpanel_master; // main mixpanel instance / object
var INIT_MODULE  = 0;
var INIT_SNIPPET = 1;

var IDENTITY_FUNC = function(x) {return x;};
var NOOP_FUNC = function() {};

/** @const */ var PRIMARY_INSTANCE_NAME = 'mixpanel';
/** @const */ var PAYLOAD_TYPE_BASE64   = 'base64';
/** @const */ var PAYLOAD_TYPE_JSON     = 'json';
/** @const */ var DEVICE_ID_PREFIX      = '$device:';


/*
 * Dynamic... constants? Is that an oxymoron?
 */
// http://hacks.mozilla.org/2009/07/cross-site-xmlhttprequest-with-cors/
// https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#withCredentials
var USE_XHR = (window$1.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest());

// IE<10 does not support cross-origin XHR's but script tags
// with defer won't block window.onload; ENQUEUE_REQUESTS
// should only be true for Opera<12
var ENQUEUE_REQUESTS = !USE_XHR && (userAgent.indexOf('MSIE') === -1) && (userAgent.indexOf('Mozilla') === -1);

// save reference to navigator.sendBeacon so it can be minified
var sendBeacon = null;
if (navigator['sendBeacon']) {
    sendBeacon = function() {
        // late reference to navigator.sendBeacon to allow patching/spying
        return navigator['sendBeacon'].apply(navigator, arguments);
    };
}

var DEFAULT_API_ROUTES = {
    'track': 'track/',
    'engage': 'engage/',
    'groups': 'groups/'
};

/*
 * Module-level globals
 */
var DEFAULT_CONFIG = {
    'api_host':                          'https://api-js.mixpanel.com',
    'api_routes':                        DEFAULT_API_ROUTES,
    'api_method':                        'POST',
    'api_transport':                     'XHR',
    'api_payload_format':                PAYLOAD_TYPE_BASE64,
    'app_host':                          'https://mixpanel.com',
    'cdn':                               'https://cdn.mxpnl.com',
    'cross_site_cookie':                 false,
    'cross_subdomain_cookie':            true,
    'error_reporter':                    NOOP_FUNC,
    'persistence':                       'cookie',
    'persistence_name':                  '',
    'cookie_domain':                     '',
    'cookie_name':                       '',
    'loaded':                            NOOP_FUNC,
    'mp_loader':                         null,
    'track_marketing':                   true,
    'track_pageview':                    false,
    'skip_first_touch_marketing':        false,
    'store_google':                      true,
    'stop_utm_persistence':              false,
    'save_referrer':                     true,
    'test':                              false,
    'verbose':                           false,
    'img':                               false,
    'debug':                             false,
    'track_links_timeout':               300,
    'cookie_expiration':                 365,
    'upgrade':                           false,
    'disable_persistence':               false,
    'disable_cookie':                    false,
    'secure_cookie':                     false,
    'ip':                                true,
    'opt_out_tracking_by_default':       false,
    'opt_out_persistence_by_default':    false,
    'opt_out_tracking_persistence_type': 'localStorage',
    'opt_out_tracking_cookie_prefix':    null,
    'property_blacklist':                [],
    'xhr_headers':                       {}, // { header: value, header2: value }
    'ignore_dnt':                        false,
    'batch_requests':                    true,
    'batch_size':                        50,
    'batch_flush_interval_ms':           5000,
    'batch_request_timeout_ms':          90000,
    'batch_autostart':                   true,
    'hooks':                             {}
};

var DOM_LOADED = false;

/**
 * Mixpanel Library Object
 * @constructor
 */
var MixpanelLib = function() {};


/**
 * create_mplib(token:string, config:object, name:string)
 *
 * This function is used by the init method of MixpanelLib objects
 * as well as the main initializer at the end of the JSLib (that
 * initializes document.mixpanel as well as any additional instances
 * declared before this file has loaded).
 */
var create_mplib = function(token, config, name) {
    var instance,
        target = (name === PRIMARY_INSTANCE_NAME) ? mixpanel_master : mixpanel_master[name];

    if (target && init_type === INIT_MODULE) {
        instance = target;
    } else {
        if (target && !_.isArray(target)) {
            console$1.error('You have already initialized ' + name);
            return;
        }
        instance = new MixpanelLib();
    }

    instance._cached_groups = {}; // cache groups in a pool

    instance._init(token, config, name);

    instance['people'] = new MixpanelPeople();
    instance['people']._init(instance);

    if (!instance.get_config('skip_first_touch_marketing')) {
        // We need null UTM params in the object because
        // UTM parameters act as a tuple. If any UTM param
        // is present, then we set all UTM params including
        // empty ones together
        var utm_params = _.info.campaignParams(null);
        var initial_utm_params = {};
        var has_utm = false;
        _.each(utm_params, function(utm_value, utm_key) {
            initial_utm_params['initial_' + utm_key] = utm_value;
            if (utm_value) {
                has_utm = true;
            }
        });
        if (has_utm) {
            instance['people'].set_once(initial_utm_params);
        }
    }

    // if any instance on the page has debug = true, we set the
    // global debug to be true
    Config.DEBUG = Config.DEBUG || instance.get_config('debug');

    // if target is not defined, we called init after the lib already
    // loaded, so there won't be an array of things to execute
    if (!_.isUndefined(target) && _.isArray(target)) {
        // Crunch through the people queue first - we queue this data up &
        // flush on identify, so it's better to do all these operations first
        instance._execute_array.call(instance['people'], target['people']);
        instance._execute_array(target);
    }

    return instance;
};

// Initialization methods

/**
 * This function initializes a new instance of the Mixpanel tracking object.
 * All new instances are added to the main mixpanel object as sub properties (such as
 * mixpanel.library_name) and also returned by this function. To define a
 * second instance on the page, you would call:
 *
 *     mixpanel.init('new token', { your: 'config' }, 'library_name');
 *
 * and use it like so:
 *
 *     mixpanel.library_name.track(...);
 *
 * @param {String} token   Your Mixpanel API token
 * @param {Object} [config]  A dictionary of config options to override. <a href="https://github.com/mixpanel/mixpanel-js/blob/v2.46.0/src/mixpanel-core.js#L88-L127">See a list of default config options</a>.
 * @param {String} [name]    The name for the new mixpanel instance that you want created
 */
MixpanelLib.prototype.init = function (token, config, name) {
    if (_.isUndefined(name)) {
        this.report_error('You must name your new library: init(token, config, name)');
        return;
    }
    if (name === PRIMARY_INSTANCE_NAME) {
        this.report_error('You must initialize the main mixpanel object right after you include the Mixpanel js snippet');
        return;
    }

    var instance = create_mplib(token, config, name);
    mixpanel_master[name] = instance;
    instance._loaded();

    return instance;
};

// mixpanel._init(token:string, config:object, name:string)
//
// This function sets up the current instance of the mixpanel
// library.  The difference between this method and the init(...)
// method is this one initializes the actual instance, whereas the
// init(...) method sets up a new library and calls _init on it.
//
MixpanelLib.prototype._init = function(token, config, name) {
    config = config || {};

    this['__loaded'] = true;
    this['config'] = {};

    var variable_features = {};

    // default to JSON payload for standard mixpanel.com API hosts
    if (!('api_payload_format' in config)) {
        var api_host = config['api_host'] || DEFAULT_CONFIG['api_host'];
        if (api_host.match(/\.mixpanel\.com/)) {
            variable_features['api_payload_format'] = PAYLOAD_TYPE_JSON;
        }
    }

    this.set_config(_.extend({}, DEFAULT_CONFIG, variable_features, config, {
        'name': name,
        'token': token,
        'callback_fn': ((name === PRIMARY_INSTANCE_NAME) ? name : PRIMARY_INSTANCE_NAME + '.' + name) + '._jsc'
    }));

    this['_jsc'] = NOOP_FUNC;

    this.__dom_loaded_queue = [];
    this.__request_queue = [];
    this.__disabled_events = [];
    this._flags = {
        'disable_all_events': false,
        'identify_called': false
    };

    // set up request queueing/batching
    this.request_batchers = {};
    this._batch_requests = this.get_config('batch_requests');
    if (this._batch_requests) {
        if (!_.localStorage.is_supported(true) || !USE_XHR) {
            this._batch_requests = false;
            console$1.log('Turning off Mixpanel request-queueing; needs XHR and localStorage support');
            _.each(this.get_batcher_configs(), function(batcher_config) {
                console$1.log('Clearing batch queue ' + batcher_config.queue_key);
                _.localStorage.remove(batcher_config.queue_key);
            });
        } else {
            this.init_batchers();
            if (sendBeacon && window$1.addEventListener) {
                // Before page closes or hides (user tabs away etc), attempt to flush any events
                // queued up via navigator.sendBeacon. Since sendBeacon doesn't report success/failure,
                // events will not be removed from the persistent store; if the site is loaded again,
                // the events will be flushed again on startup and deduplicated on the Mixpanel server
                // side.
                // There is no reliable way to capture only page close events, so we lean on the
                // visibilitychange and pagehide events as recommended at
                // https://developer.mozilla.org/en-US/docs/Web/API/Window/unload_event#usage_notes.
                // These events fire when the user clicks away from the current page/tab, so will occur
                // more frequently than page unload, but are the only mechanism currently for capturing
                // this scenario somewhat reliably.
                var flush_on_unload = _.bind(function() {
                    if (!this.request_batchers.events.stopped) {
                        this.request_batchers.events.flush({unloading: true});
                    }
                }, this);
                window$1.addEventListener('pagehide', function(ev) {
                    if (ev['persisted']) {
                        flush_on_unload();
                    }
                });
                window$1.addEventListener('visibilitychange', function() {
                    if (document$1['visibilityState'] === 'hidden') {
                        flush_on_unload();
                    }
                });
            }
        }
    }

    this['persistence'] = this['cookie'] = new MixpanelPersistence(this['config']);
    this.unpersisted_superprops = {};
    this._gdpr_init();

    var uuid = _.UUID();
    if (!this.get_distinct_id()) {
        // There is no need to set the distinct id
        // or the device id if something was already stored
        // in the persitence
        this.register_once({
            'distinct_id': DEVICE_ID_PREFIX + uuid,
            '$device_id': uuid
        }, '');
    }

    var track_pageview_option = this.get_config('track_pageview');
    if (track_pageview_option) {
        this._init_url_change_tracking(track_pageview_option);
    }
};

// Private methods

MixpanelLib.prototype._loaded = function() {
    this.get_config('loaded')(this);
    this._set_default_superprops();
    this['people'].set_once(this['persistence'].get_referrer_info());

    // The original 'store_google' functionality will be deprecated and the config will be
    // used to clear previously managed UTM parameters from persistence.
    // stop_utm_persistence is `false` by default now but will be default `true` in the future.
    if (this.get_config('store_google') && this.get_config('stop_utm_persistence')) {
        var utm_params = _.info.campaignParams(null);
        _.each(utm_params, function(_utm_value, utm_key) {
            // We need to unregister persisted UTM parameters so old values
            // are not mixed with the new UTM parameters
            this.unregister(utm_key);
        }.bind(this));
    }
};

// update persistence with info on referrer, UTM params, etc
MixpanelLib.prototype._set_default_superprops = function() {
    this['persistence'].update_search_keyword(document$1.referrer);
    if (this.get_config('store_google') && !this.get_config('stop_utm_persistence')) {
        this.register(_.info.campaignParams());
    }
    if (this.get_config('save_referrer')) {
        this['persistence'].update_referrer_info(document$1.referrer);
    }
};

MixpanelLib.prototype._dom_loaded = function() {
    _.each(this.__dom_loaded_queue, function(item) {
        this._track_dom.apply(this, item);
    }, this);

    if (!this.has_opted_out_tracking()) {
        _.each(this.__request_queue, function(item) {
            this._send_request.apply(this, item);
        }, this);
    }

    delete this.__dom_loaded_queue;
    delete this.__request_queue;
};

MixpanelLib.prototype._track_dom = function(DomClass, args) {
    if (this.get_config('img')) {
        this.report_error('You can\'t use DOM tracking functions with img = true.');
        return false;
    }

    if (!DOM_LOADED) {
        this.__dom_loaded_queue.push([DomClass, args]);
        return false;
    }

    var dt = new DomClass().init(this);
    return dt.track.apply(dt, args);
};

MixpanelLib.prototype._init_url_change_tracking = function(track_pageview_option) {
    var previous_tracked_url = '';
    var tracked = this.track_pageview();
    if (tracked) {
        previous_tracked_url = _.info.currentUrl();
    }

    if (_.include(['full-url', 'url-with-path-and-query-string', 'url-with-path'], track_pageview_option)) {
        window$1.addEventListener('popstate', function() {
            window$1.dispatchEvent(new Event('mp_locationchange'));
        });
        window$1.addEventListener('hashchange', function() {
            window$1.dispatchEvent(new Event('mp_locationchange'));
        });
        var nativePushState = window$1.history.pushState;
        if (typeof nativePushState === 'function') {
            window$1.history.pushState = function(state, unused, url) {
                nativePushState.call(window$1.history, state, unused, url);
                window$1.dispatchEvent(new Event('mp_locationchange'));
            };
        }
        var nativeReplaceState = window$1.history.replaceState;
        if (typeof nativeReplaceState === 'function') {
            window$1.history.replaceState = function(state, unused, url) {
                nativeReplaceState.call(window$1.history, state, unused, url);
                window$1.dispatchEvent(new Event('mp_locationchange'));
            };
        }
        window$1.addEventListener('mp_locationchange', function() {
            var current_url = _.info.currentUrl();
            var should_track = false;
            if (track_pageview_option === 'full-url') {
                should_track = current_url !== previous_tracked_url;
            } else if (track_pageview_option === 'url-with-path-and-query-string') {
                should_track = current_url.split('#')[0] !== previous_tracked_url.split('#')[0];
            } else if (track_pageview_option === 'url-with-path') {
                should_track = current_url.split('#')[0].split('?')[0] !== previous_tracked_url.split('#')[0].split('?')[0];
            }

            if (should_track) {
                var tracked = this.track_pageview();
                if (tracked) {
                    previous_tracked_url = current_url;
                }
            }
        }.bind(this));
    }
};

/**
 * _prepare_callback() should be called by callers of _send_request for use
 * as the callback argument.
 *
 * If there is no callback, this returns null.
 * If we are going to make XHR/XDR requests, this returns a function.
 * If we are going to use script tags, this returns a string to use as the
 * callback GET param.
 */
MixpanelLib.prototype._prepare_callback = function(callback, data) {
    if (_.isUndefined(callback)) {
        return null;
    }

    if (USE_XHR) {
        var callback_function = function(response) {
            callback(response, data);
        };
        return callback_function;
    } else {
        // if the user gives us a callback, we store as a random
        // property on this instances jsc function and update our
        // callback string to reflect that.
        var jsc = this['_jsc'];
        var randomized_cb = '' + Math.floor(Math.random() * 100000000);
        var callback_string = this.get_config('callback_fn') + '[' + randomized_cb + ']';
        jsc[randomized_cb] = function(response) {
            delete jsc[randomized_cb];
            callback(response, data);
        };
        return callback_string;
    }
};

MixpanelLib.prototype._send_request = function(url, data, options, callback) {
    var succeeded = true;

    if (ENQUEUE_REQUESTS) {
        this.__request_queue.push(arguments);
        return succeeded;
    }

    var DEFAULT_OPTIONS = {
        method: this.get_config('api_method'),
        transport: this.get_config('api_transport'),
        verbose: this.get_config('verbose')
    };
    var body_data = null;

    if (!callback && (_.isFunction(options) || typeof options === 'string')) {
        callback = options;
        options = null;
    }
    options = _.extend(DEFAULT_OPTIONS, options || {});
    if (!USE_XHR) {
        options.method = 'GET';
    }
    var use_post = options.method === 'POST';
    var use_sendBeacon = sendBeacon && use_post && options.transport.toLowerCase() === 'sendbeacon';

    // needed to correctly format responses
    var verbose_mode = options.verbose;
    if (data['verbose']) { verbose_mode = true; }

    if (this.get_config('test')) { data['test'] = 1; }
    if (verbose_mode) { data['verbose'] = 1; }
    if (this.get_config('img')) { data['img'] = 1; }
    if (!USE_XHR) {
        if (callback) {
            data['callback'] = callback;
        } else if (verbose_mode || this.get_config('test')) {
            // Verbose output (from verbose mode, or an error in test mode) is a json blob,
            // which by itself is not valid javascript. Without a callback, this verbose output will
            // cause an error when returned via jsonp, so we force a no-op callback param.
            // See the ECMA script spec: http://www.ecma-international.org/ecma-262/5.1/#sec-12.4
            data['callback'] = '(function(){})';
        }
    }

    data['ip'] = this.get_config('ip')?1:0;
    data['_'] = new Date().getTime().toString();

    if (use_post) {
        body_data = 'data=' + encodeURIComponent(data['data']);
        delete data['data'];
    }

    url += '?' + _.HTTPBuildQuery(data);

    var lib = this;
    if ('img' in data) {
        var img = document$1.createElement('img');
        img.src = url;
        document$1.body.appendChild(img);
    } else if (use_sendBeacon) {
        try {
            succeeded = sendBeacon(url, body_data);
        } catch (e) {
            lib.report_error(e);
            succeeded = false;
        }
        try {
            if (callback) {
                callback(succeeded ? 1 : 0);
            }
        } catch (e) {
            lib.report_error(e);
        }
    } else if (USE_XHR) {
        try {
            var req = new XMLHttpRequest();
            req.open(options.method, url, true);

            var headers = this.get_config('xhr_headers');
            if (use_post) {
                headers['Content-Type'] = 'application/x-www-form-urlencoded';
            }
            _.each(headers, function(headerValue, headerName) {
                req.setRequestHeader(headerName, headerValue);
            });

            if (options.timeout_ms && typeof req.timeout !== 'undefined') {
                req.timeout = options.timeout_ms;
                var start_time = new Date().getTime();
            }

            // send the mp_optout cookie
            // withCredentials cannot be modified until after calling .open on Android and Mobile Safari
            req.withCredentials = true;
            req.onreadystatechange = function () {
                if (req.readyState === 4) { // XMLHttpRequest.DONE == 4, except in safari 4
                    if (req.status === 200) {
                        if (callback) {
                            if (verbose_mode) {
                                var response;
                                try {
                                    response = _.JSONDecode(req.responseText);
                                } catch (e) {
                                    lib.report_error(e);
                                    if (options.ignore_json_errors) {
                                        response = req.responseText;
                                    } else {
                                        return;
                                    }
                                }
                                callback(response);
                            } else {
                                callback(Number(req.responseText));
                            }
                        }
                    } else {
                        var error;
                        if (
                            req.timeout &&
                            !req.status &&
                            new Date().getTime() - start_time >= req.timeout
                        ) {
                            error = 'timeout';
                        } else {
                            error = 'Bad HTTP status: ' + req.status + ' ' + req.statusText;
                        }
                        lib.report_error(error);
                        if (callback) {
                            if (verbose_mode) {
                                callback({status: 0, error: error, xhr_req: req});
                            } else {
                                callback(0);
                            }
                        }
                    }
                }
            };
            req.send(body_data);
        } catch (e) {
            lib.report_error(e);
            succeeded = false;
        }
    } else {
        var script = document$1.createElement('script');
        script.type = 'text/javascript';
        script.async = true;
        script.defer = true;
        script.src = url;
        var s = document$1.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(script, s);
    }

    return succeeded;
};

/**
 * _execute_array() deals with processing any mixpanel function
 * calls that were called before the Mixpanel library were loaded
 * (and are thus stored in an array so they can be called later)
 *
 * Note: we fire off all the mixpanel function calls && user defined
 * functions BEFORE we fire off mixpanel tracking calls. This is so
 * identify/register/set_config calls can properly modify early
 * tracking calls.
 *
 * @param {Array} array
 */
MixpanelLib.prototype._execute_array = function(array) {
    var fn_name, alias_calls = [], other_calls = [], tracking_calls = [];
    _.each(array, function(item) {
        if (item) {
            fn_name = item[0];
            if (_.isArray(fn_name)) {
                tracking_calls.push(item); // chained call e.g. mixpanel.get_group().set()
            } else if (typeof(item) === 'function') {
                item.call(this);
            } else if (_.isArray(item) && fn_name === 'alias') {
                alias_calls.push(item);
            } else if (_.isArray(item) && fn_name.indexOf('track') !== -1 && typeof(this[fn_name]) === 'function') {
                tracking_calls.push(item);
            } else {
                other_calls.push(item);
            }
        }
    }, this);

    var execute = function(calls, context) {
        _.each(calls, function(item) {
            if (_.isArray(item[0])) {
                // chained call
                var caller = context;
                _.each(item, function(call) {
                    caller = caller[call[0]].apply(caller, call.slice(1));
                });
            } else {
                this[item[0]].apply(this, item.slice(1));
            }
        }, context);
    };

    execute(alias_calls, this);
    execute(other_calls, this);
    execute(tracking_calls, this);
};

// request queueing utils

MixpanelLib.prototype.are_batchers_initialized = function() {
    return !!this.request_batchers.events;
};

MixpanelLib.prototype.get_batcher_configs = function() {
    var queue_prefix = '__mpq_' + this.get_config('token');
    var api_routes = this.get_config('api_routes');
    this._batcher_configs = this._batcher_configs || {
        events: {type: 'events', endpoint: '/' + api_routes['track'], queue_key: queue_prefix + '_ev'},
        people: {type: 'people', endpoint: '/' + api_routes['engage'], queue_key: queue_prefix + '_pp'},
        groups: {type: 'groups', endpoint: '/' + api_routes['groups'], queue_key: queue_prefix + '_gr'}
    };
    return this._batcher_configs;
};

MixpanelLib.prototype.init_batchers = function() {
    if (!this.are_batchers_initialized()) {
        var batcher_for = _.bind(function(attrs) {
            return new RequestBatcher(
                attrs.queue_key,
                {
                    libConfig: this['config'],
                    sendRequestFunc: _.bind(function(data, options, cb) {
                        this._send_request(
                            this.get_config('api_host') + attrs.endpoint,
                            this._encode_data_for_request(data),
                            options,
                            this._prepare_callback(cb, data)
                        );
                    }, this),
                    beforeSendHook: _.bind(function(item) {
                        return this._run_hook('before_send_' + attrs.type, item);
                    }, this),
                    errorReporter: this.get_config('error_reporter'),
                    stopAllBatchingFunc: _.bind(this.stop_batch_senders, this)
                }
            );
        }, this);
        var batcher_configs = this.get_batcher_configs();
        this.request_batchers = {
            events: batcher_for(batcher_configs.events),
            people: batcher_for(batcher_configs.people),
            groups: batcher_for(batcher_configs.groups)
        };
    }
    if (this.get_config('batch_autostart')) {
        this.start_batch_senders();
    }
};

MixpanelLib.prototype.start_batch_senders = function() {
    this._batchers_were_started = true;
    if (this.are_batchers_initialized()) {
        this._batch_requests = true;
        _.each(this.request_batchers, function(batcher) {
            batcher.start();
        });
    }
};

MixpanelLib.prototype.stop_batch_senders = function() {
    this._batch_requests = false;
    _.each(this.request_batchers, function(batcher) {
        batcher.stop();
        batcher.clear();
    });
};

/**
 * push() keeps the standard async-array-push
 * behavior around after the lib is loaded.
 * This is only useful for external integrations that
 * do not wish to rely on our convenience methods
 * (created in the snippet).
 *
 * ### Usage:
 *     mixpanel.push(['register', { a: 'b' }]);
 *
 * @param {Array} item A [function_name, args...] array to be executed
 */
MixpanelLib.prototype.push = function(item) {
    this._execute_array([item]);
};

/**
 * Disable events on the Mixpanel object. If passed no arguments,
 * this function disables tracking of any event. If passed an
 * array of event names, those events will be disabled, but other
 * events will continue to be tracked.
 *
 * Note: this function does not stop other mixpanel functions from
 * firing, such as register() or people.set().
 *
 * @param {Array} [events] An array of event names to disable
 */
MixpanelLib.prototype.disable = function(events) {
    if (typeof(events) === 'undefined') {
        this._flags.disable_all_events = true;
    } else {
        this.__disabled_events = this.__disabled_events.concat(events);
    }
};

MixpanelLib.prototype._encode_data_for_request = function(data) {
    var encoded_data = _.JSONEncode(data);
    if (this.get_config('api_payload_format') === PAYLOAD_TYPE_BASE64) {
        encoded_data = _.base64Encode(encoded_data);
    }
    return {'data': encoded_data};
};

// internal method for handling track vs batch-enqueue logic
MixpanelLib.prototype._track_or_batch = function(options, callback) {
    var truncated_data = _.truncate(options.data, 255);
    var endpoint = options.endpoint;
    var batcher = options.batcher;
    var should_send_immediately = options.should_send_immediately;
    var send_request_options = options.send_request_options || {};
    callback = callback || NOOP_FUNC;

    var request_enqueued_or_initiated = true;
    var send_request_immediately = _.bind(function() {
        if (!send_request_options.skip_hooks) {
            truncated_data = this._run_hook('before_send_' + options.type, truncated_data);
        }
        if (truncated_data) {
            console$1.log('MIXPANEL REQUEST:');
            console$1.log(truncated_data);
            return this._send_request(
                endpoint,
                this._encode_data_for_request(truncated_data),
                send_request_options,
                this._prepare_callback(callback, truncated_data)
            );
        } else {
            return null;
        }
    }, this);

    if (this._batch_requests && !should_send_immediately) {
        batcher.enqueue(truncated_data, function(succeeded) {
            if (succeeded) {
                callback(1, truncated_data);
            } else {
                send_request_immediately();
            }
        });
    } else {
        request_enqueued_or_initiated = send_request_immediately();
    }

    return request_enqueued_or_initiated && truncated_data;
};

/**
 * Track an event. This is the most important and
 * frequently used Mixpanel function.
 *
 * ### Usage:
 *
 *     // track an event named 'Registered'
 *     mixpanel.track('Registered', {'Gender': 'Male', 'Age': 21});
 *
 *     // track an event using navigator.sendBeacon
 *     mixpanel.track('Left page', {'duration_seconds': 35}, {transport: 'sendBeacon'});
 *
 * To track link clicks or form submissions, see track_links() or track_forms().
 *
 * @param {String} event_name The name of the event. This can be anything the user does - 'Button Click', 'Sign Up', 'Item Purchased', etc.
 * @param {Object} [properties] A set of properties to include with the event you're sending. These describe the user who did the event or details about the event itself.
 * @param {Object} [options] Optional configuration for this track request.
 * @param {String} [options.transport] Transport method for network request ('xhr' or 'sendBeacon').
 * @param {Boolean} [options.send_immediately] Whether to bypass batching/queueing and send track request immediately.
 * @param {Function} [callback] If provided, the callback function will be called after tracking the event.
 * @returns {Boolean|Object} If the tracking request was successfully initiated/queued, an object
 * with the tracking payload sent to the API server is returned; otherwise false.
 */
MixpanelLib.prototype.track = addOptOutCheckMixpanelLib(function(event_name, properties, options, callback) {
    if (!callback && typeof options === 'function') {
        callback = options;
        options = null;
    }
    options = options || {};
    var transport = options['transport']; // external API, don't minify 'transport' prop
    if (transport) {
        options.transport = transport; // 'transport' prop name can be minified internally
    }
    var should_send_immediately = options['send_immediately'];
    if (typeof callback !== 'function') {
        callback = NOOP_FUNC;
    }

    if (_.isUndefined(event_name)) {
        this.report_error('No event name provided to mixpanel.track');
        return;
    }

    if (this._event_is_disabled(event_name)) {
        callback(0);
        return;
    }

    // set defaults
    properties = _.extend({}, properties);
    properties['token'] = this.get_config('token');

    // set $duration if time_event was previously called for this event
    var start_timestamp = this['persistence'].remove_event_timer(event_name);
    if (!_.isUndefined(start_timestamp)) {
        var duration_in_ms = new Date().getTime() - start_timestamp;
        properties['$duration'] = parseFloat((duration_in_ms / 1000).toFixed(3));
    }

    this._set_default_superprops();

    var marketing_properties = this.get_config('track_marketing')
        ? _.info.marketingParams()
        : {};

    // note: extend writes to the first object, so lets make sure we
    // don't write to the persistence properties object and info
    // properties object by passing in a new object

    // update properties with pageview info and super-properties
    properties = _.extend(
        {},
        _.info.properties({'mp_loader': this.get_config('mp_loader')}),
        marketing_properties,
        this['persistence'].properties(),
        this.unpersisted_superprops,
        properties
    );

    var property_blacklist = this.get_config('property_blacklist');
    if (_.isArray(property_blacklist)) {
        _.each(property_blacklist, function(blacklisted_prop) {
            delete properties[blacklisted_prop];
        });
    } else {
        this.report_error('Invalid value for property_blacklist config: ' + property_blacklist);
    }

    var data = {
        'event': event_name,
        'properties': properties
    };
    var ret = this._track_or_batch({
        type: 'events',
        data: data,
        endpoint: this.get_config('api_host') + '/' + this.get_config('api_routes')['track'],
        batcher: this.request_batchers.events,
        should_send_immediately: should_send_immediately,
        send_request_options: options
    }, callback);

    return ret;
});

/**
 * Register the current user into one/many groups.
 *
 * ### Usage:
 *
 *      mixpanel.set_group('company', ['mixpanel', 'google']) // an array of IDs
 *      mixpanel.set_group('company', 'mixpanel')
 *      mixpanel.set_group('company', 128746312)
 *
 * @param {String} group_key Group key
 * @param {Array|String|Number} group_ids An array of group IDs, or a singular group ID
 * @param {Function} [callback] If provided, the callback will be called after tracking the event.
 *
 */
MixpanelLib.prototype.set_group = addOptOutCheckMixpanelLib(function(group_key, group_ids, callback) {
    if (!_.isArray(group_ids)) {
        group_ids = [group_ids];
    }
    var prop = {};
    prop[group_key] = group_ids;
    this.register(prop);
    return this['people'].set(group_key, group_ids, callback);
});

/**
 * Add a new group for this user.
 *
 * ### Usage:
 *
 *      mixpanel.add_group('company', 'mixpanel')
 *
 * @param {String} group_key Group key
 * @param {*} group_id A valid Mixpanel property type
 * @param {Function} [callback] If provided, the callback will be called after tracking the event.
 */
MixpanelLib.prototype.add_group = addOptOutCheckMixpanelLib(function(group_key, group_id, callback) {
    var old_values = this.get_property(group_key);
    var prop = {};
    if (old_values === undefined) {
        prop[group_key] = [group_id];
        this.register(prop);
    } else {
        if (old_values.indexOf(group_id) === -1) {
            old_values.push(group_id);
            prop[group_key] = old_values;
            this.register(prop);
        }
    }
    return this['people'].union(group_key, group_id, callback);
});

/**
 * Remove a group from this user.
 *
 * ### Usage:
 *
 *      mixpanel.remove_group('company', 'mixpanel')
 *
 * @param {String} group_key Group key
 * @param {*} group_id A valid Mixpanel property type
 * @param {Function} [callback] If provided, the callback will be called after tracking the event.
 */
MixpanelLib.prototype.remove_group = addOptOutCheckMixpanelLib(function(group_key, group_id, callback) {
    var old_value = this.get_property(group_key);
    // if the value doesn't exist, the persistent store is unchanged
    if (old_value !== undefined) {
        var idx = old_value.indexOf(group_id);
        if (idx > -1) {
            old_value.splice(idx, 1);
            this.register({group_key: old_value});
        }
        if (old_value.length === 0) {
            this.unregister(group_key);
        }
    }
    return this['people'].remove(group_key, group_id, callback);
});

/**
 * Track an event with specific groups.
 *
 * ### Usage:
 *
 *      mixpanel.track_with_groups('purchase', {'product': 'iphone'}, {'University': ['UCB', 'UCLA']})
 *
 * @param {String} event_name The name of the event (see `mixpanel.track()`)
 * @param {Object=} properties A set of properties to include with the event you're sending (see `mixpanel.track()`)
 * @param {Object=} groups An object mapping group name keys to one or more values
 * @param {Function} [callback] If provided, the callback will be called after tracking the event.
 */
MixpanelLib.prototype.track_with_groups = addOptOutCheckMixpanelLib(function(event_name, properties, groups, callback) {
    var tracking_props = _.extend({}, properties || {});
    _.each(groups, function(v, k) {
        if (v !== null && v !== undefined) {
            tracking_props[k] = v;
        }
    });
    return this.track(event_name, tracking_props, callback);
});

MixpanelLib.prototype._create_map_key = function (group_key, group_id) {
    return group_key + '_' + JSON.stringify(group_id);
};

MixpanelLib.prototype._remove_group_from_cache = function (group_key, group_id) {
    delete this._cached_groups[this._create_map_key(group_key, group_id)];
};

/**
 * Look up reference to a Mixpanel group
 *
 * ### Usage:
 *
 *       mixpanel.get_group(group_key, group_id)
 *
 * @param {String} group_key Group key
 * @param {Object} group_id A valid Mixpanel property type
 * @returns {Object} A MixpanelGroup identifier
 */
MixpanelLib.prototype.get_group = function (group_key, group_id) {
    var map_key = this._create_map_key(group_key, group_id);
    var group = this._cached_groups[map_key];
    if (group === undefined || group._group_key !== group_key || group._group_id !== group_id) {
        group = new MixpanelGroup();
        group._init(this, group_key, group_id);
        this._cached_groups[map_key] = group;
    }
    return group;
};

/**
 * Track a default Mixpanel page view event, which includes extra default event properties to
 * improve page view data.
 *
 * ### Usage:
 *
 *     // track a default $mp_web_page_view event
 *     mixpanel.track_pageview();
 *
 *     // track a page view event with additional event properties
 *     mixpanel.track_pageview({'ab_test_variant': 'card-layout-b'});
 *
 *     // example approach to track page views on different page types as event properties
 *     mixpanel.track_pageview({'page': 'pricing'});
 *     mixpanel.track_pageview({'page': 'homepage'});
 *
 *     // UNCOMMON: Tracking a page view event with a custom event_name option. NOT expected to be used for
 *     // individual pages on the same site or product. Use cases for custom event_name may be page
 *     // views on different products or internal applications that are considered completely separate
 *     mixpanel.track_pageview({'page': 'customer-search'}, {'event_name': '[internal] Admin Page View'});
 *
 * ### Notes:
 *
 * The `config.track_pageview` option for <a href="#mixpanelinit">mixpanel.init()</a>
 * may be turned on for tracking page loads automatically.
 *
 *     // track only page loads
 *     mixpanel.init(PROJECT_TOKEN, {track_pageview: true});
 *
 *     // track when the URL changes in any manner
 *     mixpanel.init(PROJECT_TOKEN, {track_pageview: 'full-url'});
 *
 *     // track when the URL changes, ignoring any changes in the hash part
 *     mixpanel.init(PROJECT_TOKEN, {track_pageview: 'url-with-path-and-query-string'});
 *
 *     // track when the path changes, ignoring any query parameter or hash changes
 *     mixpanel.init(PROJECT_TOKEN, {track_pageview: 'url-with-path'});
 *
 * @param {Object} [properties] An optional set of additional properties to send with the page view event
 * @param {Object} [options] Page view tracking options
 * @param {String} [options.event_name] - Alternate name for the tracking event
 * @returns {Boolean|Object} If the tracking request was successfully initiated/queued, an object
 * with the tracking payload sent to the API server is returned; otherwise false.
 */
MixpanelLib.prototype.track_pageview = addOptOutCheckMixpanelLib(function(properties, options) {
    if (typeof properties !== 'object') {
        properties = {};
    }
    options = options || {};
    var event_name = options['event_name'] || '$mp_web_page_view';

    var default_page_properties = _.extend(
        _.info.mpPageViewProperties(),
        _.info.campaignParams(),
        _.info.clickParams()
    );

    var event_properties = _.extend(
        {},
        default_page_properties,
        properties
    );

    return this.track(event_name, event_properties);
});

/**
 * Track clicks on a set of document elements. Selector must be a
 * valid query. Elements must exist on the page at the time track_links is called.
 *
 * ### Usage:
 *
 *     // track click for link id #nav
 *     mixpanel.track_links('#nav', 'Clicked Nav Link');
 *
 * ### Notes:
 *
 * This function will wait up to 300 ms for the Mixpanel
 * servers to respond. If they have not responded by that time
 * it will head to the link without ensuring that your event
 * has been tracked.  To configure this timeout please see the
 * set_config() documentation below.
 *
 * If you pass a function in as the properties argument, the
 * function will receive the DOMElement that triggered the
 * event as an argument.  You are expected to return an object
 * from the function; any properties defined on this object
 * will be sent to mixpanel as event properties.
 *
 * @type {Function}
 * @param {Object|String} query A valid DOM query, element or jQuery-esque list
 * @param {String} event_name The name of the event to track
 * @param {Object|Function} [properties] A properties object or function that returns a dictionary of properties when passed a DOMElement
 */
MixpanelLib.prototype.track_links = function() {
    return this._track_dom.call(this, LinkTracker, arguments);
};

/**
 * Track form submissions. Selector must be a valid query.
 *
 * ### Usage:
 *
 *     // track submission for form id 'register'
 *     mixpanel.track_forms('#register', 'Created Account');
 *
 * ### Notes:
 *
 * This function will wait up to 300 ms for the mixpanel
 * servers to respond, if they have not responded by that time
 * it will head to the link without ensuring that your event
 * has been tracked.  To configure this timeout please see the
 * set_config() documentation below.
 *
 * If you pass a function in as the properties argument, the
 * function will receive the DOMElement that triggered the
 * event as an argument.  You are expected to return an object
 * from the function; any properties defined on this object
 * will be sent to mixpanel as event properties.
 *
 * @type {Function}
 * @param {Object|String} query A valid DOM query, element or jQuery-esque list
 * @param {String} event_name The name of the event to track
 * @param {Object|Function} [properties] This can be a set of properties, or a function that returns a set of properties after being passed a DOMElement
 */
MixpanelLib.prototype.track_forms = function() {
    return this._track_dom.call(this, FormTracker, arguments);
};

/**
 * Time an event by including the time between this call and a
 * later 'track' call for the same event in the properties sent
 * with the event.
 *
 * ### Usage:
 *
 *     // time an event named 'Registered'
 *     mixpanel.time_event('Registered');
 *     mixpanel.track('Registered', {'Gender': 'Male', 'Age': 21});
 *
 * When called for a particular event name, the next track call for that event
 * name will include the elapsed time between the 'time_event' and 'track'
 * calls. This value is stored as seconds in the '$duration' property.
 *
 * @param {String} event_name The name of the event.
 */
MixpanelLib.prototype.time_event = function(event_name) {
    if (_.isUndefined(event_name)) {
        this.report_error('No event name provided to mixpanel.time_event');
        return;
    }

    if (this._event_is_disabled(event_name)) {
        return;
    }

    this['persistence'].set_event_timer(event_name,  new Date().getTime());
};

var REGISTER_DEFAULTS = {
    'persistent': true
};
/**
 * Helper to parse options param for register methods, maintaining
 * legacy support for plain "days" param instead of options object
 * @param {Number|Object} [days_or_options] 'days' option (Number), or Options object for register methods
 * @returns {Object} options object
 */
var options_for_register = function(days_or_options) {
    var options;
    if (_.isObject(days_or_options)) {
        options = days_or_options;
    } else if (!_.isUndefined(days_or_options)) {
        options = {'days': days_or_options};
    } else {
        options = {};
    }
    return _.extend({}, REGISTER_DEFAULTS, options);
};

/**
 * Register a set of super properties, which are included with all
 * events. This will overwrite previous super property values.
 *
 * ### Usage:
 *
 *     // register 'Gender' as a super property
 *     mixpanel.register({'Gender': 'Female'});
 *
 *     // register several super properties when a user signs up
 *     mixpanel.register({
 *         'Email': 'jdoe@example.com',
 *         'Account Type': 'Free'
 *     });
 *
 *     // register only for the current pageload
 *     mixpanel.register({'Name': 'Pat'}, {persistent: false});
 *
 * @param {Object} properties An associative array of properties to store about the user
 * @param {Number|Object} [days_or_options] Options object or number of days since the user's last visit to store the super properties (only valid for persisted props)
 * @param {boolean} [days_or_options.days] - number of days since the user's last visit to store the super properties (only valid for persisted props)
 * @param {boolean} [days_or_options.persistent=true] - whether to put in persistent storage (cookie/localStorage)
 */
MixpanelLib.prototype.register = function(props, days_or_options) {
    var options = options_for_register(days_or_options);
    if (options['persistent']) {
        this['persistence'].register(props, options['days']);
    } else {
        _.extend(this.unpersisted_superprops, props);
    }
};

/**
 * Register a set of super properties only once. This will not
 * overwrite previous super property values, unlike register().
 *
 * ### Usage:
 *
 *     // register a super property for the first time only
 *     mixpanel.register_once({
 *         'First Login Date': new Date().toISOString()
 *     });
 *
 *     // register once, only for the current pageload
 *     mixpanel.register_once({
 *         'First interaction time': new Date().toISOString()
 *     }, 'None', {persistent: false});
 *
 * ### Notes:
 *
 * If default_value is specified, current super properties
 * with that value will be overwritten.
 *
 * @param {Object} properties An associative array of properties to store about the user
 * @param {*} [default_value] Value to override if already set in super properties (ex: 'False') Default: 'None'
 * @param {Number|Object} [days_or_options] Options object or number of days since the user's last visit to store the super properties (only valid for persisted props)
 * @param {boolean} [days_or_options.days] - number of days since the user's last visit to store the super properties (only valid for persisted props)
 * @param {boolean} [days_or_options.persistent=true] - whether to put in persistent storage (cookie/localStorage)
 */
MixpanelLib.prototype.register_once = function(props, default_value, days_or_options) {
    var options = options_for_register(days_or_options);
    if (options['persistent']) {
        this['persistence'].register_once(props, default_value, options['days']);
    } else {
        if (typeof(default_value) === 'undefined') {
            default_value = 'None';
        }
        _.each(props, function(val, prop) {
            if (!this.unpersisted_superprops.hasOwnProperty(prop) || this.unpersisted_superprops[prop] === default_value) {
                this.unpersisted_superprops[prop] = val;
            }
        }, this);
    }
};

/**
 * Delete a super property stored with the current user.
 *
 * @param {String} property The name of the super property to remove
 * @param {Object} [options]
 * @param {boolean} [options.persistent=true] - whether to look in persistent storage (cookie/localStorage)
 */
MixpanelLib.prototype.unregister = function(property, options) {
    options = options_for_register(options);
    if (options['persistent']) {
        this['persistence'].unregister(property);
    } else {
        delete this.unpersisted_superprops[property];
    }
};

MixpanelLib.prototype._register_single = function(prop, value) {
    var props = {};
    props[prop] = value;
    this.register(props);
};

/**
 * Identify a user with a unique ID to track user activity across
 * devices, tie a user to their events, and create a user profile.
 * If you never call this method, unique visitors are tracked using
 * a UUID generated the first time they visit the site.
 *
 * Call identify when you know the identity of the current user,
 * typically after login or signup. We recommend against using
 * identify for anonymous visitors to your site.
 *
 * ### Notes:
 * If your project has
 * <a href="https://help.mixpanel.com/hc/en-us/articles/360039133851">ID Merge</a>
 * enabled, the identify method will connect pre- and
 * post-authentication events when appropriate.
 *
 * If your project does not have ID Merge enabled, identify will
 * change the user's local distinct_id to the unique ID you pass.
 * Events tracked prior to authentication will not be connected
 * to the same user identity. If ID Merge is disabled, alias can
 * be used to connect pre- and post-registration events.
 *
 * @param {String} [unique_id] A string that uniquely identifies a user. If not provided, the distinct_id currently in the persistent store (cookie or localStorage) will be used.
 */
MixpanelLib.prototype.identify = function(
    new_distinct_id, _set_callback, _add_callback, _append_callback, _set_once_callback, _union_callback, _unset_callback, _remove_callback
) {
    // Optional Parameters
    //  _set_callback:function  A callback to be run if and when the People set queue is flushed
    //  _add_callback:function  A callback to be run if and when the People add queue is flushed
    //  _append_callback:function  A callback to be run if and when the People append queue is flushed
    //  _set_once_callback:function  A callback to be run if and when the People set_once queue is flushed
    //  _union_callback:function  A callback to be run if and when the People union queue is flushed
    //  _unset_callback:function  A callback to be run if and when the People unset queue is flushed

    var previous_distinct_id = this.get_distinct_id();
    if (new_distinct_id && previous_distinct_id !== new_distinct_id) {
        // we allow the following condition if previous distinct_id is same as new_distinct_id
        // so that you can force flush people updates for anonymous profiles.
        if (typeof new_distinct_id === 'string' && new_distinct_id.indexOf(DEVICE_ID_PREFIX) === 0) {
            this.report_error('distinct_id cannot have $device: prefix');
            return -1;
        }
        this.register({'$user_id': new_distinct_id});
    }

    if (!this.get_property('$device_id')) {
        // The persisted distinct id might not actually be a device id at all
        // it might be a distinct id of the user from before
        var device_id = previous_distinct_id;
        this.register_once({
            '$had_persisted_distinct_id': true,
            '$device_id': device_id
        }, '');
    }

    // identify only changes the distinct id if it doesn't match either the existing or the alias;
    // if it's new, blow away the alias as well.
    if (new_distinct_id !== previous_distinct_id && new_distinct_id !== this.get_property(ALIAS_ID_KEY)) {
        this.unregister(ALIAS_ID_KEY);
        this.register({'distinct_id': new_distinct_id});
    }
    this._flags.identify_called = true;
    // Flush any queued up people requests
    this['people']._flush(_set_callback, _add_callback, _append_callback, _set_once_callback, _union_callback, _unset_callback, _remove_callback);

    // send an $identify event any time the distinct_id is changing - logic on the server
    // will determine whether or not to do anything with it.
    if (new_distinct_id !== previous_distinct_id) {
        this.track('$identify', {
            'distinct_id': new_distinct_id,
            '$anon_distinct_id': previous_distinct_id
        }, {skip_hooks: true});
    }
};

/**
 * Clears super properties and generates a new random distinct_id for this instance.
 * Useful for clearing data when a user logs out.
 */
MixpanelLib.prototype.reset = function() {
    this['persistence'].clear();
    this._flags.identify_called = false;
    var uuid = _.UUID();
    this.register_once({
        'distinct_id': DEVICE_ID_PREFIX + uuid,
        '$device_id': uuid
    }, '');
};

/**
 * Returns the current distinct id of the user. This is either the id automatically
 * generated by the library or the id that has been passed by a call to identify().
 *
 * ### Notes:
 *
 * get_distinct_id() can only be called after the Mixpanel library has finished loading.
 * init() has a loaded function available to handle this automatically. For example:
 *
 *     // set distinct_id after the mixpanel library has loaded
 *     mixpanel.init('YOUR PROJECT TOKEN', {
 *         loaded: function(mixpanel) {
 *             distinct_id = mixpanel.get_distinct_id();
 *         }
 *     });
 */
MixpanelLib.prototype.get_distinct_id = function() {
    return this.get_property('distinct_id');
};

/**
 * The alias method creates an alias which Mixpanel will use to
 * remap one id to another. Multiple aliases can point to the
 * same identifier.
 *
 * The following is a valid use of alias:
 *
 *     mixpanel.alias('new_id', 'existing_id');
 *     // You can add multiple id aliases to the existing ID
 *     mixpanel.alias('newer_id', 'existing_id');
 *
 * Aliases can also be chained - the following is a valid example:
 *
 *     mixpanel.alias('new_id', 'existing_id');
 *     // chain newer_id - new_id - existing_id
 *     mixpanel.alias('newer_id', 'new_id');
 *
 * Aliases cannot point to multiple identifiers - the following
 * example will not work:
 *
 *     mixpanel.alias('new_id', 'existing_id');
 *     // this is invalid as 'new_id' already points to 'existing_id'
 *     mixpanel.alias('new_id', 'newer_id');
 *
 * ### Notes:
 *
 * If your project does not have
 * <a href="https://help.mixpanel.com/hc/en-us/articles/360039133851">ID Merge</a>
 * enabled, the best practice is to call alias once when a unique
 * ID is first created for a user (e.g., when a user first registers
 * for an account). Do not use alias multiple times for a single
 * user without ID Merge enabled.
 *
 * @param {String} alias A unique identifier that you want to use for this user in the future.
 * @param {String} [original] The current identifier being used for this user.
 */
MixpanelLib.prototype.alias = function(alias, original) {
    // If the $people_distinct_id key exists in persistence, there has been a previous
    // mixpanel.people.identify() call made for this user. It is VERY BAD to make an alias with
    // this ID, as it will duplicate users.
    if (alias === this.get_property(PEOPLE_DISTINCT_ID_KEY)) {
        this.report_error('Attempting to create alias for existing People user - aborting.');
        return -2;
    }

    var _this = this;
    if (_.isUndefined(original)) {
        original = this.get_distinct_id();
    }
    if (alias !== original) {
        this._register_single(ALIAS_ID_KEY, alias);
        return this.track('$create_alias', {
            'alias': alias,
            'distinct_id': original
        }, {
            skip_hooks: true
        }, function() {
            // Flush the people queue
            _this.identify(alias);
        });
    } else {
        this.report_error('alias matches current distinct_id - skipping api call.');
        this.identify(alias);
        return -1;
    }
};

/**
 * Provide a string to recognize the user by. The string passed to
 * this method will appear in the Mixpanel Streams product rather
 * than an automatically generated name. Name tags do not have to
 * be unique.
 *
 * This value will only be included in Streams data.
 *
 * @param {String} name_tag A human readable name for the user
 * @deprecated
 */
MixpanelLib.prototype.name_tag = function(name_tag) {
    this._register_single('mp_name_tag', name_tag);
};

/**
 * Update the configuration of a mixpanel library instance.
 *
 * The default config is:
 *
 *     {
 *       // host for requests (customizable for e.g. a local proxy)
 *       api_host: 'https://api-js.mixpanel.com',
 *
 *       // endpoints for different types of requests
 *       api_routes: {
 *         track: 'track/',
 *         engage: 'engage/',
 *         groups: 'groups/',
 *       }
 *
 *       // HTTP method for tracking requests
 *       api_method: 'POST'
 *
 *       // transport for sending requests ('XHR' or 'sendBeacon')
 *       // NB: sendBeacon should only be used for scenarios such as
 *       // page unload where a "best-effort" attempt to send is
 *       // acceptable; the sendBeacon API does not support callbacks
 *       // or any way to know the result of the request. Mixpanel
 *       // tracking via sendBeacon will not support any event-
 *       // batching or retry mechanisms.
 *       api_transport: 'XHR'
 *
 *       // request-batching/queueing/retry
 *       batch_requests: true,
 *
 *       // maximum number of events/updates to send in a single
 *       // network request
 *       batch_size: 50,
 *
 *       // milliseconds to wait between sending batch requests
 *       batch_flush_interval_ms: 5000,
 *
 *       // milliseconds to wait for network responses to batch requests
 *       // before they are considered timed-out and retried
 *       batch_request_timeout_ms: 90000,
 *
 *       // override value for cookie domain, only useful for ensuring
 *       // correct cross-subdomain cookies on unusual domains like
 *       // subdomain.mainsite.avocat.fr; NB this cannot be used to
 *       // set cookies on a different domain than the current origin
 *       cookie_domain: ''
 *
 *       // super properties cookie expiration (in days)
 *       cookie_expiration: 365
 *
 *       // if true, cookie will be set with SameSite=None; Secure
 *       // this is only useful in special situations, like embedded
 *       // 3rd-party iframes that set up a Mixpanel instance
 *       cross_site_cookie: false
 *
 *       // super properties span subdomains
 *       cross_subdomain_cookie: true
 *
 *       // debug mode
 *       debug: false
 *
 *       // if this is true, the mixpanel cookie or localStorage entry
 *       // will be deleted, and no user persistence will take place
 *       disable_persistence: false
 *
 *       // if this is true, Mixpanel will automatically determine
 *       // City, Region and Country data using the IP address of
 *       //the client
 *       ip: true
 *
 *       // opt users out of tracking by this Mixpanel instance by default
 *       opt_out_tracking_by_default: false
 *
 *       // opt users out of browser data storage by this Mixpanel instance by default
 *       opt_out_persistence_by_default: false
 *
 *       // persistence mechanism used by opt-in/opt-out methods - cookie
 *       // or localStorage - falls back to cookie if localStorage is unavailable
 *       opt_out_tracking_persistence_type: 'localStorage'
 *
 *       // customize the name of cookie/localStorage set by opt-in/opt-out methods
 *       opt_out_tracking_cookie_prefix: null
 *
 *       // type of persistent store for super properties (cookie/
 *       // localStorage) if set to 'localStorage', any existing
 *       // mixpanel cookie value with the same persistence_name
 *       // will be transferred to localStorage and deleted
 *       persistence: 'cookie'
 *
 *       // name for super properties persistent store
 *       persistence_name: ''
 *
 *       // names of properties/superproperties which should never
 *       // be sent with track() calls
 *       property_blacklist: []
 *
 *       // if this is true, mixpanel cookies will be marked as
 *       // secure, meaning they will only be transmitted over https
 *       secure_cookie: false
 *
 *       // disables enriching user profiles with first touch marketing data
 *       skip_first_touch_marketing: false
 *
 *       // the amount of time track_links will
 *       // wait for Mixpanel's servers to respond
 *       track_links_timeout: 300
 *
 *       // adds any UTM parameters and click IDs present on the page to any events fired
 *       track_marketing: true
 *
 *       // enables automatic page view tracking using default page view events through
 *       // the track_pageview() method
 *       track_pageview: false
 *
 *       // if you set upgrade to be true, the library will check for
 *       // a cookie from our old js library and import super
 *       // properties from it, then the old cookie is deleted
 *       // The upgrade config option only works in the initialization,
 *       // so make sure you set it when you create the library.
 *       upgrade: false
 *
 *       // extra HTTP request headers to set for each API request, in
 *       // the format {'Header-Name': value}
 *       xhr_headers: {}
 *
 *       // whether to ignore or respect the web browser's Do Not Track setting
 *       ignore_dnt: false
 *     }
 *
 *
 * @param {Object} config A dictionary of new configuration values to update
 */
MixpanelLib.prototype.set_config = function(config) {
    if (_.isObject(config)) {
        _.extend(this['config'], config);

        var new_batch_size = config['batch_size'];
        if (new_batch_size) {
            _.each(this.request_batchers, function(batcher) {
                batcher.resetBatchSize();
            });
        }

        if (!this.get_config('persistence_name')) {
            this['config']['persistence_name'] = this['config']['cookie_name'];
        }
        if (!this.get_config('disable_persistence')) {
            this['config']['disable_persistence'] = this['config']['disable_cookie'];
        }

        if (this['persistence']) {
            this['persistence'].update_config(this['config']);
        }
        Config.DEBUG = Config.DEBUG || this.get_config('debug');
    }
};

/**
 * returns the current config object for the library.
 */
MixpanelLib.prototype.get_config = function(prop_name) {
    return this['config'][prop_name];
};

/**
 * Fetch a hook function from config, with safe default, and run it
 * against the given arguments
 * @param {string} hook_name which hook to retrieve
 * @returns {any|null} return value of user-provided hook, or null if nothing was returned
 */
MixpanelLib.prototype._run_hook = function(hook_name) {
    var ret = (this['config']['hooks'][hook_name] || IDENTITY_FUNC).apply(this, slice.call(arguments, 1));
    if (typeof ret === 'undefined') {
        this.report_error(hook_name + ' hook did not return a value');
        ret = null;
    }
    return ret;
};

/**
 * Returns the value of the super property named property_name. If no such
 * property is set, get_property() will return the undefined value.
 *
 * ### Notes:
 *
 * get_property() can only be called after the Mixpanel library has finished loading.
 * init() has a loaded function available to handle this automatically. For example:
 *
 *     // grab value for 'user_id' after the mixpanel library has loaded
 *     mixpanel.init('YOUR PROJECT TOKEN', {
 *         loaded: function(mixpanel) {
 *             user_id = mixpanel.get_property('user_id');
 *         }
 *     });
 *
 * @param {String} property_name The name of the super property you want to retrieve
 */
MixpanelLib.prototype.get_property = function(property_name) {
    return this['persistence'].load_prop([property_name]);
};

MixpanelLib.prototype.toString = function() {
    var name = this.get_config('name');
    if (name !== PRIMARY_INSTANCE_NAME) {
        name = PRIMARY_INSTANCE_NAME + '.' + name;
    }
    return name;
};

MixpanelLib.prototype._event_is_disabled = function(event_name) {
    return _.isBlockedUA(userAgent) ||
        this._flags.disable_all_events ||
        _.include(this.__disabled_events, event_name);
};

// perform some housekeeping around GDPR opt-in/out state
MixpanelLib.prototype._gdpr_init = function() {
    var is_localStorage_requested = this.get_config('opt_out_tracking_persistence_type') === 'localStorage';

    // try to convert opt-in/out cookies to localStorage if possible
    if (is_localStorage_requested && _.localStorage.is_supported()) {
        if (!this.has_opted_in_tracking() && this.has_opted_in_tracking({'persistence_type': 'cookie'})) {
            this.opt_in_tracking({'enable_persistence': false});
        }
        if (!this.has_opted_out_tracking() && this.has_opted_out_tracking({'persistence_type': 'cookie'})) {
            this.opt_out_tracking({'clear_persistence': false});
        }
        this.clear_opt_in_out_tracking({
            'persistence_type': 'cookie',
            'enable_persistence': false
        });
    }

    // check whether the user has already opted out - if so, clear & disable persistence
    if (this.has_opted_out_tracking()) {
        this._gdpr_update_persistence({'clear_persistence': true});

    // check whether we should opt out by default
    // note: we don't clear persistence here by default since opt-out default state is often
    //       used as an initial state while GDPR information is being collected
    } else if (!this.has_opted_in_tracking() && (
        this.get_config('opt_out_tracking_by_default') || _.cookie.get('mp_optout')
    )) {
        _.cookie.remove('mp_optout');
        this.opt_out_tracking({
            'clear_persistence': this.get_config('opt_out_persistence_by_default')
        });
    }
};

/**
 * Enable or disable persistence based on options
 * only enable/disable if persistence is not already in this state
 * @param {boolean} [options.clear_persistence] If true, will delete all data stored by the sdk in persistence and disable it
 * @param {boolean} [options.enable_persistence] If true, will re-enable sdk persistence
 */
MixpanelLib.prototype._gdpr_update_persistence = function(options) {
    var disabled;
    if (options && options['clear_persistence']) {
        disabled = true;
    } else if (options && options['enable_persistence']) {
        disabled = false;
    } else {
        return;
    }

    if (!this.get_config('disable_persistence') && this['persistence'].disabled !== disabled) {
        this['persistence'].set_disabled(disabled);
    }

    if (disabled) {
        this.stop_batch_senders();
    } else {
        // only start batchers after opt-in if they have previously been started
        // in order to avoid unintentionally starting up batching for the first time
        if (this._batchers_were_started) {
            this.start_batch_senders();
        }
    }
};

// call a base gdpr function after constructing the appropriate token and options args
MixpanelLib.prototype._gdpr_call_func = function(func, options) {
    options = _.extend({
        'track': _.bind(this.track, this),
        'persistence_type': this.get_config('opt_out_tracking_persistence_type'),
        'cookie_prefix': this.get_config('opt_out_tracking_cookie_prefix'),
        'cookie_expiration': this.get_config('cookie_expiration'),
        'cross_site_cookie': this.get_config('cross_site_cookie'),
        'cross_subdomain_cookie': this.get_config('cross_subdomain_cookie'),
        'cookie_domain': this.get_config('cookie_domain'),
        'secure_cookie': this.get_config('secure_cookie'),
        'ignore_dnt': this.get_config('ignore_dnt')
    }, options);

    // check if localStorage can be used for recording opt out status, fall back to cookie if not
    if (!_.localStorage.is_supported()) {
        options['persistence_type'] = 'cookie';
    }

    return func(this.get_config('token'), {
        track: options['track'],
        trackEventName: options['track_event_name'],
        trackProperties: options['track_properties'],
        persistenceType: options['persistence_type'],
        persistencePrefix: options['cookie_prefix'],
        cookieDomain: options['cookie_domain'],
        cookieExpiration: options['cookie_expiration'],
        crossSiteCookie: options['cross_site_cookie'],
        crossSubdomainCookie: options['cross_subdomain_cookie'],
        secureCookie: options['secure_cookie'],
        ignoreDnt: options['ignore_dnt']
    });
};

/**
 * Opt the user in to data tracking and cookies/localstorage for this Mixpanel instance
 *
 * ### Usage:
 *
 *     // opt user in
 *     mixpanel.opt_in_tracking();
 *
 *     // opt user in with specific event name, properties, cookie configuration
 *     mixpanel.opt_in_tracking({
 *         track_event_name: 'User opted in',
 *         track_event_properties: {
 *             'Email': 'jdoe@example.com'
 *         },
 *         cookie_expiration: 30,
 *         secure_cookie: true
 *     });
 *
 * @param {Object} [options] A dictionary of config options to override
 * @param {function} [options.track] Function used for tracking a Mixpanel event to record the opt-in action (default is this Mixpanel instance's track method)
 * @param {string} [options.track_event_name=$opt_in] Event name to be used for tracking the opt-in action
 * @param {Object} [options.track_properties] Set of properties to be tracked along with the opt-in action
 * @param {boolean} [options.enable_persistence=true] If true, will re-enable sdk persistence
 * @param {string} [options.persistence_type=localStorage] Persistence mechanism used - cookie or localStorage - falls back to cookie if localStorage is unavailable
 * @param {string} [options.cookie_prefix=__mp_opt_in_out] Custom prefix to be used in the cookie/localstorage name
 * @param {Number} [options.cookie_expiration] Number of days until the opt-in cookie expires (overrides value specified in this Mixpanel instance's config)
 * @param {string} [options.cookie_domain] Custom cookie domain (overrides value specified in this Mixpanel instance's config)
 * @param {boolean} [options.cross_site_cookie] Whether the opt-in cookie is set as cross-site-enabled (overrides value specified in this Mixpanel instance's config)
 * @param {boolean} [options.cross_subdomain_cookie] Whether the opt-in cookie is set as cross-subdomain or not (overrides value specified in this Mixpanel instance's config)
 * @param {boolean} [options.secure_cookie] Whether the opt-in cookie is set as secure or not (overrides value specified in this Mixpanel instance's config)
 */
MixpanelLib.prototype.opt_in_tracking = function(options) {
    options = _.extend({
        'enable_persistence': true
    }, options);

    this._gdpr_call_func(optIn, options);
    this._gdpr_update_persistence(options);
};

/**
 * Opt the user out of data tracking and cookies/localstorage for this Mixpanel instance
 *
 * ### Usage:
 *
 *     // opt user out
 *     mixpanel.opt_out_tracking();
 *
 *     // opt user out with different cookie configuration from Mixpanel instance
 *     mixpanel.opt_out_tracking({
 *         cookie_expiration: 30,
 *         secure_cookie: true
 *     });
 *
 * @param {Object} [options] A dictionary of config options to override
 * @param {boolean} [options.delete_user=true] If true, will delete the currently identified user's profile and clear all charges after opting the user out
 * @param {boolean} [options.clear_persistence=true] If true, will delete all data stored by the sdk in persistence
 * @param {string} [options.persistence_type=localStorage] Persistence mechanism used - cookie or localStorage - falls back to cookie if localStorage is unavailable
 * @param {string} [options.cookie_prefix=__mp_opt_in_out] Custom prefix to be used in the cookie/localstorage name
 * @param {Number} [options.cookie_expiration] Number of days until the opt-in cookie expires (overrides value specified in this Mixpanel instance's config)
 * @param {string} [options.cookie_domain] Custom cookie domain (overrides value specified in this Mixpanel instance's config)
 * @param {boolean} [options.cross_site_cookie] Whether the opt-in cookie is set as cross-site-enabled (overrides value specified in this Mixpanel instance's config)
 * @param {boolean} [options.cross_subdomain_cookie] Whether the opt-in cookie is set as cross-subdomain or not (overrides value specified in this Mixpanel instance's config)
 * @param {boolean} [options.secure_cookie] Whether the opt-in cookie is set as secure or not (overrides value specified in this Mixpanel instance's config)
 */
MixpanelLib.prototype.opt_out_tracking = function(options) {
    options = _.extend({
        'clear_persistence': true,
        'delete_user': true
    }, options);

    // delete user and clear charges since these methods may be disabled by opt-out
    if (options['delete_user'] && this['people'] && this['people']._identify_called()) {
        this['people'].delete_user();
        this['people'].clear_charges();
    }

    this._gdpr_call_func(optOut, options);
    this._gdpr_update_persistence(options);
};

/**
 * Check whether the user has opted in to data tracking and cookies/localstorage for this Mixpanel instance
 *
 * ### Usage:
 *
 *     var has_opted_in = mixpanel.has_opted_in_tracking();
 *     // use has_opted_in value
 *
 * @param {Object} [options] A dictionary of config options to override
 * @param {string} [options.persistence_type=localStorage] Persistence mechanism used - cookie or localStorage - falls back to cookie if localStorage is unavailable
 * @param {string} [options.cookie_prefix=__mp_opt_in_out] Custom prefix to be used in the cookie/localstorage name
 * @returns {boolean} current opt-in status
 */
MixpanelLib.prototype.has_opted_in_tracking = function(options) {
    return this._gdpr_call_func(hasOptedIn, options);
};

/**
 * Check whether the user has opted out of data tracking and cookies/localstorage for this Mixpanel instance
 *
 * ### Usage:
 *
 *     var has_opted_out = mixpanel.has_opted_out_tracking();
 *     // use has_opted_out value
 *
 * @param {Object} [options] A dictionary of config options to override
 * @param {string} [options.persistence_type=localStorage] Persistence mechanism used - cookie or localStorage - falls back to cookie if localStorage is unavailable
 * @param {string} [options.cookie_prefix=__mp_opt_in_out] Custom prefix to be used in the cookie/localstorage name
 * @returns {boolean} current opt-out status
 */
MixpanelLib.prototype.has_opted_out_tracking = function(options) {
    return this._gdpr_call_func(hasOptedOut, options);
};

/**
 * Clear the user's opt in/out status of data tracking and cookies/localstorage for this Mixpanel instance
 *
 * ### Usage:
 *
 *     // clear user's opt-in/out status
 *     mixpanel.clear_opt_in_out_tracking();
 *
 *     // clear user's opt-in/out status with specific cookie configuration - should match
 *     // configuration used when opt_in_tracking/opt_out_tracking methods were called.
 *     mixpanel.clear_opt_in_out_tracking({
 *         cookie_expiration: 30,
 *         secure_cookie: true
 *     });
 *
 * @param {Object} [options] A dictionary of config options to override
 * @param {boolean} [options.enable_persistence=true] If true, will re-enable sdk persistence
 * @param {string} [options.persistence_type=localStorage] Persistence mechanism used - cookie or localStorage - falls back to cookie if localStorage is unavailable
 * @param {string} [options.cookie_prefix=__mp_opt_in_out] Custom prefix to be used in the cookie/localstorage name
 * @param {Number} [options.cookie_expiration] Number of days until the opt-in cookie expires (overrides value specified in this Mixpanel instance's config)
 * @param {string} [options.cookie_domain] Custom cookie domain (overrides value specified in this Mixpanel instance's config)
 * @param {boolean} [options.cross_site_cookie] Whether the opt-in cookie is set as cross-site-enabled (overrides value specified in this Mixpanel instance's config)
 * @param {boolean} [options.cross_subdomain_cookie] Whether the opt-in cookie is set as cross-subdomain or not (overrides value specified in this Mixpanel instance's config)
 * @param {boolean} [options.secure_cookie] Whether the opt-in cookie is set as secure or not (overrides value specified in this Mixpanel instance's config)
 */
MixpanelLib.prototype.clear_opt_in_out_tracking = function(options) {
    options = _.extend({
        'enable_persistence': true
    }, options);

    this._gdpr_call_func(clearOptInOut, options);
    this._gdpr_update_persistence(options);
};

MixpanelLib.prototype.report_error = function(msg, err) {
    console$1.error.apply(console$1.error, arguments);
    try {
        if (!err && !(msg instanceof Error)) {
            msg = new Error(msg);
        }
        this.get_config('error_reporter')(msg, err);
    } catch(err) {
        console$1.error(err);
    }
};

// EXPORTS (for closure compiler)

// MixpanelLib Exports
MixpanelLib.prototype['init']                      = MixpanelLib.prototype.init;
MixpanelLib.prototype['reset']                     = MixpanelLib.prototype.reset;
MixpanelLib.prototype['disable']                   = MixpanelLib.prototype.disable;
MixpanelLib.prototype['time_event']                = MixpanelLib.prototype.time_event;
MixpanelLib.prototype['track']                     = MixpanelLib.prototype.track;
MixpanelLib.prototype['track_links']               = MixpanelLib.prototype.track_links;
MixpanelLib.prototype['track_forms']               = MixpanelLib.prototype.track_forms;
MixpanelLib.prototype['track_pageview']            = MixpanelLib.prototype.track_pageview;
MixpanelLib.prototype['register']                  = MixpanelLib.prototype.register;
MixpanelLib.prototype['register_once']             = MixpanelLib.prototype.register_once;
MixpanelLib.prototype['unregister']                = MixpanelLib.prototype.unregister;
MixpanelLib.prototype['identify']                  = MixpanelLib.prototype.identify;
MixpanelLib.prototype['alias']                     = MixpanelLib.prototype.alias;
MixpanelLib.prototype['name_tag']                  = MixpanelLib.prototype.name_tag;
MixpanelLib.prototype['set_config']                = MixpanelLib.prototype.set_config;
MixpanelLib.prototype['get_config']                = MixpanelLib.prototype.get_config;
MixpanelLib.prototype['get_property']              = MixpanelLib.prototype.get_property;
MixpanelLib.prototype['get_distinct_id']           = MixpanelLib.prototype.get_distinct_id;
MixpanelLib.prototype['toString']                  = MixpanelLib.prototype.toString;
MixpanelLib.prototype['opt_out_tracking']          = MixpanelLib.prototype.opt_out_tracking;
MixpanelLib.prototype['opt_in_tracking']           = MixpanelLib.prototype.opt_in_tracking;
MixpanelLib.prototype['has_opted_out_tracking']    = MixpanelLib.prototype.has_opted_out_tracking;
MixpanelLib.prototype['has_opted_in_tracking']     = MixpanelLib.prototype.has_opted_in_tracking;
MixpanelLib.prototype['clear_opt_in_out_tracking'] = MixpanelLib.prototype.clear_opt_in_out_tracking;
MixpanelLib.prototype['get_group']                 = MixpanelLib.prototype.get_group;
MixpanelLib.prototype['set_group']                 = MixpanelLib.prototype.set_group;
MixpanelLib.prototype['add_group']                 = MixpanelLib.prototype.add_group;
MixpanelLib.prototype['remove_group']              = MixpanelLib.prototype.remove_group;
MixpanelLib.prototype['track_with_groups']         = MixpanelLib.prototype.track_with_groups;
MixpanelLib.prototype['start_batch_senders']       = MixpanelLib.prototype.start_batch_senders;
MixpanelLib.prototype['stop_batch_senders']        = MixpanelLib.prototype.stop_batch_senders;
MixpanelLib.prototype['DEFAULT_API_ROUTES']        = DEFAULT_API_ROUTES;

// MixpanelPersistence Exports
MixpanelPersistence.prototype['properties']            = MixpanelPersistence.prototype.properties;
MixpanelPersistence.prototype['update_search_keyword'] = MixpanelPersistence.prototype.update_search_keyword;
MixpanelPersistence.prototype['update_referrer_info']  = MixpanelPersistence.prototype.update_referrer_info;
MixpanelPersistence.prototype['get_cross_subdomain']   = MixpanelPersistence.prototype.get_cross_subdomain;
MixpanelPersistence.prototype['clear']                 = MixpanelPersistence.prototype.clear;


var instances = {};
var extend_mp = function() {
    // add all the sub mixpanel instances
    _.each(instances, function(instance, name) {
        if (name !== PRIMARY_INSTANCE_NAME) { mixpanel_master[name] = instance; }
    });

    // add private functions as _
    mixpanel_master['_'] = _;
};

var override_mp_init_func = function() {
    // we override the snippets init function to handle the case where a
    // user initializes the mixpanel library after the script loads & runs
    mixpanel_master['init'] = function(token, config, name) {
        if (name) {
            // initialize a sub library
            if (!mixpanel_master[name]) {
                mixpanel_master[name] = instances[name] = create_mplib(token, config, name);
                mixpanel_master[name]._loaded();
            }
            return mixpanel_master[name];
        } else {
            var instance = mixpanel_master;

            if (instances[PRIMARY_INSTANCE_NAME]) {
                // main mixpanel lib already initialized
                instance = instances[PRIMARY_INSTANCE_NAME];
            } else if (token) {
                // intialize the main mixpanel lib
                instance = create_mplib(token, config, PRIMARY_INSTANCE_NAME);
                instance._loaded();
                instances[PRIMARY_INSTANCE_NAME] = instance;
            }

            mixpanel_master = instance;
            if (init_type === INIT_SNIPPET) {
                window$1[PRIMARY_INSTANCE_NAME] = mixpanel_master;
            }
            extend_mp();
        }
    };
};

var add_dom_loaded_handler = function() {
    // Cross browser DOM Loaded support
    function dom_loaded_handler() {
        // function flag since we only want to execute this once
        if (dom_loaded_handler.done) { return; }
        dom_loaded_handler.done = true;

        DOM_LOADED = true;
        ENQUEUE_REQUESTS = false;

        _.each(instances, function(inst) {
            inst._dom_loaded();
        });
    }

    function do_scroll_check() {
        try {
            document$1.documentElement.doScroll('left');
        } catch(e) {
            setTimeout(do_scroll_check, 1);
            return;
        }

        dom_loaded_handler();
    }

    if (document$1.addEventListener) {
        if (document$1.readyState === 'complete') {
            // safari 4 can fire the DOMContentLoaded event before loading all
            // external JS (including this file). you will see some copypasta
            // on the internet that checks for 'complete' and 'loaded', but
            // 'loaded' is an IE thing
            dom_loaded_handler();
        } else {
            document$1.addEventListener('DOMContentLoaded', dom_loaded_handler, false);
        }
    } else if (document$1.attachEvent) {
        // IE
        document$1.attachEvent('onreadystatechange', dom_loaded_handler);

        // check to make sure we arn't in a frame
        var toplevel = false;
        try {
            toplevel = window$1.frameElement === null;
        } catch(e) {
            // noop
        }

        if (document$1.documentElement.doScroll && toplevel) {
            do_scroll_check();
        }
    }

    // fallback handler, always will work
    _.register_event(window$1, 'load', dom_loaded_handler, true);
};

function init_as_module() {
    init_type = INIT_MODULE;
    mixpanel_master = new MixpanelLib();

    override_mp_init_func();
    mixpanel_master['init']();
    add_dom_loaded_handler();

    return mixpanel_master;
}

var mixpanel = init_as_module();

var mixpanel_cjs = mixpanel;

//                                      Copyright 2024 WebPros International, LLC
//                                                           All rights reserved.
// copyright@cpanel.net                                         http://cpanel.net
// This code is subject to the cPanel license. Unauthorized copying is prohibited.
/**
 * A place to store constants used by the Mixpanel tool.
 */
const MixpanelConstants = {
  devReportingEnabled: false,
  apiHost: "https://mixpanel-proxy.cpanel.net",
  devProjectToken: "c7c6f1b1bc8e7b3d8254ebe545861955",
  prodProjectToken: "2cca34424fe0e8ad6897d354b9591c45",
  mpUserSession: "mp_cp_user_session",
  mpResetSession: "mp_cp_reset_session",
};

//                                      Copyright 2024 WebPros International, LLC
class MixpanelUtilsService {
  /**
   * Initialize Mixpanel for the workspace (cPanel, Webmail or WHM)
   * that calls this function.
   * Note: It DOES NOT track any analytics data yet.
   */
  initializeMixpanel(config) {
    // Need this for sending into 'loaded' handler.
    const mixpanelUtilsSvc = this;
    let mixpanelConfig = config && typeof config === "string" ? JSON.parse(unescape(config)) : config;
    let debugMode = mixpanelConfig.debugMode || false;
    let isQaBuild = true;
    if (mixpanelConfig.cpAnalyticsData) {
      isQaBuild =
        !mixpanelConfig.cpAnalyticsData.is_nat && mixpanelConfig.cpAnalyticsData.server_main_ip_is_private;
    }
    const isProdEnv = this._isProdEnvironment(mixpanelConfig.isSandbox, isQaBuild);
    const accessToken = isProdEnv ? MixpanelConstants.prodProjectToken : MixpanelConstants.devProjectToken;
    const isDevReportingDisabled = !isProdEnv && !(window["__cpanel_force_dev_reporting"] || MixpanelConstants.devReportingEnabled);
    if (isDevReportingDisabled) {
      console.log("[Mixpanel DRY RUN] Dev reporting disabled. Would have initialized with token:", accessToken);
      console.log("[Mixpanel DRY RUN] Config:", JSON.stringify(mixpanelConfig, null, 2));
      return;
    }
    mixpanel_cjs.init(accessToken, {
      debug: debugMode,
      ignore_dnt: true,
      property_blacklist: [
        // properties that reveal the cpSess CSRF url path
        "$initial_referrer",
        "url",
      ],
      ip: false,
      autotrack: false,
      api_host: window["__cpanel_mixpanel_api_host"] || MixpanelConstants.apiHost,
      loaded: function (mixpanel) {
        // Remove old ones if a new user is detected.
        if (mixpanelConfig.loginUser !== sessionStorage.getItem(MixpanelConstants.mpUserSession)) {
          sessionStorage.removeItem(MixpanelConstants.mpUserSession);
          sessionStorage.removeItem(MixpanelConstants.mpResetSession);
        }
        if (mixpanelConfig.canTrackUserAnalytics) {
          mixpanelUtilsSvc.enableAnalytics(mixpanelConfig, false);
        }
        else {
          // The init allows track events by default. Disable it here and
          // Let it get enabled when the user consent is checked and mixpanel
          // properties are actually getting registered.
          mixpanel.opt_out_tracking();
        }
        window["mixpanel"] = mixpanel;
      },
    });
  }
  /**
   * This method is called when the user logs in for the first time with analytics consent enabled,
   * or after saving their analytics consent preference.
   * @param mixpanelConfig    An object that includes mixpanel specific data.
   * @param isFirstTime       A boolean indicating if this is the first time the user is enabling analytics.
   */
  enableAnalytics(mixpanelConfig, isFirstTime = true) {
    const isAnalyticsDataExists = Object.keys(mixpanelConfig.cpAnalyticsData || {}).length > 0;
    const isAnalyticsEnabled = !!mixpanelConfig.canTrackUserAnalytics && isAnalyticsDataExists;
    if (!isFirstTime && !isAnalyticsEnabled)
      return;
    // Store user logged in event when loaded the first time.
    if (!sessionStorage.getItem(MixpanelConstants.mpUserSession)) {
      sessionStorage.setItem(MixpanelConstants.mpUserSession, mixpanelConfig.loginUser);
    }
    this._registerMixpanel(mixpanel_cjs, mixpanelConfig.cpAnalyticsData);
  }
  /**
   * Registers Mixpanel for the workspace (cPanel, Webmail or WHM)
   * that calls this function.
   * Opts in analytics tracking.
   * Creates super properties and that can be accessed by all events.
   */
  _registerMixpanel(mixpanel, analyticsData) {
    if (Object.keys(analyticsData).length === 0) {
      return;
    }
    // Call Mixpanel's opt-in method.
    if (!mixpanel.has_opted_in_tracking()) {
      // We don't want this to create an unnecessary event.
      mixpanel.opt_in_tracking({ track: () => { } });
    }
    const tokenRegex = /\/cpsess\d+\//i;
    // Sanitize the url path.
    var path = this._getUrlPath().replace(tokenRegex, "/");
    var pageTitle = analyticsData.product_interface + "-" + (analyticsData.product_feature || path);
    // Register $current_url before the identify request to ensure it uses
    // the sanitized path in all requests.
    mixpanel.register({
      $current_url: path,
    });
    // Identify the user only if the UUID exists.
    if (analyticsData.UUID) {
      mixpanel.identify(analyticsData.UUID);
    }
    else if (!sessionStorage.getItem(MixpanelConstants.mpResetSession)) {
      // When UUID doesn't exist, Mixpanel SDK uses the previous UUID
      // stored in the cookie. That may end up identifying the current user
      // with a previous user's login. To avoid such situation, we are clearing
      // old data and recreating the props for the current user IF UUID doesn't exist.
      mixpanel.reset();
      sessionStorage.setItem(MixpanelConstants.mpResetSession, "true");
    }
    // Identify the team user only if is_team_user is true and get roles
    if (analyticsData.is_team_user) {
      mixpanel.people.set({ team_user_roles: analyticsData.team_user_roles });
    }
    // Register MixPanel. The properties set during registration are super properties.
    // These super properties are sent with all events tracked by Mixpanel.
    mixpanel.register(Object.assign({}, analyticsData));
    mixpanel.set_group("company_id", analyticsData.company_id);
    mixpanel.people.set({
      product_locale: analyticsData.product_locale,
      product_version: analyticsData.product_version,
      product_trial_status: analyticsData.product_trial_status,
      server_current_license_kind: analyticsData.server_current_license_kind,
      server_main_ip: analyticsData.server_main_ip,
      server_operating_system: analyticsData.server_operating_system,
      server_is_nat: analyticsData.is_nat,
      account_transferred_or_restored: analyticsData.TRANSFERRED_OR_RESTORED,
    });
    // Track Page view event.
    mixpanel.track(pageTitle, {});
  }
  /**
   * Opts out of analytics tracking for the
   * workspace (cPanel, Webmail or WHM)
   * from where this function is called.
   * Additionally, it also clears the super properties
   * that where set during the opt in phase.
   */
  optOutOfAnalytics() {
    if (mixpanel_cjs.has_opted_in_tracking()) {
      mixpanel_cjs.clear_opt_in_out_tracking();
      // Clear all the super properties before opting out.
      mixpanel_cjs.reset();
      mixpanel_cjs.opt_out_tracking();
    }
  }
  /**
   * Returns the sanitized path of the url.
   */
  _getUrlPath() {
    var path = window.location.pathname;
    if (path) {
      var wholepath = path.split("/");
      var custompath = wholepath.slice(2);
      path = "/" + custompath.join("/");
    }
    return path;
  }
  /**
   * Return if the current environment is Production or Development
   * based on sandbox touchfile and IP addressing.
   */
  _isProdEnvironment(isSandbox, isQaBuild) {
    return isSandbox || isQaBuild ? false : true;
  }
}
const mixpanelUtils = new MixpanelUtilsService();

const CpLoadMixpanelJs$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
    this.mixpanelInstanceLoaded = createEvent(this, "mixpanelInstanceLoaded", 7);
    /**
     * IMPORTANT: This is a special variable used to identify if mixpanel is loaded from
     * cp-analytics package.
     * REASON: The users have the ability to disable either or both cp-analytics package updates and cPanel version updates.
     * So to AVOID the situation where the users may end up loading mixpanel DOUBLE times, we added this flag
     * to check if it is available from package and create the new distribution/load strategy ONLY
     * when it DOES NOT exist.
     */
    this.mixpanelAvailableThroughRpm = false;
  }
  componentWillLoad() {
    var _a;
    this.parsedAnalyticsConfig = JSON.parse(unescape(this.analyticsConfig));
    /**
     * DEV NOTES: The mixpanel instrumentation is now moved to ULC but the consent popup still exists in cp-analytics package.
     * In the scenario where the user gave consent and then later server admin uninstalls cp-analytics package, the consent popup
     * does NOT appear for the user in any workspace (:2083, :2087 and :2096).
     * Since they don't have control to 'Allow'/'Deny' in this scenario, we have to abort mixpanel tracking.
     *
     * The need for this check should go away when consent gathering interface moves to the ULC codebase.
     */
    if (!!((_a = this.parsedAnalyticsConfig) === null || _a === void 0 ? void 0 : _a.isUserAnalyticsRequiredByLeika)) {
      const analyticsPopup = document.querySelector("#analyticsContainer");
      if (analyticsPopup == null) {
        return;
      }
    }
    /**
     * Having mixpanel defined already tells the system that cp-analytics package did not update.
     * (It could be because the server admin excluded it from updates or just disabled manually)
     * In such case, the system just uses the one defined in cp-analytics package. It helps to avoid
     * double duplication of mixpanel instance.
     */
    if (typeof window["mixpanel"] !== "undefined") {
      this.mixpanelAvailableThroughRpm = true;
    }
    else {
      this.mixpanelAvailableThroughRpm = false;
      mixpanelUtils.initializeMixpanel(this.analyticsConfig);
    }
    this.mixpanelInstanceLoaded.emit();
  }
  /**
   * Listens for consentPrivacySaved event dispatched even when consent and privacy settings are changed and saved
   * outside of the webcomponent area. Hence the reason why this listener targets at the body of the document.
   *
   * @param event
   * @returns
   */
  handleConsentPrivacySavedEvent(event) {
    if (typeof window["mixpanel"] === "undefined") {
      return;
    }
    if (event.detail.analytics) {
      mixpanelUtils.enableAnalytics(this.parsedAnalyticsConfig, true);
    }
    else {
      mixpanelUtils.optOutOfAnalytics();
    }
  }
  render() {
    return !this.mixpanelAvailableThroughRpm ? h(Host, null) : "";
  }
};

/**
# cpanel - ui/web-components/src/components/shared/cp-logo/logo-types.ts
#                                                  Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
 */
var LogoType;
(function (LogoType) {
  LogoType["CpanelOrangeLg"] = "./assets/cpanel-logo-orange.svg";
  LogoType["CpanelWhiteLg"] = "./assets/cpanel-logo-white.svg";
})(LogoType || (LogoType = {}));

const cpLogoCss = ":root{--cp-font-weight-semi-bold:600}.logo{width:auto;max-width:200px;max-height:100px;min-height:25px;height:-moz-max-content;height:max-content}@media (max-width: 767.98px){.logo{max-width:150px;max-height:50px}}";

const locale$n = getLocaleInstance();
const CpLogo$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
    /**
     * The href for the anchor tag surrounding the logo.
     */
    this.logoLinkHref = "index.html";
    /**
     * Target for the anchor tag.
     */
    this.linkTarget = "";
    /**
     * Title attribute for the anchor tag.
     */
    this.logoTitle = "";
    /**
     * Id attribute for the logo.
     */
    this.logoId = "";
    /**
     * src attribute for the logo.
     */
    this.logoSrc = getAssetPath(LogoType.CpanelOrangeLg);
    /**
     * Alt text which will override the default logo description.
     */
    this.logoAltText = "";
  }
  /**
   * Stencil lifecycle. Gets values from state.
   */
  componentWillRender() {
    this.directoryPrefix = state.directoryPrefix;
  }
  /**
   * The href property after checking if it is internal or external.
   */
  get parsedLogoLinkHref() {
    // If the link contains http, it is external so we don't add the directoryPrefix
    if (this.logoLinkHref.includes("http")) {
      return this.logoLinkHref;
    }
    return `${this.directoryPrefix}${this.logoLinkHref}`;
  }
  /**
   * When called, applies focus to the a tag within this component
   */
  async doFocus() {
    this.linkEl.focus();
  }
  render() {
    return (h(Host, null, h("cp-dir", null, h("a", { tabindex: "0", href: this.parsedLogoLinkHref, ref: el => (this.linkEl = el), target: this.linkTarget, title: this.logoTitle }, h("img", { id: this.logoId, class: "logo", src: this.logoSrc, alt: this.logoAltText ? this.logoAltText : locale$n.maketext("cPanel logo") })))));
  }
  get host() { return this; }
  static get style() { return cpLogoCss; }
};

const cpMainMenuCss = ":root{--cp-font-weight-semi-bold:600}nav{display:block;background:var(--cp-primary-color);color:var(--cp-primary-contrast-text);height:100%;box-sizing:border-box}.cp-main-menu__logo-container{display:flex;justify-content:flex-start;align-items:baseline}";

const CpMainMenu$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
    /**
     * base64-encoded SVG or url
     */
    this.logoSrc = "";
    /**
     * Optional logo description. This is needed because the logo can be custom and the alt
     * text needs to accurately describe the logo displayed.
     */
    this.logoAltText = "";
  }
  componentWillLoad() {
    this._appName = state.appName;
  }
  /**
   * Handles the scroll event of the nav menu
   */
  handleScroll() {
    var _a;
    this.renderBoxShadow = ((_a = this.navElement) === null || _a === void 0 ? void 0 : _a.scrollTop) !== 0;
  }
  /**
   * Update the favorites dynamically when they are edited.
   *
   * @param items List of apps to put in the favorites category.
   */
  async updateFavorites(items) {
    var _a;
    await ((_a = this.menuEl) === null || _a === void 0 ? void 0 : _a.updateFavorites(items));
  }
  render() {
    return (h(Host, null, h("cp-style-reset", null, h("cp-dir", null, h("nav", { onScroll: () => this.handleScroll(), ref: el => (this.navElement = el) }, this._appName === AppName.Cpanel ? (h("cp-main-menu-nav", { "logo-src": this.logoSrc, "logo-alt-text": this.logoAltText })) : (h("cp-main-menu-nav-whm", { ref: el => (this.menuEl = el), "render-box-shadow": this.renderBoxShadow, "logo-alt-text": this.logoAltText })))))));
  }
  static get style() { return cpMainMenuCss; }
};

const cpMainMenuHeaderControlCss = ":host{display:flex}.btn-hamburger-menu{display:flex;background:transparent;border:none;padding:0;cursor:pointer}";

const locale$m = getLocaleInstance();
const CpMainMenuHeaderControl$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
    this.mainMenuOpened = createEvent(this, "mainMenuOpened", 7);
    /**
     * Determines if the main menu is open.
     */
    this.isMainMenuOpen = false;
    /**
     * Main menu DOM element.
     */
    this.mainMenuEl = document.querySelector("#cp-main-menu-container");
    /**
     * Overlay DOM element.
     */
    this.overlayEl = document.querySelector("#cp-overlay");
  }
  /**
   * Listens for click on component, opens menu
   */
  openMainMenu() {
    this.isMainMenuOpen = true;
  }
  /**
   * Listens for click on body, ensures menu closes on click-out
   */
  handleClickOut(event) {
    // If menu's already closed, exit early
    if (!this.isMainMenuOpen) {
      return;
    }
    // Check for click-out, close menu when user clicks out
    const isClickOutsideMenu = event.target === this.overlayEl;
    if (isClickOutsideMenu) {
      this.isMainMenuOpen = false;
    }
  }
  /**
   * Listens for ESC keypress on body, closes menu
   */
  handleKeyDown(event) {
    // If menu's already closed, exit early
    if (!this.isMainMenuOpen) {
      return;
    }
    if (event.key === "Escape") {
      this.isMainMenuOpen = false;
    }
  }
  /**
   * Triggers necessary DOM updates + event emissions whenever state or props update
   */
  componentWillUpdate() {
    this.updateDOMBasedOnMenuState();
    this.mainMenuOpened.emit(this.isMainMenuOpen);
  }
  /**
   * Manipulates the DOM as needed when the menu state changes.
   * Displays/hides main menu container
   * Displays/hides overlay
   * Brings focus back to the hamburger menu btn when the user closes the menu
   */
  updateDOMBasedOnMenuState() {
    var _a;
    if (!this.overlayEl || !this.mainMenuEl) {
      return;
    }
    if (this.isMainMenuOpen) {
      this.overlayEl.classList.add("cp-overlay--cover-header");
      this.mainMenuEl.classList.add("cp-layout-main-menu--show");
    }
    else {
      this.overlayEl.classList.remove("cp-overlay--cover-header");
      this.mainMenuEl.classList.remove("cp-layout-main-menu--show");
      // Ensure focus returns to menu toggle on menu close
      const menuBtnEl = (_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector("#hamburger-menu");
      menuBtnEl.focus();
    }
  }
  render() {
    return (h(Host, null, h("cp-dir", null, h("button", { id: "hamburger-menu", type: "button", class: "btn-hamburger-menu", "aria-expanded": `${this.isMainMenuOpen}`, "aria-label": locale$m.maketext("Open main menu") }, h("cp-icon", { name: "menu-line", size: IconSize.lg, mode: IconMode.Centered })))));
  }
  get host() { return this; }
  static get style() { return cpMainMenuHeaderControlCss; }
};

/**
# cpanel - ui/web-components/src/utils/url.ts      Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
 */
/**
 * Tells whether a URL is absolute (i.e., has a scheme and all) or not.
 */
function urlIsAbsolute(input) {
  return input.includes("://");
}

/**
# cpanel - ui/web-components/src/components/shared/services/expanded-left-nav.service.ts
#                                                  Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
 */
class ExpandedLeftNavService {
  /**
   * Focuses the first link in the menu.
   * @param event
   * @param childLogo
   */
  async setFocus(event, childLogo) {
    const menuOpened = event.detail;
    if (menuOpened) {
      await childLogo.doFocus();
    }
  }
}
const expandedLeftNavService = new ExpandedLeftNavService();

const cpMainMenuNavCss = ":root{--cp-font-weight-semi-bold:600}.cp-main-menu__container{padding:var(--cp-spacer-5) var(--cp-spacer-4) 0 var(--cp-spacer-4);height:100%;display:flex;flex-direction:column}.links{margin-top:var(--cp-spacer-5);flex-grow:1;overflow-y:auto;scrollbar-color:var(--cp-primary-color) var(--cp-tertiary-background)}[dir=\"ltr\"] .links{padding-left:0}[dir=\"rtl\"] .links{padding-right:0}.links::-webkit-scrollbar{width:12px}.links::-webkit-scrollbar-track{background:var(--cp-tertiary-background)}.links::-webkit-scrollbar-thumb{background-color:var(--cp-primary-color);border-radius:20px;border:3px solid var(--cp-tertiary-background)}.list-item{list-style:none;margin-bottom:var(--cp-spacer-3)}.list-item:last-child{margin-bottom:0}.list-item__icon{display:inline;vertical-align:middle}[dir=\"ltr\"] .list-item__icon{margin-right:var(--cp-spacer-2)}[dir=\"rtl\"] .list-item__icon{margin-left:var(--cp-spacer-2)}.list-item__text{vertical-align:top}a{color:var(--cp-primary-contrast-text)}a:link,a:visited,a:active,a:hover{text-decoration:none}";

/**
 * Is the given input an absolute path?
 */
function _isAbsolutePath(input) {
  return input.startsWith("/");
}
const CpMainMenuNav$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
  }
  /**
   * The actual href value
   */
  _finalLinkURL(input) {
    if (urlIsAbsolute(input)) {
      return input;
    }
    if (_isAbsolutePath(input)) {
      // /foo/bar.html needs the security token added
      // (e.g., /cpsessXXXXX/foo/bar.html), but in cP
      // we don’t have the security token for now.
      //
      // This is here as a courtesy so that we get some
      // indicator of a deeper problem once someone tries
      // to send an absolute path in here.
      throw "No security token available!";
    }
    return this.directoryPrefix + input;
  }
  /**
   * Listens for mainMenuOpened event emission on body and focuses the first link in the menu.
   * @param event
   */
  async setFocus(event) {
    expandedLeftNavService.setFocus(event, this.childLogo);
  }
  analyticsInstanceLoadHandler() {
    var _a, _b;
    // Track link clicks from cPanel Jupiter's main menu.
    if (this._appName === AppName.Cpanel) {
      const navLinkEls = (_a = this.navLinks) === null || _a === void 0 ? void 0 : _a.querySelectorAll("li>a");
      if (navLinkEls === null || navLinkEls === void 0 ? void 0 : navLinkEls.length) {
        (_b = window["mixpanel"]) === null || _b === void 0 ? void 0 : _b.track_links(navLinkEls, "cPanel-Main-Menu-Nav-Link", linkEl => {
          return { "nav-link-id": linkEl.id };
        });
      }
    }
  }
  /**
   * Stencil lifecycle method
   */
  componentWillRender() {
    this.directoryPrefix = state.directoryPrefix;
    if (this.directoryPrefix && !this.directoryPrefix.endsWith("/")) {
      this.directoryPrefix += "/";
    }
    this.linkList = state.mainMenuLinks;
  }
  componentDidLoad() {
    this._appName = state.appName;
  }
  render() {
    return (h("cp-style-reset", null, h("cp-dir", null, h("div", { class: "cp-main-menu__container" }, h("div", { class: "cp-main-menu__logo-container" }, h("cp-logo", { ref: el => (this.childLogo = el), "logo-src": this.logoSrc, "logo-alt-text": this.logoAltText, id: "cp-main-menu__logo" })), h("ul", { class: "links", id: "cp-main-menu__link-list", ref: el => (this.navLinks = el) }, this.linkList.map(link => (h("li", { class: "list-item", key: link.id }, h("a", { id: link.id, class: "list-item__link", href: this._finalLinkURL(link.linkUrl) }, h("span", { class: "list-item__icon", role: "img", "aria-hidden": "true", innerHTML: link.iconSvg }), h("span", { class: "list-item__text" }, link.userText))))))))));
  }
  static get style() { return cpMainMenuNavCss; }
};

/**
# cpanel - ui/web-components/src/components/main-menu/cp-main-menu-nav-whm/session-storage-keys.ts
#                                                  Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
*/
/**
 * Keys used sessionStorage
 */
var SessionStorage;
(function (SessionStorage) {
  SessionStorage["SEARCHTERM"] = "searchTerm";
  SessionStorage["USERNAME"] = "userName";
})(SessionStorage || (SessionStorage = {}));

/**
# cpanel - ui/web-components/src/components/shared/classes/category.ts
#                                                  Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
 */
class Category {
  /**
   * @param input - static properties
   * @param initialNavUrl - from the global store/state
   */
  constructor(input, initialNavUrl) {
    this._expansionStateChanged = false;
    Object.assign(this, input);
    this._containsLoadedPageApp = this.items.some(app => app.url === initialNavUrl);
  }
  shownExpanded() {
    if (this._containsLoadedPageApp) {
      if (!this._expansionStateChanged) {
        return true;
      }
    }
    return this.storedExpanded;
  }
  setExpansionState(newState) {
    this._expansionStateChanged = true;
    this.storedExpanded = newState;
  }
  /**
   * Update the list of apps in the category.
   *
   * @param items The list of apps to set for the category.
   */
  update(items) {
    this.items = items;
  }
}

/**
# cpanel - ui/web-components/src/components/shared/services/whm/personalization.service.ts
#                                                  Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
 */
/**
 * Get saved personalization data for user
 */
function getPersonalizationData(securityToken, store, name) {
  const body = {
    "api.version": 1,
    "names": [`${name}`],
    "store": `${store}`,
  };
  const request = new Request(buildRequestURL(securityToken, "personalization_get"), {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    body: JSON.stringify(body),
  });
  return fetch(request)
    .then(resp => {
    return resp.json();
  })
    .then(data => {
    if (data.metadata && !data.metadata.result) {
      throw data.metadata.reason;
    }
    else {
      return data.data.personalization;
    }
  })
    .catch(error => {
    console.error(`DEV ERROR: ${error}`);
  });
}
/**
 * Set personalization data for user
 */
function setPersonalizationData(securityToken, store, name, data) {
  const body = {
    "api.version": 1,
    "store": `${store}`,
    "personalization": {},
  };
  body["personalization"][`${name}`] = data;
  const request = new Request(buildRequestURL(securityToken, "personalization_set"), {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    body: JSON.stringify(body),
  });
  return fetch(request)
    .then(resp => {
    return resp.json();
  })
    .then(data => {
    if (data.metadata && !data.metadata.result) {
      throw data.metadata.reason;
    }
    else {
      return data;
    }
  })
    .catch(error => {
    console.error(`DEV ERROR: ${error}`);
  });
}

/**
# cpanel - ui/web-components/src/components/shared/enums/plugins-category.enum.ts
#                                                  Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
 */
/**
 * Plugins category does not exist in dynamicui.conf. It is created dynamically if plugins exist.
 * This enum returns the hard coded key and name of the category if/when plugins exist.
 */
var PluginsCategory;
(function (PluginsCategory) {
  /**
   * Localizable display name
   * Note: Please localize the name wherever it's used.
   *
   * @example
   * const locale = getLocaleInstance();
   * const categoryName = "";
   * if (category.key === PluginsCategory.KEY){
   *      categoryName = locale.maketext(PluginsCategory.NAME)
   * }
   */
  PluginsCategory["NAME"] = "Plugins";
  /**
   * Non localized identifier key
   */
  PluginsCategory["KEY"] = "plugins";
})(PluginsCategory || (PluginsCategory = {}));

const cpMainMenuNavWhmCss = "@charset \"UTF-8\";:root{--cp-font-weight-semi-bold:600}input[type=search].hide-browser-clear-button::-ms-clear{display:none;width:0;height:0}input[type=search].hide-browser-clear-button::-ms-reveal{display:none;width:0;height:0}input[type=search].hide-browser-clear-button::-webkit-search-decoration,input[type=search].hide-browser-clear-button::-webkit-search-cancel-button,input[type=search].hide-browser-clear-button::-webkit-search-results-button,input[type=search].hide-browser-clear-button::-webkit-search-results-decoration{display:none}.flex-wrapper{height:100%;display:flex;flex-direction:column}.section-separator{width:100%;margin-bottom:0;border:solid 0.5px var(--cp-primary-contrast-dull-color);opacity:0.8}.navlist-container{overflow-y:auto;scrollbar-color:var(--cp-primary-color) var(--cp-primary-contrast-dull-color)}.navlist-container::-webkit-scrollbar{width:12px}.navlist-container::-webkit-scrollbar-track{background:var(--cp-primary-contrast-dull-color)}.navlist-container::-webkit-scrollbar-thumb{background-color:var(--cp-primary-color);border-radius:20px;border:3px solid var(--cp-primary-contrast-dull-color)}.links{margin-top:0;flex-grow:1}[dir=\"ltr\"] .links{padding:0 var(--cp-spacer-4) 0 var(--cp-spacer-3)}[dir=\"rtl\"] .links{padding:0 var(--cp-spacer-3) 0 var(--cp-spacer-4)}.links a:focus{outline:dashed var(--cp-border-width-1) var(--cp-primary-contrast-dull-color)}.list-item{list-style:none;}.list-item:last-child{margin-bottom:0}.list-item a{color:var(--cp-primary-contrast-dull-color)}.list-item a:hover,.list-item a:focus{color:var(--cp-primary-contrast-text)}.list-item .list-item__category-text{font-size:15px}.list-item .list-item{margin-bottom:var(--cp-spacer-2);font-size:15px;line-height:21px;font-weight:400}.list-item .list-item.whm-current-tool .list-item__text{position:relative}.list-item .list-item.whm-current-tool .list-item__text::before{content:\"●\";color:var(--cp-primary-contrast-text);position:absolute}[dir=\"ltr\"] .list-item .list-item.whm-current-tool .list-item__text::before{left:-1.55rem}[dir=\"rtl\"] .list-item .list-item.whm-current-tool .list-item__text::before{right:-1.55rem}.list-item .list-item.whm-current-tool a,.list-item .list-item.whm-current-tool a:hover{color:var(--cp-primary-contrast-text)}.list-item .list-item a{color:var(--cp-primary-contrast-dull-color)}.list-item .list-item a:hover,.list-item .list-item a:focus{color:var(--cp-primary-contrast-text)}[dir=\"ltr\"] .list-item__icon{margin-right:var(--cp-spacer-1)}[dir=\"rtl\"] .list-item__icon{margin-left:var(--cp-spacer-1)}.list-item__category-link,.list-item__link{display:flex;align-items:center}.list-item__link{padding:2px}[dir=\"ltr\"] .list-item__link{margin-left:-5px}[dir=\"rtl\"] .list-item__link{margin-right:-5px}a:link,a:visited,a:active,a:hover{text-decoration:none}.toggle-all-container{margin-top:var(--cp-spacer-3);display:flex;justify-content:space-between;gap:var(--cp-spacer-1)}.toggle-all-container__button{background:none;color:var(--cp-primary-contrast-dull-color);cursor:pointer;border:solid var(--cp-border-width-1) var(--cp-primary-contrast-dull-color);padding:var(--cp-spacer-1);border-radius:3px;flex:1 1 0}[dir=\"ltr\"] .toggle-all-container__button{margin-right:0;margin-right:var(--cp-spacer-2)}[dir=\"rtl\"] .toggle-all-container__button{margin-left:0;margin-left:var(--cp-spacer-2)}.toggle-all-container__button:hover,.toggle-all-container__button:active,.toggle-all-container__button:focus{color:var(--cp-primary-contrast-text);border:solid var(--cp-border-width-1) var(--cp-primary-contrast-text)}[dir=\"ltr\"] .toggle-all-container__button:last-of-type{margin-right:0}[dir=\"rtl\"] .toggle-all-container__button:last-of-type{margin-left:0}.toggle-all-container__text{padding:var(--cp-spacer-1)}[dir=\"ltr\"] .toggle-all-container__text:not(:last-of-type){padding-right:var(--cp-spacer-1)}[dir=\"rtl\"] .toggle-all-container__text:not(:last-of-type){padding-left:var(--cp-spacer-1)}[dir=\"ltr\"] .list{padding-left:var(--cp-spacer-5)}[dir=\"rtl\"] .list{padding-right:var(--cp-spacer-5)}.list a:hover{text-decoration:underline;color:var(--cp-primary-contrast-dull-color)}.cp-main-menu__header,.cp-main-menu__header--box-shadowed{position:sticky;top:0;padding:var(--cp-spacer-4) var(--cp-spacer-3) var(--cp-spacer-2) var(--cp-spacer-3);background-color:var(--cp-primary-color);z-index:1;margin-bottom:var(--cp-spacer-1)}.cp-main-menu__header--box-shadowed{box-shadow:0 0.125rem 0.25rem rgba(255, 255, 255, 0.08)}.cp-main-menu__input-container{height:2rem;width:100%;margin-top:var(--cp-spacer-3);display:flex;flex-direction:row;position:relative}.cp-main-menu__filter-input{border:var(--cp-border-width-1) solid #b3bccf;border-radius:0.25rem;width:100%;box-sizing:border-box;background-color:var(--cp-primary-contrast-dull-background-color)}[dir=\"ltr\"] .cp-main-menu__filter-input{padding:var(--cp-spacer-1) var(--cp-spacer-4) var(--cp-spacer-1) var(--cp-spacer-2)}[dir=\"rtl\"] .cp-main-menu__filter-input{padding:var(--cp-spacer-1) var(--cp-spacer-2) var(--cp-spacer-1) var(--cp-spacer-4)}.cp-main-menu__filter-input::-moz-placeholder{color:var(--cp-overlay-background);opacity:1;}.cp-main-menu__filter-input:-ms-input-placeholder{color:var(--cp-overlay-background);opacity:1;}.cp-main-menu__filter-input::placeholder{color:var(--cp-overlay-background);opacity:1;}.cp-main-menu__filter-input:hover,.cp-main-menu__filter-input:active,.cp-main-menu__filter-input:focus{border:var(--cp-border-width-1) solid var(--cp-primary-color);outline:var(--cp-primary-color);background-color:var(--cp-body-background)}.cp-main-menu__filter-input:-moz-placeholder-shown{overflow:ellipsis}.cp-main-menu__filter-input:-ms-input-placeholder{overflow:ellipsis}.cp-main-menu__filter-input:placeholder-shown{overflow:ellipsis}.cp-main-menu__logo-container{display:flex;align-items:baseline}.text-white{color:white}.cp-main-menu__search-clear-search-button{height:100%;display:inline-flex;border:none;background-color:transparent;color:#1b366f;position:absolute;cursor:pointer;padding:var(--cp-spacer-1)}[dir=\"ltr\"] .cp-main-menu__search-clear-search-button{right:var(--cp-spacer-0)}[dir=\"rtl\"] .cp-main-menu__search-clear-search-button{left:var(--cp-spacer-0)}";

/* Should *not* be a property of App because this ID is local to this
 * particular Stencil component.
 */
function navItemID(appUrl) {
  let scrubbed = appUrl.replace(/[^0-9a-zA-Z_-]/g, "_");
  return `app-nav-${scrubbed}`;
}
// https://stackoverflow.com/a/65586985/586723
function doWhenHasSize(el, todo) {
  const checkSize = () => {
    if (!el.offsetWidth && !el.offsetHeight) {
      return requestAnimationFrame(checkSize);
    }
    // If we get here, `el` has a width or height.
    todo(el);
  };
  checkSize();
}
const locale$l = getLocaleInstance();
const CpMainMenuNavWhm$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
    /**
     * Store property for personalization APIs
     */
    this._personalizationStore = "left-navigation";
    /**
     * Name property for personalization APIs
     */
    this._personalizationName = "toggle-status";
  }
  /**
   * Show clear button if search input has text in it.
   */
  get showClearSearchButton() {
    var _a;
    return ((_a = this.filterInputText) === null || _a === void 0 ? void 0 : _a.length) > 0;
  }
  watchRenderBoxShadowProp(newValue) {
    this.renderBoxShadow = newValue;
  }
  /**
   * Save category toggle status
   */
  async _propagateCategoriesState() {
    // Since category state manifests only in internals of objects
    // that Stencil holds, Stencil doesn’t see those state changes.
    // Thus, we have to redraw explicitly.
    forceUpdate(this.element);
    const data = {};
    this.categories.forEach(category => {
      data[category.group] = fromBoolean(category.storedExpanded);
    });
    await setPersonalizationData(this._securityToken, this._personalizationStore, this._personalizationName, data);
  }
  /**
   * Toggle visibility of all category lists
   */
  toggleAllCategories(expand) {
    this.categories.forEach(category => {
      category.setExpansionState(expand);
    });
    this._propagateCategoriesState();
  }
  /**
   * Toggle visibility of single category list
   */
  setCategoryExpansion(category, expand) {
    category.setExpansionState(expand);
    this._propagateCategoriesState();
  }
  /**
   * Returns a Category[] of the actual items to display
   * in the left-nav menu.
   */
  _categoriesForDisplay() {
    return this.categories.filter(category => !!category.items.length);
  }
  /**
   * Appends the Favorites category to the list
   * of categories in the left-nav menu.
   */
  _addFavoritesCategory(expanded) {
    const favoritesCategory = {
      dnsonly_ok: "dns",
      group: "favorites",
      groupdesc: "Favorites",
      items: state.favorites,
      key: "favorites",
      searchtext: "favorites",
    };
    this.unfilteredCategories.unshift(new Category(Object.assign(Object.assign({}, JSON.parse(JSON.stringify(favoritesCategory))), { storedExpanded: expanded ? toBoolean(expanded[favoritesCategory.group]) : false }), state.initialNavUrl));
  }
  _findApp(item) {
    return state.appList.find((app) => {
      if (app.key == item.key) {
        return true;
      }
      return false;
    });
  }
  /**
   * Update the favorites after a user edits them.
   *
   * @param favorites List of favorites in the set.
   */
  async updateFavorites(items) {
    // Favorites is always at the top of the list
    let favoritesCategory = this.unfilteredCategories[0];
    if (items.length > 0) {
      if (favoritesCategory.group != "favorites") {
        let expanded = await this._fetchGroupExpansionData();
        this._addFavoritesCategory(expanded);
        favoritesCategory = this.unfilteredCategories[0];
      }
    }
    else {
      if (favoritesCategory.group == "favorites") {
        this.unfilteredCategories.splice(0, 1);
      }
    }
    // Update the items.
    if (favoritesCategory.group == "favorites") {
      let apps = items.reduce((apps, item) => {
        let app = this._findApp(item);
        if (app) {
          apps.push({
            url: "/" + app.url,
            itemorder: 1,
            itemdesc: app.name,
            description: app.description,
            target: app.target,
            searchtext: app.searchText.join(" "),
            key: app.key,
          });
        }
        return apps;
      }, []);
      favoritesCategory.update(apps);
    }
    const filterText = this.filterInputText;
    if (filterText) {
      // Reapply the filters
      this.categories = this._filterApps(filterText);
    }
    else {
      // or Show all categories and items.
      this.categories = this.unfilteredCategories;
    }
    // Since we change child properties possibly.
    forceUpdate(this.element);
  }
  async componentWillLoad() {
    this.flatApplicationList = state.appList;
    this._securityToken = state.directoryPrefix;
    const expandedGroups = await this._fetchGroupExpansionData();
    this.unfilteredCategories = this._getFullCategoriesList(expandedGroups);
    this._addFavoritesCategory(expandedGroups);
    this.categories = this.unfilteredCategories;
    this.searchService = new Fuse(this.flatApplicationList, WHM_MAIN_MENU_SEARCH_OPTIONS);
  }
  /**
   * Fetch personalization data for the user
   * @returns Promise of key value pair of strings describing categories and if they are expanded. Values are perl bools ie 1 or 0
   */
  async _fetchGroupExpansionData() {
    let response;
    if (state.permissions.basicWHMFunctions) {
      response = await getPersonalizationData(this._securityToken, this._personalizationStore, this._personalizationName);
      return response[this._personalizationName].value;
    }
    return null;
  }
  /**
   * Add additional data to categories from state.
   * @param expandedGroups key value pair of strings describing categories and if they are expanded. Values are perl bools ie 1 or 0
   * @returns Categories array
   */
  _getFullCategoriesList(expandedGroups) {
    let categoryList = state.categoryList.map(rawCategory => {
      return new Category(Object.assign(Object.assign({}, JSON.parse(JSON.stringify(rawCategory))), { storedExpanded: expandedGroups ? toBoolean(expandedGroups[rawCategory.group]) : false }), state.initialNavUrl);
    });
    return this._getPlugins(categoryList);
  }
  /**
   * Remove the plugin category if none exist, otherwise add any plugins to that category
   * @param categoryList Category array
   * @returns Categories array with or without plugin category group
   */
  _getPlugins(categoryList) {
    if (!state.plugins.length) {
      return categoryList.filter(category => {
        return category.group !== PluginsCategory.KEY;
      });
    }
    else {
      const idx = categoryList.findIndex(category => {
        return category.group === PluginsCategory.KEY;
      });
      state.plugins.forEach((plugin, index) => {
        categoryList[idx].items.push({
          url: plugin.url(),
          itemorder: index,
          itemdesc: plugin.name,
          description: "",
          key: plugin.key,
          searchtext: plugin.name,
        });
      });
      return categoryList;
    }
  }
  componentDidLoad() {
    var _a, _b, _c;
    let navUrl = state.initialNavUrl;
    const filterTextFromSession = this._getFilterInputText();
    if (filterTextFromSession) {
      this.filterInputText = filterTextFromSession;
      this.categories = this._filterApps(this.filterInputText);
    }
    if (navUrl) {
      let el = (_a = this.element.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById(navItemID(navUrl));
      if (el) {
        /**
         * For some reason, when this code first runs
         * the actual nav list isn’t shown. (Confirm by calling
         * window.alert() here.) It’s unclear (?) what causes the
         * list to be rendered, so for now we poll the DOM
         * until the element has size.
         */
        doWhenHasSize(el, el => el.scrollIntoView({ behavior: "smooth", block: "center" }));
      }
    }
    this.searchInputElement = (_c = (_b = this.element) === null || _b === void 0 ? void 0 : _b.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector(".cp-main-menu__filter-input");
  }
  /**
   * Get the value of the filter input from sessionStorage.
   * This is done to keep the filter input across page navigations and across different tabs.
   * @returns string for the input text
   */
  _getFilterInputText() {
    const storageSearchTerm = sessionStorage.getItem(SessionStorage.SEARCHTERM);
    const storageUserName = sessionStorage.getItem(SessionStorage.USERNAME);
    const windowUserName = state.user;
    if (storageSearchTerm && storageUserName && storageUserName === windowUserName) {
      return storageSearchTerm;
    }
    // Most likely end up here because the user names don't match. So clear storage.
    sessionStorage.removeItem(SessionStorage.SEARCHTERM);
    sessionStorage.removeItem(SessionStorage.USERNAME);
    return "";
  }
  /**
   * The actual href value
   */
  _finalMenuHref(app) {
    return urlIsAbsolute(app.url) ? app.url : this._securityToken + app.url;
  }
  /**
   * Get the relevant elements that can be focused in the sidebar
   */
  getFocusNavigation(currentEl) {
    var _a;
    let elements = (_a = this.element.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll("a");
    if (!elements) {
      return;
    }
    let index = Array.prototype.indexOf.call(elements, currentEl), nextEl = elements[index + 1], previousEl = elements[index - 1], categories = Array.prototype.filter.call(elements, (element, _index) => {
      return _index <= index && element.getAttribute("data-type") === "category";
    }), categoryEl = categories[categories.length - 1], firstEl = elements[0], lastEl = elements[elements.length - 1];
    return {
      nextEl,
      previousEl,
      categoryEl,
      firstEl,
      lastEl,
    };
  }
  /**
   * Handle the keydown event with the commands defined
   */
  handleKeyDown(event, category) {
    const commands = {
      ArrowLeft: function () {
        if (document.dir === "rtl") {
          this.setCategoryExpansion(category, true);
          return;
        }
        this.setCategoryExpansion(category, false);
        categoryEl.focus();
      },
      ArrowRight: function () {
        if (document.dir === "rtl") {
          this.setCategoryExpansion(category, false);
          categoryEl.focus();
          return;
        }
        this.setCategoryExpansion(category, true);
      },
      ArrowUp: function () {
        if (!previousEl) {
          return;
        }
        previousEl.focus();
      },
      ArrowDown: function () {
        if (!nextEl) {
          return;
        }
        nextEl.focus();
      },
      Home: function () {
        firstEl.focus();
      },
      End: function () {
        lastEl.focus();
      },
    };
    if (!commands[event.key]) {
      return;
    }
    const currentEl = (event.target || event.srcElement);
    const { nextEl, previousEl, categoryEl, firstEl, lastEl } = this.getFocusNavigation(currentEl);
    event.preventDefault();
    commands[event.key].bind(this)();
  }
  /**
   * Focus the next category when the down arrow is pressed in either expand/collapse all button
   */
  handleButtonKeyDown(event) {
    if (event.key !== "ArrowDown") {
      return;
    }
    event.preventDefault();
    let element = (event.target || event.srcElement);
    let { firstEl } = this.getFocusNavigation(element);
    firstEl.focus();
  }
  /**
   * Handles keyboard inputs when executed while the filter input is focused.
   * Handles moving down to the list of categories and apps.
   * @param event keyboard event from the input
   */
  handleFilterKeyDown(event) {
    const currentEl = event.target;
    const { nextEl } = this.getFocusNavigation(currentEl);
    if (nextEl) {
      this.handleButtonKeyDown(event);
    }
  }
  /**
   * Handles keyboard inputs when executed while the filter input is focused.
   * Handles clearing the input.
   * @param event keyboard event from the input
   * @returns void
   */
  handleFilterKeyUp(event) {
    if (event.key === "Escape") {
      this._clearFilterInput();
      return;
    }
  }
  /**
   * Filters the categories and their apps to display based on user input.
   * @param event onInput event from the input element
   * @returns void
   */
  _handleFilterInput(event) {
    var _a;
    // Handles the case of clicking the "x" in the input provided by the browser.
    if (!event.data && !event.inputType) {
      this._clearFilterInput();
      return;
    }
    this.filterInputText = (_a = event.target) === null || _a === void 0 ? void 0 : _a.value.trim();
    const emptyString = /^\s+$/g.test(this.filterInputText);
    this.categories = this.unfilteredCategories;
    // Don't do filtering if the input is empty or just spaces
    if (!this.filterInputText || emptyString) {
      this._clearFilterInput();
      return;
    }
    // Make a list of categories with filterd app lists
    this.categories = this._filterApps(this.filterInputText);
    this._saveFilterInput(this.filterInputText);
    event.stopPropagation();
  }
  /**
   * Handles clearing the filter input.
   */
  _clearFilterInput() {
    this.filterInputText = "";
    this.categories = this.unfilteredCategories;
    this._saveFilterInput(this.filterInputText);
  }
  /**
   * Creates a new list of categories whose apps contain the input text in their searchtext key.
   * @param input filter string
   * @returns
   */
  _filterApps(input) {
    // Get the fuzzy search results.
    const result = this.searchService.search(input);
    let resultListByCategory = result.reduce((newList, resultItem) => {
      var _a;
      if (newList[resultItem.item.categoryKey]) {
        (_a = newList[resultItem.item.categoryKey]) === null || _a === void 0 ? void 0 : _a.push(resultItem.item.key);
      }
      else {
        newList[resultItem.item.categoryKey] = [resultItem.item.key];
      }
      return newList;
    }, {});
    return this.categories.reduce((newCategoryList, category) => {
      var _a;
      if (((_a = resultListByCategory[category.group]) === null || _a === void 0 ? void 0 : _a.length) > 0) {
        const filteredAppList = category.items.filter(item => {
          var _a;
          return (_a = resultListByCategory[category.group]) === null || _a === void 0 ? void 0 : _a.includes(item.key);
        });
        const categoryWithFilteredItems = new Category(Object.assign(Object.assign({}, JSON.parse(JSON.stringify(category))), {
          // Set them all to expanded
          storedExpanded: true,
          // Show filtered list of apps
          items: filteredAppList
        }), state.initialNavUrl);
        newCategoryList.push(categoryWithFilteredItems);
      }
      return newCategoryList;
    }, []);
  }
  /**
   * When a user inputs a value in the filter, save it to sessionStorage with the current user name.
   * @param input string value from the filter input
   */
  _saveFilterInput(input) {
    sessionStorage.setItem(SessionStorage.SEARCHTERM, input);
    sessionStorage.setItem(SessionStorage.USERNAME, window["COMMON"].userName);
  }
  /**
   * Expand All/Collapse All when shift+8 is pressed
   */
  toggleCategories(event) {
    if (!(event.code == "Digit8" && event.shiftKey)) {
      return;
    }
    let allCollapsed = this.categories.every(function (category) {
      return !category.shownExpanded();
    });
    this.toggleAllCategories(allCollapsed);
  }
  /**
   * Focus the filter ctrl+/ is pressed
   * @param event keyboard event
   */
  focusFilterInput(event) {
    if (event.ctrlKey && event.key === "/") {
      this.searchInputElement.focus();
    }
  }
  /**
   * Listens for mainMenuOpened event emission on body and focuses the first link in the menu.
   * @param event
   */
  async setFocus(event) {
    expandedLeftNavService.setFocus(event, this.childLogo);
  }
  /**
   * Handle clear search click event.
   */
  handleClearSearchClicked() {
    this._clearFilterInput();
    this.searchInputElement.focus();
  }
  render() {
    return (h("cp-style-reset", null, h("cp-dir", null, h("div", { class: "flex-wrapper" }, h("div", { class: this.renderBoxShadow ? "cp-main-menu__header--box-shadowed" : "cp-main-menu__header" }, h("div", { class: "cp-main-menu__logo-container" }, h("cp-logo", { ref: el => (this.childLogo = el), "logo-src": state.whmLogos.WhmWhiteLg, "logo-alt-text": this.logoAltText ? this.logoAltText : "", "logo-link-href": "/" }), isDnsOnly() && h("cp-dns-only", { class: "text-white" })), h("div", { class: "toggle-all-container" }, h("button", { "data-key": "toggle-all-open-button", class: "toggle-all-container__button", onKeyDown: e => this.handleButtonKeyDown(e), onClick: () => this.toggleAllCategories(true), title: locale$l.maketext("Expand all category lists.") }, h("span", { class: "toggle-all-container__text" }, locale$l.maketext("Expand")), h("cp-icon", { name: "arrow-down-line", size: IconSize.lg })), h("button", { "data-key": "toggle-all-close-button", class: "toggle-all-container__button", onKeyDown: e => this.handleButtonKeyDown(e), onClick: () => this.toggleAllCategories(false), title: locale$l.maketext("Collapse all category lists.") }, h("span", { class: "toggle-all-container__text" }, locale$l.maketext("Collapse")), h("cp-icon", { name: "arrow-up-line", size: IconSize.lg }))), h("div", { class: "cp-main-menu__input-container" }, h("input", { id: "main-menu-filter", class: "cp-main-menu__filter-input hide-browser-clear-button", type: "search", autocomplete: "off", spellcheck: "false", placeholder: locale$l.maketext("Search Tools (Ctrl /)[comment,placeholder text]"), title: locale$l.maketext("Search Tools (Ctrl /)[comment,placeholder text]"), "aria-label": locale$l.maketext("Search Tools (Ctrl /)[comment,placeholder text]"), value: this.filterInputText, onInput: e => this._handleFilterInput(e), onKeyDown: e => this.handleFilterKeyDown(e), onKeyUp: e => this.handleFilterKeyUp(e) }), this.showClearSearchButton && (h("button", { onClick: () => this.handleClearSearchClicked(), class: "cp-main-menu__search-clear-search-button", "aria-label": locale$l.maketext("Clear Search") }, h("cp-icon", { name: "close-line", mode: IconMode.Centered }))))), h("hr", { class: "section-separator" }), h("div", { class: "navlist-container" }, h("ul", { class: "links" }, this._categoriesForDisplay().map(category => (h("li", { class: "list-item", key: category.grouporder }, h("a", { "data-type": "category", class: "list-item__category-link", href: "javascript:void(0)", onKeyDown: e => this.handleKeyDown(e, category), onClick: () => this.setCategoryExpansion(category, !category.shownExpanded()) }, category.shownExpanded() ? (h("cp-icon", { class: "list-item__icon", name: "arrow-down-s-line", size: IconSize.xl, mode: IconMode.Inline })) : (h("cp-icon", { class: "list-item__icon", name: "arrow-right-s-line", size: IconSize.xl, mode: IconMode.Inline })), h("span", { class: "list-item__category-text" }, category.groupdesc)), category.shownExpanded() && (h("ul", { class: "list" }, category.items.map(item => (h("li", { class: "list-item" +
        (state.initialNavUrl === item.url
          ? " whm-current-tool"
          : ""), key: item.itemorder, id: navItemID(item.url) }, h("a", { onKeyDown: event => this.handleKeyDown(event, category), class: "list-item__link", href: this._finalMenuHref(item), target: item.target, "data-type": "application" }, h("span", { class: "list-item__text", innerHTML: item.itemdesc }))))))))))))))));
  }
  get element() { return this; }
  static get watchers() { return {
    "renderBoxShadow": ["watchRenderBoxShadowProp"]
  }; }
  static get style() { return cpMainMenuNavWhmCss; }
};

/*
# cpanel - ui/web-components/src/components/shared/cp-modal/cp-modal-size.ts
#                                                  Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
*/
var ModalSize;
(function (ModalSize) {
  ModalSize["default"] = "";
  ModalSize["sm"] = "cp-modal-sm";
  ModalSize["lg"] = "cp-modal-lg";
  ModalSize["xl"] = "cp-modal-xl";
})(ModalSize || (ModalSize = {}));

/**
# cpanel - ui/web-components/src/components/shared/cp-modal/cp-modal-state.ts
#                                                  Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
 */
var ModalState;
(function (ModalState) {
  ModalState["OPEN"] = "open";
  ModalState["CLOSE"] = "close";
})(ModalState || (ModalState = {}));

// Copyright 2022 cPanel, L.L.C. - All rights reserved.
class UapiServiceController {
  constructor() { }
  /**
   * Package up the api url into a full url for the current application.
   *
   * @param info [description]
   */
  packageUrl(info) {
    const appPath = new ApplicationPath(new LocationService());
    return appPath.buildTokenPath(info.url);
  }
  /**
   * Build a response handler for the request
   *
   * @param url [description]
   */
  packageResponseHandler(response, url) {
    const uapiResponse = new UapiResponse(response);
    uapiResponse.meta.properties["url"] = url ? url : "";
    return uapiResponse;
  }
  /**
   * Start an async GET request
   *
   * @param request - UapiRequest object with details of the API call.
   * @returns response object of type Promise
   */
  get(request) {
    const info = request.generate({
      verb: HttpVerb.GET,
      encoder: new WwwFormUrlArgumentEncoder(),
    });
    const url = this.packageUrl(info);
    return fetch(url, {
      method: "GET",
      headers: info.headers.toObject(),
    })
      .then(response => response.json())
      .then(response => {
      response = this.packageResponseHandler(response);
      if (response.hasErrors) {
        return Promise.reject(response.errors);
      }
      else {
        return Promise.resolve(response);
      }
    });
  }
  /**
   * Start an async POST request
   *
   * @param request - UapiRequest object with details of the API call.
   * @returns response object of type Promise
   */
  post(request) {
    const info = request.generate();
    const url = this.packageUrl(info);
    return fetch(url, {
      method: "POST",
      headers: info.headers.toObject(),
      body: info.body,
    })
      .then(response => response.json())
      .then(response => {
      response = this.packageResponseHandler(response);
      if (response.hasErrors) {
        return Promise.reject(response.errors);
      }
      else {
        return Promise.resolve(response);
      }
    });
  }
}
const UapiService = new UapiServiceController();

const cpMigrationModalCss = "@charset \"UTF-8\";:root{--cp-font-weight-semi-bold:600}:root{--bs-blue:#0d6efd;--bs-indigo:#6610f2;--bs-purple:#6f42c1;--bs-pink:#d63384;--bs-red:#dc3545;--bs-orange:#fd7e14;--bs-yellow:#ffc107;--bs-green:#198754;--bs-teal:#20c997;--bs-cyan:#0dcaf0;--bs-white:#fff;--bs-gray:#6c757d;--bs-gray-dark:#343a40;--bs-gray-100:#f8f9fa;--bs-gray-200:#e9ecef;--bs-gray-300:#dee2e6;--bs-gray-400:#ced4da;--bs-gray-500:#adb5bd;--bs-gray-600:#6c757d;--bs-gray-700:#495057;--bs-gray-800:#343a40;--bs-gray-900:#212529;--bs-primary:#0d6efd;--bs-secondary:#6c757d;--bs-success:#198754;--bs-info:#0dcaf0;--bs-warning:#ffc107;--bs-danger:#dc3545;--bs-light:#f8f9fa;--bs-dark:#212529;--bs-primary-rgb:13, 110, 253;--bs-secondary-rgb:108, 117, 125;--bs-success-rgb:25, 135, 84;--bs-info-rgb:13, 202, 240;--bs-warning-rgb:255, 193, 7;--bs-danger-rgb:220, 53, 69;--bs-light-rgb:248, 249, 250;--bs-dark-rgb:33, 37, 41;--bs-white-rgb:255, 255, 255;--bs-black-rgb:0, 0, 0;--bs-body-color-rgb:8, 25, 62;--bs-body-bg-rgb:247, 248, 250;--bs-font-sans-serif:system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, \"Noto Sans\", \"Liberation Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\";--bs-font-monospace:SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;--bs-gradient:linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));--bs-body-font-family:var(--cp-font-family-roboto);--bs-body-font-size:1rem;--bs-body-font-weight:400;--bs-body-line-height:1.5;--bs-body-color:#08193e;--bs-body-bg:#F7F8FA}:root{--cp-font-family-roboto:“Roboto”, -apple-system, BlinkMacSystemFont, “Segoe UI”, “Oxygen”, “Ubuntu”, “Cantarell”, “Fira Sans”, “Droid Sans”, “Helvetica Neue”, sans-serif;--cp-spacer-0:0;--cp-spacer-1:0.25rem;--cp-spacer-2:0.5rem;--cp-spacer-3:1rem;--cp-spacer-4:1.5rem;--cp-spacer-5:2rem;--cp-spacer-6:3rem;--cp-border-width-1:1px;--cp-border-width-2:2px;--cp-border-width-3:3px;--cp-border-width-4:4px;--cp-border-width-5:5px;--cp-small-font-size:0.875em;--cp-main-menu-width:clamp(240px, 14.8vw, 320px);--cp-header-height:60px;--cp-stat-header-height:50px;--cp-current-viewport:xs}@media (min-width: 576px){:root{--cp-current-viewport:sm}}@media (min-width: 768px){:root{--cp-current-viewport:md}}@media (min-width: 992px){:root{--cp-current-viewport:lg}}@media (min-width: 1200px){:root{--cp-current-viewport:xl}}*,*::before,*::after{box-sizing:border-box}@media (prefers-reduced-motion: no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:var(--bs-body-font-family);font-size:var(--bs-body-font-size);font-weight:var(--bs-body-font-weight);line-height:var(--bs-body-line-height);color:var(--bs-body-color);text-align:var(--bs-body-text-align);background-color:var(--bs-body-bg);-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:rgba(0, 0, 0, 0)}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:0.25}hr:not([size]){height:1px}h6,h5,h4,h3,h2,h1{margin-top:0;margin-bottom:0.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.3125rem + 0.75vw)}@media (min-width: 1200px){h1{font-size:1.875rem}}h2{font-size:calc(1.2875rem + 0.45vw)}@media (min-width: 1200px){h2{font-size:1.625rem}}h3{font-size:calc(1.275rem + 0.3vw)}@media (min-width: 1200px){h3{font-size:1.5rem}}h4{font-size:calc(1.2625rem + 0.15vw)}@media (min-width: 1200px){h4{font-size:1.375rem}}h5{font-size:1.25rem}h6{font-size:1.125rem}p{margin-top:0;margin-bottom:1rem}abbr[title],abbr[data-bs-original-title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}[dir=\"ltr\"] ol,[dir=\"ltr\"] ul{padding-left:2rem}[dir=\"rtl\"] ol,[dir=\"rtl\"] ul{padding-right:2rem}ol,ul,dl{margin-top:0;margin-bottom:1rem}ol ol,ul ul,ol ul,ul ol{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:0.5rem}[dir=\"ltr\"] dd{margin-left:0}[dir=\"rtl\"] dd{margin-right:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:0.875em}mark{padding:0.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:0.75em;line-height:0;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}pre,code,kbd,samp{font-family:var(--cp-font-monospace);font-size:1em;direction:ltr ;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:0.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:0.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:0.2rem 0.4rem;font-size:0.875em;color:#fff;background-color:#212529;border-radius:0.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:0.5rem;padding-bottom:0.5rem;color:#6c757d}[dir=\"ltr\"] caption{text-align:left}[dir=\"rtl\"] caption{text-align:right}th{text-align:inherit;text-align:-webkit-match-parent}thead,tbody,tfoot,tr,td,th{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}input,button,select,optgroup,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button:not(:disabled),[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{width:100%;padding:0;margin-bottom:0.5rem;font-size:calc(1.275rem + 0.3vw);line-height:inherit}[dir=\"ltr\"] legend{float:left}[dir=\"rtl\"] legend{float:right}@media (min-width: 1200px){legend{font-size:1.5rem}}[dir=\"ltr\"] legend+*{clear:left}[dir=\"rtl\"] legend+*{clear:right}::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-text,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}[dir=\"rtl\"] [type=\"tel\"],[dir=\"rtl\"] [type=\"url\"],[dir=\"rtl\"] [type=\"email\"],[dir=\"rtl\"] [type=\"number\"]{direction:ltr}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::-webkit-file-upload-button{font:inherit}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none !important}:root{--cp-font-weight-semi-bold:600}a{color:#4259ed;text-decoration:none}a:hover{color:#384cc9;text-decoration:underline}input{font-size:1rem}h1{font-weight:300;margin-bottom:var(--cp-spacer-4)}h2{font-weight:400;margin-bottom:var(--cp-spacer-3)}h3,h4,h5{font-weight:500;margin-bottom:var(--cp-spacer-3)}h6{font-weight:700}.cp-modal-content__container{font-weight:300;font-size:0.875rem}@media (max-width: 575.98px){.cp-modal-body{padding:0}}";

const locale$k = getLocaleInstance();
const CpMigrationModal$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
    this.migrationModalAriaLabel = locale$k.maketext("Migration modal[comment,aria label]");
    /**
     * Determines if the modal is open initially.
     */
    this.opened = false;
  }
  /**
   * Listens for the close modal event from the cp-modal component
   */
  modalDismiss() {
    this.opened = false;
  }
  /**
   * Watches for the modal opening to update the state.
   * @param newValue
   */
  openedChanged(newValue) {
    if (newValue !== true) {
      this.closeMigrationModalHandler();
    }
  }
  /**
   * Listens for the modal close event from the footer
   */
  async closeMigrationModalHandler() {
    await this.saveMigrationModalDismissal();
    this.changeModalState(ModalState.CLOSE);
  }
  componentDidRender() {
    if (this.opened === true) {
      this.changeModalState(ModalState.OPEN);
    }
  }
  /**
   * Saves the user preferences when modal is dismissed as an NVData entry.
   * NVData entry: cp-migration-panel_dismissed
   */
  async saveMigrationModalDismissal() {
    const request = new UapiRequest({
      namespace: "Personalization",
      method: "set",
      arguments: [new Argument("personalization", { "cp-migration-panel_dismissed": 1 })],
      config: {
        json: true,
      },
    });
    await UapiService.post(request)
      .then(uapiResponse => {
      if (uapiResponse.hasErrors) {
        throw uapiResponse.errors;
      }
      return uapiResponse;
    })
      .catch(errors => {
      if (!Array.isArray(errors)) {
        errors = [errors];
      }
      errors.forEach(error => console.error(`Error saving migration modal dismissal: ${error.message}`));
    });
  }
  /**
   * Opens or closes the migration modal based on the given input.
   * @param state ModalState
   */
  async changeModalState(state) {
    var _a;
    await customElements.whenDefined("cp-modal");
    const modalEl = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector("cp-modal");
    if (state === ModalState.OPEN) {
      await modalEl.open();
    }
    else {
      await modalEl.close();
    }
  }
  render() {
    return (h("cp-style-reset", null, h("cp-dir", null, h("cp-modal", { "modal-aria-label": this.migrationModalAriaLabel, "hide-title": "true", "modal-size": ModalSize.lg }, h("div", { id: "migrationModalContent", slot: "modal-content", class: "cp-modal-content__container" }, h("cp-migration-modal-body", null)), h("div", { id: "migrationModalFooter", slot: "modal-footer" }, h("cp-migration-modal-footer", null))))));
  }
  get el() { return this; }
  static get watchers() { return {
    "opened": ["openedChanged"]
  }; }
  static get style() { return cpMigrationModalCss; }
};

const cpMigrationModalBodyCss = "@charset \"UTF-8\";:root{--cp-font-weight-semi-bold:600}:root{--bs-blue:#0d6efd;--bs-indigo:#6610f2;--bs-purple:#6f42c1;--bs-pink:#d63384;--bs-red:#dc3545;--bs-orange:#fd7e14;--bs-yellow:#ffc107;--bs-green:#198754;--bs-teal:#20c997;--bs-cyan:#0dcaf0;--bs-white:#fff;--bs-gray:#6c757d;--bs-gray-dark:#343a40;--bs-gray-100:#f8f9fa;--bs-gray-200:#e9ecef;--bs-gray-300:#dee2e6;--bs-gray-400:#ced4da;--bs-gray-500:#adb5bd;--bs-gray-600:#6c757d;--bs-gray-700:#495057;--bs-gray-800:#343a40;--bs-gray-900:#212529;--bs-primary:#0d6efd;--bs-secondary:#6c757d;--bs-success:#198754;--bs-info:#0dcaf0;--bs-warning:#ffc107;--bs-danger:#dc3545;--bs-light:#f8f9fa;--bs-dark:#212529;--bs-primary-rgb:13, 110, 253;--bs-secondary-rgb:108, 117, 125;--bs-success-rgb:25, 135, 84;--bs-info-rgb:13, 202, 240;--bs-warning-rgb:255, 193, 7;--bs-danger-rgb:220, 53, 69;--bs-light-rgb:248, 249, 250;--bs-dark-rgb:33, 37, 41;--bs-white-rgb:255, 255, 255;--bs-black-rgb:0, 0, 0;--bs-body-color-rgb:8, 25, 62;--bs-body-bg-rgb:247, 248, 250;--bs-font-sans-serif:system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, \"Noto Sans\", \"Liberation Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\";--bs-font-monospace:SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;--bs-gradient:linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));--bs-body-font-family:var(--cp-font-family-roboto);--bs-body-font-size:1rem;--bs-body-font-weight:400;--bs-body-line-height:1.5;--bs-body-color:#08193e;--bs-body-bg:#F7F8FA}:root{--cp-font-family-roboto:“Roboto”, -apple-system, BlinkMacSystemFont, “Segoe UI”, “Oxygen”, “Ubuntu”, “Cantarell”, “Fira Sans”, “Droid Sans”, “Helvetica Neue”, sans-serif;--cp-spacer-0:0;--cp-spacer-1:0.25rem;--cp-spacer-2:0.5rem;--cp-spacer-3:1rem;--cp-spacer-4:1.5rem;--cp-spacer-5:2rem;--cp-spacer-6:3rem;--cp-border-width-1:1px;--cp-border-width-2:2px;--cp-border-width-3:3px;--cp-border-width-4:4px;--cp-border-width-5:5px;--cp-small-font-size:0.875em;--cp-main-menu-width:clamp(240px, 14.8vw, 320px);--cp-header-height:60px;--cp-stat-header-height:50px;--cp-current-viewport:xs}@media (min-width: 576px){:root{--cp-current-viewport:sm}}@media (min-width: 768px){:root{--cp-current-viewport:md}}@media (min-width: 992px){:root{--cp-current-viewport:lg}}@media (min-width: 1200px){:root{--cp-current-viewport:xl}}*,*::before,*::after{box-sizing:border-box}@media (prefers-reduced-motion: no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:var(--bs-body-font-family);font-size:var(--bs-body-font-size);font-weight:var(--bs-body-font-weight);line-height:var(--bs-body-line-height);color:var(--bs-body-color);text-align:var(--bs-body-text-align);background-color:var(--bs-body-bg);-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:rgba(0, 0, 0, 0)}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:0.25}hr:not([size]){height:1px}h6,h5,h4,h3,h2,h1,.cp-migration-modal__content-title{margin-top:0;margin-bottom:0.5rem;font-weight:500;line-height:1.2}h1,.cp-migration-modal__content-title{font-size:calc(1.3125rem + 0.75vw)}@media (min-width: 1200px){h1,.cp-migration-modal__content-title{font-size:1.875rem}}h2{font-size:calc(1.2875rem + 0.45vw)}@media (min-width: 1200px){h2{font-size:1.625rem}}h3{font-size:calc(1.275rem + 0.3vw)}@media (min-width: 1200px){h3{font-size:1.5rem}}h4{font-size:calc(1.2625rem + 0.15vw)}@media (min-width: 1200px){h4{font-size:1.375rem}}h5{font-size:1.25rem}h6{font-size:1.125rem}p{margin-top:0;margin-bottom:1rem}abbr[title],abbr[data-bs-original-title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}[dir=\"ltr\"] ol,[dir=\"ltr\"] ul{padding-left:2rem}[dir=\"rtl\"] ol,[dir=\"rtl\"] ul{padding-right:2rem}ol,ul,dl{margin-top:0;margin-bottom:1rem}ol ol,ul ul,ol ul,ul ol{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:0.5rem}[dir=\"ltr\"] dd{margin-left:0}[dir=\"rtl\"] dd{margin-right:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:0.875em}mark{padding:0.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:0.75em;line-height:0;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}pre,code,kbd,samp{font-family:var(--cp-font-monospace);font-size:1em;direction:ltr ;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:0.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:0.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:0.2rem 0.4rem;font-size:0.875em;color:#fff;background-color:#212529;border-radius:0.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:0.5rem;padding-bottom:0.5rem;color:#6c757d}[dir=\"ltr\"] caption{text-align:left}[dir=\"rtl\"] caption{text-align:right}th{text-align:inherit;text-align:-webkit-match-parent}thead,tbody,tfoot,tr,td,th{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}input,button,select,optgroup,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button:not(:disabled),[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{width:100%;padding:0;margin-bottom:0.5rem;font-size:calc(1.275rem + 0.3vw);line-height:inherit}[dir=\"ltr\"] legend{float:left}[dir=\"rtl\"] legend{float:right}@media (min-width: 1200px){legend{font-size:1.5rem}}[dir=\"ltr\"] legend+*{clear:left}[dir=\"rtl\"] legend+*{clear:right}::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-text,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}[dir=\"rtl\"] [type=\"tel\"],[dir=\"rtl\"] [type=\"url\"],[dir=\"rtl\"] [type=\"email\"],[dir=\"rtl\"] [type=\"number\"]{direction:ltr}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::-webkit-file-upload-button{font:inherit}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none !important}:root{--cp-font-weight-semi-bold:600}a{color:#4259ed;text-decoration:none}a:hover{color:#384cc9;text-decoration:underline}input{font-size:1rem}h1,.cp-migration-modal__content-title{font-weight:300;margin-bottom:var(--cp-spacer-4)}h2{font-weight:400;margin-bottom:var(--cp-spacer-3)}h3,h4,h5{font-weight:500;margin-bottom:var(--cp-spacer-3)}h6{font-weight:700}.container,.container-fluid,.container-xxl,.container-xl,.container-lg,.container-md,.container-sm{width:100%;padding-right:var(--bs-gutter-x, 0.75rem);padding-left:var(--bs-gutter-x, 0.75rem);margin-right:auto;margin-left:auto}@media (min-width: 576px){.container-sm,.container{max-width:540px}}@media (min-width: 768px){.container-md,.container-sm,.container{max-width:720px}}@media (min-width: 992px){.container-lg,.container-md,.container-sm,.container{max-width:960px}}@media (min-width: 1200px){.container-xl,.container-lg,.container-md,.container-sm,.container{max-width:1140px}}@media (min-width: 1400px){.container-xxl,.container-xl,.container-lg,.container-md,.container-sm,.container{max-width:1320px}}.row{--bs-gutter-x:1.5rem;--bs-gutter-y:0;display:flex;flex-wrap:wrap;margin-top:calc(-1 * var(--bs-gutter-y));margin-right:calc(-0.5 * var(--bs-gutter-x));margin-left:calc(-0.5 * var(--bs-gutter-x))}.row>*{flex-shrink:0;width:100%;max-width:100%;padding-right:calc(var(--bs-gutter-x) * 0.5);padding-left:calc(var(--bs-gutter-x) * 0.5);margin-top:var(--bs-gutter-y)}.col{flex:1 0 0%}.row-cols-auto>*{flex:0 0 auto;width:auto}.row-cols-1>*{flex:0 0 auto;width:100%}.row-cols-2>*{flex:0 0 auto;width:50%}.row-cols-3>*{flex:0 0 auto;width:33.3333333333%}.row-cols-4>*{flex:0 0 auto;width:25%}.row-cols-5>*{flex:0 0 auto;width:20%}.row-cols-6>*{flex:0 0 auto;width:16.6666666667%}.col-auto{flex:0 0 auto;width:auto}.col-1{flex:0 0 auto;width:8.33333333%}.col-2{flex:0 0 auto;width:16.66666667%}.col-3{flex:0 0 auto;width:25%}.col-4{flex:0 0 auto;width:33.33333333%}.col-5{flex:0 0 auto;width:41.66666667%}.col-6{flex:0 0 auto;width:50%}.col-7{flex:0 0 auto;width:58.33333333%}.col-8{flex:0 0 auto;width:66.66666667%}.col-9{flex:0 0 auto;width:75%}.col-10{flex:0 0 auto;width:83.33333333%}.col-11{flex:0 0 auto;width:91.66666667%}.col-12{flex:0 0 auto;width:100%}[dir=\"ltr\"] .offset-1{margin-left:8.33333333%}[dir=\"rtl\"] .offset-1{margin-right:8.33333333%}[dir=\"ltr\"] .offset-2{margin-left:16.66666667%}[dir=\"rtl\"] .offset-2{margin-right:16.66666667%}[dir=\"ltr\"] .offset-3{margin-left:25%}[dir=\"rtl\"] .offset-3{margin-right:25%}[dir=\"ltr\"] .offset-4{margin-left:33.33333333%}[dir=\"rtl\"] .offset-4{margin-right:33.33333333%}[dir=\"ltr\"] .offset-5{margin-left:41.66666667%}[dir=\"rtl\"] .offset-5{margin-right:41.66666667%}[dir=\"ltr\"] .offset-6{margin-left:50%}[dir=\"rtl\"] .offset-6{margin-right:50%}[dir=\"ltr\"] .offset-7{margin-left:58.33333333%}[dir=\"rtl\"] .offset-7{margin-right:58.33333333%}[dir=\"ltr\"] .offset-8{margin-left:66.66666667%}[dir=\"rtl\"] .offset-8{margin-right:66.66666667%}[dir=\"ltr\"] .offset-9{margin-left:75%}[dir=\"rtl\"] .offset-9{margin-right:75%}[dir=\"ltr\"] .offset-10{margin-left:83.33333333%}[dir=\"rtl\"] .offset-10{margin-right:83.33333333%}[dir=\"ltr\"] .offset-11{margin-left:91.66666667%}[dir=\"rtl\"] .offset-11{margin-right:91.66666667%}.g-0,.gx-0{--bs-gutter-x:0}.g-0,.gy-0{--bs-gutter-y:0}.g-1,.gx-1{--bs-gutter-x:0.25rem}.g-1,.gy-1{--bs-gutter-y:0.25rem}.g-2,.gx-2{--bs-gutter-x:0.5rem}.g-2,.gy-2{--bs-gutter-y:0.5rem}.g-3,.gx-3{--bs-gutter-x:1rem}.g-3,.gy-3{--bs-gutter-y:1rem}.g-4,.gx-4{--bs-gutter-x:1.5rem}.g-4,.gy-4{--bs-gutter-y:1.5rem}.g-5,.gx-5{--bs-gutter-x:2rem}.g-5,.gy-5{--bs-gutter-y:2rem}.g-6,.gx-6{--bs-gutter-x:3rem}.g-6,.gy-6{--bs-gutter-y:3rem}@media (min-width: 576px){.col-sm{flex:1 0 0%}.row-cols-sm-auto>*{flex:0 0 auto;width:auto}.row-cols-sm-1>*{flex:0 0 auto;width:100%}.row-cols-sm-2>*{flex:0 0 auto;width:50%}.row-cols-sm-3>*{flex:0 0 auto;width:33.3333333333%}.row-cols-sm-4>*{flex:0 0 auto;width:25%}.row-cols-sm-5>*{flex:0 0 auto;width:20%}.row-cols-sm-6>*{flex:0 0 auto;width:16.6666666667%}.col-sm-auto{flex:0 0 auto;width:auto}.col-sm-1{flex:0 0 auto;width:8.33333333%}.col-sm-2{flex:0 0 auto;width:16.66666667%}.col-sm-3{flex:0 0 auto;width:25%}.col-sm-4{flex:0 0 auto;width:33.33333333%}.col-sm-5{flex:0 0 auto;width:41.66666667%}.col-sm-6{flex:0 0 auto;width:50%}.col-sm-7{flex:0 0 auto;width:58.33333333%}.col-sm-8{flex:0 0 auto;width:66.66666667%}.col-sm-9{flex:0 0 auto;width:75%}.col-sm-10{flex:0 0 auto;width:83.33333333%}.col-sm-11{flex:0 0 auto;width:91.66666667%}.col-sm-12{flex:0 0 auto;width:100%}[dir=\"ltr\"] .offset-sm-0{margin-left:0}[dir=\"rtl\"] .offset-sm-0{margin-right:0}[dir=\"ltr\"] .offset-sm-1{margin-left:8.33333333%}[dir=\"rtl\"] .offset-sm-1{margin-right:8.33333333%}[dir=\"ltr\"] .offset-sm-2{margin-left:16.66666667%}[dir=\"rtl\"] .offset-sm-2{margin-right:16.66666667%}[dir=\"ltr\"] .offset-sm-3{margin-left:25%}[dir=\"rtl\"] .offset-sm-3{margin-right:25%}[dir=\"ltr\"] .offset-sm-4{margin-left:33.33333333%}[dir=\"rtl\"] .offset-sm-4{margin-right:33.33333333%}[dir=\"ltr\"] .offset-sm-5{margin-left:41.66666667%}[dir=\"rtl\"] .offset-sm-5{margin-right:41.66666667%}[dir=\"ltr\"] .offset-sm-6{margin-left:50%}[dir=\"rtl\"] .offset-sm-6{margin-right:50%}[dir=\"ltr\"] .offset-sm-7{margin-left:58.33333333%}[dir=\"rtl\"] .offset-sm-7{margin-right:58.33333333%}[dir=\"ltr\"] .offset-sm-8{margin-left:66.66666667%}[dir=\"rtl\"] .offset-sm-8{margin-right:66.66666667%}[dir=\"ltr\"] .offset-sm-9{margin-left:75%}[dir=\"rtl\"] .offset-sm-9{margin-right:75%}[dir=\"ltr\"] .offset-sm-10{margin-left:83.33333333%}[dir=\"rtl\"] .offset-sm-10{margin-right:83.33333333%}[dir=\"ltr\"] .offset-sm-11{margin-left:91.66666667%}[dir=\"rtl\"] .offset-sm-11{margin-right:91.66666667%}.g-sm-0,.gx-sm-0{--bs-gutter-x:0}.g-sm-0,.gy-sm-0{--bs-gutter-y:0}.g-sm-1,.gx-sm-1{--bs-gutter-x:0.25rem}.g-sm-1,.gy-sm-1{--bs-gutter-y:0.25rem}.g-sm-2,.gx-sm-2{--bs-gutter-x:0.5rem}.g-sm-2,.gy-sm-2{--bs-gutter-y:0.5rem}.g-sm-3,.gx-sm-3{--bs-gutter-x:1rem}.g-sm-3,.gy-sm-3{--bs-gutter-y:1rem}.g-sm-4,.gx-sm-4{--bs-gutter-x:1.5rem}.g-sm-4,.gy-sm-4{--bs-gutter-y:1.5rem}.g-sm-5,.gx-sm-5{--bs-gutter-x:2rem}.g-sm-5,.gy-sm-5{--bs-gutter-y:2rem}.g-sm-6,.gx-sm-6{--bs-gutter-x:3rem}.g-sm-6,.gy-sm-6{--bs-gutter-y:3rem}}@media (min-width: 768px){.col-md{flex:1 0 0%}.row-cols-md-auto>*{flex:0 0 auto;width:auto}.row-cols-md-1>*{flex:0 0 auto;width:100%}.row-cols-md-2>*{flex:0 0 auto;width:50%}.row-cols-md-3>*{flex:0 0 auto;width:33.3333333333%}.row-cols-md-4>*{flex:0 0 auto;width:25%}.row-cols-md-5>*{flex:0 0 auto;width:20%}.row-cols-md-6>*{flex:0 0 auto;width:16.6666666667%}.col-md-auto{flex:0 0 auto;width:auto}.col-md-1{flex:0 0 auto;width:8.33333333%}.col-md-2{flex:0 0 auto;width:16.66666667%}.col-md-3{flex:0 0 auto;width:25%}.col-md-4{flex:0 0 auto;width:33.33333333%}.col-md-5{flex:0 0 auto;width:41.66666667%}.col-md-6{flex:0 0 auto;width:50%}.col-md-7{flex:0 0 auto;width:58.33333333%}.col-md-8{flex:0 0 auto;width:66.66666667%}.col-md-9{flex:0 0 auto;width:75%}.col-md-10{flex:0 0 auto;width:83.33333333%}.col-md-11{flex:0 0 auto;width:91.66666667%}.col-md-12{flex:0 0 auto;width:100%}[dir=\"ltr\"] .offset-md-0{margin-left:0}[dir=\"rtl\"] .offset-md-0{margin-right:0}[dir=\"ltr\"] .offset-md-1{margin-left:8.33333333%}[dir=\"rtl\"] .offset-md-1{margin-right:8.33333333%}[dir=\"ltr\"] .offset-md-2{margin-left:16.66666667%}[dir=\"rtl\"] .offset-md-2{margin-right:16.66666667%}[dir=\"ltr\"] .offset-md-3{margin-left:25%}[dir=\"rtl\"] .offset-md-3{margin-right:25%}[dir=\"ltr\"] .offset-md-4{margin-left:33.33333333%}[dir=\"rtl\"] .offset-md-4{margin-right:33.33333333%}[dir=\"ltr\"] .offset-md-5{margin-left:41.66666667%}[dir=\"rtl\"] .offset-md-5{margin-right:41.66666667%}[dir=\"ltr\"] .offset-md-6{margin-left:50%}[dir=\"rtl\"] .offset-md-6{margin-right:50%}[dir=\"ltr\"] .offset-md-7{margin-left:58.33333333%}[dir=\"rtl\"] .offset-md-7{margin-right:58.33333333%}[dir=\"ltr\"] .offset-md-8{margin-left:66.66666667%}[dir=\"rtl\"] .offset-md-8{margin-right:66.66666667%}[dir=\"ltr\"] .offset-md-9{margin-left:75%}[dir=\"rtl\"] .offset-md-9{margin-right:75%}[dir=\"ltr\"] .offset-md-10{margin-left:83.33333333%}[dir=\"rtl\"] .offset-md-10{margin-right:83.33333333%}[dir=\"ltr\"] .offset-md-11{margin-left:91.66666667%}[dir=\"rtl\"] .offset-md-11{margin-right:91.66666667%}.g-md-0,.gx-md-0{--bs-gutter-x:0}.g-md-0,.gy-md-0{--bs-gutter-y:0}.g-md-1,.gx-md-1{--bs-gutter-x:0.25rem}.g-md-1,.gy-md-1{--bs-gutter-y:0.25rem}.g-md-2,.gx-md-2{--bs-gutter-x:0.5rem}.g-md-2,.gy-md-2{--bs-gutter-y:0.5rem}.g-md-3,.gx-md-3{--bs-gutter-x:1rem}.g-md-3,.gy-md-3{--bs-gutter-y:1rem}.g-md-4,.gx-md-4{--bs-gutter-x:1.5rem}.g-md-4,.gy-md-4{--bs-gutter-y:1.5rem}.g-md-5,.gx-md-5{--bs-gutter-x:2rem}.g-md-5,.gy-md-5{--bs-gutter-y:2rem}.g-md-6,.gx-md-6{--bs-gutter-x:3rem}.g-md-6,.gy-md-6{--bs-gutter-y:3rem}}@media (min-width: 992px){.col-lg{flex:1 0 0%}.row-cols-lg-auto>*{flex:0 0 auto;width:auto}.row-cols-lg-1>*{flex:0 0 auto;width:100%}.row-cols-lg-2>*{flex:0 0 auto;width:50%}.row-cols-lg-3>*{flex:0 0 auto;width:33.3333333333%}.row-cols-lg-4>*{flex:0 0 auto;width:25%}.row-cols-lg-5>*{flex:0 0 auto;width:20%}.row-cols-lg-6>*{flex:0 0 auto;width:16.6666666667%}.col-lg-auto{flex:0 0 auto;width:auto}.col-lg-1{flex:0 0 auto;width:8.33333333%}.col-lg-2{flex:0 0 auto;width:16.66666667%}.col-lg-3{flex:0 0 auto;width:25%}.col-lg-4{flex:0 0 auto;width:33.33333333%}.col-lg-5{flex:0 0 auto;width:41.66666667%}.col-lg-6{flex:0 0 auto;width:50%}.col-lg-7{flex:0 0 auto;width:58.33333333%}.col-lg-8{flex:0 0 auto;width:66.66666667%}.col-lg-9{flex:0 0 auto;width:75%}.col-lg-10{flex:0 0 auto;width:83.33333333%}.col-lg-11{flex:0 0 auto;width:91.66666667%}.col-lg-12{flex:0 0 auto;width:100%}[dir=\"ltr\"] .offset-lg-0{margin-left:0}[dir=\"rtl\"] .offset-lg-0{margin-right:0}[dir=\"ltr\"] .offset-lg-1{margin-left:8.33333333%}[dir=\"rtl\"] .offset-lg-1{margin-right:8.33333333%}[dir=\"ltr\"] .offset-lg-2{margin-left:16.66666667%}[dir=\"rtl\"] .offset-lg-2{margin-right:16.66666667%}[dir=\"ltr\"] .offset-lg-3{margin-left:25%}[dir=\"rtl\"] .offset-lg-3{margin-right:25%}[dir=\"ltr\"] .offset-lg-4{margin-left:33.33333333%}[dir=\"rtl\"] .offset-lg-4{margin-right:33.33333333%}[dir=\"ltr\"] .offset-lg-5{margin-left:41.66666667%}[dir=\"rtl\"] .offset-lg-5{margin-right:41.66666667%}[dir=\"ltr\"] .offset-lg-6{margin-left:50%}[dir=\"rtl\"] .offset-lg-6{margin-right:50%}[dir=\"ltr\"] .offset-lg-7{margin-left:58.33333333%}[dir=\"rtl\"] .offset-lg-7{margin-right:58.33333333%}[dir=\"ltr\"] .offset-lg-8{margin-left:66.66666667%}[dir=\"rtl\"] .offset-lg-8{margin-right:66.66666667%}[dir=\"ltr\"] .offset-lg-9{margin-left:75%}[dir=\"rtl\"] .offset-lg-9{margin-right:75%}[dir=\"ltr\"] .offset-lg-10{margin-left:83.33333333%}[dir=\"rtl\"] .offset-lg-10{margin-right:83.33333333%}[dir=\"ltr\"] .offset-lg-11{margin-left:91.66666667%}[dir=\"rtl\"] .offset-lg-11{margin-right:91.66666667%}.g-lg-0,.gx-lg-0{--bs-gutter-x:0}.g-lg-0,.gy-lg-0{--bs-gutter-y:0}.g-lg-1,.gx-lg-1{--bs-gutter-x:0.25rem}.g-lg-1,.gy-lg-1{--bs-gutter-y:0.25rem}.g-lg-2,.gx-lg-2{--bs-gutter-x:0.5rem}.g-lg-2,.gy-lg-2{--bs-gutter-y:0.5rem}.g-lg-3,.gx-lg-3{--bs-gutter-x:1rem}.g-lg-3,.gy-lg-3{--bs-gutter-y:1rem}.g-lg-4,.gx-lg-4{--bs-gutter-x:1.5rem}.g-lg-4,.gy-lg-4{--bs-gutter-y:1.5rem}.g-lg-5,.gx-lg-5{--bs-gutter-x:2rem}.g-lg-5,.gy-lg-5{--bs-gutter-y:2rem}.g-lg-6,.gx-lg-6{--bs-gutter-x:3rem}.g-lg-6,.gy-lg-6{--bs-gutter-y:3rem}}@media (min-width: 1200px){.col-xl{flex:1 0 0%}.row-cols-xl-auto>*{flex:0 0 auto;width:auto}.row-cols-xl-1>*{flex:0 0 auto;width:100%}.row-cols-xl-2>*{flex:0 0 auto;width:50%}.row-cols-xl-3>*{flex:0 0 auto;width:33.3333333333%}.row-cols-xl-4>*{flex:0 0 auto;width:25%}.row-cols-xl-5>*{flex:0 0 auto;width:20%}.row-cols-xl-6>*{flex:0 0 auto;width:16.6666666667%}.col-xl-auto{flex:0 0 auto;width:auto}.col-xl-1{flex:0 0 auto;width:8.33333333%}.col-xl-2{flex:0 0 auto;width:16.66666667%}.col-xl-3{flex:0 0 auto;width:25%}.col-xl-4{flex:0 0 auto;width:33.33333333%}.col-xl-5{flex:0 0 auto;width:41.66666667%}.col-xl-6{flex:0 0 auto;width:50%}.col-xl-7{flex:0 0 auto;width:58.33333333%}.col-xl-8{flex:0 0 auto;width:66.66666667%}.col-xl-9{flex:0 0 auto;width:75%}.col-xl-10{flex:0 0 auto;width:83.33333333%}.col-xl-11{flex:0 0 auto;width:91.66666667%}.col-xl-12{flex:0 0 auto;width:100%}[dir=\"ltr\"] .offset-xl-0{margin-left:0}[dir=\"rtl\"] .offset-xl-0{margin-right:0}[dir=\"ltr\"] .offset-xl-1{margin-left:8.33333333%}[dir=\"rtl\"] .offset-xl-1{margin-right:8.33333333%}[dir=\"ltr\"] .offset-xl-2{margin-left:16.66666667%}[dir=\"rtl\"] .offset-xl-2{margin-right:16.66666667%}[dir=\"ltr\"] .offset-xl-3{margin-left:25%}[dir=\"rtl\"] .offset-xl-3{margin-right:25%}[dir=\"ltr\"] .offset-xl-4{margin-left:33.33333333%}[dir=\"rtl\"] .offset-xl-4{margin-right:33.33333333%}[dir=\"ltr\"] .offset-xl-5{margin-left:41.66666667%}[dir=\"rtl\"] .offset-xl-5{margin-right:41.66666667%}[dir=\"ltr\"] .offset-xl-6{margin-left:50%}[dir=\"rtl\"] .offset-xl-6{margin-right:50%}[dir=\"ltr\"] .offset-xl-7{margin-left:58.33333333%}[dir=\"rtl\"] .offset-xl-7{margin-right:58.33333333%}[dir=\"ltr\"] .offset-xl-8{margin-left:66.66666667%}[dir=\"rtl\"] .offset-xl-8{margin-right:66.66666667%}[dir=\"ltr\"] .offset-xl-9{margin-left:75%}[dir=\"rtl\"] .offset-xl-9{margin-right:75%}[dir=\"ltr\"] .offset-xl-10{margin-left:83.33333333%}[dir=\"rtl\"] .offset-xl-10{margin-right:83.33333333%}[dir=\"ltr\"] .offset-xl-11{margin-left:91.66666667%}[dir=\"rtl\"] .offset-xl-11{margin-right:91.66666667%}.g-xl-0,.gx-xl-0{--bs-gutter-x:0}.g-xl-0,.gy-xl-0{--bs-gutter-y:0}.g-xl-1,.gx-xl-1{--bs-gutter-x:0.25rem}.g-xl-1,.gy-xl-1{--bs-gutter-y:0.25rem}.g-xl-2,.gx-xl-2{--bs-gutter-x:0.5rem}.g-xl-2,.gy-xl-2{--bs-gutter-y:0.5rem}.g-xl-3,.gx-xl-3{--bs-gutter-x:1rem}.g-xl-3,.gy-xl-3{--bs-gutter-y:1rem}.g-xl-4,.gx-xl-4{--bs-gutter-x:1.5rem}.g-xl-4,.gy-xl-4{--bs-gutter-y:1.5rem}.g-xl-5,.gx-xl-5{--bs-gutter-x:2rem}.g-xl-5,.gy-xl-5{--bs-gutter-y:2rem}.g-xl-6,.gx-xl-6{--bs-gutter-x:3rem}.g-xl-6,.gy-xl-6{--bs-gutter-y:3rem}}@media (min-width: 1400px){.col-xxl{flex:1 0 0%}.row-cols-xxl-auto>*{flex:0 0 auto;width:auto}.row-cols-xxl-1>*{flex:0 0 auto;width:100%}.row-cols-xxl-2>*{flex:0 0 auto;width:50%}.row-cols-xxl-3>*{flex:0 0 auto;width:33.3333333333%}.row-cols-xxl-4>*{flex:0 0 auto;width:25%}.row-cols-xxl-5>*{flex:0 0 auto;width:20%}.row-cols-xxl-6>*{flex:0 0 auto;width:16.6666666667%}.col-xxl-auto{flex:0 0 auto;width:auto}.col-xxl-1{flex:0 0 auto;width:8.33333333%}.col-xxl-2{flex:0 0 auto;width:16.66666667%}.col-xxl-3{flex:0 0 auto;width:25%}.col-xxl-4{flex:0 0 auto;width:33.33333333%}.col-xxl-5{flex:0 0 auto;width:41.66666667%}.col-xxl-6{flex:0 0 auto;width:50%}.col-xxl-7{flex:0 0 auto;width:58.33333333%}.col-xxl-8{flex:0 0 auto;width:66.66666667%}.col-xxl-9{flex:0 0 auto;width:75%}.col-xxl-10{flex:0 0 auto;width:83.33333333%}.col-xxl-11{flex:0 0 auto;width:91.66666667%}.col-xxl-12{flex:0 0 auto;width:100%}[dir=\"ltr\"] .offset-xxl-0{margin-left:0}[dir=\"rtl\"] .offset-xxl-0{margin-right:0}[dir=\"ltr\"] .offset-xxl-1{margin-left:8.33333333%}[dir=\"rtl\"] .offset-xxl-1{margin-right:8.33333333%}[dir=\"ltr\"] .offset-xxl-2{margin-left:16.66666667%}[dir=\"rtl\"] .offset-xxl-2{margin-right:16.66666667%}[dir=\"ltr\"] .offset-xxl-3{margin-left:25%}[dir=\"rtl\"] .offset-xxl-3{margin-right:25%}[dir=\"ltr\"] .offset-xxl-4{margin-left:33.33333333%}[dir=\"rtl\"] .offset-xxl-4{margin-right:33.33333333%}[dir=\"ltr\"] .offset-xxl-5{margin-left:41.66666667%}[dir=\"rtl\"] .offset-xxl-5{margin-right:41.66666667%}[dir=\"ltr\"] .offset-xxl-6{margin-left:50%}[dir=\"rtl\"] .offset-xxl-6{margin-right:50%}[dir=\"ltr\"] .offset-xxl-7{margin-left:58.33333333%}[dir=\"rtl\"] .offset-xxl-7{margin-right:58.33333333%}[dir=\"ltr\"] .offset-xxl-8{margin-left:66.66666667%}[dir=\"rtl\"] .offset-xxl-8{margin-right:66.66666667%}[dir=\"ltr\"] .offset-xxl-9{margin-left:75%}[dir=\"rtl\"] .offset-xxl-9{margin-right:75%}[dir=\"ltr\"] .offset-xxl-10{margin-left:83.33333333%}[dir=\"rtl\"] .offset-xxl-10{margin-right:83.33333333%}[dir=\"ltr\"] .offset-xxl-11{margin-left:91.66666667%}[dir=\"rtl\"] .offset-xxl-11{margin-right:91.66666667%}.g-xxl-0,.gx-xxl-0{--bs-gutter-x:0}.g-xxl-0,.gy-xxl-0{--bs-gutter-y:0}.g-xxl-1,.gx-xxl-1{--bs-gutter-x:0.25rem}.g-xxl-1,.gy-xxl-1{--bs-gutter-y:0.25rem}.g-xxl-2,.gx-xxl-2{--bs-gutter-x:0.5rem}.g-xxl-2,.gy-xxl-2{--bs-gutter-y:0.5rem}.g-xxl-3,.gx-xxl-3{--bs-gutter-x:1rem}.g-xxl-3,.gy-xxl-3{--bs-gutter-y:1rem}.g-xxl-4,.gx-xxl-4{--bs-gutter-x:1.5rem}.g-xxl-4,.gy-xxl-4{--bs-gutter-y:1.5rem}.g-xxl-5,.gx-xxl-5{--bs-gutter-x:2rem}.g-xxl-5,.gy-xxl-5{--bs-gutter-y:2rem}.g-xxl-6,.gx-xxl-6{--bs-gutter-x:3rem}.g-xxl-6,.gy-xxl-6{--bs-gutter-y:3rem}}:root{--cp-font-weight-semi-bold:600}.cp-card{box-shadow:0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);transition:all 0.15s ease-in;height:100%;display:flex;flex-direction:column;justify-content:space-between;background:#ffffff;color:#08193e;border-radius:0.2rem}.cp-card:active,.cp-card:focus,.cp-card:hover{box-shadow:0 0.5rem 1rem rgba(0, 0, 0, 0.15)}.cp-card__body{padding:var(--cp-spacer-4)}.cp-card__title{display:block;font-size:1.375rem;font-weight:500;margin-bottom:var(--cp-spacer-3)}.cp-card__description{font-weight:300;font-size:0.875rem;margin-bottom:var(--cp-spacer-0)}.cp-card__image-wrapper{width:100%;max-width:250px;margin-bottom:var(--cp-spacer-3);position:relative;padding-top:66.6666666667%;background:#F7F8FA;animation:placeholder-shimmer 1.4s linear infinite forwards}[dir=\"ltr\"] .cp-card__image-wrapper{background:linear-gradient(to right, #ffffff 10%, #F7F8FA 40%, #ffffff 50%)}[dir=\"rtl\"] .cp-card__image-wrapper{background:linear-gradient(to left, #ffffff 10%, #F7F8FA 40%, #ffffff 50%)}[dir] .cp-card__image-wrapper{background-size:1500px 800px}.cp-card__image-wrapper img,.cp-card__image-wrapper svg,.cp-card__image-wrapper video,.cp-card__image-wrapper iframe,.cp-card__image-wrapper object,.cp-card__image-wrapper embed{width:100%;height:100%;position:absolute;top:0}[dir=\"ltr\"] .cp-card__image-wrapper img,[dir=\"ltr\"] .cp-card__image-wrapper svg,[dir=\"ltr\"] .cp-card__image-wrapper video,[dir=\"ltr\"] .cp-card__image-wrapper iframe,[dir=\"ltr\"] .cp-card__image-wrapper object,[dir=\"ltr\"] .cp-card__image-wrapper embed{left:0}[dir=\"rtl\"] .cp-card__image-wrapper img,[dir=\"rtl\"] .cp-card__image-wrapper svg,[dir=\"rtl\"] .cp-card__image-wrapper video,[dir=\"rtl\"] .cp-card__image-wrapper iframe,[dir=\"rtl\"] .cp-card__image-wrapper object,[dir=\"rtl\"] .cp-card__image-wrapper embed{right:0}@keyframes placeholder-shimmer{0%{background-position:-500px 0}100%{background-position:500px 0}}.cp-card__header{font-size:1.25rem;font-weight:500;padding:var(--cp-spacer-4);padding-bottom:0}.cp-card__header-icon{vertical-align:middle}[dir=\"ltr\"] .cp-card__header-icon{margin-right:var(--cp-spacer-2)}[dir=\"rtl\"] .cp-card__header-icon{margin-left:var(--cp-spacer-2)}.cp-card__header-text{vertical-align:middle}.cp-card__footer{border-top:var(--cp-border-width-1) solid #e6e9ef;padding:var(--cp-spacer-3)}.cp-card__footer--no-divider{padding-top:0;border-top:none}.cp-card--condensed .cp-card__body{padding:var(--cp-spacer-3) var(--cp-spacer-4)}.cp-migration-modal__content{margin-left:auto;margin-right:auto;max-width:85%}.cp-migration-modal__content-img-wrapper{width:100%;margin-bottom:var(--cp-spacer-4);position:relative;padding-top:28%}.cp-migration-modal__content-img-wrapper svg{height:100%;width:100%;position:absolute;margin-left:auto;margin-right:auto;left:0;right:0;top:0;text-align:center}.cp-migration-modal__content-title{color:#08193e;text-align:center;margin-bottom:var(--cp-spacer-1)}.cp-migration-modal__content-text{margin-bottom:var(--cp-spacer-4);padding:0 var(--cp-spacer-3)}.cp-migration-modal__content-row{justify-content:center}.cp-card__body{padding:var(--cp-spacer-5) var(--cp-spacer-3) var(--cp-spacer-3) var(--cp-spacer-3);position:relative}.cp-card__icon{display:block;margin-left:auto;margin-right:auto;width:48px;height:48px}.cp-card__title{font-size:1.125rem;margin-bottom:var(--cp-spacer-2);text-align:center;font-weight:400}.cp-card__description{font-size:0.75rem;text-align:center}@media (max-width: 991.98px){.cp-card__icon{align-self:center;margin:0 var(--cp-spacer-3)}.cp-card__body{padding:var(--cp-spacer-2);display:flex;justify-content:space-around}[dir=\"ltr\"] .cp-card__description,[dir=\"ltr\"] .cp-card__title{text-align:left}[dir=\"rtl\"] .cp-card__description,[dir=\"rtl\"] .cp-card__title{text-align:right}.cp-card__text-container{flex-grow:2}}@media (max-width: 575.98px){.cp-migration-modal__content{max-width:100%}.cp-migration-modal__content-img-wrapper{display:none}.cp-card__body{padding:var(--cp-spacer-1)}.cp-card__icon{margin:0 var(--cp-spacer-2)}}";

const locale$j = getLocaleInstance();
const CpMigrationModalBody$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    /**
     * Migration model image markup
     */
    this.migrationImg = (h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "511.56264", height: "532.44842", viewBox: "0 0 511.56264 532.44842" }, h("polygon", { points: "454.49103 405.20843 454.48102 405.44842 466.49103 532.44842 378.85101 532.44842 367.49103 454.44842 362.49103 530.44842 272.49103 529.44842 282.05103 429.66839 290.18103 383.41839 290.18103 383.40838 291.401 376.44842 452.10101 376.44842 452.31103 378.96838 454.49103 405.20843", fill: "var(--cp-graphic-color)" }), h("path", { d: "M222.88285,478.83064c9.28179,1.69101,18.96019-8.76188,21.61758-23.34779,1.16327-6.38475,.78778-12.50277-.78019-17.50611l1.42323-8.40799,23.88334-113.10923s43.98031-87.97522,43.9791-103.24828c-.00111-15.27287-12.72223-22.76282-12.72223-22.76282l-17.21435,.16096-53.98264,131.84662-9.72217,97.42982-1.57289,13.36711c-3.2316,4.12897-5.74053,9.72145-6.90332,16.10621-2.65749,14.58572,2.71275,27.78048,11.99454,29.4715Z", fill: "#ffb6b6" }), h("polygon", { points: "397.99103 135.94842 381.99103 98.94842 329.99103 107.94842 326.49103 151.47992 397.99103 135.94842", fill: "#ffb6b6" }), h("polygon", { points: "397.99103 135.94842 381.99103 98.94842 329.99103 107.94842 326.49103 151.47992 397.99103 135.94842", opacity: ".1" }), h("path", { d: "M510.99121,212.9484s-37-69-44-76c-3.11621-3.11621-8.01465-3.15955-12.49316-2.25134l-51.50684-17.74866-17.45801-9.8092-1.15039,18.66199-57.31543,10.28748c.31836-11.38086,1.92383-15.70972,1.92383-15.70972l-21,24.56946-41,20,.02246,.18005c-3.00879,1.05029-5.86133,2.84741-8.02246,5.81995-8,11-30,145-30,145l47,10,6.39648-40.13953,4.60352,36.13953,3.5,67.5s64,55,95,35,69-19,69-19l.94824-31.28796c.6748-1.07861,1.05176-1.71204,1.05176-1.71204l-1-110.98425v-29.5321c7.61816,10.61353,16.81152,19.74109,27.5,24.01636,35,14,28-43,28-43Z", fill: "#e6e6e6" }), h("circle", { cx: "350.55585", cy: "66.61991", r: "47.83848", fill: "#ffb6b6" }), h("path", { d: "M384.87476,80.13948s4.15987-14.55954,13.51957-13.51957c9.3597,1.03997,11.43964-7.27977,9.3597-11.43964-2.07993-4.15987-6.2398-24.95921-6.2398-24.95921,0,0,2.07993-14.55954-10.39967-16.63947-12.4796-2.07993-16.63947-4.15987-18.71941-8.31974-2.07993-4.15987-33.27894-8.31974-43.67861-2.07993-10.39967,6.2398-18.71941,18.2117-25.99917,21.58546-7.27977,3.37375-13.51957,9.61355-9.3597,20.01322,4.15987,10.39967,10.19286,30.7392,10.19286,30.7392,0,0,10.60648-3.70006,12.68641,2.53974,2.07993,6.2398-6.2398-2.07993,4.15987-18.71941,10.39967-16.63947,10.39967-33.27894,27.03914-27.03914,16.63947,6.2398,35.35888,4.15987,33.27894,16.63947-2.07993,12.4796,4.15987,31.19901,4.15987,31.19901Z", fill: "#2f2e41" }), h("g", null, h("path", { d: "M381.94946,459.38422H18.63322c-10.27456,0-18.63322-8.35942-18.63322-18.63322V247.758c0-10.2738,8.35866-18.63322,18.63322-18.63322H381.94946c10.27456,0,18.63322,8.35942,18.63322,18.63322v192.993c0,10.2738-8.35866,18.63322-18.63322,18.63322Z", fill: "#fff" }), h("path", { d: "M381.94946,459.38422H18.63322c-10.27456,0-18.63322-8.35942-18.63322-18.63322V247.758c0-10.2738,8.35866-18.63322,18.63322-18.63322H381.94946c10.27456,0,18.63322,8.35942,18.63322,18.63322v192.993c0,10.2738-8.35866,18.63322-18.63322,18.63322ZM18.63322,232.23639c-8.55846,0-15.52161,6.96315-15.52161,15.52161v192.993c0,8.55846,6.96315,15.52161,15.52161,15.52161H381.94946c8.55846,0,15.52161-6.96315,15.52161-15.52161V247.758c0-8.55846-6.96315-15.52161-15.52161-15.52161H18.63322Z", fill: "#3f3d56" }), h("circle", { cx: "353.90847", cy: "247.79446", r: "4.66742", fill: "#3f3d56" }), h("circle", { cx: "366.35492", cy: "247.79446", r: "4.66742", fill: "#3f3d56" }), h("circle", { cx: "378.80138", cy: "247.79446", r: "4.66742", fill: "#3f3d56" }), h("path", { d: "M26.44872,323.2511c-1.28688,0-2.33371,1.04683-2.33371,2.33371,0,.62749,.24234,1.20788,.68218,1.63633,.44365,.45428,1.0248,.69738,1.65153,.69738H375.68976c1.28688,0,2.33371-1.04683,2.33371-2.33371,0-.62749-.24234-1.20788-.68218-1.63633-.44365-.45428-1.0248-.69738-1.65153-.69738H26.44872Z", fill: "#e6e6e6" }), h("path", { d: "M332.12717,322.4732v6.22323H26.44872c-.85567,0-1.63358-.34233-2.19365-.91797-.57574-.56007-.91797-1.33797-.91797-2.19365,0-1.71144,1.40026-3.11161,3.11161-3.11161H332.12717Z", fill: "#4259ed" }), h("path", { d: "M371.80025,310.80464h-31.11614c-3.43144,0-6.22323-2.79103-6.22323-6.22323s2.79179-6.22323,6.22323-6.22323h31.11614c3.43144,0,6.22323,2.79103,6.22323,6.22323s-2.79179,6.22323-6.22323,6.22323Z", fill: "#e6e6e6" }), h("path", { d: "M167.98953,278.1327H28.78243c-3.43144,0-6.22323-2.79103-6.22323-6.22323s2.79179-6.22323,6.22323-6.22323H167.98953c3.43144,0,6.22323,2.79103,6.22323,6.22323s-2.79179,6.22323-6.22323,6.22323Z", fill: "#e6e6e6" }), h("path", { d: "M26.44872,393.26242c-1.28688,0-2.33371,1.04683-2.33371,2.33371,0,.62749,.24234,1.20788,.68218,1.63633,.44365,.45428,1.0248,.69738,1.65153,.69738H375.68976c1.28688,0,2.33371-1.04683,2.33371-2.33371,0-.62749-.24234-1.20788-.68218-1.63633-.44365-.45428-1.0248-.69738-1.65153-.69738H26.44872Z", fill: "#e6e6e6" }), h("path", { d: "M212.33003,392.48451v6.22323H26.44872c-.85567,0-1.63358-.34233-2.19365-.91797-.57574-.56007-.91797-1.33797-.91797-2.19365,0-1.71144,1.40026-3.11161,3.11161-3.11161H212.33003Z", fill: "#4259ed" }), h("path", { d: "M371.80025,380.81596h-31.11614c-3.43144,0-6.22323-2.79103-6.22323-6.22323s2.79179-6.22323,6.22323-6.22323h31.11614c3.43144,0,6.22323,2.79103,6.22323,6.22323s-2.79179,6.22323-6.22323,6.22323Z", fill: "#e6e6e6" })), h("g", null, h("ellipse", { cx: "426.27357", cy: "70.44086", rx: "48.72643", ry: "47.69976", fill: "#4259ed" }), h("path", { d: "M442.81136,46.3808c-6.487,11.81215-12.97405,23.62439-19.46106,35.43659-4.13442-7.30499-8.24624-14.62285-12.39083-21.92211-1.43136-2.5209-5.32473-.25351-3.88976,2.27368,4.80448,8.46149,9.55919,16.95111,14.36367,25.41259,.82147,1.44676,3.07677,1.48035,3.8898,0,7.12599-12.9757,14.25199-25.95141,21.37798-38.92707,1.39635-2.54258-2.4924-4.81822-3.8898-2.27368Z", fill: "#fff" })), h("path", { d: "M493.53827,196.17181l-48.54724-23.22339s-1.94983-15.5437-11.05402-21.08789c-1.54779-3.6925-3.32855-7.74908-4.94598-10.96332-4-7.94879,2-22.94879-3-22.94879s-12.39122,15.77543-12,20c.30031,3.24292,2.98059,8.90472,3.5343,13.8609-6.09709,2.29949-11.01564,6.24084-14.24964,9.37903-2.79865,2.71575-3.8385,6.76755-2.74475,10.51073,3.16948,10.84703,11.09153,33.24933,22.46008,33.24933,15,0,19-3,19-3,0,0,31,39,54,42s-2.45276-47.77661-2.45276-47.77661Z", fill: "#ffb6b6" })));
  }
  /**
   * Gets a SVG from the asset directory
   * @param imagekey name of the image in the assets directory
   * @returns
   */
  getImagePath(imagekey) {
    return getAssetPath(`./assets/${imagekey}.svg`);
  }
  render() {
    return (h("div", { class: "cp-migration-modal__content" }, h("figure", { class: "cp-migration-modal__content-img-wrapper", role: "img", "aria-hidden": "true" }, this.migrationImg), h("div", { class: "cp-migration-modal__content-title" }, locale$j.maketext("Welcome to Jupiter")), h("div", { class: "cp-migration-modal__content-text" }, locale$j.maketext("Welcome to Jupiter - the new theme for the cPanel interface! We have been hard at work creating a new cPanel experience, and it has finally arrived.")), h("div", { class: "container" }, h("div", { class: "row row-cols-lg-3 row-cols-md-1 g-4 cp-migration-modal__content-row" }, h("div", { class: "col-lg-4 col-md-12 g-3" }, h("a", { class: "cp-card", href: "https://go.cpanel.net/explorejupiter", id: "migration-modal-option-explore", target: "cPanel-blog" }, h("div", { class: "cp-card__body" }, h("img", { class: "cp-card__icon", src: this.getImagePath("cp-blog-icon"), alt: "null", "aria-hidden": "true" }), h("div", { class: "cp-card__text-container" }, h("span", { class: "cp-card__title" }, locale$j.maketext("Explore Jupiter")), h("p", { class: "cp-card__description" }, locale$j.maketext("Read our Jupiter introduction website.")))))), h("div", { class: "col-lg-4 col-md-12 g-3" }, h("a", { class: "cp-card", href: "https://go.cpanel.net/jupiter-interface", id: "migration-modal-option-docs", target: "cPanel-documentation" }, h("div", { class: "cp-card__body" }, h("img", { class: "cp-card__icon", src: this.getImagePath("cp-docs-icon"), alt: "null", "aria-hidden": "true" }), h("div", { class: "cp-card__text-container" }, h("span", { class: "cp-card__title" }, locale$j.maketext("Documentation")), h("p", { class: "cp-card__description" }, locale$j.maketext("Read our interface documentation about the Jupiter theme."))))))))));
  }
  static get style() { return cpMigrationModalBodyCss; }
};

const cpMigrationModalFooterCss = "@charset \"UTF-8\";:root{--cp-font-weight-semi-bold:600}.cp-btn{display:inline-block;box-sizing:border-box;padding:0.375rem 0.75rem;border-radius:0.25rem;text-align:center;vertical-align:middle;text-decoration:none;font-size:0.875rem;font-weight:500;font-family:“Roboto”, -apple-system, BlinkMacSystemFont, “Segoe UI”, “Oxygen”, “Ubuntu”, “Cantarell”, “Fira Sans”, “Droid Sans”, “Helvetica Neue”, sans-serif;min-width:160px;}:lang(en) .cp-btn{text-transform:uppercase}.cp-btn--primary{background:#4259ed;color:#ffffff;border:1px solid #4259ed}.cp-btn--primary:hover:enabled,.cp-btn--primary:focus,.cp-btn--primary:active{background:#384cc9;border:1px solid #384cc9}.cp-btn--primary:disabled{background:#e6e9ef;color:#b3bccf;border:1px solid #b3bccf}.cp-btn--secondary{background:transparent;color:#4259ed;border:1px solid #4259ed}.cp-btn--secondary:hover:enabled,.cp-btn--secondary:focus:enabled,.cp-btn--secondary:active:enabled{background:#384cc9;color:#ffffff;border:1px solid #384cc9;text-decoration:none}.cp-btn--secondary:disabled{color:#b3bccf;border:1px solid #b3bccf}.cp-btn--link{background:transparent;border:transparent;min-width:initial}";

const locale$i = getLocaleInstance();
const CpMigrationModalFooter$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.closeMigrationModal = createEvent(this, "closeMigrationModal", 7);
  }
  render() {
    return (h("button", { id: "btnSetupLater", type: "button", class: "cp-btn cp-btn--secondary", onClick: () => this.closeMigrationModal.emit() }, locale$i.maketext("Dismiss")));
  }
  static get style() { return cpMigrationModalFooterCss; }
};

/*
# cpanel - ui/web-components/src/components/shared/cp-modal/cp-modal-actions.ts
#                                                  Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
*/
var ModalActions;
(function (ModalActions) {
  ModalActions["Close"] = "CLOSE-MODAL";
  ModalActions["Open"] = "OPEN-MODAL";
})(ModalActions || (ModalActions = {}));

const cpModalCss = "@charset \"UTF-8\";:root{--cp-font-weight-semi-bold:600}:root{--bs-blue:#0d6efd;--bs-indigo:#6610f2;--bs-purple:#6f42c1;--bs-pink:#d63384;--bs-red:#dc3545;--bs-orange:#fd7e14;--bs-yellow:#ffc107;--bs-green:#198754;--bs-teal:#20c997;--bs-cyan:#0dcaf0;--bs-white:#fff;--bs-gray:#6c757d;--bs-gray-dark:#343a40;--bs-gray-100:#f8f9fa;--bs-gray-200:#e9ecef;--bs-gray-300:#dee2e6;--bs-gray-400:#ced4da;--bs-gray-500:#adb5bd;--bs-gray-600:#6c757d;--bs-gray-700:#495057;--bs-gray-800:#343a40;--bs-gray-900:#212529;--bs-primary:#0d6efd;--bs-secondary:#6c757d;--bs-success:#198754;--bs-info:#0dcaf0;--bs-warning:#ffc107;--bs-danger:#dc3545;--bs-light:#f8f9fa;--bs-dark:#212529;--bs-primary-rgb:13, 110, 253;--bs-secondary-rgb:108, 117, 125;--bs-success-rgb:25, 135, 84;--bs-info-rgb:13, 202, 240;--bs-warning-rgb:255, 193, 7;--bs-danger-rgb:220, 53, 69;--bs-light-rgb:248, 249, 250;--bs-dark-rgb:33, 37, 41;--bs-white-rgb:255, 255, 255;--bs-black-rgb:0, 0, 0;--bs-body-color-rgb:8, 25, 62;--bs-body-bg-rgb:247, 248, 250;--bs-font-sans-serif:system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, \"Noto Sans\", \"Liberation Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\";--bs-font-monospace:SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;--bs-gradient:linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));--bs-body-font-family:var(--cp-font-family-roboto);--bs-body-font-size:1rem;--bs-body-font-weight:400;--bs-body-line-height:1.5;--bs-body-color:#08193e;--bs-body-bg:#F7F8FA}:root{--cp-font-family-roboto:“Roboto”, -apple-system, BlinkMacSystemFont, “Segoe UI”, “Oxygen”, “Ubuntu”, “Cantarell”, “Fira Sans”, “Droid Sans”, “Helvetica Neue”, sans-serif;--cp-spacer-0:0;--cp-spacer-1:0.25rem;--cp-spacer-2:0.5rem;--cp-spacer-3:1rem;--cp-spacer-4:1.5rem;--cp-spacer-5:2rem;--cp-spacer-6:3rem;--cp-border-width-1:1px;--cp-border-width-2:2px;--cp-border-width-3:3px;--cp-border-width-4:4px;--cp-border-width-5:5px;--cp-small-font-size:0.875em;--cp-main-menu-width:clamp(240px, 14.8vw, 320px);--cp-header-height:60px;--cp-stat-header-height:50px;--cp-current-viewport:xs}@media (min-width: 576px){:root{--cp-current-viewport:sm}}@media (min-width: 768px){:root{--cp-current-viewport:md}}@media (min-width: 992px){:root{--cp-current-viewport:lg}}@media (min-width: 1200px){:root{--cp-current-viewport:xl}}:root{--cp-font-weight-semi-bold:600}.cp-btn{display:inline-block;box-sizing:border-box;padding:0.375rem 0.75rem;border-radius:0.25rem;text-align:center;vertical-align:middle;text-decoration:none;font-size:0.875rem;font-weight:500;font-family:“Roboto”, -apple-system, BlinkMacSystemFont, “Segoe UI”, “Oxygen”, “Ubuntu”, “Cantarell”, “Fira Sans”, “Droid Sans”, “Helvetica Neue”, sans-serif;min-width:160px;}:lang(en) .cp-btn{text-transform:uppercase}.cp-btn--primary{background:#4259ed;color:#ffffff;border:1px solid #4259ed}.cp-btn--primary:hover:enabled,.cp-btn--primary:focus,.cp-btn--primary:active{background:#384cc9;border:1px solid #384cc9}.cp-btn--primary:disabled{background:#e6e9ef;color:#b3bccf;border:1px solid #b3bccf}.cp-btn--secondary{background:transparent;color:#4259ed;border:1px solid #4259ed}.cp-btn--secondary:hover:enabled,.cp-btn--secondary:focus:enabled,.cp-btn--secondary:active:enabled{background:#384cc9;color:#ffffff;border:1px solid #384cc9;text-decoration:none}.cp-btn--secondary:disabled{color:#b3bccf;border:1px solid #b3bccf}.cp-btn--link{background:transparent;border:transparent;min-width:initial}:host{display:block}.cp-modal{position:fixed;top:0;z-index:1055;display:none;width:100%;height:100%;overflow-x:hidden;overflow-y:auto;outline:0}[dir=\"ltr\"] .cp-modal{left:0}[dir=\"rtl\"] .cp-modal{right:0}.cp-modal--is-open{display:block}.cp-modal-dialog{position:relative;width:auto;margin:0.5rem;pointer-events:none}.cp-modal.fade .cp-modal-dialog{transition:transform 0.3s ease-out;transform:translate(0, -50px)}@media (prefers-reduced-motion: reduce){.cp-modal.fade .cp-modal-dialog{transition:none}}.cp-modal.show .cp-modal-dialog{transform:none}.cp-modal.cp-modal-static .cp-modal-dialog{transform:scale(1.02)}.cp-modal-dialog-scrollable{height:calc(100% - 1rem)}.cp-modal-dialog-scrollable .cp-modal-content{max-height:100%;overflow:hidden}.cp-modal-dialog-scrollable .cp-modal-body{overflow-y:auto}.cp-modal-dialog-centered{display:flex;align-items:center;min-height:calc(100% - 1rem)}.cp-modal-content{position:relative;display:flex;flex-direction:column;width:100%;pointer-events:auto;background-color:#fff;background-clip:padding-box;border:1px solid rgba(0, 0, 0, 0.2);border-radius:0.3rem;outline:0}.cp-modal-header{display:flex;flex-shrink:0;align-items:center;justify-content:space-between;border-bottom:1px solid #dee2e6;border-top-left-radius:calc(0.3rem - 1px);border-top-right-radius:calc(0.3rem - 1px)}[dir=\"ltr\"] .cp-modal-header__btn-close{margin:var(--cp-spacer-2) var(--cp-spacer-2) var(--cp-spacer-2) auto}[dir=\"rtl\"] .cp-modal-header__btn-close{margin:var(--cp-spacer-2) auto var(--cp-spacer-2) var(--cp-spacer-2)}.cp-modal-header--no-title{background-color:#F7F8FA;border-bottom:none}.cp-modal-body{position:relative;padding:1.5rem;background-color:#F7F8FA}.cp-modal-footer{display:flex;flex-wrap:wrap;flex-shrink:0;align-items:center;justify-content:flex-end;padding:1rem;border-top:1px solid #dee2e6;border-bottom-right-radius:calc(0.3rem - 1px);border-bottom-left-radius:calc(0.3rem - 1px)}.cp-modal-footer>*{margin:0.25rem}@media (min-width: 576px){.cp-modal-dialog{max-width:500px;margin:1.75rem auto}.cp-modal-dialog-scrollable{height:calc(100% - 3.5rem)}.cp-modal-dialog-centered{min-height:calc(100% - 3.5rem)}.cp-modal-sm{max-width:300px}}@media (min-width: 992px){.cp-modal-lg,.cp-modal-xl{max-width:800px}}@media (min-width: 1200px){.cp-modal-xl{max-width:1140px}}.cp-modal-fullscreen{width:100vw;max-width:none;height:100%;margin:0}.cp-modal-fullscreen .cp-modal-content{height:100%;border:0;border-radius:0}.cp-modal-fullscreen .cp-modal-header{border-radius:0}.cp-modal-fullscreen .cp-modal-body{overflow-y:auto}.cp-modal-fullscreen .cp-modal-footer{border-radius:0}@media (max-width: 575.98px){.cp-modal-fullscreen-sm-down{width:100vw;max-width:none;height:100%;margin:0}.cp-modal-fullscreen-sm-down .cp-modal-content{height:100%;border:0;border-radius:0}.cp-modal-fullscreen-sm-down .cp-modal-header{border-radius:0}.cp-modal-fullscreen-sm-down .cp-modal-body{overflow-y:auto}.cp-modal-fullscreen-sm-down .cp-modal-footer{border-radius:0}}@media (max-width: 767.98px){.cp-modal-fullscreen-md-down{width:100vw;max-width:none;height:100%;margin:0}.cp-modal-fullscreen-md-down .cp-modal-content{height:100%;border:0;border-radius:0}.cp-modal-fullscreen-md-down .cp-modal-header{border-radius:0}.cp-modal-fullscreen-md-down .cp-modal-body{overflow-y:auto}.cp-modal-fullscreen-md-down .cp-modal-footer{border-radius:0}}@media (max-width: 991.98px){.cp-modal-fullscreen-lg-down{width:100vw;max-width:none;height:100%;margin:0}.cp-modal-fullscreen-lg-down .cp-modal-content{height:100%;border:0;border-radius:0}.cp-modal-fullscreen-lg-down .cp-modal-header{border-radius:0}.cp-modal-fullscreen-lg-down .cp-modal-body{overflow-y:auto}.cp-modal-fullscreen-lg-down .cp-modal-footer{border-radius:0}}@media (max-width: 1199.98px){.cp-modal-fullscreen-xl-down{width:100vw;max-width:none;height:100%;margin:0}.cp-modal-fullscreen-xl-down .cp-modal-content{height:100%;border:0;border-radius:0}.cp-modal-fullscreen-xl-down .cp-modal-header{border-radius:0}.cp-modal-fullscreen-xl-down .cp-modal-body{overflow-y:auto}.cp-modal-fullscreen-xl-down .cp-modal-footer{border-radius:0}}@media (max-width: 1399.98px){.cp-modal-fullscreen-xxl-down{width:100vw;max-width:none;height:100%;margin:0}.cp-modal-fullscreen-xxl-down .cp-modal-content{height:100%;border:0;border-radius:0}.cp-modal-fullscreen-xxl-down .cp-modal-header{border-radius:0}.cp-modal-fullscreen-xxl-down .cp-modal-body{overflow-y:auto}.cp-modal-fullscreen-xxl-down .cp-modal-footer{border-radius:0}}";

const locale$h = getLocaleInstance();
const CpModal$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
    this.modalClosed = createEvent(this, "modalClosed", 7);
    this.modalOpened = createEvent(this, "modalOpened", 7);
    /**
     * Counter to ensure focus loops don't happen
     */
    this.focusCaptureCounter = 0;
    /**
     * State of the modal.
     */
    this.isOpen = true;
    /**
     * Modal size
     */
    this.modalSize = ModalSize.default;
    /**
     * Boolean value that hides modal title, removes background and header border bottom
     */
    this.hideTitle = false;
    /**
     * Boolean value toggle show/hide of the dismiss button (X) on the top right corner.
     * Defaults to true.
     */
    this.dismissable = true;
  }
  /**
   * Validation for the elementIdToFocus prop. elementIdToFocus is a required prop.
   * @param newValue
   */
  validateElementIdToFocus(newValue) {
    const isBlank = typeof newValue !== "string" || newValue === "";
    if (isBlank) {
      throw new Error("elementIdToFocus: required");
    }
  }
  /**
   * Validation for the modalAriaLabel prop. modalAriaLabel is a required prop.
   * @param newValue
   */
  validateModalAriaLabel(newValue) {
    const isBlank = typeof newValue !== "string" || newValue === "";
    if (isBlank) {
      throw new Error("modalAriaLabel: required");
    }
  }
  componentDidLoad() {
    this.modal = this.el.querySelector("#cp-modal");
  }
  /**
   * Listen for focus transition. If anything on the page tries to capture focus, steal it back.
   * Any element that tried to steal focus will be stored for later and focused when the modal is dismissed.
   * @param event
   */
  trapFocusInModal(event) {
    var _a;
    // Only set an element to focus on dismiss once.
    if (this.focusCaptureCounter === 0) {
      this.setElementToFocusOnDismiss();
    }
    const elementToFocus = event.target;
    // If focus target is not contained in modal, then return focus to modal
    if (!((_a = this.modal) === null || _a === void 0 ? void 0 : _a.contains(elementToFocus)) && this.focusCaptureCounter < 10) {
      this.setFocus();
      // Sanity check to make sure we don't try to infinitely recapture focus
      // if some other element is doing the same thing. Better to leave users with a
      // less ideal keyboard navigation than to trap them in an infinite loop.
      this.focusCaptureCounter++;
    }
  }
  /**
   *  Listens for keypresses to handle keyboard navigation inside the modal. Ensures keyboard navigation is predictable.
   * @param event
   * @returns
   */
  handleKeypress(event) {
    if (!this.isOpen) {
      return;
    }
    if (this.dismissable && event.key === "Escape") {
      this.closeModal();
      return;
    }
    // If user tabs out from last focusable element, then redirect focus to first element in modal
    if (!event.shiftKey && event.key === "Tab" && document.activeElement === this.lastFocusableEl) {
      event.preventDefault();
      this.firstFocusableEl.focus();
    }
    // If user shift+tabs out from first focusable element, then redirect focus to last element in modal
    if (event.shiftKey && event.key === "Tab" && document.activeElement === this.firstFocusableEl) {
      event.preventDefault();
      this.lastFocusableEl.focus();
    }
  }
  /**
   * Method available outside the component. Used to close the modal.
   */
  async close() {
    // Those closer operations here are strictly to close the modal. Any other operations on close should be on the caller
    this.closeModal();
    // Emit a closed event
  }
  /**
   * Method available outside the component. Used to open the modal.
   */
  async open() {
    this.openModal();
  }
  /**
   * Calls all the functions and sets all the variables needed to close the modal.
   */
  closeModal() {
    this.isOpen = false;
    this.updateOverlay();
    this.setBodyScroll();
    this.setAccessibilityAttributes();
    this.returnFocusToOtherFocusElement();
    this.modalClosed.emit(ModalActions.Close);
  }
  /**
   * Calls all the functions and sets all the variabled needed to open the modal.
   */
  openModal() {
    this.isOpen = true;
    this.setFocusAndCaptureEl();
    this.setFocus();
    this.setAccessibilityAttributes();
    this.updateOverlay();
    this.setBodyScroll();
    this.modalOpened.emit(ModalActions.Open);
  }
  /**
   * If another element is trying to grab focus at the same time as the modal, store it to be focused when the modal is dismissed.
   */
  setElementToFocusOnDismiss() {
    if (document.activeElement !== this.elementToFocus) {
      this.elementToFocusOnDismiss = document.activeElement;
    }
  }
  /**
   * Focus the element that was trying to be focused when the modal was opened.
   */
  returnFocusToOtherFocusElement() {
    var _a, _b, _c, _d, _e, _f, _g;
    if (!this.elementToFocusOnDismiss) {
      return;
    }
    else if (this.elementToFocusOnDismiss.localName === "cp-header") {
      // Traverse through the shadow DOM to get to the header input.
      (_g = (_f = (_e = (_d = (_c = (_b = (_a = document
        .querySelector("cp-header")) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector("cp-header-search-control")) === null || _c === void 0 ? void 0 : _c.shadowRoot) === null || _d === void 0 ? void 0 : _d.querySelector("cp-header-search")) === null || _e === void 0 ? void 0 : _e.shadowRoot) === null || _f === void 0 ? void 0 : _f.querySelector(".header__search-input")) === null || _g === void 0 ? void 0 : _g.focus();
    }
    else {
      // Elements on inner app pages can also be focused.
      this.elementToFocusOnDismiss.focus();
    }
  }
  /**
   * Sets accessibility attributes given the modal's state.
   */
  setAccessibilityAttributes() {
    if (!this.modal) {
      return;
    }
    if (this.isOpen) {
      this.modal.removeAttribute("aria-hidden");
      this.modal.setAttribute("aria-modal", "true");
      this.modal.setAttribute("role", "dialog");
      this.modal.removeAttribute("tabIndex");
    }
    else {
      this.modal.setAttribute("aria-hidden", "true");
      this.modal.removeAttribute("aria-modal");
      this.modal.removeAttribute("role");
      this.modal.setAttribute("tabIndex", "-1");
    }
  }
  /**
   * Determines how the window should scroll dependant on the modal state.
   * @returns
   */
  setBodyScroll() {
    const body = document.querySelector("body");
    if (!body) {
      return;
    }
    if (this.isOpen) {
      body.style.overflow = "hidden";
    }
    else {
      body.style.overflow = "unset";
    }
  }
  /**
   * Sets focus on a specific element when the modal opens.
   */
  setFocus() {
    if (this.isOpen) {
      window.setTimeout(() => {
        if (this.elementToFocus) {
          this.elementToFocus.focus();
        }
      });
    }
  }
  /**
   * Set the elementToFocus, lastFocusableEl, and firstFocusableEl.
   * This can't be done in a lifecycle method due to how components are rendered
   * Components are rendered parent then children, so these elements do not exist when this component has finished rendering.
   */
  setFocusAndCaptureEl() {
    var _a, _b, _c, _d, _e, _f, _g, _h, _j;
    this.elementToFocus =
      ((_b = (_a = this.el) === null || _a === void 0 ? void 0 : _a.querySelector("[slot=modal-footer]")) === null || _b === void 0 ? void 0 : _b.querySelector(`#${this.elementIdToFocus}`)) ||
        ((_d = (_c = this.el) === null || _c === void 0 ? void 0 : _c.querySelector("[slot=modal-footer]")) === null || _d === void 0 ? void 0 : _d.querySelector("button"));
    this.lastFocusableEl =
      ((_f = (_e = this.el) === null || _e === void 0 ? void 0 : _e.querySelector("[slot=modal-footer]")) === null || _f === void 0 ? void 0 : _f.querySelector(`#${this.elementIdToFocus}`)) ||
        ((_h = (_g = this.el) === null || _g === void 0 ? void 0 : _g.querySelector("[slot=modal-footer]")) === null || _h === void 0 ? void 0 : _h.querySelector("button"));
    this.firstFocusableEl = (_j = this.el) === null || _j === void 0 ? void 0 : _j.querySelector("#cp-modalClose");
  }
  /**
   * Handles the overlay given the modal state.
   * @returns
   */
  updateOverlay() {
    const overlayEl = document.querySelector("#cp-overlay");
    if (!overlayEl) {
      return;
    }
    if (this.isOpen) {
      overlayEl.classList.add("cp-overlay--cover-page");
    }
    else {
      overlayEl.classList.remove("cp-overlay--cover-page");
    }
  }
  getModalClassNames(state) {
    if (state) {
      return `cp-modal show cp-modal--is-open`;
    }
    else {
      return `cp-modal fade`;
    }
  }
  getModalDialogClassNames(modalSize) {
    return `cp-modal-dialog ${modalSize} cp-modal-dialog-centered cp-modal-dialog-scrollable`;
  }
  get headerTitleClassName() {
    return this.hideTitle ? "cp-modal-header cp-modal-header--no-title" : "cp-modal-header";
  }
  /**
   * Toggles the display of the modal close button (X) depending on the dismissable property value.
   * @returns html
   */
  toggleDismissButtonHtml() {
    if (this.dismissable) {
      return (h("button", { id: "cp-modalClose", type: "button", class: "cp-btn cp-btn--link cp-modal-header__btn-close", "aria-label": locale$h.maketext("Close"), onClick: () => this.closeModal() }, h("cp-icon", { name: "close-line", size: IconSize.lg, mode: IconMode.Centered })));
    }
    return;
  }
  render() {
    return (h(Host, null, h("cp-style-reset", null, h("cp-dir", null, h("div", { class: this.getModalClassNames(this.isOpen), id: "cp-modal", tabindex: "-1", "aria-label": this.modalAriaLabel, "aria-hidden": "true" }, h("div", { class: this.getModalDialogClassNames(this.modalSize) }, h("div", { class: "cp-modal-content" }, h("header", { class: this.headerTitleClassName, id: "cp-modal-header" }, !this.hideTitle ? h("slot", { name: "modal-title" }) : "", this.toggleDismissButtonHtml()), h("main", { class: "cp-modal-body", id: "cp-modal-main" }, h("slot", { name: "modal-content" })), h("footer", { class: "cp-modal-footer", id: "cp-modal-foot" }, h("slot", { name: "modal-footer" })))))))));
  }
  get el() { return this; }
  static get watchers() { return {
    "elementIdToFocus": ["validateElementIdToFocus"],
    "modalAriaLabel": ["validateModalAriaLabel"]
  }; }
  static get style() { return cpModalCss; }
};

/**
# cpanel - ui/web-components/src/components/shared/classes/plugin.ts
#                                                  Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
 */
class Plugin {
  constructor(attrs) {
    Object.assign(this, attrs);
  }
  /**
   * The absolute URL path to access the plugin.
   *
   * IMPORTANT: This does **NOT** include the security token,
   * which is necessary for the URL to work.
   */
  url() {
    return `/cgi/${this.cgi}`;
  }
}

/**
# cpanel - ui/web-components/src/components/shared/services/whm/app-tools.service.ts
#                                                  Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
 */
const locale$g = getLocaleInstance();
const AppToolsService = {
  /**
   * Set the WHM application list. After the initial API call, set the application list value in the store and pull the data from there.
   */
  getWHMApplicationList(categoryList, plugins) {
    let appList = [];
    categoryList.forEach(category => {
      if (category.items.length) {
        category.items.forEach(app => {
          let thisUrlIsAbsolute = urlIsAbsolute(app.url);
          appList.push({
            name: app.itemdesc,
            searchText: toLocaleLowerCase(app.searchtext).split(/\s+/),
            url: thisUrlIsAbsolute ? app.url : app.url.substring(1),
            url_is_absolute: thisUrlIsAbsolute ? 1 : 0,
            target: app.target,
            key: app.key,
            categoryKey: category.group,
            category: category.groupdesc,
            description: app.description || "",
          });
        });
      }
    });
    plugins.forEach(plugin => {
      appList.push({
        name: plugin.name,
        searchText: toLocaleLowerCase(plugin.name).split(/\s+/),
        url_is_absolute: 0,
        key: plugin.key,
        // Omit leading slash:
        url: plugin.url().substring(1),
        categoryKey: PluginsCategory.KEY,
        category: locale$g.maketext(PluginsCategory.NAME),
        description: "",
      });
    });
    return appList;
  },
  /**
   * Set the cPanel application list. After the initial API call, set the application list value in the store and pull the data from there.
   */
  getCpanelApplicationList(rawAppList) {
    return JSON.parse(unescape(rawAppList)).map(app => {
      app["searchText"] = toLocaleLowerCase(app.searchText).split(/\s+/);
      return app;
    });
  },
  /**
   * Set the Webmail application list. After the initial API call, set the application list value in the store and pull the data from there.
   */
  getWebmailApplicationList(rawAppList, mailClientList) {
    let appList = [];
    // Normalize rawAppList to the AppEntry type.
    appList = JSON.parse(unescape(rawAppList)).map(app => {
      const thisUrlIsAbsolute = urlIsAbsolute(app.url);
      return {
        name: app.name,
        searchText: "",
        url: app.url,
        url_is_absolute: thisUrlIsAbsolute ? 1 : 0,
        key: app.key,
        category: app.category,
        categoryKey: app.category,
        description: app.description,
      };
    });
    appList = appList.concat(JSON.parse(unescape(mailClientList)).map(mailClient => {
      const thisUrlIsAbsolute = urlIsAbsolute(mailClient.url);
      return {
        name: mailClient.displayname,
        searchText: "",
        url: mailClient.url,
        url_is_absolute: thisUrlIsAbsolute ? 1 : 0,
        key: mailClient.id,
        category: "",
        categoryKey: "",
        description: mailClient.displayname,
      };
    }));
    return appList;
  },
};

const cpRootVariablesCss = "@charset \"UTF-8\";:root{--cp-font-weight-semi-bold:600}:root{--bs-blue:#0d6efd;--bs-indigo:#6610f2;--bs-purple:#6f42c1;--bs-pink:#d63384;--bs-red:#dc3545;--bs-orange:#fd7e14;--bs-yellow:#ffc107;--bs-green:#198754;--bs-teal:#20c997;--bs-cyan:#0dcaf0;--bs-white:#fff;--bs-gray:#6c757d;--bs-gray-dark:#343a40;--bs-gray-100:#f8f9fa;--bs-gray-200:#e9ecef;--bs-gray-300:#dee2e6;--bs-gray-400:#ced4da;--bs-gray-500:#adb5bd;--bs-gray-600:#6c757d;--bs-gray-700:#495057;--bs-gray-800:#343a40;--bs-gray-900:#212529;--bs-primary:#0d6efd;--bs-secondary:#6c757d;--bs-success:#198754;--bs-info:#0dcaf0;--bs-warning:#ffc107;--bs-danger:#dc3545;--bs-light:#f8f9fa;--bs-dark:#212529;--bs-primary-rgb:13, 110, 253;--bs-secondary-rgb:108, 117, 125;--bs-success-rgb:25, 135, 84;--bs-info-rgb:13, 202, 240;--bs-warning-rgb:255, 193, 7;--bs-danger-rgb:220, 53, 69;--bs-light-rgb:248, 249, 250;--bs-dark-rgb:33, 37, 41;--bs-white-rgb:255, 255, 255;--bs-black-rgb:0, 0, 0;--bs-body-color-rgb:8, 25, 62;--bs-body-bg-rgb:247, 248, 250;--bs-font-sans-serif:system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, \"Noto Sans\", \"Liberation Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\";--bs-font-monospace:SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;--bs-gradient:linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));--bs-body-font-family:var(--cp-font-family-roboto);--bs-body-font-size:1rem;--bs-body-font-weight:400;--bs-body-line-height:1.5;--bs-body-color:#08193e;--bs-body-bg:#F7F8FA}:root{--cp-font-family-roboto:“Roboto”, -apple-system, BlinkMacSystemFont, “Segoe UI”, “Oxygen”, “Ubuntu”, “Cantarell”, “Fira Sans”, “Droid Sans”, “Helvetica Neue”, sans-serif;--cp-spacer-0:0;--cp-spacer-1:0.25rem;--cp-spacer-2:0.5rem;--cp-spacer-3:1rem;--cp-spacer-4:1.5rem;--cp-spacer-5:2rem;--cp-spacer-6:3rem;--cp-border-width-1:1px;--cp-border-width-2:2px;--cp-border-width-3:3px;--cp-border-width-4:4px;--cp-border-width-5:5px;--cp-small-font-size:0.875em;--cp-main-menu-width:clamp(240px, 14.8vw, 320px);--cp-header-height:60px;--cp-stat-header-height:50px;--cp-current-viewport:xs}@media (min-width: 576px){:root{--cp-current-viewport:sm}}@media (min-width: 768px){:root{--cp-current-viewport:md}}@media (min-width: 992px){:root{--cp-current-viewport:lg}}@media (min-width: 1200px){:root{--cp-current-viewport:xl}}cp-root-variables{display:none}";

const CpRootVariables$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
  }
  /**
   * With cP applications we can get this URL from the backend, but
   * plugins don’t give us that luxury, so we infer it from the
   * browser state. (Getting it from the backend is preferable because
   * there are some apps whose nav URLs include query strings.)
   */
  _autodetectPageUrl() {
    let path = window.location.pathname;
    if (this.directoryPrefix && path.startsWith(`${this.directoryPrefix}/`)) {
      path = path.substring(this.directoryPrefix.length);
    }
    return path;
  }
  /**
   * Set all properties of the cp-root-variables web component on the shared store object
   */
  _setStoreProperties() {
    state.directoryPrefix = this.directoryPrefix;
    /*
     * Stencil HTML decodes HTML encoded strings that come in as props. However, there are parts of the appList that are translated HTML-escaped.
     * The simplest solution is to HTML-unescape the entire thing rather than unescaping those specific strings. This may lead to an escess-unescape bug.
     * If this does happen then the logic an be fixed in the TT layer to unescape the strings that need it.
     */
    state.mainMenuLinks = this.mainMenuLinks ? JSON.parse(unescape(this.mainMenuLinks)) : "";
    state.appName = this.appName;
    state.cpanelAppKey = this.cpanelAppKey || "";
    state.hostName = this.hostName || "";
    state.serverEnvironment = this.serverEnvironment || "";
    state.user = this.user || "";
    state.version = this.version || "";
    state.cpanelFullVersion = this.cpanelFullVersion || "";
    state.categoryList = this.categoryList ? JSON.parse(unescape(this.categoryList)) : "";
    state.licenseType = this.licenseType || "";
    if (this.permissions)
      state.permissions = new Permissions(JSON.parse(this.permissions));
    state.appSearchResultsLimit = this.appSearchResultsLimit;
    state.initialNavUrl = this.initialNavUrl || this._autodetectPageUrl();
    state.primaryDomain = this.primaryDomain;
    state.whmLogos = this.whmLogosJson ? JSON.parse(this.whmLogosJson) : "";
    state.companyId = this.companyId || "";
    if (this.plugins) {
      let rawPlugins = JSON.parse(unescape(this.plugins));
      state.plugins = rawPlugins.map(plugin => {
        return new Plugin({
          icon: plugin.icon,
          target: plugin.target,
          cgi: plugin.cgi,
          aclList: plugin.acllist,
          key: plugin.uniquekey,
          name: plugin.showname,
        });
      });
    }
    if (this.favorites) {
      if (this.favorites === '"dynamic"') {
        // For PHP apps, fetch the favorites here
        this._getFavorites();
      }
      else {
        state.favorites = JSON.parse(unescape(this.favorites));
      }
    }
    if (this.whmNotifications && this.whmNotifications.length) {
      const jsonNotifications = JSON.parse(this.whmNotifications);
      state.whmNotifications = jsonNotifications.map(notification => {
        notification.isShown = toBoolean(notification.isShown);
        return notification;
      });
    }
    else {
      state.whmNotifications = [];
    }
    if (this.appName === AppName.Whm) {
      state.appList = AppToolsService.getWHMApplicationList(state.categoryList, state.plugins);
    }
    else if (this.appName === AppName.Cpanel) {
      state.appList = AppToolsService.getCpanelApplicationList(this.appList);
    }
    else if (this.appName === AppName.Webmail) {
      state.appList = AppToolsService.getWebmailApplicationList(this.appList, this.mailClientList);
    }
    document.addEventListener("DOMContentLoaded", () => {
      let el = document.querySelector("#cp-overlay");
      if (!el)
        throw "need #cp-overlay";
      state.uiOverlay = new UIOverlay(el);
    });
  }
  /**
   * Fetch favorites from NVData and transform into usable format for left navigation.
   * This is useful when running PHP apps such as WPT, since the logged in user is obfuscated,
   * and therefore the NVData is not accessible through the template.
   */
  async _getFavorites() {
    let favoritesNVData = (await getPersonalizationData(this.directoryPrefix, "", "favorites")).favorites.value;
    let favorites = [];
    let tools = JSON.parse(this.categoryList);
    let plugins = JSON.parse(this.plugins);
    if (Array.isArray(favoritesNVData)) {
      let groups = {};
      for (const tool of tools) {
        groups[tool.group] = tool.items;
      }
      favoritesNVData.forEach(identifier => {
        let [group, key] = identifier.split("$");
        let app = undefined;
        if (group === "plugins") {
          [app] = plugins.filter(item => {
            return key === item.uniquekey;
          });
          // Plugin is in user's favorites list, but plugin doesn't exist
          if (!app) {
            return;
          }
          app["group"] = group;
          app["type"] = "plugin";
          app["key"] = app["uniquekey"];
          app["description"] = "";
          app["itemdesc"] = app["showname"];
          app["url"] = "/cgi/" + app["cgi"];
        }
        else {
          let groupItems = groups[group];
          [app] = groupItems.filter(item => {
            return key === item.key;
          });
          // App is in user's favorites list, but app doesn't exist
          if (!app) {
            return;
          }
          app["type"] = "builtin";
        }
        if (app !== undefined) {
          app["description"].replace("&amp;", "&");
          favorites.push(app);
        }
      });
      state.favorites = favorites;
    }
    return;
  }
  connectedCallback() {
    this._setStoreProperties();
  }
  render() {
    return h(Host, null);
  }
  static get style() { return cpRootVariablesCss; }
};

const cpStyleResetCss = ":host{all:initial;font-family:Roboto;font-size:16px;line-height:1.5}button{line-height:inherit}";

const CpStyleReset$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
  }
  render() {
    return (h(Host, null, h("slot", null)));
  }
  static get style() { return cpStyleResetCss; }
};

const CpUiLoadAnalytics$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
    this.analyticsInstanceLoaded = createEvent(this, "analyticsInstanceLoaded", 7);
  }
  analyticsInstanceLoadHandler() {
    this.analyticsInstanceLoaded.emit();
  }
  render() {
    return (h(Host, null, h("cp-load-mixpanel-js", { "analytics-config": this.analyticsConfig })));
  }
};

const cpWebmailConsentPrivacyModalCss = "@charset \"UTF-8\";:root{--cp-font-weight-semi-bold:600}:root{--bs-blue:#0d6efd;--bs-indigo:#6610f2;--bs-purple:#6f42c1;--bs-pink:#d63384;--bs-red:#dc3545;--bs-orange:#fd7e14;--bs-yellow:#ffc107;--bs-green:#198754;--bs-teal:#20c997;--bs-cyan:#0dcaf0;--bs-white:#fff;--bs-gray:#6c757d;--bs-gray-dark:#343a40;--bs-gray-100:#f8f9fa;--bs-gray-200:#e9ecef;--bs-gray-300:#dee2e6;--bs-gray-400:#ced4da;--bs-gray-500:#adb5bd;--bs-gray-600:#6c757d;--bs-gray-700:#495057;--bs-gray-800:#343a40;--bs-gray-900:#212529;--bs-primary:#0d6efd;--bs-secondary:#6c757d;--bs-success:#198754;--bs-info:#0dcaf0;--bs-warning:#ffc107;--bs-danger:#dc3545;--bs-light:#f8f9fa;--bs-dark:#212529;--bs-primary-rgb:13, 110, 253;--bs-secondary-rgb:108, 117, 125;--bs-success-rgb:25, 135, 84;--bs-info-rgb:13, 202, 240;--bs-warning-rgb:255, 193, 7;--bs-danger-rgb:220, 53, 69;--bs-light-rgb:248, 249, 250;--bs-dark-rgb:33, 37, 41;--bs-white-rgb:255, 255, 255;--bs-black-rgb:0, 0, 0;--bs-body-color-rgb:8, 25, 62;--bs-body-bg-rgb:247, 248, 250;--bs-font-sans-serif:system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, \"Noto Sans\", \"Liberation Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\";--bs-font-monospace:SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;--bs-gradient:linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));--bs-body-font-family:var(--cp-font-family-roboto);--bs-body-font-size:1rem;--bs-body-font-weight:400;--bs-body-line-height:1.5;--bs-body-color:#08193e;--bs-body-bg:#F7F8FA}:root{--cp-font-family-roboto:“Roboto”, -apple-system, BlinkMacSystemFont, “Segoe UI”, “Oxygen”, “Ubuntu”, “Cantarell”, “Fira Sans”, “Droid Sans”, “Helvetica Neue”, sans-serif;--cp-spacer-0:0;--cp-spacer-1:0.25rem;--cp-spacer-2:0.5rem;--cp-spacer-3:1rem;--cp-spacer-4:1.5rem;--cp-spacer-5:2rem;--cp-spacer-6:3rem;--cp-border-width-1:1px;--cp-border-width-2:2px;--cp-border-width-3:3px;--cp-border-width-4:4px;--cp-border-width-5:5px;--cp-small-font-size:0.875em;--cp-main-menu-width:clamp(240px, 14.8vw, 320px);--cp-header-height:60px;--cp-stat-header-height:50px;--cp-current-viewport:xs}@media (min-width: 576px){:root{--cp-current-viewport:sm}}@media (min-width: 768px){:root{--cp-current-viewport:md}}@media (min-width: 992px){:root{--cp-current-viewport:lg}}@media (min-width: 1200px){:root{--cp-current-viewport:xl}}*,*::before,*::after{box-sizing:border-box}@media (prefers-reduced-motion: no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:var(--bs-body-font-family);font-size:var(--bs-body-font-size);font-weight:var(--bs-body-font-weight);line-height:var(--bs-body-line-height);color:var(--bs-body-color);text-align:var(--bs-body-text-align);background-color:var(--bs-body-bg);-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:rgba(0, 0, 0, 0)}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:0.25}hr:not([size]){height:1px}h6,h5,h4,h3,h2,h1{margin-top:0;margin-bottom:0.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.3125rem + 0.75vw)}@media (min-width: 1200px){h1{font-size:1.875rem}}h2{font-size:calc(1.2875rem + 0.45vw)}@media (min-width: 1200px){h2{font-size:1.625rem}}h3{font-size:calc(1.275rem + 0.3vw)}@media (min-width: 1200px){h3{font-size:1.5rem}}h4{font-size:calc(1.2625rem + 0.15vw)}@media (min-width: 1200px){h4{font-size:1.375rem}}h5{font-size:1.25rem}h6{font-size:1.125rem}p{margin-top:0;margin-bottom:1rem}abbr[title],abbr[data-bs-original-title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}[dir=\"ltr\"] ol,[dir=\"ltr\"] ul{padding-left:2rem}[dir=\"rtl\"] ol,[dir=\"rtl\"] ul{padding-right:2rem}ol,ul,dl{margin-top:0;margin-bottom:1rem}ol ol,ul ul,ol ul,ul ol{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:0.5rem}[dir=\"ltr\"] dd{margin-left:0}[dir=\"rtl\"] dd{margin-right:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:0.875em}mark{padding:0.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:0.75em;line-height:0;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}pre,code,kbd,samp{font-family:var(--cp-font-monospace);font-size:1em;direction:ltr ;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:0.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:0.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:0.2rem 0.4rem;font-size:0.875em;color:#fff;background-color:#212529;border-radius:0.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:0.5rem;padding-bottom:0.5rem;color:#6c757d}[dir=\"ltr\"] caption{text-align:left}[dir=\"rtl\"] caption{text-align:right}th{text-align:inherit;text-align:-webkit-match-parent}thead,tbody,tfoot,tr,td,th{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}input,button,select,optgroup,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button:not(:disabled),[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{width:100%;padding:0;margin-bottom:0.5rem;font-size:calc(1.275rem + 0.3vw);line-height:inherit}[dir=\"ltr\"] legend{float:left}[dir=\"rtl\"] legend{float:right}@media (min-width: 1200px){legend{font-size:1.5rem}}[dir=\"ltr\"] legend+*{clear:left}[dir=\"rtl\"] legend+*{clear:right}::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-text,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}[dir=\"rtl\"] [type=\"tel\"],[dir=\"rtl\"] [type=\"url\"],[dir=\"rtl\"] [type=\"email\"],[dir=\"rtl\"] [type=\"number\"]{direction:ltr}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::-webkit-file-upload-button{font:inherit}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none !important}:root{--cp-font-weight-semi-bold:600}a{color:#4259ed;text-decoration:none}a:hover{color:#384cc9;text-decoration:underline}input{font-size:1rem}h1{font-weight:300;margin-bottom:var(--cp-spacer-4)}h2{font-weight:400;margin-bottom:var(--cp-spacer-3)}h3,h4,h5{font-weight:500;margin-bottom:var(--cp-spacer-3)}h6{font-weight:700}:host{display:block}.cp-modal-content__container{font-weight:300;font-size:0.875rem}@media (max-width: 575.98px){.cp-modal-body{padding:0}}";

const CpWebmailConsentPrivacyModal$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
    this.saveActionCompleted = createEvent(this, "saveActionCompleted", 7);
    this.consentPrivacySaved = createEvent(this, "consentPrivacySaved", 7);
    this.consentPrivacySettings = {
      analytics: "off",
    };
    /**
     * Determines if the modal is open initially.
     */
    this.opened = false;
  }
  /**
   * Opens or closes the migration modal based on the given input.
   * @param state ModalState
   */
  async changeModalState(state) {
    var _a;
    await customElements.whenDefined("cp-modal");
    const modalEl = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector("cp-modal");
    if (state === ModalState.OPEN) {
      await modalEl.open();
    }
    else {
      await modalEl.close();
    }
  }
  async saveConsentPrivacySettings() {
    const request = new UapiRequest({
      namespace: "Personalization",
      method: "set",
      arguments: [new Argument("personalization", this.consentPrivacySettings)],
      config: {
        json: true,
      },
    });
    await UapiService.post(request)
      .then(uapiResponse => {
      if (uapiResponse.hasErrors) {
        throw uapiResponse.errors;
      }
      // The settings are saved. Fire an event called 'consentPrivacySaved'
      this.consentPrivacySaved.emit({
        analytics: this.consentPrivacySettings.analytics === "on" ? true : false,
      });
      return uapiResponse;
    })
      .catch(errors => {
      if (!Array.isArray(errors)) {
        errors = [errors];
      }
      errors.forEach(error => console.error(`Error saving consent and privacy settings: ${error.message}`));
    });
  }
  /**
   * Listens for the modal close event from the footer
   */
  captureConsentValue(consentValue) {
    this.consentPrivacySettings.analytics = consentValue.detail ? "on" : "off";
  }
  /**
   * Listens for the modal close event from the footer
   */
  async saveConsentPrivacyAndContinueHandler() {
    await this.saveConsentPrivacySettings()
      .then(() => {
      if (!!this.defaultWebmailApp) {
        const defaultApp = this.applicationList.find(app => app.key === this.defaultWebmailApp);
        if (defaultApp) {
          window.location.href = defaultApp.url;
        }
      }
      this.changeModalState(ModalState.CLOSE);
    }, err => {
      console.error("An error occurred when saving the consent and privacy settings: ", err);
    })
      .finally(() => {
      this.saveActionCompleted.emit();
    });
  }
  componentDidRender() {
    if (this.opened === true) {
      this.changeModalState(ModalState.OPEN);
    }
  }
  /**
   * StencilJS lifecycle. Gets values from state.
   */
  componentWillLoad() {
    this.applicationList = state.appList;
  }
  render() {
    return (h(Host, null, h("cp-style-reset", null, h("cp-dir", null, h("cp-modal", { "modal-aria-label": "webmailOboardingModalTitle", "hide-title": "true", "modal-size": ModalSize.lg, dismissable: false }, h("div", { id: "webmailOboardingModalContent", slot: "modal-content", class: "cp-modal-content__container" }, h("cp-webmail-consent-privacy-modal-body", null)), h("div", { id: "webmailOboardingModalFooter", slot: "modal-footer" }, h("cp-webmail-consent-privacy-modal-footer", null)))))));
  }
  get el() { return this; }
  static get style() { return cpWebmailConsentPrivacyModalCss; }
};

const cpWebmailConsentPrivacyModalBodyCss = "@charset \"UTF-8\";:root{--cp-font-weight-semi-bold:600}:root{--bs-blue:#0d6efd;--bs-indigo:#6610f2;--bs-purple:#6f42c1;--bs-pink:#d63384;--bs-red:#dc3545;--bs-orange:#fd7e14;--bs-yellow:#ffc107;--bs-green:#198754;--bs-teal:#20c997;--bs-cyan:#0dcaf0;--bs-white:#fff;--bs-gray:#6c757d;--bs-gray-dark:#343a40;--bs-gray-100:#f8f9fa;--bs-gray-200:#e9ecef;--bs-gray-300:#dee2e6;--bs-gray-400:#ced4da;--bs-gray-500:#adb5bd;--bs-gray-600:#6c757d;--bs-gray-700:#495057;--bs-gray-800:#343a40;--bs-gray-900:#212529;--bs-primary:#0d6efd;--bs-secondary:#6c757d;--bs-success:#198754;--bs-info:#0dcaf0;--bs-warning:#ffc107;--bs-danger:#dc3545;--bs-light:#f8f9fa;--bs-dark:#212529;--bs-primary-rgb:13, 110, 253;--bs-secondary-rgb:108, 117, 125;--bs-success-rgb:25, 135, 84;--bs-info-rgb:13, 202, 240;--bs-warning-rgb:255, 193, 7;--bs-danger-rgb:220, 53, 69;--bs-light-rgb:248, 249, 250;--bs-dark-rgb:33, 37, 41;--bs-white-rgb:255, 255, 255;--bs-black-rgb:0, 0, 0;--bs-body-color-rgb:8, 25, 62;--bs-body-bg-rgb:247, 248, 250;--bs-font-sans-serif:system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, \"Noto Sans\", \"Liberation Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\";--bs-font-monospace:SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;--bs-gradient:linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));--bs-body-font-family:var(--cp-font-family-roboto);--bs-body-font-size:1rem;--bs-body-font-weight:400;--bs-body-line-height:1.5;--bs-body-color:#08193e;--bs-body-bg:#F7F8FA}:root{--cp-font-family-roboto:“Roboto”, -apple-system, BlinkMacSystemFont, “Segoe UI”, “Oxygen”, “Ubuntu”, “Cantarell”, “Fira Sans”, “Droid Sans”, “Helvetica Neue”, sans-serif;--cp-spacer-0:0;--cp-spacer-1:0.25rem;--cp-spacer-2:0.5rem;--cp-spacer-3:1rem;--cp-spacer-4:1.5rem;--cp-spacer-5:2rem;--cp-spacer-6:3rem;--cp-border-width-1:1px;--cp-border-width-2:2px;--cp-border-width-3:3px;--cp-border-width-4:4px;--cp-border-width-5:5px;--cp-small-font-size:0.875em;--cp-main-menu-width:clamp(240px, 14.8vw, 320px);--cp-header-height:60px;--cp-stat-header-height:50px;--cp-current-viewport:xs}@media (min-width: 576px){:root{--cp-current-viewport:sm}}@media (min-width: 768px){:root{--cp-current-viewport:md}}@media (min-width: 992px){:root{--cp-current-viewport:lg}}@media (min-width: 1200px){:root{--cp-current-viewport:xl}}*,*::before,*::after{box-sizing:border-box}@media (prefers-reduced-motion: no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:var(--bs-body-font-family);font-size:var(--bs-body-font-size);font-weight:var(--bs-body-font-weight);line-height:var(--bs-body-line-height);color:var(--bs-body-color);text-align:var(--bs-body-text-align);background-color:var(--bs-body-bg);-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:rgba(0, 0, 0, 0)}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:0.25}hr:not([size]){height:1px}h6,h5,h4,h3,h2,h1,.cp-webmail-consent-privacy-modal__content-title{margin-top:0;margin-bottom:0.5rem;font-weight:500;line-height:1.2}h1,.cp-webmail-consent-privacy-modal__content-title{font-size:calc(1.3125rem + 0.75vw)}@media (min-width: 1200px){h1,.cp-webmail-consent-privacy-modal__content-title{font-size:1.875rem}}h2{font-size:calc(1.2875rem + 0.45vw)}@media (min-width: 1200px){h2{font-size:1.625rem}}h3{font-size:calc(1.275rem + 0.3vw)}@media (min-width: 1200px){h3{font-size:1.5rem}}h4{font-size:calc(1.2625rem + 0.15vw)}@media (min-width: 1200px){h4{font-size:1.375rem}}h5{font-size:1.25rem}h6{font-size:1.125rem}p{margin-top:0;margin-bottom:1rem}abbr[title],abbr[data-bs-original-title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}[dir=\"ltr\"] ol,[dir=\"ltr\"] ul{padding-left:2rem}[dir=\"rtl\"] ol,[dir=\"rtl\"] ul{padding-right:2rem}ol,ul,dl{margin-top:0;margin-bottom:1rem}ol ol,ul ul,ol ul,ul ol{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:0.5rem}[dir=\"ltr\"] dd{margin-left:0}[dir=\"rtl\"] dd{margin-right:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:0.875em}mark{padding:0.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:0.75em;line-height:0;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}pre,code,kbd,samp{font-family:var(--cp-font-monospace);font-size:1em;direction:ltr ;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:0.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:0.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:0.2rem 0.4rem;font-size:0.875em;color:#fff;background-color:#212529;border-radius:0.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:0.5rem;padding-bottom:0.5rem;color:#6c757d}[dir=\"ltr\"] caption{text-align:left}[dir=\"rtl\"] caption{text-align:right}th{text-align:inherit;text-align:-webkit-match-parent}thead,tbody,tfoot,tr,td,th{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}input,button,select,optgroup,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button:not(:disabled),[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{width:100%;padding:0;margin-bottom:0.5rem;font-size:calc(1.275rem + 0.3vw);line-height:inherit}[dir=\"ltr\"] legend{float:left}[dir=\"rtl\"] legend{float:right}@media (min-width: 1200px){legend{font-size:1.5rem}}[dir=\"ltr\"] legend+*{clear:left}[dir=\"rtl\"] legend+*{clear:right}::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-text,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}[dir=\"rtl\"] [type=\"tel\"],[dir=\"rtl\"] [type=\"url\"],[dir=\"rtl\"] [type=\"email\"],[dir=\"rtl\"] [type=\"number\"]{direction:ltr}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::-webkit-file-upload-button{font:inherit}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none !important}:root{--cp-font-weight-semi-bold:600}a{color:#4259ed;text-decoration:none}a:hover{color:#384cc9;text-decoration:underline}input{font-size:1rem}h1,.cp-webmail-consent-privacy-modal__content-title{font-weight:300;margin-bottom:var(--cp-spacer-4)}h2{font-weight:400;margin-bottom:var(--cp-spacer-3)}h3,h4,h5{font-weight:500;margin-bottom:var(--cp-spacer-3)}h6{font-weight:700}.container,.container-fluid,.container-xxl,.container-xl,.container-lg,.container-md,.container-sm{width:100%;padding-right:var(--bs-gutter-x, 0.75rem);padding-left:var(--bs-gutter-x, 0.75rem);margin-right:auto;margin-left:auto}@media (min-width: 576px){.container-sm,.container{max-width:540px}}@media (min-width: 768px){.container-md,.container-sm,.container{max-width:720px}}@media (min-width: 992px){.container-lg,.container-md,.container-sm,.container{max-width:960px}}@media (min-width: 1200px){.container-xl,.container-lg,.container-md,.container-sm,.container{max-width:1140px}}@media (min-width: 1400px){.container-xxl,.container-xl,.container-lg,.container-md,.container-sm,.container{max-width:1320px}}.row{--bs-gutter-x:1.5rem;--bs-gutter-y:0;display:flex;flex-wrap:wrap;margin-top:calc(-1 * var(--bs-gutter-y));margin-right:calc(-0.5 * var(--bs-gutter-x));margin-left:calc(-0.5 * var(--bs-gutter-x))}.row>*{flex-shrink:0;width:100%;max-width:100%;padding-right:calc(var(--bs-gutter-x) * 0.5);padding-left:calc(var(--bs-gutter-x) * 0.5);margin-top:var(--bs-gutter-y)}.col{flex:1 0 0%}.row-cols-auto>*{flex:0 0 auto;width:auto}.row-cols-1>*{flex:0 0 auto;width:100%}.row-cols-2>*{flex:0 0 auto;width:50%}.row-cols-3>*{flex:0 0 auto;width:33.3333333333%}.row-cols-4>*{flex:0 0 auto;width:25%}.row-cols-5>*{flex:0 0 auto;width:20%}.row-cols-6>*{flex:0 0 auto;width:16.6666666667%}.col-auto{flex:0 0 auto;width:auto}.col-1{flex:0 0 auto;width:8.33333333%}.col-2{flex:0 0 auto;width:16.66666667%}.col-3{flex:0 0 auto;width:25%}.col-4{flex:0 0 auto;width:33.33333333%}.col-5{flex:0 0 auto;width:41.66666667%}.col-6{flex:0 0 auto;width:50%}.col-7{flex:0 0 auto;width:58.33333333%}.col-8{flex:0 0 auto;width:66.66666667%}.col-9{flex:0 0 auto;width:75%}.col-10{flex:0 0 auto;width:83.33333333%}.col-11{flex:0 0 auto;width:91.66666667%}.col-12{flex:0 0 auto;width:100%}[dir=\"ltr\"] .offset-1{margin-left:8.33333333%}[dir=\"rtl\"] .offset-1{margin-right:8.33333333%}[dir=\"ltr\"] .offset-2{margin-left:16.66666667%}[dir=\"rtl\"] .offset-2{margin-right:16.66666667%}[dir=\"ltr\"] .offset-3{margin-left:25%}[dir=\"rtl\"] .offset-3{margin-right:25%}[dir=\"ltr\"] .offset-4{margin-left:33.33333333%}[dir=\"rtl\"] .offset-4{margin-right:33.33333333%}[dir=\"ltr\"] .offset-5{margin-left:41.66666667%}[dir=\"rtl\"] .offset-5{margin-right:41.66666667%}[dir=\"ltr\"] .offset-6{margin-left:50%}[dir=\"rtl\"] .offset-6{margin-right:50%}[dir=\"ltr\"] .offset-7{margin-left:58.33333333%}[dir=\"rtl\"] .offset-7{margin-right:58.33333333%}[dir=\"ltr\"] .offset-8{margin-left:66.66666667%}[dir=\"rtl\"] .offset-8{margin-right:66.66666667%}[dir=\"ltr\"] .offset-9{margin-left:75%}[dir=\"rtl\"] .offset-9{margin-right:75%}[dir=\"ltr\"] .offset-10{margin-left:83.33333333%}[dir=\"rtl\"] .offset-10{margin-right:83.33333333%}[dir=\"ltr\"] .offset-11{margin-left:91.66666667%}[dir=\"rtl\"] .offset-11{margin-right:91.66666667%}.g-0,.gx-0{--bs-gutter-x:0}.g-0,.gy-0{--bs-gutter-y:0}.g-1,.gx-1{--bs-gutter-x:0.25rem}.g-1,.gy-1{--bs-gutter-y:0.25rem}.g-2,.gx-2{--bs-gutter-x:0.5rem}.g-2,.gy-2{--bs-gutter-y:0.5rem}.g-3,.gx-3{--bs-gutter-x:1rem}.g-3,.gy-3{--bs-gutter-y:1rem}.g-4,.gx-4{--bs-gutter-x:1.5rem}.g-4,.gy-4{--bs-gutter-y:1.5rem}.g-5,.gx-5{--bs-gutter-x:2rem}.g-5,.gy-5{--bs-gutter-y:2rem}.g-6,.gx-6{--bs-gutter-x:3rem}.g-6,.gy-6{--bs-gutter-y:3rem}@media (min-width: 576px){.col-sm{flex:1 0 0%}.row-cols-sm-auto>*{flex:0 0 auto;width:auto}.row-cols-sm-1>*{flex:0 0 auto;width:100%}.row-cols-sm-2>*{flex:0 0 auto;width:50%}.row-cols-sm-3>*{flex:0 0 auto;width:33.3333333333%}.row-cols-sm-4>*{flex:0 0 auto;width:25%}.row-cols-sm-5>*{flex:0 0 auto;width:20%}.row-cols-sm-6>*{flex:0 0 auto;width:16.6666666667%}.col-sm-auto{flex:0 0 auto;width:auto}.col-sm-1{flex:0 0 auto;width:8.33333333%}.col-sm-2{flex:0 0 auto;width:16.66666667%}.col-sm-3{flex:0 0 auto;width:25%}.col-sm-4{flex:0 0 auto;width:33.33333333%}.col-sm-5{flex:0 0 auto;width:41.66666667%}.col-sm-6{flex:0 0 auto;width:50%}.col-sm-7{flex:0 0 auto;width:58.33333333%}.col-sm-8{flex:0 0 auto;width:66.66666667%}.col-sm-9{flex:0 0 auto;width:75%}.col-sm-10{flex:0 0 auto;width:83.33333333%}.col-sm-11{flex:0 0 auto;width:91.66666667%}.col-sm-12{flex:0 0 auto;width:100%}[dir=\"ltr\"] .offset-sm-0{margin-left:0}[dir=\"rtl\"] .offset-sm-0{margin-right:0}[dir=\"ltr\"] .offset-sm-1{margin-left:8.33333333%}[dir=\"rtl\"] .offset-sm-1{margin-right:8.33333333%}[dir=\"ltr\"] .offset-sm-2{margin-left:16.66666667%}[dir=\"rtl\"] .offset-sm-2{margin-right:16.66666667%}[dir=\"ltr\"] .offset-sm-3{margin-left:25%}[dir=\"rtl\"] .offset-sm-3{margin-right:25%}[dir=\"ltr\"] .offset-sm-4{margin-left:33.33333333%}[dir=\"rtl\"] .offset-sm-4{margin-right:33.33333333%}[dir=\"ltr\"] .offset-sm-5{margin-left:41.66666667%}[dir=\"rtl\"] .offset-sm-5{margin-right:41.66666667%}[dir=\"ltr\"] .offset-sm-6{margin-left:50%}[dir=\"rtl\"] .offset-sm-6{margin-right:50%}[dir=\"ltr\"] .offset-sm-7{margin-left:58.33333333%}[dir=\"rtl\"] .offset-sm-7{margin-right:58.33333333%}[dir=\"ltr\"] .offset-sm-8{margin-left:66.66666667%}[dir=\"rtl\"] .offset-sm-8{margin-right:66.66666667%}[dir=\"ltr\"] .offset-sm-9{margin-left:75%}[dir=\"rtl\"] .offset-sm-9{margin-right:75%}[dir=\"ltr\"] .offset-sm-10{margin-left:83.33333333%}[dir=\"rtl\"] .offset-sm-10{margin-right:83.33333333%}[dir=\"ltr\"] .offset-sm-11{margin-left:91.66666667%}[dir=\"rtl\"] .offset-sm-11{margin-right:91.66666667%}.g-sm-0,.gx-sm-0{--bs-gutter-x:0}.g-sm-0,.gy-sm-0{--bs-gutter-y:0}.g-sm-1,.gx-sm-1{--bs-gutter-x:0.25rem}.g-sm-1,.gy-sm-1{--bs-gutter-y:0.25rem}.g-sm-2,.gx-sm-2{--bs-gutter-x:0.5rem}.g-sm-2,.gy-sm-2{--bs-gutter-y:0.5rem}.g-sm-3,.gx-sm-3{--bs-gutter-x:1rem}.g-sm-3,.gy-sm-3{--bs-gutter-y:1rem}.g-sm-4,.gx-sm-4{--bs-gutter-x:1.5rem}.g-sm-4,.gy-sm-4{--bs-gutter-y:1.5rem}.g-sm-5,.gx-sm-5{--bs-gutter-x:2rem}.g-sm-5,.gy-sm-5{--bs-gutter-y:2rem}.g-sm-6,.gx-sm-6{--bs-gutter-x:3rem}.g-sm-6,.gy-sm-6{--bs-gutter-y:3rem}}@media (min-width: 768px){.col-md{flex:1 0 0%}.row-cols-md-auto>*{flex:0 0 auto;width:auto}.row-cols-md-1>*{flex:0 0 auto;width:100%}.row-cols-md-2>*{flex:0 0 auto;width:50%}.row-cols-md-3>*{flex:0 0 auto;width:33.3333333333%}.row-cols-md-4>*{flex:0 0 auto;width:25%}.row-cols-md-5>*{flex:0 0 auto;width:20%}.row-cols-md-6>*{flex:0 0 auto;width:16.6666666667%}.col-md-auto{flex:0 0 auto;width:auto}.col-md-1{flex:0 0 auto;width:8.33333333%}.col-md-2{flex:0 0 auto;width:16.66666667%}.col-md-3{flex:0 0 auto;width:25%}.col-md-4{flex:0 0 auto;width:33.33333333%}.col-md-5{flex:0 0 auto;width:41.66666667%}.col-md-6{flex:0 0 auto;width:50%}.col-md-7{flex:0 0 auto;width:58.33333333%}.col-md-8{flex:0 0 auto;width:66.66666667%}.col-md-9{flex:0 0 auto;width:75%}.col-md-10{flex:0 0 auto;width:83.33333333%}.col-md-11{flex:0 0 auto;width:91.66666667%}.col-md-12{flex:0 0 auto;width:100%}[dir=\"ltr\"] .offset-md-0{margin-left:0}[dir=\"rtl\"] .offset-md-0{margin-right:0}[dir=\"ltr\"] .offset-md-1{margin-left:8.33333333%}[dir=\"rtl\"] .offset-md-1{margin-right:8.33333333%}[dir=\"ltr\"] .offset-md-2{margin-left:16.66666667%}[dir=\"rtl\"] .offset-md-2{margin-right:16.66666667%}[dir=\"ltr\"] .offset-md-3{margin-left:25%}[dir=\"rtl\"] .offset-md-3{margin-right:25%}[dir=\"ltr\"] .offset-md-4{margin-left:33.33333333%}[dir=\"rtl\"] .offset-md-4{margin-right:33.33333333%}[dir=\"ltr\"] .offset-md-5{margin-left:41.66666667%}[dir=\"rtl\"] .offset-md-5{margin-right:41.66666667%}[dir=\"ltr\"] .offset-md-6{margin-left:50%}[dir=\"rtl\"] .offset-md-6{margin-right:50%}[dir=\"ltr\"] .offset-md-7{margin-left:58.33333333%}[dir=\"rtl\"] .offset-md-7{margin-right:58.33333333%}[dir=\"ltr\"] .offset-md-8{margin-left:66.66666667%}[dir=\"rtl\"] .offset-md-8{margin-right:66.66666667%}[dir=\"ltr\"] .offset-md-9{margin-left:75%}[dir=\"rtl\"] .offset-md-9{margin-right:75%}[dir=\"ltr\"] .offset-md-10{margin-left:83.33333333%}[dir=\"rtl\"] .offset-md-10{margin-right:83.33333333%}[dir=\"ltr\"] .offset-md-11{margin-left:91.66666667%}[dir=\"rtl\"] .offset-md-11{margin-right:91.66666667%}.g-md-0,.gx-md-0{--bs-gutter-x:0}.g-md-0,.gy-md-0{--bs-gutter-y:0}.g-md-1,.gx-md-1{--bs-gutter-x:0.25rem}.g-md-1,.gy-md-1{--bs-gutter-y:0.25rem}.g-md-2,.gx-md-2{--bs-gutter-x:0.5rem}.g-md-2,.gy-md-2{--bs-gutter-y:0.5rem}.g-md-3,.gx-md-3{--bs-gutter-x:1rem}.g-md-3,.gy-md-3{--bs-gutter-y:1rem}.g-md-4,.gx-md-4{--bs-gutter-x:1.5rem}.g-md-4,.gy-md-4{--bs-gutter-y:1.5rem}.g-md-5,.gx-md-5{--bs-gutter-x:2rem}.g-md-5,.gy-md-5{--bs-gutter-y:2rem}.g-md-6,.gx-md-6{--bs-gutter-x:3rem}.g-md-6,.gy-md-6{--bs-gutter-y:3rem}}@media (min-width: 992px){.col-lg{flex:1 0 0%}.row-cols-lg-auto>*{flex:0 0 auto;width:auto}.row-cols-lg-1>*{flex:0 0 auto;width:100%}.row-cols-lg-2>*{flex:0 0 auto;width:50%}.row-cols-lg-3>*{flex:0 0 auto;width:33.3333333333%}.row-cols-lg-4>*{flex:0 0 auto;width:25%}.row-cols-lg-5>*{flex:0 0 auto;width:20%}.row-cols-lg-6>*{flex:0 0 auto;width:16.6666666667%}.col-lg-auto{flex:0 0 auto;width:auto}.col-lg-1{flex:0 0 auto;width:8.33333333%}.col-lg-2{flex:0 0 auto;width:16.66666667%}.col-lg-3{flex:0 0 auto;width:25%}.col-lg-4{flex:0 0 auto;width:33.33333333%}.col-lg-5{flex:0 0 auto;width:41.66666667%}.col-lg-6{flex:0 0 auto;width:50%}.col-lg-7{flex:0 0 auto;width:58.33333333%}.col-lg-8{flex:0 0 auto;width:66.66666667%}.col-lg-9{flex:0 0 auto;width:75%}.col-lg-10{flex:0 0 auto;width:83.33333333%}.col-lg-11{flex:0 0 auto;width:91.66666667%}.col-lg-12{flex:0 0 auto;width:100%}[dir=\"ltr\"] .offset-lg-0{margin-left:0}[dir=\"rtl\"] .offset-lg-0{margin-right:0}[dir=\"ltr\"] .offset-lg-1{margin-left:8.33333333%}[dir=\"rtl\"] .offset-lg-1{margin-right:8.33333333%}[dir=\"ltr\"] .offset-lg-2{margin-left:16.66666667%}[dir=\"rtl\"] .offset-lg-2{margin-right:16.66666667%}[dir=\"ltr\"] .offset-lg-3{margin-left:25%}[dir=\"rtl\"] .offset-lg-3{margin-right:25%}[dir=\"ltr\"] .offset-lg-4{margin-left:33.33333333%}[dir=\"rtl\"] .offset-lg-4{margin-right:33.33333333%}[dir=\"ltr\"] .offset-lg-5{margin-left:41.66666667%}[dir=\"rtl\"] .offset-lg-5{margin-right:41.66666667%}[dir=\"ltr\"] .offset-lg-6{margin-left:50%}[dir=\"rtl\"] .offset-lg-6{margin-right:50%}[dir=\"ltr\"] .offset-lg-7{margin-left:58.33333333%}[dir=\"rtl\"] .offset-lg-7{margin-right:58.33333333%}[dir=\"ltr\"] .offset-lg-8{margin-left:66.66666667%}[dir=\"rtl\"] .offset-lg-8{margin-right:66.66666667%}[dir=\"ltr\"] .offset-lg-9{margin-left:75%}[dir=\"rtl\"] .offset-lg-9{margin-right:75%}[dir=\"ltr\"] .offset-lg-10{margin-left:83.33333333%}[dir=\"rtl\"] .offset-lg-10{margin-right:83.33333333%}[dir=\"ltr\"] .offset-lg-11{margin-left:91.66666667%}[dir=\"rtl\"] .offset-lg-11{margin-right:91.66666667%}.g-lg-0,.gx-lg-0{--bs-gutter-x:0}.g-lg-0,.gy-lg-0{--bs-gutter-y:0}.g-lg-1,.gx-lg-1{--bs-gutter-x:0.25rem}.g-lg-1,.gy-lg-1{--bs-gutter-y:0.25rem}.g-lg-2,.gx-lg-2{--bs-gutter-x:0.5rem}.g-lg-2,.gy-lg-2{--bs-gutter-y:0.5rem}.g-lg-3,.gx-lg-3{--bs-gutter-x:1rem}.g-lg-3,.gy-lg-3{--bs-gutter-y:1rem}.g-lg-4,.gx-lg-4{--bs-gutter-x:1.5rem}.g-lg-4,.gy-lg-4{--bs-gutter-y:1.5rem}.g-lg-5,.gx-lg-5{--bs-gutter-x:2rem}.g-lg-5,.gy-lg-5{--bs-gutter-y:2rem}.g-lg-6,.gx-lg-6{--bs-gutter-x:3rem}.g-lg-6,.gy-lg-6{--bs-gutter-y:3rem}}@media (min-width: 1200px){.col-xl{flex:1 0 0%}.row-cols-xl-auto>*{flex:0 0 auto;width:auto}.row-cols-xl-1>*{flex:0 0 auto;width:100%}.row-cols-xl-2>*{flex:0 0 auto;width:50%}.row-cols-xl-3>*{flex:0 0 auto;width:33.3333333333%}.row-cols-xl-4>*{flex:0 0 auto;width:25%}.row-cols-xl-5>*{flex:0 0 auto;width:20%}.row-cols-xl-6>*{flex:0 0 auto;width:16.6666666667%}.col-xl-auto{flex:0 0 auto;width:auto}.col-xl-1{flex:0 0 auto;width:8.33333333%}.col-xl-2{flex:0 0 auto;width:16.66666667%}.col-xl-3{flex:0 0 auto;width:25%}.col-xl-4{flex:0 0 auto;width:33.33333333%}.col-xl-5{flex:0 0 auto;width:41.66666667%}.col-xl-6{flex:0 0 auto;width:50%}.col-xl-7{flex:0 0 auto;width:58.33333333%}.col-xl-8{flex:0 0 auto;width:66.66666667%}.col-xl-9{flex:0 0 auto;width:75%}.col-xl-10{flex:0 0 auto;width:83.33333333%}.col-xl-11{flex:0 0 auto;width:91.66666667%}.col-xl-12{flex:0 0 auto;width:100%}[dir=\"ltr\"] .offset-xl-0{margin-left:0}[dir=\"rtl\"] .offset-xl-0{margin-right:0}[dir=\"ltr\"] .offset-xl-1{margin-left:8.33333333%}[dir=\"rtl\"] .offset-xl-1{margin-right:8.33333333%}[dir=\"ltr\"] .offset-xl-2{margin-left:16.66666667%}[dir=\"rtl\"] .offset-xl-2{margin-right:16.66666667%}[dir=\"ltr\"] .offset-xl-3{margin-left:25%}[dir=\"rtl\"] .offset-xl-3{margin-right:25%}[dir=\"ltr\"] .offset-xl-4{margin-left:33.33333333%}[dir=\"rtl\"] .offset-xl-4{margin-right:33.33333333%}[dir=\"ltr\"] .offset-xl-5{margin-left:41.66666667%}[dir=\"rtl\"] .offset-xl-5{margin-right:41.66666667%}[dir=\"ltr\"] .offset-xl-6{margin-left:50%}[dir=\"rtl\"] .offset-xl-6{margin-right:50%}[dir=\"ltr\"] .offset-xl-7{margin-left:58.33333333%}[dir=\"rtl\"] .offset-xl-7{margin-right:58.33333333%}[dir=\"ltr\"] .offset-xl-8{margin-left:66.66666667%}[dir=\"rtl\"] .offset-xl-8{margin-right:66.66666667%}[dir=\"ltr\"] .offset-xl-9{margin-left:75%}[dir=\"rtl\"] .offset-xl-9{margin-right:75%}[dir=\"ltr\"] .offset-xl-10{margin-left:83.33333333%}[dir=\"rtl\"] .offset-xl-10{margin-right:83.33333333%}[dir=\"ltr\"] .offset-xl-11{margin-left:91.66666667%}[dir=\"rtl\"] .offset-xl-11{margin-right:91.66666667%}.g-xl-0,.gx-xl-0{--bs-gutter-x:0}.g-xl-0,.gy-xl-0{--bs-gutter-y:0}.g-xl-1,.gx-xl-1{--bs-gutter-x:0.25rem}.g-xl-1,.gy-xl-1{--bs-gutter-y:0.25rem}.g-xl-2,.gx-xl-2{--bs-gutter-x:0.5rem}.g-xl-2,.gy-xl-2{--bs-gutter-y:0.5rem}.g-xl-3,.gx-xl-3{--bs-gutter-x:1rem}.g-xl-3,.gy-xl-3{--bs-gutter-y:1rem}.g-xl-4,.gx-xl-4{--bs-gutter-x:1.5rem}.g-xl-4,.gy-xl-4{--bs-gutter-y:1.5rem}.g-xl-5,.gx-xl-5{--bs-gutter-x:2rem}.g-xl-5,.gy-xl-5{--bs-gutter-y:2rem}.g-xl-6,.gx-xl-6{--bs-gutter-x:3rem}.g-xl-6,.gy-xl-6{--bs-gutter-y:3rem}}@media (min-width: 1400px){.col-xxl{flex:1 0 0%}.row-cols-xxl-auto>*{flex:0 0 auto;width:auto}.row-cols-xxl-1>*{flex:0 0 auto;width:100%}.row-cols-xxl-2>*{flex:0 0 auto;width:50%}.row-cols-xxl-3>*{flex:0 0 auto;width:33.3333333333%}.row-cols-xxl-4>*{flex:0 0 auto;width:25%}.row-cols-xxl-5>*{flex:0 0 auto;width:20%}.row-cols-xxl-6>*{flex:0 0 auto;width:16.6666666667%}.col-xxl-auto{flex:0 0 auto;width:auto}.col-xxl-1{flex:0 0 auto;width:8.33333333%}.col-xxl-2{flex:0 0 auto;width:16.66666667%}.col-xxl-3{flex:0 0 auto;width:25%}.col-xxl-4{flex:0 0 auto;width:33.33333333%}.col-xxl-5{flex:0 0 auto;width:41.66666667%}.col-xxl-6{flex:0 0 auto;width:50%}.col-xxl-7{flex:0 0 auto;width:58.33333333%}.col-xxl-8{flex:0 0 auto;width:66.66666667%}.col-xxl-9{flex:0 0 auto;width:75%}.col-xxl-10{flex:0 0 auto;width:83.33333333%}.col-xxl-11{flex:0 0 auto;width:91.66666667%}.col-xxl-12{flex:0 0 auto;width:100%}[dir=\"ltr\"] .offset-xxl-0{margin-left:0}[dir=\"rtl\"] .offset-xxl-0{margin-right:0}[dir=\"ltr\"] .offset-xxl-1{margin-left:8.33333333%}[dir=\"rtl\"] .offset-xxl-1{margin-right:8.33333333%}[dir=\"ltr\"] .offset-xxl-2{margin-left:16.66666667%}[dir=\"rtl\"] .offset-xxl-2{margin-right:16.66666667%}[dir=\"ltr\"] .offset-xxl-3{margin-left:25%}[dir=\"rtl\"] .offset-xxl-3{margin-right:25%}[dir=\"ltr\"] .offset-xxl-4{margin-left:33.33333333%}[dir=\"rtl\"] .offset-xxl-4{margin-right:33.33333333%}[dir=\"ltr\"] .offset-xxl-5{margin-left:41.66666667%}[dir=\"rtl\"] .offset-xxl-5{margin-right:41.66666667%}[dir=\"ltr\"] .offset-xxl-6{margin-left:50%}[dir=\"rtl\"] .offset-xxl-6{margin-right:50%}[dir=\"ltr\"] .offset-xxl-7{margin-left:58.33333333%}[dir=\"rtl\"] .offset-xxl-7{margin-right:58.33333333%}[dir=\"ltr\"] .offset-xxl-8{margin-left:66.66666667%}[dir=\"rtl\"] .offset-xxl-8{margin-right:66.66666667%}[dir=\"ltr\"] .offset-xxl-9{margin-left:75%}[dir=\"rtl\"] .offset-xxl-9{margin-right:75%}[dir=\"ltr\"] .offset-xxl-10{margin-left:83.33333333%}[dir=\"rtl\"] .offset-xxl-10{margin-right:83.33333333%}[dir=\"ltr\"] .offset-xxl-11{margin-left:91.66666667%}[dir=\"rtl\"] .offset-xxl-11{margin-right:91.66666667%}.g-xxl-0,.gx-xxl-0{--bs-gutter-x:0}.g-xxl-0,.gy-xxl-0{--bs-gutter-y:0}.g-xxl-1,.gx-xxl-1{--bs-gutter-x:0.25rem}.g-xxl-1,.gy-xxl-1{--bs-gutter-y:0.25rem}.g-xxl-2,.gx-xxl-2{--bs-gutter-x:0.5rem}.g-xxl-2,.gy-xxl-2{--bs-gutter-y:0.5rem}.g-xxl-3,.gx-xxl-3{--bs-gutter-x:1rem}.g-xxl-3,.gy-xxl-3{--bs-gutter-y:1rem}.g-xxl-4,.gx-xxl-4{--bs-gutter-x:1.5rem}.g-xxl-4,.gy-xxl-4{--bs-gutter-y:1.5rem}.g-xxl-5,.gx-xxl-5{--bs-gutter-x:2rem}.g-xxl-5,.gy-xxl-5{--bs-gutter-y:2rem}.g-xxl-6,.gx-xxl-6{--bs-gutter-x:3rem}.g-xxl-6,.gy-xxl-6{--bs-gutter-y:3rem}}.cp-webmail-consent-privacy-modal__content{margin-left:auto;margin-right:auto;max-width:90%}.cp-webmail-consent-privacy-modal__content-img-wrapper{width:100%;margin-bottom:var(--cp-spacer-4);position:relative;padding-top:20%}.cp-webmail-consent-privacy-modal__content-img-wrapper svg{height:100%;width:100%;position:absolute;margin-left:auto;margin-right:auto;left:0;right:0;top:0;text-align:center}.cp-webmail-consent-privacy-modal__content-title{color:#08193e;text-align:center;margin-bottom:var(--cp-spacer-3)}.cp-webmail-consent-privacy-modal__content-text{margin-bottom:var(--cp-spacer-4);padding:0 var(--cp-spacer-3)}.cp-webmail-consent-privacy-modal__content-row{justify-content:center}@media (max-width: 575.98px){.cp-webmail-consent-privacy-modal__content{max-width:100%}.cp-webmail-consent-privacy-modal__content-img-wrapper{display:none}}";

const locale$f = getLocaleInstance();
const CpWebmailConsentPrivacyModalBody$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.consentPrivacyImg = (h("svg", { xmlns: "http://www.w3.org/2000/svg", "data-name": "Layer 1", width: "942.54724", height: "631.43903", viewBox: "0 0 942.54724 631.43903" }, h("path", { d: "M879.59026,413.72015l2.79791-22.42655a30.28454,30.28454,0,0,1,60.10315,7.4984l-2.79791,22.42654a4.07267,4.07267,0,0,1-4.5404,3.53316l-52.02959-6.49115A4.07266,4.07266,0,0,1,879.59026,413.72015Z", transform: "translate(-128.72638 -134.28048)", fill: "#2f2e41" }), h("circle", { cx: "775.78648", cy: "263.92678", r: "22.20356", fill: "#ffb8b8" }), h("path", { d: "M875.05486,392.20076a23.98352,23.98352,0,0,1,26.73792-20.80636l4.48553.55961a23.98334,23.98334,0,0,1,20.80614,26.73789l-.056.44853-9.47894-1.18258-2.10358-9.45631L913.67,397.47385l-4.8988-.61117-1.06132-4.77116-.89618,4.52695-31.81482-3.96918Z", transform: "translate(-128.72638 -134.28048)", fill: "#2f2e41" }), h("path", { d: "M795.91611,477.41149a10.22784,10.22784,0,0,0,15.28426,3.51477L831.3673,492.74l10.16823-10.50441-28.71392-16.28326a10.28328,10.28328,0,0,0-16.9055,11.45917Z", transform: "translate(-128.72638 -134.28048)", fill: "#ffb8b8" }), h("path", { d: "M862.01251,498.63944c-14.87549,0-41.052-6.65918-42.50146-7.03125l-.45777-.11719,4.11988-20.85889,39.98193,7.897,21.7207-30.58692,24.93726-2.53515-.69605.916c-.32422.42676-32.46972,42.74317-37.47241,49.8418C870.38214,497.95585,866.77618,498.63944,862.01251,498.63944Z", transform: "translate(-128.72638 -134.28048)", fill: "#3f3d56" }), h("path", { d: "M866.00055,576.92752l-.59522-.28417c-.12671-.06055-12.76513-6.208-19.31128-18.209-6.51489-11.94434,23.98316-62.6123,26.1167-66.12793l.031-16.09082L883.213,446.59452l13.9917-7.90821L885.19171,466.7161Z", transform: "translate(-128.72638 -134.28048)", fill: "#3f3d56" }), h("polygon", { points: "723.257 615.591 709.885 615.59 703.523 564.011 723.259 564.012 723.257 615.591", fill: "#ffb8b8" }), h("path", { d: "M855.39347,762.83333l-43.11785-.00159v-.54537A16.78359,16.78359,0,0,1,829.05829,745.504h.00107l26.33491.00107Z", transform: "translate(-128.72638 -134.28048)", fill: "#2f2e41" }), h("polygon", { points: "866.891 603.872 854.184 608.035 832.077 561.002 850.832 554.857 866.891 603.872", fill: "#ffb8b8" }), h("path", { d: "M1002.89464,749.40842,961.92,762.83333l-.16982-.51825a16.78358,16.78358,0,0,1,10.72241-21.174l.001-.00033,25.02593-8.1994Z", transform: "translate(-128.72638 -134.28048)", fill: "#2f2e41" }), h("path", { d: "M969.72638,729.71952l-38.1205-63.64087L899.4256,598.08573l-28.95826,60.06054-11.50366,77.78809-40.343.56055.15893-.63086L880.51715,490.5535l48.352,7.22363-2.20093,31.916,1.31079,1.86426c10.92261,15.5166,22.21607,31.55957,15.73877,48.85351l18.36231,54.52246,40.64624,90.78614Z", transform: "translate(-128.72638 -134.28048)", fill: "#2f2e41" }), h("path", { d: "M882.72638,543.71952c-7.00635,0-15-8-10.853-21.65821l-.26855-.19433,9.96069-44.00781c-8.69263-12.43165,2.76807-22.69141,3.842-23.60791l5.4707-9.84717,24.1377-15.30811L927.22882,530.5701l-.18066.17285C918.2276,539.18241,888.60358,543.71952,882.72638,543.71952Z", transform: "translate(-128.72638 -134.28048)", fill: "var(--cp-graphic-color)" }), h("path", { d: "M932.15948,566.617a11.88134,11.88134,0,0,1-2.85131-.30176c-.93873-.23535-2.4585-1.43066-4.80689-9.07715-9.33618-30.39746-20.35913-121.86035-12.35083-130.81055l.18335-.20507,13.14893,2.1914c1.093-.80664,6.82861-4.81054,12.12133-4.11425a8.033,8.033,0,0,1,5.49659,3.249l.09057.11865,4.189,59.59424,15.34619,70.13086-.36792.167C961.46564,557.96561,942.303,566.617,932.15948,566.617Z", transform: "translate(-128.72638 -134.28048)", fill: "#3f3d56" }), h("path", { d: "M923.31655,543.32446a10.22788,10.22788,0,0,0,9.66238-12.35317l19.24856-13.25752-5.20361-13.66228-26.91975,19.104a10.28328,10.28328,0,0,0,3.21242,20.169Z", transform: "translate(-128.72638 -134.28048)", fill: "#ffb8b8" }), h("path", { d: "M945.876,528.3367l-17.14551-12.57324,24.10083-32.86426L934.33624,450.261l8.27466-23.66113.53467,1.019c.249.47461,24.94824,47.52686,29.25683,55.06738,4.48267,7.84375-24.97,43.76075-26.22583,45.28516Z", transform: "translate(-128.72638 -134.28048)", fill: "#3f3d56" }), h("path", { d: "M560.20614,676.255l-14.5923-6.1443-10.01026-73.15138H402.299L391.4486,669.81186l-13.05511,6.52746a3.10016,3.10016,0,0,0,1.38657,5.873H559.00349A3.1,3.1,0,0,0,560.20614,676.255Z", transform: "translate(-128.72638 -134.28048)", fill: "#e6e6e6" }), h("path", { d: "M797.09757,606.69181H142.26837a12.97344,12.97344,0,0,1-12.9443-12.97332V501.379h680.7178v92.33952A12.97357,12.97357,0,0,1,797.09757,606.69181Z", transform: "translate(-128.72638 -134.28048)", fill: "#ccc" }), h("path", { d: "M810.72638,545.02084h-682V149.91957A15.65719,15.65719,0,0,1,144.366,134.28048H795.08655a15.65736,15.65736,0,0,1,15.63983,15.63909Z", transform: "translate(-128.72638 -134.28048)", fill: "#3f3d56" }), h("path", { d: "M769.99322,516.34435H169.45954a12.07024,12.07024,0,0,1-12.057-12.05667v-329.274a12.07088,12.07088,0,0,1,12.057-12.05741H769.99322a12.07088,12.07088,0,0,1,12.057,12.05741v329.274A12.07024,12.07024,0,0,1,769.99322,516.34435Z", transform: "translate(-128.72638 -134.28048)", fill: "#fff" }), h("path", { d: "M638.14638,682.97542l-337.44822,0a1.56681,1.56681,0,0,1-1.53908-1.13363,1.52911,1.52911,0,0,1,1.47725-1.91893l337.385,0a1.61535,1.61535,0,0,1,1.61617,1.19368A1.52819,1.52819,0,0,1,638.14638,682.97542Z", transform: "translate(-128.72638 -134.28048)", fill: "#ccc" }), h("rect", { x: "489.85973", y: "81.90943", width: "144.99594", height: "110.7733", fill: "#f2f2f2" }), h("rect", { x: "497.0645", y: "87.41369", width: "130.58641", height: "99.76477", fill: "#fff" }), h("path", { d: "M693.37738,295.69477q.02592.00028.05185-.00109a34.81675,34.81675,0,0,0,.779-69.48892.79424.79424,0,0,0-.60112.20836.78592.78592,0,0,0-.25678.57553l-.7612,67.902a.79707.79707,0,0,0,.78826.80412Z", transform: "translate(-128.72638 -134.28048)", fill: "#3f3d56" }), h("path", { d: "M666.072,237.43291a1.02524,1.02524,0,0,1,.71962.30735l23.37584,23.90588a1.01418,1.01418,0,0,1,.29094.72511l-.36424,32.49143a1.01059,1.01059,0,0,1-.33018.73985,1.026,1.026,0,0,1-.77126.26782,35.04446,35.04446,0,0,1-23.69951-58.09062,1.02636,1.02636,0,0,1,.74091-.34658Q666.05306,237.4327,666.072,237.43291Z", transform: "translate(-128.72638 -134.28048)", fill: "#e6e6e6" }), h("path", { d: "M689.84193,225.9272a1.02931,1.02931,0,0,1,.69948.28585,1.01135,1.01135,0,0,1,.31394.74786l-.32864,29.31578a1.02077,1.02077,0,0,1-1.75041.70223L668.378,236.11808a1.02291,1.02291,0,0,1,.05493-1.48163,35.11806,35.11806,0,0,1,21.34564-8.708C689.79961,225.92739,689.82088,225.927,689.84193,225.9272Z", transform: "translate(-128.72638 -134.28048)", fill: "var(--cp-graphic-color)" }), h("path", { d: "M679.33353,309.77539a6.25343,6.25343,0,1,1-6.18294-6.32313A6.26054,6.26054,0,0,1,679.33353,309.77539Z", transform: "translate(-128.72638 -134.28048)", fill: "var(--cp-graphic-color)" }), h("path", { d: "M697.19935,309.97567a6.25343,6.25343,0,1,1-6.18294-6.32313A6.26056,6.26056,0,0,1,697.19935,309.97567Z", transform: "translate(-128.72638 -134.28048)", fill: "#3f3d56" }), h("path", { d: "M715.06516,310.176a6.25343,6.25343,0,1,1-6.18294-6.32314A6.26054,6.26054,0,0,1,715.06516,310.176Z", transform: "translate(-128.72638 -134.28048)", fill: "#e6e6e6" }), h("rect", { x: "488.33346", y: "210.11637", width: "144.99594", height: "110.7733", fill: "#f2f2f2" }), h("rect", { x: "495.53823", y: "215.62063", width: "130.58641", height: "99.76477", fill: "#fff" }), h("circle", { cx: "517.69473", cy: "242.98812", r: "5.42203", fill: "#3f3d56" }), h("path", { d: "M733.53881,373.0493a3.67713,3.67713,0,1,1,0,7.35425H676.51323a3.67712,3.67712,0,1,1,0-7.35425h57.02558m0-.9006H676.51323a4.57773,4.57773,0,1,0,0,9.15545h57.02558a4.57773,4.57773,0,1,0,0-9.15545Z", transform: "translate(-128.72638 -134.28048)", fill: "#3f3d56" }), h("path", { d: "M711.03754,381.30414h-42.9283a4.57772,4.57772,0,1,1,0-9.15544h42.9283a4.57772,4.57772,0,0,1,0,9.15544Z", transform: "translate(-128.72638 -134.28048)", fill: "var(--cp-graphic-color)" }), h("circle", { cx: "517.69473", cy: "265.50302", r: "5.42203", fill: "#3f3d56" }), h("path", { d: "M733.53881,395.5642a3.67713,3.67713,0,1,1,0,7.35425H676.51323a3.67712,3.67712,0,1,1,0-7.35425h57.02558m0-.9006H676.51323a4.57772,4.57772,0,1,0,0,9.15545h57.02558a4.57772,4.57772,0,1,0,0-9.15545Z", transform: "translate(-128.72638 -134.28048)", fill: "#3f3d56" }), h("path", { d: "M727.24826,403.819h-59.139a4.57772,4.57772,0,1,1,0-9.15544h59.139a4.57772,4.57772,0,0,1,0,9.15544Z", transform: "translate(-128.72638 -134.28048)", fill: "var(--cp-graphic-color)" }), h("circle", { cx: "517.69473", cy: "288.01792", r: "5.42203", fill: "#3f3d56" }), h("path", { d: "M733.53881,418.0791a3.67713,3.67713,0,1,1,0,7.35425H676.51323a3.67712,3.67712,0,1,1,0-7.35425h57.02558m0-.9006H676.51323a4.57772,4.57772,0,1,0,0,9.15545h57.02558a4.57772,4.57772,0,1,0,0-9.15545Z", transform: "translate(-128.72638 -134.28048)", fill: "#3f3d56" }), h("path", { d: "M692.125,426.33393H668.10924a4.57772,4.57772,0,1,1,0-9.15543H692.125a4.57772,4.57772,0,0,1,0,9.15543Z", transform: "translate(-128.72638 -134.28048)", fill: "var(--cp-graphic-color)" }), h("rect", { x: "51.18842", y: "101.50782", width: "405.09331", height: "207.61032", fill: "#f2f2f2" }), h("rect", { x: "64.69153", y: "111.82386", width: "378.08709", height: "186.97824", fill: "#fff" }), h("path", { d: "M524.61425,404.55724H248.996a.8626.8626,0,0,1-.86256-.86256V271.59086a.86256.86256,0,1,1,1.72512,0V402.83212H524.61425a.86256.86256,0,0,1,0,1.72512Z", transform: "translate(-128.72638 -134.28048)", fill: "#3f3d56" }), h("path", { d: "M307.88363,395.06909H282.81508a2.56336,2.56336,0,0,1-2.56051-2.5603V357.95166a2.56337,2.56337,0,0,1,2.56051-2.5603h25.06855a2.56337,2.56337,0,0,1,2.56051,2.5603v34.55713A2.56336,2.56336,0,0,1,307.88363,395.06909Z", transform: "translate(-128.72638 -134.28048)", fill: "var(--cp-graphic-color)" }), h("path", { d: "M353.59927,395.06909H328.53072a2.56336,2.56336,0,0,1-2.56051-2.5603V325.17441a2.56336,2.56336,0,0,1,2.56051-2.5603h25.06855a2.56336,2.56336,0,0,1,2.56051,2.5603v67.33438A2.56336,2.56336,0,0,1,353.59927,395.06909Z", transform: "translate(-128.72638 -134.28048)", fill: "var(--cp-graphic-color)" }), h("path", { d: "M399.31491,395.06909H374.24636a2.56337,2.56337,0,0,1-2.56051-2.5603V357.95166a2.56337,2.56337,0,0,1,2.56051-2.5603h25.06855a2.56337,2.56337,0,0,1,2.56052,2.5603v34.55713A2.56337,2.56337,0,0,1,399.31491,395.06909Z", transform: "translate(-128.72638 -134.28048)", fill: "var(--cp-graphic-color)" }), h("path", { d: "M445.03056,395.06909H419.962a2.50734,2.50734,0,0,1-2.56052-2.44431V312.12a2.50734,2.50734,0,0,1,2.56052-2.44431h25.06855a2.50734,2.50734,0,0,1,2.56051,2.44431v80.50475A2.50734,2.50734,0,0,1,445.03056,395.06909Z", transform: "translate(-128.72638 -134.28048)", fill: "var(--cp-graphic-color)" }), h("path", { d: "M490.7462,395.06909H465.67765a2.56336,2.56336,0,0,1-2.56051-2.5603V288.94692a2.56336,2.56336,0,0,1,2.56051-2.5603H490.7462a2.56336,2.56336,0,0,1,2.56051,2.5603V392.50879A2.56336,2.56336,0,0,1,490.7462,395.06909Z", transform: "translate(-128.72638 -134.28048)", fill: "var(--cp-graphic-color)" }), h("circle", { cx: "166.62298", cy: "205.58481", r: "5.17536", fill: "#3f3d56" }), h("circle", { cx: "212.33862", cy: "171.945", r: "5.17536", fill: "#3f3d56" }), h("circle", { cx: "258.05426", cy: "205.58481", r: "5.17536", fill: "#3f3d56" }), h("circle", { cx: "303.7699", cy: "155.55637", r: "5.17536", fill: "#3f3d56" }), h("circle", { cx: "349.48555", cy: "136.58007", r: "5.17536", fill: "#3f3d56" }), h("polygon", { points: "258.163 206.744 212.339 172.421 167.14 206.275 166.106 204.895 212.339 170.265 257.945 204.425 303.266 154.83 303.447 154.756 349.163 136.337 349.808 137.937 304.274 156.283 258.163 206.744", fill: "#3f3d56" }), h("path", { d: "M1070.27362,765.71952h-381a1,1,0,0,1,0-2h381a1,1,0,0,1,0,2Z", transform: "translate(-128.72638 -134.28048)", fill: "#ccc" })));
  }
  render() {
    return (h("div", { class: "cp-webmail-consent-privacy-modal__content" }, h("figure", { class: "cp-webmail-consent-privacy-modal__content-img-wrapper", role: "img", "aria-hidden": "true" }, this.consentPrivacyImg), h("div", { class: "cp-webmail-consent-privacy-modal__content-title" }, locale$f.maketext("Consent and Privacy[comment,title]")), h("cp-consent-privacy-settings", null)));
  }
  static get style() { return cpWebmailConsentPrivacyModalBodyCss; }
};

const cpWebmailConsentPrivacyModalFooterCss = "@charset \"UTF-8\";:root{--cp-font-weight-semi-bold:600}.cp-btn{display:inline-block;box-sizing:border-box;padding:0.375rem 0.75rem;border-radius:0.25rem;text-align:center;vertical-align:middle;text-decoration:none;font-size:0.875rem;font-weight:500;font-family:“Roboto”, -apple-system, BlinkMacSystemFont, “Segoe UI”, “Oxygen”, “Ubuntu”, “Cantarell”, “Fira Sans”, “Droid Sans”, “Helvetica Neue”, sans-serif;min-width:160px;}:lang(en) .cp-btn{text-transform:uppercase}.cp-btn--primary{background:#4259ed;color:#ffffff;border:1px solid #4259ed}.cp-btn--primary:hover:enabled,.cp-btn--primary:focus,.cp-btn--primary:active{background:#384cc9;border:1px solid #384cc9}.cp-btn--primary:disabled{background:#e6e9ef;color:#b3bccf;border:1px solid #b3bccf}.cp-btn--secondary{background:transparent;color:#4259ed;border:1px solid #4259ed}.cp-btn--secondary:hover:enabled,.cp-btn--secondary:focus:enabled,.cp-btn--secondary:active:enabled{background:#384cc9;color:#ffffff;border:1px solid #384cc9;text-decoration:none}.cp-btn--secondary:disabled{color:#b3bccf;border:1px solid #b3bccf}.cp-btn--link{background:transparent;border:transparent;min-width:initial}";

const locale$e = getLocaleInstance();
const CpWebmailConsentPrivacyModalFooter$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.saveConsentPrivacyAndContinue = createEvent(this, "saveConsentPrivacyAndContinue", 7);
  }
  /**
   * Listens for the modal close event from the footer
   */
  performActionsAftersaveCompleted() {
    if (this.btnSave) {
      this.btnSave.disabled = false;
      this.btnSave.classList.remove("disabled");
    }
  }
  /**
   * Handles button click event for 'Save and Continue'
   */
  handleBtnClick() {
    if (this.btnSave) {
      this.btnSave.disabled = true;
      this.btnSave.classList.add("disabled");
    }
    this.saveConsentPrivacyAndContinue.emit();
  }
  render() {
    return (h("button", { id: "btnSaveAndContinue", type: "button", class: "cp-btn cp-btn--primary", "data-bs-toggle": "button", onClick: () => this.handleBtnClick(), ref: btn => {
        this.btnSave = btn;
      } }, locale$e.maketext("Save and Continue")));
  }
  static get style() { return cpWebmailConsentPrivacyModalFooterCss; }
};

/*
# cpanel - ui/web-components/src/components/welcome-modal/welcome-modal-actions.ts
#                                                  Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
*/
var WelcomeModalActions;
(function (WelcomeModalActions) {
  WelcomeModalActions["Dismiss"] = "DISMISS";
  WelcomeModalActions["CreateWebsite"] = "CREATE-WEBSITE";
  WelcomeModalActions["AfterCreateWebsite"] = "AFTER-CREATE-WEBSITE";
  WelcomeModalActions["NextStep"] = "NEXT-STEP";
  WelcomeModalActions["RedirectToUrl"] = "REDIRECT-TO-URL";
})(WelcomeModalActions || (WelcomeModalActions = {}));

/*
# cpanel - ui/web-components/src/components/welcome-modal/site-install-status.enum.ts
#                                                  Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
*/
var SiteInstallStatus;
(function (SiteInstallStatus) {
  SiteInstallStatus[SiteInstallStatus["Started"] = 0] = "Started";
  SiteInstallStatus[SiteInstallStatus["InProgress"] = 1] = "InProgress";
  SiteInstallStatus[SiteInstallStatus["Success"] = 2] = "Success";
  SiteInstallStatus[SiteInstallStatus["Error"] = 3] = "Error";
})(SiteInstallStatus || (SiteInstallStatus = {}));

/*
# cpanel - ui/web-components/src/components/welcome-modal/welcome-modal-steps.enum.ts
#                                                  Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
*/
var WelcomeModalSteps;
(function (WelcomeModalSteps) {
  WelcomeModalSteps["StartingPoint"] = "starting-point";
  WelcomeModalSteps["WordpressInstall"] = "wp-install";
  WelcomeModalSteps["FinalScreen"] = "congrats";
})(WelcomeModalSteps || (WelcomeModalSteps = {}));

const cpWelcomeModalCss = "@charset \"UTF-8\";:root{--cp-font-weight-semi-bold:600}:root{--bs-blue:#0d6efd;--bs-indigo:#6610f2;--bs-purple:#6f42c1;--bs-pink:#d63384;--bs-red:#dc3545;--bs-orange:#fd7e14;--bs-yellow:#ffc107;--bs-green:#198754;--bs-teal:#20c997;--bs-cyan:#0dcaf0;--bs-white:#fff;--bs-gray:#6c757d;--bs-gray-dark:#343a40;--bs-gray-100:#f8f9fa;--bs-gray-200:#e9ecef;--bs-gray-300:#dee2e6;--bs-gray-400:#ced4da;--bs-gray-500:#adb5bd;--bs-gray-600:#6c757d;--bs-gray-700:#495057;--bs-gray-800:#343a40;--bs-gray-900:#212529;--bs-primary:#0d6efd;--bs-secondary:#6c757d;--bs-success:#198754;--bs-info:#0dcaf0;--bs-warning:#ffc107;--bs-danger:#dc3545;--bs-light:#f8f9fa;--bs-dark:#212529;--bs-primary-rgb:13, 110, 253;--bs-secondary-rgb:108, 117, 125;--bs-success-rgb:25, 135, 84;--bs-info-rgb:13, 202, 240;--bs-warning-rgb:255, 193, 7;--bs-danger-rgb:220, 53, 69;--bs-light-rgb:248, 249, 250;--bs-dark-rgb:33, 37, 41;--bs-white-rgb:255, 255, 255;--bs-black-rgb:0, 0, 0;--bs-body-color-rgb:8, 25, 62;--bs-body-bg-rgb:247, 248, 250;--bs-font-sans-serif:system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, \"Noto Sans\", \"Liberation Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\";--bs-font-monospace:SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;--bs-gradient:linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));--bs-body-font-family:var(--cp-font-family-roboto);--bs-body-font-size:1rem;--bs-body-font-weight:400;--bs-body-line-height:1.5;--bs-body-color:#08193e;--bs-body-bg:#F7F8FA}:root{--cp-font-family-roboto:“Roboto”, -apple-system, BlinkMacSystemFont, “Segoe UI”, “Oxygen”, “Ubuntu”, “Cantarell”, “Fira Sans”, “Droid Sans”, “Helvetica Neue”, sans-serif;--cp-spacer-0:0;--cp-spacer-1:0.25rem;--cp-spacer-2:0.5rem;--cp-spacer-3:1rem;--cp-spacer-4:1.5rem;--cp-spacer-5:2rem;--cp-spacer-6:3rem;--cp-border-width-1:1px;--cp-border-width-2:2px;--cp-border-width-3:3px;--cp-border-width-4:4px;--cp-border-width-5:5px;--cp-small-font-size:0.875em;--cp-main-menu-width:clamp(240px, 14.8vw, 320px);--cp-header-height:60px;--cp-stat-header-height:50px;--cp-current-viewport:xs}@media (min-width: 576px){:root{--cp-current-viewport:sm}}@media (min-width: 768px){:root{--cp-current-viewport:md}}@media (min-width: 992px){:root{--cp-current-viewport:lg}}@media (min-width: 1200px){:root{--cp-current-viewport:xl}}*,*::before,*::after{box-sizing:border-box}@media (prefers-reduced-motion: no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:var(--bs-body-font-family);font-size:var(--bs-body-font-size);font-weight:var(--bs-body-font-weight);line-height:var(--bs-body-line-height);color:var(--bs-body-color);text-align:var(--bs-body-text-align);background-color:var(--bs-body-bg);-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:rgba(0, 0, 0, 0)}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:0.25}hr:not([size]){height:1px}h6,h5,h4,h3,h2,h1,.cp-welcome-modal__content-title{margin-top:0;margin-bottom:0.5rem;font-weight:500;line-height:1.2}h1,.cp-welcome-modal__content-title{font-size:calc(1.3125rem + 0.75vw)}@media (min-width: 1200px){h1,.cp-welcome-modal__content-title{font-size:1.875rem}}h2{font-size:calc(1.2875rem + 0.45vw)}@media (min-width: 1200px){h2{font-size:1.625rem}}h3{font-size:calc(1.275rem + 0.3vw)}@media (min-width: 1200px){h3{font-size:1.5rem}}h4{font-size:calc(1.2625rem + 0.15vw)}@media (min-width: 1200px){h4{font-size:1.375rem}}h5{font-size:1.25rem}h6{font-size:1.125rem}p{margin-top:0;margin-bottom:1rem}abbr[title],abbr[data-bs-original-title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}[dir=\"ltr\"] ol,[dir=\"ltr\"] ul{padding-left:2rem}[dir=\"rtl\"] ol,[dir=\"rtl\"] ul{padding-right:2rem}ol,ul,dl{margin-top:0;margin-bottom:1rem}ol ol,ul ul,ol ul,ul ol{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:0.5rem}[dir=\"ltr\"] dd{margin-left:0}[dir=\"rtl\"] dd{margin-right:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:0.875em}mark{padding:0.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:0.75em;line-height:0;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}pre,code,kbd,samp{font-family:var(--cp-font-monospace);font-size:1em;direction:ltr ;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:0.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:0.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:0.2rem 0.4rem;font-size:0.875em;color:#fff;background-color:#212529;border-radius:0.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:0.5rem;padding-bottom:0.5rem;color:#6c757d}[dir=\"ltr\"] caption{text-align:left}[dir=\"rtl\"] caption{text-align:right}th{text-align:inherit;text-align:-webkit-match-parent}thead,tbody,tfoot,tr,td,th{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}input,button,select,optgroup,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button:not(:disabled),[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{width:100%;padding:0;margin-bottom:0.5rem;font-size:calc(1.275rem + 0.3vw);line-height:inherit}[dir=\"ltr\"] legend{float:left}[dir=\"rtl\"] legend{float:right}@media (min-width: 1200px){legend{font-size:1.5rem}}[dir=\"ltr\"] legend+*{clear:left}[dir=\"rtl\"] legend+*{clear:right}::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-text,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}[dir=\"rtl\"] [type=\"tel\"],[dir=\"rtl\"] [type=\"url\"],[dir=\"rtl\"] [type=\"email\"],[dir=\"rtl\"] [type=\"number\"]{direction:ltr}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::-webkit-file-upload-button{font:inherit}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none !important}:root{--cp-font-weight-semi-bold:600}a{color:#4259ed;text-decoration:none}a:hover{color:#384cc9;text-decoration:underline}input{font-size:1rem}h1,.cp-welcome-modal__content-title{font-weight:300;margin-bottom:var(--cp-spacer-4)}h2{font-weight:400;margin-bottom:var(--cp-spacer-3)}h3,h4,h5{font-weight:500;margin-bottom:var(--cp-spacer-3)}h6{font-weight:700}:root{--cp-font-weight-semi-bold:600}.cp-btn{display:inline-block;box-sizing:border-box;padding:0.375rem 0.75rem;border-radius:0.25rem;text-align:center;vertical-align:middle;text-decoration:none;font-size:0.875rem;font-weight:500;font-family:“Roboto”, -apple-system, BlinkMacSystemFont, “Segoe UI”, “Oxygen”, “Ubuntu”, “Cantarell”, “Fira Sans”, “Droid Sans”, “Helvetica Neue”, sans-serif;min-width:160px;}:lang(en) .cp-btn{text-transform:uppercase}.cp-btn--primary{background:#4259ed;color:#ffffff;border:1px solid #4259ed}.cp-btn--primary:hover:enabled,.cp-btn--primary:focus,.cp-btn--primary:active{background:#384cc9;border:1px solid #384cc9}.cp-btn--primary:disabled{background:#e6e9ef;color:#b3bccf;border:1px solid #b3bccf}.cp-btn--secondary{background:transparent;color:#4259ed;border:1px solid #4259ed}.cp-btn--secondary:hover:enabled,.cp-btn--secondary:focus:enabled,.cp-btn--secondary:active:enabled{background:#384cc9;color:#ffffff;border:1px solid #384cc9;text-decoration:none}.cp-btn--secondary:disabled{color:#b3bccf;border:1px solid #b3bccf}.cp-btn--link{background:transparent;border:transparent;min-width:initial}:host{display:block}.cp-welcome-modal__content{margin-left:auto;margin-right:auto;max-width:85%}.cp-modal-content__container{font-weight:300;font-size:0.875rem}.cp-welcome-modal__content-img-wrapper{width:100%;margin-bottom:var(--cp-spacer-3);position:relative;padding-top:28%}.cp-welcome-modal__content-img-wrapper svg{height:100%;width:100%;position:absolute;margin-left:auto;margin-right:auto;left:0;right:0;top:0;text-align:center}.cp-welcome-modal__content-title{color:#08193e;text-align:center;margin-bottom:var(--cp-spacer-4)}@media (max-width: 575.98px){.cp-modal-body{padding:0}.cp-welcome-modal__content{max-width:100%}}";

const CpWelcomeModal$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
    this.wordPressInstallPoll = createEvent(this, "wordPressInstallPoll", 7);
    /**
     * Determines if the modal is open initially.
     */
    this.opened = false;
    /**
     * Is true if the user is migrated to Jupiter theme by the system during upcp.
     */
    this.migratedToJupiter = false;
    /**
     * Array of steps for the modal to navigate.
     */
    this.steps = Object.keys(WelcomeModalSteps).map(key => WelcomeModalSteps[key]);
  }
  /*
   * Get the component reference of the current view's content.
   */
  get currentContentComponent() {
    switch (this.currentStep) {
      case WelcomeModalSteps.StartingPoint:
        return (h("cp-welcome-modal-starting-point", { "migrated-to-jupiter": this.migratedToJupiter }));
      case WelcomeModalSteps.WordpressInstall:
        return (h("cp-welcome-modal-wp-install", { "install-status": this.wpInstallStatus, "modal-status": this.opened }));
      case WelcomeModalSteps.FinalScreen:
        return h("cp-welcome-modal-congrats", { "install-status": this.wpInstallStatus });
    }
  }
  /*
   * Get the component reference of the current view's footer.
   */
  get currentFooterComponent() {
    switch (this.currentStep) {
      case WelcomeModalSteps.StartingPoint:
        return h("cp-welcome-modal-starting-point-footer", null);
      case WelcomeModalSteps.WordpressInstall:
        return h("cp-welcome-modal-wp-install-footer", null);
      case WelcomeModalSteps.FinalScreen:
        return (h("cp-welcome-modal-congrats-footer", { "install-status": this.wpInstallStatus }));
    }
  }
  /**
   * Watches for the modal opening to update the state.
   * @param newValue
   */
  openedChanged(newValue) {
    if (newValue !== true) {
      this.onClose();
    }
  }
  /**
   * Stencil lifecycle method.
   */
  componentWillLoad() {
    this.currentStep = this.steps[0];
  }
  /**
   * Stencil lifecycle method.
   */
  componentDidRender() {
    if (this.opened === true) {
      this.changeModalState(ModalState.OPEN);
    }
  }
  /**
   * Listens for a click event on any button in a welcome modal footer component.
   * @param event
   */
  onModalButtonClickedHandler(event) {
    var _a, _b, _c;
    switch ((_a = event.detail) === null || _a === void 0 ? void 0 : _a.modalAction) {
      case WelcomeModalActions.CreateWebsite:
        const status = (_b = event.detail) === null || _b === void 0 ? void 0 : _b.eventData;
        this.wpInstallStatus = status;
        if (status === SiteInstallStatus.Error || status === SiteInstallStatus.Success) {
          return (this.currentStep = WelcomeModalSteps.FinalScreen);
        }
      case WelcomeModalActions.AfterCreateWebsite:
        this.wpInstallStatus = (_c = event.detail) === null || _c === void 0 ? void 0 : _c.eventData;
        break;
      case WelcomeModalActions.Dismiss:
        return this.modalDismiss();
      case WelcomeModalActions.RedirectToUrl:
        return this.redirectToUrl(event.detail.redirectUrl);
    }
    this.advanceStep();
  }
  /**
   * Listening for the cp-modal close event.
   */
  modalDismiss() {
    this.opened = false;
  }
  /**
   * Selects the next step depending on the count.
   * @param count The method advances number of steps provide in this parameter.
   */
  advanceStep() {
    const currentStepIndex = this.steps.indexOf(this.currentStep);
    // If not at the last step then advance; else close the modal.
    if (currentStepIndex + 1 !== this.steps.length) {
      this.currentStep = this.steps[currentStepIndex + 1];
    }
    else {
      this.modalDismiss();
    }
  }
  /**
   * Selects the modal component then calls an component method to close or open the modal.
   * @param state ModalState
   */
  async changeModalState(state) {
    var _a;
    await customElements.whenDefined("cp-modal");
    const modalEl = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector("cp-modal");
    if (state === ModalState.OPEN) {
      await modalEl.open();
    }
    else {
      await modalEl.close();
    }
  }
  /**
   * Dismisses the welcome modal and saves the data then redirects the user to a provided URL
   * @param redirectUrl a URL to be redirected to. the directoryPrefix should not be included.
   */
  async redirectToUrl(redirectUrl = "") {
    // Save dismissal nvdata. Do not close as we need to redirect to wptoolkit
    await this.saveWelcomeModalDismissal();
    window.location.href = `${state.directoryPrefix}${redirectUrl ? redirectUrl : "index.html"}`;
  }
  /**
   * Methods to execute when the modal closes.
   */
  async onClose() {
    this.wordPressPollingOnClose();
    await this.saveWelcomeModalDismissal();
    this.changeModalState(ModalState.CLOSE);
  }
  /**
   * When the modal is closed determines if polling needs to continue and emits the necessary event.
   */
  wordPressPollingOnClose() {
    if (this.currentStep === WelcomeModalSteps.WordpressInstall) {
      this.wordPressInstallPoll.emit();
    }
  }
  /**
   * Saves user preferences when the modal is dismissed.
   * NVData entry: cp-welcome-panel_dismissed
   */
  async saveWelcomeModalDismissal() {
    const request = new UapiRequest({
      namespace: "Personalization",
      method: "set",
      arguments: [
        new Argument("personalization", {
          "cp-welcome-panel_dismissed": 1,
          "cp-migration-panel_dismissed": 1,
          "migrated_to_jupiter": 0,
        }),
      ],
      config: {
        json: true,
      },
    });
    await UapiService.post(request)
      .then(uapiResponse => {
      if (uapiResponse.hasErrors) {
        throw uapiResponse.errors;
      }
      return uapiResponse;
    })
      .catch(errors => {
      if (!Array.isArray(errors)) {
        errors = [errors];
      }
      errors.forEach(error => console.error(`Error saving welcome modal dismissal: ${error.message}`));
    });
  }
  /**
   * Render method
   */
  render() {
    return (h(Host, null, h("cp-style-reset", null, h("cp-dir", null, h("cp-modal", { "modal-aria-label": "welcomeModalTitle", "hide-title": "true", "modal-size": ModalSize.lg }, h("div", { id: "welcomeModalContent", slot: "modal-content", class: "cp-modal-content__container" }, h("div", { class: "cp-welcome-modal__content-items" }, this.currentContentComponent)), h("div", { id: "welcomeModalFooter", slot: "modal-footer" }, this.currentFooterComponent))))));
  }
  get el() { return this; }
  static get watchers() { return {
    "opened": ["openedChanged"]
  }; }
  static get style() { return cpWelcomeModalCss; }
};

/*
# Copyright 2023 cPanel, L.L.C. - All rights reserved.
# copyright@cpanel.net
# https://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
*/
// These app keys come from app keys used in dynamicui.conf files or for plugins in the install.json file.
var AppKeys;
(function (AppKeys) {
  AppKeys["WpToolkit"] = "wp-toolkit";
  AppKeys["BackupWizard"] = "backup_wizard";
  AppKeys["SitePublisher"] = "site_publisher";
  AppKeys["FileManager"] = "file_manager";
  AppKeys["Tools"] = "tools";
  AppKeys["Solutions"] = "solutions";
  AppKeys["Email"] = "email_accounts";
  AppKeys["PasswordSecurity"] = "change_password";
  AppKeys["Sitejet"] = "cpanel-sitejet-plugin";
})(AppKeys || (AppKeys = {}));

/*
# cpanel - ui/web-components/src/utils/app-feature-check.ts
#                                                  Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
*/
/**
 * Checks the state's appList for the existence of apps. This is used as a feature check until a better method can be implemented.
 * @param appNames List of appNames. The appName comes from the "file" key in dynamicui.conf
 * @returns AppEntry[]. Given a list of appNames, returns the AppEntry for those strings if the user has access to the feature.
 */
function appFeatureCheck(appNames) {
  return state.appList.filter(app => appNames.includes(app.key));
}

const cpWelcomeModalCongratsCss = ":root{--cp-font-weight-semi-bold:600}.list-unstyled{list-style:none}[dir=\"ltr\"] .list-unstyled{padding-left:0}[dir=\"rtl\"] .list-unstyled{padding-right:0}.next-steps__link{display:flex;align-items:center;padding:var(--cp-spacer-2);text-decoration:none}.next-steps__link:hover,.next-steps__link:focus,.next-steps__link:active{text-decoration:none}.next-steps__link-text{font-weight:400}[dir=\"ltr\"] .next-steps__link-text{padding-left:var(--cp-spacer-2)}[dir=\"rtl\"] .next-steps__link-text{padding-right:var(--cp-spacer-2)}.next-steps__link-text:hover,.next-steps__link-text:focus,.next-steps__link-text:active{text-decoration:underline}";

const locale$d = getLocaleInstance();
const CpWelcomeModalCongrats$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.modalButtonClick = createEvent(this, "modalButtonClick", 7);
    /**
     * Modal title. Defaults to success message
     */
    this.modalTitle = "";
    /**
     * The primary domain of the user.
     */
    this.primaryDomainUrl = "https://" + state.primaryDomain;
    /**
     * List of availble links to show on the congrats page.
     */
    this.nextLinks = [
      {
        key: AppKeys.PasswordSecurity,
        url: "",
        title: locale$d.maketext("Update your password and set your security preferences"),
        icon: "lock-2-line",
        show: false,
      },
      {
        key: AppKeys.Email,
        url: "",
        title: locale$d.maketext("Set up an email account with calendars and contacts"),
        icon: "mail-add-line",
        show: false,
      },
    ];
  }
  /**
   * Handles the click of the solution page link.
   */
  nextLinkClickHandler(url) {
    this.modalButtonClick.emit({ modalAction: WelcomeModalActions.RedirectToUrl, redirectUrl: url });
  }
  /**
   * Determines if a link is available to be shown to the user.
   */
  updateAvailableNextLinks() {
    const keys = this.nextLinks.map(app => app.key);
    const availableNextLinks = appFeatureCheck(keys);
    this.nextLinks.forEach(link => {
      const directoryPrefix = state.directoryPrefix;
      const nextLink = availableNextLinks.find(nextLink => nextLink.key === link.key);
      if (nextLink) {
        link.url = nextLink.url ? `${directoryPrefix}${nextLink.url}` : `${directoryPrefix}${link.url}`;
        link.show = true;
      }
    });
  }
  /**
   *  Creates markup for the link that is shown to the user.
   * @param link NextLink
   * @returns
   */
  renderNextLink(link) {
    return (h("li", null, h("a", { id: "lnkSolutions", href: "javascript:void(0)", class: "next-steps__link", target: "_self", onClick: () => this.nextLinkClickHandler(link.url) }, h("cp-icon", { name: link.icon, class: "next-steps__link-icon", size: IconSize.lg, mode: IconMode.Inline }), h("span", { class: "next-steps__link-text", innerHTML: link.title }))));
  }
  /**
   * Creates the markup for the entire success template to be shown in the modal.
   */
  getSuccessTemplate() {
    this.modalTitle = locale$d.maketext("Congratulations!");
    this.updateAvailableNextLinks();
    this.statusImg = (h("svg", { xmlns: "http://www.w3.org/2000/svg", "data-name": "Layer 1", width: "743.40429", height: "753.13373", viewBox: "0 0 743.40429 753.13373" }, h("title", null, this.modalTitle), h("path", { d: "M884.02338,360.16127C842.39655,196.47512,698.56275,78.31661,529.733,73.57737c-89.25523-2.50549-183.17665,27.0965-251.55836,130.68464-122.23971,185.175,7.51191,313.13661,97.97131,373.94142A566.02694,566.02694,0,0,1,493.14148,683.35864c61.10238,72.50779,178.64943,162.60891,318.64265,21.43431C913.25139,602.46943,911.751,469.19242,884.02338,360.16127Z", transform: "translate(-228.29785 -73.43313)", fill: "#f2f2f2" }), h("path", { d: "M955.20863,737.06376c0,32.26235-151.72264,89.50311-338.882,89.50311s-321.118-115.99853-321.118-148.26087,133.95866,31.42857,321.118,31.42857S955.20863,704.80141,955.20863,737.06376Z", transform: "translate(-228.29785 -73.43313)", fill: "#3f3d56" }), h("path", { d: "M955.20863,737.06376c0,32.26235-151.72264,89.50311-338.882,89.50311s-321.118-115.99853-321.118-148.26087,133.95866,31.42857,321.118,31.42857S955.20863,704.80141,955.20863,737.06376Z", transform: "translate(-228.29785 -73.43313)", opacity: "0.1" }), h("path", { d: "M955.20863,736.72215c0,32.26234-151.72264,58.41614-338.882,58.41614s-321.118-84.56995-321.118-116.83229,133.95866,0,321.118,0S955.20863,704.4598,955.20863,736.72215Z", transform: "translate(-228.29785 -73.43313)", fill: "#3f3d56" }), h("g", { opacity: "0.7" }, h("path", { d: "M943.99062,249.26589c-12.292,23.85838-51.25117,51.97188-75.10956,39.67987s-23.58129-60.33479-11.28929-84.19317a48.59577,48.59577,0,0,1,86.39885,44.5133Z", transform: "translate(-228.29785 -73.43313)", fill: "var(--cp-graphic-color)" }), h("path", { d: "M870.89964,295.25478a8.05032,8.05032,0,0,0-8.32759-4.29044l4.29043-8.3276,8.3276,4.29044Z", transform: "translate(-228.29785 -73.43313)", fill: "var(--cp-graphic-color)" }), h("path", { d: "M864.83,286.63541a10.30467,10.30467,0,0,0,8.36009,4.26389", transform: "translate(-228.29785 -73.43313)", fill: "none", stroke: "#2f2e41", "stroke-miterlimit": "10", "stroke-width": "2" }), h("ellipse", { cx: "928.13292", cy: "218.04387", rx: "12.29531", ry: "10.2461", transform: "translate(80.9232 869.8155) rotate(-62.74216)", fill: "#fff", opacity: "0.4" }), h("line", { x1: "640.35992", y1: "215.81139", x2: "604.10504", y2: "307.04377", fill: "none", stroke: "#2f2e41", "stroke-miterlimit": "10", "stroke-width": "2" })), h("path", { d: "M951.644,395.61836c-26.91169,27.1498-91.8722,48.66484-119.022,21.75315s-6.20783-92.05921,20.70387-119.209A69.21723,69.21723,0,0,1,951.644,395.61836Z", transform: "translate(-228.29785 -73.43313)", fill: "#ff6584" }), h("path", { d: "M832.66353,426.8064a11.46647,11.46647,0,0,0-9.47645-9.39334l9.39334-9.47644,9.47645,9.39333Z", transform: "translate(-228.29785 -73.43313)", fill: "#ff6584" }), h("path", { d: "M828.10753,412.49875a14.67743,14.67743,0,0,0,9.532,9.37117", transform: "translate(-228.29785 -73.43313)", fill: "none", stroke: "#2f2e41", "stroke-miterlimit": "10", "stroke-width": "2" }), h("line", { x1: "602.51563", y1: "346.22772", x2: "513.27994", y2: "436.25297", fill: "none", stroke: "#2f2e41", "stroke-miterlimit": "10", "stroke-width": "2" }), h("ellipse", { cx: "943.46642", cy: "346.41508", rx: "17.51279", ry: "14.594", transform: "translate(-195.04707 699.17413) rotate(-45.25236)", fill: "#fff", opacity: "0.4" }), h("path", { d: "M867.5301,307.663c-8.86788,37.18484-53.16533,89.34326-90.35016,80.47538s-53.17592-75.404-44.308-112.58879A69.21723,69.21723,0,0,1,867.5301,307.663Z", transform: "translate(-228.29785 -73.43313)", fill: "var(--cp-graphic-color)" }), h("path", { d: "M782.12185,396.17556a11.46645,11.46645,0,0,0-12.9791-3.09527l3.09527-12.9791,12.9791,3.09526Z", transform: "translate(-228.29785 -73.43313)", fill: "var(--cp-graphic-color)" }), h("path", { d: "M770.79,386.324a14.6774,14.6774,0,0,0,13.015,3.04747", transform: "translate(-228.29785 -73.43313)", fill: "none", stroke: "#2f2e41", "stroke-miterlimit": "10", "stroke-width": "2" }), h("ellipse", { cx: "834.95809", cy: "269.88867", rx: "17.51279", ry: "14.594", transform: "translate(150.44384 946.02975) rotate(-76.58659)", fill: "#fff", opacity: "0.4" }), h("line", { x1: "548.67563", y1: "317.585", x2: "519.27091", y2: "440.8851", fill: "none", stroke: "#2f2e41", "stroke-miterlimit": "10", "stroke-width": "2" }), h("g", { opacity: "0.8" }, h("path", { d: "M455.36207,633.71133c-19.33018,18.81-65.42983,33.16077-84.23986,13.83059s-3.20748-65.02133,16.12269-83.83137a48.83661,48.83661,0,0,1,68.11717,70.00078Z", transform: "translate(-228.29785 -73.43313)", fill: "var(--cp-graphic-color)" }), h("path", { d: "M371.03143,654.1982a8.09023,8.09023,0,0,0-6.56551-6.74706l6.74706-6.56551,6.56551,6.74706Z", transform: "translate(-228.29785 -73.43313)", fill: "var(--cp-graphic-color)" }), h("path", { d: "M367.99956,644.047a10.35577,10.35577,0,0,0,6.60494,6.73213", transform: "translate(-228.29785 -73.43313)", fill: "none", stroke: "#2f2e41", "stroke-miterlimit": "10", "stroke-width": "2" }), h("ellipse", { cx: "450.21956", cy: "598.89724", rx: "12.35625", ry: "10.29687", transform: "translate(-518.41331 410.22687) rotate(-44.21867)", fill: "#fff", opacity: "0.4" })), h("path", { d: "M436.85861,163.88584h13.58021a33.5923,33.5923,0,0,1,33.5923,33.5923v47.17251a0,0,0,0,1,0,0H403.2663a0,0,0,0,1,0,0V197.47815A33.5923,33.5923,0,0,1,436.85861,163.88584Z", fill: "#2f2e41" }), h("path", { d: "M626.60927,447.61614,616.41655,469.0459s-8.30778,28.788,1.10579,31.8654,11.25109-29.542,11.25109-29.542l7.79675-21.6001Z", transform: "translate(-228.29785 -73.43313)", fill: "#ffb9b9" }), h("path", { d: "M626.60927,447.61614,616.41655,469.0459s-8.30778,28.788,1.10579,31.8654,11.25109-29.542,11.25109-29.542l7.79675-21.6001Z", transform: "translate(-228.29785 -73.43313)", opacity: "0.1" }), h("polygon", { points: "400.242 340.643 387.351 385.76 407.762 396.502 407.762 342.791 400.242 340.643", fill: "#575a89" }), h("path", { d: "M663.452,294.30051s-1.07422,17.18751-3.22266,17.18751-6.44531,20.41016-6.44531,20.41016l18.26172,11.81641,22.5586-20.41016L688.159,307.19114s-3.22266-6.44531-2.14844-12.89063S663.452,294.30051,663.452,294.30051Z", transform: "translate(-228.29785 -73.43313)", fill: "#ffb9b9" }), h("path", { d: "M663.452,294.30051s-1.07422,17.18751-3.22266,17.18751-6.44531,20.41016-6.44531,20.41016l18.26172,11.81641,22.5586-20.41016L688.159,307.19114s-3.22266-6.44531-2.14844-12.89063S663.452,294.30051,663.452,294.30051Z", transform: "translate(-228.29785 -73.43313)", opacity: "0.1" }), h("path", { d: "M731.1278,465.10135l2.14844,23.63282s7.51954,29.00392,17.18751,26.85548-5.3711-31.15236-5.3711-31.15236l-4.29687-22.5586Z", transform: "translate(-228.29785 -73.43313)", fill: "#ffb9b9" }), h("path", { d: "M684.93638,698.2069s6.44532,39.7461,2.14844,47.26564,4.29688,8.59375,4.29688,8.59375L717.163,747.621V735.80456s-8.59376-38.67188-8.59376-40.82032S684.93638,698.2069,684.93638,698.2069Z", transform: "translate(-228.29785 -73.43313)", fill: "#ffb9b9" }), h("path", { d: "M632.29965,519.88653s7.51953,77.34377,19.33594,102.05081,22.5586,92.38284,27.9297,93.45706,46.19142-6.44531,51.56251-10.74219-36.52345-108.49613-36.52345-109.57035-9.668-96.67972-9.668-96.67972l-12.89063-21.48438Z", transform: "translate(-228.29785 -73.43313)", fill: "#2f2e41" }), h("path", { d: "M632.29965,519.88653s7.51953,77.34377,19.33594,102.05081,22.5586,92.38284,27.9297,93.45706,46.19142-6.44531,51.56251-10.74219-36.52345-108.49613-36.52345-109.57035-9.668-96.67972-9.668-96.67972l-12.89063-21.48438Z", transform: "translate(-228.29785 -73.43313)", opacity: "0.1" }), h("path", { d: "M694.60435,743.3241s-10.74219-5.3711-12.89063-2.14844L673.12,754.06629s-36.52345,17.1875-23.63282,19.33594,37.59767,2.14844,40.82033,0,38.67189-21.48438,37.59767-22.5586-9.668-23.63282-10.74219-21.48438S701.04967,747.621,694.60435,743.3241Z", transform: "translate(-228.29785 -73.43313)", fill: "#2f2e41" }), h("path", { d: "M514.13555,652.01547s-24.707,17.18751-36.52345,13.96485,0,23.63282,0,23.63282l21.48438,11.81641,6.44531-5.37109s22.5586-30.07814,32.22658-31.15236S514.13555,652.01547,514.13555,652.01547Z", transform: "translate(-228.29785 -73.43313)", fill: "#ffb9b9" }), h("path", { d: "M625.85433,455.43338l4.29688,22.5586L549.58478,600.453s-48.33986,48.33986-44.043,53.711,31.15236,36.52345,37.59767,32.22658S698.90123,520.96074,697.827,499.47636s-36.52345-62.30471-36.52345-62.30471l-35.44923,16.11329Z", transform: "translate(-228.29785 -73.43313)", fill: "#2f2e41" }), h("path", { d: "M482.98319,673.49986s9.668-10.74219,4.29688-11.81641a160.38968,160.38968,0,0,0-18.26173-2.14844c-2.14844,0-31.15235-15.03907-33.30079-9.668s12.89063,33.30079,21.48438,36.52345S496.948,712.17174,496.948,712.17174s16.11329-13.96484,13.96485-17.1875S478.68631,685.31627,482.98319,673.49986Z", transform: "translate(-228.29785 -73.43313)", fill: "#2f2e41" }), h("circle", { cx: "443.7479", cy: "205.82831", r: "25.78126", fill: "#ffb9b9" }), h("path", { d: "M677.41685,317.93333s-18.26173,1.07422-23.63282-2.14843-17.18751,44.043-17.18751,44.043L629.077,422.13259s-1.07422,7.51953,0,11.81641-10.74219-2.14844-6.44532,9.668-3.22265,17.1875,4.29688,18.26172,47.26564-15.03906,47.26564-15.03906l18.26173-95.6055,5.37109-38.67189Z", transform: "translate(-228.29785 -73.43313)", fill: "#d0cde1" }), h("path", { d: "M661.53142,309.20666s-9.89583-2.01552-13.11849.13292-15.03906,18.26173-15.03906,22.5586-4.29688,51.56252-4.29688,55.8594-3.22266,26.85547-3.22266,29.00391,2.75539,11.38223,2.75539,11.38223l6.91258-12.45645s-2.14843-16.11328,5.3711-41.89454S661.53142,309.20666,661.53142,309.20666Z", transform: "translate(-228.29785 -73.43313)", fill: "#575a89" }), h("path", { d: "M672.04575,325.45287s14.35058-22.5586,15.23193-20.41016,16.99465,5.37109,16.99465,5.37109,29.00391,20.41016,26.85547,29.00392-17.1875,73.0469-17.1875,73.0469-13.96485,33.30079-3.22266,56.93361-2.14844,32.22657-2.14844,32.22657-8.59375,4.29688-6.44531,8.59375-24.707,20.41017-27.9297,8.59376-42.96876-82.71487-34.375-108.49613S672.04575,325.45287,672.04575,325.45287Z", transform: "translate(-228.29785 -73.43313)", fill: "#575a89" }), h("path", { d: "M725.75671,336.19506s11.81641,22.5586,9.668,25.78126,7.51953,22.5586,7.51953,22.5586a7.4393,7.4393,0,0,0,0,5.37109c1.07422,3.22266,7.51954,17.18751,7.51954,22.55861s-1.07422,22.5586,0,30.07813,15.03906,25.78126,3.22265,26.85548-31.15235,10.74219-30.07813,0,4.29688-36.52345,0-40.82033-7.51953-4.29687-5.3711-9.668-9.668-19.33594-9.668-19.33594Z", transform: "translate(-228.29785 -73.43313)", fill: "#575a89" }), h("polygon", { points: "465.29 199.477 424.514 199.477 415.281 178.259 472.215 178.259 465.29 199.477", fill: "#2f2e41" }), h("ellipse", { cx: "645.93755", cy: "283.17697", rx: "2.05334", ry: "5.47558", transform: "translate(-281.58989 117.53485) rotate(-16.16012)", fill: "#ffb9b9" }), h("ellipse", { cx: "697.27112", cy: "283.17697", rx: "5.47558", ry: "2.05334", transform: "translate(2.919 800.6496) rotate(-73.83988)", fill: "#ffb9b9" }), h("path", { d: "M940.20863,692.41188c0,24.9524-14.83239,33.66445-33.13,33.66445-.42525,0-.85051-.00575-1.27008-.0115q-1.27575-.03447-2.517-.12066c-16.51615-1.16661-29.34292-10.32692-29.34292-33.53229,0-24.00988,30.67613-54.30675,32.99209-56.55946a.00563.00563,0,0,0,.00575-.00575c.08621-.08047.13216-.12641.13216-.12641S940.20863,667.45952,940.20863,692.41188Z", transform: "translate(-228.29785 -73.43313)", fill: "#f2f2f2" }), h("path", { d: "M905.87182,722.26048l12.11411-16.92989-12.14287,18.78612-.03452,1.94812q-1.27575-.03447-2.517-.12066l1.30452-24.95812-.01151-.1954.023-.03448.12641-2.3619-12.17739-18.8321,12.21184,17.06209.02876.50571.98842-18.86082L895.361,658.80492l10.55109,16.14835,1.02862-39.10085.00575-.13216v.12641l-.17236,30.83706,10.37858-12.22334-10.4246,14.87833-.27008,16.88966,9.689-16.2058-9.72927,18.6884-.15517,9.3902,14.068-22.556-14.11972,25.83163Z", transform: "translate(-228.29785 -73.43313)", fill: "#3f3d56" })));
    return (h("div", { class: "cp-welcome-modal__content" }, h("figure", { id: "imgCongratsSuccess", class: "cp-welcome-modal__content-img-wrapper", role: "img", "aria-label": locale$d.maketext("Success") }, this.statusImg), h("div", { id: "lblCongratsViewSuccess", class: "cp-welcome-modal__content-title", innerHTML: this.modalTitle }), h("p", { id: "successDescText", innerHTML: locale$d.maketext("Your website is ready. Start adding content and personalizing “[output,strong,_1]” now.", state.primaryDomain) }), h("div", null, h("ul", { class: "list-unstyled" }, h("li", null, h("a", { id: "lnkPreview", href: this.primaryDomainUrl, target: "primarySite", class: "next-steps__link" }, h("cp-icon", { name: "external-link-line", class: "next-steps__link-icon", size: IconSize.lg, mode: IconMode.Inline }), h("span", { class: "next-steps__link-text", innerHTML: locale$d.maketext("Preview your site [_1][comment,link title with domain name.]", state.primaryDomain) }))), this.nextLinks.map(link => {
      if (link.show) {
        return this.renderNextLink(link);
      }
    })))));
  }
  /**
   * Creates the markup for the entire error template to be shown in the modal.
   */
  getErrorTemplate() {
    // Modal title when wp install failed
    this.modalTitle = locale$d.maketext("Oh no!");
    // Modal image when wp install failed
    this.statusImg = (h("svg", { xmlns: "http://www.w3.org/2000/svg", "data-name": "Layer 1", width: "1032.24", height: "832.63", viewBox: "0 0 1032.24 832.63" }, h("defs", null, h("linearGradient", { id: "fb7ae7e0-1793-4d3b-a6c6-7b51ed07a232-368", x1: "86.9", y1: "457.32", x2: "402.8", y2: "457.32", gradientUnits: "userSpaceOnUse" }, h("stop", { offset: "0", "stop-color": "gray", "stop-opacity": "0.25" }), h("stop", { offset: "0.54", "stop-color": "gray", "stop-opacity": "0.12" }), h("stop", { offset: "1", "stop-color": "gray", "stop-opacity": "0.1" })), h("linearGradient", { id: "26387a05-323e-43c3-b271-53af00551daf-369", x1: "3013.29", y1: "358.28", x2: "3255.1", y2: "358.28", gradientTransform: "matrix(-1, 0, 0, 1, 3342, 0)" })), h("title", null, locale$d.maketext("Error")), h("ellipse", { cx: "530.99", cy: "416.32", rx: "466.48", ry: "416.32", fill: "var(--cp-graphic-color)", opacity: "0.1" }), h("ellipse", { cx: "172", cy: "629.28", rx: "172", ry: "26.66", fill: "var(--cp-graphic-color)", opacity: "0.1" }), h("ellipse", { cx: "254.67", cy: "769.13", rx: "66.9", ry: "13.82", fill: "var(--cp-graphic-color)", opacity: "0.1" }), h("ellipse", { cx: "711.8", cy: "715.96", rx: "66.9", ry: "13.82", fill: "var(--cp-graphic-color)", opacity: "0.1" }), h("ellipse", { cx: "484.79", cy: "699.75", rx: "108.79", ry: "18.43", fill: "var(--cp-graphic-color)", opacity: "0.1" }), h("ellipse", { cx: "805.34", cy: "608.52", rx: "226.91", ry: "35.54", fill: "var(--cp-graphic-color)", opacity: "0.1" }), h("path", { d: "M130.91,580.17a63.14,63.14,0,0,0,3.29,63.39c2,3,3.84,5.16,5.31,5.73,7.05,2.77,21.17,9.58,21.17,9.58l34-13.36s5.52-29.2,10.74-54.27v0c3.56-17.1,7-32.27,8.41-34.93,3.52-6.55,0-77.86,0-77.86s-34-2.28-43.35,23.93l-4.09,8Z", transform: "translate(-83.88 -33.68)", fill: "#a8a8a8" }), h("path", { d: "M176.05,588.05c20.67,23.69,29.39,3.2,29.39,3.2h0v0c3.56-17.1,7-32.27,8.41-34.93,3.52-6.55,0-77.86,0-77.86s-34-2.28-43.35,23.93l-4.09,8C163.79,531.36,161.2,571,176.05,588.05Z", transform: "translate(-83.88 -33.68)", fill: "#fff", opacity: "0.1" }), h("path", { d: "M180.59,654.08l120-13.86L322,499.34l-16.19-36.59a148.26,148.26,0,0,0-28-42.24c-8.15-8.59-18-16.85-28.36-21a42.56,42.56,0,0,0-4.33-1.48,11.21,11.21,0,0,0-10,1.77c-14.8,10.49-20.09,55.09-21.8,76.56a239.6,239.6,0,0,1-3.57,26.29Z", transform: "translate(-83.88 -33.68)", fill: "#a8a8a8" }), h("path", { d: "M260.48,497.82l-25,61.5c13.1-9.58,32.51-61.75,32.51-61.75l17.39,59.48-13.86-62.69a196.07,196.07,0,0,0,1.76-41.14c-1.1-15.74-15.87-41-23.89-53.72a42.56,42.56,0,0,0-4.33-1.48,11.21,11.21,0,0,0-10,1.77c6.3,12.65,22.05,44.28,26.85,53.68C268,465.31,260.48,497.82,260.48,497.82Z", transform: "translate(-83.88 -33.68)", fill: "#fff", opacity: "0.1" }), h("path", { d: "M280.89,658.87H346a19.75,19.75,0,0,0,19.73-20.75c-1.44-27.92-5.09-77.7-13.77-109.3-4.69-17.05-10.14-26-15.14-30.41a14.77,14.77,0,0,0-8.61-4.05,11.3,11.3,0,0,0-7,1.7C309.12,507.65,295,568.64,295,568.64Z", transform: "translate(-83.88 -33.68)", fill: "#a8a8a8" }), h("path", { d: "M341,604.78c2.68,7.43,3.74,16,0,24.35l-14.51,7.17s-39-16.53-34.26-50.41c0,0,1.28-7,14.71-6.46A38.07,38.07,0,0,1,341,604.78Z", transform: "translate(-83.88 -33.68)", fill: "#fff", opacity: "0.1" }), h("path", { d: "M325.5,515.72c-.45-11.88,6-16,11.33-17.31a14.77,14.77,0,0,0-8.61-4.05,22.86,22.86,0,0,0-7.51,12l-13.6,66.29S326.26,535.63,325.5,515.72Z", transform: "translate(-83.88 -33.68)", fill: "#fff", opacity: "0.1" }), h("path", { d: "M263.76,568.14,296,612.24l5.59,36.4-20.72,10.23L251,665.47a28.71,28.71,0,0,1-8.77.57l-81.51-7.17,11.09-25.71,38.3-53.77Z", transform: "translate(-83.88 -33.68)", fill: "#a8a8a8" }), h("path", { d: "M251.28,553s22,1.51,13.74,39.31-93.25,40.83-93.25,40.83,18.06-32,45.84-54.93c3.12-2.57,6.13-5.25,9-8.11C233,563.71,245.22,552.48,251.28,553Z", transform: "translate(-83.88 -33.68)", fill: "#fff", opacity: "0.1" }), h("path", { d: "M271.07,581.5s29.81,27.13,27,68.88", transform: "translate(-83.88 -33.68)", opacity: "0.1" }), h("path", { d: "M321.22,496.06s-31.28,41.6-34.79,105.61", transform: "translate(-83.88 -33.68)", opacity: "0.1" }), h("path", { d: "M213.86,478.43S229,547.18,191.2,599", transform: "translate(-83.88 -33.68)", opacity: "0.1" }), h("path", { d: "M489.61,733.05H652.75a9.14,9.14,0,0,0,8-13.47L579.22,568.1a9.13,9.13,0,0,0-16.08,0L481.57,719.58A9.14,9.14,0,0,0,489.61,733.05Zm91.95-27.68H560.8V684.62h20.76Zm0-34.59H560.8V629.27h20.76Z", transform: "translate(-83.88 -33.68)", fill: "#464353" }), h("path", { d: "M489.61,733.05H652.75a9.14,9.14,0,0,0,8-13.47L579.22,568.1a9.13,9.13,0,0,0-16.08,0L481.57,719.58A9.14,9.14,0,0,0,489.61,733.05Zm91.95-27.68H560.8V684.62h20.76Zm0-34.59H560.8V629.27h20.76Z", transform: "translate(-83.88 -33.68)", opacity: "0.1" }), h("path", { d: "M489.61,738.05H652.75a9.14,9.14,0,0,0,8-13.47L579.22,573.1a9.13,9.13,0,0,0-16.08,0L481.57,724.58A9.14,9.14,0,0,0,489.61,738.05Zm91.95-27.68H560.8V689.62h20.76Zm0-34.59H560.8V634.27h20.76Z", transform: "translate(-83.88 -33.68)", fill: "#464353" }), h("path", { d: "M400,656.47a11.2,11.2,0,0,0-2.31-1.12c-2.68-1-5.54-1.26-8.22-2.22a11.77,11.77,0,0,1-4.13-2.44c-.2-.2-.39-.4-.57-.61,1-.63,1.91-1.26,2.9-1.85a34.36,34.36,0,0,0-12.06-12c1.61-2.37,5.24-2.18,7.36-4.09a7,7,0,0,0,2-3.93c.79-3.93-.19-8-1.17-11.87-1.9-7.57-3.82-15.19-6.9-22.35a88.07,88.07,0,0,1-3.74-9.06c-2.59-8.62-.78-18-2.74-26.81-.63-2.83-1.65-5.75-.94-8.55,1.09-4.34,5.94-6.91,7-11.25,3.84-15.45,4.53-31.48,6.71-47.25A60.81,60.81,0,0,0,384,482c0-3.19-.57-6.35-.8-9.53-.62-8.93,1.17-17.85,1.94-26.77a28,28,0,0,1,3.63,8.95,36.13,36.13,0,0,1,.21,8.88,41.71,41.71,0,0,1-.63,5.91c-.49,2.32-1.35,4.54-1.92,6.86a21.21,21.21,0,0,0,.95,13.76c1.36,3,4.35,5.78,7.46,4.88,2.15-.62,3.45-2.76,4.41-4.79,3-6.36,4.67-13.73,2.65-20.49-1.33-4.5-4.25-8.57-4.52-13.27a34.3,34.3,0,0,1,.44-5.61c1.25-10.86-1.45-21.77-2.05-32.69-.16-2.89.1-6.48-.55-9.55-.08-.37-.17-.74-.28-1.09a2.34,2.34,0,0,1,.72.33,6.52,6.52,0,0,0-.14-5.59,14.21,14.21,0,0,1-.94-1.76c-.38-1-.31-2.16-.78-3.12a13.31,13.31,0,0,0-1-1.45c-1.29-1.87-1.36-4.29-1.39-6.56q-.23-17.76-1-35.48c-.27-6-.61-12.14-2.71-17.77a26.64,26.64,0,0,0-9.4-12.47,21.9,21.9,0,0,0-2.11-1.32,7.32,7.32,0,0,0,.6-2.7,6.46,6.46,0,0,0,0-.88l-.06-.5v0a21.1,21.1,0,0,0-2-6,16.86,16.86,0,0,1-1.91-6.56,10.19,10.19,0,0,1,.07-1.24v0c.34-2.88,1.84-5.58,2.37-8.46a14.51,14.51,0,0,0,.22-2.71c0-.31,0-.63,0-.95a.08.08,0,0,0,0,0,27.26,27.26,0,0,0-3.21-10.1c-.5-1-1-2-1.56-3-.26-1.87-.55-3.74-.84-5.6-.16-1.08-.33-2.16-.56-3.23q-.17-.8-.39-1.56c1.55-1.46.65-3.6-.34-5.58-1.91-3.76-1.51-8.25-2.32-12.39a37.44,37.44,0,0,0-2.94-8.32,18.54,18.54,0,0,0-3.19-5.24,19.56,19.56,0,0,0-4.13-3,13.15,13.15,0,0,0-4.1-1.85c-.91-.18-1.84-.17-2.74-.38a8.68,8.68,0,0,1-1.68-.61,11.43,11.43,0,0,0-3.59-1.31,8,8,0,0,0-3.46.66,12.73,12.73,0,0,1-3.72,1c-.45,0-.93,0-1.41,0a3.13,3.13,0,0,0-1.91.46,7.22,7.22,0,0,0-.82.84,11.07,11.07,0,0,1-2.41,1.65A23.75,23.75,0,0,0,318.5,255a10.06,10.06,0,0,1-.29,3.29c-.29.84-.86,1.57-1.1,2.43A6.82,6.82,0,0,0,317,263c.08,1.17.2,2.33.33,3.5h0a7.36,7.36,0,0,0-1.46,3.23v0a4.41,4.41,0,0,0-.09.62v.08h0c-.11,2.09.92,4,1.52,6A21.32,21.32,0,0,1,317,288.2c-.73,2.63-1.77,5.35-2,8v0c0,.06,0,.12,0,.18a9.67,9.67,0,0,0,.46,4c.33.91.82,1.76,1.12,2.68,1.06,3.26-.48,6.68-2.52,9.54l0,0c-.32.45-.65.88-1,1.3l.05,0-.05.05,2.08,1.47c-.61.32-1.22.67-1.84,1a18.92,18.92,0,0,0-6.78,2.51,27.56,27.56,0,0,0-5.5,3.66,23.33,23.33,0,0,0-4.34,6,75.41,75.41,0,0,0-3.68,7.76,24.3,24.3,0,0,0-1.88,6.73c-.86,1.83-1.57,3.8-2.36,5.57-.4.91-.79,1.82-1.18,2.73l-34.42-84.28-5.34,2.22.42,1-1.11.47,1.51,3.68c-.22.15-.44.3-.65.46l-.28.22-.56.44-.28.23-.57.48-.21.18-.71.65,0,0c-.76.69-1.49,1.42-2.2,2.15l-1.83,1.89-.35.37-.61.62-.34.35-.87.87-.06.06-.54.52-.34.32c-.14.14-.29.27-.44.4l-.42.39-.68.58-.2.18-.93.74a26.07,26.07,0,0,1-4,2.57c-5.47,2.83-11.26,5.2-16.6,8.23a47.8,47.8,0,0,0-8.22,5.76c-3.53,3.13-6.52,7-10.61,9.27l-.45.24c-7.24,3.72-15.77,1.49-24,1.33-1.23,0-2.44,0-3.64.08-6.68.52-12.79,3.23-18.7,6.53-4.16,2.33-8.22,4.95-12.3,7.32-2.58,1.49-5.17,3.11-7.77,4.77-6.6,4.19-13.28,8.59-20.19,11.76-6.42,2.94-13,4.81-20,4.45H89c-.67,0-1.34-.09-2-.17-.65,5.25,3.55,9.48,6.35,14.1a14.29,14.29,0,0,1,2.37,6.68,12,12,0,0,1-.2,2.68c-.56,3.24-2.06,6.42-1.65,9.68A11.21,11.21,0,0,0,96,387.11c1.78,2.54,4.25,4.8,5.93,7.45,2.54,4,3.2,8.87,4.19,13.58a28.57,28.57,0,0,0,3.29,9.41c2.16,3.48,5.46,6,8.56,8.67.57.49,1.13,1,1.67,1.5.4.36.79.74,1.16,1.13,3.63,3.71,6.33,9.43,4.14,14.07-.07.16-.15.3-.23.45a4,4,0,0,0,.55.33c2.79,1.36,6.29-.82,8.58-3.13,1.13-1.13,2.2-2.33,3.24-3.55,2.79-3.1,5.35-6.46,8-9.68.72-.87,1.44-1.72,2.18-2.56a37,37,0,0,1,9.88-8,36.29,36.29,0,0,1,6.06-2.46c3.1-1,6.3-1.74,9.41-2.72a77.31,77.31,0,0,0,12.39-5.2A190.55,190.55,0,0,0,205,394l1-.65a34.28,34.28,0,0,0,5.95-4.75c.32-.35.63-.71.92-1.08,1.56-2,2.57-4.37,4-6.45a20.75,20.75,0,0,1,5.61-5.41c6.17-4.15,14.36-5.73,21.69-8l.08,0a84.3,84.3,0,0,0,34.17-20.29l5.48,13.42q-.85,2.38-1.61,4.81c-1.22,4-2.22,8.12-4.61,11.5a8.58,8.58,0,0,0-1.74,3.09,10,10,0,0,1-.41,2.48c-.34.68-1.05,1.13-1.34,1.83-.42,1,.13,2.29-.43,3.23a5.08,5.08,0,0,1-.95,1C271.38,390,271,392,271,393.82a17.83,17.83,0,0,1-.45,5.52,13.15,13.15,0,0,1,1.29-.67,6,6,0,0,0-.11,1,11.14,11.14,0,0,0,.35,2.81,22.19,22.19,0,0,0,2.92,5.84,41.5,41.5,0,0,0,3.13,4.5,41,41,0,0,0,6.62,5.92l10.08,7.78-1,4.21c-2.2,8.82-4.42,17.75-4.53,26.85a115.7,115.7,0,0,0,.81,12.89l.87,8.78c.7,7.07,1.4,14.14,2.17,21.21.49,4.47,1,9,2.58,13.22,2.38,6.41-.25,13.65.76,20.43.8,5.31,2.38,10.8.79,15.93-.64,2-1.76,3.92-2.58,5.9-2.05,4.92-2.26,10.39-2.43,15.72a66.81,66.81,0,0,0,.51,14c.86,4.78,2.76,9.47,2.39,14.32-.52,6.89-5.56,12.78-6.17,19.67-.49,5.49,1.9,10.8,4.47,15.67,1.89,3.59-.75,8.23-1.75,12.18-2,7.75,1.32,15.85,5.37,22.72a1.12,1.12,0,0,0,.51.54c.46.17.89-.29,1.19-.68s.39-.48.6-.71c0,.31.06.62.08.92,0,.65.05,1.3.05,2a20.1,20.1,0,0,0,1.36,7.4,13.07,13.07,0,0,0,.56,1.34,6.18,6.18,0,0,0,1,1.61,6.11,6.11,0,0,0,4,1.68c3.32.36,6.66-.33,10-.62,3.52-.3,7.05-.17,10.58-.25a1.53,1.53,0,0,0,.79-.17,1.35,1.35,0,0,0,.45-.72,8,8,0,0,0,.17-3.94,27.94,27.94,0,0,0-.75-3.13c-.47-1.65-.9-3.31-1.31-5-.08-.31-.15-.62-.22-.93l.16.07q3.23-7.26,6.47-14.52c1.09-2.45,2.2-5.1,1.66-7.73-.39-1.88-1.59-3.47-2.44-5.19-2-4.06-2.08-8.8-2.11-13.34l-.12-25.72c5-6.36,8.09-13.93,10-21.83a70.61,70.61,0,0,1,.59,34,31.67,31.67,0,0,0-.95,5.18c-.39,7.13,5.16,13.17,6.64,20.15a4.54,4.54,0,0,1,.11,1.64,6.15,6.15,0,0,1-.82,1.9c-2.66,4.87-2.37,10.75-2,16.29l1.17.19a3.1,3.1,0,0,0,1.24,1.22h0a6.12,6.12,0,0,0,1.55.64,38.18,38.18,0,0,0,5.83.89c2.82.28,5.65.56,8.48.74,1.12.07,2.24.13,3.36.16a33.55,33.55,0,0,1,4.7.33,34,34,0,0,1,5,1.45c7.29,2.44,15.45,3.83,22.51.79a10.14,10.14,0,0,0,4.11-2.91,4.84,4.84,0,0,0-1.21-7.52ZM303.28,371.4c1.06,2.11,2.12,4.21,3,6.4,1.73,4.24,2.78,9,1.68,13.42-.32,1.3-2.41,2.3-2.4,3.64a3,3,0,0,0-.16.31l-6.53-16A57.08,57.08,0,0,1,303.28,371.4Zm-7.17,34a27.67,27.67,0,0,1-3.54-6.11c-.12-.27-.25-.53-.37-.8a2.4,2.4,0,0,0,.95-.71c1-1.26.46-3.1.61-4.72a10.2,10.2,0,0,1,1.59-4l6.13,15q-.93,2.44-1.74,4.93A35,35,0,0,1,296.11,405.4Z", transform: "translate(-83.88 -33.68)", fill: "url(#fb7ae7e0-1793-4d3b-a6c6-7b51ed07a232-368)" }), h("path", { d: "M317.69,270.4c-.11,2.09.93,4,1.54,6a21.23,21.23,0,0,1-.29,11.74c-1.12,4-3,8.23-1.57,12.14.33.92.83,1.76,1.13,2.68,1.24,3.8-1.06,7.8-3.58,10.91l9.89,6.93a11.37,11.37,0,0,0,5,2.39c1.85.22,4-.77,4.38-2.59.13-.62,0-1.27.12-1.9a5.16,5.16,0,0,1,2.77-3.84,9.06,9.06,0,0,1,4.79-.89c6.07.33,11.23,4.32,16.75,6.88a67.38,67.38,0,0,0,11.27,3.74c2.19.57,4.62,1.09,6.6,0s2.89-3.62,2.74-5.91a19.33,19.33,0,0,0-2.1-6.51,16.56,16.56,0,0,1-1.93-6.55c0-3.36,1.84-6.42,2.46-9.72.87-4.69-.9-9.46-3.06-13.72s-4.78-8.36-5.83-13a19,19,0,0,0-1.09-4.11,9.36,9.36,0,0,0-2-2.68c-3.71-3.67-9-5.41-14.18-5.79s-10.41.47-15.55,1.36a32.51,32.51,0,0,0-5.77,1.37,36.65,36.65,0,0,0-7.59,4.11C320.25,265.06,317.84,267.43,317.69,270.4Z", transform: "translate(-83.88 -33.68)", fill: "#464353" }), h("g", { opacity: "0.1" }, h("path", { d: "M375.17,303.57c0,.3,0,.6.06.89.31-2.93,1.85-5.68,2.4-8.61a14.22,14.22,0,0,0,.19-3.56c0,.52-.1,1-.19,1.56C377,297.15,375.13,300.21,375.17,303.57Z", transform: "translate(-83.88 -33.68)" }), h("path", { d: "M319.9,280.4a17.91,17.91,0,0,0-.67-6,34.78,34.78,0,0,1-1.45-4.66c0,.21-.08.41-.09.62-.11,2.09.93,4,1.54,6A16.89,16.89,0,0,1,319.9,280.4Z", transform: "translate(-83.88 -33.68)" }), h("path", { d: "M379.14,318.13a5.72,5.72,0,0,1-2.68,4.41c-2,1.09-4.41.57-6.6,0a66.52,66.52,0,0,1-11.27-3.75c-5.52-2.55-10.68-6.54-16.75-6.87a9.06,9.06,0,0,0-4.79.89,5.16,5.16,0,0,0-2.77,3.84c-.07.63,0,1.28-.12,1.9-.39,1.82-2.53,2.81-4.38,2.59a11.37,11.37,0,0,1-5-2.39l-8.89-6.24c-.33.45-.66.89-1,1.3l9.89,6.94a11.37,11.37,0,0,0,5,2.39c1.85.22,4-.77,4.38-2.59.13-.62,0-1.27.12-1.9a5.16,5.16,0,0,1,2.77-3.84,9.06,9.06,0,0,1,4.79-.89c6.07.33,11.23,4.32,16.75,6.87a66.52,66.52,0,0,0,11.27,3.75c2.19.57,4.62,1.09,6.6,0s2.89-3.62,2.74-5.91C379.19,318.46,379.16,318.3,379.14,318.13Z", transform: "translate(-83.88 -33.68)" }), h("path", { d: "M318.5,302.91a7.74,7.74,0,0,1,.27,1.23,7.25,7.25,0,0,0-.27-3.23c-.3-.92-.8-1.76-1.13-2.68a8.36,8.36,0,0,1-.46-2.07,9.4,9.4,0,0,0,.46,4.07C317.7,301.15,318.2,302,318.5,302.91Z", transform: "translate(-83.88 -33.68)" })), h("path", { d: "M330.24,682.36a1.31,1.31,0,0,1-.46.72,1.53,1.53,0,0,1-.79.17c-3.56.08-7.12,0-10.67.25-3.36.29-6.73,1-10.08.62a5.17,5.17,0,0,1-5-3.29,13.07,13.07,0,0,1-.56-1.34,19.91,19.91,0,0,1-1.37-7.4c0-.67,0-1.32,0-2a15.17,15.17,0,0,0-.29-2.18,3.31,3.31,0,0,1,.1-2.53c1.42-2.59,4.85-3.11,7.49-3.31a61.85,61.85,0,0,1,18.25,1.34c.47,2.3,1,4.58,1.56,6.86q.62,2.51,1.32,5a28,28,0,0,1,.76,3.13A8,8,0,0,1,330.24,682.36Z", transform: "translate(-83.88 -33.68)", fill: "#464353" }), h("path", { d: "M330.24,682.36a1.31,1.31,0,0,1-.46.72,1.53,1.53,0,0,1-.79.17c-3.56.08-7.12,0-10.67.25-3.36.29-6.73,1-10.08.62a5.17,5.17,0,0,1-5-3.29,13.07,13.07,0,0,1-.56-1.34h1.28c4.21,0,8.43-.15,12.64-.15,1.27,0,2.55-.06,3.81-.21s2.29-.36,3.44-.5a47.13,47.13,0,0,1,5.18-.21h1.42A8,8,0,0,1,330.24,682.36Z", transform: "translate(-83.88 -33.68)", opacity: "0.06" }), h("path", { d: "M403.89,663.79a10.23,10.23,0,0,1-4.14,2.91c-7.12,3-15.35,1.65-22.7-.79a34.58,34.58,0,0,0-5.05-1.45,34,34,0,0,0-4.73-.33c-1.13,0-2.26-.09-3.39-.16-2.86-.18-5.71-.46-8.55-.74a38.63,38.63,0,0,1-5.88-.89,6.25,6.25,0,0,1-1.57-.64h0a2.41,2.41,0,0,1-1.44-2.15c.08-1.27,1.4-2,2.56-2.55,10.29-4.45,21.47-6.38,32.57-7.93a13.05,13.05,0,0,0,3.27-1c1.25-.5,1.38.32,2,1.24a7.71,7.71,0,0,0,1,1.18,11.9,11.9,0,0,0,4.16,2.44c2.7,1,5.59,1.27,8.29,2.22a11.35,11.35,0,0,1,2.33,1.12,4.82,4.82,0,0,1,1.22,7.52Z", transform: "translate(-83.88 -33.68)", fill: "#464353" }), h("path", { d: "M403.89,663.79a10.23,10.23,0,0,1-4.14,2.91c-7.12,3-15.35,1.65-22.7-.79a34.58,34.58,0,0,0-5.05-1.45,34,34,0,0,0-4.73-.33c-1.13,0-2.26-.09-3.39-.16.92-.87,1.86-1.72,2.82-2.54a8.4,8.4,0,0,1,2.37-1.56,6.86,6.86,0,0,1,3.37-.23c5.72.79,10.86,4.8,16.63,4.45a20.46,20.46,0,0,0,7.65-2.47,13.35,13.35,0,0,0,5-3.56,5.77,5.77,0,0,0,.93-1.79,4.82,4.82,0,0,1,1.22,7.52Z", transform: "translate(-83.88 -33.68)", opacity: "0.06" }), h("path", { d: "M401.88,490c-1,2-2.28,4.17-4.44,4.79-3.14.9-6.16-1.92-7.53-4.88a21.08,21.08,0,0,1-1-13.76c.57-2.31,1.44-4.53,1.93-6.85a41.72,41.72,0,0,0,.64-5.91,36.13,36.13,0,0,0-.21-8.88c-1.61-8.59-9-15-11.46-23.44-1.24-4.21-1.18-8.69-1.11-13.08a13.45,13.45,0,0,1,.34-3.3,5.15,5.15,0,0,1,.3-.86c1.65-3.66,6.54-4.16,9.94-6.29,1.88-1.17,6.15-4.94,7.73-1.5a11.31,11.31,0,0,1,.76,2.39c.65,3.06.39,6.65.55,9.54.61,10.92,3.33,21.82,2.07,32.68a34.09,34.09,0,0,0-.44,5.6c.27,4.7,3.21,8.77,4.56,13.27C406.59,476.29,404.92,483.66,401.88,490Z", transform: "translate(-83.88 -33.68)", fill: "#fbbebe" }), h("path", { d: "M397.82,408.45a3.37,3.37,0,0,0-2.3,0l-6.77,2a41.92,41.92,0,0,0-6.91,2.51,16.21,16.21,0,0,0-2.75,1.71,5.15,5.15,0,0,1,.3-.86c1.65-3.66,6.54-4.16,9.94-6.29,1.88-1.17,6.15-4.94,7.73-1.5A11.31,11.31,0,0,1,397.82,408.45Z", transform: "translate(-83.88 -33.68)", opacity: "0.1" }), h("path", { d: "M398.26,407.69a3.06,3.06,0,0,0-2.74-.22l-6.77,2a41.92,41.92,0,0,0-6.91,2.51,15.88,15.88,0,0,0-3.29,2.14c-3.16-5.49-4-12-4.58-18.3-.32-3.67-.56-7.35-.7-11a49.34,49.34,0,0,1,.16-7.88c.38-3,1.25-5.93,1.79-8.91a40.66,40.66,0,0,0,.62-5.28,51.63,51.63,0,0,0-.53-11.59,71.84,71.84,0,0,0-2.78-12c-.64-1.79-1.41-3.52-2.11-5.28l-.24-.62a72.9,72.9,0,0,1-3.09-9.91c-.32-1.38-.34-2.83-1.4-3.77a18.82,18.82,0,0,1,3-.12q.3,0,.6,0a22.43,22.43,0,0,1,11.44,4A26.73,26.73,0,0,1,390.21,336c2.11,5.63,2.46,11.75,2.73,17.76q.81,17.72,1,35.46c0,2.27.1,4.69,1.4,6.56a13.39,13.39,0,0,1,1,1.45c.47,1,.4,2.11.78,3.12a15.77,15.77,0,0,0,.95,1.76A6.45,6.45,0,0,1,398.26,407.69Z", transform: "translate(-83.88 -33.68)", fill: "#464353" }), h("path", { d: "M331.7,290.31c-1-.33-2-.68-3-1l2.08.16A4.2,4.2,0,0,1,331.7,290.31Z", transform: "translate(-83.88 -33.68)", fill: "#fbbebe" }), h("path", { d: "M372.65,326.4c-.2.68-.4,1.36-.62,2a38.22,38.22,0,0,1-1.85,4.81,22.38,22.38,0,0,1-4.73,6.86,6.28,6.28,0,0,1-2.36,1.56,7.5,7.5,0,0,1-2.32.22q-4,0-8-.12a28.42,28.42,0,0,1-6.18-.61,22.07,22.07,0,0,1-6.3-2.84c-7.47-4.62-13.61-11.66-16.24-20-.33-1.06-.56-2.33.17-3.16a3.87,3.87,0,0,1,2.55-.87l.12,0a16.11,16.11,0,0,0,6.09-2.09,6.26,6.26,0,0,0,2.78-2.84,7.66,7.66,0,0,0-.09-4.42l-2.22-10.08a10.44,10.44,0,0,0-1.77-4.49c.65.23,1.3.44,2,.62,6.18,1.67,12.94.66,19,2.85,2.32.85,4.64,2.38,5.34,4.76,1.17,4-2.74,8.15-1.62,12.15.75,2.72,3.52,4.29,6,5.56l1.67.85,4.63,2.35.64.32.1.05c1.46.74,3,1.66,3.51,3.23A6,6,0,0,1,372.65,326.4Z", transform: "translate(-83.88 -33.68)", fill: "#fbbebe" }), h("path", { d: "M384.85,349.88a21.59,21.59,0,0,1-1.84,7.4,30.23,30.23,0,0,0-3.15,13c-.77,13.5-5.9,29.57,1.45,40.91.18.28.36.56.53.85a15.88,15.88,0,0,0-3.29,2.14c-3.16-5.49-4-12-4.58-18.3-.32-3.67-.56-7.35-.7-11a49.34,49.34,0,0,1,.16-7.88c.38-3,1.25-5.93,1.79-8.91a40.66,40.66,0,0,0,.62-5.28,51.63,51.63,0,0,0-.53-11.59,71.84,71.84,0,0,0-2.78-12c-.64-1.79-1.41-3.52-2.11-5.28l-.24-.62a22.38,22.38,0,0,1-4.73,6.86,6.28,6.28,0,0,1-2.36,1.56,7.5,7.5,0,0,1-2.32.22q-4,0-8-.12a28.42,28.42,0,0,1-6.18-.61,22.07,22.07,0,0,1-6.3-2.84c-7.47-4.62-13.61-11.66-16.24-20-.33-1.06-.56-2.33.17-3.16a3.87,3.87,0,0,1,2.55-.87l.12,0,9,11.13a18,18,0,0,1,2.6,3.89,2.32,2.32,0,0,0,.8,1.19,2.05,2.05,0,0,0,1,.18c8.45,0,19.71,0,28.16,0a7.31,7.31,0,0,0-1.24-4.21c-.26.06-.61.08-.07-.08a28.34,28.34,0,0,0-3.1-9.27,6.45,6.45,0,0,0-.31-.58,10.66,10.66,0,0,1-1.48-3.24,5.4,5.4,0,0,1,3.28,0c1.23.53,1.87,1.86,2.41,3.09.46,1,.92,2.07,1.33,3.12,0,.11.1.23.14.34a22.64,22.64,0,0,1,1.66,6.49c.06.82.26,1.86.94,2.13a.89.89,0,0,0,.34.08,3.78,3.78,0,0,1,4.09,1,9,9,0,0,1,2,3.94,21.56,21.56,0,0,0,1.42,4.24c1.29,2.46-.68,3.56,1.65,5.07a8.12,8.12,0,0,1,2.74,2.46A7.68,7.68,0,0,1,384.85,349.88Z", transform: "translate(-83.88 -33.68)", opacity: "0.1" }), h("path", { d: "M326.77,663.45c.47,2.3,1,4.58,1.56,6.86l-.06.14c-4.57-2-9.25-4.09-14.24-4.53-4.63-.4-9.66.85-12.81,4.21a15.17,15.17,0,0,0-.29-2.18,3.31,3.31,0,0,1,.1-2.53c1.42-2.59,4.85-3.11,7.49-3.31A61.85,61.85,0,0,1,326.77,663.45Z", transform: "translate(-83.88 -33.68)", opacity: "0.1" }), h("path", { d: "M366.16,328.37c.47,0,.3,0,.07.08S365.62,328.53,366.16,328.37Z", transform: "translate(-83.88 -33.68)", opacity: "0.1" }), h("path", { d: "M387.89,650.49a86.86,86.86,0,0,0-12.52,9.69,13.11,13.11,0,0,1-3.95,2.89,11.54,11.54,0,0,1-4.76.49,162,162,0,0,1-18.78-1.86h0a2.41,2.41,0,0,1-1.44-2.15c.08-1.27,1.4-2,2.56-2.55,10.29-4.45,21.47-6.38,32.57-7.93a13.05,13.05,0,0,0,3.27-1c1.25-.5,1.38.32,2,1.24A7.71,7.71,0,0,0,387.89,650.49Z", transform: "translate(-83.88 -33.68)", opacity: "0.1" }), h("path", { d: "M314.52,316.77c1.47,1.31,3.15,2.37,4.64,3.64,4,3.39,6.52,8.13,9,12.75a8.34,8.34,0,0,1-4.59.31,32.92,32.92,0,0,0,.39,13.37,12.4,12.4,0,0,0-4.47,5.55,37.1,37.1,0,0,0-1.46,7q-2.16,15.61-4.34,31.22a4.84,4.84,0,0,1-1,2.81,5.39,5.39,0,0,0-.76.75,4.15,4.15,0,0,0-.35,2.15c-.06.73-.54,1.6-1.27,1.5a1.58,1.58,0,0,1-.89-.58,20.42,20.42,0,0,1-2-2.48c-5.9,11.32-8.74,23.52-11.86,35.9-2.23,8.82-4.46,17.74-4.57,26.84a115.68,115.68,0,0,0,.81,12.88l.88,8.78c.71,7.06,1.42,14.13,2.19,21.19.5,4.48,1,9,2.61,13.22,2.4,6.41-.26,13.64.76,20.42.8,5.31,2.39,10.8.79,15.92-.64,2.05-1.76,3.92-2.6,5.9-2.06,4.92-2.27,10.39-2.45,15.72a66,66,0,0,0,.52,14c.86,4.79,2.79,9.48,2.41,14.32-.53,6.89-5.61,12.78-6.23,19.66-.49,5.49,1.92,10.79,4.51,15.66,1.91,3.59-.75,8.23-1.76,12.18-2,7.74,1.33,15.84,5.41,22.71a1.09,1.09,0,0,0,.52.54c.47.17.89-.29,1.2-.68,3.07-3.94,8.51-5.43,13.5-5s9.66,2.49,14.24,4.53L334.79,655c1.1-2.45,2.22-5.1,1.67-7.73-.39-1.88-1.6-3.47-2.46-5.19-2-4.06-2.1-8.79-2.12-13.34l-.12-25.7c5.06-6.36,8.15-13.92,10.1-21.82a70,70,0,0,1,.6,34,30.85,30.85,0,0,0-1,5.18c-.39,7.13,5.2,13.16,6.69,20.14a4.33,4.33,0,0,1,.12,1.64,6.18,6.18,0,0,1-.83,1.9c-2.68,4.86-2.39,10.75-2,16.29a162.33,162.33,0,0,0,21.21,2.27,11.92,11.92,0,0,0,4.76-.49,13.14,13.14,0,0,0,3.95-2.9A87.22,87.22,0,0,1,390.23,648a34.62,34.62,0,0,0-12.15-12c1.61-2.37,5.28-2.18,7.42-4.08a7,7,0,0,0,2-3.94c.8-3.92-.19-8-1.18-11.85-1.92-7.58-3.85-15.19-7-22.35a85.88,85.88,0,0,1-3.76-9.05c-2.62-8.62-.79-18-2.77-26.81-.64-2.82-1.67-5.73-.95-8.54,1.1-4.33,6-6.9,7.08-11.24,3.87-15.45,4.56-31.46,6.76-47.23a60.68,60.68,0,0,0,.79-9.11c0-3.19-.57-6.35-.8-9.53-.9-12.73,3.17-25.43,2.13-38.15a48,48,0,0,0-7.52-22c-7.35-11.35-2.22-27.41-1.45-40.91a30.08,30.08,0,0,1,3.14-13,21.33,21.33,0,0,0,1.85-7.4,7.65,7.65,0,0,0-.56-4.67,7.89,7.89,0,0,0-2.73-2.46c-2.33-1.52-.36-2.62-1.65-5.08a21.34,21.34,0,0,1-1.42-4.24,8.92,8.92,0,0,0-2-3.93,3.78,3.78,0,0,0-4.09-1c-.95,0-1.21-1.26-1.29-2.21-.27-3.48-1.71-6.75-3.12-9.95-.54-1.23-1.18-2.56-2.41-3.09a5.51,5.51,0,0,0-3.29,0,10.63,10.63,0,0,0,1.49,3.25,28.24,28.24,0,0,1,3.4,9.84c-1,.3,1,0,0,0a7,7,0,0,1,1.31,4.29c-8.44,0-19.7,0-28.15,0a2,2,0,0,1-1-.18,2.4,2.4,0,0,1-.81-1.19,17.33,17.33,0,0,0-2.6-3.88L325,314.1a2.5,2.5,0,0,0-.85-.77,2.3,2.3,0,0,0-1.25,0C319.69,313.8,317.32,315.14,314.52,316.77Z", transform: "translate(-83.88 -33.68)", fill: "var(--cp-graphic-color)" }), h("path", { d: "M350.05,482.21a9.54,9.54,0,0,1,4.87,1.26,4.91,4.91,0,0,1,2.42,4.22c-.11,1.89-1.56,3.39-2.61,5a13.4,13.4,0,0,0-1.54,3.16,1.27,1.27,0,0,0-.08.81c.12.38.53.57.88.74a7.51,7.51,0,0,1,4.41,6.56c-.09,3.9-3.9,7.06-3.69,11a22.62,22.62,0,0,0,.42,2.44,18.64,18.64,0,0,1-1.35,9.89c-1.21,3.14-2.86,6.09-4.16,9.2-3.51,8.45-4.27,17.81-4,27,.21,6.24-2,12.18-4,18.12a260.46,260.46,0,0,0,.9-36c-.14-3.26-.55-6.34-.4-9.61.24-5.19,3.14-9.91,3.88-15,.42-2.91.14-5.87.21-8.81.14-6,1.77-11.92,1.88-17.94C348.23,490,347.84,485.62,350.05,482.21Z", transform: "translate(-83.88 -33.68)", opacity: "0.1" }), h("path", { d: "M308.32,318.91a27.42,27.42,0,0,0-5.54,3.66,23.6,23.6,0,0,0-4.38,6,76.64,76.64,0,0,0-3.71,7.76c-1.41,3.44-2.58,7.25-1.61,10.84.88,3.25,3.37,5.78,5.09,8.67s2.73,6.28,4.05,9.45c1.76,4.23,4.17,8.17,5.91,12.41s2.79,9,1.69,13.41c-.32,1.3-2.43,2.31-2.43,3.64,0,2.2,3.18,4.59,5.29,5.23,2.43.75,5.08-.37,7.07-2,3.65-2.89,5.87-7.22,7.51-11.58,2.64-7,4.05-14.43,5.32-21.81.92-5.42,1.78-10.85,2.27-16.31.45-4.92.59-10-.71-14.72a25,25,0,0,0-6.83-11.36c-2.6-2.5-6.86-5.86-10.64-5.95C313.68,316.24,310.88,317.5,308.32,318.91Z", transform: "translate(-83.88 -33.68)", fill: "#464353" }), h("path", { d: "M336.75,439.46a4.78,4.78,0,0,1-2.23,3.33,13.13,13.13,0,0,1-3.81,1.56c-2.68.78-5.52,1.5-8.23.81a16.52,16.52,0,0,1-5.78-3.29l-30.28-23.18a40.89,40.89,0,0,1-6.67-5.92,42.63,42.63,0,0,1-3.16-4.49,22,22,0,0,1-2.94-5.84,10.69,10.69,0,0,1-.36-2.81,5.29,5.29,0,0,1,.64-2.57c.73-1.22,2.29-1.47,3.57-1.81a37.46,37.46,0,0,1,13.17-1,1.79,1.79,0,0,1,1.78,1.21c.67,1.23,1.25,2.51,1.85,3.79a27.4,27.4,0,0,0,3.57,6.11,51.54,51.54,0,0,0,4.45,4.29c3.2,3,5.82,6.6,9.23,9.36,3.95,3.19,8.75,5.1,13.25,7.45s8.94,5.4,11.2,9.95A5.83,5.83,0,0,1,336.75,439.46Z", transform: "translate(-83.88 -33.68)", fill: "#fbbebe" }), h("path", { d: "M371.8,277.74a24.76,24.76,0,1,1-.69-5.8A24.66,24.66,0,0,1,371.8,277.74Z", transform: "translate(-83.88 -33.68)", opacity: "0.1" }), h("path", { d: "M371.8,276.74a24.76,24.76,0,1,1-.69-5.8A24.66,24.66,0,0,1,371.8,276.74Z", transform: "translate(-83.88 -33.68)", fill: "#fbbebe" }), h("path", { d: "M294.3,399.21c-1.14.73-2.83.49-4.24.17-5.56-1.24-11.7-2.13-16.77.25a5.29,5.29,0,0,1,.64-2.57c.73-1.22,2.29-1.47,3.57-1.81a37.46,37.46,0,0,1,13.17-1,1.79,1.79,0,0,1,1.78,1.21C293.12,396.65,293.7,397.93,294.3,399.21Z", transform: "translate(-83.88 -33.68)", opacity: "0.1" }), h("path", { d: "M283.85,365.54c-1.23,4-2.24,8.11-4.65,11.5a8.5,8.5,0,0,0-1.76,3.08,9.6,9.6,0,0,1-.41,2.48c-.34.68-1.06,1.13-1.35,1.83-.43,1,.13,2.29-.44,3.23a4.8,4.8,0,0,1-.95,1c-1.36,1.26-1.7,3.27-1.73,5.13s.15,3.76-.46,5.51c5.28-3.15,12-2.21,18-.87,1.67.37,3.74.65,4.82-.69s.46-3.1.61-4.71c.2-2.1,1.64-3.84,2.53-5.75,1-2.15,1.34-4.55,2.11-6.79,1.59-4.71,5-8.55,7.19-13a12.49,12.49,0,0,0,1.42-4.94,14.74,14.74,0,0,0-1.71-6.41,87.68,87.68,0,0,0-7.4-13.21c-1.27-1.87-3.46-5.33-5.43-2.34-1.6,2.41-2.6,5.48-3.78,8.12A148.62,148.62,0,0,0,283.85,365.54Z", transform: "translate(-83.88 -33.68)", fill: "#464353" }), h("path", { d: "M374.08,326.72a20.21,20.21,0,0,1-16.18-6.39,2.48,2.48,0,0,1-.72-1.17,2.35,2.35,0,0,1,.46-1.64c1.2-1.85,3.27-3.07,4.23-5.06s.63-4.28.72-6.46c.16-3.91,1.7-7.78,1.83-11.63a12.15,12.15,0,0,0-.22-2.94,18.43,18.43,0,0,1-.84-4.43c.13-2.93,2.77-5.21,3.21-8.1.57-3.68-2.48-6.88-5.55-9a33.07,33.07,0,0,0-7.56-3.91,24.61,24.61,0,0,0-5.08-1.23,19.8,19.8,0,0,0-9.57,1.07,15.63,15.63,0,0,0-3.56,1.9,4.82,4.82,0,0,0-1.59,1.65,5.37,5.37,0,0,0-.42,2.39c-.06,4.09.4,8.44-1.55,12-1,1.91-2.7,3.46-3.53,5.48a9.11,9.11,0,0,0-.63,2.63,26.5,26.5,0,0,0-.15,2.82c-.06,5.27,0,10.83,2.68,15.4a40.15,40.15,0,0,1,2.57,4.31,4.91,4.91,0,0,1-.25,4.79,5.45,5.45,0,0,1-2,1.5,16,16,0,0,1-12.79.46,16.21,16.21,0,0,0,3.78-18.08,10.67,10.67,0,0,1-1.38-4,10.15,10.15,0,0,1,1-3.66,20,20,0,0,0,.61-11.72c-.61-2.38-1.67-4.68-1.86-7.13a21.57,21.57,0,0,1,.24-5.54,18,18,0,0,1,12.33-14.19c.51-.17,1-.33,1.56-.47a33.26,33.26,0,0,1,7.39-.79c5.55-.18,11.18-.34,16.53,1.11a22.18,22.18,0,0,1,8.56,4.4,15.45,15.45,0,0,1,4.14,5.47,19,19,0,0,1,1.17,3.78c.23,1.07.4,2.15.57,3.23,1.21,7.69,2.42,15.53,1.13,23.21-.51,3-1.4,6-1.8,9.06C370.59,312.89,372.34,319.9,374.08,326.72Z", transform: "translate(-83.88 -33.68)", fill: "#464353" }), h("circle", { cx: "254.67", cy: "301.06", r: "1.86", fill: "#fff" }), h("circle", { cx: "286.06", cy: "300.18", r: "1.86", fill: "#fff" }), h("path", { d: "M338.55,240.74l-4-7.55a7.31,7.31,0,0,1,.83-.84,3.17,3.17,0,0,1,1.93-.46Z", transform: "translate(-83.88 -33.68)", opacity: "0.1" }), h("path", { d: "M349.58,231.54l-4.53,6.7-2.58-7.35a8.18,8.18,0,0,1,3.49-.66A11.6,11.6,0,0,1,349.58,231.54Z", transform: "translate(-83.88 -33.68)", opacity: "0.1" }), h("g", { opacity: "0.1" }, h("path", { d: "M332.38,317.22a5.45,5.45,0,0,1-2,1.5,16.07,16.07,0,0,1-11.37.95,15.57,15.57,0,0,1-1.42,1.51,16,16,0,0,0,12.79-.46,5.45,5.45,0,0,0,2-1.5,4.31,4.31,0,0,0,.64-3.46A3.55,3.55,0,0,1,332.38,317.22Z", transform: "translate(-83.88 -33.68)" }), h("path", { d: "M321.53,283.73a19.7,19.7,0,0,1,.57,4,19.93,19.93,0,0,0-.57-6c-.61-2.38-1.67-4.68-1.86-7.13,0-.31,0-.62-.05-.94a22.31,22.31,0,0,0,.05,2.94C319.86,279.05,320.92,281.35,321.53,283.73Z", transform: "translate(-83.88 -33.68)" }), h("path", { d: "M373.29,296.81a43.75,43.75,0,0,0,.54-8,41.68,41.68,0,0,1-.54,6c-.51,3-1.4,6-1.8,9.06a31.56,31.56,0,0,0-.23,4.95,29.52,29.52,0,0,1,.23-2.95C371.89,302.81,372.78,299.84,373.29,296.81Z", transform: "translate(-83.88 -33.68)" }), h("path", { d: "M321.33,301.1a16.44,16.44,0,0,1-1.26-3.09,4.52,4.52,0,0,0-.12,1.1,10.67,10.67,0,0,0,1.38,4,15.11,15.11,0,0,1,1.25,5.3A15.5,15.5,0,0,0,321.33,301.1Z", transform: "translate(-83.88 -33.68)" }), h("path", { d: "M364.2,291.39a13.07,13.07,0,0,1,.19,1.38c0-.15,0-.29,0-.44a12.15,12.15,0,0,0-.22-2.94c-.22-1.05-.58-2.09-.75-3.15a4.43,4.43,0,0,0-.09.72A18.43,18.43,0,0,0,364.2,291.39Z", transform: "translate(-83.88 -33.68)" }), h("path", { d: "M357.9,318.29a5.27,5.27,0,0,1-.43-.51,2.07,2.07,0,0,0-.29,1.34,2.48,2.48,0,0,0,.72,1.17,20.21,20.21,0,0,0,16.18,6.39c-.17-.66-.34-1.31-.5-2A20.18,20.18,0,0,1,357.9,318.29Z", transform: "translate(-83.88 -33.68)" }), h("path", { d: "M366.55,277a.43.43,0,0,1,0-.11c.57-3.68-2.48-6.88-5.55-9a33.07,33.07,0,0,0-7.56-3.91,24.61,24.61,0,0,0-5.08-1.23,19.8,19.8,0,0,0-9.57,1.07,15.63,15.63,0,0,0-3.56,1.9,4.82,4.82,0,0,0-1.59,1.65,5.37,5.37,0,0,0-.42,2.39c0,.69,0,1.38,0,2.08v-.08a5.37,5.37,0,0,1,.42-2.39,4.82,4.82,0,0,1,1.59-1.65,15.63,15.63,0,0,1,3.56-1.9,19.8,19.8,0,0,1,9.57-1.07,24.61,24.61,0,0,1,5.08,1.23,33.07,33.07,0,0,1,7.56,3.91C363.55,271.61,366.06,274.09,366.55,277Z", transform: "translate(-83.88 -33.68)" }), h("path", { d: "M331.69,281.79c-1,1.91-2.7,3.46-3.53,5.48a9.11,9.11,0,0,0-.63,2.63,26.5,26.5,0,0,0-.15,2.82c0,.85,0,1.71,0,2.57,0-.19,0-.38,0-.57a26.5,26.5,0,0,1,.15-2.82,9.11,9.11,0,0,1,.63-2.63c.83-2,2.49-3.57,3.53-5.48,1.61-3,1.58-6.45,1.55-9.88A16.68,16.68,0,0,1,331.69,281.79Z", transform: "translate(-83.88 -33.68)" })), h("path", { d: "M371.59,270.41a2.91,2.91,0,0,1-.48.53,4.58,4.58,0,0,1-1.17.7c-2.91,1.26-2.79-2.85-4.31-4.26a5.17,5.17,0,0,0-3.38-1q-4.39-.22-8.79-.39c-4.89-.18-9.77-.27-14.65-.16q-3.51.06-7,.29c-2.7.18-5.6.53-7.9,1.81a8.37,8.37,0,0,0-2.11,1.65c-.55.6-1.13,1.36-1.89,1.5a18,18,0,0,1,12.33-14.19,24.75,24.75,0,0,1,34,4.25,15.45,15.45,0,0,1,4.14,5.47A19,19,0,0,1,371.59,270.41Z", transform: "translate(-83.88 -33.68)", opacity: "0.1" }), h("path", { d: "M369.94,269.64c-2.91,1.26-2.79-2.85-4.31-4.26a5.17,5.17,0,0,0-3.38-1,266.53,266.53,0,0,0-30.44-.26c-3.61.24-7.57.78-10,3.46-.62.68-1.27,1.56-2.2,1.53-.31-2-.53-4.08-.68-6.13a6.82,6.82,0,0,1,.12-2.3c.25-.86.82-1.59,1.11-2.43a9.74,9.74,0,0,0,.3-3.28,23.7,23.7,0,0,1,11.66-20.16,10.59,10.59,0,0,0,2.43-1.64,7.31,7.31,0,0,1,.83-.84,3.17,3.17,0,0,1,1.93-.46c.48,0,1,0,1.42,0a12.91,12.91,0,0,0,3.75-1,8.18,8.18,0,0,1,3.49-.66,11.6,11.6,0,0,1,3.62,1.31,8.77,8.77,0,0,0,1.69.61c.91.21,1.85.2,2.76.38a13.47,13.47,0,0,1,4.14,1.84,19.75,19.75,0,0,1,4.16,3,18.41,18.41,0,0,1,3.22,5.24,37.53,37.53,0,0,1,3,8.32c.81,4.14.41,8.62,2.33,12.38C372.06,265.65,373.13,268.27,369.94,269.64Z", transform: "translate(-83.88 -33.68)", fill: "#fed253" }), h("path", { d: "M319.25,266.5s20.73-18.86,51.6-3.22C370.85,263.28,336,255.35,319.25,266.5Z", transform: "translate(-83.88 -33.68)", opacity: "0.1" }), h("path", { d: "M93.37,362.87c-2.82-4.62-7.06-8.85-6.4-14.09,7.76.89,15.12-1,22.23-4.29s13.71-7.56,20.37-11.75c2.62-1.65,5.23-3.27,7.83-4.77,4.12-2.36,8.21-5,12.4-7.31,6-3.3,12.12-6,18.86-6.52a34.4,34.4,0,0,1,3.67-.09c8.3.16,16.9,2.39,24.2-1.33l.45-.24c4.14-2.27,7.15-6.13,10.7-9.26a47.79,47.79,0,0,1,8.29-5.76c5.39-3,11.23-5.4,16.74-8.23a25.39,25.39,0,0,0,4-2.56l.94-.75.21-.18c.23-.19.46-.38.68-.58l.43-.38.44-.4.34-.32.55-.52.06-.07.87-.86.35-.35.61-.63.36-.36c.61-.63,1.22-1.27,1.84-1.89s1.46-1.46,2.21-2.15l0,0,.72-.64.21-.18.58-.48.27-.23.57-.44.28-.22c.28-.21.57-.41.86-.61a6.26,6.26,0,0,1,.84-.49l-1.87-4.53,5.38-2.22,74.2,180.05-5.39,2.22-42.44-103-.3.3a85.2,85.2,0,0,1-35.09,20.88l-.08,0c-7.39,2.23-15.66,3.81-21.88,7.95a21,21,0,0,0-5.65,5.41c-1.46,2.08-2.48,4.45-4,6.45-.29.37-.61.73-.93,1.07a34.77,34.77,0,0,1-6,4.76l-.95.65a194.48,194.48,0,0,1-20.1,12.39,79.3,79.3,0,0,1-12.49,5.2c-3.13,1-6.36,1.73-9.49,2.72a37.16,37.16,0,0,0-6.11,2.46c-5.3,2.77-9.37,7.11-13.22,11.74-3.37,4.06-6.57,8.36-10.27,12.06-2.32,2.3-5.85,4.48-8.65,3.13l-.57-.33c.09-.15.16-.3.24-.46,2.21-4.63-.51-10.35-4.17-14.06-.38-.39-.77-.77-1.17-1.13s-1.12-1-1.69-1.5c-3.13-2.69-6.46-5.19-8.63-8.66a28.25,28.25,0,0,1-3.32-9.41c-1-4.71-1.67-9.56-4.23-13.57-1.68-2.65-4.18-4.91-6-7.45a11.35,11.35,0,0,1-2.2-5.14c-.41-3.25,1.1-6.43,1.67-9.67a12.07,12.07,0,0,0,.21-2.68A14.19,14.19,0,0,0,93.37,362.87Z", transform: "translate(-83.88 -33.68)", fill: "url(#26387a05-323e-43c3-b271-53af00551daf-369)" }), h("rect", { x: "284.7", y: "262.55", width: "5.73", height: "191.47", transform: "translate(606.05 546.3) rotate(157.6)", fill: "#d6d8e1" }), h("path", { d: "M103.85,393.88c2.51,3.95,3.18,8.71,4.15,13.34a28.1,28.1,0,0,0,3.27,9.26c2.14,3.41,5.41,5.87,8.48,8.51.56.49,1.12,1,1.66,1.48.39.35.78.73,1.15,1.1,3.6,3.65,6.27,9.28,4.1,13.83a3.81,3.81,0,0,1-.23.45,4.57,4.57,0,0,0,.55.32c2.76,1.34,6.23-.8,8.51-3.07,3.64-3.64,6.79-7.86,10.1-11.85,3.78-4.56,7.79-8.83,13-11.55a36,36,0,0,1,6-2.42c3.07-1,6.25-1.71,9.33-2.67a78.53,78.53,0,0,0,12.28-5.11A192.53,192.53,0,0,0,206,393.31l.94-.64a34.35,34.35,0,0,0,5.9-4.67c.32-.34.63-.69.92-1.06,1.54-2,2.55-4.29,4-6.34a20.66,20.66,0,0,1,5.56-5.32c6.12-4.07,14.24-5.63,21.51-7.82l.08,0a83.94,83.94,0,0,0,34.5-20.53,5.62,5.62,0,0,0,1.73-2.54c.31-1.41-.45-2.81-1.18-4.05-.85-1.46-1.68-2.92-2.5-4.4a196.49,196.49,0,0,1-9.86-20.73c-.63-1.56-1.24-3.11-1.83-4.68q-2.27-6-4.14-12.17c-.41-1.36-.81-2.73-1.19-4.1-.07-.26-.15-.54-.22-.84-1.66-6.67-3.88-22.28-10.72-17.61a39.57,39.57,0,0,0-5.65,4.91c-1.33,1.35-2.63,2.74-4,4.08a40.44,40.44,0,0,1-3.53,3.09,25.93,25.93,0,0,1-4,2.52c-5.43,2.78-11.17,5.11-16.46,8.09a46.79,46.79,0,0,0-8.16,5.66c-3.49,3.08-6.45,6.88-10.52,9.11l-.44.24c-7.18,3.65-15.63,1.46-23.8,1.3a35.91,35.91,0,0,0-3.6.09c-6.63.5-12.69,3.16-18.55,6.41-4.12,2.28-8.14,4.86-12.19,7.19-2.56,1.47-5.12,3.06-7.7,4.69-6.54,4.12-13.17,8.44-20,11.56-7,3.18-14.23,5.08-21.86,4.21-.65,5.15,3.51,9.31,6.29,13.85a13.75,13.75,0,0,1,2.35,6.57,11.61,11.61,0,0,1-.19,2.63c-.56,3.19-2,6.31-1.64,9.52A11.05,11.05,0,0,0,98,386.56C99.74,389.05,102.19,391.28,103.85,393.88Z", transform: "translate(-83.88 -33.68)", fill: "#C82333" }), h("path", { d: "M307.16,414.71s8.76,7.64,17.64,11.71,3,18.67,3,18.67-9.41,2.16-16-7S307.16,414.71,307.16,414.71Z", transform: "translate(-83.88 -33.68)", fill: "#fbbebe" }), h("path", { d: "M779.2,544.76S756,575.29,736.75,575.54s-30.55,12.86-21.41,20.74,108.74-4.5,108.74-4.5.94-37.52-7.69-43S779.2,544.76,779.2,544.76Z", transform: "translate(-83.88 -33.68)", fill: "#444176" }), h("path", { d: "M1028.65,581.41s3.55,24.18-7.42,40.67,19.82,22.85,19.82,22.85,22.37,6.23,24-15.87,1.1-39-1-40.8-3.85-14.23-3.85-14.23Z", transform: "translate(-83.88 -33.68)", fill: "#444176" }), h("path", { d: "M677.45,627.08s-.81-78.21,76.58-110L772,482.89l8.62-21a51.1,51.1,0,0,1,36.09-30.46l13.94-3.13,4.31-18.16a51.08,51.08,0,0,1,40.81-38.54,142.91,142.91,0,0,1,25.7-2.4,22.12,22.12,0,0,1,18.79,11h0s73.32-.81,76.57,39.11c0,0,7.34,36.65,17.93,43.17,0,0,17.92-4.07,35.84,22l19.55,66.8s51.32,48.06,35.84,92c0,0-21.18,30.14-128.71,9.77,0,0-114.86,35-176-13C801.27,640.11,699.45,659.66,677.45,627.08Z", transform: "translate(-83.88 -33.68)", fill: "#a8a8a8" }), h("path", { d: "M728.77,614.86s16.3-22.81,15.48-39.11,3.84-56,3.84-56", transform: "translate(-83.88 -33.68)", fill: "none", stroke: "#000", "stroke-miterlimit": "10", opacity: "0.1" }), h("path", { d: "M788.24,553.76s16.29-30.14,14.66-46.43c0,0,17.11-31,30.14-28.52", transform: "translate(-83.88 -33.68)", fill: "none", stroke: "#000", "stroke-miterlimit": "10", opacity: "0.1" }), h("path", { d: "M877.85,468.22s44.8-16.29,47.25-29.32", transform: "translate(-83.88 -33.68)", fill: "none", stroke: "#000", "stroke-miterlimit": "10", opacity: "0.1" }), h("path", { d: "M894.14,505.7s47.25-21.18,47.25-26.89H965s34.22,44.81,30.15,64.36", transform: "translate(-83.88 -33.68)", fill: "none", stroke: "#000", "stroke-miterlimit": "10", opacity: "0.1" }), h("path", { d: "M949.54,538.28s-45.62-3.26-61.92,9.78S842,567.61,842,567.61s-17.11,36.66-23.63,43.17-17.11,29.33-17.11,29.33", transform: "translate(-83.88 -33.68)", fill: "none", stroke: "#000", "stroke-miterlimit": "10", opacity: "0.1" }), h("path", { d: "M949.54,581.46s4.88,17.1,11.4,26.88,16.29,44.8,16.29,44.8", transform: "translate(-83.88 -33.68)", fill: "none", stroke: "#000", "stroke-miterlimit": "10", opacity: "0.1" }), h("path", { d: "M1026.11,631.15s10.34,28.77,19.43,29.05", transform: "translate(-83.88 -33.68)", fill: "none", stroke: "#000", "stroke-miterlimit": "10", opacity: "0.1" }), h("path", { d: "M958.38,507.66s26.86,7.26,38.09,24.85S1042,566.05,1042,566.05", transform: "translate(-83.88 -33.68)", fill: "none", stroke: "#000", "stroke-miterlimit": "10", opacity: "0.1" }), h("path", { d: "M969.9,421s0,37.47,10.59,37.47,34.22,4.07,34.22,4.07", transform: "translate(-83.88 -33.68)", fill: "none", stroke: "#000", "stroke-miterlimit": "10", opacity: "0.1" }), h("path", { d: "M918,376.5s-2.71,64.73-16.56,81.49", transform: "translate(-83.88 -33.68)", fill: "none", stroke: "#000", "stroke-miterlimit": "10", opacity: "0.1" }), h("g", { opacity: "0.05" }, h("path", { d: "M1068.47,550.5l-19.55-66.8c-17.92-26.07-35.84-22-35.84-22-10.59-6.52-17.92-43.18-17.92-43.18-3.26-39.92-76.58-39.1-76.58-39.1h0a22.12,22.12,0,0,0-18.83-11c-3.46,0-7,.11-10.54.4q3,.3,5.75.85l5.7,9.78s73.31-.82,76.57,39.1c0,0,7.34,36.66,17.93,43.18,0,0,17.92-4.08,35.84,22l19.55,66.8s51.32,48.06,35.84,92c0,0-10.45,14.87-53.92,16.67,58.61,2.15,71.84-16.67,71.84-16.67C1119.79,598.56,1068.47,550.5,1068.47,550.5Z", transform: "translate(-83.88 -33.68)" }), h("path", { d: "M781.72,639.29A380.38,380.38,0,0,1,729.53,645c20.41.78,41.64-1.43,55.32-3.31C783.79,640.88,782.75,640.1,781.72,639.29Z", transform: "translate(-83.88 -33.68)" }), h("path", { d: "M957.68,652.33a334.57,334.57,0,0,1-76.92,12.16c37.55,1.36,73.12-6.47,87.78-10.23C965,653.67,961.41,653,957.68,652.33Z", transform: "translate(-83.88 -33.68)" })), h("path", { d: "M306.73,779.39s22.41-.69,29.16-5.5,34.46-10.55,36.14-2.84,33.67,38.35,8.37,38.56-58.77-3.94-65.51-8.05S306.73,779.39,306.73,779.39Z", transform: "translate(-83.88 -33.68)", fill: "#a8a8a8" }), h("path", { d: "M380.86,806.92c-25.3.21-58.78-3.94-65.52-8-5.13-3.13-7.18-14.35-7.86-19.52l-.75,0s1.42,18.07,8.16,22.17,40.22,8.25,65.51,8.05c7.31-.06,9.83-2.66,9.69-6.51C389.08,805.43,386.29,806.88,380.86,806.92Z", transform: "translate(-83.88 -33.68)", opacity: "0.2" }), h("path", { d: "M853.07,723.19s-26.39-5.28-33.42-12.32-38.7-19.34-42.22-10.55-47.49,38.7-17.59,44,70.36,7,79.16,3.52S853.07,723.19,853.07,723.19Z", transform: "translate(-83.88 -33.68)", fill: "#a8a8a8" }), h("path", { d: "M759.84,741c29.91,5.27,70.36,7,79.16,3.51,6.69-2.68,11.35-15.55,13.19-21.54l.88.19s-5.28,21.1-14.07,24.62-49.25,1.76-79.16-3.52c-8.63-1.52-11.1-5.1-10.17-9.62C750.41,737.62,753.42,739.89,759.84,741Z", transform: "translate(-83.88 -33.68)", opacity: "0.2" }), h("path", { d: "M600.38,148.53H594.1a4.4,4.4,0,0,0,0-8.8H543.22a4.4,4.4,0,0,0,0,8.8h6.28a4.4,4.4,0,0,0,0,8.79h-8.79a4.4,4.4,0,0,0,0,8.8h50.88a4.4,4.4,0,0,0,0-8.8h8.79a4.4,4.4,0,1,0,0-8.79Z", transform: "translate(-83.88 -33.68)", fill: "var(--cp-graphic-color)", opacity: "0.1" }), h("path", { d: "M798,303.34h-6.28a4.4,4.4,0,0,0,0-8.79H740.79a4.4,4.4,0,1,0,0,8.79h6.28a4.4,4.4,0,0,0,0,8.79h-8.79a4.4,4.4,0,1,0,0,8.8h50.87a4.4,4.4,0,0,0,0-8.8H798a4.4,4.4,0,1,0,0-8.79Z", transform: "translate(-83.88 -33.68)", fill: "var(--cp-graphic-color)", opacity: "0.1" }), h("path", { d: "M505.17,274.7h-6.28a4.4,4.4,0,1,0,0-8.79H448a4.4,4.4,0,1,0,0,8.79h6.28a4.4,4.4,0,1,0,0,8.79h-8.8a4.4,4.4,0,0,0,0,8.8h50.88a4.4,4.4,0,0,0,0-8.8h8.79a4.4,4.4,0,1,0,0-8.79Z", transform: "translate(-83.88 -33.68)", fill: "var(--cp-graphic-color)", opacity: "0.1" })));
    return (h("div", { class: "cp-welcome-modal__content" }, h("figure", { id: "imgCongratsViewError", class: "cp-welcome-modal__content-img-wrapper", role: "img", "aria-label": locale$d.maketext("Error") }, this.statusImg), h("div", { id: "lblCongratsViewError", class: "cp-welcome-modal__content-title", innerHTML: this.modalTitle }), h("div", null, h("p", { innerHTML: locale$d.maketext("Something went wrong. Your website failed to create. Try creating your website manually using WordPress Toolkit.") }))));
  }
  render() {
    return this.installStatus === SiteInstallStatus.Success ? this.getSuccessTemplate() : this.getErrorTemplate();
  }
  static get style() { return cpWelcomeModalCongratsCss; }
};

const locale$c = getLocaleInstance();
const CpWelcomeModalCongratsFooter$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.modalButtonClick = createEvent(this, "modalButtonClick", 7);
  }
  get wpToolkitAppURL() {
    const appInfo = appFeatureCheck([AppKeys.WpToolkit]);
    return appInfo.length !== 0 ? appInfo[0].url : "";
  }
  render() {
    return (h("div", null, h("button", { id: "cp-btnComplete", type: "button", class: "cp-btn cp-btn--primary", onClick: () => this.modalButtonClick.emit({
        modalAction: WelcomeModalActions.RedirectToUrl,
        redirectUrl: this.wpToolkitAppURL,
      }) }, this.installStatus === SiteInstallStatus.Success
      ? locale$c.maketext("Add Content")
      : locale$c.maketext("Create a Website"))));
  }
};

/*
# Copyright 2024 cPanel, L.L.C. - All rights reserved.
# copyright@cpanel.net
# https://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
*/
const locale$b = getLocaleInstance();
class StartingPointOption {
  constructor(key, url, title, description, imageKey, show = false, showBadge = false, badgeText) {
    this.key = key;
    this.url = url;
    this.title = title;
    this.description = description;
    this.imageKey = imageKey;
    this.show = show;
    this.showBadge = showBadge;
    this.badgeText = badgeText || locale$b.maketext("Recommended");
  }
  /**
   * Updates the show and url properties for an app when it is available to a user.
   * @param url url string for the option
   */
  updateOptionsInfo(url, show) {
    this.url = url;
    this.show = show;
  }
}

/*
# Copyright 2024 cPanel, L.L.C. - All rights reserved.
# copyright@cpanel.net
# https://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
*/
const locale$a = getLocaleInstance();
let wpToolkitAppInfo = new StartingPointOption(AppKeys.WpToolkit, "", locale$a.maketext("WordPress"), locale$a.maketext("Create and build your website with WordPress."), "wp-toolkit", false, false);
let backupAppInfo = new StartingPointOption(AppKeys.BackupWizard, "backup/wizard-restore.html", locale$a.maketext("Restore from backup"), locale$a.maketext("Have a backup file? Restore it to your account."), "backup-wizard", false, false);
let sitejetAppInfo = new StartingPointOption(AppKeys.Sitejet, "sitejet/index.html#", locale$a.maketext("Sitejet Builder"), locale$a.maketext("An easy path to build a custom website."), AppKeys.Sitejet, true, true, locale$a.maketext("Easy [output,amp] Powerful"));
let solutionsInfo = new StartingPointOption(AppKeys.Tools, `${state.directoryPrefix}index.html`, locale$a.maketext("Explore Account"), locale$a.maketext("Discover your account’s available features."), "solutions", true, false);
// THIS IS AN ORDERED LIST FROM MOST IMPORTANT TO LEAST
let startingPointApps = [wpToolkitAppInfo, sitejetAppInfo, backupAppInfo];
function getAvailableAppEntries(apps) {
  return appFeatureCheck(apps.map(app => app.key));
}
function filterByAvailableApps(apps, availableAppEntries) {
  return apps.filter(app => availableAppEntries.some(entry => entry.key === app.key));
}
function updateAppUrls(apps, availableAppKeys) {
  return apps.map(app => {
    const appEntry = availableAppKeys.find(featureApp => featureApp.key === app.key);
    const fullUrl = app.url
      ? `${state.directoryPrefix}${app.url}`
      : appEntry
        ? `${state.directoryPrefix}${appEntry.url}`
        : "";
    if (fullUrl) {
      app.updateOptionsInfo(fullUrl, true);
    }
    return app;
  });
}
function assembleFinalAppList(apps) {
  return [...apps.slice(0, 2), solutionsInfo];
}
function getAvailableStartOptions() {
  const availableAppKeys = getAvailableAppEntries(startingPointApps);
  const filteredApps = filterByAvailableApps(startingPointApps, availableAppKeys);
  const updatedApps = updateAppUrls(filteredApps, availableAppKeys);
  return assembleFinalAppList(updatedApps);
}

/*
# Copyright 2024 cPanel, L.L.C. - All rights reserved.
# copyright@cpanel.net
# https://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
*/
var SitejetInfo;
(function (SitejetInfo) {
  SitejetInfo["Key"] = "cpanel-sitejet-plugin";
  SitejetInfo["Url"] = "sitejet/index.html#";
})(SitejetInfo || (SitejetInfo = {}));

const cpWelcomeModalStartingPointCss = ":root{--cp-font-weight-semi-bold:600}.container,.container-fluid,.container-xxl,.container-xl,.container-lg,.container-md,.container-sm{width:100%;padding-right:var(--bs-gutter-x, 0.75rem);padding-left:var(--bs-gutter-x, 0.75rem);margin-right:auto;margin-left:auto}@media (min-width: 576px){.container-sm,.container{max-width:540px}}@media (min-width: 768px){.container-md,.container-sm,.container{max-width:720px}}@media (min-width: 992px){.container-lg,.container-md,.container-sm,.container{max-width:960px}}@media (min-width: 1200px){.container-xl,.container-lg,.container-md,.container-sm,.container{max-width:1140px}}@media (min-width: 1400px){.container-xxl,.container-xl,.container-lg,.container-md,.container-sm,.container{max-width:1320px}}.row{--bs-gutter-x:1.5rem;--bs-gutter-y:0;display:flex;flex-wrap:wrap;margin-top:calc(-1 * var(--bs-gutter-y));margin-right:calc(-0.5 * var(--bs-gutter-x));margin-left:calc(-0.5 * var(--bs-gutter-x))}.row>*{flex-shrink:0;width:100%;max-width:100%;padding-right:calc(var(--bs-gutter-x) * 0.5);padding-left:calc(var(--bs-gutter-x) * 0.5);margin-top:var(--bs-gutter-y)}.col{flex:1 0 0%}.row-cols-auto>*{flex:0 0 auto;width:auto}.row-cols-1>*{flex:0 0 auto;width:100%}.row-cols-2>*{flex:0 0 auto;width:50%}.row-cols-3>*{flex:0 0 auto;width:33.3333333333%}.row-cols-4>*{flex:0 0 auto;width:25%}.row-cols-5>*{flex:0 0 auto;width:20%}.row-cols-6>*{flex:0 0 auto;width:16.6666666667%}.col-auto{flex:0 0 auto;width:auto}.col-1{flex:0 0 auto;width:8.33333333%}.col-2{flex:0 0 auto;width:16.66666667%}.col-3{flex:0 0 auto;width:25%}.col-4{flex:0 0 auto;width:33.33333333%}.col-5{flex:0 0 auto;width:41.66666667%}.col-6{flex:0 0 auto;width:50%}.col-7{flex:0 0 auto;width:58.33333333%}.col-8{flex:0 0 auto;width:66.66666667%}.col-9{flex:0 0 auto;width:75%}.col-10{flex:0 0 auto;width:83.33333333%}.col-11{flex:0 0 auto;width:91.66666667%}.col-12{flex:0 0 auto;width:100%}[dir=\"ltr\"] .offset-1{margin-left:8.33333333%}[dir=\"rtl\"] .offset-1{margin-right:8.33333333%}[dir=\"ltr\"] .offset-2{margin-left:16.66666667%}[dir=\"rtl\"] .offset-2{margin-right:16.66666667%}[dir=\"ltr\"] .offset-3{margin-left:25%}[dir=\"rtl\"] .offset-3{margin-right:25%}[dir=\"ltr\"] .offset-4{margin-left:33.33333333%}[dir=\"rtl\"] .offset-4{margin-right:33.33333333%}[dir=\"ltr\"] .offset-5{margin-left:41.66666667%}[dir=\"rtl\"] .offset-5{margin-right:41.66666667%}[dir=\"ltr\"] .offset-6{margin-left:50%}[dir=\"rtl\"] .offset-6{margin-right:50%}[dir=\"ltr\"] .offset-7{margin-left:58.33333333%}[dir=\"rtl\"] .offset-7{margin-right:58.33333333%}[dir=\"ltr\"] .offset-8{margin-left:66.66666667%}[dir=\"rtl\"] .offset-8{margin-right:66.66666667%}[dir=\"ltr\"] .offset-9{margin-left:75%}[dir=\"rtl\"] .offset-9{margin-right:75%}[dir=\"ltr\"] .offset-10{margin-left:83.33333333%}[dir=\"rtl\"] .offset-10{margin-right:83.33333333%}[dir=\"ltr\"] .offset-11{margin-left:91.66666667%}[dir=\"rtl\"] .offset-11{margin-right:91.66666667%}.g-0,.gx-0{--bs-gutter-x:0}.g-0,.gy-0{--bs-gutter-y:0}.g-1,.gx-1{--bs-gutter-x:0.25rem}.g-1,.gy-1{--bs-gutter-y:0.25rem}.g-2,.gx-2{--bs-gutter-x:0.5rem}.g-2,.gy-2{--bs-gutter-y:0.5rem}.g-3,.gx-3{--bs-gutter-x:1rem}.g-3,.gy-3{--bs-gutter-y:1rem}.g-4,.gx-4{--bs-gutter-x:1.5rem}.g-4,.gy-4{--bs-gutter-y:1.5rem}.g-5,.gx-5{--bs-gutter-x:2rem}.g-5,.gy-5{--bs-gutter-y:2rem}.g-6,.gx-6{--bs-gutter-x:3rem}.g-6,.gy-6{--bs-gutter-y:3rem}@media (min-width: 576px){.col-sm{flex:1 0 0%}.row-cols-sm-auto>*{flex:0 0 auto;width:auto}.row-cols-sm-1>*{flex:0 0 auto;width:100%}.row-cols-sm-2>*{flex:0 0 auto;width:50%}.row-cols-sm-3>*{flex:0 0 auto;width:33.3333333333%}.row-cols-sm-4>*{flex:0 0 auto;width:25%}.row-cols-sm-5>*{flex:0 0 auto;width:20%}.row-cols-sm-6>*{flex:0 0 auto;width:16.6666666667%}.col-sm-auto{flex:0 0 auto;width:auto}.col-sm-1{flex:0 0 auto;width:8.33333333%}.col-sm-2{flex:0 0 auto;width:16.66666667%}.col-sm-3{flex:0 0 auto;width:25%}.col-sm-4{flex:0 0 auto;width:33.33333333%}.col-sm-5{flex:0 0 auto;width:41.66666667%}.col-sm-6{flex:0 0 auto;width:50%}.col-sm-7{flex:0 0 auto;width:58.33333333%}.col-sm-8{flex:0 0 auto;width:66.66666667%}.col-sm-9{flex:0 0 auto;width:75%}.col-sm-10{flex:0 0 auto;width:83.33333333%}.col-sm-11{flex:0 0 auto;width:91.66666667%}.col-sm-12{flex:0 0 auto;width:100%}[dir=\"ltr\"] .offset-sm-0{margin-left:0}[dir=\"rtl\"] .offset-sm-0{margin-right:0}[dir=\"ltr\"] .offset-sm-1{margin-left:8.33333333%}[dir=\"rtl\"] .offset-sm-1{margin-right:8.33333333%}[dir=\"ltr\"] .offset-sm-2{margin-left:16.66666667%}[dir=\"rtl\"] .offset-sm-2{margin-right:16.66666667%}[dir=\"ltr\"] .offset-sm-3{margin-left:25%}[dir=\"rtl\"] .offset-sm-3{margin-right:25%}[dir=\"ltr\"] .offset-sm-4{margin-left:33.33333333%}[dir=\"rtl\"] .offset-sm-4{margin-right:33.33333333%}[dir=\"ltr\"] .offset-sm-5{margin-left:41.66666667%}[dir=\"rtl\"] .offset-sm-5{margin-right:41.66666667%}[dir=\"ltr\"] .offset-sm-6{margin-left:50%}[dir=\"rtl\"] .offset-sm-6{margin-right:50%}[dir=\"ltr\"] .offset-sm-7{margin-left:58.33333333%}[dir=\"rtl\"] .offset-sm-7{margin-right:58.33333333%}[dir=\"ltr\"] .offset-sm-8{margin-left:66.66666667%}[dir=\"rtl\"] .offset-sm-8{margin-right:66.66666667%}[dir=\"ltr\"] .offset-sm-9{margin-left:75%}[dir=\"rtl\"] .offset-sm-9{margin-right:75%}[dir=\"ltr\"] .offset-sm-10{margin-left:83.33333333%}[dir=\"rtl\"] .offset-sm-10{margin-right:83.33333333%}[dir=\"ltr\"] .offset-sm-11{margin-left:91.66666667%}[dir=\"rtl\"] .offset-sm-11{margin-right:91.66666667%}.g-sm-0,.gx-sm-0{--bs-gutter-x:0}.g-sm-0,.gy-sm-0{--bs-gutter-y:0}.g-sm-1,.gx-sm-1{--bs-gutter-x:0.25rem}.g-sm-1,.gy-sm-1{--bs-gutter-y:0.25rem}.g-sm-2,.gx-sm-2{--bs-gutter-x:0.5rem}.g-sm-2,.gy-sm-2{--bs-gutter-y:0.5rem}.g-sm-3,.gx-sm-3{--bs-gutter-x:1rem}.g-sm-3,.gy-sm-3{--bs-gutter-y:1rem}.g-sm-4,.gx-sm-4{--bs-gutter-x:1.5rem}.g-sm-4,.gy-sm-4{--bs-gutter-y:1.5rem}.g-sm-5,.gx-sm-5{--bs-gutter-x:2rem}.g-sm-5,.gy-sm-5{--bs-gutter-y:2rem}.g-sm-6,.gx-sm-6{--bs-gutter-x:3rem}.g-sm-6,.gy-sm-6{--bs-gutter-y:3rem}}@media (min-width: 768px){.col-md{flex:1 0 0%}.row-cols-md-auto>*{flex:0 0 auto;width:auto}.row-cols-md-1>*{flex:0 0 auto;width:100%}.row-cols-md-2>*{flex:0 0 auto;width:50%}.row-cols-md-3>*{flex:0 0 auto;width:33.3333333333%}.row-cols-md-4>*{flex:0 0 auto;width:25%}.row-cols-md-5>*{flex:0 0 auto;width:20%}.row-cols-md-6>*{flex:0 0 auto;width:16.6666666667%}.col-md-auto{flex:0 0 auto;width:auto}.col-md-1{flex:0 0 auto;width:8.33333333%}.col-md-2{flex:0 0 auto;width:16.66666667%}.col-md-3{flex:0 0 auto;width:25%}.col-md-4{flex:0 0 auto;width:33.33333333%}.col-md-5{flex:0 0 auto;width:41.66666667%}.col-md-6{flex:0 0 auto;width:50%}.col-md-7{flex:0 0 auto;width:58.33333333%}.col-md-8{flex:0 0 auto;width:66.66666667%}.col-md-9{flex:0 0 auto;width:75%}.col-md-10{flex:0 0 auto;width:83.33333333%}.col-md-11{flex:0 0 auto;width:91.66666667%}.col-md-12{flex:0 0 auto;width:100%}[dir=\"ltr\"] .offset-md-0{margin-left:0}[dir=\"rtl\"] .offset-md-0{margin-right:0}[dir=\"ltr\"] .offset-md-1{margin-left:8.33333333%}[dir=\"rtl\"] .offset-md-1{margin-right:8.33333333%}[dir=\"ltr\"] .offset-md-2{margin-left:16.66666667%}[dir=\"rtl\"] .offset-md-2{margin-right:16.66666667%}[dir=\"ltr\"] .offset-md-3{margin-left:25%}[dir=\"rtl\"] .offset-md-3{margin-right:25%}[dir=\"ltr\"] .offset-md-4{margin-left:33.33333333%}[dir=\"rtl\"] .offset-md-4{margin-right:33.33333333%}[dir=\"ltr\"] .offset-md-5{margin-left:41.66666667%}[dir=\"rtl\"] .offset-md-5{margin-right:41.66666667%}[dir=\"ltr\"] .offset-md-6{margin-left:50%}[dir=\"rtl\"] .offset-md-6{margin-right:50%}[dir=\"ltr\"] .offset-md-7{margin-left:58.33333333%}[dir=\"rtl\"] .offset-md-7{margin-right:58.33333333%}[dir=\"ltr\"] .offset-md-8{margin-left:66.66666667%}[dir=\"rtl\"] .offset-md-8{margin-right:66.66666667%}[dir=\"ltr\"] .offset-md-9{margin-left:75%}[dir=\"rtl\"] .offset-md-9{margin-right:75%}[dir=\"ltr\"] .offset-md-10{margin-left:83.33333333%}[dir=\"rtl\"] .offset-md-10{margin-right:83.33333333%}[dir=\"ltr\"] .offset-md-11{margin-left:91.66666667%}[dir=\"rtl\"] .offset-md-11{margin-right:91.66666667%}.g-md-0,.gx-md-0{--bs-gutter-x:0}.g-md-0,.gy-md-0{--bs-gutter-y:0}.g-md-1,.gx-md-1{--bs-gutter-x:0.25rem}.g-md-1,.gy-md-1{--bs-gutter-y:0.25rem}.g-md-2,.gx-md-2{--bs-gutter-x:0.5rem}.g-md-2,.gy-md-2{--bs-gutter-y:0.5rem}.g-md-3,.gx-md-3{--bs-gutter-x:1rem}.g-md-3,.gy-md-3{--bs-gutter-y:1rem}.g-md-4,.gx-md-4{--bs-gutter-x:1.5rem}.g-md-4,.gy-md-4{--bs-gutter-y:1.5rem}.g-md-5,.gx-md-5{--bs-gutter-x:2rem}.g-md-5,.gy-md-5{--bs-gutter-y:2rem}.g-md-6,.gx-md-6{--bs-gutter-x:3rem}.g-md-6,.gy-md-6{--bs-gutter-y:3rem}}@media (min-width: 992px){.col-lg{flex:1 0 0%}.row-cols-lg-auto>*{flex:0 0 auto;width:auto}.row-cols-lg-1>*{flex:0 0 auto;width:100%}.row-cols-lg-2>*{flex:0 0 auto;width:50%}.row-cols-lg-3>*{flex:0 0 auto;width:33.3333333333%}.row-cols-lg-4>*{flex:0 0 auto;width:25%}.row-cols-lg-5>*{flex:0 0 auto;width:20%}.row-cols-lg-6>*{flex:0 0 auto;width:16.6666666667%}.col-lg-auto{flex:0 0 auto;width:auto}.col-lg-1{flex:0 0 auto;width:8.33333333%}.col-lg-2{flex:0 0 auto;width:16.66666667%}.col-lg-3{flex:0 0 auto;width:25%}.col-lg-4{flex:0 0 auto;width:33.33333333%}.col-lg-5{flex:0 0 auto;width:41.66666667%}.col-lg-6{flex:0 0 auto;width:50%}.col-lg-7{flex:0 0 auto;width:58.33333333%}.col-lg-8{flex:0 0 auto;width:66.66666667%}.col-lg-9{flex:0 0 auto;width:75%}.col-lg-10{flex:0 0 auto;width:83.33333333%}.col-lg-11{flex:0 0 auto;width:91.66666667%}.col-lg-12{flex:0 0 auto;width:100%}[dir=\"ltr\"] .offset-lg-0{margin-left:0}[dir=\"rtl\"] .offset-lg-0{margin-right:0}[dir=\"ltr\"] .offset-lg-1{margin-left:8.33333333%}[dir=\"rtl\"] .offset-lg-1{margin-right:8.33333333%}[dir=\"ltr\"] .offset-lg-2{margin-left:16.66666667%}[dir=\"rtl\"] .offset-lg-2{margin-right:16.66666667%}[dir=\"ltr\"] .offset-lg-3{margin-left:25%}[dir=\"rtl\"] .offset-lg-3{margin-right:25%}[dir=\"ltr\"] .offset-lg-4{margin-left:33.33333333%}[dir=\"rtl\"] .offset-lg-4{margin-right:33.33333333%}[dir=\"ltr\"] .offset-lg-5{margin-left:41.66666667%}[dir=\"rtl\"] .offset-lg-5{margin-right:41.66666667%}[dir=\"ltr\"] .offset-lg-6{margin-left:50%}[dir=\"rtl\"] .offset-lg-6{margin-right:50%}[dir=\"ltr\"] .offset-lg-7{margin-left:58.33333333%}[dir=\"rtl\"] .offset-lg-7{margin-right:58.33333333%}[dir=\"ltr\"] .offset-lg-8{margin-left:66.66666667%}[dir=\"rtl\"] .offset-lg-8{margin-right:66.66666667%}[dir=\"ltr\"] .offset-lg-9{margin-left:75%}[dir=\"rtl\"] .offset-lg-9{margin-right:75%}[dir=\"ltr\"] .offset-lg-10{margin-left:83.33333333%}[dir=\"rtl\"] .offset-lg-10{margin-right:83.33333333%}[dir=\"ltr\"] .offset-lg-11{margin-left:91.66666667%}[dir=\"rtl\"] .offset-lg-11{margin-right:91.66666667%}.g-lg-0,.gx-lg-0{--bs-gutter-x:0}.g-lg-0,.gy-lg-0{--bs-gutter-y:0}.g-lg-1,.gx-lg-1{--bs-gutter-x:0.25rem}.g-lg-1,.gy-lg-1{--bs-gutter-y:0.25rem}.g-lg-2,.gx-lg-2{--bs-gutter-x:0.5rem}.g-lg-2,.gy-lg-2{--bs-gutter-y:0.5rem}.g-lg-3,.gx-lg-3{--bs-gutter-x:1rem}.g-lg-3,.gy-lg-3{--bs-gutter-y:1rem}.g-lg-4,.gx-lg-4{--bs-gutter-x:1.5rem}.g-lg-4,.gy-lg-4{--bs-gutter-y:1.5rem}.g-lg-5,.gx-lg-5{--bs-gutter-x:2rem}.g-lg-5,.gy-lg-5{--bs-gutter-y:2rem}.g-lg-6,.gx-lg-6{--bs-gutter-x:3rem}.g-lg-6,.gy-lg-6{--bs-gutter-y:3rem}}@media (min-width: 1200px){.col-xl{flex:1 0 0%}.row-cols-xl-auto>*{flex:0 0 auto;width:auto}.row-cols-xl-1>*{flex:0 0 auto;width:100%}.row-cols-xl-2>*{flex:0 0 auto;width:50%}.row-cols-xl-3>*{flex:0 0 auto;width:33.3333333333%}.row-cols-xl-4>*{flex:0 0 auto;width:25%}.row-cols-xl-5>*{flex:0 0 auto;width:20%}.row-cols-xl-6>*{flex:0 0 auto;width:16.6666666667%}.col-xl-auto{flex:0 0 auto;width:auto}.col-xl-1{flex:0 0 auto;width:8.33333333%}.col-xl-2{flex:0 0 auto;width:16.66666667%}.col-xl-3{flex:0 0 auto;width:25%}.col-xl-4{flex:0 0 auto;width:33.33333333%}.col-xl-5{flex:0 0 auto;width:41.66666667%}.col-xl-6{flex:0 0 auto;width:50%}.col-xl-7{flex:0 0 auto;width:58.33333333%}.col-xl-8{flex:0 0 auto;width:66.66666667%}.col-xl-9{flex:0 0 auto;width:75%}.col-xl-10{flex:0 0 auto;width:83.33333333%}.col-xl-11{flex:0 0 auto;width:91.66666667%}.col-xl-12{flex:0 0 auto;width:100%}[dir=\"ltr\"] .offset-xl-0{margin-left:0}[dir=\"rtl\"] .offset-xl-0{margin-right:0}[dir=\"ltr\"] .offset-xl-1{margin-left:8.33333333%}[dir=\"rtl\"] .offset-xl-1{margin-right:8.33333333%}[dir=\"ltr\"] .offset-xl-2{margin-left:16.66666667%}[dir=\"rtl\"] .offset-xl-2{margin-right:16.66666667%}[dir=\"ltr\"] .offset-xl-3{margin-left:25%}[dir=\"rtl\"] .offset-xl-3{margin-right:25%}[dir=\"ltr\"] .offset-xl-4{margin-left:33.33333333%}[dir=\"rtl\"] .offset-xl-4{margin-right:33.33333333%}[dir=\"ltr\"] .offset-xl-5{margin-left:41.66666667%}[dir=\"rtl\"] .offset-xl-5{margin-right:41.66666667%}[dir=\"ltr\"] .offset-xl-6{margin-left:50%}[dir=\"rtl\"] .offset-xl-6{margin-right:50%}[dir=\"ltr\"] .offset-xl-7{margin-left:58.33333333%}[dir=\"rtl\"] .offset-xl-7{margin-right:58.33333333%}[dir=\"ltr\"] .offset-xl-8{margin-left:66.66666667%}[dir=\"rtl\"] .offset-xl-8{margin-right:66.66666667%}[dir=\"ltr\"] .offset-xl-9{margin-left:75%}[dir=\"rtl\"] .offset-xl-9{margin-right:75%}[dir=\"ltr\"] .offset-xl-10{margin-left:83.33333333%}[dir=\"rtl\"] .offset-xl-10{margin-right:83.33333333%}[dir=\"ltr\"] .offset-xl-11{margin-left:91.66666667%}[dir=\"rtl\"] .offset-xl-11{margin-right:91.66666667%}.g-xl-0,.gx-xl-0{--bs-gutter-x:0}.g-xl-0,.gy-xl-0{--bs-gutter-y:0}.g-xl-1,.gx-xl-1{--bs-gutter-x:0.25rem}.g-xl-1,.gy-xl-1{--bs-gutter-y:0.25rem}.g-xl-2,.gx-xl-2{--bs-gutter-x:0.5rem}.g-xl-2,.gy-xl-2{--bs-gutter-y:0.5rem}.g-xl-3,.gx-xl-3{--bs-gutter-x:1rem}.g-xl-3,.gy-xl-3{--bs-gutter-y:1rem}.g-xl-4,.gx-xl-4{--bs-gutter-x:1.5rem}.g-xl-4,.gy-xl-4{--bs-gutter-y:1.5rem}.g-xl-5,.gx-xl-5{--bs-gutter-x:2rem}.g-xl-5,.gy-xl-5{--bs-gutter-y:2rem}.g-xl-6,.gx-xl-6{--bs-gutter-x:3rem}.g-xl-6,.gy-xl-6{--bs-gutter-y:3rem}}@media (min-width: 1400px){.col-xxl{flex:1 0 0%}.row-cols-xxl-auto>*{flex:0 0 auto;width:auto}.row-cols-xxl-1>*{flex:0 0 auto;width:100%}.row-cols-xxl-2>*{flex:0 0 auto;width:50%}.row-cols-xxl-3>*{flex:0 0 auto;width:33.3333333333%}.row-cols-xxl-4>*{flex:0 0 auto;width:25%}.row-cols-xxl-5>*{flex:0 0 auto;width:20%}.row-cols-xxl-6>*{flex:0 0 auto;width:16.6666666667%}.col-xxl-auto{flex:0 0 auto;width:auto}.col-xxl-1{flex:0 0 auto;width:8.33333333%}.col-xxl-2{flex:0 0 auto;width:16.66666667%}.col-xxl-3{flex:0 0 auto;width:25%}.col-xxl-4{flex:0 0 auto;width:33.33333333%}.col-xxl-5{flex:0 0 auto;width:41.66666667%}.col-xxl-6{flex:0 0 auto;width:50%}.col-xxl-7{flex:0 0 auto;width:58.33333333%}.col-xxl-8{flex:0 0 auto;width:66.66666667%}.col-xxl-9{flex:0 0 auto;width:75%}.col-xxl-10{flex:0 0 auto;width:83.33333333%}.col-xxl-11{flex:0 0 auto;width:91.66666667%}.col-xxl-12{flex:0 0 auto;width:100%}[dir=\"ltr\"] .offset-xxl-0{margin-left:0}[dir=\"rtl\"] .offset-xxl-0{margin-right:0}[dir=\"ltr\"] .offset-xxl-1{margin-left:8.33333333%}[dir=\"rtl\"] .offset-xxl-1{margin-right:8.33333333%}[dir=\"ltr\"] .offset-xxl-2{margin-left:16.66666667%}[dir=\"rtl\"] .offset-xxl-2{margin-right:16.66666667%}[dir=\"ltr\"] .offset-xxl-3{margin-left:25%}[dir=\"rtl\"] .offset-xxl-3{margin-right:25%}[dir=\"ltr\"] .offset-xxl-4{margin-left:33.33333333%}[dir=\"rtl\"] .offset-xxl-4{margin-right:33.33333333%}[dir=\"ltr\"] .offset-xxl-5{margin-left:41.66666667%}[dir=\"rtl\"] .offset-xxl-5{margin-right:41.66666667%}[dir=\"ltr\"] .offset-xxl-6{margin-left:50%}[dir=\"rtl\"] .offset-xxl-6{margin-right:50%}[dir=\"ltr\"] .offset-xxl-7{margin-left:58.33333333%}[dir=\"rtl\"] .offset-xxl-7{margin-right:58.33333333%}[dir=\"ltr\"] .offset-xxl-8{margin-left:66.66666667%}[dir=\"rtl\"] .offset-xxl-8{margin-right:66.66666667%}[dir=\"ltr\"] .offset-xxl-9{margin-left:75%}[dir=\"rtl\"] .offset-xxl-9{margin-right:75%}[dir=\"ltr\"] .offset-xxl-10{margin-left:83.33333333%}[dir=\"rtl\"] .offset-xxl-10{margin-right:83.33333333%}[dir=\"ltr\"] .offset-xxl-11{margin-left:91.66666667%}[dir=\"rtl\"] .offset-xxl-11{margin-right:91.66666667%}.g-xxl-0,.gx-xxl-0{--bs-gutter-x:0}.g-xxl-0,.gy-xxl-0{--bs-gutter-y:0}.g-xxl-1,.gx-xxl-1{--bs-gutter-x:0.25rem}.g-xxl-1,.gy-xxl-1{--bs-gutter-y:0.25rem}.g-xxl-2,.gx-xxl-2{--bs-gutter-x:0.5rem}.g-xxl-2,.gy-xxl-2{--bs-gutter-y:0.5rem}.g-xxl-3,.gx-xxl-3{--bs-gutter-x:1rem}.g-xxl-3,.gy-xxl-3{--bs-gutter-y:1rem}.g-xxl-4,.gx-xxl-4{--bs-gutter-x:1.5rem}.g-xxl-4,.gy-xxl-4{--bs-gutter-y:1.5rem}.g-xxl-5,.gx-xxl-5{--bs-gutter-x:2rem}.g-xxl-5,.gy-xxl-5{--bs-gutter-y:2rem}.g-xxl-6,.gx-xxl-6{--bs-gutter-x:3rem}.g-xxl-6,.gy-xxl-6{--bs-gutter-y:3rem}}.cp-external-link:after{font-family:\"remixicon\";content:\"\\ecaf\"}:root{--cp-font-weight-semi-bold:600}.badge{display:inline-block;padding:0.35em 0.65em;font-size:0.75em;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:0.25rem}.badge:empty{display:none}.btn .badge{position:relative;top:-1px}.cp-badge-light{background:rgba(66, 89, 237, 0.08);color:#4259ed;font-weight:500}:root{--cp-font-weight-semi-bold:600}.cp-card{box-shadow:0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);transition:all 0.15s ease-in;height:100%;display:flex;flex-direction:column;justify-content:space-between;background:#ffffff;color:#08193e;border-radius:0.2rem}.cp-card:active,.cp-card:focus,.cp-card:hover{box-shadow:0 0.5rem 1rem rgba(0, 0, 0, 0.15)}.cp-card__body{padding:var(--cp-spacer-4)}.cp-card__title{display:block;font-size:1.375rem;font-weight:500;margin-bottom:var(--cp-spacer-3)}.cp-card__description{font-weight:300;font-size:0.875rem;margin-bottom:var(--cp-spacer-0)}.cp-card__image-wrapper{width:100%;max-width:250px;margin-bottom:var(--cp-spacer-3);position:relative;padding-top:66.6666666667%;background:#F7F8FA;animation:placeholder-shimmer 1.4s linear infinite forwards}[dir=\"ltr\"] .cp-card__image-wrapper{background:linear-gradient(to right, #ffffff 10%, #F7F8FA 40%, #ffffff 50%)}[dir=\"rtl\"] .cp-card__image-wrapper{background:linear-gradient(to left, #ffffff 10%, #F7F8FA 40%, #ffffff 50%)}[dir] .cp-card__image-wrapper{background-size:1500px 800px}.cp-card__image-wrapper img,.cp-card__image-wrapper svg,.cp-card__image-wrapper video,.cp-card__image-wrapper iframe,.cp-card__image-wrapper object,.cp-card__image-wrapper embed{width:100%;height:100%;position:absolute;top:0}[dir=\"ltr\"] .cp-card__image-wrapper img,[dir=\"ltr\"] .cp-card__image-wrapper svg,[dir=\"ltr\"] .cp-card__image-wrapper video,[dir=\"ltr\"] .cp-card__image-wrapper iframe,[dir=\"ltr\"] .cp-card__image-wrapper object,[dir=\"ltr\"] .cp-card__image-wrapper embed{left:0}[dir=\"rtl\"] .cp-card__image-wrapper img,[dir=\"rtl\"] .cp-card__image-wrapper svg,[dir=\"rtl\"] .cp-card__image-wrapper video,[dir=\"rtl\"] .cp-card__image-wrapper iframe,[dir=\"rtl\"] .cp-card__image-wrapper object,[dir=\"rtl\"] .cp-card__image-wrapper embed{right:0}@keyframes placeholder-shimmer{0%{background-position:-500px 0}100%{background-position:500px 0}}.cp-card__header{font-size:1.25rem;font-weight:500;padding:var(--cp-spacer-4);padding-bottom:0}.cp-card__header-icon{vertical-align:middle}[dir=\"ltr\"] .cp-card__header-icon{margin-right:var(--cp-spacer-2)}[dir=\"rtl\"] .cp-card__header-icon{margin-left:var(--cp-spacer-2)}.cp-card__header-text{vertical-align:middle}.cp-card__footer{border-top:var(--cp-border-width-1) solid #e6e9ef;padding:var(--cp-spacer-3)}.cp-card__footer--no-divider{padding-top:0;border-top:none}.cp-card--condensed .cp-card__body{padding:var(--cp-spacer-3) var(--cp-spacer-4)}.cp-card:hover{cursor:pointer;text-decoration:none}.starting-point-img-wrapper{padding-top:30%}.cp-welcome-modal__content-info-prompt{display:flex;border:1px solid var(--cp-primary-color);padding:var(--cp-spacer-2);border-radius:var(--cp-spacer-2);margin-bottom:var(--cp-spacer-1)}.cp-welcome-modal__content-info-prompt-icon{align-self:center;margin:0 var(--cp-spacer-2);display:block;color:var(--cp-primary-color)}.cp-welcome-modal__content-info-prompt-text{flex-grow:2}.cp-card__title{font-size:1.125rem;margin-bottom:var(--cp-spacer-2);text-align:center;font-weight:400}.cp-card__body{padding:var(--cp-spacer-5) var(--cp-spacer-3) var(--cp-spacer-3) var(--cp-spacer-3);position:relative}.starting-point-recommended-badge{position:absolute;top:var(--cp-spacer-2)}[dir=\"ltr\"] .starting-point-recommended-badge{right:var(--cp-spacer-2)}[dir=\"rtl\"] .starting-point-recommended-badge{left:var(--cp-spacer-2)}.starting-point-recommended-badge-mobile{display:none}.cp-welcome-modal__content-row{justify-content:center}.cp-card__description{font-size:0.75rem;text-align:center}.cp-card__icon{display:block;margin-left:auto;margin-right:auto;width:48px;height:48px}@media (max-width: 991.98px){.cp-card__icon{align-self:center;margin:0 var(--cp-spacer-3)}.cp-card__body{padding:var(--cp-spacer-2);display:flex;justify-content:space-around}[dir=\"ltr\"] .cp-card__description,[dir=\"ltr\"] .cp-card__title{text-align:left}[dir=\"rtl\"] .cp-card__description,[dir=\"rtl\"] .cp-card__title{text-align:right}.cp-card__text-container{flex-grow:2}}@media (max-width: 575.98px){.cp-welcome-modal__content-img-wrapper{display:none}.cp-card__body{padding:var(--cp-spacer-1)}.cp-card__icon{margin:0 var(--cp-spacer-2)}.starting-point-recommended-badge{display:none}.starting-point-recommended-badge-mobile{display:block;margin-bottom:var(--cp-spacer-1)}[dir=\"ltr\"] .starting-point-recommended-badge-mobile{float:right}[dir=\"rtl\"] .starting-point-recommended-badge-mobile{float:left}}";

const locale$9 = getLocaleInstance();
const CpWelcomeModalStartingPoint$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.startingPointLinkClick = createEvent(this, "modalButtonClick", 7);
    /**
     * Is true if the user is migrated to Jupiter theme by the system during upcp.
     */
    this.migratedToJupiter = false;
    this.options = getAvailableStartOptions();
    this.modalTitle = locale$9.maketext("Choose a starting point[comment,starting point view header title.]");
    this.startingPoingImg = (h("svg", { id: "bfd7ed38-e2c2-4ce4-aa7c-70bac4bc4918", "data-name": "Layer 1", xmlns: "http://www.w3.org/2000/svg", width: "807.9", height: "581.6", viewBox: "0 0 807.85972 581.58175" }, h("path", { d: "M 898.3 376.1 a 137.7 137.7 0 0 1 -11.9 56.2 q -1 2.2 -2.1 4.4 a 138.2 138.2 0 0 1 -262.4 -60.6 q 0 -4.8 0.3 -9.5 q 0.2 -2.4 0.4 -4.8 a 138.2 138.2 0 0 1 275.6 14.3 Z", transform: "translate(-196.1,-159.2)", fill: "var(--cp-graphic-color)" }), h("circle", { fill: "#f2f2f2", cx: "567.7", cy: "52.2", r: "1.6" }), h("circle", { fill: "#cccccc", cx: "357.6", cy: "119.8", r: "2.7" }), h("circle", { cx: "351.8", cy: "226.4", r: "5.4", fill: "#cccccc" }), h("circle", { cx: "674.8", cy: "61.7", r: "3.6", fill: "#cccccc" }), h("circle", { cx: "802", cy: "210.6", r: "5.8", fill: "#cccccc" }), h("circle", { cx: "756.5", cy: "117.6", r: "2.5", fill: "#cccccc" }), h("circle", { cx: "453.2", cy: "85.5", r: "3.9", fill: "#cccccc" }), h("circle", { cx: "747.8", cy: "198.8", r: "2.5", fill: "#cccccc" }), h("circle", { cx: "364.5", cy: "302.4", r: "3.1", fill: "#cccccc" }), h("circle", { cx: "427.3", cy: "345.7", r: "3.4", fill: "#cccccc" }), h("polygon", { points: "525.2,6.6 518.6,6.6 518.6,0 515,0 515,6.6 508.3,6.6 508.3,10.2 515,10.2 515,16.9 518.6,16.9 518.6,10.2 525.2,10.2 525.2,6.6", fill: "#cccccc" }), h("polygon", { points: "679.3,366.2 675.2,366.2 675.2,362 672.9,362 672.9,366.2 668.8,366.2 668.8,368.4 672.9,368.4 672.9,372.6 675.2,372.6 675.2,368.4 679.3,368.4 679.3,366.2", fill: "#cccccc" }), h("polygon", { points: "775.6,344.8 772.5,344.8 772.5,341.7 770.9,341.7 770.9,344.8 767.7,344.8 767.7,346.5 770.9,346.5 770.9,349.6 772.5,349.6 772.5,346.5 775.6,346.5 775.6,344.8", fill: "#cccccc" }), h("circle", { opacity: "0.1", style: { isolation: "isolate" }, cx: "566.1", cy: "108.7", r: "11.6" }), h("circle", { opacity: "0.1", style: { isolation: "isolate" }, cx: "476.9", cy: "193.7", r: "11.6" }), h("circle", { opacity: "0.1", style: { isolation: "isolate" }, cx: "605.2", cy: "310.3", r: "11.6" }), h("circle", { cx: "566.1", cy: "211.6", r: "11.6", opacity: "0.1", style: { isolation: "isolate" } }), h("circle", { cx: "482.7", cy: "275.5", r: "11.6", opacity: "0.1", style: { isolation: "isolate" } }), h("circle", { cx: "628.4", cy: "149.4", r: "11.6", opacity: "0.1", style: { isolation: "isolate" } }), h("circle", { cx: "666.9", cy: "228", r: "11.6", opacity: "0.1", style: { isolation: "isolate" } }), h("circle", { fill: "#ffffff", cx: "566.1", cy: "161", r: "15.3" }), h("path", { transform: "translate(-196.1,-159.2)", d: "M 762.2 298 a 21.6 21.6 0 0 0 -21.6 21.6 c 0 12 21.6 51.2 21.6 51.2 s 21.6 -39.2 21.6 -51.2 A 21.6 21.6 0 0 0 762.2 298 Z m 0 32.2 a 10 10 0 1 1 10 -10 a 10 10 0 0 1 -10 10 h 0 Z", fill: "#cccccc" }), h("circle", { cx: "482.7", cy: "226.4", r: "15.3", fill: "#ffffff" }), h("path", { transform: "translate(-196.1,-159.2)", d: "M 678.8 363.5 a 21.6 21.6 0 0 0 -21.6 21.6 c 0 12 21.6 51.2 21.6 51.2 s 21.6 -39.2 21.6 -51.2 A 21.6 21.6 0 0 0 678.8 363.5 Z m 0 32.2 a 10 10 0 1 1 10 -10 a 10 10 0 0 1 -10 10 h 0 Z", fill: "#cccccc" }), h("circle", { cx: "666.9", cy: "178.9", r: "15.3", fill: "#ffffff" }), h("path", { transform: "translate(-196.1,-159.2)", d: "M 863 316 a 21.6 21.6 0 0 0 -21.6 21.6 c 0 12 21.6 51.2 21.6 51.2 s 21.6 -39.2 21.6 -51.2 A 21.6 21.6 0 0 0 863 316 Z m 0 32.2 A 10 10 0 1 1 873 338.1 a 10 10 0 0 1 -10 10 Z", fill: "#cccccc" }), h("circle", { cx: "566.1", cy: "58.1", r: "15.3", fill: "#ffffff" }), h("path", { transform: "translate(-196.1,-159.2)", d: "M 762.2 195.1 a 21.6 21.6 0 0 0 -21.6 21.6 c 0 12 21.6 51.2 21.6 51.2 s 21.6 -39.2 21.6 -51.2 A 21.6 21.6 0 0 0 762.2 195.1 Z m 0 32.2 a 10 10 0 1 1 10 -10 a 10 10 0 0 1 -10 10 Z", fill: "#cccccc" }), h("circle", { cx: "605.2", cy: "261.2", r: "15.3", fill: "#ffffff" }), h("path", { transform: "translate(-196.1,-159.2)", d: "M 801.2 398.3 a 21.6 21.6 0 0 0 -21.6 21.6 c 0 12 21.6 51.2 21.6 51.2 s 21.6 -39.2 21.6 -51.2 A 21.6 21.6 0 0 0 801.2 398.3 Z m 0 32.2 a 10 10 0 1 1 10 -10 a 10 10 0 0 1 -10 10 Z", fill: "#3f3d56" }), h("circle", { cx: "476.9", cy: "143.6", r: "15.3", fill: "#ffffff" }), h("path", { transform: "translate(-196.1,-159.2)", d: "M 673 280.6 a 21.6 21.6 0 0 0 -21.6 21.6 c 0 12 21.6 51.2 21.6 51.2 s 21.6 -39.2 21.6 -51.2 A 21.6 21.6 0 0 0 673 280.6 Z m 0 32.2 a 10 10 0 1 1 10 -10 a 10 10 0 0 1 -10 10 Z", fill: "#3f3d56" }), h("circle", { cx: "628.4", cy: "100.8", r: "15.3", fill: "#ffffff" }), h("path", { transform: "translate(-196.1,-159.2)", d: "M 824.5 237.8 A 21.6 21.6 0 0 0 802.8 259.5 c 0 12 21.6 51.2 21.6 51.2 s 21.6 -39.2 21.6 -51.2 A 21.6 21.6 0 0 0 824.5 237.8 Z m 0 32.2 a 10 10 0 1 1 10 -10 A 10 10 0 0 1 824.5 270 h 0 Z", fill: "#3f3d56" }), h("polygon", { points: "188.9,569.7 201,568.3 201.5,520.7 183.5,522.7 188.9,569.7", fill: "#ffb8b8" }), h("path", { transform: "translate(687.6,1252.7) rotate(173.5)", d: "M 382.6 723.5 h 38.5 a 0 0 0 0 1 0 0 v 14.9 a 0 0 0 0 1 0 0 H 397.5 a 14.9 14.9 0 0 1 -14.9 -14.9 v 0 A 0 0 0 0 1 382.6 723.5 Z", fill: "#2f2e41" }), h("polygon", { points: "63.6,569 75.8,569 81.7,521.7 63.6,521.7 63.6,569", fill: "#ffb8b8" }), h("path", { transform: "translate(356.5,1305) rotate(180)", d: "M 257 724.7 h 38.5 a 0 0 0 0 1 0 0 v 14.9 a 0 0 0 0 1 0 0 H 271.9 a 14.9 14.9 0 0 1 -14.9 -14.9 v 0 A 0 0 0 0 1 257 724.7 Z", fill: "#2f2e41" }), h("path", { transform: "translate(-196.1,-159.2)", d: "M 347.6 516.7 l 7 22.8 l 38 82.2 l 10 78 l -23 1 l -14 -72 l -48 -52 l -42 136 l -19 -2 s 16 -176 38 -194 C 294.6 516.7 330.6 499.7 347.6 516.7 Z", fill: "#2f2e41" }), h("circle", { cx: "120.5", cy: "234.7", r: "24.6", fill: "#ffb8b8" }), h("path", { transform: "translate(-196.1,-159.2)", d: "M 350.1 521.2 s 3 -102 -39 -95 s -24.5 105.5 -24.5 105.5 s 9 18 31 -2 S 350.1 521.2 350.1 521.2 Z", fill: "#cccccc" }), h("polygon", { opacity: "0.2", points: "96,310 105.9,347.9 121,362.9 100,356 96,310" }), h("path", { fill: "#ffb8b8", transform: "translate(-196.1,-159.2)", d: "M 350.4 564.3 a 10.1 10.1 0 0 1 -5.3 -14.5 l -23.4 -27 l 18.4 -2.4 l 19.4 26 a 10.1 10.1 0 0 1 -9.1 17.9 Z" }), h("path", { fill: "#cccccc", transform: "translate(-196.1,-159.2)", d: "M 322 447 l 2.6 51.7 l 31 40 l -13 10 l -42 -42 s -15 -51 -4 -66 c 4.1 -5.6 8.7 -7.2 12.7 -6.9 A 13.8 13.8 0 0 1 322 447 Z" }), h("path", { fill: "#2f2e41", transform: "matrix(1,0,0,1,-196.1,-159.2)", d: "M 313.6 419.7 a 1 1 0 0 0 -0.1 -1.6 a 14.3 14.3 0 0 1 1.4 -25 c 7.2 -3.4 17 -0.8 22.3 -7.4 a 12.4 12.4 0 0 0 2.3 -10.1 c -1.2 -6.2 -5.8 -10.9 -11.1 -14.1 a 40.4 40.4 0 0 0 -61.1 39.1 c 0.7 6 2.5 12.8 -1 17.6 c -3.1 4.3 -9.1 5.1 -14.3 6.2 c -11.2 2.3 -22 7.6 -29.6 16.1 s -11.6 20.5 -9.4 31.7 s 11.5 21 22.8 22.8 c 9.2 1.4 18.7 -2.5 25.4 -8.9 s 11 -15 13.7 -23.9 c 3.2 -10.6 4.5 -22 10.2 -31.4 c 5.6 -9.2 17.8 -15.8 27.3 -11 a 1 1 0 0 0 1.1 -0.1 Z" }), h("path", { d: "M 504.1 740.8 h -307 a 1 1 0 0 1 0 -2 h 307 a 1 1 0 1 1 0 2 Z", transform: "translate(-196.1,-159.2)", fill: "#3f3d56" })));
  }
  getImagePath(imagekey) {
    return getAssetPath(`./assets/${imagekey}.svg`);
  }
  recommendedPart(option, classes) {
    return option.showBadge ? (h("span", { class: `badge cp-badge-light ${classes.join(" ")}`, innerHTML: option.badgeText })) : ("");
  }
  renderOption(option) {
    return (h("div", { class: "col-lg-4 col-md-12 g-3 card-list", key: option.key }, h("a", { class: "cp-card", href: "javascript:void(0)", onClick: () => this.linkClickHandler(option), id: `welcome-modal-option-${option.key}` }, h("div", { class: "cp-card__body" }, this.recommendedPart(option, ["starting-point-recommended-badge"]), h("img", { id: option.imageKey, class: "cp-card__icon", src: this.getImagePath(option.imageKey), alt: option.title }), h("div", { class: "cp-card__text-container" }, this.recommendedPart(option, ["starting-point-recommended-badge-mobile"]), h("span", { class: "cp-card__title" }, option.title), h("p", { class: "cp-card__description" }, option.description))))));
  }
  wordpressTileClicked() {
    const request = new UapiRequest({
      namespace: "WordPressSite",
      method: "create",
    });
    let eventInfo = { modalAction: WelcomeModalActions.CreateWebsite };
    UapiService.post(request)
      .then(() => {
      eventInfo["eventData"] = SiteInstallStatus.Started;
    })
      .catch(() => {
      eventInfo["eventData"] = SiteInstallStatus.Error;
    })
      .finally(() => {
      this.startingPointLinkClick.emit(eventInfo);
    });
  }
  linkClickHandler(option) {
    switch (option.key) {
      case AppKeys.BackupWizard:
      case AppKeys.SitePublisher:
      case AppKeys.FileManager:
      case SitejetInfo.Key:
      case AppKeys.Tools:
        this.startingPointLinkClick.emit({
          modalAction: WelcomeModalActions.RedirectToUrl,
          redirectUrl: option.url,
        });
        break;
      case AppKeys.WpToolkit:
        this.wordpressTileClicked();
        break;
    }
  }
  renderMigratedToJupiterAlert() {
    if (this.migratedToJupiter) {
      const alertText = locale$9.maketext("Welcome to Jupiter - the new theme for cPanel interface! We have been hard at work creating a new cPanel experience, and it has finally arrived. For more information, read our [output,url,_1,Jupiter blog post,title,Jupiter blog post,target,_2,class,cp-external-link] or [output,url,_3,Jupiter documentation,title,Jupiter documentation,target,_4,class,cp-external-link].", "https://go.cpanel.net/jupiterblogpost", "JupiterBlog", "https://go.cpanel.net/jupiter-interface", "JupiterDocs");
      return (h("div", { class: "cp-welcome-modal__content-info-prompt" }, h("cp-icon", { name: "thumb-up-fill", size: IconSize.lg, mode: IconMode.Centered, class: "cp-welcome-modal__content-info-prompt-icon" }), h("div", { class: "cp-welcome-modal__content-info-prompt-text", innerHTML: alertText })));
    }
  }
  componentDidLoad() {
    var _a, _b;
    // Track link clicks from cPanel Jupiter's Welcome Modal starting point options.
    const navLinkEls = (_a = this.optionsContainerEl) === null || _a === void 0 ? void 0 : _a.querySelectorAll("#welcomeModalStartingPointOptions a[id*='welcome-modal-option-']");
    if (navLinkEls === null || navLinkEls === void 0 ? void 0 : navLinkEls.length) {
      (_b = window["mixpanel"]) === null || _b === void 0 ? void 0 : _b.track_links(navLinkEls, "cPanel-Welcome-Modal-Nav-Link", linkEl => {
        return { "nav-link-id": linkEl.id };
      });
    }
  }
  render() {
    return (h("div", { class: "cp-welcome-modal__content" }, h("figure", { class: "cp-welcome-modal__content-img-wrapper starting-point-img-wrapper", role: "img", "aria-label": "" }, this.startingPoingImg), this.renderMigratedToJupiterAlert(), h("div", { class: "cp-welcome-modal__content-title", innerHTML: this.modalTitle }), h("div", { id: "welcomeModalStartingPointOptions", class: "container", ref: el => (this.optionsContainerEl = el) }, h("div", { class: "row row-cols-lg-3 row-cols-md-1 g-4 cp-welcome-modal__content-row" }, this.options.map(option => {
      if (option.show) {
        return this.renderOption(option);
      }
    })))));
  }
  static get style() { return cpWelcomeModalStartingPointCss; }
};

const cpWelcomeModalStartingPointFooterCss = "";

const locale$8 = getLocaleInstance();
const CpWelcomeModalStartingPointFooter$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.modalButtonClick = createEvent(this, "modalButtonClick", 7);
  }
  render() {
    return (h("button", { id: "btnSetupLater", type: "button", class: "cp-btn cp-btn--secondary", onClick: () => this.modalButtonClick.emit({ modalAction: WelcomeModalActions.Dismiss }) }, locale$8.maketext("Skip")));
  }
  static get style() { return cpWelcomeModalStartingPointFooterCss; }
};

const cpWelcomeModalWpInstallCss = "";

const locale$7 = getLocaleInstance();
const CpWelcomeModalWpInstall$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.nextStepEvent = createEvent(this, "modalButtonClick", 7);
    this.elIdPrefix = "welcome-modal-wp-install";
    /**
     * Text for the modal. Broken out for ease of using locale functions.
     */
    this.proTips = [
      locale$7.maketext("WordPress is the world’s most popular website builder, making website creation easy. With drag-and-drop features and over 55,000 plugins, you have the freedom to build anything you can imagine."),
      locale$7.maketext("You can easily search for cPanel features and applications using the search box in the top navigation bar."),
      locale$7.maketext("Need help? Our [output,url,_1,documentation,title,cPanel Documentation,target,_2,class,cp-external-link] has the answers. We have a robust knowledge base to help you make the most of cPanel.", "https://go.cpanel.net/cpanelhelp-documentation", "cPanel docs"),
    ];
    /**
     * Text for modal header.
     */
    this.viewHeader = locale$7.maketext("Did you know?[comment,Header title.]");
    this.wordpressSVG = (h("svg", { xmlns: "http://www.w3.org/2000/svg", "data-name": "Layer 1", width: "1113.88736", height: "612.2441", viewBox: "0 0 1113.88736 612.2441" }, h("title", null, "wordpress"), h("rect", { x: "476.90168", y: "96.25", width: "452", height: "93", fill: "none", stroke: "#3f3d56", "stroke-miterlimit": "10" }), h("path", { d: "M250.22415,372.229C263.11336,352.08825,287.517,338.5,315.5,338.5c41.42136,0,75,29.77306,75,66.5,0,23.48168-13.72626,44.12077-34.45252,55.9533", transform: "translate(-43.05632 -143.875)", fill: "none", stroke: "#3f3d56", "stroke-miterlimit": "10" }), h("rect", { x: "444.90168", y: "114.25", width: "452", height: "93", fill: "var(--cp-graphic-color)" }), h("circle", { cx: "159.17106", cy: "18.49996", r: "7.00009", fill: "var(--cp-graphic-color)" }), h("circle", { cx: "183.17106", cy: "18.49996", r: "7.00009", fill: "var(--cp-graphic-color)" }), h("circle", { cx: "207.17106", cy: "18.49996", r: "7.00009", fill: "var(--cp-graphic-color)" }), h("rect", { x: "140.17142", y: "0.5", width: "840", height: "546", fill: "none", stroke: "#3f3d56", "stroke-miterlimit": "10" }), h("line", { x1: "140.17142", y1: "30.83505", x2: "980.17142", y2: "30.83505", fill: "none", stroke: "#3f3d56", "stroke-miterlimit": "10" }), h("circle", { cx: "161.17106", cy: "15.49996", r: "7.00009", fill: "none", stroke: "#3f3d56", "stroke-miterlimit": "10" }), h("circle", { cx: "185.17106", cy: "15.49996", r: "7.00009", fill: "none", stroke: "#3f3d56", "stroke-miterlimit": "10" }), h("circle", { cx: "209.17106", cy: "15.49996", r: "7.00009", fill: "none", stroke: "#3f3d56", "stroke-miterlimit": "10" }), h("path", { d: "M75.27267,348.42356a21.61922,21.61922,0,1,0-26.639-31.90264l8.0969,7.65194L46.32837,320.94a21.53767,21.53767,0,0,0,.42814,16.46985,21.19971,21.19971,0,0,0,3.15322,5.07973A21.6151,21.6151,0,0,0,75.27267,348.42356Z", transform: "translate(-43.05632 -143.875)", fill: "#57b894" }), h("path", { d: "M183.44639,423.47872c-7.89466-5.53929-7.89618-17.16828-5.93507-26.61092s4.95464-19.74456.50306-28.29983c-6.3977-12.29544-23.21458-13.035-37.01248-14.349a130.15616,130.15616,0,0,1-30.04827-6.5136c-3.8984-1.344-7.80228-2.91353-10.99464-5.52363-4.59737-3.75884-7.29414-9.30238-9.81237-14.68041Q77.56317,300.62766,66.25742,273.18", transform: "translate(-43.05632 -143.875)", fill: "none", stroke: "#3f3d56", "stroke-miterlimit": "10" }), h("path", { d: "M73.9308,345.7404a21.61922,21.61922,0,1,0-26.639-31.90265l8.0969,7.65194L44.9865,318.25685a21.53767,21.53767,0,0,0,.42814,16.46985,21.19919,21.19919,0,0,0,3.15322,5.07973A21.61509,21.61509,0,0,0,73.9308,345.7404Z", transform: "translate(-43.05632 -143.875)", fill: "none", stroke: "#3f3d56", "stroke-miterlimit": "10" }), h("path", { d: "M47.58089,285.78442a21.594,21.594,0,0,1,1.72991-20.66591l8.61043,6.39795-5.3141-10.29993a21.61655,21.61655,0,1,1-5.02624,24.56789Z", transform: "translate(-43.05632 -143.875)", fill: "#57b894" }), h("path", { d: "M45.79173,282.20686A21.594,21.594,0,0,1,47.52164,261.541l8.61043,6.398L50.818,257.639a21.61656,21.61656,0,1,1-5.02623,24.56789Z", transform: "translate(-43.05632 -143.875)", fill: "none", stroke: "#3f3d56", "stroke-miterlimit": "10" }), h("path", { d: "M138.41288,357.002a21.61661,21.61661,0,0,0-12.83334-40.99231l4.08388,7.915-8.70985-6.47535a.37577.37577,0,0,0-.05415.023A21.61777,21.61777,0,1,0,138.41288,357.002Z", transform: "translate(-43.05632 -143.875)", fill: "#57b894" }), h("path", { d: "M136.47525,353.49867a21.61661,21.61661,0,0,0-12.83334-40.9923l4.08388,7.915-8.70986-6.47536a.378.378,0,0,0-.05415.02306,21.61777,21.61777,0,1,0,17.51347,39.52961Z", transform: "translate(-43.05632 -143.875)", fill: "none", stroke: "#3f3d56", "stroke-miterlimit": "10" }), h("path", { d: "M147.04276,398.48755a21.60757,21.60757,0,1,0-8.71949-15.097l16.98867,3.78678-14.82289,3.56438A21.41544,21.41544,0,0,0,147.04276,398.48755Z", transform: "translate(-43.05632 -143.875)", fill: "#57b894" }), h("path", { d: "M145.70089,395.80438a21.60757,21.60757,0,1,0-8.71949-15.097l16.98867,3.78678-14.82289,3.56438A21.41544,21.41544,0,0,0,145.70089,395.80438Z", transform: "translate(-43.05632 -143.875)", fill: "none", stroke: "#3f3d56", "stroke-miterlimit": "10" }), h("path", { d: "M1084.61287,602.26517a20.81252,20.81252,0,1,0,8.3387-39.13277l-.98562,10.67947-3.7314-9.80018a20.73405,20.73405,0,0,0-12.22123,10.10949,20.40828,20.40828,0,0,0-1.97438,5.40651A20.80854,20.80854,0,0,0,1084.61287,602.26517Z", transform: "translate(-43.05632 -143.875)", fill: "#57b894" }), h("path", { d: "M1092.0289,728.797c-.49451-9.27109,8.31332-16.18134,16.63109-20.306s17.89981-7.97772,21.73547-16.43263c5.51252-12.15118-3.91862-25.32906-11.121-36.56135a125.3002,125.3002,0,0,1-12.91856-26.63091c-1.29809-3.75147-2.42859-7.64108-2.34816-11.61.11584-5.71565,2.71274-11.052,5.29035-16.15471q12.88015-25.49811,26.95418-50.36938", transform: "translate(-43.05632 -143.875)", fill: "none", stroke: "#3f3d56", "stroke-miterlimit": "10" }), h("path", { d: "M1085.84808,599.65459a20.81252,20.81252,0,1,0,8.33869-39.13278l-.98561,10.67948-3.7314-9.80018a20.734,20.734,0,0,0-12.22123,10.10949,20.40859,20.40859,0,0,0-1.97439,5.4065A20.80855,20.80855,0,0,0,1085.84808,599.65459Z", transform: "translate(-43.05632 -143.875)", fill: "none", stroke: "#3f3d56", "stroke-miterlimit": "10" }), h("path", { d: "M1115.60841,544.07357a20.78822,20.78822,0,0,1,16.68183-10.96779l.26936,10.32343,4.64475-10.1448a20.81,20.81,0,1,1-21.59594,10.78916Z", transform: "translate(-43.05632 -143.875)", fill: "#57b894" }), h("path", { d: "M1117.25535,540.59279a20.78824,20.78824,0,0,1,16.68183-10.96779l.26936,10.32344,4.64475-10.14481a20.81,20.81,0,1,1-21.59594,10.78916Z", transform: "translate(-43.05632 -143.875)", fill: "none", stroke: "#3f3d56", "stroke-miterlimit": "10" }), h("path", { d: "M1115.62817,655.18935a20.81,20.81,0,0,0,23.42627-34.07564l-3.56911,7.796-.2698-10.44473a.36282.36282,0,0,0-.04963-.02732,20.81113,20.81113,0,1,0-19.53773,36.75172Z", transform: "translate(-43.05632 -143.875)", fill: "#57b894" }), h("path", { d: "M1117.13066,651.64023a20.81,20.81,0,0,0,23.42627-34.07565l-3.56912,7.796-.26979-10.44474a.36409.36409,0,0,0-.04964-.02732,20.81113,20.81113,0,1,0-19.53772,36.75173Z", transform: "translate(-43.05632 -143.875)", fill: "none", stroke: "#3f3d56", "stroke-miterlimit": "10" }), h("path", { d: "M1089.33088,686.374a20.80131,20.80131,0,1,0,6.25521-15.57438l7.225,15.11843-11.50663-9.11037A20.61639,20.61639,0,0,0,1089.33088,686.374Z", transform: "translate(-43.05632 -143.875)", fill: "#57b894" }), h("path", { d: "M1090.56608,683.76343a20.80131,20.80131,0,1,0,6.25521-15.57438l7.225,15.11842-11.50663-9.11037A20.61655,20.61655,0,0,0,1090.56608,683.76343Z", transform: "translate(-43.05632 -143.875)", fill: "none", stroke: "#3f3d56", "stroke-miterlimit": "10" }), h("path", { d: "M158.27267,262.42356a21.61922,21.61922,0,1,0-26.639-31.90264l8.0969,7.65194L129.32837,234.94a21.53767,21.53767,0,0,0,.42814,16.46985,21.19971,21.19971,0,0,0,3.15322,5.07973A21.6151,21.6151,0,0,0,158.27267,262.42356Z", transform: "translate(-43.05632 -143.875)", fill: "#57b894" }), h("path", { d: "M182.959,256.18177c-4.59737-3.75884-7.29414-9.30238-9.81237-14.68041q-12.58345-26.8737-23.8892-54.32135", transform: "translate(-43.05632 -143.875)", fill: "none", stroke: "#3f3d56", "stroke-miterlimit": "10" }), h("path", { d: "M156.9308,259.7404a21.61922,21.61922,0,1,0-26.639-31.90265l8.0969,7.65194-10.40218-3.23284a21.53767,21.53767,0,0,0,.42814,16.46985,21.19919,21.19919,0,0,0,3.15322,5.07973A21.61509,21.61509,0,0,0,156.9308,259.7404Z", transform: "translate(-43.05632 -143.875)", fill: "none", stroke: "#3f3d56", "stroke-miterlimit": "10" }), h("path", { d: "M130.58089,199.78442a21.594,21.594,0,0,1,1.72991-20.66591l8.61043,6.398-5.3141-10.29993a21.61655,21.61655,0,1,1-5.02624,24.56789Z", transform: "translate(-43.05632 -143.875)", fill: "#57b894" }), h("path", { d: "M128.79173,196.20686a21.594,21.594,0,0,1,1.72991-20.66591l8.61043,6.398L133.818,171.639a21.61656,21.61656,0,1,1-5.02623,24.56789Z", transform: "translate(-43.05632 -143.875)", fill: "none", stroke: "#3f3d56", "stroke-miterlimit": "10" }), h("line", { x1: "403.89774", y1: "30.83505", x2: "403.89774", y2: "547.27591", fill: "none", stroke: "#3f3d56", "stroke-miterlimit": "10" }), h("rect", { x: "498.40168", y: "284.75", width: "147", height: "20", fill: "#f2f2f2" }), h("rect", { x: "729.40168", y: "284.75", width: "147", height: "20", fill: "#f2f2f2" }), h("rect", { x: "506.40168", y: "274.75", width: "147", height: "20", fill: "none", stroke: "#3f3d56", "stroke-miterlimit": "10" }), h("rect", { x: "498.40168", y: "439.75", width: "147", height: "20", fill: "#f2f2f2" }), h("rect", { x: "506.40168", y: "429.75", width: "147", height: "20", fill: "none", stroke: "#3f3d56", "stroke-miterlimit": "10" }), h("rect", { x: "498.90168", y: "360.25", width: "378", height: "20", fill: "#f2f2f2" }), h("rect", { x: "506.90168", y: "352.25", width: "378", height: "20", fill: "none", stroke: "#3f3d56", "stroke-miterlimit": "10" }), h("rect", { x: "737.40168", y: "274.75", width: "147", height: "20", fill: "none", stroke: "#3f3d56", "stroke-miterlimit": "10" }), h("path", { d: "M974.12309,360.06179a20.52086,20.52086,0,0,0,1.20129,3.14327,52.96337,52.96337,0,0,1,.65343,39.86623c3.58806-.22468,7.17109.35557,10.75575.63294s7.295.23158,10.62749-1.17133,6.23339-4.40851,6.71888-8.11679c.65549-5.00687-2.98836-9.37369-6.18738-13.17378-3.25983-3.87234-6.40947-8.14314-7.37416-13.19348-1.06041-5.55146.44893-12.06057-3.058-16.38555a3.38957,3.38957,0,0,0-1.16552-.9944c-1.88372-.86332-6.788-.83559-8.68394.23344C974.69249,352.5479,973.40582,356.88787,974.12309,360.06179Z", transform: "translate(-43.05632 -143.875)", fill: "#3f3d56" }), h("path", { d: "M1073.42743,722.20289a25.20426,25.20426,0,0,1-1.17772,4.90714s-3.63344,8.36175-18.57731,6.10666c-9.76193-1.47433-9.69655-6.05-8.07825-9.59182a22.85,22.85,0,0,1,2.66512-4.14817c1.45254-1.96285,1.30857-9.45225,1.81893-16.283.506-6.83509,3.5942-7.184,3.5942-7.184l.18322,7.69c5.81876-7.63333,9.88839,1.30857,9.88839,1.30857s8.27437.172,7.26257-4.06964c-1.07779-4.51822-2.68694-11.67244-2.68694-11.67244s4.00424,1.85817,4.72831,3.16674c.72843,1.30857-.14395,18.83031-.79824,20.50093s0,6.1808.94655,7.48937A2.854,2.854,0,0,1,1073.42743,722.20289Z", transform: "translate(-43.05632 -143.875)", fill: "#3f3d56" }), h("path", { d: "M1070.66634,700.48935a8.14784,8.14784,0,0,1-5.69664,7.76417,10.97309,10.97309,0,0,1-9.58305-1.46123,5.62468,5.62468,0,0,1-2.36854-5.27354l.23114-1.93232.83751-7.04445,1.15154-9.70523s12.38344-6.30731,11.559-3.92571c-.30968.88982.37511,4.894,1.35654,9.56128.69792,3.33686,1.54413,7.00957,2.29,10.124A8.06769,8.06769,0,0,1,1070.66634,700.48935Z", transform: "translate(-43.05632 -143.875)", fill: "#fbbebe" }), h("path", { d: "M1052.25767,699.95721s10.723-12.595,19.50133,1.145l-1.47214,8.80255h-18.02919Z", transform: "translate(-43.05632 -143.875)", opacity: "0.1" }), h("path", { d: "M1052.25767,700.82959s10.723-12.595,19.50133,1.145l-1.47214,8.80255h-18.02919Z", transform: "translate(-43.05632 -143.875)", fill: "#3f3d56" }), h("circle", { cx: "1023.14048", cy: "563.63077", r: "1.09047", fill: "#f2f2f2" }), h("circle", { cx: "1009.20139", cy: "561.88327", r: "1.09047", fill: "#f2f2f2" }), h("circle", { cx: "1019.37911", cy: "571.02172", r: "1.09047", fill: "#f2f2f2" }), h("circle", { cx: "1009.86154", cy: "569.74011", r: "1.09047", fill: "#f2f2f2" }), h("circle", { cx: "1021.4874", cy: "567.55917", r: "1.09047", fill: "#f2f2f2" }), h("circle", { cx: "1009.20139", cy: "565.81167", r: "1.09047", fill: "#f2f2f2" }), h("circle", { cx: "1018.28867", cy: "575.07724", r: "1.09047", fill: "#f2f2f2" }), h("circle", { cx: "1009.86157", cy: "573.66858", r: "1.09051", fill: "#f2f2f2" }), h("path", { d: "M980.43174,735.39764l-14.83046,5.01618s-7.85141-7.85142-5.67047-10.25046c.92909-1.02507,1.7404-4.42734,2.35981-7.99537.20063-1.12538.37948-2.27256.5365-3.363.51473-3.54622.81131-6.52538.81131-6.52538s17.2295-8.28761,14.39427,0a20.40919,20.40919,0,0,0-.81568,7.24947,48.10707,48.10707,0,0,0,.92036,7.25821A69.13914,69.13914,0,0,0,980.43174,735.39764Z", transform: "translate(-43.05632 -143.875)", fill: "#fbbebe" }), h("path", { d: "M980.43174,735.39764l-14.83046,5.01618s-7.85141-7.85142-5.67047-10.25046c.92909-1.02507,1.7404-4.42734,2.35981-7.99537a15.499,15.499,0,0,1,1.73166,4.833c12.81089,7.03574,13.029,2.83523,13.029,2.83523a7.787,7.787,0,0,1,1.08611-3.049A69.13914,69.13914,0,0,0,980.43174,735.39764Z", transform: "translate(-43.05632 -143.875)", opacity: "0.1" }), h("path", { d: "M983.70316,746.84762s-2.56479,1.90615-10.0847,2.18095a39.65312,39.65312,0,0,0-5.86591.66064,73.28862,73.28862,0,0,1-24.05818.64958,52.18363,52.18363,0,0,1-6.11829-1.20117c-7.74237-2.12861-1.8538-7.03138-1.8538-7.03138s.3708-.32278,1.012-.807c1.64007-1.23006,5.04232-3.49822,8.53184-4.04783,4.85043-.76333,9.32138-9.37808,9.32138-9.37808l3.05333-5.50908c4.74138-4.0871,6.38146,5.50908,6.38146,5.50908,12.81089,7.03574,13.029,2.83523,13.029,2.83523.711-3.76432,2.01956-3.76432,2.01956-3.76432s3.19289,8.59729,4.34885,10.74336a2.12653,2.12653,0,0,0,.28348.43619C984.4665,738.88715,983.70316,746.84762,983.70316,746.84762Z", transform: "translate(-43.05632 -143.875)", fill: "#3f3d56" }), h("circle", { cx: "920.90925", cy: "587.59693", r: "1.09047", fill: "#f2f2f2" }), h("circle", { cx: "914.6638", cy: "590.65026", r: "1.09047", fill: "#f2f2f2" }), h("circle", { cx: "918.02116", cy: "589.08641", r: "1.09047", fill: "#f2f2f2" }), h("circle", { cx: "911.14952", cy: "592.44951", r: "1.09047", fill: "#f2f2f2" }), h("path", { d: "M978.0327,712.27957a20.40919,20.40919,0,0,0-.81568,7.24947c-3.869-1.29983-10.20685-1.073-14.3899-.72409.51473-3.54622.81131-6.52538.81131-6.52538S980.86793,703.992,978.0327,712.27957Z", transform: "translate(-43.05632 -143.875)", opacity: "0.1" }), h("path", { d: "M1068.15388,688.47232c-5.36076,5.25608-10.486,5.58322-14.06712,4.06966l1.15154-9.70523s12.38344-6.30731,11.559-3.92571C1066.48766,679.80086,1067.17245,683.80508,1068.15388,688.47232Z", transform: "translate(-43.05632 -143.875)", opacity: "0.1" }), h("path", { d: "M974.108,509.45127s-8.50669,4.79809-10.03335,14.17618-4.14381,21.3733-6.10666,23.55425-8.06951,9.16-5.67047,12.8676,2.83524,16.35712,2.83524,16.35712-.87238,11.34094,1.52666,15.04855,4.3619,27.26187-.87238,34.24091c0,0-1.74476,16.139-1.09047,17.66569s-2.83524,5.45237-1.74476,8.7238,6.32475,63.46563,5.67047,65.86467c0,0,16.57521-2.399,20.93711,1.52666,0,0,.87238-6.54284,0-11.12284s.65428-22.68187,2.61714-27.26187,2.399-22.02758,1.74476-23.77234c0,0,3.48952-15.48475,2.181-18.53807s5.67047-31.18758,5.67047-31.18758,3.48952-6.76094,2.61714-7.63332c0,0,5.67046-3.70762,5.01618-6.54285s5.23428-6.10666,5.23428-6.10666,5.23428,12.8676,6.979,14.83046,1.81321,14.61236,3.95993,17.2295,4.982,16.35712,7.81719,20.06473,14.17617,13.52189,15.92093,24.64473c0,0,10.25047,15.92093,9.81428,20.93711s11.559,14.17617,23.11806-2.83523a15.11356,15.11356,0,0,1-6.10666-12.43141c0-8.50571-9.16-35.76757-9.16-35.76757s-5.23427-7.63333-3.27142-11.34094.2181-14.61236.2181-14.61236l4.1438-6.76094s.65428-6.54285,1.30857-13.3038-3.92571-14.17617-1.74476-17.44759-.87238-19.61656-.87238-19.61656-2.71429-28.17483-6.76094-29.891S974.108,509.45127,974.108,509.45127Z", transform: "translate(-43.05632 -143.875)", fill: "#3f3d56" }), h("path", { d: "M993.97982,469.97609s-4.47968.51033-9.91895,1.025c-7.86888.74152-17.74859,1.49176-18.92634.71972-1.989-1.30857,0-17.88379,0-17.88379s.68485-18.10188.03056-30.75138c-.53214-10.26356,6.26368-17.80091,8.84158-20.27847.60195-.57577.9727-.87674.9727-.87674l2.18095,1.74476,12.43141,21.15521Z", transform: "translate(-43.05632 -143.875)", fill: "#fbbebe" }), h("path", { d: "M1042.5888,400.4038l-12.21332,7.41523-20.06473,15.26665s-20.719-10.90475-15.48474-17.2295a9.80613,9.80613,0,0,0,1.91488-4.279c1.57463-7.28437-1.91488-17.74856-1.91488-17.74856s27.29679-36.86241,25.7352-8.28761c-.62809,11.48052,2.80467,17.74857,7.13606,21.14211C1034.14853,401.73418,1042.5888,400.4038,1042.5888,400.4038Z", transform: "translate(-43.05632 -143.875)", fill: "#fbbebe" }), h("path", { d: "M1042.5888,400.4038l-12.21332,7.41523-20.06473,15.26665s-20.719-10.90475-15.48474-17.2295a9.80613,9.80613,0,0,0,1.91488-4.279c1.57463-7.28437-1.91488-17.74856-1.91488-17.74856s27.29679-36.86241,25.7352-8.28761c-.62809,11.48052,2.80467,17.74857,7.13606,21.14211C1034.14853,401.73418,1042.5888,400.4038,1042.5888,400.4038Z", transform: "translate(-43.05632 -143.875)", opacity: "0.1" }), h("ellipse", { cx: "962.06082", cy: "223.74844", rx: "25.25834", ry: "26.75955", opacity: "0.1" }), h("ellipse", { cx: "962.06082", cy: "222.87606", rx: "25.25834", ry: "26.75955", fill: "#fbbebe" }), h("path", { d: "M1042.5888,400.4038l-12.21332,7.41523-20.06473,15.26665s-20.719-10.90475-15.48474-17.2295a9.80613,9.80613,0,0,0,1.91488-4.279c22.85636,19.54131,29.80047-.68482,30.95638-4.89406C1034.14853,401.73418,1042.5888,400.4038,1042.5888,400.4038Z", transform: "translate(-43.05632 -143.875)", opacity: "0.1" }), h("path", { d: "M993.97982,469.97609s-4.47968.51033-9.91895,1.025c-.21373-4.69341-.92477-10.00184-.7939-13.23836.2181-5.45237.2181-6.10666-1.52666-9.16s-1.52667-5.45238-1.30857-9.37809c.20936-3.76-.78516-4.51892-4.3226-10.52526-.15271-.26173-.30973-.53217-.47549-.81567-1.736-2.99226-2.23329-8.40539-2.2507-13.51752a.12429.12429,0,0,0,0-.05671c-.00437-1.217.01741-2.41651.061-3.55933.00437-.048.00437-.09594.00437-.14392.12651-3.45464.41-6.39892.55833-7.79908.60195-.57577.9727-.87674.9727-.87674l2.18095,1.74476,12.43141,21.15521Z", transform: "translate(-43.05632 -143.875)", opacity: "0.1" }), h("path", { d: "M1058.458,403.625c-.01744-.00873,2.634,1.99562,2.61653,1.99128-7.895-3.40664-12.37471,13.753-13.57423,19.15308-.22246.99453-.33151,1.58774-.33151,1.58774s.13961,1.44815.314,3.75122c.58889,7.71184,1.60083,24.98061-.75024,29.18112a6.51339,6.51339,0,0,0-.5627,1.40015c-.7415,2.55173-.65428,6.38583-.27038,10.11091a101.26535,101.26535,0,0,0,1.92356,11.38891s5.23428,13.30379,3.05333,22.02759a32.36341,32.36341,0,0,0-.63682,9.89278,58.504,58.504,0,0,0,1.38268,9.02477c.205.868.34461,1.36528.34461,1.36528q-4.93334,1.688-9.64415,2.80033a93.54989,93.54989,0,0,1-18.65148,2.52553c-29.4908.93782-49.12807-13.19475-53.76477-17.04628-.36639-.30534-.64119-.54524-.81568-.711-3.05333-2.83523,2.83524-5.01618,2.181-6.979s2.98358-6.32476,2.98358-6.32476-.80263-7.19713,2.4688-8.7238,5.67046-6.76094,7.51554-11.12284c1.84071-4.3619-.31841-15.70283-.10032-21.15521s.2181-6.10666-1.52666-9.16-1.52667-5.45238-1.30857-9.37809c.20936-3.76-.78516-4.51892-4.3226-10.52526-.15271-.26173-.30974-.53217-.47549-.81567-1.736-2.99226.96938-8.14664.952-13.25877.00436-.01746,1.00436.01744,1,0-.00437-1.217-2.04361-2.85718-2-4,.00436-.048-1-.952-1-1a32.39519,32.39519,0,0,0-.47863-7.69453c17.44759-8.94189,21.5914.37511,21.5914.37511,25.5171,21.96215,31.30972-5.48291,31.30972-5.48291,13.88827-4.74574,32.1559,8.039,33.1984,8.78051C1061.10943,405.625,1058.458,403.625,1058.458,403.625Z", transform: "translate(-43.05632 -143.875)", fill: "#55536e" }), h("path", { d: "M964.838,467.75249s-2.183,11.64719,4.13051,18.14557a7.1,7.1,0,0,0,8.21306,1.41145c2.09688-1.031,4.44194-2.56084,5.32212-4.52342C984.23841,478.918,978.796,460.01012,964.838,467.75249Z", transform: "translate(-43.05632 -143.875)", fill: "#fbbebe" }), h("path", { d: "M1046.7326,459.28944a6.51339,6.51339,0,0,0-.5627,1.40015l.99889-25.49964.314-5.08163C1048.07173,437.82016,1049.08367,455.08893,1046.7326,459.28944Z", transform: "translate(-43.05632 -143.875)", opacity: "0.1" }), h("path", { d: "M1050.87641,504.217a32.36341,32.36341,0,0,0-.63682,9.89278c-1.41326,2.56043-2.62151,4.73265-3.40667,6.1459-.615,1.09921-.9727,1.736-.9727,1.736a41.19653,41.19653,0,0,0-3.53749,5.30843,10.2626,10.2626,0,0,0-1.47869,4.31392c0,3.3543-3.38047,25.709-19.41045,20.14761-10.35078-3.58986-3.74249-14.59055,2.23766-21.936a82.14651,82.14651,0,0,1,6.37709-6.96158s1.84944-2.35543,3.62476-4.81989a29.27006,29.27006,0,0,0,3.13618-4.99438c.76333-2.18095,5.797-11.77713,5.797-11.77713s4.99872-10.5776,3.90825-15.48474c-.61063-2.748-.67612-9.53947-.615-14.98747a101.26535,101.26535,0,0,0,1.92356,11.38891S1053.05736,495.4932,1050.87641,504.217Z", transform: "translate(-43.05632 -143.875)", opacity: "0.1" }), h("path", { d: "M1061.12687,405.63808s7.85142,5.45238,7.63332,19.62855-2.83523,38.71185-2.83523,38.71185l-1.63571,15.26664s-2.07191,6.21571-1.74476,8.06952S1045.424,520.247,1045.424,520.247s-5.01618,6.27168-5.01618,9.62417-3.38047,25.70721-19.41045,20.14579,8.61475-28.89758,8.61475-28.89758,5.99761-7.63332,6.76094-9.81427S1042.172,499.528,1042.172,499.528s4.99684-10.5776,3.90637-15.48474-.43619-22.723-.43619-22.723l1.09047-27.875.43619-7.08809S1051.20355,402.80285,1061.12687,405.63808Z", transform: "translate(-43.05632 -143.875)", fill: "#fbbebe" }), h("path", { d: "M977.84205,457.6742l11.9011-4.323a5.63319,5.63319,0,0,1,5.79116,1.19929l15.79421,14.91676s.87238,2.39429-.29079,2.28762-18.17458-17.11807-18.17458-17.11807l-16.866,5.67046h0A2.80135,2.80135,0,0,1,977.84205,457.6742Z", transform: "translate(-43.05632 -143.875)", fill: "var(--cp-graphic-color)" }), h("polygon", { points: "951.624 333.807 967.981 327.88 949.807 310.762 932.941 316.432 951.624 333.807", fill: "#4b4b5b" }), h("circle", { cx: "927.05229", cy: "381.35187", r: "1.45397", fill: "#f2f2f2" }), h("circle", { cx: "917.16527", cy: "400.03392", r: "1.45398", fill: "#f2f2f2" }), h("circle", { cx: "996.14627", cy: "406.82577", r: "1.45396", fill: "#f2f2f2" }), h("circle", { cx: "1004.36956", cy: "433.21874", r: "1.45398", fill: "#f2f2f2" }), h("circle", { cx: "1001.16656", cy: "425.79112", r: "1.45398", fill: "#f2f2f2" }), h("circle", { cx: "998.38703", cy: "416.30841", r: "1.45399", fill: "#f2f2f2" }), h("circle", { cx: "921.78106", cy: "390.19628", r: "1.45398", fill: "#f2f2f2" }), h("circle", { cx: "911.39801", cy: "409.73367", r: "1.45398", fill: "#f2f2f2" }), h("path", { d: "M1061.07889,405.60318l-.00436.0131c-7.895-3.40664-12.37471,13.753-13.57423,19.15308l-12.40085-17.74856s-5.086,8.13929-21.51728,9.37808c-16.43124,1.23442-20.42675-12.50556-20.42675-12.50556-2.25512-.17448-12.46629,18.20656-16.1739,24.80612-.15271-.26173-.30974-.53217-.47549-.81567-1.736-2.99226-2.23329-8.40539-2.2507-13.51752a.12429.12429,0,0,0,0-.05671c.013-1.18645.03488-2.37724.061-3.55933.00437-.048.00437-.09594.00437-.14392.17885-4.84172.65865-8.67582.65865-8.67582,17.44759-8.94189,21.5914.37511,21.5914.37511,25.5171,21.96215,31.30972-5.48291,31.30972-5.48291C1041.76876,392.07693,1060.03639,404.86165,1061.07889,405.60318Z", transform: "translate(-43.05632 -143.875)", fill: "var(--cp-graphic-color)" }), h("path", { d: "M964.29271,565.06548c.2181.54524,18.53807,21.70045,25.299,22.79093S964.29271,565.06548,964.29271,565.06548Z", transform: "translate(-43.05632 -143.875)", opacity: "0.1" }), h("path", { d: "M977.41051,532.61723s.186,14.91558-4.394,18.28407S977.41051,532.61723,977.41051,532.61723Z", transform: "translate(-43.05632 -143.875)", opacity: "0.1" }), h("path", { d: "M985.88411,537.91266s-.43619,17.55665,6.10666,21.70045C991.99077,559.61311,979.99555,547.945,985.88411,537.91266Z", transform: "translate(-43.05632 -143.875)", opacity: "0.1" }), h("path", { d: "M977.8146,628.09492s-12.21332,9.05094-15.59379,9.70523S977.8146,628.09492,977.8146,628.09492Z", transform: "translate(-43.05632 -143.875)", opacity: "0.1" }), h("path", { d: "M974.7656,351.1462c-2.63128,2.21724-1.68359,6.81984,1.00475,8.96755s6.36411,2.47745,9.80386,2.56616c6.62084.17075,13.3493-.21329,19.769,1.41531a16.02656,16.02656,0,0,1,7.58332,3.88476,17.06661,17.06661,0,0,1,3.94125,7.84032,42.93649,42.93649,0,0,1,1.3482,13.14281c-.15642,2.97384-.62194,5.9661-.19513,8.9133a28.50494,28.50494,0,0,0,2.78165,7.92946,329.46177,329.46177,0,0,0,16.84757,31.2541,5.81707,5.81707,0,0,0,2.195,2.40209c1.575.76033,3.42668-.0105,4.99967-.77495a37.53645,37.53645,0,0,1-1.54277-9.47076,4.23362,4.23362,0,0,0,4.475-1.56345,12.41834,12.41834,0,0,0,2.03861-4.58284l2.93454-10.11141c.90744-3.12675,2.25325-6.71538,5.37618-7.63591a19.4711,19.4711,0,0,0,3.29794-.76858,4.222,4.222,0,0,0,2.0369-4.15955,8.98407,8.98407,0,0,0-1.969-4.44041c-4.415-5.94025-11.77726-9.463-15.22357-16.013-2.95959-5.62487-2.44562-12.39362-1.46922-18.67415s2.3348-12.73739.83256-18.91328a25.05861,25.05861,0,0,0-9.72562-13.93155,39.2308,39.2308,0,0,0-15.90707-6.54037,15.882,15.882,0,0,0-8.04.05452c-1.983.67016-3.68141,1.99317-5.61693,2.79005-4.39726,1.81041-9.46615.72907-14.07978,1.88146a18.934,18.934,0,0,0-10.41411,7.52417,39.942,39.942,0,0,0-5.4535,11.86079c-.84961,2.773.51305,3.88235-1.96436,5.39029", transform: "translate(-43.05632 -143.875)", opacity: "0.1" }), h("path", { d: "M975.20179,350.27382c-2.63128,2.21724-1.68359,6.81984,1.00475,8.96755s6.36411,2.47745,9.80386,2.56616c6.62084.17075,13.3493-.21329,19.769,1.41531a16.02656,16.02656,0,0,1,7.58332,3.88476,17.0665,17.0665,0,0,1,3.94124,7.84032,42.93618,42.93618,0,0,1,1.34821,13.14281c-.15642,2.97384-.62194,5.9661-.19513,8.9133a28.50494,28.50494,0,0,0,2.78165,7.92946,329.46177,329.46177,0,0,0,16.84757,31.2541,5.81707,5.81707,0,0,0,2.195,2.40209c1.575.76033,3.42668-.0105,4.99967-.77495a37.53645,37.53645,0,0,1-1.54277-9.47076,4.23362,4.23362,0,0,0,4.475-1.56345,12.41834,12.41834,0,0,0,2.03861-4.58284l2.93454-10.11141c.90744-3.12675,2.25325-6.71538,5.37618-7.63591a19.4711,19.4711,0,0,0,3.29794-.76858,4.222,4.222,0,0,0,2.0369-4.15955,8.98407,8.98407,0,0,0-1.969-4.44041c-4.415-5.94025-11.77726-9.463-15.22357-16.013-2.95959-5.62487-2.44562-12.39362-1.46922-18.67415s2.3348-12.73739.83256-18.91328a25.05861,25.05861,0,0,0-9.72562-13.93155,39.2308,39.2308,0,0,0-15.90707-6.54037,15.88208,15.88208,0,0,0-8.04.05452c-1.983.67016-3.68141,1.99317-5.61693,2.79-4.39726,1.81041-9.46615.72907-14.07978,1.88146a18.934,18.934,0,0,0-10.41411,7.52417,39.942,39.942,0,0,0-5.4535,11.86079c-.84961,2.773.51305,3.88235-1.96436,5.39029", transform: "translate(-43.05632 -143.875)", fill: "#3f3d56" }), h("path", { d: "M972.47127,469.10371s19.95569-13.30379,25.62616-5.12523-17.55664,18.21093-17.55664,18.21093Z", transform: "translate(-43.05632 -143.875)", fill: "#fbbebe" }), h("path", { d: "M978.99355,405.88405c-.07325,1.2825-.31892,2.85493-1.03355,3.08753,1.86215-.04435,3.69756,1.32583,5.54553.9164,1.37608-.30488,2.67021-1.63957,3.50053-3.61023a1.68346,1.68346,0,0,1,.46864-.77027c.19416-.11365.40484-.00029.59884.11421a58.21646,58.21646,0,0,1,10.03848,7.57769c1.02241.95219,2.15681,1.98367,3.277,1.4863a25.02257,25.02257,0,0,0-2.14165-10.49378,13.41106,13.41106,0,0,0-5.7166-6.25441,17.50943,17.50943,0,0,0-6.72279-1.74968,6.73487,6.73487,0,0,1-2.89766-.72075c-.99141-.58255-4.1566-4.365-4.86728-1.61053-.34311,1.32981.09911,4.16256.10954,5.63366C979.1677,401.62451,979.11483,403.76042,978.99355,405.88405Z", transform: "translate(-43.05632 -143.875)", fill: "#3f3d56" }), h("g", { opacity: "0.1" }, h("path", { d: "M1042.14843,436.40872a5.81721,5.81721,0,0,1-2.195-2.40208,329.45713,329.45713,0,0,1-16.84756-31.25411,28.50429,28.50429,0,0,1-2.78167-7.92945c-.4268-2.94721.03871-5.93946.19514-8.9133a42.93606,42.93606,0,0,0-1.34821-13.1428,17.06665,17.06665,0,0,0-3.94123-7.84034,16.02653,16.02653,0,0,0-7.58332-3.88474c-6.41969-1.6286-13.14816-1.24457-19.769-1.41533-3.43977-.0887-7.11554-.41846-9.80387-2.56615a6.7741,6.7741,0,0,1-2.23992-7.1847,4.331,4.331,0,0,1-.55751.445c-2.56679,2.23375-1.61785,6.78717,1.05267,8.92063,2.68833,2.14769,6.3641,2.47744,9.80387,2.56615,6.62082.17076,13.34929-.21327,19.769,1.41533a16.02653,16.02653,0,0,1,7.58332,3.88474,17.06665,17.06665,0,0,1,3.94123,7.84034,42.93606,42.93606,0,0,1,1.34821,13.1428c-.15643,2.97383-.62194,5.96609-.19514,8.9133a28.5044,28.5044,0,0,0,2.78167,7.92945,329.45713,329.45713,0,0,0,16.84756,31.25411,5.81721,5.81721,0,0,0,2.195,2.40208c1.575.76035,3.42669-.01049,4.99967-.77494-.13077-.43853-.25118-.88-.36577-1.32308A3.98394,3.98394,0,0,1,1042.14843,436.40872Z", transform: "translate(-43.05632 -143.875)" }), h("path", { d: "M974.98919,350.51078c.10561-.0643.195-.127.28715-.19.01712-.0149.03049-.03221.04792-.0469Z", transform: "translate(-43.05632 -143.875)" }), h("path", { d: "M977.0211,348.1398c-.09214.063-.18154.12574-.28715.19l.33507-.23694c-.01743.01469-.0308.032-.04792.04691,2.06887-1.41469.86384-2.54547,1.67722-5.20026a40.34835,40.34835,0,0,1,5.32256-11.66747,23.1343,23.1343,0,0,0-1.61383,1.98764,39.94176,39.94176,0,0,0-5.45349,11.86078,18.56117,18.56117,0,0,0-.42682,3.53473A4.17039,4.17039,0,0,1,977.0211,348.1398Z", transform: "translate(-43.05632 -143.875)" }), h("path", { d: "M1063.72766,401.50083a19.47132,19.47132,0,0,1-3.29794.76858,6.36053,6.36053,0,0,0-3.64851,3.22129,5.23728,5.23728,0,0,1,1.90375-1.04035,19.47108,19.47108,0,0,0,3.29794-.76857,3.71942,3.71942,0,0,0,1.80756-2.21615C1063.76916,401.47687,1063.7493,401.49005,1063.72766,401.50083Z", transform: "translate(-43.05632 -143.875)" }), h("path", { d: "M1045.60533,426.163q.03762,1.13406.14592,2.26425a4.91225,4.91225,0,0,0,2.58437-1.64676,7.28053,7.28053,0,0,0,.86679-1.34871A3.88793,3.88793,0,0,1,1045.60533,426.163Z", transform: "translate(-43.05632 -143.875)" })), h("path", { d: "M967.64432,466.50791s5.26224-2.13014,8.35282-1.657", transform: "translate(-43.05632 -143.875)", opacity: "0.1" }), h("path", { d: "M982.8158,490.477s2.67087,4.14381,16.17338,5.88857S982.8158,490.477,982.8158,490.477Z", transform: "translate(-43.05632 -143.875)", opacity: "0.1" }), h("path", { d: "M977.96,505.96176s12.14489,10.68665,31.6259,6.76094S977.96,505.96176,977.96,505.96176Z", transform: "translate(-43.05632 -143.875)", opacity: "0.1" }), h("line", { x1: "880.40168", y1: "611.75", x2: "1080.40168", y2: "580.75", fill: "none", stroke: "#3f3d56", "stroke-miterlimit": "10" }), h("path", { d: "M224.36673,418.99808c0,26.13213,17.16823,48.71308,42.0635,59.41566l-35.6018-86.28266a59.38557,59.38557,0,0,0-6.4617,26.867Zm125.01888-3.33137c0-8.15883-3.31321-13.80909-6.15494-18.207-3.78329-5.438-7.328-10.04309-7.328-15.48106,0-6.06857,5.202-11.71757,12.53142-11.71757.3309,0,.64476.03643.96855.05276a79.973,79.973,0,0,0-50.40123-17.33015c-26.074,0-49.01373,11.83314-62.3589,29.7562,1.751.04648,3.40268.07788,4.803.07788,7.80658,0,19.89066-.83786,19.89066-.83786,4.0233-.20978,4.49763,5.01715.48,5.438,0,0-4.0446.42082-8.54364.62934l27.17888,71.50757L296.786,416.2257,285.15637,388.046c-4.019-.20853-7.82646-.62934-7.82646-.62934-4.02188-.20853-3.55039-5.64775.47149-5.438,0,0,12.3255.83787,19.65918.83787,7.80516,0,19.89065-.83787,19.89065-.83787,4.02613-.20978,4.499,5.01715.47859,5.438,0,0-4.05169.42081-8.54222.62934l26.97154,70.96617,7.443-22.00436c3.228-9.13111,5.68345-15.68958,5.68345-21.3411Z", transform: "translate(-43.05632 -143.875)", fill: "var(--cp-graphic-color)" }), h("path", { d: "M300.31082,424.7727l-22.393,57.55528a83.94664,83.94664,0,0,0,45.8681-1.05142,5.38774,5.38774,0,0,1-.53114-.90947ZM364.49036,387.325a44.91214,44.91214,0,0,1,.50273,6.78835c0,6.69916-1.41448,14.22991-5.67493,23.64617l-22.79772,58.3027c22.18847-11.445,37.11286-32.70821,37.11286-57.06411a59.7826,59.7826,0,0,0-9.143-31.67312Z", transform: "translate(-43.05632 -143.875)", fill: "var(--cp-graphic-color)" })));
  }
  stopPollingOnClose(newValue) {
    if (!newValue) {
      clearInterval(this.pollingIntervalId);
      this.pollingIntervalId = null;
    }
  }
  /*
   * Poll the status of wordpress install until the process is finished.
   */
  pollWordpressInstallStatus() {
    const request = new UapiRequest({
      namespace: "WordPressSite",
      method: "retrieve",
    });
    let eventInfo = { modalAction: WelcomeModalActions.AfterCreateWebsite };
    UapiService.get(request)
      .then(uapiResponse => {
      var _a;
      if (((_a = uapiResponse.data) === null || _a === void 0 ? void 0 : _a.install_status) === "success") {
        clearInterval(this.pollingIntervalId);
        this.pollingIntervalId = null;
        eventInfo["eventData"] = SiteInstallStatus.Success;
      }
    })
      .catch(errors => {
      eventInfo["eventData"] = SiteInstallStatus.Error;
      errors.forEach(error => console.error(error.message));
    })
      .finally(() => {
      if (eventInfo["eventData"] === SiteInstallStatus.Success ||
        eventInfo["eventData"] === SiteInstallStatus.Error) {
        this.nextStepEvent.emit(eventInfo);
      }
    });
  }
  componentWillLoad() {
    // Initiate the polling to check for wordpress install status.
    if (this.installStatus === SiteInstallStatus.Started && !this.pollingIntervalId) {
      this.pollingIntervalId = setInterval(() => {
        this.pollWordpressInstallStatus();
      }, 5000);
    }
  }
  render() {
    return (h("div", { id: `${this.elIdPrefix}-content`, class: "cp-welcome-modal__content" }, h("figure", { id: `${this.elIdPrefix}-figure`, class: "cp-welcome-modal__content-img-wrapper wp-install-wrapper", role: "img", "aria-label": "" }, this.wordpressSVG), h("p", { id: `${this.elIdPrefix}-in-progress-text`, class: "text-center" }, locale$7.maketext("Your WordPress site is being created.")), h("div", { id: `${this.elIdPrefix}-progress-bar`, class: "progress" }, h("div", { class: "progress-bar-indeterminate" })), h("div", { id: `${this.elIdPrefix}-tips-header`, class: "cp-welcome-modal__content-title tips-header", innerHTML: this.viewHeader }), h("div", { id: "pro-tips-container" }, this.proTips.map(tip => {
      return h("p", { innerHTML: tip });
    }))));
  }
  static get watchers() { return {
    "modalStatus": ["stopPollingOnClose"]
  }; }
  static get style() { return cpWelcomeModalWpInstallCss; }
};

const cpWelcomeModalWpInstallFooterCss = ":host{display:block}.wp-footer-explore__link{text-decoration:none}.wp-footer-explore__link:hover,.wp-footer-explore__link:focus,.wp-footer-explore__link:active{text-decoration:none}.wp-footer-explore__link-text{vertical-align:middle}.wp-footer-explore__link-text:hover,.wp-footer-explore__link-text:focus,.wp-footer-explore__link-text:active{text-decoration:underline}.wp-footer-explore__link-icon{vertical-align:middle}";

const locale$6 = getLocaleInstance();
const CpWelcomeModalWpInstallFooter$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.modalButtonClick = createEvent(this, "modalButtonClick", 7);
  }
  lnkExploreAccountHandler() {
    this.modalButtonClick.emit({ modalAction: WelcomeModalActions.Dismiss });
  }
  render() {
    return (h("div", { id: "wpInstallFooter" }, h("a", { id: "lnkExploreAccount", href: "javascript:void(0)", class: "wp-footer-explore__link", onClick: () => this.lnkExploreAccountHandler() }, h("span", { class: "wp-footer-explore__link-text" }, locale$6.maketext("Explore the account[comment,link title.]")), h("cp-icon", { name: "arrow-right-s-line", class: "wp-footer-explore__link-icon", size: IconSize.lg }))));
  }
  static get style() { return cpWelcomeModalWpInstallFooterCss; }
};

/**
# cpanel - ui/web-components/src/components/shared/services/whm/notifications.service.ts
#                                                  Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
 */
/**
 * Check if WHM version update is available, and if it is what version
 */
function getUpdateAvailabilityNotification(securityToken) {
  const url = `${buildRequestURL(securityToken, "get_update_availability")}?api.version=1`;
  return fetch(url)
    .then(resp => {
    return resp.json();
  })
    .then(data => {
    if (toBoolean(data.metadata.result)) {
      return data.data;
    }
  });
}
/**
 * Get filesystem quota enabled/disabled status
 */
function getQuotaNotification(securityToken) {
  const url = `${buildRequestURL(securityToken, "quota_enabled")}?api.version=1`;
  return fetch(url)
    .then(resp => {
    return resp.json();
  })
    .then(data => {
    if (toBoolean(data.metadata.result)) {
      return toBoolean(data.data);
    }
  });
}

const cpWhmHeaderNotificationsControlCss = ":root{--cp-font-weight-semi-bold:600}:host{display:block}button{border:1px solid var(--cp-primary-color);text-decoration:none;cursor:pointer;color:inherit;background:transparent;height:100%;width:100%;padding:var(--cp-spacer-2);display:flex;align-items:center;justify-content:center;box-sizing:border-box;border-radius:50%}.notifications-menu--expanded{background:var(--cp-primary-color);color:var(--cp-primary-contrast-text)}.notifications-menu--active{border:1px solid var(--cp-error-border-color)}.shake{animation:swing 1s ease 3s}@keyframes swing{0%{transform:rotateZ(0)}25%{transform:rotateZ(25deg)}50%{transform:rotateZ(-15deg)}75%{transform:rotateZ(10deg)}100%{transform:rotateZ(0)}}.notifications-menu--warning{color:#000000;background-color:#fff7df;border-color:#e0a800}.notifications-menu--warning.expanded{background-color:#ffc107;color:var(--cp-primary-contrast-text)}.notifications-menu--error{color:#000000;background-color:#fae5e7;border-color:#c82333}.notifications-menu--error.expanded{background-color:#dc3545;color:var(--cp-primary-contrast-text)}";

const locale$5 = getLocaleInstance();
const CpWhmHeaderNotificationsControl$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
    this.toggleExpand = createEvent(this, "toggleExpand", 7);
  }
  /**
   * Listens for clicks and flips the menu expanded state.
   */
  toggleMenu(e) {
    e.stopPropagation();
    this.toggleExpand.emit(!this.isMenuExpanded);
  }
  /**
   * Handles when a user moves away from the account menu component.
   */
  handleFocusOut() {
    this.toggleExpand.emit(false);
  }
  /**
   * If the notification badge should be displayed to the user
   */
  get _showNotificationBadge() {
    return this._notifications.length ? true : false;
  }
  get _notificationClasses() {
    let cssClass = "header__control";
    if (this.isMenuExpanded) {
      cssClass += " notifications-menu--expanded expanded";
    }
    if (this._showNotificationBadge) {
      cssClass += " shake notifications-menu--error";
    }
    return cssClass;
  }
  async componentWillLoad() {
    let updateAvailable = await getUpdateAvailabilityNotification(state.directoryPrefix);
    let quotaEnabled = await getQuotaNotification(state.directoryPrefix);
    this._notifications = state.whmNotifications.filter(notification => {
      if (notification.name === "version_update_available") {
        notification.isShown = updateAvailable.update_available;
        if (notification.isShown) {
          notification.text = locale$5.maketext("Version “[_1]” is available.", updateAvailable.newest_version);
        }
      }
      if (notification.name === "quota_disabled") {
        notification.isShown = !quotaEnabled;
      }
      return notification.isShown;
    });
  }
  render() {
    return (h(Host, null, h("cp-dir", null, h("cp-header-control", { "show-badge": this._showNotificationBadge }, h("button", { tabindex: "0", id: "notifications-menu-button", class: this._notificationClasses, title: locale$5.maketext("Notifications Menu"), "aria-label": locale$5.maketext("Notifications Menu") }, h("cp-icon", { name: "notification-3-line", size: IconSize.sm, mode: IconMode.Centered, class: this._showNotificationBadge ? "shake" : "" }))), this.isMenuExpanded && (h("cp-whm-header-notifications-dropdown", { notifications: this._notifications })))));
  }
  get el() { return this; }
  static get style() { return cpWhmHeaderNotificationsControlCss; }
};

const cpWhmHeaderNotificationsDropdownCss = ":root{--cp-font-weight-semi-bold:600}:root{--cp-font-weight-semi-bold:600}.list-group{display:flex;flex-direction:column;margin-bottom:0;border-radius:0.25rem}[dir=\"ltr\"] .list-group{padding-left:0}[dir=\"rtl\"] .list-group{padding-right:0}.list-group-numbered{list-style-type:none;counter-reset:section}.list-group-numbered>li::before{content:counters(section, \".\") \". \";counter-increment:section}.list-group-item-action{width:100%;color:#495057;text-align:inherit}.list-group-item-action:hover,.list-group-item-action:focus{z-index:1;color:#495057;text-decoration:none;background-color:#f5f6f7}.list-group-item-action:active{color:#08193e;background-color:#e9ecef}.list-group-item{position:relative;display:block;padding:0.5rem 1rem;color:#08193e;text-decoration:none;background-color:#fff;border:1px solid rgba(0, 0, 0, 0.125)}.list-group-item:first-child{border-top-left-radius:inherit;border-top-right-radius:inherit}.list-group-item:last-child{border-bottom-right-radius:inherit;border-bottom-left-radius:inherit}.list-group-item.disabled,.list-group-item:disabled{color:#6c757d;pointer-events:none;background-color:#fff}.list-group-item.active{z-index:2;color:#fff;background-color:#0d6efd;border-color:#0d6efd}.list-group-item+.list-group-item{border-top-width:0}.list-group-item+.list-group-item.active{margin-top:-1px;border-top-width:1px}.list-group-horizontal{flex-direction:row}[dir=\"ltr\"] .list-group-horizontal>.list-group-item:first-child{border-bottom-left-radius:0.25rem;border-top-right-radius:0}[dir=\"rtl\"] .list-group-horizontal>.list-group-item:first-child{border-bottom-right-radius:0.25rem;border-top-left-radius:0}[dir=\"ltr\"] .list-group-horizontal>.list-group-item:last-child{border-top-right-radius:0.25rem;border-bottom-left-radius:0}[dir=\"rtl\"] .list-group-horizontal>.list-group-item:last-child{border-top-left-radius:0.25rem;border-bottom-right-radius:0}.list-group-horizontal>.list-group-item.active{margin-top:0}.list-group-horizontal>.list-group-item+.list-group-item{border-top-width:1px}[dir=\"ltr\"] .list-group-horizontal>.list-group-item+.list-group-item{border-left-width:0}[dir=\"rtl\"] .list-group-horizontal>.list-group-item+.list-group-item{border-right-width:0}[dir=\"ltr\"] .list-group-horizontal>.list-group-item+.list-group-item.active{margin-left:-1px;border-left-width:1px}[dir=\"rtl\"] .list-group-horizontal>.list-group-item+.list-group-item.active{margin-right:-1px;border-right-width:1px}@media (min-width: 576px){.list-group-horizontal-sm{flex-direction:row}[dir=\"ltr\"] .list-group-horizontal-sm>.list-group-item:first-child{border-bottom-left-radius:0.25rem;border-top-right-radius:0}[dir=\"rtl\"] .list-group-horizontal-sm>.list-group-item:first-child{border-bottom-right-radius:0.25rem;border-top-left-radius:0}[dir=\"ltr\"] .list-group-horizontal-sm>.list-group-item:last-child{border-top-right-radius:0.25rem;border-bottom-left-radius:0}[dir=\"rtl\"] .list-group-horizontal-sm>.list-group-item:last-child{border-top-left-radius:0.25rem;border-bottom-right-radius:0}.list-group-horizontal-sm>.list-group-item.active{margin-top:0}.list-group-horizontal-sm>.list-group-item+.list-group-item{border-top-width:1px}[dir=\"ltr\"] .list-group-horizontal-sm>.list-group-item+.list-group-item{border-left-width:0}[dir=\"rtl\"] .list-group-horizontal-sm>.list-group-item+.list-group-item{border-right-width:0}[dir=\"ltr\"] .list-group-horizontal-sm>.list-group-item+.list-group-item.active{margin-left:-1px;border-left-width:1px}[dir=\"rtl\"] .list-group-horizontal-sm>.list-group-item+.list-group-item.active{margin-right:-1px;border-right-width:1px}}@media (min-width: 768px){.list-group-horizontal-md{flex-direction:row}[dir=\"ltr\"] .list-group-horizontal-md>.list-group-item:first-child{border-bottom-left-radius:0.25rem;border-top-right-radius:0}[dir=\"rtl\"] .list-group-horizontal-md>.list-group-item:first-child{border-bottom-right-radius:0.25rem;border-top-left-radius:0}[dir=\"ltr\"] .list-group-horizontal-md>.list-group-item:last-child{border-top-right-radius:0.25rem;border-bottom-left-radius:0}[dir=\"rtl\"] .list-group-horizontal-md>.list-group-item:last-child{border-top-left-radius:0.25rem;border-bottom-right-radius:0}.list-group-horizontal-md>.list-group-item.active{margin-top:0}.list-group-horizontal-md>.list-group-item+.list-group-item{border-top-width:1px}[dir=\"ltr\"] .list-group-horizontal-md>.list-group-item+.list-group-item{border-left-width:0}[dir=\"rtl\"] .list-group-horizontal-md>.list-group-item+.list-group-item{border-right-width:0}[dir=\"ltr\"] .list-group-horizontal-md>.list-group-item+.list-group-item.active{margin-left:-1px;border-left-width:1px}[dir=\"rtl\"] .list-group-horizontal-md>.list-group-item+.list-group-item.active{margin-right:-1px;border-right-width:1px}}@media (min-width: 992px){.list-group-horizontal-lg{flex-direction:row}[dir=\"ltr\"] .list-group-horizontal-lg>.list-group-item:first-child{border-bottom-left-radius:0.25rem;border-top-right-radius:0}[dir=\"rtl\"] .list-group-horizontal-lg>.list-group-item:first-child{border-bottom-right-radius:0.25rem;border-top-left-radius:0}[dir=\"ltr\"] .list-group-horizontal-lg>.list-group-item:last-child{border-top-right-radius:0.25rem;border-bottom-left-radius:0}[dir=\"rtl\"] .list-group-horizontal-lg>.list-group-item:last-child{border-top-left-radius:0.25rem;border-bottom-right-radius:0}.list-group-horizontal-lg>.list-group-item.active{margin-top:0}.list-group-horizontal-lg>.list-group-item+.list-group-item{border-top-width:1px}[dir=\"ltr\"] .list-group-horizontal-lg>.list-group-item+.list-group-item{border-left-width:0}[dir=\"rtl\"] .list-group-horizontal-lg>.list-group-item+.list-group-item{border-right-width:0}[dir=\"ltr\"] .list-group-horizontal-lg>.list-group-item+.list-group-item.active{margin-left:-1px;border-left-width:1px}[dir=\"rtl\"] .list-group-horizontal-lg>.list-group-item+.list-group-item.active{margin-right:-1px;border-right-width:1px}}@media (min-width: 1200px){.list-group-horizontal-xl{flex-direction:row}[dir=\"ltr\"] .list-group-horizontal-xl>.list-group-item:first-child{border-bottom-left-radius:0.25rem;border-top-right-radius:0}[dir=\"rtl\"] .list-group-horizontal-xl>.list-group-item:first-child{border-bottom-right-radius:0.25rem;border-top-left-radius:0}[dir=\"ltr\"] .list-group-horizontal-xl>.list-group-item:last-child{border-top-right-radius:0.25rem;border-bottom-left-radius:0}[dir=\"rtl\"] .list-group-horizontal-xl>.list-group-item:last-child{border-top-left-radius:0.25rem;border-bottom-right-radius:0}.list-group-horizontal-xl>.list-group-item.active{margin-top:0}.list-group-horizontal-xl>.list-group-item+.list-group-item{border-top-width:1px}[dir=\"ltr\"] .list-group-horizontal-xl>.list-group-item+.list-group-item{border-left-width:0}[dir=\"rtl\"] .list-group-horizontal-xl>.list-group-item+.list-group-item{border-right-width:0}[dir=\"ltr\"] .list-group-horizontal-xl>.list-group-item+.list-group-item.active{margin-left:-1px;border-left-width:1px}[dir=\"rtl\"] .list-group-horizontal-xl>.list-group-item+.list-group-item.active{margin-right:-1px;border-right-width:1px}}@media (min-width: 1400px){.list-group-horizontal-xxl{flex-direction:row}[dir=\"ltr\"] .list-group-horizontal-xxl>.list-group-item:first-child{border-bottom-left-radius:0.25rem;border-top-right-radius:0}[dir=\"rtl\"] .list-group-horizontal-xxl>.list-group-item:first-child{border-bottom-right-radius:0.25rem;border-top-left-radius:0}[dir=\"ltr\"] .list-group-horizontal-xxl>.list-group-item:last-child{border-top-right-radius:0.25rem;border-bottom-left-radius:0}[dir=\"rtl\"] .list-group-horizontal-xxl>.list-group-item:last-child{border-top-left-radius:0.25rem;border-bottom-right-radius:0}.list-group-horizontal-xxl>.list-group-item.active{margin-top:0}.list-group-horizontal-xxl>.list-group-item+.list-group-item{border-top-width:1px}[dir=\"ltr\"] .list-group-horizontal-xxl>.list-group-item+.list-group-item{border-left-width:0}[dir=\"rtl\"] .list-group-horizontal-xxl>.list-group-item+.list-group-item{border-right-width:0}[dir=\"ltr\"] .list-group-horizontal-xxl>.list-group-item+.list-group-item.active{margin-left:-1px;border-left-width:1px}[dir=\"rtl\"] .list-group-horizontal-xxl>.list-group-item+.list-group-item.active{margin-right:-1px;border-right-width:1px}}.list-group-flush{border-radius:0}.list-group-flush>.list-group-item{border-width:0 0 1px}.list-group-flush>.list-group-item:last-child{border-bottom-width:0}.list-group-item-primary{color:#084298;background-color:#cfe2ff}.list-group-item-primary.list-group-item-action:hover,.list-group-item-primary.list-group-item-action:focus{color:#084298;background-color:#bacbe6}.list-group-item-primary.list-group-item-action.active{color:#fff;background-color:#084298;border-color:#084298}.list-group-item-secondary{color:#41464b;background-color:#e2e3e5}.list-group-item-secondary.list-group-item-action:hover,.list-group-item-secondary.list-group-item-action:focus{color:#41464b;background-color:#cbccce}.list-group-item-secondary.list-group-item-action.active{color:#fff;background-color:#41464b;border-color:#41464b}.list-group-item-success{color:#0f5132;background-color:#d1e7dd}.list-group-item-success.list-group-item-action:hover,.list-group-item-success.list-group-item-action:focus{color:#0f5132;background-color:#bcd0c7}.list-group-item-success.list-group-item-action.active{color:#fff;background-color:#0f5132;border-color:#0f5132}.list-group-item-info{color:#055160;background-color:#cff4fc}.list-group-item-info.list-group-item-action:hover,.list-group-item-info.list-group-item-action:focus{color:#055160;background-color:#badce3}.list-group-item-info.list-group-item-action.active{color:#fff;background-color:#055160;border-color:#055160}.list-group-item-warning{color:#664d03;background-color:#fff3cd}.list-group-item-warning.list-group-item-action:hover,.list-group-item-warning.list-group-item-action:focus{color:#664d03;background-color:#e6dbb9}.list-group-item-warning.list-group-item-action.active{color:#fff;background-color:#664d03;border-color:#664d03}.list-group-item-danger{color:#842029;background-color:#f8d7da}.list-group-item-danger.list-group-item-action:hover,.list-group-item-danger.list-group-item-action:focus{color:#842029;background-color:#dfc2c4}.list-group-item-danger.list-group-item-action.active{color:#fff;background-color:#842029;border-color:#842029}.list-group-item-light{color:#636464;background-color:#fefefe}.list-group-item-light.list-group-item-action:hover,.list-group-item-light.list-group-item-action:focus{color:#636464;background-color:#e5e5e5}.list-group-item-light.list-group-item-action.active{color:#fff;background-color:#636464;border-color:#636464}.list-group-item-dark{color:#141619;background-color:#d3d3d4}.list-group-item-dark.list-group-item-action:hover,.list-group-item-dark.list-group-item-action:focus{color:#141619;background-color:#bebebf}.list-group-item-dark.list-group-item-action.active{color:#fff;background-color:#141619;border-color:#141619}.list-group{background-color:var(--cp-secondary-background)}.list-group-item,.list-group-item-action{box-sizing:border-box;border:0px solid transparent}.list-group-item.active,.list-group-item-action.active{background-color:var(--cp-primary-action-opacity-10);color:var(--cp-body-color);border:0px solid transparent}:host{display:block;z-index:1032;position:relative}.list-group{background-color:var(--cp-secondary-background);z-index:1032}.notifications-menu__list{position:absolute;top:0.8rem;border-radius:0.25rem;border:1px solid #e6e9ef;box-shadow:0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);overflow:hidden;list-style-type:none;padding:0;margin:var(--cp-spacer-1);background:#ffffff;min-width:248px;overflow-y:auto;max-height:calc(100vh - 60px)}[dir=\"ltr\"] .notifications-menu__list{right:0}[dir=\"rtl\"] .notifications-menu__list{left:0}@media (max-width: 575.98px){.notifications-menu__list{top:0.8rem;width:100%;border:none;box-shadow:none;margin-right:0;margin-left:0}}.notifications-menu__list-item{padding:var(--cp-spacer-3);border-top:none;border-left:none;border-right:none;border-bottom:1px solid #e6e9ef;width:unset;display:flex;align-items:center}li:nth-last-child(1) .server-menu__list-item{border-bottom:none}.list-group-item-no-action{margin:0}.notifications-menu__list-icons{text-decoration:none;vertical-align:middle}[dir=\"ltr\"] .notifications-menu__list-icons{padding:0 var(--cp-spacer-3) 0 0}[dir=\"rtl\"] .notifications-menu__list-icons{padding:0 0 0 var(--cp-spacer-3)}.notifications-menu__list-icons:focus,.notifications-menu__list-icons:hover{text-decoration:none}";

const locale$4 = getLocaleInstance();
const CpWhmHeaderNotificationsDropdown$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
    this.menuItemPress = createEvent(this, "menuItemPress", 7);
  }
  /**
   * Handles the menu item click event.
   * @param menuItem The menu item pressed
   */
  menuItemPressHandler(menuItem) {
    this.menuItemPress.emit(menuItem);
  }
  /**
   * Determines whether or not a URL is absolute or requires a session token.
   * @param url is the URL being analyzed.
   */
  buildUrl(url) {
    const regex = new RegExp("^http(s)?://");
    return regex.test(url) ? url : state.directoryPrefix + "/" + url;
  }
  /**
   * Check if any notifications exist and return the correct template to reflect that status.
   */
  get notificationsComponent() {
    return this.notifications && this.notifications.length ? (this.notifications.map(notification => (h("li", null, h("a", { href: this.buildUrl(notification.url), target: "_blank", "aria-label": notification.title, title: notification.title, class: "list-group-item list-group-item-action notifications-menu__list-item", onClick: _ => this.menuItemPressHandler(notification) }, h("cp-icon", { name: "error-warning-line", class: "notifications-menu__list-icons" }), h("span", { class: "notifications-menu__list-text", innerHTML: notification.text })))))) : (h("li", null, h("p", { class: "list-group-item list-group-item-no-action notifications-menu__list-item" }, h("cp-icon", { name: "check-line", class: "notifications-menu__list-icons" }), h("span", { class: "notifications-menu__list-text" }, locale$4.maketext("You have no notifications.")))));
  }
  render() {
    return (h(Host, null, h("cp-dir", null, h("ul", { class: "notifications-menu__list list-group" }, this.notificationsComponent))));
  }
  static get style() { return cpWhmHeaderNotificationsDropdownCss; }
};

const cpWhmHeaderStatsControlCss = ":root{--cp-font-weight-semi-bold:600}:host{display:block;background-color:var(--cp-tertiary-background);color:var(--cp-body-color);padding:0.4rem;height:50px}.cpanel-whm-header-stats__wrapper{display:grid;grid-auto-flow:column;grid-template-columns:min-content fit-content(20%) min-content min-content 3fr;gap:0px 10px;justify-items:stretch;align-items:start;margin-left:20px;margin-right:20px}.cpanel-whm-header-stats__cell1,.cpanel-whm-header-stats__cell2,.cpanel-whm-header-stats__cell3,.cpanel-whm-header-stats__cell4{padding-top:2.641px}.cpanel-whm-header-stats__cell1 .cpanel-whm-header-stats__cell_data,.cpanel-whm-header-stats__cell2 .cpanel-whm-header-stats__cell_data,.cpanel-whm-header-stats__cell3 .cpanel-whm-header-stats__cell_data,.cpanel-whm-header-stats__cell4 .cpanel-whm-header-stats__cell_data{overflow:hidden}.cpanel-whm-header-stats__cell1,.cpanel-whm-header-stats__cell2,.cpanel-whm-header-stats__cell3,.cpanel-whm-header-stats__cell4,.cpanel-whm-header-stats__cell5{font-size:0.8rem;white-space:nowrap}.cpanel-whm-header-stats__cell1 .cpanel-whm-header-stats__cell_label,.cpanel-whm-header-stats__cell2 .cpanel-whm-header-stats__cell_label,.cpanel-whm-header-stats__cell3 .cpanel-whm-header-stats__cell_label,.cpanel-whm-header-stats__cell4 .cpanel-whm-header-stats__cell_label,.cpanel-whm-header-stats__cell5 .cpanel-whm-header-stats__cell_label{font-size:0.7rem;font-weight:100}.cpanel-whm-header-stats__cell1 .cpanel-whm-header-stats__cell_data,.cpanel-whm-header-stats__cell2 .cpanel-whm-header-stats__cell_data,.cpanel-whm-header-stats__cell3 .cpanel-whm-header-stats__cell_data,.cpanel-whm-header-stats__cell4 .cpanel-whm-header-stats__cell_data,.cpanel-whm-header-stats__cell5 .cpanel-whm-header-stats__cell_data{padding-left:var(--cp-spacer-1);padding-right:var(--cp-spacer-1)}.cpanel-whm-header-stats__cell1 .cpanel-whm-header-stats__cell_data span,.cpanel-whm-header-stats__cell2 .cpanel-whm-header-stats__cell_data span,.cpanel-whm-header-stats__cell3 .cpanel-whm-header-stats__cell_data span,.cpanel-whm-header-stats__cell4 .cpanel-whm-header-stats__cell_data span,.cpanel-whm-header-stats__cell5 .cpanel-whm-header-stats__cell_data span{display:inline-block;vertical-align:bottom}.cpanel-whm-header-stats__cell2 .cpanel-whm-header-stats__cell_data .cpanel-whm-header-stats__wide_format{display:inline-block}.cpanel-whm-header-stats__cell2 .cpanel-whm-header-stats__cell_data .cpanel-whm-header-stats__intermediate_format{display:none}.cpanel-whm-header-stats__cell2 .cpanel-whm-header-stats__cell_data .cpanel-whm-header-stats__narrow_format{display:none}@media (max-width: 575.98px){.cpanel-whm-header-stats__cell2 .cpanel-whm-header-stats__cell_data .cpanel-whm-header-stats__wide_format{display:none}.cpanel-whm-header-stats__cell2 .cpanel-whm-header-stats__cell_data .cpanel-whm-header-stats__intermediate_format{display:none}.cpanel-whm-header-stats__cell2 .cpanel-whm-header-stats__cell_data .cpanel-whm-header-stats__narrow_format{display:inline-block}.cpanel-whm-header-stats__wrapper{grid-template-columns:min-content fit-content(20%) 1fr}.cpanel-whm-header-stats__cell3{display:none}.cpanel-whm-header-stats__cell4{display:none}}@media (min-width: 576px) and (max-width: 767.98px){.cpanel-whm-header-stats__cell2 .cpanel-whm-header-stats__cell_data .cpanel-whm-header-stats__wide_format{display:none}.cpanel-whm-header-stats__cell2 .cpanel-whm-header-stats__cell_data .cpanel-whm-header-stats__intermediate_format{display:inline-block}.cpanel-whm-header-stats__cell2 .cpanel-whm-header-stats__cell_data .cpanel-whm-header-stats__narrow_format{display:none}.cpanel-whm-header-stats__wrapper{grid-template-columns:min-content fit-content(20%) 2fr}.cpanel-whm-header-stats__cell3{display:none}.cpanel-whm-header-stats__cell4{display:none}}@media (min-width: 768px) and (max-width: 991.98px){.cpanel-whm-header-stats__cell2 .cpanel-whm-header-stats__cell_data .cpanel-whm-header-stats__wide_format{display:none}.cpanel-whm-header-stats__cell2 .cpanel-whm-header-stats__cell_data .cpanel-whm-header-stats__intermediate_format{display:inline-block}.cpanel-whm-header-stats__cell2 .cpanel-whm-header-stats__cell_data .cpanel-whm-header-stats__narrow_format{display:none}.cpanel-whm-header-stats__wrapper{grid-template-columns:min-content fit-content(20%) min-content 3fr}.cpanel-whm-header-stats__cell3{display:none}}.cpanel-whm-header-stats__cell5{justify-self:end}[dir=\"ltr\"] .cpanel-whm-header-stats__cell5{text-align:right}[dir=\"rtl\"] .cpanel-whm-header-stats__cell5{text-align:left}.cpanel-whm-header-stats__cell5 .cpanel-whm-header-stats__cell_label{text-align:center}.header__whm__load-average__link,.header__whm__load-average__link:link,.header__whm__load-average__link:hover,.header__whm__version__link,.header__whm__version__link:link,.header__whm__version__link:hover{color:var(--cp-body-color);text-decoration:none}";

const locale$3 = getLocaleInstance();
const DEFAULT_HOSTNAME_CUTOFF_LENGTH = 40;
const NARROW_HOSTNAME_CUTOFF_LENGTH = 20;
const CpWhmHeaderStatsControl$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
  }
  /**
   * Retrieve the information for a link. This will return nothing if the
   * named link can not be found.
   *
   * @param name The name of the whm link requested.
   * @returns The details needed to render the link.
   */
  getWhmLink(name) {
    // TODO: Fetch this from an api prefetch instead of hardcode
    switch (name) {
      case "process_manager":
        return {
          href: this._directoryPrefix + "/scripts2/top",
          title: locale$3.maketext("Process Manager"),
          target: "_self",
        };
      case "upgrade_to_latest_version":
        return {
          href: this._directoryPrefix + "/scripts2/upcpform",
          title: locale$3.maketext("Upgrade to Latest Version"),
          target: "_self",
        };
    }
    return;
  }
  /**
   * Render the load average component
   */
  renderLoadAverageControl() {
    return h("cp-load-averages", { id: "whm-header-load-average", class: "load-average", inverse: true });
  }
  /**
   * Render the element from the renderElement callback warpped in a link
   * if there is a valid link and the current user has the needed permission
   * or without the link otherwise.
   *
   * @argument linkClassName - the CSS class name to apply to the link.
   * @argument featureId - unique feature id for the feature.
   * @argument permission - the permission required to access the link.
   * @argument renderElement - callback that returns the deep vdom of the
   * element to wrap.
   * @returns vdom for the wrapped element.
   */
  _renderLinkedElement(linkClassName, featureId, permission, renderElement) {
    const link = this.getWhmLink(featureId);
    if (state.permissions[permission]) {
      return (h("div", null, h("a", { class: linkClassName, href: link === null || link === void 0 ? void 0 : link.href, title: link === null || link === void 0 ? void 0 : link.title, target: link === null || link === void 0 ? void 0 : link.target }, renderElement())));
    }
    else {
      return h("div", null, renderElement());
    }
  }
  /**
   * Component Lifecycle method just before the component loads
   */
  componentWillLoad() {
    this._directoryPrefix = state.directoryPrefix;
    this._stats = {
      user: state.user || "",
      hostName: state.hostName || "",
      serverEnvironment: state.serverEnvironment || "",
      version: state.version || "",
    };
  }
  /**
   * Get the minimum set of domain parts that fit in a cutoffLength range. There must
   * be at least one part. Its not guarenteed the resulting partial domain will be fewer
   * characters then the cutoffLength, just that parent domains that push it past the cut
   * off length will not be displayed.
   *
   * This truncation algorithm preserves whole domain segments
   * so if your domain is:
   *
   *   a.b.c.d.e.f.com
   *
   * truncation will only happen at the . boundries when adding the . and
   * the next segment will exceed the cutoff.
   *
   * Say the cutoff is 5 or 6 with the above domain, you will get:
   *
   *   a.b.c…
   *
   * Or if the offset is 7 or 8, you will get:
   *
   *   a.b.c.d…
   *
   * thus preserving the most domain segments that fit in the cutoff range.
   *
   * @param hostName The domain name of the server.
   * @param cutoffLength The length at which we stop appending parent domains
   * @returns a partial domain consisting of complete subdomains, but with only the left
   * most subdomains upto the cutoff length.
   */
  truncatedHostName(hostName, cutoffLength) {
    if (hostName.length > cutoffLength) {
      let shortHostName = "";
      const parts = hostName.split(/\./);
      let done = false;
      do {
        shortHostName += parts.shift();
        if (parts.length !== 0 && shortHostName.length + parts[0].length + 1 <= cutoffLength) {
          shortHostName += ".";
        }
        else {
          done = true;
          break;
        }
      } while (shortHostName.length <= cutoffLength || done);
      return shortHostName + "…";
    }
    return hostName;
  }
  /**
   * Render the control.
   *
   * @returns vdom for the control.
   */
  render() {
    return (h(Host, null, h("div", { class: "cpanel-whm-header-stats__wrapper" }, h("div", { class: "cpanel-whm-header-stats__cell1" }, h("div", { class: "cpanel-whm-header-stats__cell_label" }, locale$3.maketext("Username")), h("div", { class: "cpanel-whm-header-stats__cell_data" }, h("span", null, this._stats.user))), h("div", { class: "cpanel-whm-header-stats__cell2" }, h("div", { class: "cpanel-whm-header-stats__cell_label" }, locale$3.maketext("Hostname")), h("div", { class: "cpanel-whm-header-stats__cell_data" }, h("span", { title: this._stats.hostName, class: "cpanel-whm-header-stats__wide_format" }, this._stats.hostName), h("span", { title: this._stats.hostName, class: "cpanel-whm-header-stats__intermediate_format" }, this.truncatedHostName(this._stats.hostName, DEFAULT_HOSTNAME_CUTOFF_LENGTH)), h("span", { title: this._stats.hostName, class: "cpanel-whm-header-stats__narrow_format" }, this.truncatedHostName(this._stats.hostName, NARROW_HOSTNAME_CUTOFF_LENGTH)))), h("div", { class: "cpanel-whm-header-stats__cell3" }, h("div", { class: "cpanel-whm-header-stats__cell_label" }, locale$3.maketext("OS")), h("div", { class: "cpanel-whm-header-stats__cell_data" }, h("span", null, this._stats.serverEnvironment))), h("div", { class: "cpanel-whm-header-stats__cell4" }, h("div", { class: "cpanel-whm-header-stats__cell_label" }, locale$3.maketext("cPanel Version")), h("div", { class: "cpanel-whm-header-stats__cell_data" }, h("span", null, this._renderLinkedElement("header__whm__version__link", "upgrade_to_latest_version", "all", () => this._stats.version)))), h("div", { class: "cpanel-whm-header-stats__cell5" }, h("div", { class: "cpanel-whm-header-stats__cell_label" }, locale$3.maketext("Load Averages")), h("div", { class: "cpanel-whm-header-stats__cell_data" }, this._renderLinkedElement("header__whm__load-average__link", "process_manager", "all", () => this.renderLoadAverageControl()))))));
  }
  static get style() { return cpWhmHeaderStatsControlCss; }
};

const Fragment = (props, children) => [ ...children ];

const cpWrapFilterCss = ":host{display:inline}";

const CpWrapFilter$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
    /**
     * The delimiter character for optimal wrapping. Ex: (.) for hostname
     */
    this.delimiter = ".";
    /**
     * The cutoff for longer substrings with no delimiter. This should change depending on how big the box is where the string will be
     * Ex: one part of hostname is too long and has to wrap every 27 characters without a delimiter.
     */
    this.limit = 27;
  }
  /**
   * Reformat the text to wrap at the locations specified.
   *
   * @param text - The text to wrap
   * @param delimiter - The separator to wrap on.
   * @param limit - The maximum number of characters per wrap section.
   * @returns - The HTML Fragment with the wrapping rules defined.
   */
  wrapFilter(text, delimiter, limit) {
    let countSinceLastDelimit = 0;
    let length = text.length;
    let els = [];
    for (let i = 0; i < length; i++) {
      if (text[i] === delimiter || (countSinceLastDelimit && countSinceLastDelimit % (limit - 1) === 0)) {
        els.push(h(Fragment, null, text[i], h("wbr", null)));
        countSinceLastDelimit = 0;
      }
      else {
        els.push(h(Fragment, null, text[i]));
        countSinceLastDelimit++;
      }
    }
    return els;
  }
  render() {
    return (h(Host, null, h("span", null, this.wrapFilter(this.text, this.delimiter, this.limit))));
  }
  static get style() { return cpWrapFilterCss; }
};

/**
# cpanel - ui/web-components/src/components/header/cp-header/integration-icon.enum.ts
#                                                  Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
 */
var IntegrationIcon;
(function (IntegrationIcon) {
  IntegrationIcon["customer_service_app_info"] = "customer-service-2-line";
  IntegrationIcon["support_app_info"] = "hand-heart-line";
  IntegrationIcon["billing_app_info"] = "price-tag-line";
  IntegrationIcon["upgrade_app_info"] = "arrow-up-circle-line";
})(IntegrationIcon || (IntegrationIcon = {}));

/**
# cpanel - ui/web-components/src/components/header/cpanel-header/cpanel-menu-items.ts
#                                                  Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
 */
const locale$2 = getLocaleInstance();
/* NOTE: Checking for available apps based on URL could be brittle, but we do not have
any kind of ID field on the applications list. If this causes problems in the future,
the applications should be assigned UIDs when the list is constructed. */
const constructMenuItems = (integrationsInfoJSON) => {
  const apps = state.appList;
  const directoryPrefix = state.directoryPrefix;
  const integrations = JSON.parse(integrationsInfoJSON);
  const feedbackLinkData = sharedUtils.getFeedbackLinkDataForCpanel(state.cpanelFullVersion, state.companyId, state.cpanelAppKey);
  let menuItems = [];
  // Account Settings - always shown
  menuItems.push({
    id: "menu-account-link",
    href: directoryPrefix + "account_preferences/index.html.tt",
    title: locale$2.maketext("Account Preferences"),
    icon: "settings-3-line",
  });
  // Password & Security - if available
  const pwd = apps.find(a => a.url.includes("passwd"));
  if (pwd) {
    menuItems.push({
      id: "menu-password-link",
      href: pwd.url_is_absolute ? pwd.url : directoryPrefix + pwd.url,
      title: pwd.name,
      icon: "lock-2-line",
    });
  }
  // Change Language - if available
  const lang = apps.find(a => a.url.includes("setlang"));
  if (lang) {
    menuItems.push({
      id: "menu-language-link",
      href: lang.url_is_absolute ? lang.url : directoryPrefix + lang.url,
      title: lang.name,
      icon: "translate",
    });
  }
  // Contact Information - if available
  const contact = apps.find(a => a.url.includes("contact/"));
  if (contact) {
    menuItems.push({
      id: "menu-contact-link",
      href: contact.url_is_absolute ? contact.url : directoryPrefix + contact.url,
      title: contact.name,
      icon: "mail-line",
    });
  }
  // Integrations - if available
  for (const item in integrations) {
    if (integrations[item]) {
      menuItems.push({
        id: `menu-${item}-link`,
        href: directoryPrefix + integrations[item].url,
        title: integrations[item].itemdesc,
        icon: IntegrationIcon[item],
      });
    }
  }
  // Reset Page Settings - always shown
  menuItems.push({
    id: "menu-reset-link",
    href: "javascript:void(0)",
    title: locale$2.maketext("Reset Page Settings"),
    icon: "refresh-line",
  });
  // Provide Feedback - always shown
  menuItems.push({
    id: "menu-feedback-link",
    href: feedbackLinkData.url,
    target: feedbackLinkData.target,
    title: feedbackLinkData.title,
    icon: "feedback-line",
  });
  // Log Out - always shown
  menuItems.push({
    id: "menu-logout-link",
    target: "_top",
    href: `/logout/?locale=${document.documentElement.lang}`,
    title: locale$2.maketext("Log Out"),
    icon: "logout-box-line",
  });
  return menuItems;
};

const cpanelHeaderCss = ":root{--cp-font-weight-semi-bold:600}:host{display:block;background:#ffffff;height:100%;box-shadow:0 0.125rem 0.25rem rgba(0, 0, 0, 0.075)}.header{height:100%;display:flex;justify-content:flex-end;align-items:center;padding:0 var(--cp-spacer-5)}@media (max-width: 767.98px){.header{justify-content:space-between;padding:0 var(--cp-spacer-4)}}@media (max-width: 575.98px){.header{padding:0 var(--cp-spacer-2)}}.header--with-logo{justify-content:space-between}.header__logo-section{display:none}@media (max-width: 767.98px){.header__logo-section{display:flex;align-items:baseline;padding:var(--cp-spacer-2)}[dir=\"ltr\"] .header__logo-section>*:not(:last-child){margin-right:var(--cp-spacer-3)}[dir=\"rtl\"] .header__logo-section>*:not(:last-child){margin-left:var(--cp-spacer-3)}}.header__logo-section--full-width{display:flex;align-items:baseline}.header__controls,.cpanel-header__wrapper,.header__controls--whm{display:flex;width:100%;min-width:315px;justify-content:flex-end}@media (max-width: 575.98px){.header__controls,.cpanel-header__wrapper,.header__controls--whm{min-width:140px}}[dir=\"ltr\"] .header__controls>*:not(:last-child),[dir=\"ltr\"] .cpanel-header__wrapper>*:not(:last-child),[dir=\"ltr\"] .header__controls--whm>*:not(:last-child){margin-right:var(--cp-spacer-3)}[dir=\"rtl\"] .header__controls>*:not(:last-child),[dir=\"rtl\"] .cpanel-header__wrapper>*:not(:last-child),[dir=\"rtl\"] .header__controls--whm>*:not(:last-child){margin-left:var(--cp-spacer-3)}@media (max-width: 575.98px){.header__controls--whm{min-width:175px}}.header-controls__search{max-width:400px}.header-controls__button{border:1px solid var(--cp-primary-color);text-decoration:none;cursor:pointer;color:inherit;background:transparent;height:100%;width:100%;padding:var(--cp-spacer-2);display:flex;align-items:center;justify-content:center;box-sizing:border-box;border-radius:50%}[dir=\"ltr\"] .cp-header__dns-only{margin-left:calc(-1 * var(--cp-spacer-3))}[dir=\"rtl\"] .cp-header__dns-only{margin-right:calc(-1 * var(--cp-spacer-3))}@media (max-width: 575.98px){.hide-on-sm{display:none}[dir=\"ltr\"] .hide-on-sm{margin-right:var(--cp-spacer-0)}[dir=\"rtl\"] .hide-on-sm{margin-left:var(--cp-spacer-0)}}@media (min-width: 576px){.only-show-sm{display:none}}@media (max-width: 767.98px){.hide-on-md{display:none}[dir=\"ltr\"] .hide-on-md{margin-right:var(--cp-spacer-0)}[dir=\"rtl\"] .hide-on-md{margin-left:var(--cp-spacer-0)}}.mobile-search-flex{flex-grow:1;justify-content:flex-start}[dir=\"ltr\"] .mobile-search-flex>*:not(:last-child){margin-right:var(--cp-spacer-0)}[dir=\"rtl\"] .mobile-search-flex>*:not(:last-child){margin-left:var(--cp-spacer-0)}[dir=\"ltr\"] .header__more-controls{text-align:right}[dir=\"rtl\"] .header__more-controls{text-align:left}.header__more-controls .header__whm__load-average__link{text-decoration:none;color:var(--cp-primary-color)}.cpanel-header__wrapper{width:unset;min-width:unset;max-width:unset}";

const UI_OVERLAY_CLAIM_NAME$1 = "cpanel-header";
const CpanelHeader$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    /**
     * Flags if the header should display the input for searching. Only used in mobile displays
     */
    this.isMobileSearch = false;
    /**
     * if the Account Menu is expanded.
     */
    this.isAccountMenuExpanded = false;
  }
  /**
   * CSS class to append to a DOM element for mobile search functionality.
   */
  get mobileSearchClass() {
    return this.isMobileSearch ? "hide-on-sm" : "";
  }
  componentWillLoad() {
    this.accountMenuItems = constructMenuItems(this.integrationsInfo);
  }
  /**
   * Removes the overlay if the user moves focus outside of it
   */
  handleFocusOut() {
    this.isAccountMenuExpanded = false;
    this.updateOverlay();
  }
  /**
   * Removes the overlay if the user presses the Esc key
   */
  handleKeyUp(event) {
    let key = event.key || event.keyCode;
    if (!["Esc", "Escape", 27].includes(key)) {
      return;
    }
    this.handleFocusOut();
  }
  /**
   * Updates the page overlay element.
   */
  updateOverlay() {
    let func = this.isAccountMenuExpanded ? "claim" : "release";
    state.uiOverlay[func](UI_OVERLAY_CLAIM_NAME$1);
  }
  /**
   * Handles the toggleExpand event
   * @param event custom toggleExpand event
   */
  handleToggleExpand(event) {
    this.isAccountMenuExpanded = event.detail;
    this.updateOverlay();
  }
  render() {
    return (h(Host, null, h("div", { class: "cpanel-header__wrapper" }, h("cp-header-notifications-control", { class: this.mobileSearchClass }), h("cp-header-user-account-control", { isMenuExpanded: this.isAccountMenuExpanded, onToggleExpand: e => this.handleToggleExpand(e), menuItems: this.accountMenuItems, class: this.mobileSearchClass }))));
  }
  static get style() { return cpanelHeaderCss; }
};

/*
# cpanel - ui/web-components/src/components/cpw-toggle-switch/toggle-states.enum.ts
#                                                  Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
*/
/**
 * Enum for toggle states
 *
 */
var ToggleStates;
(function (ToggleStates) {
  ToggleStates["TOGGLE_ON"] = "on";
  ToggleStates["TOGGLE_OFF"] = "off";
  ToggleStates["TOGGLE_UPDATING"] = "updating";
})(ToggleStates || (ToggleStates = {}));

/*
# cpanel - ui/web-components/src/components/cpw-toggle-switch/toggle-label-positions.enum.ts
#                                                  Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
*/
/**
 * Enum for toggle switch label and spinner positions
 *
 */
var ToggleLabelPositions;
(function (ToggleLabelPositions) {
  ToggleLabelPositions["LEFT"] = "left";
  ToggleLabelPositions["RIGHT"] = "right";
})(ToggleLabelPositions || (ToggleLabelPositions = {}));

const cpwToggleSwitchCss = ":root{--cp-font-weight-semi-bold:600}:host{display:block;white-space:nowrap}.toggle-switch-wrapper{height:1.75rem;cursor:pointer;border-radius:0.25rem;display:inline-block}[dir=\"ltr\"] .toggle-switch-wrapper{padding:var(--cp-spacer-1) var(--cp-spacer-1) var(--cp-spacer-1) 1.25rem;margin-left:-1.25rem}[dir=\"rtl\"] .toggle-switch-wrapper{padding:var(--cp-spacer-1) 1.25rem var(--cp-spacer-1) var(--cp-spacer-1);margin-right:-1.25rem}.toggle-switch-wrapper .toggle-switch-text{padding-left:var(--cp-spacer-1);padding-right:var(--cp-spacer-1)}.toggle-switch-wrapper .toggle-switch{min-width:2.2rem;vertical-align:middle;height:0.75rem;display:inline-block;overflow:visible;border-radius:0.375rem;box-shadow:inset 0 0 0.125rem rgba(0, 0, 0, 0.5)}.toggle-switch-wrapper .toggle-switch .toggle-switch-animate span{display:inline-block}[dir=\"ltr\"] .toggle-switch-wrapper .toggle-switch .toggle-switch-animate span{transition:left 0.5s}[dir=\"rtl\"] .toggle-switch-wrapper .toggle-switch .toggle-switch-animate span{transition:right 0.5s}.toggle-switch-wrapper .toggle-switch .toggle-switch-animate .knob{width:1.25rem;height:1.25rem;margin-top:-var(--cp-spacer-1);border-radius:50%;display:inline-block;position:relative;box-shadow:inset 0 0 0.125rem rgba(0, 0, 0, 0.5);top:-0.25rem}.toggle-switch-wrapper .toggle-switch.switch-on{background-color:#0a58ca}.toggle-switch-wrapper .toggle-switch.switch-on .knob{background-color:#0a58ca;z-index:99}[dir=\"ltr\"] .toggle-switch-wrapper .toggle-switch.switch-on .knob{left:50%}[dir=\"rtl\"] .toggle-switch-wrapper .toggle-switch.switch-on .knob{right:50%}.toggle-switch-wrapper .toggle-switch.switch-off{background-color:#cccccc}.toggle-switch-wrapper .toggle-switch.switch-off .knob{background-color:#cccccc}[dir=\"ltr\"] .toggle-switch-wrapper .toggle-switch.switch-off .knob{left:0%}[dir=\"rtl\"] .toggle-switch-wrapper .toggle-switch.switch-off .knob{right:0%}.toggle-switch-wrapper .toggle-switch.disabled{cursor:not-allowed;background-color:#aaaaaa}.toggle-switch-wrapper .toggle-switch.disabled .toggle-switch-text{opacity:0.75;font-style:italic}.toggle-switch-wrapper .toggle-switch.disabled .knob{background-color:#aaaaaa}[dir=\"ltr\"] .toggle-switch-wrapper .toggle-switch-label-left{margin-right:var(--cp-spacer-1)}[dir=\"rtl\"] .toggle-switch-wrapper .toggle-switch-label-left{margin-left:var(--cp-spacer-1)}[dir=\"ltr\"] .toggle-switch-wrapper .toggle-switch-updating-indicator-left{margin-right:var(--cp-spacer-1)}[dir=\"rtl\"] .toggle-switch-wrapper .toggle-switch-updating-indicator-left{margin-left:var(--cp-spacer-1)}[dir=\"ltr\"] .toggle-switch-wrapper .toggle-switch-label-right{margin-left:var(--cp-spacer-1)}[dir=\"rtl\"] .toggle-switch-wrapper .toggle-switch-label-right{margin-right:var(--cp-spacer-1)}[dir=\"ltr\"] .toggle-switch-wrapper .toggle-switch-updating-indicator-right{margin-left:var(--cp-spacer-1)}[dir=\"rtl\"] .toggle-switch-wrapper .toggle-switch-updating-indicator-right{margin-right:var(--cp-spacer-1)}";

const locale$1 = getLocaleInstance();
const CpwToggleSwitch$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
    this.toggle = createEvent(this, "toggle", 7);
    /**
     * Is the toggle updating
     */
    this.isToggleUpdating = false;
    /**
     * Whether the spinner is showing
     */
    this.hasSpinner = false;
    /**
     * The initial toggle state
     */
    this.initState = ToggleStates.TOGGLE_OFF; // eslint-disable-line @stencil/strict-mutable
    /**
     * Text displayed when switch is on
     */
    this.toggleOnText = ""; // eslint-disable-line @stencil/strict-mutable
    /**
     * Text displayed when switch is off
     */
    this.toggleOffText = ""; // eslint-disable-line @stencil/strict-mutable
    /**
     * If switch is disabled
     */
    this.isDisabled = false; // eslint-disable-line @stencil/strict-mutable
  }
  /**
   * Sets state for toggle button
   * @param toggleState Toggle state
   */
  async update(toggleState) {
    this._update(toggleState);
  }
  /**
   * Internal helper to update the state.
   */
  _update(toggleState) {
    this.toggleState = toggleState;
    switch (toggleState) {
      case ToggleStates.TOGGLE_ON:
        this.isToggleUpdating = false;
        break;
      case ToggleStates.TOGGLE_OFF:
        this.isToggleUpdating = false;
        break;
      case ToggleStates.TOGGLE_UPDATING:
        this.hasSpinner = true;
        break;
    }
  }
  /**
   * Value of label for HTML
   */
  get labelValue() {
    if (this.isDisabled) {
      return "disabled";
    }
    switch (this.toggleState) {
      case ToggleStates.TOGGLE_OFF:
        return this.toggleOffText;
      case ToggleStates.TOGGLE_ON:
        return this.toggleOnText;
      case ToggleStates.TOGGLE_UPDATING:
        return "updating";
    }
  }
  /**
   * If the page is being read left to right
   *
   * @ignore
   */
  get isLTR() {
    return locale$1.isLtr;
  }
  _toggle() {
    if (this.toggleState === ToggleStates.TOGGLE_OFF) {
      this._update(ToggleStates.TOGGLE_ON);
    }
    else if (this.toggleState === ToggleStates.TOGGLE_ON) {
      this._update(ToggleStates.TOGGLE_OFF);
    }
  }
  _toggle_on() {
    // prevent unnecessary redraw
    if (this.toggleState === ToggleStates.TOGGLE_ON) {
      return;
    }
    this._update(ToggleStates.TOGGLE_ON);
  }
  _toggle_off() {
    // prevent unnecessary redraw
    if (this.toggleState === ToggleStates.TOGGLE_OFF) {
      return;
    }
    this._update(ToggleStates.TOGGLE_OFF);
  }
  /**
   * Determine if toggle is in valid state to toggle.
   * Disabled or actively toggling is not valid.
   * @ignore
   */
  processToggleEvent(event) {
    if (this.isDisabled || this.isToggleUpdating) {
      return;
    }
    if (event.type === "click") {
      this._toggle();
    }
    else if (event.type === "keyup") {
      switch (event.key) {
        case "Space":
          this._toggle();
          break;
        case "Enter":
          this._toggle();
          break;
        case "ArrowLeft":
          this.isLTR ? this._toggle_off() : this._toggle_on();
          break;
        case "ArrowRight":
          this.isLTR ? this._toggle_on() : this._toggle_off();
          break;
      }
    }
    this.toggle.emit({ state: this.toggleState });
  }
  /**
   * Return true if label is visible to user
   */
  isLabelVisible(position) {
    if (!this.labelPosition || this.isToggleUpdating) {
      return false;
    }
    else if (this.labelPosition && position === this.labelPosition) {
      return true;
    }
    return false;
  }
  /**
   * Return true if spinner is visible to user
   */
  isSpinnerVisible(position) {
    if (this.hasSpinner &&
      this.labelPosition &&
      this.isToggleUpdating &&
      !this.isDisabled &&
      position === this.labelPosition) {
      return true;
    }
    else {
      return false;
    }
  }
  onClick(event) {
    this.processToggleEvent(event);
  }
  onKeyup(event) {
    this.processToggleEvent(event);
  }
  componentWillLoad() {
    const id = this.host.getAttribute("id");
    if (!id) {
      throw new Error("id must be defined for `cpw-toggle-switch`");
    }
    if (typeof this.isToggleUpdating === "undefined") {
      this.isToggleUpdating = false;
    }
    if (typeof this.initState !== "undefined") {
      this._update(this.initState);
    }
  }
  render() {
    const id = this.host.getAttribute("id");
    const toggleID = `${id}_toggle`;
    const labelID = `${id}_toggle_label`;
    const onTextID = `${id}_toggle_on_text`;
    const offTextID = `${id}_toggle__off_text`;
    const leftSpinnerID = `${id}_toggle_left_spinner`;
    const rightSpinnerID = `${id}_toggle_right_spinner`;
    return (h(Host, null, h("cp-dir", null, h("div", { id: toggleID, class: `toggle-switch-wrapper ${this.isDisabled || this.isToggleUpdating ? "disabled" : ""}`, role: "switch", "data-value": this.labelValue, "aria-checked": this.toggleState === ToggleStates.TOGGLE_ON ? "true" : "false", "aria-labelledby": labelID, tabindex: 0 }, this.isLabelVisible(ToggleLabelPositions.LEFT) && (h("label", { id: labelID, htmlFor: toggleID, class: "toggle-switch-label-left", "aria-label": this.labelValue }, h("span", { id: onTextID, class: "toggle-switch-text toggle-switch-text-left" }, this.labelValue))), this.isSpinnerVisible(ToggleLabelPositions.LEFT) && (h("i", { id: leftSpinnerID, class: "fas fa-sync fa-spin spinner toggle-switch-updating-indicator toggle-switch-updating-indicator-left" })), h("div", { class: `toggle-switch
                        ${this.isDisabled || this.isToggleUpdating ? "disabled" : ""}
                        ${this.toggleState === ToggleStates.TOGGLE_ON ? "switch-on" : ""}
                        ${this.toggleState === ToggleStates.TOGGLE_OFF ? "switch-off" : ""}`, role: "button", "aria-label": "toggle", "aria-pressed": "false" }, h("div", { class: `toggle-switch-animate` }, h("span", { class: "switch-left" }), h("span", { class: "knob" }), h("span", { class: "switch-right" }))), this.isLabelVisible(ToggleLabelPositions.RIGHT) && (h("label", { id: labelID, htmlFor: toggleID, class: "toggle-switch-label-right", "aria-label": this.labelValue }, h("span", { id: offTextID, class: "toggle-switch-text toggle-switch-text-right" }, this.labelValue))), this.isSpinnerVisible(ToggleLabelPositions.RIGHT) && (h("i", { id: rightSpinnerID, class: "fas fa-sync fa-spin spinner toggle-switch-updating-indicator toggle-switch-updating-indicator-right" }))))));
  }
  get host() { return this; }
  static get style() { return cpwToggleSwitchCss; }
};

/**
# cpanel - ui/web-components/src/components/header/cp-header-user-account-dropdown/whm-user-menu-items.ts
#                                                  Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
 */
const locale = getLocaleInstance();
/* NOTE: Checking for available apps based on URL could be brittle, but we do not have
any kind of ID field on the applications list. If this causes problems in the future,
the applications should be assigned UIDs when the list is constructed. */
const constructWhmAccountMenuItems = (cpSecurityToken) => {
  const menuItems = [];
  // Right now WHM’s only self-password-modification screen is for
  // the “root” user. A root-reseller *can* set their own password,
  // but there’s no dedicated “change my password” UI. We intend to
  // improve that in COBRA-13453.
  if (state.user === "root") {
    menuItems.unshift({
      id: "menu-account-link",
      href: `${cpSecurityToken}scripts/chrootpass`,
      title: locale.maketext("Password Modification"),
      icon: "lock-2-line",
    });
  }
  // Log Out - always shown
  menuItems.push({
    id: "menu-logout-link",
    target: "_top",
    href: `/logout/?locale=${document.documentElement.lang}`,
    title: `${locale.maketext("Log Out")} (${state.user})`,
    icon: "logout-box-line",
  });
  return menuItems;
};

const whmHeaderCss = ":root{--cp-font-weight-semi-bold:600}:host{display:block;background:#ffffff;height:100%;box-shadow:0 0.125rem 0.25rem rgba(0, 0, 0, 0.075)}.header{height:100%;display:flex;justify-content:flex-end;align-items:center;padding:0 var(--cp-spacer-5)}@media (max-width: 767.98px){.header{justify-content:space-between;padding:0 var(--cp-spacer-4)}}@media (max-width: 575.98px){.header{padding:0 var(--cp-spacer-2)}}.header--with-logo{justify-content:space-between}.header__logo-section{display:none}@media (max-width: 767.98px){.header__logo-section{display:flex;align-items:baseline;padding:var(--cp-spacer-2)}[dir=\"ltr\"] .header__logo-section>*:not(:last-child){margin-right:var(--cp-spacer-3)}[dir=\"rtl\"] .header__logo-section>*:not(:last-child){margin-left:var(--cp-spacer-3)}}.header__logo-section--full-width{display:flex;align-items:baseline}.header__controls,.whm-header__wrapper,.header__controls--whm{display:flex;width:100%;min-width:315px;justify-content:flex-end}@media (max-width: 575.98px){.header__controls,.whm-header__wrapper,.header__controls--whm{min-width:140px}}[dir=\"ltr\"] .header__controls>*:not(:last-child),[dir=\"ltr\"] .whm-header__wrapper>*:not(:last-child),[dir=\"ltr\"] .header__controls--whm>*:not(:last-child){margin-right:var(--cp-spacer-3)}[dir=\"rtl\"] .header__controls>*:not(:last-child),[dir=\"rtl\"] .whm-header__wrapper>*:not(:last-child),[dir=\"rtl\"] .header__controls--whm>*:not(:last-child){margin-left:var(--cp-spacer-3)}@media (max-width: 575.98px){.header__controls--whm{min-width:175px}}.header-controls__search{max-width:400px}.header-controls__button{border:1px solid var(--cp-primary-color);text-decoration:none;cursor:pointer;color:inherit;background:transparent;height:100%;width:100%;padding:var(--cp-spacer-2);display:flex;align-items:center;justify-content:center;box-sizing:border-box;border-radius:50%}[dir=\"ltr\"] .cp-header__dns-only{margin-left:calc(-1 * var(--cp-spacer-3))}[dir=\"rtl\"] .cp-header__dns-only{margin-right:calc(-1 * var(--cp-spacer-3))}@media (max-width: 575.98px){.hide-on-sm{display:none}[dir=\"ltr\"] .hide-on-sm{margin-right:var(--cp-spacer-0)}[dir=\"rtl\"] .hide-on-sm{margin-left:var(--cp-spacer-0)}}@media (min-width: 576px){.only-show-sm{display:none}}@media (max-width: 767.98px){.hide-on-md{display:none}[dir=\"ltr\"] .hide-on-md{margin-right:var(--cp-spacer-0)}[dir=\"rtl\"] .hide-on-md{margin-left:var(--cp-spacer-0)}}.mobile-search-flex{flex-grow:1;justify-content:flex-start}[dir=\"ltr\"] .mobile-search-flex>*:not(:last-child){margin-right:var(--cp-spacer-0)}[dir=\"rtl\"] .mobile-search-flex>*:not(:last-child){margin-left:var(--cp-spacer-0)}[dir=\"ltr\"] .header__more-controls{text-align:right}[dir=\"rtl\"] .header__more-controls{text-align:left}.header__more-controls .header__whm__load-average__link{text-decoration:none;color:var(--cp-primary-color)}.whm-header__wrapper{width:unset;min-width:unset;max-width:unset}";

const UI_OVERLAY_CLAIM_NAME = "whm-header";
const WhmHeader$1 = class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    /**
     * Flags if the header should display the input for searching. Only used in mobile displays
     */
    this.isMobileSearch = false;
  }
  /**
   * CSS class to append to a DOM element for mobile search functionality.
   */
  get mobileSearchClass() {
    return this.isMobileSearch ? "hide-on-sm" : "";
  }
  /**
   * Removes the overlay if the user moves focus outside of it
   */
  handleFocusOut() {
    this.expandedMenu = "";
    this.updateOverlay();
  }
  /**
   * Removes the overlay if the user presses the Esc key
   */
  handleKeyUp(event) {
    let key = event.key || event.keyCode;
    if (!["Esc", "Escape", 27].includes(key)) {
      return;
    }
    this.handleFocusOut();
  }
  /**
   * Updates the page overlay element.
   */
  updateOverlay() {
    let func = this.expandedMenu === "" ? "release" : "claim";
    state.uiOverlay[func](UI_OVERLAY_CLAIM_NAME);
  }
  async componentWillRender() {
    const directoryPrefix = state.directoryPrefix + "/";
    this.accountMenuItems = constructWhmAccountMenuItems(directoryPrefix);
  }
  /**
   * Updates the expand status of the provided menu.
   */
  _expandMenu(menu, expanded) {
    if (expanded.detail) {
      this.expandedMenu = menu;
    }
    else {
      this.expandedMenu = "";
    }
    this.updateOverlay();
  }
  render() {
    return (h(Host, null, h("div", { class: "whm-header__wrapper" }, h("cp-whm-header-notifications-control", { isMenuExpanded: this.expandedMenu === "notifications", onToggleExpand: e => this._expandMenu("notifications", e), class: this.mobileSearchClass }), h("cp-header-user-account-control", { isMenuExpanded: this.expandedMenu === "user-account", onToggleExpand: e => this._expandMenu("user-account", e), menuItems: this.accountMenuItems, class: this.mobileSearchClass }))));
  }
  static get style() { return whmHeaderCss; }
};

const CpApp = /*@__PURE__*/proxyCustomElement(CpApp$1, [0,"cp-app",{"name":[1],"url":[1],"iconurl":[1],"description":[1],"target":[1],"uniquekey":[1],"editMode":[32]},[[0,"click","handleClick"]]]);
const CpConsentPrivacySettings = /*@__PURE__*/proxyCustomElement(CpConsentPrivacySettings$1, [0,"cp-consent-privacy-settings"]);
const CpDir = /*@__PURE__*/proxyCustomElement(CpDir$1, [4,"cp-dir"]);
const CpDnsOnly = /*@__PURE__*/proxyCustomElement(CpDnsOnly$1, [1,"cp-dns-only"]);
const CpFavorite = /*@__PURE__*/proxyCustomElement(CpFavorite$1, [0,"cp-favorite",{"removeDescription":[1,"remove-description"],"group":[1],"name":[1],"url":[1],"icon":[1],"target":[1],"displayName":[1,"display-name"],"description":[1],"showDescription":[4,"show-description"],"editMode":[32]}]);
const CpFavoriteList = /*@__PURE__*/proxyCustomElement(CpFavoriteList$1, [0,"cp-favorite-list",{"showDescriptions":[4,"show-descriptions"],"favorites":[32]}]);
const CpFavoriteSelector = /*@__PURE__*/proxyCustomElement(CpFavoriteSelector$1, [1,"cp-favorite-selector",{"group":[1],"name":[1],"checked":[32],"showEditControls":[32]},[[0,"click","handleClick"]]]);
const CpFooter = /*@__PURE__*/proxyCustomElement(CpFooter$1, [1,"cp-footer",{"logoSrc":[1,"logo-src"],"version":[1],"docLink":[1,"doc-link"],"helpLink":[1,"help-link"]}]);
const CpHeader = /*@__PURE__*/proxyCustomElement(CpHeader$1, [1,"cp-header",{"focusSearch":[1540,"focus-search"],"integrationsInfo":[1,"integrations-info"],"logoSrc":[1,"logo-src"],"logoAltText":[1,"logo-alt-text"],"isMobileSearch":[32]},[[0,"toggleMobileSearch","toggleMobileSearch"],[0,"searchInputFocusChange","searchInputFocusChange"]]]);
const CpHeaderControl = /*@__PURE__*/proxyCustomElement(CpHeaderControl$1, [1,"cp-header-control",{"showBadge":[4,"show-badge"]}]);
const CpHeaderNotificationsControl = /*@__PURE__*/proxyCustomElement(CpNotificationsHeaderControl, [1,"cp-header-notifications-control",{"hasNotifications":[32]}]);
const CpHeaderSearch = /*@__PURE__*/proxyCustomElement(CpHeaderSearch$1, [1,"cp-header-search",{"focusSearch":[4,"focus-search"],"isVisible":[4,"is-visible"],"matchedApplicationList":[32],"inputText":[32],"accountResults":[32]},[[8,"keydown","handleKeydown"],[0,"focusout","handleFocusOut"]]]);
const CpHeaderSearchControl = /*@__PURE__*/proxyCustomElement(CpSearchHeaderControl, [1,"cp-header-search-control",{"focusSearch":[1028,"focus-search"],"isMobileSearch":[4,"is-mobile-search"]},[[9,"resize","onResize"]]]);
const CpHeaderUserAccountControl = /*@__PURE__*/proxyCustomElement(CpUserAccountHeaderControl, [1,"cp-header-user-account-control",{"menuItems":[16],"isMenuExpanded":[4,"is-menu-expanded"]},[[0,"click","toggleMenu"],[8,"click","handleFocusOut"]]]);
const CpHeaderUserAccountDropdown = /*@__PURE__*/proxyCustomElement(CpHeaderUserDropdown, [1,"cp-header-user-account-dropdown",{"menuItems":[16]}]);
const CpIcon = /*@__PURE__*/proxyCustomElement(CpIcon$1, [1,"cp-icon",{"name":[1],"mode":[2],"size":[1]}]);
const CpLoadAverages = /*@__PURE__*/proxyCustomElement(CpLoadAverages$1, [1,"cp-load-averages",{"inverse":[4],"showHeader":[4,"show-header"],"showLoading":[4,"show-loading"],"verbose":[4],"isLoading":[32],"current":[32],"last":[32],"error":[32]},[[8,"updateSample","updateSampleHandler"],[8,"samplingError","samplingErrorHandler"],[8,"startSampling","startSamplingHandler"]]]);
const CpLoadMixpanelJs = /*@__PURE__*/proxyCustomElement(CpLoadMixpanelJs$1, [1,"cp-load-mixpanel-js",{"analyticsConfig":[1,"analytics-config"]},[[16,"consentPrivacySaved","handleConsentPrivacySavedEvent"]]]);
const CpLogo = /*@__PURE__*/proxyCustomElement(CpLogo$1, [1,"cp-logo",{"logoLinkHref":[1,"logo-link-href"],"linkTarget":[1,"link-target"],"logoTitle":[1,"logo-title"],"logoId":[1,"logo-id"],"logoSrc":[1,"logo-src"],"logoAltText":[1,"logo-alt-text"]}]);
const CpMainMenu = /*@__PURE__*/proxyCustomElement(CpMainMenu$1, [1,"cp-main-menu",{"logoSrc":[1,"logo-src"],"logoAltText":[1,"logo-alt-text"],"renderBoxShadow":[32]}]);
const CpMainMenuHeaderControl = /*@__PURE__*/proxyCustomElement(CpMainMenuHeaderControl$1, [1,"cp-main-menu-header-control",{"isMainMenuOpen":[32]},[[0,"click","openMainMenu"],[16,"click","handleClickOut"],[16,"keydown","handleKeyDown"]]]);
const CpMainMenuNav = /*@__PURE__*/proxyCustomElement(CpMainMenuNav$1, [1,"cp-main-menu-nav",{"logoSrc":[1,"logo-src"],"logoAltText":[1,"logo-alt-text"]},[[16,"mainMenuOpened","setFocus"],[16,"analyticsInstanceLoaded","analyticsInstanceLoadHandler"]]]);
const CpMainMenuNavWhm = /*@__PURE__*/proxyCustomElement(CpMainMenuNavWhm$1, [1,"cp-main-menu-nav-whm",{"logoAltText":[1,"logo-alt-text"],"renderBoxShadow":[1028,"render-box-shadow"],"categories":[32],"filterInputText":[32]},[[8,"keydown","toggleCategories"],[8,"keydown","focusFilterInput"],[16,"mainMenuOpened","setFocus"]]]);
const CpMigrationModal = /*@__PURE__*/proxyCustomElement(CpMigrationModal$1, [1,"cp-migration-modal",{"opened":[1540]},[[2,"modalClosed","modalDismiss"],[2,"closeMigrationModal","closeMigrationModalHandler"]]]);
const CpMigrationModalBody = /*@__PURE__*/proxyCustomElement(CpMigrationModalBody$1, [0,"cp-migration-modal-body"]);
const CpMigrationModalFooter = /*@__PURE__*/proxyCustomElement(CpMigrationModalFooter$1, [0,"cp-migration-modal-footer"]);
const CpModal = /*@__PURE__*/proxyCustomElement(CpModal$1, [1,"cp-modal",{"modalSize":[1,"modal-size"],"elementIdToFocus":[1,"element-id-to-focus"],"modalAriaLabel":[1,"modal-aria-label"],"hideTitle":[4,"hide-title"],"dismissable":[4],"isOpen":[32]},[[8,"focusin","trapFocusInModal"],[8,"keydown","handleKeypress"]]]);
const CpRootVariables = /*@__PURE__*/proxyCustomElement(CpRootVariables$1, [0,"cp-root-variables",{"directoryPrefix":[1,"directory-prefix"],"appList":[1,"app-list"],"mainMenuLinks":[1,"main-menu-links"],"appName":[1,"app-name"],"categoryList":[1,"category-list"],"hostName":[1,"host-name"],"plugins":[1],"favorites":[1],"serverEnvironment":[1,"server-environment"],"user":[1],"version":[1],"cpanelFullVersion":[1,"cpanel-full-version"],"whmNotifications":[1,"whm-notifications"],"licenseType":[1,"license-type"],"permissions":[1],"appSearchResultsLimit":[2,"app-search-results-limit"],"uiOverlay":[16],"initialNavUrl":[1,"initial-nav-url"],"companyId":[1,"company-id"],"mailClientList":[1,"mail-client-list"],"primaryDomain":[1,"primary-domain"],"whmLogosJson":[1,"whm-logos-json"],"cpanelAppKey":[1,"cpanel-app-key"]}]);
const CpStyleReset = /*@__PURE__*/proxyCustomElement(CpStyleReset$1, [1,"cp-style-reset"]);
const CpUiLoadAnalytics = /*@__PURE__*/proxyCustomElement(CpUiLoadAnalytics$1, [1,"cp-ui-load-analytics",{"analyticsConfig":[1,"analytics-config"]},[[0,"mixpanelInstanceLoaded","analyticsInstanceLoadHandler"]]]);
const CpWebmailConsentPrivacyModal = /*@__PURE__*/proxyCustomElement(CpWebmailConsentPrivacyModal$1, [1,"cp-webmail-consent-privacy-modal",{"defaultWebmailApp":[1,"default-webmail-app"],"opened":[516]},[[2,"consentValueChanged","captureConsentValue"],[2,"saveConsentPrivacyAndContinue","saveConsentPrivacyAndContinueHandler"]]]);
const CpWebmailConsentPrivacyModalBody = /*@__PURE__*/proxyCustomElement(CpWebmailConsentPrivacyModalBody$1, [0,"cp-webmail-consent-privacy-modal-body"]);
const CpWebmailConsentPrivacyModalFooter = /*@__PURE__*/proxyCustomElement(CpWebmailConsentPrivacyModalFooter$1, [0,"cp-webmail-consent-privacy-modal-footer",null,[[4,"saveActionCompleted","performActionsAftersaveCompleted"]]]);
const CpWelcomeModal = /*@__PURE__*/proxyCustomElement(CpWelcomeModal$1, [1,"cp-welcome-modal",{"opened":[1540],"migratedToJupiter":[516,"migrated-to-jupiter"],"currentStep":[32]},[[2,"modalButtonClick","onModalButtonClickedHandler"],[2,"modalClosed","modalDismiss"]]]);
const CpWelcomeModalCongrats = /*@__PURE__*/proxyCustomElement(CpWelcomeModalCongrats$1, [0,"cp-welcome-modal-congrats",{"installStatus":[2,"install-status"]}]);
const CpWelcomeModalCongratsFooter = /*@__PURE__*/proxyCustomElement(CpWelcomeModalCongratsFooter$1, [0,"cp-welcome-modal-congrats-footer",{"installStatus":[2,"install-status"]}]);
const CpWelcomeModalStartingPoint = /*@__PURE__*/proxyCustomElement(CpWelcomeModalStartingPoint$1, [0,"cp-welcome-modal-starting-point",{"migratedToJupiter":[516,"migrated-to-jupiter"]}]);
const CpWelcomeModalStartingPointFooter = /*@__PURE__*/proxyCustomElement(CpWelcomeModalStartingPointFooter$1, [0,"cp-welcome-modal-starting-point-footer"]);
const CpWelcomeModalWpInstall = /*@__PURE__*/proxyCustomElement(CpWelcomeModalWpInstall$1, [0,"cp-welcome-modal-wp-install",{"installStatus":[2,"install-status"],"modalStatus":[516,"modal-status"]}]);
const CpWelcomeModalWpInstallFooter = /*@__PURE__*/proxyCustomElement(CpWelcomeModalWpInstallFooter$1, [0,"cp-welcome-modal-wp-install-footer"]);
const CpWhmHeaderNotificationsControl = /*@__PURE__*/proxyCustomElement(CpWhmHeaderNotificationsControl$1, [1,"cp-whm-header-notifications-control",{"isMenuExpanded":[4,"is-menu-expanded"]},[[0,"click","toggleMenu"],[8,"click","handleFocusOut"]]]);
const CpWhmHeaderNotificationsDropdown = /*@__PURE__*/proxyCustomElement(CpWhmHeaderNotificationsDropdown$1, [1,"cp-whm-header-notifications-dropdown",{"notifications":[16]}]);
const CpWhmHeaderStatsControl = /*@__PURE__*/proxyCustomElement(CpWhmHeaderStatsControl$1, [1,"cp-whm-header-stats-control"]);
const CpWrapFilter = /*@__PURE__*/proxyCustomElement(CpWrapFilter$1, [1,"cp-wrap-filter",{"text":[1],"delimiter":[1],"limit":[2]}]);
const CpanelHeader = /*@__PURE__*/proxyCustomElement(CpanelHeader$1, [0,"cpanel-header",{"integrationsInfo":[1,"integrations-info"],"isMobileSearch":[4,"is-mobile-search"],"isAccountMenuExpanded":[32]},[[0,"focusout","handleFocusOut"],[0,"keyup","handleKeyUp"]]]);
const CpwToggleSwitch = /*@__PURE__*/proxyCustomElement(CpwToggleSwitch$1, [1,"cpw-toggle-switch",{"initState":[1025,"init-state"],"toggleOnText":[1025,"toggle-on-text"],"toggleOffText":[1025,"toggle-off-text"],"labelPosition":[1,"label-position"],"isDisabled":[1028,"is-disabled"],"toggleState":[32],"isToggleUpdating":[32],"hasSpinner":[32]},[[0,"click","onClick"],[0,"keyup","onKeyup"]]]);
const WhmHeader = /*@__PURE__*/proxyCustomElement(WhmHeader$1, [0,"whm-header",{"isMobileSearch":[4,"is-mobile-search"],"expandedMenu":[32]},[[0,"focusout","handleFocusOut"],[8,"keyup","handleKeyUp"]]]);
const defineCustomElements = (opts) => {
  if (typeof customElements !== 'undefined') {
    [
      CpApp,
  CpConsentPrivacySettings,
  CpDir,
  CpDnsOnly,
  CpFavorite,
  CpFavoriteList,
  CpFavoriteSelector,
  CpFooter,
  CpHeader,
  CpHeaderControl,
  CpHeaderNotificationsControl,
  CpHeaderSearch,
  CpHeaderSearchControl,
  CpHeaderUserAccountControl,
  CpHeaderUserAccountDropdown,
  CpIcon,
  CpLoadAverages,
  CpLoadMixpanelJs,
  CpLogo,
  CpMainMenu,
  CpMainMenuHeaderControl,
  CpMainMenuNav,
  CpMainMenuNavWhm,
  CpMigrationModal,
  CpMigrationModalBody,
  CpMigrationModalFooter,
  CpModal,
  CpRootVariables,
  CpStyleReset,
  CpUiLoadAnalytics,
  CpWebmailConsentPrivacyModal,
  CpWebmailConsentPrivacyModalBody,
  CpWebmailConsentPrivacyModalFooter,
  CpWelcomeModal,
  CpWelcomeModalCongrats,
  CpWelcomeModalCongratsFooter,
  CpWelcomeModalStartingPoint,
  CpWelcomeModalStartingPointFooter,
  CpWelcomeModalWpInstall,
  CpWelcomeModalWpInstallFooter,
  CpWhmHeaderNotificationsControl,
  CpWhmHeaderNotificationsDropdown,
  CpWhmHeaderStatsControl,
  CpWrapFilter,
  CpanelHeader,
  CpwToggleSwitch,
  WhmHeader
    ].forEach(cmp => {
      if (!customElements.get(cmp.is)) {
        customElements.define(cmp.is, cmp, opts);
      }
    });
  }
};

export { CpApp, CpConsentPrivacySettings, CpDir, CpDnsOnly, CpFavorite, CpFavoriteList, CpFavoriteSelector, CpFooter, CpHeader, CpHeaderControl, CpHeaderNotificationsControl, CpHeaderSearch, CpHeaderSearchControl, CpHeaderUserAccountControl, CpHeaderUserAccountDropdown, CpIcon, CpLoadAverages, CpLoadMixpanelJs, CpLogo, CpMainMenu, CpMainMenuHeaderControl, CpMainMenuNav, CpMainMenuNavWhm, CpMigrationModal, CpMigrationModalBody, CpMigrationModalFooter, CpModal, CpRootVariables, CpStyleReset, CpUiLoadAnalytics, CpWebmailConsentPrivacyModal, CpWebmailConsentPrivacyModalBody, CpWebmailConsentPrivacyModalFooter, CpWelcomeModal, CpWelcomeModalCongrats, CpWelcomeModalCongratsFooter, CpWelcomeModalStartingPoint, CpWelcomeModalStartingPointFooter, CpWelcomeModalWpInstall, CpWelcomeModalWpInstallFooter, CpWhmHeaderNotificationsControl, CpWhmHeaderNotificationsDropdown, CpWhmHeaderStatsControl, CpWrapFilter, CpanelHeader, CpwToggleSwitch, WhmHeader, defineCustomElements };
Back to Directory File Manager