/*! * M365 Moray Extensions v1.145.0 * MWF (Moray) v2.8.1 * Copyright (c) Microsoft Corporation. All rights reserved. * Copyright 2011-2020 The Bootstrap Authors and Twitter, Inc. */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.m365 = {})); })(this, (function (exports) { 'use strict'; var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; var check = function (it) { return it && it.Math == Math && it; }; // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global$B = // eslint-disable-next-line es/no-global-this -- safe check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || // eslint-disable-next-line no-restricted-globals -- safe check(typeof self == 'object' && self) || check(typeof commonjsGlobal == 'object' && commonjsGlobal) || // eslint-disable-next-line no-new-func -- fallback (function () { return this; })() || Function('return this')(); var objectGetOwnPropertyDescriptor = {}; var fails$J = function (exec) { try { return !!exec(); } catch (error) { return true; } }; var fails$I = fails$J; // Detect IE8's incomplete defineProperty implementation var descriptors = !fails$I(function () { // eslint-disable-next-line es/no-object-defineproperty -- required for testing return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7; }); var fails$H = fails$J; var functionBindNative = !fails$H(function () { // eslint-disable-next-line es/no-function-prototype-bind -- safe var test = (function () { /* empty */ }).bind(); // eslint-disable-next-line no-prototype-builtins -- safe return typeof test != 'function' || test.hasOwnProperty('prototype'); }); var NATIVE_BIND$4 = functionBindNative; var call$q = Function.prototype.call; var functionCall = NATIVE_BIND$4 ? call$q.bind(call$q) : function () { return call$q.apply(call$q, arguments); }; var objectPropertyIsEnumerable = {}; var $propertyIsEnumerable$2 = {}.propertyIsEnumerable; // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var getOwnPropertyDescriptor$6 = Object.getOwnPropertyDescriptor; // Nashorn ~ JDK8 bug var NASHORN_BUG = getOwnPropertyDescriptor$6 && !$propertyIsEnumerable$2.call({ 1: 2 }, 1); // `Object.prototype.propertyIsEnumerable` method implementation // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) { var descriptor = getOwnPropertyDescriptor$6(this, V); return !!descriptor && descriptor.enumerable; } : $propertyIsEnumerable$2; var createPropertyDescriptor$6 = function (bitmap, value) { return { enumerable: !(bitmap & 1), configurable: !(bitmap & 2), writable: !(bitmap & 4), value: value }; }; var NATIVE_BIND$3 = functionBindNative; var FunctionPrototype$3 = Function.prototype; var call$p = FunctionPrototype$3.call; var uncurryThisWithBind = NATIVE_BIND$3 && FunctionPrototype$3.bind.bind(call$p, call$p); var functionUncurryThisRaw = NATIVE_BIND$3 ? uncurryThisWithBind : function (fn) { return function () { return call$p.apply(fn, arguments); }; }; var uncurryThisRaw$1 = functionUncurryThisRaw; var toString$m = uncurryThisRaw$1({}.toString); var stringSlice$c = uncurryThisRaw$1(''.slice); var classofRaw$2 = function (it) { return stringSlice$c(toString$m(it), 8, -1); }; var classofRaw$1 = classofRaw$2; var uncurryThisRaw = functionUncurryThisRaw; var functionUncurryThis = function (fn) { // Nashorn bug: // https://github.com/zloirock/core-js/issues/1128 // https://github.com/zloirock/core-js/issues/1130 if (classofRaw$1(fn) === 'Function') return uncurryThisRaw(fn); }; var uncurryThis$M = functionUncurryThis; var fails$G = fails$J; var classof$c = classofRaw$2; var $Object$4 = Object; var split$3 = uncurryThis$M(''.split); // fallback for non-array-like ES3 and non-enumerable old V8 strings var indexedObject = fails$G(function () { // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346 // eslint-disable-next-line no-prototype-builtins -- safe return !$Object$4('z').propertyIsEnumerable(0); }) ? function (it) { return classof$c(it) == 'String' ? split$3(it, '') : $Object$4(it); } : $Object$4; // we can't use just `it == null` since of `document.all` special case // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec var isNullOrUndefined$b = function (it) { return it === null || it === undefined; }; var isNullOrUndefined$a = isNullOrUndefined$b; var $TypeError$j = TypeError; // `RequireObjectCoercible` abstract operation // https://tc39.es/ecma262/#sec-requireobjectcoercible var requireObjectCoercible$d = function (it) { if (isNullOrUndefined$a(it)) throw $TypeError$j("Can't call method on " + it); return it; }; // toObject with fallback for non-array-like ES3 strings var IndexedObject$4 = indexedObject; var requireObjectCoercible$c = requireObjectCoercible$d; var toIndexedObject$d = function (it) { return IndexedObject$4(requireObjectCoercible$c(it)); }; var documentAll$2 = typeof document == 'object' && document.all; // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot var IS_HTMLDDA = typeof documentAll$2 == 'undefined' && documentAll$2 !== undefined; var documentAll_1 = { all: documentAll$2, IS_HTMLDDA: IS_HTMLDDA }; var $documentAll$1 = documentAll_1; var documentAll$1 = $documentAll$1.all; // `IsCallable` abstract operation // https://tc39.es/ecma262/#sec-iscallable var isCallable$u = $documentAll$1.IS_HTMLDDA ? function (argument) { return typeof argument == 'function' || argument === documentAll$1; } : function (argument) { return typeof argument == 'function'; }; var isCallable$t = isCallable$u; var $documentAll = documentAll_1; var documentAll = $documentAll.all; var isObject$o = $documentAll.IS_HTMLDDA ? function (it) { return typeof it == 'object' ? it !== null : isCallable$t(it) || it === documentAll; } : function (it) { return typeof it == 'object' ? it !== null : isCallable$t(it); }; var global$A = global$B; var isCallable$s = isCallable$u; var aFunction = function (argument) { return isCallable$s(argument) ? argument : undefined; }; var getBuiltIn$d = function (namespace, method) { return arguments.length < 2 ? aFunction(global$A[namespace]) : global$A[namespace] && global$A[namespace][method]; }; var uncurryThis$L = functionUncurryThis; var objectIsPrototypeOf = uncurryThis$L({}.isPrototypeOf); var getBuiltIn$c = getBuiltIn$d; var engineUserAgent = getBuiltIn$c('navigator', 'userAgent') || ''; var global$z = global$B; var userAgent$6 = engineUserAgent; var process$3 = global$z.process; var Deno$1 = global$z.Deno; var versions = process$3 && process$3.versions || Deno$1 && Deno$1.version; var v8 = versions && versions.v8; var match, version; if (v8) { match = v8.split('.'); // in old Chrome, versions of V8 isn't V8 = Chrome / 10 // but their correct versions are not interesting for us version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]); } // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0` // so check `userAgent` even if `.v8` exists, but 0 if (!version && userAgent$6) { match = userAgent$6.match(/Edge\/(\d+)/); if (!match || match[1] >= 74) { match = userAgent$6.match(/Chrome\/(\d+)/); if (match) version = +match[1]; } } var engineV8Version = version; /* eslint-disable es/no-symbol -- required for testing */ var V8_VERSION$3 = engineV8Version; var fails$F = fails$J; // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$F(function () { var symbol = Symbol(); // Chrome 38 Symbol has incorrect toString conversion // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances return !String(symbol) || !(Object(symbol) instanceof Symbol) || // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances !Symbol.sham && V8_VERSION$3 && V8_VERSION$3 < 41; }); /* eslint-disable es/no-symbol -- required for testing */ var NATIVE_SYMBOL$6 = symbolConstructorDetection; var useSymbolAsUid = NATIVE_SYMBOL$6 && !Symbol.sham && typeof Symbol.iterator == 'symbol'; var getBuiltIn$b = getBuiltIn$d; var isCallable$r = isCallable$u; var isPrototypeOf$7 = objectIsPrototypeOf; var USE_SYMBOL_AS_UID$1 = useSymbolAsUid; var $Object$3 = Object; var isSymbol$5 = USE_SYMBOL_AS_UID$1 ? function (it) { return typeof it == 'symbol'; } : function (it) { var $Symbol = getBuiltIn$b('Symbol'); return isCallable$r($Symbol) && isPrototypeOf$7($Symbol.prototype, $Object$3(it)); }; var $String$4 = String; var tryToString$6 = function (argument) { try { return $String$4(argument); } catch (error) { return 'Object'; } }; var isCallable$q = isCallable$u; var tryToString$5 = tryToString$6; var $TypeError$i = TypeError; // `Assert: IsCallable(argument) is true` var aCallable$a = function (argument) { if (isCallable$q(argument)) return argument; throw $TypeError$i(tryToString$5(argument) + ' is not a function'); }; var aCallable$9 = aCallable$a; var isNullOrUndefined$9 = isNullOrUndefined$b; // `GetMethod` abstract operation // https://tc39.es/ecma262/#sec-getmethod var getMethod$7 = function (V, P) { var func = V[P]; return isNullOrUndefined$9(func) ? undefined : aCallable$9(func); }; var call$o = functionCall; var isCallable$p = isCallable$u; var isObject$n = isObject$o; var $TypeError$h = TypeError; // `OrdinaryToPrimitive` abstract operation // https://tc39.es/ecma262/#sec-ordinarytoprimitive var ordinaryToPrimitive$1 = function (input, pref) { var fn, val; if (pref === 'string' && isCallable$p(fn = input.toString) && !isObject$n(val = call$o(fn, input))) return val; if (isCallable$p(fn = input.valueOf) && !isObject$n(val = call$o(fn, input))) return val; if (pref !== 'string' && isCallable$p(fn = input.toString) && !isObject$n(val = call$o(fn, input))) return val; throw $TypeError$h("Can't convert object to primitive value"); }; var shared$7 = {exports: {}}; var isPure = false; var global$y = global$B; // eslint-disable-next-line es/no-object-defineproperty -- safe var defineProperty$e = Object.defineProperty; var defineGlobalProperty$3 = function (key, value) { try { defineProperty$e(global$y, key, { value: value, configurable: true, writable: true }); } catch (error) { global$y[key] = value; } return value; }; var global$x = global$B; var defineGlobalProperty$2 = defineGlobalProperty$3; var SHARED = '__core-js_shared__'; var store$3 = global$x[SHARED] || defineGlobalProperty$2(SHARED, {}); var sharedStore = store$3; var store$2 = sharedStore; (shared$7.exports = function (key, value) { return store$2[key] || (store$2[key] = value !== undefined ? value : {}); })('versions', []).push({ version: '3.26.0', mode: 'global', copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)', license: 'https://github.com/zloirock/core-js/blob/v3.26.0/LICENSE', source: 'https://github.com/zloirock/core-js' }); var requireObjectCoercible$b = requireObjectCoercible$d; var $Object$2 = Object; // `ToObject` abstract operation // https://tc39.es/ecma262/#sec-toobject var toObject$d = function (argument) { return $Object$2(requireObjectCoercible$b(argument)); }; var uncurryThis$K = functionUncurryThis; var toObject$c = toObject$d; var hasOwnProperty = uncurryThis$K({}.hasOwnProperty); // `HasOwnProperty` abstract operation // https://tc39.es/ecma262/#sec-hasownproperty // eslint-disable-next-line es/no-object-hasown -- safe var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) { return hasOwnProperty(toObject$c(it), key); }; var uncurryThis$J = functionUncurryThis; var id$3 = 0; var postfix = Math.random(); var toString$l = uncurryThis$J(1.0.toString); var uid$4 = function (key) { return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$l(++id$3 + postfix, 36); }; var global$w = global$B; var shared$6 = shared$7.exports; var hasOwn$m = hasOwnProperty_1; var uid$3 = uid$4; var NATIVE_SYMBOL$5 = symbolConstructorDetection; var USE_SYMBOL_AS_UID = useSymbolAsUid; var WellKnownSymbolsStore$1 = shared$6('wks'); var Symbol$3 = global$w.Symbol; var symbolFor = Symbol$3 && Symbol$3['for']; var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$3 : Symbol$3 && Symbol$3.withoutSetter || uid$3; var wellKnownSymbol$t = function (name) { if (!hasOwn$m(WellKnownSymbolsStore$1, name) || !(NATIVE_SYMBOL$5 || typeof WellKnownSymbolsStore$1[name] == 'string')) { var description = 'Symbol.' + name; if (NATIVE_SYMBOL$5 && hasOwn$m(Symbol$3, name)) { WellKnownSymbolsStore$1[name] = Symbol$3[name]; } else if (USE_SYMBOL_AS_UID && symbolFor) { WellKnownSymbolsStore$1[name] = symbolFor(description); } else { WellKnownSymbolsStore$1[name] = createWellKnownSymbol(description); } } return WellKnownSymbolsStore$1[name]; }; var call$n = functionCall; var isObject$m = isObject$o; var isSymbol$4 = isSymbol$5; var getMethod$6 = getMethod$7; var ordinaryToPrimitive = ordinaryToPrimitive$1; var wellKnownSymbol$s = wellKnownSymbol$t; var $TypeError$g = TypeError; var TO_PRIMITIVE = wellKnownSymbol$s('toPrimitive'); // `ToPrimitive` abstract operation // https://tc39.es/ecma262/#sec-toprimitive var toPrimitive$2 = function (input, pref) { if (!isObject$m(input) || isSymbol$4(input)) return input; var exoticToPrim = getMethod$6(input, TO_PRIMITIVE); var result; if (exoticToPrim) { if (pref === undefined) pref = 'default'; result = call$n(exoticToPrim, input, pref); if (!isObject$m(result) || isSymbol$4(result)) return result; throw $TypeError$g("Can't convert object to primitive value"); } if (pref === undefined) pref = 'number'; return ordinaryToPrimitive(input, pref); }; var toPrimitive$1 = toPrimitive$2; var isSymbol$3 = isSymbol$5; // `ToPropertyKey` abstract operation // https://tc39.es/ecma262/#sec-topropertykey var toPropertyKey$4 = function (argument) { var key = toPrimitive$1(argument, 'string'); return isSymbol$3(key) ? key : key + ''; }; var global$v = global$B; var isObject$l = isObject$o; var document$3 = global$v.document; // typeof document.createElement is 'object' in old IE var EXISTS$1 = isObject$l(document$3) && isObject$l(document$3.createElement); var documentCreateElement$2 = function (it) { return EXISTS$1 ? document$3.createElement(it) : {}; }; var DESCRIPTORS$p = descriptors; var fails$E = fails$J; var createElement$1 = documentCreateElement$2; // Thanks to IE8 for its funny defineProperty var ie8DomDefine = !DESCRIPTORS$p && !fails$E(function () { // eslint-disable-next-line es/no-object-defineproperty -- required for testing return Object.defineProperty(createElement$1('div'), 'a', { get: function () { return 7; } }).a != 7; }); var DESCRIPTORS$o = descriptors; var call$m = functionCall; var propertyIsEnumerableModule$2 = objectPropertyIsEnumerable; var createPropertyDescriptor$5 = createPropertyDescriptor$6; var toIndexedObject$c = toIndexedObject$d; var toPropertyKey$3 = toPropertyKey$4; var hasOwn$l = hasOwnProperty_1; var IE8_DOM_DEFINE$1 = ie8DomDefine; // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var $getOwnPropertyDescriptor$2 = Object.getOwnPropertyDescriptor; // `Object.getOwnPropertyDescriptor` method // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor objectGetOwnPropertyDescriptor.f = DESCRIPTORS$o ? $getOwnPropertyDescriptor$2 : function getOwnPropertyDescriptor(O, P) { O = toIndexedObject$c(O); P = toPropertyKey$3(P); if (IE8_DOM_DEFINE$1) try { return $getOwnPropertyDescriptor$2(O, P); } catch (error) { /* empty */ } if (hasOwn$l(O, P)) return createPropertyDescriptor$5(!call$m(propertyIsEnumerableModule$2.f, O, P), O[P]); }; var objectDefineProperty = {}; var DESCRIPTORS$n = descriptors; var fails$D = fails$J; // V8 ~ Chrome 36- // https://bugs.chromium.org/p/v8/issues/detail?id=3334 var v8PrototypeDefineBug = DESCRIPTORS$n && fails$D(function () { // eslint-disable-next-line es/no-object-defineproperty -- required for testing return Object.defineProperty(function () { /* empty */ }, 'prototype', { value: 42, writable: false }).prototype != 42; }); var isObject$k = isObject$o; var $String$3 = String; var $TypeError$f = TypeError; // `Assert: Type(argument) is Object` var anObject$l = function (argument) { if (isObject$k(argument)) return argument; throw $TypeError$f($String$3(argument) + ' is not an object'); }; var DESCRIPTORS$m = descriptors; var IE8_DOM_DEFINE = ie8DomDefine; var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug; var anObject$k = anObject$l; var toPropertyKey$2 = toPropertyKey$4; var $TypeError$e = TypeError; // eslint-disable-next-line es/no-object-defineproperty -- safe var $defineProperty$1 = Object.defineProperty; // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor; var ENUMERABLE = 'enumerable'; var CONFIGURABLE$1 = 'configurable'; var WRITABLE = 'writable'; // `Object.defineProperty` method // https://tc39.es/ecma262/#sec-object.defineproperty objectDefineProperty.f = DESCRIPTORS$m ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) { anObject$k(O); P = toPropertyKey$2(P); anObject$k(Attributes); if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) { var current = $getOwnPropertyDescriptor$1(O, P); if (current && current[WRITABLE]) { O[P] = Attributes.value; Attributes = { configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1], enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE], writable: false }; } } return $defineProperty$1(O, P, Attributes); } : $defineProperty$1 : function defineProperty(O, P, Attributes) { anObject$k(O); P = toPropertyKey$2(P); anObject$k(Attributes); if (IE8_DOM_DEFINE) try { return $defineProperty$1(O, P, Attributes); } catch (error) { /* empty */ } if ('get' in Attributes || 'set' in Attributes) throw $TypeError$e('Accessors not supported'); if ('value' in Attributes) O[P] = Attributes.value; return O; }; var DESCRIPTORS$l = descriptors; var definePropertyModule$6 = objectDefineProperty; var createPropertyDescriptor$4 = createPropertyDescriptor$6; var createNonEnumerableProperty$7 = DESCRIPTORS$l ? function (object, key, value) { return definePropertyModule$6.f(object, key, createPropertyDescriptor$4(1, value)); } : function (object, key, value) { object[key] = value; return object; }; var makeBuiltIn$3 = {exports: {}}; var DESCRIPTORS$k = descriptors; var hasOwn$k = hasOwnProperty_1; var FunctionPrototype$2 = Function.prototype; // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var getDescriptor = DESCRIPTORS$k && Object.getOwnPropertyDescriptor; var EXISTS = hasOwn$k(FunctionPrototype$2, 'name'); // additional protection from minified / mangled / dropped function names var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something'; var CONFIGURABLE = EXISTS && (!DESCRIPTORS$k || (DESCRIPTORS$k && getDescriptor(FunctionPrototype$2, 'name').configurable)); var functionName = { EXISTS: EXISTS, PROPER: PROPER, CONFIGURABLE: CONFIGURABLE }; var uncurryThis$I = functionUncurryThis; var isCallable$o = isCallable$u; var store$1 = sharedStore; var functionToString$1 = uncurryThis$I(Function.toString); // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper if (!isCallable$o(store$1.inspectSource)) { store$1.inspectSource = function (it) { return functionToString$1(it); }; } var inspectSource$3 = store$1.inspectSource; var global$u = global$B; var isCallable$n = isCallable$u; var WeakMap$1 = global$u.WeakMap; var weakMapBasicDetection = isCallable$n(WeakMap$1) && /native code/.test(String(WeakMap$1)); var shared$5 = shared$7.exports; var uid$2 = uid$4; var keys$2 = shared$5('keys'); var sharedKey$4 = function (key) { return keys$2[key] || (keys$2[key] = uid$2(key)); }; var hiddenKeys$6 = {}; var NATIVE_WEAK_MAP$1 = weakMapBasicDetection; var global$t = global$B; var isObject$j = isObject$o; var createNonEnumerableProperty$6 = createNonEnumerableProperty$7; var hasOwn$j = hasOwnProperty_1; var shared$4 = sharedStore; var sharedKey$3 = sharedKey$4; var hiddenKeys$5 = hiddenKeys$6; var OBJECT_ALREADY_INITIALIZED = 'Object already initialized'; var TypeError$6 = global$t.TypeError; var WeakMap = global$t.WeakMap; var set$1, get, has; var enforce = function (it) { return has(it) ? get(it) : set$1(it, {}); }; var getterFor = function (TYPE) { return function (it) { var state; if (!isObject$j(it) || (state = get(it)).type !== TYPE) { throw TypeError$6('Incompatible receiver, ' + TYPE + ' required'); } return state; }; }; if (NATIVE_WEAK_MAP$1 || shared$4.state) { var store = shared$4.state || (shared$4.state = new WeakMap()); /* eslint-disable no-self-assign -- prototype methods protection */ store.get = store.get; store.has = store.has; store.set = store.set; /* eslint-enable no-self-assign -- prototype methods protection */ set$1 = function (it, metadata) { if (store.has(it)) throw TypeError$6(OBJECT_ALREADY_INITIALIZED); metadata.facade = it; store.set(it, metadata); return metadata; }; get = function (it) { return store.get(it) || {}; }; has = function (it) { return store.has(it); }; } else { var STATE = sharedKey$3('state'); hiddenKeys$5[STATE] = true; set$1 = function (it, metadata) { if (hasOwn$j(it, STATE)) throw TypeError$6(OBJECT_ALREADY_INITIALIZED); metadata.facade = it; createNonEnumerableProperty$6(it, STATE, metadata); return metadata; }; get = function (it) { return hasOwn$j(it, STATE) ? it[STATE] : {}; }; has = function (it) { return hasOwn$j(it, STATE); }; } var internalState = { set: set$1, get: get, has: has, enforce: enforce, getterFor: getterFor }; var fails$C = fails$J; var isCallable$m = isCallable$u; var hasOwn$i = hasOwnProperty_1; var DESCRIPTORS$j = descriptors; var CONFIGURABLE_FUNCTION_NAME$1 = functionName.CONFIGURABLE; var inspectSource$2 = inspectSource$3; var InternalStateModule$8 = internalState; var enforceInternalState$2 = InternalStateModule$8.enforce; var getInternalState$4 = InternalStateModule$8.get; // eslint-disable-next-line es/no-object-defineproperty -- safe var defineProperty$d = Object.defineProperty; var CONFIGURABLE_LENGTH = DESCRIPTORS$j && !fails$C(function () { return defineProperty$d(function () { /* empty */ }, 'length', { value: 8 }).length !== 8; }); var TEMPLATE = String(String).split('String'); var makeBuiltIn$2 = makeBuiltIn$3.exports = function (value, name, options) { if (String(name).slice(0, 7) === 'Symbol(') { name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']'; } if (options && options.getter) name = 'get ' + name; if (options && options.setter) name = 'set ' + name; if (!hasOwn$i(value, 'name') || (CONFIGURABLE_FUNCTION_NAME$1 && value.name !== name)) { if (DESCRIPTORS$j) defineProperty$d(value, 'name', { value: name, configurable: true }); else value.name = name; } if (CONFIGURABLE_LENGTH && options && hasOwn$i(options, 'arity') && value.length !== options.arity) { defineProperty$d(value, 'length', { value: options.arity }); } try { if (options && hasOwn$i(options, 'constructor') && options.constructor) { if (DESCRIPTORS$j) defineProperty$d(value, 'prototype', { writable: false }); // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable } else if (value.prototype) value.prototype = undefined; } catch (error) { /* empty */ } var state = enforceInternalState$2(value); if (!hasOwn$i(state, 'source')) { state.source = TEMPLATE.join(typeof name == 'string' ? name : ''); } return value; }; // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative // eslint-disable-next-line no-extend-native -- required Function.prototype.toString = makeBuiltIn$2(function toString() { return isCallable$m(this) && getInternalState$4(this).source || inspectSource$2(this); }, 'toString'); var isCallable$l = isCallable$u; var definePropertyModule$5 = objectDefineProperty; var makeBuiltIn$1 = makeBuiltIn$3.exports; var defineGlobalProperty$1 = defineGlobalProperty$3; var defineBuiltIn$i = function (O, key, value, options) { if (!options) options = {}; var simple = options.enumerable; var name = options.name !== undefined ? options.name : key; if (isCallable$l(value)) makeBuiltIn$1(value, name, options); if (options.global) { if (simple) O[key] = value; else defineGlobalProperty$1(key, value); } else { try { if (!options.unsafe) delete O[key]; else if (O[key]) simple = true; } catch (error) { /* empty */ } if (simple) O[key] = value; else definePropertyModule$5.f(O, key, { value: value, enumerable: false, configurable: !options.nonConfigurable, writable: !options.nonWritable }); } return O; }; var objectGetOwnPropertyNames = {}; var ceil$1 = Math.ceil; var floor$6 = Math.floor; // `Math.trunc` method // https://tc39.es/ecma262/#sec-math.trunc // eslint-disable-next-line es/no-math-trunc -- safe var mathTrunc = Math.trunc || function trunc(x) { var n = +x; return (n > 0 ? floor$6 : ceil$1)(n); }; var trunc = mathTrunc; // `ToIntegerOrInfinity` abstract operation // https://tc39.es/ecma262/#sec-tointegerorinfinity var toIntegerOrInfinity$8 = function (argument) { var number = +argument; // eslint-disable-next-line no-self-compare -- NaN check return number !== number || number === 0 ? 0 : trunc(number); }; var toIntegerOrInfinity$7 = toIntegerOrInfinity$8; var max$5 = Math.max; var min$5 = Math.min; // Helper for a popular repeating case of the spec: // Let integer be ? ToInteger(index). // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length). var toAbsoluteIndex$4 = function (index, length) { var integer = toIntegerOrInfinity$7(index); return integer < 0 ? max$5(integer + length, 0) : min$5(integer, length); }; var toIntegerOrInfinity$6 = toIntegerOrInfinity$8; var min$4 = Math.min; // `ToLength` abstract operation // https://tc39.es/ecma262/#sec-tolength var toLength$5 = function (argument) { return argument > 0 ? min$4(toIntegerOrInfinity$6(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 }; var toLength$4 = toLength$5; // `LengthOfArrayLike` abstract operation // https://tc39.es/ecma262/#sec-lengthofarraylike var lengthOfArrayLike$b = function (obj) { return toLength$4(obj.length); }; var toIndexedObject$b = toIndexedObject$d; var toAbsoluteIndex$3 = toAbsoluteIndex$4; var lengthOfArrayLike$a = lengthOfArrayLike$b; // `Array.prototype.{ indexOf, includes }` methods implementation var createMethod$6 = function (IS_INCLUDES) { return function ($this, el, fromIndex) { var O = toIndexedObject$b($this); var length = lengthOfArrayLike$a(O); var index = toAbsoluteIndex$3(fromIndex, length); var value; // Array#includes uses SameValueZero equality algorithm // eslint-disable-next-line no-self-compare -- NaN check if (IS_INCLUDES && el != el) while (length > index) { value = O[index++]; // eslint-disable-next-line no-self-compare -- NaN check if (value != value) return true; // Array#indexOf ignores holes, Array#includes - not } else for (;length > index; index++) { if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0; } return !IS_INCLUDES && -1; }; }; var arrayIncludes = { // `Array.prototype.includes` method // https://tc39.es/ecma262/#sec-array.prototype.includes includes: createMethod$6(true), // `Array.prototype.indexOf` method // https://tc39.es/ecma262/#sec-array.prototype.indexof indexOf: createMethod$6(false) }; var uncurryThis$H = functionUncurryThis; var hasOwn$h = hasOwnProperty_1; var toIndexedObject$a = toIndexedObject$d; var indexOf$2 = arrayIncludes.indexOf; var hiddenKeys$4 = hiddenKeys$6; var push$9 = uncurryThis$H([].push); var objectKeysInternal = function (object, names) { var O = toIndexedObject$a(object); var i = 0; var result = []; var key; for (key in O) !hasOwn$h(hiddenKeys$4, key) && hasOwn$h(O, key) && push$9(result, key); // Don't enum bug & hidden keys while (names.length > i) if (hasOwn$h(O, key = names[i++])) { ~indexOf$2(result, key) || push$9(result, key); } return result; }; // IE8- don't enum bug keys var enumBugKeys$3 = [ 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf' ]; var internalObjectKeys$1 = objectKeysInternal; var enumBugKeys$2 = enumBugKeys$3; var hiddenKeys$3 = enumBugKeys$2.concat('length', 'prototype'); // `Object.getOwnPropertyNames` method // https://tc39.es/ecma262/#sec-object.getownpropertynames // eslint-disable-next-line es/no-object-getownpropertynames -- safe objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { return internalObjectKeys$1(O, hiddenKeys$3); }; var objectGetOwnPropertySymbols = {}; // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols; var getBuiltIn$a = getBuiltIn$d; var uncurryThis$G = functionUncurryThis; var getOwnPropertyNamesModule$2 = objectGetOwnPropertyNames; var getOwnPropertySymbolsModule$3 = objectGetOwnPropertySymbols; var anObject$j = anObject$l; var concat$3 = uncurryThis$G([].concat); // all object keys, includes non-enumerable and symbols var ownKeys$9 = getBuiltIn$a('Reflect', 'ownKeys') || function ownKeys(it) { var keys = getOwnPropertyNamesModule$2.f(anObject$j(it)); var getOwnPropertySymbols = getOwnPropertySymbolsModule$3.f; return getOwnPropertySymbols ? concat$3(keys, getOwnPropertySymbols(it)) : keys; }; var hasOwn$g = hasOwnProperty_1; var ownKeys$8 = ownKeys$9; var getOwnPropertyDescriptorModule$2 = objectGetOwnPropertyDescriptor; var definePropertyModule$4 = objectDefineProperty; var copyConstructorProperties$2 = function (target, source, exceptions) { var keys = ownKeys$8(source); var defineProperty = definePropertyModule$4.f; var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule$2.f; for (var i = 0; i < keys.length; i++) { var key = keys[i]; if (!hasOwn$g(target, key) && !(exceptions && hasOwn$g(exceptions, key))) { defineProperty(target, key, getOwnPropertyDescriptor(source, key)); } } }; var fails$B = fails$J; var isCallable$k = isCallable$u; var replacement = /#|\.prototype\./; var isForced$5 = function (feature, detection) { var value = data[normalize(feature)]; return value == POLYFILL ? true : value == NATIVE ? false : isCallable$k(detection) ? fails$B(detection) : !!detection; }; var normalize = isForced$5.normalize = function (string) { return String(string).replace(replacement, '.').toLowerCase(); }; var data = isForced$5.data = {}; var NATIVE = isForced$5.NATIVE = 'N'; var POLYFILL = isForced$5.POLYFILL = 'P'; var isForced_1 = isForced$5; var global$s = global$B; var getOwnPropertyDescriptor$5 = objectGetOwnPropertyDescriptor.f; var createNonEnumerableProperty$5 = createNonEnumerableProperty$7; var defineBuiltIn$h = defineBuiltIn$i; var defineGlobalProperty = defineGlobalProperty$3; var copyConstructorProperties$1 = copyConstructorProperties$2; var isForced$4 = isForced_1; /* options.target - name of the target object options.global - target is the global object options.stat - export as static methods of target options.proto - export as prototype methods of target options.real - real prototype method for the `pure` version options.forced - export even if the native feature is available options.bind - bind methods to the target, required for the `pure` version options.wrap - wrap constructors to preventing global pollution, required for the `pure` version options.unsafe - use the simple assignment of property instead of delete + defineProperty options.sham - add a flag to not completely full polyfills options.enumerable - export as enumerable property options.dontCallGetSet - prevent calling a getter on target options.name - the .name of the function if it does not match the key */ var _export = function (options, source) { var TARGET = options.target; var GLOBAL = options.global; var STATIC = options.stat; var FORCED, target, key, targetProperty, sourceProperty, descriptor; if (GLOBAL) { target = global$s; } else if (STATIC) { target = global$s[TARGET] || defineGlobalProperty(TARGET, {}); } else { target = (global$s[TARGET] || {}).prototype; } if (target) for (key in source) { sourceProperty = source[key]; if (options.dontCallGetSet) { descriptor = getOwnPropertyDescriptor$5(target, key); targetProperty = descriptor && descriptor.value; } else targetProperty = target[key]; FORCED = isForced$4(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); // contained in target if (!FORCED && targetProperty !== undefined) { if (typeof sourceProperty == typeof targetProperty) continue; copyConstructorProperties$1(sourceProperty, targetProperty); } // add a flag to not completely full polyfills if (options.sham || (targetProperty && targetProperty.sham)) { createNonEnumerableProperty$5(sourceProperty, 'sham', true); } defineBuiltIn$h(target, key, sourceProperty, options); } }; var uncurryThis$F = functionUncurryThis; var aCallable$8 = aCallable$a; var NATIVE_BIND$2 = functionBindNative; var bind$b = uncurryThis$F(uncurryThis$F.bind); // optional / simple context binding var functionBindContext = function (fn, that) { aCallable$8(fn); return that === undefined ? fn : NATIVE_BIND$2 ? bind$b(fn, that) : function (/* ...args */) { return fn.apply(that, arguments); }; }; var classof$b = classofRaw$2; // `IsArray` abstract operation // https://tc39.es/ecma262/#sec-isarray // eslint-disable-next-line es/no-array-isarray -- safe var isArray$6 = Array.isArray || function isArray(argument) { return classof$b(argument) == 'Array'; }; var wellKnownSymbol$r = wellKnownSymbol$t; var TO_STRING_TAG$3 = wellKnownSymbol$r('toStringTag'); var test$1 = {}; test$1[TO_STRING_TAG$3] = 'z'; var toStringTagSupport = String(test$1) === '[object z]'; var TO_STRING_TAG_SUPPORT$2 = toStringTagSupport; var isCallable$j = isCallable$u; var classofRaw = classofRaw$2; var wellKnownSymbol$q = wellKnownSymbol$t; var TO_STRING_TAG$2 = wellKnownSymbol$q('toStringTag'); var $Object$1 = Object; // ES3 wrong here var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments'; // fallback for IE11 Script Access Denied error var tryGet = function (it, key) { try { return it[key]; } catch (error) { /* empty */ } }; // getting tag from ES6+ `Object.prototype.toString` var classof$a = TO_STRING_TAG_SUPPORT$2 ? classofRaw : function (it) { var O, tag, result; return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case : typeof (tag = tryGet(O = $Object$1(it), TO_STRING_TAG$2)) == 'string' ? tag // builtinTag case : CORRECT_ARGUMENTS ? classofRaw(O) // ES3 arguments fallback : (result = classofRaw(O)) == 'Object' && isCallable$j(O.callee) ? 'Arguments' : result; }; var uncurryThis$E = functionUncurryThis; var fails$A = fails$J; var isCallable$i = isCallable$u; var classof$9 = classof$a; var getBuiltIn$9 = getBuiltIn$d; var inspectSource$1 = inspectSource$3; var noop = function () { /* empty */ }; var empty = []; var construct$1 = getBuiltIn$9('Reflect', 'construct'); var constructorRegExp = /^\s*(?:class|function)\b/; var exec$6 = uncurryThis$E(constructorRegExp.exec); var INCORRECT_TO_STRING = !constructorRegExp.exec(noop); var isConstructorModern = function isConstructor(argument) { if (!isCallable$i(argument)) return false; try { construct$1(noop, empty, argument); return true; } catch (error) { return false; } }; var isConstructorLegacy = function isConstructor(argument) { if (!isCallable$i(argument)) return false; switch (classof$9(argument)) { case 'AsyncFunction': case 'GeneratorFunction': case 'AsyncGeneratorFunction': return false; } try { // we can't check .prototype since constructors produced by .bind haven't it // `Function#toString` throws on some built-it function in some legacy engines // (for example, `DOMQuad` and similar in FF41-) return INCORRECT_TO_STRING || !!exec$6(constructorRegExp, inspectSource$1(argument)); } catch (error) { return true; } }; isConstructorLegacy.sham = true; // `IsConstructor` abstract operation // https://tc39.es/ecma262/#sec-isconstructor var isConstructor$4 = !construct$1 || fails$A(function () { var called; return isConstructorModern(isConstructorModern.call) || !isConstructorModern(Object) || !isConstructorModern(function () { called = true; }) || called; }) ? isConstructorLegacy : isConstructorModern; var isArray$5 = isArray$6; var isConstructor$3 = isConstructor$4; var isObject$i = isObject$o; var wellKnownSymbol$p = wellKnownSymbol$t; var SPECIES$6 = wellKnownSymbol$p('species'); var $Array$3 = Array; // a part of `ArraySpeciesCreate` abstract operation // https://tc39.es/ecma262/#sec-arrayspeciescreate var arraySpeciesConstructor$1 = function (originalArray) { var C; if (isArray$5(originalArray)) { C = originalArray.constructor; // cross-realm fallback if (isConstructor$3(C) && (C === $Array$3 || isArray$5(C.prototype))) C = undefined; else if (isObject$i(C)) { C = C[SPECIES$6]; if (C === null) C = undefined; } } return C === undefined ? $Array$3 : C; }; var arraySpeciesConstructor = arraySpeciesConstructor$1; // `ArraySpeciesCreate` abstract operation // https://tc39.es/ecma262/#sec-arrayspeciescreate var arraySpeciesCreate$3 = function (originalArray, length) { return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length); }; var bind$a = functionBindContext; var uncurryThis$D = functionUncurryThis; var IndexedObject$3 = indexedObject; var toObject$b = toObject$d; var lengthOfArrayLike$9 = lengthOfArrayLike$b; var arraySpeciesCreate$2 = arraySpeciesCreate$3; var push$8 = uncurryThis$D([].push); // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation var createMethod$5 = function (TYPE) { var IS_MAP = TYPE == 1; var IS_FILTER = TYPE == 2; var IS_SOME = TYPE == 3; var IS_EVERY = TYPE == 4; var IS_FIND_INDEX = TYPE == 6; var IS_FILTER_REJECT = TYPE == 7; var NO_HOLES = TYPE == 5 || IS_FIND_INDEX; return function ($this, callbackfn, that, specificCreate) { var O = toObject$b($this); var self = IndexedObject$3(O); var boundFunction = bind$a(callbackfn, that); var length = lengthOfArrayLike$9(self); var index = 0; var create = specificCreate || arraySpeciesCreate$2; var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined; var value, result; for (;length > index; index++) if (NO_HOLES || index in self) { value = self[index]; result = boundFunction(value, index, O); if (TYPE) { if (IS_MAP) target[index] = result; // map else if (result) switch (TYPE) { case 3: return true; // some case 5: return value; // find case 6: return index; // findIndex case 2: push$8(target, value); // filter } else switch (TYPE) { case 4: return false; // every case 7: push$8(target, value); // filterReject } } } return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target; }; }; var arrayIteration = { // `Array.prototype.forEach` method // https://tc39.es/ecma262/#sec-array.prototype.foreach forEach: createMethod$5(0), // `Array.prototype.map` method // https://tc39.es/ecma262/#sec-array.prototype.map map: createMethod$5(1), // `Array.prototype.filter` method // https://tc39.es/ecma262/#sec-array.prototype.filter filter: createMethod$5(2), // `Array.prototype.some` method // https://tc39.es/ecma262/#sec-array.prototype.some some: createMethod$5(3), // `Array.prototype.every` method // https://tc39.es/ecma262/#sec-array.prototype.every every: createMethod$5(4), // `Array.prototype.find` method // https://tc39.es/ecma262/#sec-array.prototype.find find: createMethod$5(5), // `Array.prototype.findIndex` method // https://tc39.es/ecma262/#sec-array.prototype.findIndex findIndex: createMethod$5(6), // `Array.prototype.filterReject` method // https://github.com/tc39/proposal-array-filtering filterReject: createMethod$5(7) }; var fails$z = fails$J; var arrayMethodIsStrict$8 = function (METHOD_NAME, argument) { var method = [][METHOD_NAME]; return !!method && fails$z(function () { // eslint-disable-next-line no-useless-call -- required for testing method.call(null, argument || function () { return 1; }, 1); }); }; var $forEach$1 = arrayIteration.forEach; var arrayMethodIsStrict$7 = arrayMethodIsStrict$8; var STRICT_METHOD$7 = arrayMethodIsStrict$7('forEach'); // `Array.prototype.forEach` method implementation // https://tc39.es/ecma262/#sec-array.prototype.foreach var arrayForEach = !STRICT_METHOD$7 ? function forEach(callbackfn /* , thisArg */) { return $forEach$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); // eslint-disable-next-line es/no-array-prototype-foreach -- safe } : [].forEach; var $$_ = _export; var forEach$1 = arrayForEach; // `Array.prototype.forEach` method // https://tc39.es/ecma262/#sec-array.prototype.foreach // eslint-disable-next-line es/no-array-prototype-foreach -- safe $$_({ target: 'Array', proto: true, forced: [].forEach != forEach$1 }, { forEach: forEach$1 }); var TO_STRING_TAG_SUPPORT$1 = toStringTagSupport; var classof$8 = classof$a; // `Object.prototype.toString` method implementation // https://tc39.es/ecma262/#sec-object.prototype.tostring var objectToString = TO_STRING_TAG_SUPPORT$1 ? {}.toString : function toString() { return '[object ' + classof$8(this) + ']'; }; var TO_STRING_TAG_SUPPORT = toStringTagSupport; var defineBuiltIn$g = defineBuiltIn$i; var toString$k = objectToString; // `Object.prototype.toString` method // https://tc39.es/ecma262/#sec-object.prototype.tostring if (!TO_STRING_TAG_SUPPORT) { defineBuiltIn$g(Object.prototype, 'toString', toString$k, { unsafe: true }); } // iterable DOM collections // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods var domIterables = { CSSRuleList: 0, CSSStyleDeclaration: 0, CSSValueList: 0, ClientRectList: 0, DOMRectList: 0, DOMStringList: 0, DOMTokenList: 1, DataTransferItemList: 0, FileList: 0, HTMLAllCollection: 0, HTMLCollection: 0, HTMLFormElement: 0, HTMLSelectElement: 0, MediaList: 0, MimeTypeArray: 0, NamedNodeMap: 0, NodeList: 1, PaintRequestList: 0, Plugin: 0, PluginArray: 0, SVGLengthList: 0, SVGNumberList: 0, SVGPathSegList: 0, SVGPointList: 0, SVGStringList: 0, SVGTransformList: 0, SourceBufferList: 0, StyleSheetList: 0, TextTrackCueList: 0, TextTrackList: 0, TouchList: 0 }; // in old WebKit versions, `element.classList` is not an instance of global `DOMTokenList` var documentCreateElement$1 = documentCreateElement$2; var classList = documentCreateElement$1('span').classList; var DOMTokenListPrototype$2 = classList && classList.constructor && classList.constructor.prototype; var domTokenListPrototype = DOMTokenListPrototype$2 === Object.prototype ? undefined : DOMTokenListPrototype$2; var global$r = global$B; var DOMIterables$1 = domIterables; var DOMTokenListPrototype$1 = domTokenListPrototype; var forEach = arrayForEach; var createNonEnumerableProperty$4 = createNonEnumerableProperty$7; var handlePrototype$1 = function (CollectionPrototype) { // some Chrome versions have non-configurable methods on DOMTokenList if (CollectionPrototype && CollectionPrototype.forEach !== forEach) try { createNonEnumerableProperty$4(CollectionPrototype, 'forEach', forEach); } catch (error) { CollectionPrototype.forEach = forEach; } }; for (var COLLECTION_NAME$1 in DOMIterables$1) { if (DOMIterables$1[COLLECTION_NAME$1]) { handlePrototype$1(global$r[COLLECTION_NAME$1] && global$r[COLLECTION_NAME$1].prototype); } } handlePrototype$1(DOMTokenListPrototype$1); var fails$y = fails$J; var wellKnownSymbol$o = wellKnownSymbol$t; var V8_VERSION$2 = engineV8Version; var SPECIES$5 = wellKnownSymbol$o('species'); var arrayMethodHasSpeciesSupport$5 = function (METHOD_NAME) { // We can't use this feature detection in V8 since it causes // deoptimization and serious performance degradation // https://github.com/zloirock/core-js/issues/677 return V8_VERSION$2 >= 51 || !fails$y(function () { var array = []; var constructor = array.constructor = {}; constructor[SPECIES$5] = function () { return { foo: 1 }; }; return array[METHOD_NAME](Boolean).foo !== 1; }); }; var $$Z = _export; var $map = arrayIteration.map; var arrayMethodHasSpeciesSupport$4 = arrayMethodHasSpeciesSupport$5; var HAS_SPECIES_SUPPORT$3 = arrayMethodHasSpeciesSupport$4('map'); // `Array.prototype.map` method // https://tc39.es/ecma262/#sec-array.prototype.map // with adding support of @@species $$Z({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$3 }, { map: function map(callbackfn /* , thisArg */) { return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); var objectDefineProperties = {}; var internalObjectKeys = objectKeysInternal; var enumBugKeys$1 = enumBugKeys$3; // `Object.keys` method // https://tc39.es/ecma262/#sec-object.keys // eslint-disable-next-line es/no-object-keys -- safe var objectKeys$4 = Object.keys || function keys(O) { return internalObjectKeys(O, enumBugKeys$1); }; var DESCRIPTORS$i = descriptors; var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug; var definePropertyModule$3 = objectDefineProperty; var anObject$i = anObject$l; var toIndexedObject$9 = toIndexedObject$d; var objectKeys$3 = objectKeys$4; // `Object.defineProperties` method // https://tc39.es/ecma262/#sec-object.defineproperties // eslint-disable-next-line es/no-object-defineproperties -- safe objectDefineProperties.f = DESCRIPTORS$i && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) { anObject$i(O); var props = toIndexedObject$9(Properties); var keys = objectKeys$3(Properties); var length = keys.length; var index = 0; var key; while (length > index) definePropertyModule$3.f(O, key = keys[index++], props[key]); return O; }; var getBuiltIn$8 = getBuiltIn$d; var html$2 = getBuiltIn$8('document', 'documentElement'); /* global ActiveXObject -- old IE, WSH */ var anObject$h = anObject$l; var definePropertiesModule$1 = objectDefineProperties; var enumBugKeys = enumBugKeys$3; var hiddenKeys$2 = hiddenKeys$6; var html$1 = html$2; var documentCreateElement = documentCreateElement$2; var sharedKey$2 = sharedKey$4; var GT = '>'; var LT = '<'; var PROTOTYPE$1 = 'prototype'; var SCRIPT = 'script'; var IE_PROTO$1 = sharedKey$2('IE_PROTO'); var EmptyConstructor = function () { /* empty */ }; var scriptTag = function (content) { return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT; }; // Create object with fake `null` prototype: use ActiveX Object with cleared prototype var NullProtoObjectViaActiveX = function (activeXDocument) { activeXDocument.write(scriptTag('')); activeXDocument.close(); var temp = activeXDocument.parentWindow.Object; activeXDocument = null; // avoid memory leak return temp; }; // Create object with fake `null` prototype: use iframe Object with cleared prototype var NullProtoObjectViaIFrame = function () { // Thrash, waste and sodomy: IE GC bug var iframe = documentCreateElement('iframe'); var JS = 'java' + SCRIPT + ':'; var iframeDocument; iframe.style.display = 'none'; html$1.appendChild(iframe); // https://github.com/zloirock/core-js/issues/475 iframe.src = String(JS); iframeDocument = iframe.contentWindow.document; iframeDocument.open(); iframeDocument.write(scriptTag('document.F=Object')); iframeDocument.close(); return iframeDocument.F; }; // Check for document.domain and active x support // No need to use active x approach when document.domain is not set // see https://github.com/es-shims/es5-shim/issues/150 // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346 // avoid IE GC bug var activeXDocument; var NullProtoObject = function () { try { activeXDocument = new ActiveXObject('htmlfile'); } catch (error) { /* ignore */ } NullProtoObject = typeof document != 'undefined' ? document.domain && activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) // old IE : NullProtoObjectViaIFrame() : NullProtoObjectViaActiveX(activeXDocument); // WSH var length = enumBugKeys.length; while (length--) delete NullProtoObject[PROTOTYPE$1][enumBugKeys[length]]; return NullProtoObject(); }; hiddenKeys$2[IE_PROTO$1] = true; // `Object.create` method // https://tc39.es/ecma262/#sec-object.create // eslint-disable-next-line es/no-object-create -- safe var objectCreate = Object.create || function create(O, Properties) { var result; if (O !== null) { EmptyConstructor[PROTOTYPE$1] = anObject$h(O); result = new EmptyConstructor(); EmptyConstructor[PROTOTYPE$1] = null; // add "__proto__" for Object.getPrototypeOf polyfill result[IE_PROTO$1] = O; } else result = NullProtoObject(); return Properties === undefined ? result : definePropertiesModule$1.f(result, Properties); }; var wellKnownSymbol$n = wellKnownSymbol$t; var create$6 = objectCreate; var defineProperty$c = objectDefineProperty.f; var UNSCOPABLES = wellKnownSymbol$n('unscopables'); var ArrayPrototype$1 = Array.prototype; // Array.prototype[@@unscopables] // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables if (ArrayPrototype$1[UNSCOPABLES] == undefined) { defineProperty$c(ArrayPrototype$1, UNSCOPABLES, { configurable: true, value: create$6(null) }); } // add a key to Array.prototype[@@unscopables] var addToUnscopables$4 = function (key) { ArrayPrototype$1[UNSCOPABLES][key] = true; }; var $$Y = _export; var $find = arrayIteration.find; var addToUnscopables$3 = addToUnscopables$4; var FIND = 'find'; var SKIPS_HOLES$1 = true; // Shouldn't skip holes if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES$1 = false; }); // `Array.prototype.find` method // https://tc39.es/ecma262/#sec-array.prototype.find $$Y({ target: 'Array', proto: true, forced: SKIPS_HOLES$1 }, { find: function find(callbackfn /* , that = undefined */) { return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables addToUnscopables$3(FIND); var toPropertyKey$1 = toPropertyKey$4; var definePropertyModule$2 = objectDefineProperty; var createPropertyDescriptor$3 = createPropertyDescriptor$6; var createProperty$6 = function (object, key, value) { var propertyKey = toPropertyKey$1(key); if (propertyKey in object) definePropertyModule$2.f(object, propertyKey, createPropertyDescriptor$3(0, value)); else object[propertyKey] = value; }; var uncurryThis$C = functionUncurryThis; var arraySlice$8 = uncurryThis$C([].slice); var $$X = _export; var isArray$4 = isArray$6; var isConstructor$2 = isConstructor$4; var isObject$h = isObject$o; var toAbsoluteIndex$2 = toAbsoluteIndex$4; var lengthOfArrayLike$8 = lengthOfArrayLike$b; var toIndexedObject$8 = toIndexedObject$d; var createProperty$5 = createProperty$6; var wellKnownSymbol$m = wellKnownSymbol$t; var arrayMethodHasSpeciesSupport$3 = arrayMethodHasSpeciesSupport$5; var nativeSlice = arraySlice$8; var HAS_SPECIES_SUPPORT$2 = arrayMethodHasSpeciesSupport$3('slice'); var SPECIES$4 = wellKnownSymbol$m('species'); var $Array$2 = Array; var max$4 = Math.max; // `Array.prototype.slice` method // https://tc39.es/ecma262/#sec-array.prototype.slice // fallback for not array-like ES3 strings and DOM objects $$X({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$2 }, { slice: function slice(start, end) { var O = toIndexedObject$8(this); var length = lengthOfArrayLike$8(O); var k = toAbsoluteIndex$2(start, length); var fin = toAbsoluteIndex$2(end === undefined ? length : end, length); // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible var Constructor, result, n; if (isArray$4(O)) { Constructor = O.constructor; // cross-realm fallback if (isConstructor$2(Constructor) && (Constructor === $Array$2 || isArray$4(Constructor.prototype))) { Constructor = undefined; } else if (isObject$h(Constructor)) { Constructor = Constructor[SPECIES$4]; if (Constructor === null) Constructor = undefined; } if (Constructor === $Array$2 || Constructor === undefined) { return nativeSlice(O, k, fin); } } result = new (Constructor === undefined ? $Array$2 : Constructor)(max$4(fin - k, 0)); for (n = 0; k < fin; k++, n++) if (k in O) createProperty$5(result, n, O[k]); result.length = n; return result; } }); /* eslint-disable es/no-array-prototype-indexof -- required for testing */ var $$W = _export; var uncurryThis$B = functionUncurryThis; var $indexOf = arrayIncludes.indexOf; var arrayMethodIsStrict$6 = arrayMethodIsStrict$8; var nativeIndexOf = uncurryThis$B([].indexOf); var NEGATIVE_ZERO$1 = !!nativeIndexOf && 1 / nativeIndexOf([1], 1, -0) < 0; var STRICT_METHOD$6 = arrayMethodIsStrict$6('indexOf'); // `Array.prototype.indexOf` method // https://tc39.es/ecma262/#sec-array.prototype.indexof $$W({ target: 'Array', proto: true, forced: NEGATIVE_ZERO$1 || !STRICT_METHOD$6 }, { indexOf: function indexOf(searchElement /* , fromIndex = 0 */) { var fromIndex = arguments.length > 1 ? arguments[1] : undefined; return NEGATIVE_ZERO$1 // convert -0 to +0 ? nativeIndexOf(this, searchElement, fromIndex) || 0 : $indexOf(this, searchElement, fromIndex); } }); var uncurryThis$A = functionUncurryThis; var aCallable$7 = aCallable$a; var isObject$g = isObject$o; var hasOwn$f = hasOwnProperty_1; var arraySlice$7 = arraySlice$8; var NATIVE_BIND$1 = functionBindNative; var $Function = Function; var concat$2 = uncurryThis$A([].concat); var join$3 = uncurryThis$A([].join); var factories = {}; var construct = function (C, argsLength, args) { if (!hasOwn$f(factories, argsLength)) { for (var list = [], i = 0; i < argsLength; i++) list[i] = 'a[' + i + ']'; factories[argsLength] = $Function('C,a', 'return new C(' + join$3(list, ',') + ')'); } return factories[argsLength](C, args); }; // `Function.prototype.bind` method implementation // https://tc39.es/ecma262/#sec-function.prototype.bind var functionBind = NATIVE_BIND$1 ? $Function.bind : function bind(that /* , ...args */) { var F = aCallable$7(this); var Prototype = F.prototype; var partArgs = arraySlice$7(arguments, 1); var boundFunction = function bound(/* args... */) { var args = concat$2(partArgs, arraySlice$7(arguments)); return this instanceof boundFunction ? construct(F, args.length, args) : F.apply(that, args); }; if (isObject$g(Prototype)) boundFunction.prototype = Prototype; return boundFunction; }; // TODO: Remove from `core-js@4` var $$V = _export; var bind$9 = functionBind; // `Function.prototype.bind` method // https://tc39.es/ecma262/#sec-function.prototype.bind $$V({ target: 'Function', proto: true, forced: Function.bind !== bind$9 }, { bind: bind$9 }); var DESCRIPTORS$h = descriptors; var isArray$3 = isArray$6; var $TypeError$d = TypeError; // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var getOwnPropertyDescriptor$4 = Object.getOwnPropertyDescriptor; // Safari < 13 does not throw an error in this case var SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS$h && !function () { // makes no sense without proper strict mode support if (this !== undefined) return true; try { // eslint-disable-next-line es/no-object-defineproperty -- safe Object.defineProperty([], 'length', { writable: false }).length = 1; } catch (error) { return error instanceof TypeError; } }(); var arraySetLength = SILENT_ON_NON_WRITABLE_LENGTH_SET ? function (O, length) { if (isArray$3(O) && !getOwnPropertyDescriptor$4(O, 'length').writable) { throw $TypeError$d('Cannot set read only .length'); } return O.length = length; } : function (O, length) { return O.length = length; }; var $TypeError$c = TypeError; var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991 var doesNotExceedSafeInteger$2 = function (it) { if (it > MAX_SAFE_INTEGER) throw $TypeError$c('Maximum allowed index exceeded'); return it; }; var tryToString$4 = tryToString$6; var $TypeError$b = TypeError; var deletePropertyOrThrow$2 = function (O, P) { if (!delete O[P]) throw $TypeError$b('Cannot delete property ' + tryToString$4(P) + ' of ' + tryToString$4(O)); }; var $$U = _export; var toObject$a = toObject$d; var toAbsoluteIndex$1 = toAbsoluteIndex$4; var toIntegerOrInfinity$5 = toIntegerOrInfinity$8; var lengthOfArrayLike$7 = lengthOfArrayLike$b; var setArrayLength = arraySetLength; var doesNotExceedSafeInteger$1 = doesNotExceedSafeInteger$2; var arraySpeciesCreate$1 = arraySpeciesCreate$3; var createProperty$4 = createProperty$6; var deletePropertyOrThrow$1 = deletePropertyOrThrow$2; var arrayMethodHasSpeciesSupport$2 = arrayMethodHasSpeciesSupport$5; var HAS_SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport$2('splice'); var max$3 = Math.max; var min$3 = Math.min; // `Array.prototype.splice` method // https://tc39.es/ecma262/#sec-array.prototype.splice // with adding support of @@species $$U({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$1 }, { splice: function splice(start, deleteCount /* , ...items */) { var O = toObject$a(this); var len = lengthOfArrayLike$7(O); var actualStart = toAbsoluteIndex$1(start, len); var argumentsLength = arguments.length; var insertCount, actualDeleteCount, A, k, from, to; if (argumentsLength === 0) { insertCount = actualDeleteCount = 0; } else if (argumentsLength === 1) { insertCount = 0; actualDeleteCount = len - actualStart; } else { insertCount = argumentsLength - 2; actualDeleteCount = min$3(max$3(toIntegerOrInfinity$5(deleteCount), 0), len - actualStart); } doesNotExceedSafeInteger$1(len + insertCount - actualDeleteCount); A = arraySpeciesCreate$1(O, actualDeleteCount); for (k = 0; k < actualDeleteCount; k++) { from = actualStart + k; if (from in O) createProperty$4(A, k, O[from]); } A.length = actualDeleteCount; if (insertCount < actualDeleteCount) { for (k = actualStart; k < len - actualDeleteCount; k++) { from = k + actualDeleteCount; to = k + insertCount; if (from in O) O[to] = O[from]; else deletePropertyOrThrow$1(O, to); } for (k = len; k > len - actualDeleteCount + insertCount; k--) deletePropertyOrThrow$1(O, k - 1); } else if (insertCount > actualDeleteCount) { for (k = len - actualDeleteCount; k > actualStart; k--) { from = k + actualDeleteCount - 1; to = k + insertCount - 1; if (from in O) O[to] = O[from]; else deletePropertyOrThrow$1(O, to); } } for (k = 0; k < insertCount; k++) { O[k + actualStart] = arguments[k + 2]; } setArrayLength(O, len - actualDeleteCount + insertCount); return A; } }); var DESCRIPTORS$g = descriptors; var uncurryThis$z = functionUncurryThis; var call$l = functionCall; var fails$x = fails$J; var objectKeys$2 = objectKeys$4; var getOwnPropertySymbolsModule$2 = objectGetOwnPropertySymbols; var propertyIsEnumerableModule$1 = objectPropertyIsEnumerable; var toObject$9 = toObject$d; var IndexedObject$2 = indexedObject; // eslint-disable-next-line es/no-object-assign -- safe var $assign = Object.assign; // eslint-disable-next-line es/no-object-defineproperty -- required for testing var defineProperty$b = Object.defineProperty; var concat$1 = uncurryThis$z([].concat); // `Object.assign` method // https://tc39.es/ecma262/#sec-object.assign var objectAssign = !$assign || fails$x(function () { // should have correct order of operations (Edge bug) if (DESCRIPTORS$g && $assign({ b: 1 }, $assign(defineProperty$b({}, 'a', { enumerable: true, get: function () { defineProperty$b(this, 'b', { value: 3, enumerable: false }); } }), { b: 2 })).b !== 1) return true; // should work with symbols and should have deterministic property order (V8 bug) var A = {}; var B = {}; // eslint-disable-next-line es/no-symbol -- safe var symbol = Symbol(); var alphabet = 'abcdefghijklmnopqrst'; A[symbol] = 7; alphabet.split('').forEach(function (chr) { B[chr] = chr; }); return $assign({}, A)[symbol] != 7 || objectKeys$2($assign({}, B)).join('') != alphabet; }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length` var T = toObject$9(target); var argumentsLength = arguments.length; var index = 1; var getOwnPropertySymbols = getOwnPropertySymbolsModule$2.f; var propertyIsEnumerable = propertyIsEnumerableModule$1.f; while (argumentsLength > index) { var S = IndexedObject$2(arguments[index++]); var keys = getOwnPropertySymbols ? concat$1(objectKeys$2(S), getOwnPropertySymbols(S)) : objectKeys$2(S); var length = keys.length; var j = 0; var key; while (length > j) { key = keys[j++]; if (!DESCRIPTORS$g || call$l(propertyIsEnumerable, S, key)) T[key] = S[key]; } } return T; } : $assign; var $$T = _export; var assign$1 = objectAssign; // `Object.assign` method // https://tc39.es/ecma262/#sec-object.assign // eslint-disable-next-line es/no-object-assign -- required for testing $$T({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign$1 }, { assign: assign$1 }); var classof$7 = classof$a; var $String$2 = String; var toString$j = function (argument) { if (classof$7(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string'); return $String$2(argument); }; var anObject$g = anObject$l; // `RegExp.prototype.flags` getter implementation // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags var regexpFlags$1 = function () { var that = anObject$g(this); var result = ''; if (that.hasIndices) result += 'd'; if (that.global) result += 'g'; if (that.ignoreCase) result += 'i'; if (that.multiline) result += 'm'; if (that.dotAll) result += 's'; if (that.unicode) result += 'u'; if (that.unicodeSets) result += 'v'; if (that.sticky) result += 'y'; return result; }; var fails$w = fails$J; var global$q = global$B; // babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError var $RegExp$2 = global$q.RegExp; var UNSUPPORTED_Y$2 = fails$w(function () { var re = $RegExp$2('a', 'y'); re.lastIndex = 2; return re.exec('abcd') != null; }); // UC Browser bug // https://github.com/zloirock/core-js/issues/1008 var MISSED_STICKY$1 = UNSUPPORTED_Y$2 || fails$w(function () { return !$RegExp$2('a', 'y').sticky; }); var BROKEN_CARET = UNSUPPORTED_Y$2 || fails$w(function () { // https://bugzilla.mozilla.org/show_bug.cgi?id=773687 var re = $RegExp$2('^r', 'gy'); re.lastIndex = 2; return re.exec('str') != null; }); var regexpStickyHelpers = { BROKEN_CARET: BROKEN_CARET, MISSED_STICKY: MISSED_STICKY$1, UNSUPPORTED_Y: UNSUPPORTED_Y$2 }; var fails$v = fails$J; var global$p = global$B; // babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError var $RegExp$1 = global$p.RegExp; var regexpUnsupportedDotAll = fails$v(function () { var re = $RegExp$1('.', 's'); return !(re.dotAll && re.exec('\n') && re.flags === 's'); }); var fails$u = fails$J; var global$o = global$B; // babel-minify and Closure Compiler transpiles RegExp('(?b)', 'g') -> /(?b)/g and it causes SyntaxError var $RegExp = global$o.RegExp; var regexpUnsupportedNcg = fails$u(function () { var re = $RegExp('(?b)', 'g'); return re.exec('b').groups.a !== 'b' || 'b'.replace(re, '$c') !== 'bc'; }); /* eslint-disable regexp/no-empty-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */ /* eslint-disable regexp/no-useless-quantifier -- testing */ var call$k = functionCall; var uncurryThis$y = functionUncurryThis; var toString$i = toString$j; var regexpFlags = regexpFlags$1; var stickyHelpers$1 = regexpStickyHelpers; var shared$3 = shared$7.exports; var create$5 = objectCreate; var getInternalState$3 = internalState.get; var UNSUPPORTED_DOT_ALL$1 = regexpUnsupportedDotAll; var UNSUPPORTED_NCG$1 = regexpUnsupportedNcg; var nativeReplace = shared$3('native-string-replace', String.prototype.replace); var nativeExec = RegExp.prototype.exec; var patchedExec = nativeExec; var charAt$9 = uncurryThis$y(''.charAt); var indexOf$1 = uncurryThis$y(''.indexOf); var replace$9 = uncurryThis$y(''.replace); var stringSlice$b = uncurryThis$y(''.slice); var UPDATES_LAST_INDEX_WRONG = (function () { var re1 = /a/; var re2 = /b*/g; call$k(nativeExec, re1, 'a'); call$k(nativeExec, re2, 'a'); return re1.lastIndex !== 0 || re2.lastIndex !== 0; })(); var UNSUPPORTED_Y$1 = stickyHelpers$1.BROKEN_CARET; // nonparticipating capturing group, copied from es5-shim's String#split patch. var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined; var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$1 || UNSUPPORTED_DOT_ALL$1 || UNSUPPORTED_NCG$1; if (PATCH) { patchedExec = function exec(string) { var re = this; var state = getInternalState$3(re); var str = toString$i(string); var raw = state.raw; var result, reCopy, lastIndex, match, i, object, group; if (raw) { raw.lastIndex = re.lastIndex; result = call$k(patchedExec, raw, str); re.lastIndex = raw.lastIndex; return result; } var groups = state.groups; var sticky = UNSUPPORTED_Y$1 && re.sticky; var flags = call$k(regexpFlags, re); var source = re.source; var charsAdded = 0; var strCopy = str; if (sticky) { flags = replace$9(flags, 'y', ''); if (indexOf$1(flags, 'g') === -1) { flags += 'g'; } strCopy = stringSlice$b(str, re.lastIndex); // Support anchored sticky behavior. if (re.lastIndex > 0 && (!re.multiline || re.multiline && charAt$9(str, re.lastIndex - 1) !== '\n')) { source = '(?: ' + source + ')'; strCopy = ' ' + strCopy; charsAdded++; } // ^(? + rx + ) is needed, in combination with some str slicing, to // simulate the 'y' flag. reCopy = new RegExp('^(?:' + source + ')', flags); } if (NPCG_INCLUDED) { reCopy = new RegExp('^' + source + '$(?!\\s)', flags); } if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex; match = call$k(nativeExec, sticky ? reCopy : re, strCopy); if (sticky) { if (match) { match.input = stringSlice$b(match.input, charsAdded); match[0] = stringSlice$b(match[0], charsAdded); match.index = re.lastIndex; re.lastIndex += match[0].length; } else re.lastIndex = 0; } else if (UPDATES_LAST_INDEX_WRONG && match) { re.lastIndex = re.global ? match.index + match[0].length : lastIndex; } if (NPCG_INCLUDED && match && match.length > 1) { // Fix browsers whose `exec` methods don't consistently return `undefined` // for NPCG, like IE8. NOTE: This doesn't work for /(.?)?/ call$k(nativeReplace, match[0], reCopy, function () { for (i = 1; i < arguments.length - 2; i++) { if (arguments[i] === undefined) match[i] = undefined; } }); } if (match && groups) { match.groups = object = create$5(null); for (i = 0; i < groups.length; i++) { group = groups[i]; object[group[0]] = match[group[1]]; } } return match; }; } var regexpExec$2 = patchedExec; var $$S = _export; var exec$5 = regexpExec$2; // `RegExp.prototype.exec` method // https://tc39.es/ecma262/#sec-regexp.prototype.exec $$S({ target: 'RegExp', proto: true, forced: /./.exec !== exec$5 }, { exec: exec$5 }); var ViewPort = { XS: 0, SM: 540, MD: 860, LG: 1084, XL: 1400 }; var DetectionUtil = { /* eslint-disable no-useless-escape, unicorn/better-regex */detectMobile: function detectMobile(includeTabletCheck) { if (includeTabletCheck === void 0) { includeTabletCheck = false; } /** * detect if mobile and/or tablet device * returns bool */ var check = false; if (includeTabletCheck) { (function (a) { if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.slice(0, 4))) { check = true; } })(navigator.userAgent || navigator.vendor || window.opera); } else { (function (a) { if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.slice(0, 4))) { check = true; } })(navigator.userAgent || navigator.vendor || window.opera); } return check; }, /** * Gets viewport based on brower's window width. * @returns {string} viewport */ detectViewport: function detectViewport() { var windowWidth = window.innerWidth; if (windowWidth >= ViewPort.XS && windowWidth < ViewPort.SM) { return 'xs'; } if (windowWidth < ViewPort.MD && windowWidth >= ViewPort.SM) { return 'sm'; } if (windowWidth < ViewPort.LG && windowWidth >= ViewPort.MD) { return 'md'; } if (windowWidth < ViewPort.XL && windowWidth >= ViewPort.LG) { return 'lg'; } if (windowWidth >= ViewPort.XL) { return 'xl'; } }, /* eslint-enable no-useless-escape */isBiDirectional: function isBiDirectional(el) { if (!el) { el = document.querySelector('html'); } return el.getAttribute('dir') === 'rtl'; }, /** * Detects whether a user has enabled the prefers reduced motion setting * @returns {boolean} */ prefersReducedMotion: function prefersReducedMotion() { var preference = window.matchMedia('(prefers-reduced-motion: reduce)'); return preference.matches; } }; function _regeneratorRuntime() { _regeneratorRuntime = function () { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function (obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function (skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function () { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function (exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function (type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function (record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function (finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function (tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function (iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } function _defineProperties$3(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass$3(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$3(Constructor.prototype, protoProps); if (staticProps) _defineProperties$3(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf$1(subClass, superClass); } function _getPrototypeOf$1(o) { _getPrototypeOf$1 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf$1(o); } function _setPrototypeOf$1(o, p) { _setPrototypeOf$1 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf$1(o, p); } function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _construct$1(Parent, args, Class) { if (_isNativeReflectConstruct$1()) { _construct$1 = Reflect.construct.bind(); } else { _construct$1 = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf$1(instance, Class.prototype); return instance; }; } return _construct$1.apply(null, arguments); } function _isNativeFunction$1(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; } function _wrapNativeSuper$1(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper$1 = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction$1(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct$1(Class, arguments, _getPrototypeOf$1(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf$1(Wrapper, Class); }; return _wrapNativeSuper$1(Class); } function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } function _assertThisInitialized$1(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _unsupportedIterableToArray$7(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$7(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$7(o, minLen); } function _arrayLikeToArray$7(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } function _createForOfIteratorHelperLoose$6(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray$7(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var id$2 = 0; function _classPrivateFieldLooseKey(name) { return "__private_" + id$2++ + "_" + name; } function _classPrivateFieldLooseBase(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError("attempted to use private field on non-instance"); } return receiver; } // TODO: Remove from `core-js@4` var uncurryThis$x = functionUncurryThis; var defineBuiltIn$f = defineBuiltIn$i; var DatePrototype$1 = Date.prototype; var INVALID_DATE = 'Invalid Date'; var TO_STRING$1 = 'toString'; var nativeDateToString = uncurryThis$x(DatePrototype$1[TO_STRING$1]); var thisTimeValue$2 = uncurryThis$x(DatePrototype$1.getTime); // `Date.prototype.toString` method // https://tc39.es/ecma262/#sec-date.prototype.tostring if (String(new Date(NaN)) != INVALID_DATE) { defineBuiltIn$f(DatePrototype$1, TO_STRING$1, function toString() { var value = thisTimeValue$2(this); // eslint-disable-next-line no-self-compare -- NaN check return value === value ? nativeDateToString(this) : INVALID_DATE; }); } var call$j = functionCall; var hasOwn$e = hasOwnProperty_1; var isPrototypeOf$6 = objectIsPrototypeOf; var regExpFlags = regexpFlags$1; var RegExpPrototype$3 = RegExp.prototype; var regexpGetFlags = function (R) { var flags = R.flags; return flags === undefined && !('flags' in RegExpPrototype$3) && !hasOwn$e(R, 'flags') && isPrototypeOf$6(RegExpPrototype$3, R) ? call$j(regExpFlags, R) : flags; }; var PROPER_FUNCTION_NAME$2 = functionName.PROPER; var defineBuiltIn$e = defineBuiltIn$i; var anObject$f = anObject$l; var $toString$3 = toString$j; var fails$t = fails$J; var getRegExpFlags$2 = regexpGetFlags; var TO_STRING = 'toString'; var RegExpPrototype$2 = RegExp.prototype; var nativeToString = RegExpPrototype$2[TO_STRING]; var NOT_GENERIC = fails$t(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; }); // FF44- RegExp#toString has a wrong name var INCORRECT_NAME = PROPER_FUNCTION_NAME$2 && nativeToString.name != TO_STRING; // `RegExp.prototype.toString` method // https://tc39.es/ecma262/#sec-regexp.prototype.tostring if (NOT_GENERIC || INCORRECT_NAME) { defineBuiltIn$e(RegExp.prototype, TO_STRING, function toString() { var R = anObject$f(this); var pattern = $toString$3(R.source); var flags = $toString$3(getRegExpFlags$2(R)); return '/' + pattern + '/' + flags; }, { unsafe: true }); } var $$R = _export; var isArray$2 = isArray$6; // `Array.isArray` method // https://tc39.es/ecma262/#sec-array.isarray $$R({ target: 'Array', stat: true }, { isArray: isArray$2 }); var InitializationUtil = { /** * Initialize a component after DOM is loaded * @param {string} selector - DOM selector for component * @param {Function} init - Callback function to initialize the component */ initializeComponent: function initializeComponent(selector, init) { document.querySelectorAll(selector).forEach(function (node) { return init(node); }); }, /** * Iterate over list to add event listeners * @param {Array.<{ * el: Element | Document | Window, * handler: Function, * type: String, * options?: Object * }>} eventList - List of event maps */ addEvents: function addEvents(eventList) { for (var _iterator = _createForOfIteratorHelperLoose$6(eventList), _step; !(_step = _iterator()).done;) { var obj = _step.value; if (typeof obj.options === 'undefined') { obj.options = {}; } if (typeof obj.el.addEventListener === 'function') { obj.el.addEventListener(obj.type, obj.handler, obj.options); } else if (obj.el.toString() === '[object MediaQueryList]' && typeof obj.el.addListener === 'function') { obj.el.addListener(obj.handler); // for Safari <14 } } }, /** * Iterate over list to remove event listeners * @param {array} eventList - List of event maps */ removeEvents: function removeEvents(eventList) { for (var _iterator2 = _createForOfIteratorHelperLoose$6(eventList), _step2; !(_step2 = _iterator2()).done;) { var obj = _step2.value; if (typeof obj.el.removeEventListener === 'function') { obj.el.removeEventListener(obj.type, obj.handler); } else if (obj.el.toString() === '[object MediaQueryList]' && typeof obj.el.removeListener === 'function') { obj.el.removeListener(obj.handler); // for Safari <14 } } }, /** * Tears down each in a list of mwf component instances * @param {Array} componentList an array of mwf component instance */ tearDownComponentList: function tearDownComponentList(componentList) { if (Array.isArray(componentList)) { var component; while (componentList.length > 0) { component = componentList.pop(); if (typeof component.remove === 'function') { component.remove(); } } } } }; var $$Q = _export; var fails$s = fails$J; var isArray$1 = isArray$6; var isObject$f = isObject$o; var toObject$8 = toObject$d; var lengthOfArrayLike$6 = lengthOfArrayLike$b; var doesNotExceedSafeInteger = doesNotExceedSafeInteger$2; var createProperty$3 = createProperty$6; var arraySpeciesCreate = arraySpeciesCreate$3; var arrayMethodHasSpeciesSupport$1 = arrayMethodHasSpeciesSupport$5; var wellKnownSymbol$l = wellKnownSymbol$t; var V8_VERSION$1 = engineV8Version; var IS_CONCAT_SPREADABLE = wellKnownSymbol$l('isConcatSpreadable'); // We can't use this feature detection in V8 since it causes // deoptimization and serious performance degradation // https://github.com/zloirock/core-js/issues/679 var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION$1 >= 51 || !fails$s(function () { var array = []; array[IS_CONCAT_SPREADABLE] = false; return array.concat()[0] !== array; }); var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport$1('concat'); var isConcatSpreadable = function (O) { if (!isObject$f(O)) return false; var spreadable = O[IS_CONCAT_SPREADABLE]; return spreadable !== undefined ? !!spreadable : isArray$1(O); }; var FORCED$8 = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT; // `Array.prototype.concat` method // https://tc39.es/ecma262/#sec-array.prototype.concat // with adding support of @@isConcatSpreadable and @@species $$Q({ target: 'Array', proto: true, arity: 1, forced: FORCED$8 }, { // eslint-disable-next-line no-unused-vars -- required for `.length` concat: function concat(arg) { var O = toObject$8(this); var A = arraySpeciesCreate(O, 0); var n = 0; var i, k, length, len, E; for (i = -1, length = arguments.length; i < length; i++) { E = i === -1 ? O : arguments[i]; if (isConcatSpreadable(E)) { len = lengthOfArrayLike$6(E); doesNotExceedSafeInteger(n + len); for (k = 0; k < len; k++, n++) if (k in E) createProperty$3(A, n, E[k]); } else { doesNotExceedSafeInteger(n + 1); createProperty$3(A, n++, E); } } A.length = n; return A; } }); var call$i = functionCall; var anObject$e = anObject$l; var getMethod$5 = getMethod$7; var iteratorClose$2 = function (iterator, kind, value) { var innerResult, innerError; anObject$e(iterator); try { innerResult = getMethod$5(iterator, 'return'); if (!innerResult) { if (kind === 'throw') throw value; return value; } innerResult = call$i(innerResult, iterator); } catch (error) { innerError = true; innerResult = error; } if (kind === 'throw') throw value; if (innerError) throw innerResult; anObject$e(innerResult); return value; }; var anObject$d = anObject$l; var iteratorClose$1 = iteratorClose$2; // call something on iterator step with safe closing on error var callWithSafeIterationClosing$1 = function (iterator, fn, value, ENTRIES) { try { return ENTRIES ? fn(anObject$d(value)[0], value[1]) : fn(value); } catch (error) { iteratorClose$1(iterator, 'throw', error); } }; var iterators = {}; var wellKnownSymbol$k = wellKnownSymbol$t; var Iterators$4 = iterators; var ITERATOR$9 = wellKnownSymbol$k('iterator'); var ArrayPrototype = Array.prototype; // check on default Array iterator var isArrayIteratorMethod$2 = function (it) { return it !== undefined && (Iterators$4.Array === it || ArrayPrototype[ITERATOR$9] === it); }; var classof$6 = classof$a; var getMethod$4 = getMethod$7; var isNullOrUndefined$8 = isNullOrUndefined$b; var Iterators$3 = iterators; var wellKnownSymbol$j = wellKnownSymbol$t; var ITERATOR$8 = wellKnownSymbol$j('iterator'); var getIteratorMethod$4 = function (it) { if (!isNullOrUndefined$8(it)) return getMethod$4(it, ITERATOR$8) || getMethod$4(it, '@@iterator') || Iterators$3[classof$6(it)]; }; var call$h = functionCall; var aCallable$6 = aCallable$a; var anObject$c = anObject$l; var tryToString$3 = tryToString$6; var getIteratorMethod$3 = getIteratorMethod$4; var $TypeError$a = TypeError; var getIterator$3 = function (argument, usingIterator) { var iteratorMethod = arguments.length < 2 ? getIteratorMethod$3(argument) : usingIterator; if (aCallable$6(iteratorMethod)) return anObject$c(call$h(iteratorMethod, argument)); throw $TypeError$a(tryToString$3(argument) + ' is not iterable'); }; var bind$8 = functionBindContext; var call$g = functionCall; var toObject$7 = toObject$d; var callWithSafeIterationClosing = callWithSafeIterationClosing$1; var isArrayIteratorMethod$1 = isArrayIteratorMethod$2; var isConstructor$1 = isConstructor$4; var lengthOfArrayLike$5 = lengthOfArrayLike$b; var createProperty$2 = createProperty$6; var getIterator$2 = getIterator$3; var getIteratorMethod$2 = getIteratorMethod$4; var $Array$1 = Array; // `Array.from` method implementation // https://tc39.es/ecma262/#sec-array.from var arrayFrom$1 = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) { var O = toObject$7(arrayLike); var IS_CONSTRUCTOR = isConstructor$1(this); var argumentsLength = arguments.length; var mapfn = argumentsLength > 1 ? arguments[1] : undefined; var mapping = mapfn !== undefined; if (mapping) mapfn = bind$8(mapfn, argumentsLength > 2 ? arguments[2] : undefined); var iteratorMethod = getIteratorMethod$2(O); var index = 0; var length, result, step, iterator, next, value; // if the target is not iterable or it's an array with the default iterator - use a simple case if (iteratorMethod && !(this === $Array$1 && isArrayIteratorMethod$1(iteratorMethod))) { iterator = getIterator$2(O, iteratorMethod); next = iterator.next; result = IS_CONSTRUCTOR ? new this() : []; for (;!(step = call$g(next, iterator)).done; index++) { value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value; createProperty$2(result, index, value); } } else { length = lengthOfArrayLike$5(O); result = IS_CONSTRUCTOR ? new this(length) : $Array$1(length); for (;length > index; index++) { value = mapping ? mapfn(O[index], index) : O[index]; createProperty$2(result, index, value); } } result.length = index; return result; }; var wellKnownSymbol$i = wellKnownSymbol$t; var ITERATOR$7 = wellKnownSymbol$i('iterator'); var SAFE_CLOSING = false; try { var called = 0; var iteratorWithReturn = { next: function () { return { done: !!called++ }; }, 'return': function () { SAFE_CLOSING = true; } }; iteratorWithReturn[ITERATOR$7] = function () { return this; }; // eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing Array.from(iteratorWithReturn, function () { throw 2; }); } catch (error) { /* empty */ } var checkCorrectnessOfIteration$3 = function (exec, SKIP_CLOSING) { if (!SKIP_CLOSING && !SAFE_CLOSING) return false; var ITERATION_SUPPORT = false; try { var object = {}; object[ITERATOR$7] = function () { return { next: function () { return { done: ITERATION_SUPPORT = true }; } }; }; exec(object); } catch (error) { /* empty */ } return ITERATION_SUPPORT; }; var $$P = _export; var from = arrayFrom$1; var checkCorrectnessOfIteration$2 = checkCorrectnessOfIteration$3; var INCORRECT_ITERATION = !checkCorrectnessOfIteration$2(function (iterable) { // eslint-disable-next-line es/no-array-from -- required for testing Array.from(iterable); }); // `Array.from` method // https://tc39.es/ecma262/#sec-array.from $$P({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, { from: from }); var uncurryThis$w = functionUncurryThis; var toIntegerOrInfinity$4 = toIntegerOrInfinity$8; var toString$h = toString$j; var requireObjectCoercible$a = requireObjectCoercible$d; var charAt$8 = uncurryThis$w(''.charAt); var charCodeAt$3 = uncurryThis$w(''.charCodeAt); var stringSlice$a = uncurryThis$w(''.slice); var createMethod$4 = function (CONVERT_TO_STRING) { return function ($this, pos) { var S = toString$h(requireObjectCoercible$a($this)); var position = toIntegerOrInfinity$4(pos); var size = S.length; var first, second; if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined; first = charCodeAt$3(S, position); return first < 0xD800 || first > 0xDBFF || position + 1 === size || (second = charCodeAt$3(S, position + 1)) < 0xDC00 || second > 0xDFFF ? CONVERT_TO_STRING ? charAt$8(S, position) : first : CONVERT_TO_STRING ? stringSlice$a(S, position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000; }; }; var stringMultibyte = { // `String.prototype.codePointAt` method // https://tc39.es/ecma262/#sec-string.prototype.codepointat codeAt: createMethod$4(false), // `String.prototype.at` method // https://github.com/mathiasbynens/String.prototype.at charAt: createMethod$4(true) }; var fails$r = fails$J; var correctPrototypeGetter = !fails$r(function () { function F() { /* empty */ } F.prototype.constructor = null; // eslint-disable-next-line es/no-object-getprototypeof -- required for testing return Object.getPrototypeOf(new F()) !== F.prototype; }); var hasOwn$d = hasOwnProperty_1; var isCallable$h = isCallable$u; var toObject$6 = toObject$d; var sharedKey$1 = sharedKey$4; var CORRECT_PROTOTYPE_GETTER$1 = correctPrototypeGetter; var IE_PROTO = sharedKey$1('IE_PROTO'); var $Object = Object; var ObjectPrototype$2 = $Object.prototype; // `Object.getPrototypeOf` method // https://tc39.es/ecma262/#sec-object.getprototypeof // eslint-disable-next-line es/no-object-getprototypeof -- safe var objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER$1 ? $Object.getPrototypeOf : function (O) { var object = toObject$6(O); if (hasOwn$d(object, IE_PROTO)) return object[IE_PROTO]; var constructor = object.constructor; if (isCallable$h(constructor) && object instanceof constructor) { return constructor.prototype; } return object instanceof $Object ? ObjectPrototype$2 : null; }; var fails$q = fails$J; var isCallable$g = isCallable$u; var isObject$e = isObject$o; var getPrototypeOf$1 = objectGetPrototypeOf; var defineBuiltIn$d = defineBuiltIn$i; var wellKnownSymbol$h = wellKnownSymbol$t; var ITERATOR$6 = wellKnownSymbol$h('iterator'); var BUGGY_SAFARI_ITERATORS$1 = false; // `%IteratorPrototype%` object // https://tc39.es/ecma262/#sec-%iteratorprototype%-object var IteratorPrototype$2, PrototypeOfArrayIteratorPrototype, arrayIterator; /* eslint-disable es/no-array-prototype-keys -- safe */ if ([].keys) { arrayIterator = [].keys(); // Safari 8 has buggy iterators w/o `next` if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS$1 = true; else { PrototypeOfArrayIteratorPrototype = getPrototypeOf$1(getPrototypeOf$1(arrayIterator)); if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype$2 = PrototypeOfArrayIteratorPrototype; } } var NEW_ITERATOR_PROTOTYPE = !isObject$e(IteratorPrototype$2) || fails$q(function () { var test = {}; // FF44- legacy iterators case return IteratorPrototype$2[ITERATOR$6].call(test) !== test; }); if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$2 = {}; // `%IteratorPrototype%[@@iterator]()` method // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator if (!isCallable$g(IteratorPrototype$2[ITERATOR$6])) { defineBuiltIn$d(IteratorPrototype$2, ITERATOR$6, function () { return this; }); } var iteratorsCore = { IteratorPrototype: IteratorPrototype$2, BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS$1 }; var defineProperty$a = objectDefineProperty.f; var hasOwn$c = hasOwnProperty_1; var wellKnownSymbol$g = wellKnownSymbol$t; var TO_STRING_TAG$1 = wellKnownSymbol$g('toStringTag'); var setToStringTag$7 = function (target, TAG, STATIC) { if (target && !STATIC) target = target.prototype; if (target && !hasOwn$c(target, TO_STRING_TAG$1)) { defineProperty$a(target, TO_STRING_TAG$1, { configurable: true, value: TAG }); } }; var IteratorPrototype$1 = iteratorsCore.IteratorPrototype; var create$4 = objectCreate; var createPropertyDescriptor$2 = createPropertyDescriptor$6; var setToStringTag$6 = setToStringTag$7; var Iterators$2 = iterators; var returnThis$1 = function () { return this; }; var iteratorCreateConstructor = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) { var TO_STRING_TAG = NAME + ' Iterator'; IteratorConstructor.prototype = create$4(IteratorPrototype$1, { next: createPropertyDescriptor$2(+!ENUMERABLE_NEXT, next) }); setToStringTag$6(IteratorConstructor, TO_STRING_TAG, false); Iterators$2[TO_STRING_TAG] = returnThis$1; return IteratorConstructor; }; var isCallable$f = isCallable$u; var $String$1 = String; var $TypeError$9 = TypeError; var aPossiblePrototype$1 = function (argument) { if (typeof argument == 'object' || isCallable$f(argument)) return argument; throw $TypeError$9("Can't set " + $String$1(argument) + ' as a prototype'); }; /* eslint-disable no-proto -- safe */ var uncurryThis$v = functionUncurryThis; var anObject$b = anObject$l; var aPossiblePrototype = aPossiblePrototype$1; // `Object.setPrototypeOf` method // https://tc39.es/ecma262/#sec-object.setprototypeof // Works with __proto__ only. Old v8 can't work with null proto objects. // eslint-disable-next-line es/no-object-setprototypeof -- safe var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () { var CORRECT_SETTER = false; var test = {}; var setter; try { // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe setter = uncurryThis$v(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set); setter(test, []); CORRECT_SETTER = test instanceof Array; } catch (error) { /* empty */ } return function setPrototypeOf(O, proto) { anObject$b(O); aPossiblePrototype(proto); if (CORRECT_SETTER) setter(O, proto); else O.__proto__ = proto; return O; }; }() : undefined); var $$O = _export; var call$f = functionCall; var FunctionName = functionName; var isCallable$e = isCallable$u; var createIteratorConstructor$1 = iteratorCreateConstructor; var getPrototypeOf = objectGetPrototypeOf; var setPrototypeOf$3 = objectSetPrototypeOf; var setToStringTag$5 = setToStringTag$7; var createNonEnumerableProperty$3 = createNonEnumerableProperty$7; var defineBuiltIn$c = defineBuiltIn$i; var wellKnownSymbol$f = wellKnownSymbol$t; var Iterators$1 = iterators; var IteratorsCore = iteratorsCore; var PROPER_FUNCTION_NAME$1 = FunctionName.PROPER; var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE; var IteratorPrototype = IteratorsCore.IteratorPrototype; var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS; var ITERATOR$5 = wellKnownSymbol$f('iterator'); var KEYS = 'keys'; var VALUES = 'values'; var ENTRIES = 'entries'; var returnThis = function () { return this; }; var iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) { createIteratorConstructor$1(IteratorConstructor, NAME, next); var getIterationMethod = function (KIND) { if (KIND === DEFAULT && defaultIterator) return defaultIterator; if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND]; switch (KIND) { case KEYS: return function keys() { return new IteratorConstructor(this, KIND); }; case VALUES: return function values() { return new IteratorConstructor(this, KIND); }; case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); }; } return function () { return new IteratorConstructor(this); }; }; var TO_STRING_TAG = NAME + ' Iterator'; var INCORRECT_VALUES_NAME = false; var IterablePrototype = Iterable.prototype; var nativeIterator = IterablePrototype[ITERATOR$5] || IterablePrototype['@@iterator'] || DEFAULT && IterablePrototype[DEFAULT]; var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT); var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator; var CurrentIteratorPrototype, methods, KEY; // fix native if (anyNativeIterator) { CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable())); if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) { if (getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) { if (setPrototypeOf$3) { setPrototypeOf$3(CurrentIteratorPrototype, IteratorPrototype); } else if (!isCallable$e(CurrentIteratorPrototype[ITERATOR$5])) { defineBuiltIn$c(CurrentIteratorPrototype, ITERATOR$5, returnThis); } } // Set @@toStringTag to native iterators setToStringTag$5(CurrentIteratorPrototype, TO_STRING_TAG, true); } } // fix Array.prototype.{ values, @@iterator }.name in V8 / FF if (PROPER_FUNCTION_NAME$1 && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) { if (CONFIGURABLE_FUNCTION_NAME) { createNonEnumerableProperty$3(IterablePrototype, 'name', VALUES); } else { INCORRECT_VALUES_NAME = true; defaultIterator = function values() { return call$f(nativeIterator, this); }; } } // export additional methods if (DEFAULT) { methods = { values: getIterationMethod(VALUES), keys: IS_SET ? defaultIterator : getIterationMethod(KEYS), entries: getIterationMethod(ENTRIES) }; if (FORCED) for (KEY in methods) { if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) { defineBuiltIn$c(IterablePrototype, KEY, methods[KEY]); } } else $$O({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods); } // define iterator if (IterablePrototype[ITERATOR$5] !== defaultIterator) { defineBuiltIn$c(IterablePrototype, ITERATOR$5, defaultIterator, { name: DEFAULT }); } Iterators$1[NAME] = defaultIterator; return methods; }; // `CreateIterResultObject` abstract operation // https://tc39.es/ecma262/#sec-createiterresultobject var createIterResultObject$3 = function (value, done) { return { value: value, done: done }; }; var charAt$7 = stringMultibyte.charAt; var toString$g = toString$j; var InternalStateModule$7 = internalState; var defineIterator$2 = iteratorDefine; var createIterResultObject$2 = createIterResultObject$3; var STRING_ITERATOR = 'String Iterator'; var setInternalState$7 = InternalStateModule$7.set; var getInternalState$2 = InternalStateModule$7.getterFor(STRING_ITERATOR); // `String.prototype[@@iterator]` method // https://tc39.es/ecma262/#sec-string.prototype-@@iterator defineIterator$2(String, 'String', function (iterated) { setInternalState$7(this, { type: STRING_ITERATOR, string: toString$g(iterated), index: 0 }); // `%StringIteratorPrototype%.next` method // https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next }, function next() { var state = getInternalState$2(this); var string = state.string; var index = state.index; var point; if (index >= string.length) return createIterResultObject$2(undefined, true); point = charAt$7(string, index); state.index += point.length; return createIterResultObject$2(point, false); }); var $$N = _export; var uncurryThis$u = functionUncurryThis; var IndexedObject$1 = indexedObject; var toIndexedObject$7 = toIndexedObject$d; var arrayMethodIsStrict$5 = arrayMethodIsStrict$8; var nativeJoin = uncurryThis$u([].join); var ES3_STRINGS = IndexedObject$1 != Object; var STRICT_METHOD$5 = arrayMethodIsStrict$5('join', ','); // `Array.prototype.join` method // https://tc39.es/ecma262/#sec-array.prototype.join $$N({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD$5 }, { join: function join(separator) { return nativeJoin(toIndexedObject$7(this), separator === undefined ? ',' : separator); } }); var $$M = _export; var $includes = arrayIncludes.includes; var fails$p = fails$J; var addToUnscopables$2 = addToUnscopables$4; // FF99+ bug var BROKEN_ON_SPARSE = fails$p(function () { return !Array(1).includes(); }); // `Array.prototype.includes` method // https://tc39.es/ecma262/#sec-array.prototype.includes $$M({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, { includes: function includes(el /* , fromIndex = 0 */) { return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); } }); // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables addToUnscopables$2('includes'); var isObject$d = isObject$o; var classof$5 = classofRaw$2; var wellKnownSymbol$e = wellKnownSymbol$t; var MATCH$2 = wellKnownSymbol$e('match'); // `IsRegExp` abstract operation // https://tc39.es/ecma262/#sec-isregexp var isRegexp = function (it) { var isRegExp; return isObject$d(it) && ((isRegExp = it[MATCH$2]) !== undefined ? !!isRegExp : classof$5(it) == 'RegExp'); }; var isRegExp$2 = isRegexp; var $TypeError$8 = TypeError; var notARegexp = function (it) { if (isRegExp$2(it)) { throw $TypeError$8("The method doesn't accept regular expressions"); } return it; }; var wellKnownSymbol$d = wellKnownSymbol$t; var MATCH$1 = wellKnownSymbol$d('match'); var correctIsRegexpLogic = function (METHOD_NAME) { var regexp = /./; try { '/./'[METHOD_NAME](regexp); } catch (error1) { try { regexp[MATCH$1] = false; return '/./'[METHOD_NAME](regexp); } catch (error2) { /* empty */ } } return false; }; var $$L = _export; var uncurryThis$t = functionUncurryThis; var notARegExp$1 = notARegexp; var requireObjectCoercible$9 = requireObjectCoercible$d; var toString$f = toString$j; var correctIsRegExpLogic$1 = correctIsRegexpLogic; var stringIndexOf$3 = uncurryThis$t(''.indexOf); // `String.prototype.includes` method // https://tc39.es/ecma262/#sec-string.prototype.includes $$L({ target: 'String', proto: true, forced: !correctIsRegExpLogic$1('includes') }, { includes: function includes(searchString /* , position = 0 */) { return !!~stringIndexOf$3( toString$f(requireObjectCoercible$9(this)), toString$f(notARegExp$1(searchString)), arguments.length > 1 ? arguments[1] : undefined ); } }); // a string of all valid unicode whitespaces var whitespaces$4 = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' + '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; var uncurryThis$s = functionUncurryThis; var requireObjectCoercible$8 = requireObjectCoercible$d; var toString$e = toString$j; var whitespaces$3 = whitespaces$4; var replace$8 = uncurryThis$s(''.replace); var whitespace = '[' + whitespaces$3 + ']'; var ltrim = RegExp('^' + whitespace + whitespace + '*'); var rtrim = RegExp(whitespace + whitespace + '*$'); // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation var createMethod$3 = function (TYPE) { return function ($this) { var string = toString$e(requireObjectCoercible$8($this)); if (TYPE & 1) string = replace$8(string, ltrim, ''); if (TYPE & 2) string = replace$8(string, rtrim, ''); return string; }; }; var stringTrim = { // `String.prototype.{ trimLeft, trimStart }` methods // https://tc39.es/ecma262/#sec-string.prototype.trimstart start: createMethod$3(1), // `String.prototype.{ trimRight, trimEnd }` methods // https://tc39.es/ecma262/#sec-string.prototype.trimend end: createMethod$3(2), // `String.prototype.trim` method // https://tc39.es/ecma262/#sec-string.prototype.trim trim: createMethod$3(3) }; var global$n = global$B; var fails$o = fails$J; var uncurryThis$r = functionUncurryThis; var toString$d = toString$j; var trim$2 = stringTrim.trim; var whitespaces$2 = whitespaces$4; var $parseInt$1 = global$n.parseInt; var Symbol$2 = global$n.Symbol; var ITERATOR$4 = Symbol$2 && Symbol$2.iterator; var hex = /^[+-]?0x/i; var exec$4 = uncurryThis$r(hex.exec); var FORCED$7 = $parseInt$1(whitespaces$2 + '08') !== 8 || $parseInt$1(whitespaces$2 + '0x16') !== 22 // MS Edge 18- broken with boxed symbols || (ITERATOR$4 && !fails$o(function () { $parseInt$1(Object(ITERATOR$4)); })); // `parseInt` method // https://tc39.es/ecma262/#sec-parseint-string-radix var numberParseInt = FORCED$7 ? function parseInt(string, radix) { var S = trim$2(toString$d(string)); return $parseInt$1(S, (radix >>> 0) || (exec$4(hex, S) ? 16 : 10)); } : $parseInt$1; var $$K = _export; var $parseInt = numberParseInt; // `parseInt` method // https://tc39.es/ecma262/#sec-parseint-string-radix $$K({ global: true, forced: parseInt != $parseInt }, { parseInt: $parseInt }); var toIndexedObject$6 = toIndexedObject$d; var addToUnscopables$1 = addToUnscopables$4; var Iterators = iterators; var InternalStateModule$6 = internalState; var defineProperty$9 = objectDefineProperty.f; var defineIterator$1 = iteratorDefine; var createIterResultObject$1 = createIterResultObject$3; var DESCRIPTORS$f = descriptors; var ARRAY_ITERATOR = 'Array Iterator'; var setInternalState$6 = InternalStateModule$6.set; var getInternalState$1 = InternalStateModule$6.getterFor(ARRAY_ITERATOR); // `Array.prototype.entries` method // https://tc39.es/ecma262/#sec-array.prototype.entries // `Array.prototype.keys` method // https://tc39.es/ecma262/#sec-array.prototype.keys // `Array.prototype.values` method // https://tc39.es/ecma262/#sec-array.prototype.values // `Array.prototype[@@iterator]` method // https://tc39.es/ecma262/#sec-array.prototype-@@iterator // `CreateArrayIterator` internal method // https://tc39.es/ecma262/#sec-createarrayiterator var es_array_iterator = defineIterator$1(Array, 'Array', function (iterated, kind) { setInternalState$6(this, { type: ARRAY_ITERATOR, target: toIndexedObject$6(iterated), // target index: 0, // next index kind: kind // kind }); // `%ArrayIteratorPrototype%.next` method // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next }, function () { var state = getInternalState$1(this); var target = state.target; var kind = state.kind; var index = state.index++; if (!target || index >= target.length) { state.target = undefined; return createIterResultObject$1(undefined, true); } if (kind == 'keys') return createIterResultObject$1(index, false); if (kind == 'values') return createIterResultObject$1(target[index], false); return createIterResultObject$1([index, target[index]], false); }, 'values'); // argumentsList[@@iterator] is %ArrayProto_values% // https://tc39.es/ecma262/#sec-createunmappedargumentsobject // https://tc39.es/ecma262/#sec-createmappedargumentsobject var values = Iterators.Arguments = Iterators.Array; // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables addToUnscopables$1('keys'); addToUnscopables$1('values'); addToUnscopables$1('entries'); // V8 ~ Chrome 45- bug if (DESCRIPTORS$f && values.name !== 'values') try { defineProperty$9(values, 'name', { value: 'values' }); } catch (error) { /* empty */ } var global$m = global$B; var DOMIterables = domIterables; var DOMTokenListPrototype = domTokenListPrototype; var ArrayIteratorMethods = es_array_iterator; var createNonEnumerableProperty$2 = createNonEnumerableProperty$7; var wellKnownSymbol$c = wellKnownSymbol$t; var ITERATOR$3 = wellKnownSymbol$c('iterator'); var TO_STRING_TAG = wellKnownSymbol$c('toStringTag'); var ArrayValues = ArrayIteratorMethods.values; var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) { if (CollectionPrototype) { // some Chrome versions have non-configurable methods on DOMTokenList if (CollectionPrototype[ITERATOR$3] !== ArrayValues) try { createNonEnumerableProperty$2(CollectionPrototype, ITERATOR$3, ArrayValues); } catch (error) { CollectionPrototype[ITERATOR$3] = ArrayValues; } if (!CollectionPrototype[TO_STRING_TAG]) { createNonEnumerableProperty$2(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME); } if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) { // some Chrome versions have non-configurable methods on DOMTokenList if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) try { createNonEnumerableProperty$2(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]); } catch (error) { CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME]; } } } }; for (var COLLECTION_NAME in DOMIterables) { handlePrototype(global$m[COLLECTION_NAME] && global$m[COLLECTION_NAME].prototype, COLLECTION_NAME); } handlePrototype(DOMTokenListPrototype, 'DOMTokenList'); var PROPER_FUNCTION_NAME = functionName.PROPER; var fails$n = fails$J; var whitespaces$1 = whitespaces$4; var non = '\u200B\u0085\u180E'; // check that a method works with the correct list // of whitespaces and has a correct name var stringTrimForced = function (METHOD_NAME) { return fails$n(function () { return !!whitespaces$1[METHOD_NAME]() || non[METHOD_NAME]() !== non || (PROPER_FUNCTION_NAME && whitespaces$1[METHOD_NAME].name !== METHOD_NAME); }); }; var $$J = _export; var $trim = stringTrim.trim; var forcedStringTrimMethod = stringTrimForced; // `String.prototype.trim` method // https://tc39.es/ecma262/#sec-string.prototype.trim $$J({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, { trim: function trim() { return $trim(this); } }); var selectors = ['input:not([disabled])', 'select:not([disabled])', 'textarea:not([disabled])', 'a[href]', 'button:not([disabled])', 'audio[controls]', 'video[controls]', '[contenteditable]:not([contenteditable="false"])']; var tabSelectors = [].concat(selectors, ['[tabindex]:not([tabindex^="-"]):not([disabled])']); var focusSelectors = [].concat(selectors, ['[tabindex]:not([disabled])']); var HelpersUtil = { /** * Returns array of tabbable elements * @param {HTMLElement} node container to search, default is document * @returns {Array} returns elements that can be tabbed to using the keyboard */ getTabbableElements: function getTabbableElements(node) { if (node === void 0) { node = document; } return Array.from(node.querySelectorAll(tabSelectors.join(', '))); }, /** * Checks if a node is a tabbable element * @param {HTMLElement} node the node to compare * @returns {boolean} returns true or false depending on whether the node is considered tabbable or not */ isElementTabbable: function isElementTabbable(node) { return node.matches(tabSelectors.join(', ')); }, getUid: function getUid() { // Convert random number to base 36 (numbers + letters), // and grab the first 9 characters after the decimal. return Math.random().toString(36).slice(2, 9); }, /** * Returns array of focusable elements * @param {HTMLElement} node container to search, default is document * @returns {Array} returns elements that can receive focus */ getFocusableElements: function getFocusableElements(node) { if (node === void 0) { node = document; } return Array.from(node.querySelectorAll(focusSelectors.join(', '))); }, /** * Returns outer height of element, includes element offsetHeight * @param {HTMLElement} node container to search * @param {object} options * @param {string[]} options.cssSelectors array of css properties * @example * const options = { cssSelectors: ['margin', 'padding'] }; * const options = { cssSelectors: ['marginTop'] }; * @returns {number} returns height value */ getElementOuterHeight: function getElementOuterHeight(node, options) { if (options === void 0) { options = null; } var computedNodeStyles = getComputedStyle(node); if (!options) { return computedNodeStyles.offsetHeight; } var outerHeight = node.offsetHeight; options.cssSelectors.forEach(function (selector) { // if no values are specified, calculate spacing for the top and bottom if (!selector.toLowerCase().includes('top') && !selector.toLowerCase().includes('bottom')) { outerHeight += parseInt(computedNodeStyles[selector + 'Top'], 10) + parseInt(computedNodeStyles[selector + 'Bottom'], 10); } else if (selector.values.length > 0) { outerHeight += parseInt(computedNodeStyles[selector], 10); } }); return outerHeight; }, /** * Returns outer width of element, includes element offsetWidth * @param {HTMLElement} node container to search * @param {object} options * @param {string[]} options.cssSelectors array of css properties * @example * const options = { cssSelectors: ['margin', 'padding'] }; * const options = { cssSelectors: ['marginLeft'] }; * @returns {number} returns width value */ getElementOuterWidth: function getElementOuterWidth(node, options) { if (options === void 0) { options = null; } var computedNodeStyles = getComputedStyle(node); if (!options) { return computedNodeStyles.offsetWidth; } var outerWidth = node.offsetWidth; options.cssSelectors.forEach(function (selector) { // if no values are specifed, calculate spacing for the left and right if (!selector.toLowerCase().includes('left') && !selector.toLowerCase().includes('right')) { outerWidth += parseInt(computedNodeStyles[selector + 'Left'], 10) + parseInt(computedNodeStyles[selector + 'Right'], 10); } else if (selector.values.length > 0) { outerWidth += parseInt(computedNodeStyles[selector], 10); } }); return outerWidth; }, /** * Returns the value of the data-target attribute or null * @param {HTMLElement} element element with the data-target attribute * @returns {HTMLElement} returns the value of the data-target attribute or null */ getSelectorFromElement: function getSelectorFromElement(element) { try { var selector = element.getAttribute('data-target'); if (!selector || selector === '#') { var hrefAttr = element.getAttribute('href'); selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : ''; } return selector; } catch (_unused) { return null; } }, /** * Gets the offset height of the element * @param {HTMLElement} element the element * @returns {number} returns the offset height */ reflow: function reflow(element) { return element.offsetHeight; }, /** * Gets the full height of the document * May be a little dated but this seems to be an established approach * https://javascript.info/size-and-scroll-window#width-height-of-the-document * @returns {number} the full height of the document */ getDocumentHeight: function getDocumentHeight() { return Math.max(document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight, document.body.clientHeight, document.documentElement.clientHeight); } }; // TODO: Remove from `core-js@4` since it's moved to entry points var uncurryThis$q = functionUncurryThis; var defineBuiltIn$b = defineBuiltIn$i; var regexpExec$1 = regexpExec$2; var fails$m = fails$J; var wellKnownSymbol$b = wellKnownSymbol$t; var createNonEnumerableProperty$1 = createNonEnumerableProperty$7; var SPECIES$3 = wellKnownSymbol$b('species'); var RegExpPrototype$1 = RegExp.prototype; var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) { var SYMBOL = wellKnownSymbol$b(KEY); var DELEGATES_TO_SYMBOL = !fails$m(function () { // String methods call symbol-named RegEp methods var O = {}; O[SYMBOL] = function () { return 7; }; return ''[KEY](O) != 7; }); var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails$m(function () { // Symbol-named RegExp methods call .exec var execCalled = false; var re = /a/; if (KEY === 'split') { // We can't use real regex here since it causes deoptimization // and serious performance degradation in V8 // https://github.com/zloirock/core-js/issues/306 re = {}; // RegExp[@@split] doesn't call the regex's exec method, but first creates // a new one. We need to return the patched regex when creating the new one. re.constructor = {}; re.constructor[SPECIES$3] = function () { return re; }; re.flags = ''; re[SYMBOL] = /./[SYMBOL]; } re.exec = function () { execCalled = true; return null; }; re[SYMBOL](''); return !execCalled; }); if ( !DELEGATES_TO_SYMBOL || !DELEGATES_TO_EXEC || FORCED ) { var uncurriedNativeRegExpMethod = uncurryThis$q(/./[SYMBOL]); var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) { var uncurriedNativeMethod = uncurryThis$q(nativeMethod); var $exec = regexp.exec; if ($exec === regexpExec$1 || $exec === RegExpPrototype$1.exec) { if (DELEGATES_TO_SYMBOL && !forceStringMethod) { // The native String method already delegates to @@method (this // polyfilled function), leasing to infinite recursion. // We avoid it by directly calling the native @@method method. return { done: true, value: uncurriedNativeRegExpMethod(regexp, str, arg2) }; } return { done: true, value: uncurriedNativeMethod(str, regexp, arg2) }; } return { done: false }; }); defineBuiltIn$b(String.prototype, KEY, methods[0]); defineBuiltIn$b(RegExpPrototype$1, SYMBOL, methods[1]); } if (SHAM) createNonEnumerableProperty$1(RegExpPrototype$1[SYMBOL], 'sham', true); }; var charAt$6 = stringMultibyte.charAt; // `AdvanceStringIndex` abstract operation // https://tc39.es/ecma262/#sec-advancestringindex var advanceStringIndex$2 = function (S, index, unicode) { return index + (unicode ? charAt$6(S, index).length : 1); }; var call$e = functionCall; var anObject$a = anObject$l; var isCallable$d = isCallable$u; var classof$4 = classofRaw$2; var regexpExec = regexpExec$2; var $TypeError$7 = TypeError; // `RegExpExec` abstract operation // https://tc39.es/ecma262/#sec-regexpexec var regexpExecAbstract = function (R, S) { var exec = R.exec; if (isCallable$d(exec)) { var result = call$e(exec, R, S); if (result !== null) anObject$a(result); return result; } if (classof$4(R) === 'RegExp') return call$e(regexpExec, R, S); throw $TypeError$7('RegExp#exec called on incompatible receiver'); }; var call$d = functionCall; var fixRegExpWellKnownSymbolLogic$2 = fixRegexpWellKnownSymbolLogic; var anObject$9 = anObject$l; var isNullOrUndefined$7 = isNullOrUndefined$b; var toLength$3 = toLength$5; var toString$c = toString$j; var requireObjectCoercible$7 = requireObjectCoercible$d; var getMethod$3 = getMethod$7; var advanceStringIndex$1 = advanceStringIndex$2; var regExpExec$3 = regexpExecAbstract; // @@match logic fixRegExpWellKnownSymbolLogic$2('match', function (MATCH, nativeMatch, maybeCallNative) { return [ // `String.prototype.match` method // https://tc39.es/ecma262/#sec-string.prototype.match function match(regexp) { var O = requireObjectCoercible$7(this); var matcher = isNullOrUndefined$7(regexp) ? undefined : getMethod$3(regexp, MATCH); return matcher ? call$d(matcher, regexp, O) : new RegExp(regexp)[MATCH](toString$c(O)); }, // `RegExp.prototype[@@match]` method // https://tc39.es/ecma262/#sec-regexp.prototype-@@match function (string) { var rx = anObject$9(this); var S = toString$c(string); var res = maybeCallNative(nativeMatch, rx, S); if (res.done) return res.value; if (!rx.global) return regExpExec$3(rx, S); var fullUnicode = rx.unicode; rx.lastIndex = 0; var A = []; var n = 0; var result; while ((result = regExpExec$3(rx, S)) !== null) { var matchStr = toString$c(result[0]); A[n] = matchStr; if (matchStr === '') rx.lastIndex = advanceStringIndex$1(S, toLength$3(rx.lastIndex), fullUnicode); n++; } return n === 0 ? null : A; } ]; }); var ColorUtil = { /** * Calculates the YIQ of the color * @param {object} rgb The RGB notation of the color * @returns {number} */ getYiq: function getYiq(_ref) { var r = _ref.r, g = _ref.g, b = _ref.b; return (r * 299 + g * 587 + b * 114) / 1000; }, /** * Gets the RGB object notation for a string * @param {string} str a string representing a css rgb value * @returns {object} an object for rgb notation */ getRGB: function getRGB(str) { var match = str.match(/rgba?\((\d{1,3}), ?(\d{1,3}), ?(\d{1,3})\)?(?:, ?(\d\.\d?)\))?/); return match ? { r: match[1], g: match[2], b: match[3] } : {}; } }; // https://keycode.info/table-of-all-keycodes var KeyboardUtil = { keyCodes: { ARROW_DOWN: 40, ARROW_LEFT: 37, ARROW_RIGHT: 39, ARROW_UP: 38, BACKSPACE: 8, CLEAR: 12, END: 35, ENTER: 13, ESC: 27, HOME: 36, PAGE_DOWN: 34, PAGE_UP: 33, SPACE: 32, TAB: 9 }, // https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values keys: { ARROW_DOWN: 'ArrowDown', ARROW_LEFT: 'ArrowLeft', ARROW_RIGHT: 'ArrowRight', ARROW_UP: 'ArrowUp', BACKSPACE: 'Backspace', CLEAR: 'Clear', END: 'End', ENTER: 'Enter', ESC: 'Escape', HOME: 'Home', PAGE_DOWN: 'PageDown', PAGE_UP: 'PageUp', SPACE: ' ', TAB: 'Tab' }, getKeyCode: function getKeyCode(e) { return e.which || e.keyCode || 0; } }; var NATIVE_BIND = functionBindNative; var FunctionPrototype$1 = Function.prototype; var apply$6 = FunctionPrototype$1.apply; var call$c = FunctionPrototype$1.call; // eslint-disable-next-line es/no-reflect -- safe var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call$c.bind(apply$6) : function () { return call$c.apply(apply$6, arguments); }); var uncurryThis$p = functionUncurryThis; var toObject$5 = toObject$d; var floor$5 = Math.floor; var charAt$5 = uncurryThis$p(''.charAt); var replace$7 = uncurryThis$p(''.replace); var stringSlice$9 = uncurryThis$p(''.slice); var SUBSTITUTION_SYMBOLS = /$([$&'`]|\d{1,2}|<[^>]*>)/g; var SUBSTITUTION_SYMBOLS_NO_NAMED = /$([$&'`]|\d{1,2})/g; // `GetSubstitution` abstract operation // https://tc39.es/ecma262/#sec-getsubstitution var getSubstitution$2 = function (matched, str, position, captures, namedCaptures, replacement) { var tailPos = position + matched.length; var m = captures.length; var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED; if (namedCaptures !== undefined) { namedCaptures = toObject$5(namedCaptures); symbols = SUBSTITUTION_SYMBOLS; } return replace$7(replacement, symbols, function (match, ch) { var capture; switch (charAt$5(ch, 0)) { case '$': return '$'; case '&': return matched; case '`': return stringSlice$9(str, 0, position); case "'": return stringSlice$9(str, tailPos); case '<': capture = namedCaptures[stringSlice$9(ch, 1, -1)]; break; default: // \d\d? var n = +ch; if (n === 0) return match; if (n > m) { var f = floor$5(n / 10); if (f === 0) return match; if (f <= m) return captures[f - 1] === undefined ? charAt$5(ch, 1) : captures[f - 1] + charAt$5(ch, 1); return match; } capture = captures[n - 1]; } return capture === undefined ? '' : capture; }); }; var apply$5 = functionApply; var call$b = functionCall; var uncurryThis$o = functionUncurryThis; var fixRegExpWellKnownSymbolLogic$1 = fixRegexpWellKnownSymbolLogic; var fails$l = fails$J; var anObject$8 = anObject$l; var isCallable$c = isCallable$u; var isNullOrUndefined$6 = isNullOrUndefined$b; var toIntegerOrInfinity$3 = toIntegerOrInfinity$8; var toLength$2 = toLength$5; var toString$b = toString$j; var requireObjectCoercible$6 = requireObjectCoercible$d; var advanceStringIndex = advanceStringIndex$2; var getMethod$2 = getMethod$7; var getSubstitution$1 = getSubstitution$2; var regExpExec$2 = regexpExecAbstract; var wellKnownSymbol$a = wellKnownSymbol$t; var REPLACE$1 = wellKnownSymbol$a('replace'); var max$2 = Math.max; var min$2 = Math.min; var concat = uncurryThis$o([].concat); var push$7 = uncurryThis$o([].push); var stringIndexOf$2 = uncurryThis$o(''.indexOf); var stringSlice$8 = uncurryThis$o(''.slice); var maybeToString = function (it) { return it === undefined ? it : String(it); }; // IE <= 11 replaces $0 with the whole match, as if it was $& // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0 var REPLACE_KEEPS_$0 = (function () { // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing return 'a'.replace(/./, '$0') === '$0'; })(); // Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () { if (/./[REPLACE$1]) { return /./[REPLACE$1]('a', '$0') === ''; } return false; })(); var REPLACE_SUPPORTS_NAMED_GROUPS = !fails$l(function () { var re = /./; re.exec = function () { var result = []; result.groups = { a: '7' }; return result; }; // eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive return ''.replace(re, '$') !== '7'; }); // @@replace logic fixRegExpWellKnownSymbolLogic$1('replace', function (_, nativeReplace, maybeCallNative) { var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0'; return [ // `String.prototype.replace` method // https://tc39.es/ecma262/#sec-string.prototype.replace function replace(searchValue, replaceValue) { var O = requireObjectCoercible$6(this); var replacer = isNullOrUndefined$6(searchValue) ? undefined : getMethod$2(searchValue, REPLACE$1); return replacer ? call$b(replacer, searchValue, O, replaceValue) : call$b(nativeReplace, toString$b(O), searchValue, replaceValue); }, // `RegExp.prototype[@@replace]` method // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace function (string, replaceValue) { var rx = anObject$8(this); var S = toString$b(string); if ( typeof replaceValue == 'string' && stringIndexOf$2(replaceValue, UNSAFE_SUBSTITUTE) === -1 && stringIndexOf$2(replaceValue, '$<') === -1 ) { var res = maybeCallNative(nativeReplace, rx, S, replaceValue); if (res.done) return res.value; } var functionalReplace = isCallable$c(replaceValue); if (!functionalReplace) replaceValue = toString$b(replaceValue); var global = rx.global; if (global) { var fullUnicode = rx.unicode; rx.lastIndex = 0; } var results = []; while (true) { var result = regExpExec$2(rx, S); if (result === null) break; push$7(results, result); if (!global) break; var matchStr = toString$b(result[0]); if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength$2(rx.lastIndex), fullUnicode); } var accumulatedResult = ''; var nextSourcePosition = 0; for (var i = 0; i < results.length; i++) { result = results[i]; var matched = toString$b(result[0]); var position = max$2(min$2(toIntegerOrInfinity$3(result.index), S.length), 0); var captures = []; // NOTE: This is equivalent to // captures = result.slice(1).map(maybeToString) // but for some reason `nativeSlice.call(result, 1, result.length)` (called in // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it. for (var j = 1; j < result.length; j++) push$7(captures, maybeToString(result[j])); var namedCaptures = result.groups; if (functionalReplace) { var replacerArgs = concat([matched], captures, position, S); if (namedCaptures !== undefined) push$7(replacerArgs, namedCaptures); var replacement = toString$b(apply$5(replaceValue, undefined, replacerArgs)); } else { replacement = getSubstitution$1(matched, S, position, captures, namedCaptures, replaceValue); } if (position >= nextSourcePosition) { accumulatedResult += stringSlice$8(S, nextSourcePosition, position) + replacement; nextSourcePosition = position + matched.length; } } return accumulatedResult + stringSlice$8(S, nextSourcePosition); } ]; }, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE); var StringUtil = { /** * Interpolate a string. * @param {string} template - The template string to interpolate, with keys in the format %{key}. * @param {object} data - An object containing the keys and values to replace in the template. * @returns {string} - The interpolated string. */ interpolateString: function interpolateString(template, data) { return template.replace(/%{(\w+)}/g, function (match, key) { if (Object.prototype.hasOwnProperty.call(data, key)) { return data[key]; } // %{key} not found, show a warning in the console and return an empty string // eslint-disable-next-line no-console console.warn("Template error, %{" + key + "} not found:", template); return ''; }); } }; var EventName$C = { ON_REMOVE: 'onRemove' }; var focusControls = []; /** * Class representing Focus Controls. * Solve for Firefox bug where following on-page anchor links loses focus: * https://bugzilla.mozilla.org/show_bug.cgi?id=308064 * https://bugzilla.mozilla.org/show_bug.cgi?id=277178 */ var FocusControls = /*#__PURE__*/function () { /** * Create a FocusControls instance * @param {Object} opts - The focus control options. * @param {HTMLElement} opts.el - The anchor element node, must have href attribute with fragment identifier. */ function FocusControls(opts) { var _this = this; this.el = opts.el; this.target = document.querySelector(this.el.getAttribute('href')); this.events = [{ el: this.el, type: 'click', handler: function handler(e) { _this.onClick(e); } }]; // Add event handlers. InitializationUtil.addEvents(this.events); focusControls.push(this); } /** * Click event. * @param {Event} e - The event object. */ var _proto = FocusControls.prototype; _proto.onClick = function onClick(e) { e.preventDefault(); // removes focus if target element is already focused (for voiceover on mobile) if (document.activeElement === this.target) { document.activeElement.blur(); } this.target.focus(); this.target.scrollIntoView(); } /** * Remove the focus controls and events. */; _proto.remove = function remove() { // Remove event handlers InitializationUtil.removeEvents(this.events); // Remove this focus controls reference from array of instances var index = focusControls.indexOf(this); focusControls.splice(index, 1); // Create and dispatch custom event this[EventName$C.ON_REMOVE] = new CustomEvent(EventName$C.ON_REMOVE, { bubbles: true }); this.el.dispatchEvent(this[EventName$C.ON_REMOVE]); } /** * Get an array of focus controls instances. * @returns {Object[]} Array of focus controls instances. */; FocusControls.getInstances = function getInstances() { return focusControls; }; return FocusControls; }(); var global$l = global$B; var fails$k = fails$J; var uncurryThis$n = functionUncurryThis; var toString$a = toString$j; var trim$1 = stringTrim.trim; var whitespaces = whitespaces$4; var charAt$4 = uncurryThis$n(''.charAt); var $parseFloat$1 = global$l.parseFloat; var Symbol$1 = global$l.Symbol; var ITERATOR$2 = Symbol$1 && Symbol$1.iterator; var FORCED$6 = 1 / $parseFloat$1(whitespaces + '-0') !== -Infinity // MS Edge 18- broken with boxed symbols || (ITERATOR$2 && !fails$k(function () { $parseFloat$1(Object(ITERATOR$2)); })); // `parseFloat` method // https://tc39.es/ecma262/#sec-parsefloat-string var numberParseFloat = FORCED$6 ? function parseFloat(string) { var trimmedString = trim$1(toString$a(string)); var result = $parseFloat$1(trimmedString); return result === 0 && charAt$4(trimmedString, 0) == '-' ? -0 : result; } : $parseFloat$1; var $$I = _export; var $parseFloat = numberParseFloat; // `parseFloat` method // https://tc39.es/ecma262/#sec-parsefloat-string $$I({ global: true, forced: parseFloat != $parseFloat }, { parseFloat: $parseFloat }); var $TypeError$6 = TypeError; var validateArgumentsLength$4 = function (passed, required) { if (passed < required) throw $TypeError$6('Not enough arguments'); return passed; }; var global$k = global$B; var apply$4 = functionApply; var isCallable$b = isCallable$u; var userAgent$5 = engineUserAgent; var arraySlice$6 = arraySlice$8; var validateArgumentsLength$3 = validateArgumentsLength$4; var MSIE = /MSIE .\./.test(userAgent$5); // <- dirty ie9- check var Function$2 = global$k.Function; var wrap$1 = function (scheduler) { return MSIE ? function (handler, timeout /* , ...arguments */) { var boundArgs = validateArgumentsLength$3(arguments.length, 1) > 2; var fn = isCallable$b(handler) ? handler : Function$2(handler); var args = boundArgs ? arraySlice$6(arguments, 2) : undefined; return scheduler(boundArgs ? function () { apply$4(fn, this, args); } : fn, timeout); } : scheduler; }; // ie9- setTimeout & setInterval additional parameters fix // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timers var schedulersFix = { // `setTimeout` method // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-settimeout setTimeout: wrap$1(global$k.setTimeout), // `setInterval` method // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval setInterval: wrap$1(global$k.setInterval) }; var $$H = _export; var global$j = global$B; var setInterval$1 = schedulersFix.setInterval; // ie9- setInterval additional parameters fix // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval $$H({ global: true, bind: true, forced: global$j.setInterval !== setInterval$1 }, { setInterval: setInterval$1 }); var $$G = _export; var global$i = global$B; var setTimeout$1 = schedulersFix.setTimeout; // ie9- setTimeout additional parameters fix // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-settimeout $$G({ global: true, bind: true, forced: global$i.setTimeout !== setTimeout$1 }, { setTimeout: setTimeout$1 }); var TRANSITION_END = 'transitionend'; /** * Gets the transition duration from an element's styles * @param {HTMLElement} element - element * @returns {number} - transition duration in milliseconds */ var getTransitionDurationFromElement = function getTransitionDurationFromElement(element) { var MILLISECONDS_MULTIPLIER = 1000; if (!element) { return 0; } // Get transition-duration of the element var transitionDuration = getComputedStyle(element)['transition-duration']; var transitionDelay = getComputedStyle(element)['transition-delay']; var floatTransitionDuration = parseFloat(transitionDuration); var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found if (!floatTransitionDuration && !floatTransitionDelay) { return 0; } // If multiple durations are defined, take the first transitionDuration = transitionDuration.split(',')[0]; transitionDelay = transitionDelay.split(',')[0]; return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER; }; /** * Dispatches a transition-end event. * @param {HTMLElement} element - element on which to dispatch event */ var triggerTransitionEnd = function triggerTransitionEnd(element) { element.dispatchEvent(new Event(TRANSITION_END)); }; /** * Ensures transition-end is triggered on an element. * @param {HTMLElement} element - element on which transition occurs * @param {number} duration - transition duration in milliseconds */ var emulateTransitionEnd = function emulateTransitionEnd(element, duration) { if (duration === void 0) { duration = 0; } var called = false; var durationPadding = 5; var emulatedDuration = duration + durationPadding; function listener() { called = true; element.removeEventListener(TRANSITION_END, listener); } element.addEventListener(TRANSITION_END, listener); setTimeout(function () { if (!called) { triggerTransitionEnd(element); } }, emulatedDuration); }; var TransitionUtil = { TRANSITION_END: TRANSITION_END, getTransitionDurationFromElement: getTransitionDurationFromElement, triggerTransitionEnd: triggerTransitionEnd, emulateTransitionEnd: emulateTransitionEnd }; var Util$1 = Object.assign({}, DetectionUtil, HelpersUtil, InitializationUtil, ColorUtil, KeyboardUtil, StringUtil, { FocusControls: FocusControls }, TransitionUtil); // TODO: Remove from `core-js@4` var $$F = _export; var uncurryThis$m = functionUncurryThis; var $Date = Date; var thisTimeValue$1 = uncurryThis$m($Date.prototype.getTime); // `Date.now` method // https://tc39.es/ecma262/#sec-date.now $$F({ target: 'Date', stat: true }, { now: function now() { return thisTimeValue$1(new $Date()); } }); /* eslint-disable no-undefined,no-param-reassign,no-shadow */ /** * Throttle execution of a function. Especially useful for rate limiting * execution of handlers on events like resize and scroll. * * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) * are most useful. * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, * as-is, to `callback` when the throttled-function is executed. * @param {object} [options] - An object to configure options. * @param {boolean} [options.noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds * while the throttled-function is being called. If noTrailing is false or unspecified, callback will be executed * one final time after the last throttled-function call. (After the throttled-function has not been called for * `delay` milliseconds, the internal counter is reset). * @param {boolean} [options.noLeading] - Optional, defaults to false. If noLeading is false, the first throttled-function call will execute callback * immediately. If noLeading is true, the first the callback execution will be skipped. It should be noted that * callback will never executed if both noLeading = true and noTrailing = true. * @param {boolean} [options.debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is * false (at end), schedule `callback` to execute after `delay` ms. * * @returns {Function} A new, throttled, function. */ function throttle(delay, callback, options) { var _ref = options || {}, _ref$noTrailing = _ref.noTrailing, noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing, _ref$noLeading = _ref.noLeading, noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading, _ref$debounceMode = _ref.debounceMode, debounceMode = _ref$debounceMode === void 0 ? undefined : _ref$debounceMode; /* * After wrapper has stopped being called, this timeout ensures that * `callback` is executed at the proper times in `throttle` and `end` * debounce modes. */ var timeoutID; var cancelled = false; // Keep track of the last time `callback` was executed. var lastExec = 0; // Function to clear existing timeout function clearExistingTimeout() { if (timeoutID) { clearTimeout(timeoutID); } } // Function to cancel next exec function cancel(options) { var _ref2 = options || {}, _ref2$upcomingOnly = _ref2.upcomingOnly, upcomingOnly = _ref2$upcomingOnly === void 0 ? false : _ref2$upcomingOnly; clearExistingTimeout(); cancelled = !upcomingOnly; } /* * The `wrapper` function encapsulates all of the throttling / debouncing * functionality and when executed will limit the rate at which `callback` * is executed. */ function wrapper() { for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) { arguments_[_key] = arguments[_key]; } var self = this; var elapsed = Date.now() - lastExec; if (cancelled) { return; } // Execute `callback` and update the `lastExec` timestamp. function exec() { lastExec = Date.now(); callback.apply(self, arguments_); } /* * If `debounceMode` is true (at begin) this is used to clear the flag * to allow future `callback` executions. */ function clear() { timeoutID = undefined; } if (!noLeading && debounceMode && !timeoutID) { /* * Since `wrapper` is being called for the first time and * `debounceMode` is true (at begin), execute `callback` * and noLeading != true. */ exec(); } clearExistingTimeout(); if (debounceMode === undefined && elapsed > delay) { if (noLeading) { /* * In throttle mode with noLeading, if `delay` time has * been exceeded, update `lastExec` and schedule `callback` * to execute after `delay` ms. */ lastExec = Date.now(); if (!noTrailing) { timeoutID = setTimeout(debounceMode ? clear : exec, delay); } } else { /* * In throttle mode without noLeading, if `delay` time has been exceeded, execute * `callback`. */ exec(); } } else if (noTrailing !== true) { /* * In trailing throttle mode, since `delay` time has not been * exceeded, schedule `callback` to execute `delay` ms after most * recent execution. * * If `debounceMode` is true (at begin), schedule `clear` to execute * after `delay` ms. * * If `debounceMode` is false (at end), schedule `callback` to * execute after `delay` ms. */ timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay); } } wrapper.cancel = cancel; // Return the wrapper function. return wrapper; } /* eslint-disable no-undefined */ /** * Debounce execution of a function. Debouncing, unlike throttling, * guarantees that a function is only executed a single time, either at the * very beginning of a series of calls, or at the very end. * * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful. * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is, * to `callback` when the debounced-function is executed. * @param {object} [options] - An object to configure options. * @param {boolean} [options.atBegin] - Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds * after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call. * (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset). * * @returns {Function} A new, debounced function. */ function debounce(delay, callback, options) { var _ref = options || {}, _ref$atBegin = _ref.atBegin, atBegin = _ref$atBegin === void 0 ? false : _ref$atBegin; return throttle(delay, callback, { debounceMode: atBegin !== false }); } var instances$s = []; var Selector$B = { DATA_MOUNT: '[data-mount="accordion-extension"]', COLLAPSE_BUTTON: '[data-mount="collapse"]' }; var EventName$B = { ON_REMOVE: 'onRemove' }; var ClassName$r = { LIST_ITEM_SHOW: 'accordion-list-show', ENABLE_COLLAPSE_MOBILE: 'enable-collapse-mobile', COLLAPSE_SHOW: 'show', COLLAPSED: 'collapsed', COLLAPSE: 'collapse' }; function _click(collapse) { this.el.querySelectorAll('li').forEach(function (listItem) { listItem.classList.remove(ClassName$r.LIST_ITEM_SHOW); }); // expanding - add classname to active trigger's list item if (!collapse.classList.contains(ClassName$r.COLLAPSED)) { collapse.closest('li').classList.add(ClassName$r.LIST_ITEM_SHOW); var collapseEle = collapse.closest('li').querySelector(ClassName$r.COLLAPSE); if (collapseEle) { collapseEle.classList.add(ClassName$r.COLLAPSE_SHOW); } } } function _enableMultiSelectMobile() { var _this = this; if (this.disableMobileGroupManagement) { var collapseInstances = window.mwf.Collapse.getInstances(); var accordionList = Array.prototype.map.call(this.collapseBtnList, function (btn) { return collapseInstances.find(function (collapse) { return collapse.triggerElement === btn; }); }); accordionList.forEach(function (collapse, index) { if (_this.inMobileViewport()) { collapse.parent = ''; } else { collapse.parent = collapse.el.getAttribute('data-parent'); if (_this.intialShowIndex === index) { collapse.show(); } else { collapse.hide(); } } }); } } var AccordionExtension = /*#__PURE__*/function () { function AccordionExtension(opts) { var _this2 = this; this.el = opts.el; this.collapseBtnList = this.el.querySelectorAll(Selector$B.COLLAPSE_BUTTON); this.intialShowIndex = 0; this.disableMobileGroupManagement = this.el.dataset.disableMobileGroupManagement; this.customViewports = opts.customViewports || ['md', 'lg', 'xl']; this.mobileViewports = opts.mobileViewports || ['xs', 'sm']; _enableMultiSelectMobile.call(this); // find index of intial show accordion [].slice.call(this.collapseBtnList).forEach(function (btn, i) { if (btn.className.indexOf('collapsed') === -1) { _this2.intialShowIndex = i; } }); this[EventName$B.ON_REMOVE] = new CustomEvent(EventName$B.ON_REMOVE, { bubbles: true, cancelable: true }); this.events = []; this.collapseBtnList.forEach(function (collapse) { _this2.events.push({ el: collapse, type: 'click', handler: _click.bind(_this2, collapse) }); }); if (this.disableMobileGroupManagement) { this.events.push({ el: window, type: 'resize', handler: debounce(300, _enableMultiSelectMobile.bind(this)) }); } _click.bind(this, this.collapseBtnList[this.intialShowIndex])(); Util$1.addEvents(this.events); instances$s.push(this); } var _proto = AccordionExtension.prototype; _proto.inMobileViewport = function inMobileViewport() { var viewport = Util$1.detectViewport(); return this.mobileViewports.indexOf(viewport) > -1; } /** * Remove the instance */; _proto.remove = function remove() { Util$1.removeEvents(this.events); this.el.dispatchEvent(this[EventName$B.ON_REMOVE]); var index = instances$s.indexOf(this); instances$s.splice(index, 1); } /** * Get alert instances. * @returns {Object[]} An array of alert instances */; AccordionExtension.getInstances = function getInstances() { return instances$s; }; return AccordionExtension; }(); var $$E = _export; var toObject$4 = toObject$d; var nativeKeys = objectKeys$4; var fails$j = fails$J; var FAILS_ON_PRIMITIVES$3 = fails$j(function () { nativeKeys(1); }); // `Object.keys` method // https://tc39.es/ecma262/#sec-object.keys $$E({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$3 }, { keys: function keys(it) { return nativeKeys(toObject$4(it)); } }); var $$D = _export; var DESCRIPTORS$e = descriptors; var defineProperty$8 = objectDefineProperty.f; // `Object.defineProperty` method // https://tc39.es/ecma262/#sec-object.defineproperty // eslint-disable-next-line es/no-object-defineproperty -- safe $$D({ target: 'Object', stat: true, forced: Object.defineProperty !== defineProperty$8, sham: !DESCRIPTORS$e }, { defineProperty: defineProperty$8 }); var $$C = _export; var $filter = arrayIteration.filter; var arrayMethodHasSpeciesSupport = arrayMethodHasSpeciesSupport$5; var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter'); // `Array.prototype.filter` method // https://tc39.es/ecma262/#sec-array.prototype.filter // with adding support of @@species $$C({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, { filter: function filter(callbackfn /* , thisArg */) { return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); var classof$3 = classofRaw$2; var global$h = global$B; var engineIsNode = classof$3(global$h.process) == 'process'; var getBuiltIn$7 = getBuiltIn$d; var definePropertyModule$1 = objectDefineProperty; var wellKnownSymbol$9 = wellKnownSymbol$t; var DESCRIPTORS$d = descriptors; var SPECIES$2 = wellKnownSymbol$9('species'); var setSpecies$3 = function (CONSTRUCTOR_NAME) { var Constructor = getBuiltIn$7(CONSTRUCTOR_NAME); var defineProperty = definePropertyModule$1.f; if (DESCRIPTORS$d && Constructor && !Constructor[SPECIES$2]) { defineProperty(Constructor, SPECIES$2, { configurable: true, get: function () { return this; } }); } }; var isPrototypeOf$5 = objectIsPrototypeOf; var $TypeError$5 = TypeError; var anInstance$6 = function (it, Prototype) { if (isPrototypeOf$5(Prototype, it)) return it; throw $TypeError$5('Incorrect invocation'); }; var isConstructor = isConstructor$4; var tryToString$2 = tryToString$6; var $TypeError$4 = TypeError; // `Assert: IsConstructor(argument) is true` var aConstructor$2 = function (argument) { if (isConstructor(argument)) return argument; throw $TypeError$4(tryToString$2(argument) + ' is not a constructor'); }; var anObject$7 = anObject$l; var aConstructor$1 = aConstructor$2; var isNullOrUndefined$5 = isNullOrUndefined$b; var wellKnownSymbol$8 = wellKnownSymbol$t; var SPECIES$1 = wellKnownSymbol$8('species'); // `SpeciesConstructor` abstract operation // https://tc39.es/ecma262/#sec-speciesconstructor var speciesConstructor$2 = function (O, defaultConstructor) { var C = anObject$7(O).constructor; var S; return C === undefined || isNullOrUndefined$5(S = anObject$7(C)[SPECIES$1]) ? defaultConstructor : aConstructor$1(S); }; var userAgent$4 = engineUserAgent; var engineIsIos = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent$4); var global$g = global$B; var apply$3 = functionApply; var bind$7 = functionBindContext; var isCallable$a = isCallable$u; var hasOwn$b = hasOwnProperty_1; var fails$i = fails$J; var html = html$2; var arraySlice$5 = arraySlice$8; var createElement = documentCreateElement$2; var validateArgumentsLength$2 = validateArgumentsLength$4; var IS_IOS$1 = engineIsIos; var IS_NODE$4 = engineIsNode; var set = global$g.setImmediate; var clear = global$g.clearImmediate; var process$2 = global$g.process; var Dispatch = global$g.Dispatch; var Function$1 = global$g.Function; var MessageChannel = global$g.MessageChannel; var String$1 = global$g.String; var counter = 0; var queue$1 = {}; var ONREADYSTATECHANGE = 'onreadystatechange'; var $location, defer, channel, port; try { // Deno throws a ReferenceError on `location` access without `--location` flag $location = global$g.location; } catch (error) { /* empty */ } var run = function (id) { if (hasOwn$b(queue$1, id)) { var fn = queue$1[id]; delete queue$1[id]; fn(); } }; var runner = function (id) { return function () { run(id); }; }; var listener = function (event) { run(event.data); }; var post = function (id) { // old engines have not location.origin global$g.postMessage(String$1(id), $location.protocol + '//' + $location.host); }; // Node.js 0.9+ & IE10+ has setImmediate, otherwise: if (!set || !clear) { set = function setImmediate(handler) { validateArgumentsLength$2(arguments.length, 1); var fn = isCallable$a(handler) ? handler : Function$1(handler); var args = arraySlice$5(arguments, 1); queue$1[++counter] = function () { apply$3(fn, undefined, args); }; defer(counter); return counter; }; clear = function clearImmediate(id) { delete queue$1[id]; }; // Node.js 0.8- if (IS_NODE$4) { defer = function (id) { process$2.nextTick(runner(id)); }; // Sphere (JS game engine) Dispatch API } else if (Dispatch && Dispatch.now) { defer = function (id) { Dispatch.now(runner(id)); }; // Browsers with MessageChannel, includes WebWorkers // except iOS - https://github.com/zloirock/core-js/issues/624 } else if (MessageChannel && !IS_IOS$1) { channel = new MessageChannel(); port = channel.port2; channel.port1.onmessage = listener; defer = bind$7(port.postMessage, port); // Browsers with postMessage, skip WebWorkers // IE8 has postMessage, but it's sync & typeof its postMessage is 'object' } else if ( global$g.addEventListener && isCallable$a(global$g.postMessage) && !global$g.importScripts && $location && $location.protocol !== 'file:' && !fails$i(post) ) { defer = post; global$g.addEventListener('message', listener, false); // IE8- } else if (ONREADYSTATECHANGE in createElement('script')) { defer = function (id) { html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () { html.removeChild(this); run(id); }; }; // Rest old browsers } else { defer = function (id) { setTimeout(runner(id), 0); }; } } var task$1 = { set: set, clear: clear }; var userAgent$3 = engineUserAgent; var global$f = global$B; var engineIsIosPebble = /ipad|iphone|ipod/i.test(userAgent$3) && global$f.Pebble !== undefined; var userAgent$2 = engineUserAgent; var engineIsWebosWebkit = /web0s(?!.*chrome)/i.test(userAgent$2); var global$e = global$B; var bind$6 = functionBindContext; var getOwnPropertyDescriptor$3 = objectGetOwnPropertyDescriptor.f; var macrotask = task$1.set; var IS_IOS = engineIsIos; var IS_IOS_PEBBLE = engineIsIosPebble; var IS_WEBOS_WEBKIT = engineIsWebosWebkit; var IS_NODE$3 = engineIsNode; var MutationObserver$1 = global$e.MutationObserver || global$e.WebKitMutationObserver; var document$2 = global$e.document; var process$1 = global$e.process; var Promise$1 = global$e.Promise; // Node.js 11 shows ExperimentalWarning on getting `queueMicrotask` var queueMicrotaskDescriptor = getOwnPropertyDescriptor$3(global$e, 'queueMicrotask'); var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value; var flush, head, last, notify$1, toggle, node, promise, then; // modern engines have queueMicrotask method if (!queueMicrotask) { flush = function () { var parent, fn; if (IS_NODE$3 && (parent = process$1.domain)) parent.exit(); while (head) { fn = head.fn; head = head.next; try { fn(); } catch (error) { if (head) notify$1(); else last = undefined; throw error; } } last = undefined; if (parent) parent.enter(); }; // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339 // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898 if (!IS_IOS && !IS_NODE$3 && !IS_WEBOS_WEBKIT && MutationObserver$1 && document$2) { toggle = true; node = document$2.createTextNode(''); new MutationObserver$1(flush).observe(node, { characterData: true }); notify$1 = function () { node.data = toggle = !toggle; }; // environments with maybe non-completely correct, but existent Promise } else if (!IS_IOS_PEBBLE && Promise$1 && Promise$1.resolve) { // Promise.resolve without an argument throws an error in LG WebOS 2 promise = Promise$1.resolve(undefined); // workaround of WebKit ~ iOS Safari 10.1 bug promise.constructor = Promise$1; then = bind$6(promise.then, promise); notify$1 = function () { then(flush); }; // Node.js without promises } else if (IS_NODE$3) { notify$1 = function () { process$1.nextTick(flush); }; // for other environments - macrotask based on: // - setImmediate // - MessageChannel // - window.postMessage // - onreadystatechange // - setTimeout } else { // strange IE + webpack dev server bug - use .bind(global) macrotask = bind$6(macrotask, global$e); notify$1 = function () { macrotask(flush); }; } } var microtask$1 = queueMicrotask || function (fn) { var task = { fn: fn, next: undefined }; if (last) last.next = task; if (!head) { head = task; notify$1(); } last = task; }; var global$d = global$B; var hostReportErrors$1 = function (a, b) { var console = global$d.console; if (console && console.error) { arguments.length == 1 ? console.error(a) : console.error(a, b); } }; var perform$3 = function (exec) { try { return { error: false, value: exec() }; } catch (error) { return { error: true, value: error }; } }; var Queue$1 = function () { this.head = null; this.tail = null; }; Queue$1.prototype = { add: function (item) { var entry = { item: item, next: null }; if (this.head) this.tail.next = entry; else this.head = entry; this.tail = entry; }, get: function () { var entry = this.head; if (entry) { this.head = entry.next; if (this.tail === entry) this.tail = null; return entry.item; } } }; var queue = Queue$1; var global$c = global$B; var promiseNativeConstructor = global$c.Promise; /* global Deno -- Deno case */ var engineIsDeno = typeof Deno == 'object' && Deno && typeof Deno.version == 'object'; var IS_DENO$1 = engineIsDeno; var IS_NODE$2 = engineIsNode; var engineIsBrowser = !IS_DENO$1 && !IS_NODE$2 && typeof window == 'object' && typeof document == 'object'; var global$b = global$B; var NativePromiseConstructor$4 = promiseNativeConstructor; var isCallable$9 = isCallable$u; var isForced$3 = isForced_1; var inspectSource = inspectSource$3; var wellKnownSymbol$7 = wellKnownSymbol$t; var IS_BROWSER = engineIsBrowser; var IS_DENO = engineIsDeno; var V8_VERSION = engineV8Version; NativePromiseConstructor$4 && NativePromiseConstructor$4.prototype; var SPECIES = wellKnownSymbol$7('species'); var SUBCLASSING = false; var NATIVE_PROMISE_REJECTION_EVENT$1 = isCallable$9(global$b.PromiseRejectionEvent); var FORCED_PROMISE_CONSTRUCTOR$5 = isForced$3('Promise', function () { var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(NativePromiseConstructor$4); var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(NativePromiseConstructor$4); // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables // https://bugs.chromium.org/p/chromium/issues/detail?id=830565 // We can't detect it synchronously, so just check versions if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true; // We can't use @@species feature detection in V8 since it causes // deoptimization and performance degradation // https://github.com/zloirock/core-js/issues/679 if (!V8_VERSION || V8_VERSION < 51 || !/native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) { // Detect correctness of subclassing with @@species support var promise = new NativePromiseConstructor$4(function (resolve) { resolve(1); }); var FakePromise = function (exec) { exec(function () { /* empty */ }, function () { /* empty */ }); }; var constructor = promise.constructor = {}; constructor[SPECIES] = FakePromise; SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise; if (!SUBCLASSING) return true; // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test } return !GLOBAL_CORE_JS_PROMISE && (IS_BROWSER || IS_DENO) && !NATIVE_PROMISE_REJECTION_EVENT$1; }); var promiseConstructorDetection = { CONSTRUCTOR: FORCED_PROMISE_CONSTRUCTOR$5, REJECTION_EVENT: NATIVE_PROMISE_REJECTION_EVENT$1, SUBCLASSING: SUBCLASSING }; var newPromiseCapability$2 = {}; var aCallable$5 = aCallable$a; var $TypeError$3 = TypeError; var PromiseCapability = function (C) { var resolve, reject; this.promise = new C(function ($$resolve, $$reject) { if (resolve !== undefined || reject !== undefined) throw $TypeError$3('Bad Promise constructor'); resolve = $$resolve; reject = $$reject; }); this.resolve = aCallable$5(resolve); this.reject = aCallable$5(reject); }; // `NewPromiseCapability` abstract operation // https://tc39.es/ecma262/#sec-newpromisecapability newPromiseCapability$2.f = function (C) { return new PromiseCapability(C); }; var $$B = _export; var IS_NODE$1 = engineIsNode; var global$a = global$B; var call$a = functionCall; var defineBuiltIn$a = defineBuiltIn$i; var setPrototypeOf$2 = objectSetPrototypeOf; var setToStringTag$4 = setToStringTag$7; var setSpecies$2 = setSpecies$3; var aCallable$4 = aCallable$a; var isCallable$8 = isCallable$u; var isObject$c = isObject$o; var anInstance$5 = anInstance$6; var speciesConstructor$1 = speciesConstructor$2; var task = task$1.set; var microtask = microtask$1; var hostReportErrors = hostReportErrors$1; var perform$2 = perform$3; var Queue = queue; var InternalStateModule$5 = internalState; var NativePromiseConstructor$3 = promiseNativeConstructor; var PromiseConstructorDetection = promiseConstructorDetection; var newPromiseCapabilityModule$3 = newPromiseCapability$2; var PROMISE = 'Promise'; var FORCED_PROMISE_CONSTRUCTOR$4 = PromiseConstructorDetection.CONSTRUCTOR; var NATIVE_PROMISE_REJECTION_EVENT = PromiseConstructorDetection.REJECTION_EVENT; var NATIVE_PROMISE_SUBCLASSING = PromiseConstructorDetection.SUBCLASSING; var getInternalPromiseState = InternalStateModule$5.getterFor(PROMISE); var setInternalState$5 = InternalStateModule$5.set; var NativePromisePrototype$2 = NativePromiseConstructor$3 && NativePromiseConstructor$3.prototype; var PromiseConstructor = NativePromiseConstructor$3; var PromisePrototype = NativePromisePrototype$2; var TypeError$5 = global$a.TypeError; var document$1 = global$a.document; var process = global$a.process; var newPromiseCapability$1 = newPromiseCapabilityModule$3.f; var newGenericPromiseCapability = newPromiseCapability$1; var DISPATCH_EVENT = !!(document$1 && document$1.createEvent && global$a.dispatchEvent); var UNHANDLED_REJECTION = 'unhandledrejection'; var REJECTION_HANDLED = 'rejectionhandled'; var PENDING = 0; var FULFILLED = 1; var REJECTED = 2; var HANDLED = 1; var UNHANDLED = 2; var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen; // helpers var isThenable = function (it) { var then; return isObject$c(it) && isCallable$8(then = it.then) ? then : false; }; var callReaction = function (reaction, state) { var value = state.value; var ok = state.state == FULFILLED; var handler = ok ? reaction.ok : reaction.fail; var resolve = reaction.resolve; var reject = reaction.reject; var domain = reaction.domain; var result, then, exited; try { if (handler) { if (!ok) { if (state.rejection === UNHANDLED) onHandleUnhandled(state); state.rejection = HANDLED; } if (handler === true) result = value; else { if (domain) domain.enter(); result = handler(value); // can throw if (domain) { domain.exit(); exited = true; } } if (result === reaction.promise) { reject(TypeError$5('Promise-chain cycle')); } else if (then = isThenable(result)) { call$a(then, result, resolve, reject); } else resolve(result); } else reject(value); } catch (error) { if (domain && !exited) domain.exit(); reject(error); } }; var notify = function (state, isReject) { if (state.notified) return; state.notified = true; microtask(function () { var reactions = state.reactions; var reaction; while (reaction = reactions.get()) { callReaction(reaction, state); } state.notified = false; if (isReject && !state.rejection) onUnhandled(state); }); }; var dispatchEvent = function (name, promise, reason) { var event, handler; if (DISPATCH_EVENT) { event = document$1.createEvent('Event'); event.promise = promise; event.reason = reason; event.initEvent(name, false, true); global$a.dispatchEvent(event); } else event = { promise: promise, reason: reason }; if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = global$a['on' + name])) handler(event); else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason); }; var onUnhandled = function (state) { call$a(task, global$a, function () { var promise = state.facade; var value = state.value; var IS_UNHANDLED = isUnhandled(state); var result; if (IS_UNHANDLED) { result = perform$2(function () { if (IS_NODE$1) { process.emit('unhandledRejection', value, promise); } else dispatchEvent(UNHANDLED_REJECTION, promise, value); }); // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should state.rejection = IS_NODE$1 || isUnhandled(state) ? UNHANDLED : HANDLED; if (result.error) throw result.value; } }); }; var isUnhandled = function (state) { return state.rejection !== HANDLED && !state.parent; }; var onHandleUnhandled = function (state) { call$a(task, global$a, function () { var promise = state.facade; if (IS_NODE$1) { process.emit('rejectionHandled', promise); } else dispatchEvent(REJECTION_HANDLED, promise, state.value); }); }; var bind$5 = function (fn, state, unwrap) { return function (value) { fn(state, value, unwrap); }; }; var internalReject = function (state, value, unwrap) { if (state.done) return; state.done = true; if (unwrap) state = unwrap; state.value = value; state.state = REJECTED; notify(state, true); }; var internalResolve = function (state, value, unwrap) { if (state.done) return; state.done = true; if (unwrap) state = unwrap; try { if (state.facade === value) throw TypeError$5("Promise can't be resolved itself"); var then = isThenable(value); if (then) { microtask(function () { var wrapper = { done: false }; try { call$a(then, value, bind$5(internalResolve, wrapper, state), bind$5(internalReject, wrapper, state) ); } catch (error) { internalReject(wrapper, error, state); } }); } else { state.value = value; state.state = FULFILLED; notify(state, false); } } catch (error) { internalReject({ done: false }, error, state); } }; // constructor polyfill if (FORCED_PROMISE_CONSTRUCTOR$4) { // 25.4.3.1 Promise(executor) PromiseConstructor = function Promise(executor) { anInstance$5(this, PromisePrototype); aCallable$4(executor); call$a(Internal, this); var state = getInternalPromiseState(this); try { executor(bind$5(internalResolve, state), bind$5(internalReject, state)); } catch (error) { internalReject(state, error); } }; PromisePrototype = PromiseConstructor.prototype; // eslint-disable-next-line no-unused-vars -- required for `.length` Internal = function Promise(executor) { setInternalState$5(this, { type: PROMISE, done: false, notified: false, parent: false, reactions: new Queue(), rejection: false, state: PENDING, value: undefined }); }; // `Promise.prototype.then` method // https://tc39.es/ecma262/#sec-promise.prototype.then Internal.prototype = defineBuiltIn$a(PromisePrototype, 'then', function then(onFulfilled, onRejected) { var state = getInternalPromiseState(this); var reaction = newPromiseCapability$1(speciesConstructor$1(this, PromiseConstructor)); state.parent = true; reaction.ok = isCallable$8(onFulfilled) ? onFulfilled : true; reaction.fail = isCallable$8(onRejected) && onRejected; reaction.domain = IS_NODE$1 ? process.domain : undefined; if (state.state == PENDING) state.reactions.add(reaction); else microtask(function () { callReaction(reaction, state); }); return reaction.promise; }); OwnPromiseCapability = function () { var promise = new Internal(); var state = getInternalPromiseState(promise); this.promise = promise; this.resolve = bind$5(internalResolve, state); this.reject = bind$5(internalReject, state); }; newPromiseCapabilityModule$3.f = newPromiseCapability$1 = function (C) { return C === PromiseConstructor || C === PromiseWrapper ? new OwnPromiseCapability(C) : newGenericPromiseCapability(C); }; if (isCallable$8(NativePromiseConstructor$3) && NativePromisePrototype$2 !== Object.prototype) { nativeThen = NativePromisePrototype$2.then; if (!NATIVE_PROMISE_SUBCLASSING) { // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs defineBuiltIn$a(NativePromisePrototype$2, 'then', function then(onFulfilled, onRejected) { var that = this; return new PromiseConstructor(function (resolve, reject) { call$a(nativeThen, that, resolve, reject); }).then(onFulfilled, onRejected); // https://github.com/zloirock/core-js/issues/640 }, { unsafe: true }); } // make `.constructor === Promise` work for native promise-based APIs try { delete NativePromisePrototype$2.constructor; } catch (error) { /* empty */ } // make `instanceof Promise` work for native promise-based APIs if (setPrototypeOf$2) { setPrototypeOf$2(NativePromisePrototype$2, PromisePrototype); } } } $$B({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR$4 }, { Promise: PromiseConstructor }); setToStringTag$4(PromiseConstructor, PROMISE, false); setSpecies$2(PROMISE); var bind$4 = functionBindContext; var call$9 = functionCall; var anObject$6 = anObject$l; var tryToString$1 = tryToString$6; var isArrayIteratorMethod = isArrayIteratorMethod$2; var lengthOfArrayLike$4 = lengthOfArrayLike$b; var isPrototypeOf$4 = objectIsPrototypeOf; var getIterator$1 = getIterator$3; var getIteratorMethod$1 = getIteratorMethod$4; var iteratorClose = iteratorClose$2; var $TypeError$2 = TypeError; var Result = function (stopped, result) { this.stopped = stopped; this.result = result; }; var ResultPrototype = Result.prototype; var iterate$5 = function (iterable, unboundFunction, options) { var that = options && options.that; var AS_ENTRIES = !!(options && options.AS_ENTRIES); var IS_RECORD = !!(options && options.IS_RECORD); var IS_ITERATOR = !!(options && options.IS_ITERATOR); var INTERRUPTED = !!(options && options.INTERRUPTED); var fn = bind$4(unboundFunction, that); var iterator, iterFn, index, length, result, next, step; var stop = function (condition) { if (iterator) iteratorClose(iterator, 'normal', condition); return new Result(true, condition); }; var callFn = function (value) { if (AS_ENTRIES) { anObject$6(value); return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]); } return INTERRUPTED ? fn(value, stop) : fn(value); }; if (IS_RECORD) { iterator = iterable.iterator; } else if (IS_ITERATOR) { iterator = iterable; } else { iterFn = getIteratorMethod$1(iterable); if (!iterFn) throw $TypeError$2(tryToString$1(iterable) + ' is not iterable'); // optimisation for array iterators if (isArrayIteratorMethod(iterFn)) { for (index = 0, length = lengthOfArrayLike$4(iterable); length > index; index++) { result = callFn(iterable[index]); if (result && isPrototypeOf$4(ResultPrototype, result)) return result; } return new Result(false); } iterator = getIterator$1(iterable, iterFn); } next = IS_RECORD ? iterable.next : iterator.next; while (!(step = call$9(next, iterator)).done) { try { result = callFn(step.value); } catch (error) { iteratorClose(iterator, 'throw', error); } if (typeof result == 'object' && result && isPrototypeOf$4(ResultPrototype, result)) return result; } return new Result(false); }; var NativePromiseConstructor$2 = promiseNativeConstructor; var checkCorrectnessOfIteration$1 = checkCorrectnessOfIteration$3; var FORCED_PROMISE_CONSTRUCTOR$3 = promiseConstructorDetection.CONSTRUCTOR; var promiseStaticsIncorrectIteration = FORCED_PROMISE_CONSTRUCTOR$3 || !checkCorrectnessOfIteration$1(function (iterable) { NativePromiseConstructor$2.all(iterable).then(undefined, function () { /* empty */ }); }); var $$A = _export; var call$8 = functionCall; var aCallable$3 = aCallable$a; var newPromiseCapabilityModule$2 = newPromiseCapability$2; var perform$1 = perform$3; var iterate$4 = iterate$5; var PROMISE_STATICS_INCORRECT_ITERATION$1 = promiseStaticsIncorrectIteration; // `Promise.all` method // https://tc39.es/ecma262/#sec-promise.all $$A({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION$1 }, { all: function all(iterable) { var C = this; var capability = newPromiseCapabilityModule$2.f(C); var resolve = capability.resolve; var reject = capability.reject; var result = perform$1(function () { var $promiseResolve = aCallable$3(C.resolve); var values = []; var counter = 0; var remaining = 1; iterate$4(iterable, function (promise) { var index = counter++; var alreadyCalled = false; remaining++; call$8($promiseResolve, C, promise).then(function (value) { if (alreadyCalled) return; alreadyCalled = true; values[index] = value; --remaining || resolve(values); }, reject); }); --remaining || resolve(values); }); if (result.error) reject(result.value); return capability.promise; } }); var $$z = _export; var FORCED_PROMISE_CONSTRUCTOR$2 = promiseConstructorDetection.CONSTRUCTOR; var NativePromiseConstructor$1 = promiseNativeConstructor; var getBuiltIn$6 = getBuiltIn$d; var isCallable$7 = isCallable$u; var defineBuiltIn$9 = defineBuiltIn$i; var NativePromisePrototype$1 = NativePromiseConstructor$1 && NativePromiseConstructor$1.prototype; // `Promise.prototype.catch` method // https://tc39.es/ecma262/#sec-promise.prototype.catch $$z({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR$2, real: true }, { 'catch': function (onRejected) { return this.then(undefined, onRejected); } }); // makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then` if (isCallable$7(NativePromiseConstructor$1)) { var method$1 = getBuiltIn$6('Promise').prototype['catch']; if (NativePromisePrototype$1['catch'] !== method$1) { defineBuiltIn$9(NativePromisePrototype$1, 'catch', method$1, { unsafe: true }); } } var $$y = _export; var call$7 = functionCall; var aCallable$2 = aCallable$a; var newPromiseCapabilityModule$1 = newPromiseCapability$2; var perform = perform$3; var iterate$3 = iterate$5; var PROMISE_STATICS_INCORRECT_ITERATION = promiseStaticsIncorrectIteration; // `Promise.race` method // https://tc39.es/ecma262/#sec-promise.race $$y({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, { race: function race(iterable) { var C = this; var capability = newPromiseCapabilityModule$1.f(C); var reject = capability.reject; var result = perform(function () { var $promiseResolve = aCallable$2(C.resolve); iterate$3(iterable, function (promise) { call$7($promiseResolve, C, promise).then(capability.resolve, reject); }); }); if (result.error) reject(result.value); return capability.promise; } }); var $$x = _export; var call$6 = functionCall; var newPromiseCapabilityModule = newPromiseCapability$2; var FORCED_PROMISE_CONSTRUCTOR$1 = promiseConstructorDetection.CONSTRUCTOR; // `Promise.reject` method // https://tc39.es/ecma262/#sec-promise.reject $$x({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, { reject: function reject(r) { var capability = newPromiseCapabilityModule.f(this); call$6(capability.reject, undefined, r); return capability.promise; } }); var anObject$5 = anObject$l; var isObject$b = isObject$o; var newPromiseCapability = newPromiseCapability$2; var promiseResolve$2 = function (C, x) { anObject$5(C); if (isObject$b(x) && x.constructor === C) return x; var promiseCapability = newPromiseCapability.f(C); var resolve = promiseCapability.resolve; resolve(x); return promiseCapability.promise; }; var $$w = _export; var getBuiltIn$5 = getBuiltIn$d; var FORCED_PROMISE_CONSTRUCTOR = promiseConstructorDetection.CONSTRUCTOR; var promiseResolve$1 = promiseResolve$2; getBuiltIn$5('Promise'); // `Promise.resolve` method // https://tc39.es/ecma262/#sec-promise.resolve $$w({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, { resolve: function resolve(x) { return promiseResolve$1(this, x); } }); var toIntegerOrInfinity$2 = toIntegerOrInfinity$8; var toString$9 = toString$j; var requireObjectCoercible$5 = requireObjectCoercible$d; var $RangeError$3 = RangeError; // `String.prototype.repeat` method implementation // https://tc39.es/ecma262/#sec-string.prototype.repeat var stringRepeat = function repeat(count) { var str = toString$9(requireObjectCoercible$5(this)); var result = ''; var n = toIntegerOrInfinity$2(count); if (n < 0 || n == Infinity) throw $RangeError$3('Wrong number of repetitions'); for (;n > 0; (n >>>= 1) && (str += str)) if (n & 1) result += str; return result; }; // https://github.com/tc39/proposal-string-pad-start-end var uncurryThis$l = functionUncurryThis; var toLength$1 = toLength$5; var toString$8 = toString$j; var $repeat$1 = stringRepeat; var requireObjectCoercible$4 = requireObjectCoercible$d; var repeat$1 = uncurryThis$l($repeat$1); var stringSlice$7 = uncurryThis$l(''.slice); var ceil = Math.ceil; // `String.prototype.{ padStart, padEnd }` methods implementation var createMethod$2 = function (IS_END) { return function ($this, maxLength, fillString) { var S = toString$8(requireObjectCoercible$4($this)); var intMaxLength = toLength$1(maxLength); var stringLength = S.length; var fillStr = fillString === undefined ? ' ' : toString$8(fillString); var fillLen, stringFiller; if (intMaxLength <= stringLength || fillStr == '') return S; fillLen = intMaxLength - stringLength; stringFiller = repeat$1(fillStr, ceil(fillLen / fillStr.length)); if (stringFiller.length > fillLen) stringFiller = stringSlice$7(stringFiller, 0, fillLen); return IS_END ? S + stringFiller : stringFiller + S; }; }; var stringPad = { // `String.prototype.padStart` method // https://tc39.es/ecma262/#sec-string.prototype.padstart start: createMethod$2(false), // `String.prototype.padEnd` method // https://tc39.es/ecma262/#sec-string.prototype.padend end: createMethod$2(true) }; var uncurryThis$k = functionUncurryThis; var fails$h = fails$J; var padStart = stringPad.start; var $RangeError$2 = RangeError; var $isFinite = isFinite; var abs$1 = Math.abs; var DatePrototype = Date.prototype; var nativeDateToISOString = DatePrototype.toISOString; var thisTimeValue = uncurryThis$k(DatePrototype.getTime); var getUTCDate = uncurryThis$k(DatePrototype.getUTCDate); var getUTCFullYear = uncurryThis$k(DatePrototype.getUTCFullYear); var getUTCHours = uncurryThis$k(DatePrototype.getUTCHours); var getUTCMilliseconds = uncurryThis$k(DatePrototype.getUTCMilliseconds); var getUTCMinutes = uncurryThis$k(DatePrototype.getUTCMinutes); var getUTCMonth = uncurryThis$k(DatePrototype.getUTCMonth); var getUTCSeconds = uncurryThis$k(DatePrototype.getUTCSeconds); // `Date.prototype.toISOString` method implementation // https://tc39.es/ecma262/#sec-date.prototype.toisostring // PhantomJS / old WebKit fails here: var dateToIsoString = (fails$h(function () { return nativeDateToISOString.call(new Date(-5e13 - 1)) != '0385-07-25T07:06:39.999Z'; }) || !fails$h(function () { nativeDateToISOString.call(new Date(NaN)); })) ? function toISOString() { if (!$isFinite(thisTimeValue(this))) throw $RangeError$2('Invalid time value'); var date = this; var year = getUTCFullYear(date); var milliseconds = getUTCMilliseconds(date); var sign = year < 0 ? '-' : year > 9999 ? '+' : ''; return sign + padStart(abs$1(year), sign ? 6 : 4, 0) + '-' + padStart(getUTCMonth(date) + 1, 2, 0) + '-' + padStart(getUTCDate(date), 2, 0) + 'T' + padStart(getUTCHours(date), 2, 0) + ':' + padStart(getUTCMinutes(date), 2, 0) + ':' + padStart(getUTCSeconds(date), 2, 0) + '.' + padStart(milliseconds, 3, 0) + 'Z'; } : nativeDateToISOString; var $$v = _export; var toISOString = dateToIsoString; // `Date.prototype.toISOString` method // https://tc39.es/ecma262/#sec-date.prototype.toisostring // PhantomJS / old WebKit has a broken implementations $$v({ target: 'Date', proto: true, forced: Date.prototype.toISOString !== toISOString }, { toISOString: toISOString }); var $$u = _export; var NativePromiseConstructor = promiseNativeConstructor; var fails$g = fails$J; var getBuiltIn$4 = getBuiltIn$d; var isCallable$6 = isCallable$u; var speciesConstructor = speciesConstructor$2; var promiseResolve = promiseResolve$2; var defineBuiltIn$8 = defineBuiltIn$i; var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype; // Safari bug https://bugs.webkit.org/show_bug.cgi?id=200829 var NON_GENERIC = !!NativePromiseConstructor && fails$g(function () { // eslint-disable-next-line unicorn/no-thenable -- required for testing NativePromisePrototype['finally'].call({ then: function () { /* empty */ } }, function () { /* empty */ }); }); // `Promise.prototype.finally` method // https://tc39.es/ecma262/#sec-promise.prototype.finally $$u({ target: 'Promise', proto: true, real: true, forced: NON_GENERIC }, { 'finally': function (onFinally) { var C = speciesConstructor(this, getBuiltIn$4('Promise')); var isFunction = isCallable$6(onFinally); return this.then( isFunction ? function (x) { return promiseResolve(C, onFinally()).then(function () { return x; }); } : onFinally, isFunction ? function (e) { return promiseResolve(C, onFinally()).then(function () { throw e; }); } : onFinally ); } }); // makes sure that native promise-based APIs `Promise#finally` properly works with patched `Promise#then` if (isCallable$6(NativePromiseConstructor)) { var method = getBuiltIn$4('Promise').prototype['finally']; if (NativePromisePrototype['finally'] !== method) { defineBuiltIn$8(NativePromisePrototype, 'finally', method, { unsafe: true }); } } var $$t = _export; var $some = arrayIteration.some; var arrayMethodIsStrict$4 = arrayMethodIsStrict$8; var STRICT_METHOD$4 = arrayMethodIsStrict$4('some'); // `Array.prototype.some` method // https://tc39.es/ecma262/#sec-array.prototype.some $$t({ target: 'Array', proto: true, forced: !STRICT_METHOD$4 }, { some: function some(callbackfn /* , thisArg */) { return $some(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); var $$s = _export; var uncurryThis$j = functionUncurryThis; var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f; var toLength = toLength$5; var toString$7 = toString$j; var notARegExp = notARegexp; var requireObjectCoercible$3 = requireObjectCoercible$d; var correctIsRegExpLogic = correctIsRegexpLogic; // eslint-disable-next-line es/no-string-prototype-startswith -- safe var nativeStartsWith = uncurryThis$j(''.startsWith); var stringSlice$6 = uncurryThis$j(''.slice); var min$1 = Math.min; var CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic('startsWith'); // https://github.com/zloirock/core-js/pull/702 var MDN_POLYFILL_BUG = !CORRECT_IS_REGEXP_LOGIC && !!function () { var descriptor = getOwnPropertyDescriptor$2(String.prototype, 'startsWith'); return descriptor && !descriptor.writable; }(); // `String.prototype.startsWith` method // https://tc39.es/ecma262/#sec-string.prototype.startswith $$s({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, { startsWith: function startsWith(searchString /* , position = 0 */) { var that = toString$7(requireObjectCoercible$3(this)); notARegExp(searchString); var index = toLength(min$1(arguments.length > 1 ? arguments[1] : undefined, that.length)); var search = toString$7(searchString); return nativeStartsWith ? nativeStartsWith(that, search, index) : stringSlice$6(that, index, index + search.length) === search; } }); var DESCRIPTORS$c = descriptors; var FUNCTION_NAME_EXISTS = functionName.EXISTS; var uncurryThis$i = functionUncurryThis; var defineProperty$7 = objectDefineProperty.f; var FunctionPrototype = Function.prototype; var functionToString = uncurryThis$i(FunctionPrototype.toString); var nameRE = /function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/; var regExpExec$1 = uncurryThis$i(nameRE.exec); var NAME = 'name'; // Function instances `.name` property // https://tc39.es/ecma262/#sec-function-instances-name if (DESCRIPTORS$c && !FUNCTION_NAME_EXISTS) { defineProperty$7(FunctionPrototype, NAME, { configurable: true, get: function () { try { return regExpExec$1(nameRE, functionToString(this))[1]; } catch (error) { return ''; } } }); } /* eslint-disable es/no-array-prototype-lastindexof -- safe */ var apply$2 = functionApply; var toIndexedObject$5 = toIndexedObject$d; var toIntegerOrInfinity$1 = toIntegerOrInfinity$8; var lengthOfArrayLike$3 = lengthOfArrayLike$b; var arrayMethodIsStrict$3 = arrayMethodIsStrict$8; var min = Math.min; var $lastIndexOf = [].lastIndexOf; var NEGATIVE_ZERO = !!$lastIndexOf && 1 / [1].lastIndexOf(1, -0) < 0; var STRICT_METHOD$3 = arrayMethodIsStrict$3('lastIndexOf'); var FORCED$5 = NEGATIVE_ZERO || !STRICT_METHOD$3; // `Array.prototype.lastIndexOf` method implementation // https://tc39.es/ecma262/#sec-array.prototype.lastindexof var arrayLastIndexOf = FORCED$5 ? function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) { // convert -0 to +0 if (NEGATIVE_ZERO) return apply$2($lastIndexOf, this, arguments) || 0; var O = toIndexedObject$5(this); var length = lengthOfArrayLike$3(O); var index = length - 1; if (arguments.length > 1) index = min(index, toIntegerOrInfinity$1(arguments[1])); if (index < 0) index = length + index; for (;index >= 0; index--) if (index in O && O[index] === searchElement) return index || 0; return -1; } : $lastIndexOf; var $$r = _export; var lastIndexOf = arrayLastIndexOf; // `Array.prototype.lastIndexOf` method // https://tc39.es/ecma262/#sec-array.prototype.lastindexof // eslint-disable-next-line es/no-array-prototype-lastindexof -- required for testing $$r({ target: 'Array', proto: true, forced: lastIndexOf !== [].lastIndexOf }, { lastIndexOf: lastIndexOf }); var fails$f = fails$J; var wellKnownSymbol$6 = wellKnownSymbol$t; var IS_PURE = isPure; var ITERATOR$1 = wellKnownSymbol$6('iterator'); var urlConstructorDetection = !fails$f(function () { // eslint-disable-next-line unicorn/relative-url-style -- required for testing var url = new URL('b?a=1&b=2&c=3', 'http://a'); var searchParams = url.searchParams; var result = ''; url.pathname = 'c%20d'; searchParams.forEach(function (value, key) { searchParams['delete']('b'); result += key + value; }); return (IS_PURE && !url.toJSON) || !searchParams.sort || url.href !== 'http://a/c%20d?a=1&c=3' || searchParams.get('c') !== '3' || String(new URLSearchParams('?a=1')) !== 'a=1' || !searchParams[ITERATOR$1] // throws in Edge || new URL('https://a@b').username !== 'a' || new URLSearchParams(new URLSearchParams('a=b')).get('a') !== 'b' // not punycoded in Edge || new URL('http://тест').host !== 'xn--e1aybc' // not escaped in Chrome 62- || new URL('http://a#б').hash !== '#%D0%B1' // fails in Chrome 66- || result !== 'a1c3' // throws in Safari || new URL('http://x', undefined).host !== 'x'; }); var makeBuiltIn = makeBuiltIn$3.exports; var defineProperty$6 = objectDefineProperty; var defineBuiltInAccessor$1 = function (target, name, descriptor) { if (descriptor.get) makeBuiltIn(descriptor.get, name, { getter: true }); if (descriptor.set) makeBuiltIn(descriptor.set, name, { setter: true }); return defineProperty$6.f(target, name, descriptor); }; var toAbsoluteIndex = toAbsoluteIndex$4; var lengthOfArrayLike$2 = lengthOfArrayLike$b; var createProperty$1 = createProperty$6; var $Array = Array; var max$1 = Math.max; var arraySliceSimple = function (O, start, end) { var length = lengthOfArrayLike$2(O); var k = toAbsoluteIndex(start, length); var fin = toAbsoluteIndex(end === undefined ? length : end, length); var result = $Array(max$1(fin - k, 0)); for (var n = 0; k < fin; k++, n++) createProperty$1(result, n, O[k]); result.length = n; return result; }; // based on https://github.com/bestiejs/punycode.js/blob/master/punycode.js var uncurryThis$h = functionUncurryThis; var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1 var base = 36; var tMin = 1; var tMax = 26; var skew = 38; var damp = 700; var initialBias = 72; var initialN = 128; // 0x80 var delimiter = '-'; // '\x2D' var regexNonASCII = /[^\0-\u007E]/; // non-ASCII chars var regexSeparators = /[.\u3002\uFF0E\uFF61]/g; // RFC 3490 separators var OVERFLOW_ERROR = 'Overflow: input needs wider integers to process'; var baseMinusTMin = base - tMin; var $RangeError$1 = RangeError; var exec$3 = uncurryThis$h(regexSeparators.exec); var floor$4 = Math.floor; var fromCharCode = String.fromCharCode; var charCodeAt$2 = uncurryThis$h(''.charCodeAt); var join$2 = uncurryThis$h([].join); var push$6 = uncurryThis$h([].push); var replace$6 = uncurryThis$h(''.replace); var split$2 = uncurryThis$h(''.split); var toLowerCase$1 = uncurryThis$h(''.toLowerCase); /** * Creates an array containing the numeric code points of each Unicode * character in the string. While JavaScript uses UCS-2 internally, * this function will convert a pair of surrogate halves (each of which * UCS-2 exposes as separate characters) into a single code point, * matching UTF-16. */ var ucs2decode = function (string) { var output = []; var counter = 0; var length = string.length; while (counter < length) { var value = charCodeAt$2(string, counter++); if (value >= 0xD800 && value <= 0xDBFF && counter < length) { // It's a high surrogate, and there is a next character. var extra = charCodeAt$2(string, counter++); if ((extra & 0xFC00) == 0xDC00) { // Low surrogate. push$6(output, ((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); } else { // It's an unmatched surrogate; only append this code unit, in case the // next code unit is the high surrogate of a surrogate pair. push$6(output, value); counter--; } } else { push$6(output, value); } } return output; }; /** * Converts a digit/integer into a basic code point. */ var digitToBasic = function (digit) { // 0..25 map to ASCII a..z or A..Z // 26..35 map to ASCII 0..9 return digit + 22 + 75 * (digit < 26); }; /** * Bias adaptation function as per section 3.4 of RFC 3492. * https://tools.ietf.org/html/rfc3492#section-3.4 */ var adapt = function (delta, numPoints, firstTime) { var k = 0; delta = firstTime ? floor$4(delta / damp) : delta >> 1; delta += floor$4(delta / numPoints); while (delta > baseMinusTMin * tMax >> 1) { delta = floor$4(delta / baseMinusTMin); k += base; } return floor$4(k + (baseMinusTMin + 1) * delta / (delta + skew)); }; /** * Converts a string of Unicode symbols (e.g. a domain name label) to a * Punycode string of ASCII-only symbols. */ var encode = function (input) { var output = []; // Convert the input in UCS-2 to an array of Unicode code points. input = ucs2decode(input); // Cache the length. var inputLength = input.length; // Initialize the state. var n = initialN; var delta = 0; var bias = initialBias; var i, currentValue; // Handle the basic code points. for (i = 0; i < input.length; i++) { currentValue = input[i]; if (currentValue < 0x80) { push$6(output, fromCharCode(currentValue)); } } var basicLength = output.length; // number of basic code points. var handledCPCount = basicLength; // number of code points that have been handled; // Finish the basic string with a delimiter unless it's empty. if (basicLength) { push$6(output, delimiter); } // Main encoding loop: while (handledCPCount < inputLength) { // All non-basic code points < n have been handled already. Find the next larger one: var m = maxInt; for (i = 0; i < input.length; i++) { currentValue = input[i]; if (currentValue >= n && currentValue < m) { m = currentValue; } } // Increase `delta` enough to advance the decoder's state to , but guard against overflow. var handledCPCountPlusOne = handledCPCount + 1; if (m - n > floor$4((maxInt - delta) / handledCPCountPlusOne)) { throw $RangeError$1(OVERFLOW_ERROR); } delta += (m - n) * handledCPCountPlusOne; n = m; for (i = 0; i < input.length; i++) { currentValue = input[i]; if (currentValue < n && ++delta > maxInt) { throw $RangeError$1(OVERFLOW_ERROR); } if (currentValue == n) { // Represent delta as a generalized variable-length integer. var q = delta; var k = base; while (true) { var t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); if (q < t) break; var qMinusT = q - t; var baseMinusT = base - t; push$6(output, fromCharCode(digitToBasic(t + qMinusT % baseMinusT))); q = floor$4(qMinusT / baseMinusT); k += base; } push$6(output, fromCharCode(digitToBasic(q))); bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); delta = 0; handledCPCount++; } } delta++; n++; } return join$2(output, ''); }; var stringPunycodeToAscii = function (input) { var encoded = []; var labels = split$2(replace$6(toLowerCase$1(input), regexSeparators, '\u002E'), '.'); var i, label; for (i = 0; i < labels.length; i++) { label = labels[i]; push$6(encoded, exec$3(regexNonASCII, label) ? 'xn--' + encode(label) : label); } return join$2(encoded, '.'); }; var defineBuiltIn$7 = defineBuiltIn$i; var defineBuiltIns$4 = function (target, src, options) { for (var key in src) defineBuiltIn$7(target, key, src[key], options); return target; }; var arraySlice$4 = arraySliceSimple; var floor$3 = Math.floor; var mergeSort = function (array, comparefn) { var length = array.length; var middle = floor$3(length / 2); return length < 8 ? insertionSort(array, comparefn) : merge( array, mergeSort(arraySlice$4(array, 0, middle), comparefn), mergeSort(arraySlice$4(array, middle), comparefn), comparefn ); }; var insertionSort = function (array, comparefn) { var length = array.length; var i = 1; var element, j; while (i < length) { j = i; element = array[i]; while (j && comparefn(array[j - 1], element) > 0) { array[j] = array[--j]; } if (j !== i++) array[j] = element; } return array; }; var merge = function (array, left, right, comparefn) { var llength = left.length; var rlength = right.length; var lindex = 0; var rindex = 0; while (lindex < llength || rindex < rlength) { array[lindex + rindex] = (lindex < llength && rindex < rlength) ? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++] : lindex < llength ? left[lindex++] : right[rindex++]; } return array; }; var arraySort$1 = mergeSort; // TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env` var $$q = _export; var global$9 = global$B; var call$5 = functionCall; var uncurryThis$g = functionUncurryThis; var DESCRIPTORS$b = descriptors; var USE_NATIVE_URL$1 = urlConstructorDetection; var defineBuiltIn$6 = defineBuiltIn$i; var defineBuiltIns$3 = defineBuiltIns$4; var setToStringTag$3 = setToStringTag$7; var createIteratorConstructor = iteratorCreateConstructor; var InternalStateModule$4 = internalState; var anInstance$4 = anInstance$6; var isCallable$5 = isCallable$u; var hasOwn$a = hasOwnProperty_1; var bind$3 = functionBindContext; var classof$2 = classof$a; var anObject$4 = anObject$l; var isObject$a = isObject$o; var $toString$2 = toString$j; var create$3 = objectCreate; var createPropertyDescriptor$1 = createPropertyDescriptor$6; var getIterator = getIterator$3; var getIteratorMethod = getIteratorMethod$4; var validateArgumentsLength$1 = validateArgumentsLength$4; var wellKnownSymbol$5 = wellKnownSymbol$t; var arraySort = arraySort$1; var ITERATOR = wellKnownSymbol$5('iterator'); var URL_SEARCH_PARAMS = 'URLSearchParams'; var URL_SEARCH_PARAMS_ITERATOR = URL_SEARCH_PARAMS + 'Iterator'; var setInternalState$4 = InternalStateModule$4.set; var getInternalParamsState = InternalStateModule$4.getterFor(URL_SEARCH_PARAMS); var getInternalIteratorState = InternalStateModule$4.getterFor(URL_SEARCH_PARAMS_ITERATOR); // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor; // Avoid NodeJS experimental warning var safeGetBuiltIn = function (name) { if (!DESCRIPTORS$b) return global$9[name]; var descriptor = getOwnPropertyDescriptor$1(global$9, name); return descriptor && descriptor.value; }; var nativeFetch = safeGetBuiltIn('fetch'); var NativeRequest = safeGetBuiltIn('Request'); var Headers$1 = safeGetBuiltIn('Headers'); var RequestPrototype = NativeRequest && NativeRequest.prototype; var HeadersPrototype = Headers$1 && Headers$1.prototype; var RegExp$1 = global$9.RegExp; var TypeError$4 = global$9.TypeError; var decodeURIComponent$1 = global$9.decodeURIComponent; var encodeURIComponent$1 = global$9.encodeURIComponent; var charAt$3 = uncurryThis$g(''.charAt); var join$1 = uncurryThis$g([].join); var push$5 = uncurryThis$g([].push); var replace$5 = uncurryThis$g(''.replace); var shift$1 = uncurryThis$g([].shift); var splice$1 = uncurryThis$g([].splice); var split$1 = uncurryThis$g(''.split); var stringSlice$5 = uncurryThis$g(''.slice); var plus = /\+/g; var sequences = Array(4); var percentSequence = function (bytes) { return sequences[bytes - 1] || (sequences[bytes - 1] = RegExp$1('((?:%[\\da-f]{2}){' + bytes + '})', 'gi')); }; var percentDecode = function (sequence) { try { return decodeURIComponent$1(sequence); } catch (error) { return sequence; } }; var deserialize = function (it) { var result = replace$5(it, plus, ' '); var bytes = 4; try { return decodeURIComponent$1(result); } catch (error) { while (bytes) { result = replace$5(result, percentSequence(bytes--), percentDecode); } return result; } }; var find$1 = /[!'()~]|%20/g; var replacements = { '!': '%21', "'": '%27', '(': '%28', ')': '%29', '~': '%7E', '%20': '+' }; var replacer = function (match) { return replacements[match]; }; var serialize = function (it) { return replace$5(encodeURIComponent$1(it), find$1, replacer); }; var URLSearchParamsIterator = createIteratorConstructor(function Iterator(params, kind) { setInternalState$4(this, { type: URL_SEARCH_PARAMS_ITERATOR, iterator: getIterator(getInternalParamsState(params).entries), kind: kind }); }, 'Iterator', function next() { var state = getInternalIteratorState(this); var kind = state.kind; var step = state.iterator.next(); var entry = step.value; if (!step.done) { step.value = kind === 'keys' ? entry.key : kind === 'values' ? entry.value : [entry.key, entry.value]; } return step; }, true); var URLSearchParamsState = function (init) { this.entries = []; this.url = null; if (init !== undefined) { if (isObject$a(init)) this.parseObject(init); else this.parseQuery(typeof init == 'string' ? charAt$3(init, 0) === '?' ? stringSlice$5(init, 1) : init : $toString$2(init)); } }; URLSearchParamsState.prototype = { type: URL_SEARCH_PARAMS, bindURL: function (url) { this.url = url; this.update(); }, parseObject: function (object) { var iteratorMethod = getIteratorMethod(object); var iterator, next, step, entryIterator, entryNext, first, second; if (iteratorMethod) { iterator = getIterator(object, iteratorMethod); next = iterator.next; while (!(step = call$5(next, iterator)).done) { entryIterator = getIterator(anObject$4(step.value)); entryNext = entryIterator.next; if ( (first = call$5(entryNext, entryIterator)).done || (second = call$5(entryNext, entryIterator)).done || !call$5(entryNext, entryIterator).done ) throw TypeError$4('Expected sequence with length 2'); push$5(this.entries, { key: $toString$2(first.value), value: $toString$2(second.value) }); } } else for (var key in object) if (hasOwn$a(object, key)) { push$5(this.entries, { key: key, value: $toString$2(object[key]) }); } }, parseQuery: function (query) { if (query) { var attributes = split$1(query, '&'); var index = 0; var attribute, entry; while (index < attributes.length) { attribute = attributes[index++]; if (attribute.length) { entry = split$1(attribute, '='); push$5(this.entries, { key: deserialize(shift$1(entry)), value: deserialize(join$1(entry, '=')) }); } } } }, serialize: function () { var entries = this.entries; var result = []; var index = 0; var entry; while (index < entries.length) { entry = entries[index++]; push$5(result, serialize(entry.key) + '=' + serialize(entry.value)); } return join$1(result, '&'); }, update: function () { this.entries.length = 0; this.parseQuery(this.url.query); }, updateURL: function () { if (this.url) this.url.update(); } }; // `URLSearchParams` constructor // https://url.spec.whatwg.org/#interface-urlsearchparams var URLSearchParamsConstructor = function URLSearchParams(/* init */) { anInstance$4(this, URLSearchParamsPrototype); var init = arguments.length > 0 ? arguments[0] : undefined; setInternalState$4(this, new URLSearchParamsState(init)); }; var URLSearchParamsPrototype = URLSearchParamsConstructor.prototype; defineBuiltIns$3(URLSearchParamsPrototype, { // `URLSearchParams.prototype.append` method // https://url.spec.whatwg.org/#dom-urlsearchparams-append append: function append(name, value) { validateArgumentsLength$1(arguments.length, 2); var state = getInternalParamsState(this); push$5(state.entries, { key: $toString$2(name), value: $toString$2(value) }); state.updateURL(); }, // `URLSearchParams.prototype.delete` method // https://url.spec.whatwg.org/#dom-urlsearchparams-delete 'delete': function (name) { validateArgumentsLength$1(arguments.length, 1); var state = getInternalParamsState(this); var entries = state.entries; var key = $toString$2(name); var index = 0; while (index < entries.length) { if (entries[index].key === key) splice$1(entries, index, 1); else index++; } state.updateURL(); }, // `URLSearchParams.prototype.get` method // https://url.spec.whatwg.org/#dom-urlsearchparams-get get: function get(name) { validateArgumentsLength$1(arguments.length, 1); var entries = getInternalParamsState(this).entries; var key = $toString$2(name); var index = 0; for (; index < entries.length; index++) { if (entries[index].key === key) return entries[index].value; } return null; }, // `URLSearchParams.prototype.getAll` method // https://url.spec.whatwg.org/#dom-urlsearchparams-getall getAll: function getAll(name) { validateArgumentsLength$1(arguments.length, 1); var entries = getInternalParamsState(this).entries; var key = $toString$2(name); var result = []; var index = 0; for (; index < entries.length; index++) { if (entries[index].key === key) push$5(result, entries[index].value); } return result; }, // `URLSearchParams.prototype.has` method // https://url.spec.whatwg.org/#dom-urlsearchparams-has has: function has(name) { validateArgumentsLength$1(arguments.length, 1); var entries = getInternalParamsState(this).entries; var key = $toString$2(name); var index = 0; while (index < entries.length) { if (entries[index++].key === key) return true; } return false; }, // `URLSearchParams.prototype.set` method // https://url.spec.whatwg.org/#dom-urlsearchparams-set set: function set(name, value) { validateArgumentsLength$1(arguments.length, 1); var state = getInternalParamsState(this); var entries = state.entries; var found = false; var key = $toString$2(name); var val = $toString$2(value); var index = 0; var entry; for (; index < entries.length; index++) { entry = entries[index]; if (entry.key === key) { if (found) splice$1(entries, index--, 1); else { found = true; entry.value = val; } } } if (!found) push$5(entries, { key: key, value: val }); state.updateURL(); }, // `URLSearchParams.prototype.sort` method // https://url.spec.whatwg.org/#dom-urlsearchparams-sort sort: function sort() { var state = getInternalParamsState(this); arraySort(state.entries, function (a, b) { return a.key > b.key ? 1 : -1; }); state.updateURL(); }, // `URLSearchParams.prototype.forEach` method forEach: function forEach(callback /* , thisArg */) { var entries = getInternalParamsState(this).entries; var boundFunction = bind$3(callback, arguments.length > 1 ? arguments[1] : undefined); var index = 0; var entry; while (index < entries.length) { entry = entries[index++]; boundFunction(entry.value, entry.key, this); } }, // `URLSearchParams.prototype.keys` method keys: function keys() { return new URLSearchParamsIterator(this, 'keys'); }, // `URLSearchParams.prototype.values` method values: function values() { return new URLSearchParamsIterator(this, 'values'); }, // `URLSearchParams.prototype.entries` method entries: function entries() { return new URLSearchParamsIterator(this, 'entries'); } }, { enumerable: true }); // `URLSearchParams.prototype[@@iterator]` method defineBuiltIn$6(URLSearchParamsPrototype, ITERATOR, URLSearchParamsPrototype.entries, { name: 'entries' }); // `URLSearchParams.prototype.toString` method // https://url.spec.whatwg.org/#urlsearchparams-stringification-behavior defineBuiltIn$6(URLSearchParamsPrototype, 'toString', function toString() { return getInternalParamsState(this).serialize(); }, { enumerable: true }); setToStringTag$3(URLSearchParamsConstructor, URL_SEARCH_PARAMS); $$q({ global: true, constructor: true, forced: !USE_NATIVE_URL$1 }, { URLSearchParams: URLSearchParamsConstructor }); // Wrap `fetch` and `Request` for correct work with polyfilled `URLSearchParams` if (!USE_NATIVE_URL$1 && isCallable$5(Headers$1)) { var headersHas = uncurryThis$g(HeadersPrototype.has); var headersSet = uncurryThis$g(HeadersPrototype.set); var wrapRequestOptions = function (init) { if (isObject$a(init)) { var body = init.body; var headers; if (classof$2(body) === URL_SEARCH_PARAMS) { headers = init.headers ? new Headers$1(init.headers) : new Headers$1(); if (!headersHas(headers, 'content-type')) { headersSet(headers, 'content-type', 'application/x-www-form-urlencoded;charset=UTF-8'); } return create$3(init, { body: createPropertyDescriptor$1(0, $toString$2(body)), headers: createPropertyDescriptor$1(0, headers) }); } } return init; }; if (isCallable$5(nativeFetch)) { $$q({ global: true, enumerable: true, dontCallGetSet: true, forced: true }, { fetch: function fetch(input /* , init */) { return nativeFetch(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {}); } }); } if (isCallable$5(NativeRequest)) { var RequestConstructor = function Request(input /* , init */) { anInstance$4(this, RequestPrototype); return new NativeRequest(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {}); }; RequestPrototype.constructor = RequestConstructor; RequestConstructor.prototype = RequestPrototype; $$q({ global: true, constructor: true, dontCallGetSet: true, forced: true }, { Request: RequestConstructor }); } } var web_urlSearchParams_constructor = { URLSearchParams: URLSearchParamsConstructor, getState: getInternalParamsState }; // TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env` var $$p = _export; var DESCRIPTORS$a = descriptors; var USE_NATIVE_URL = urlConstructorDetection; var global$8 = global$B; var bind$2 = functionBindContext; var uncurryThis$f = functionUncurryThis; var defineBuiltIn$5 = defineBuiltIn$i; var defineBuiltInAccessor = defineBuiltInAccessor$1; var anInstance$3 = anInstance$6; var hasOwn$9 = hasOwnProperty_1; var assign = objectAssign; var arrayFrom = arrayFrom$1; var arraySlice$3 = arraySliceSimple; var codeAt = stringMultibyte.codeAt; var toASCII = stringPunycodeToAscii; var $toString$1 = toString$j; var setToStringTag$2 = setToStringTag$7; var validateArgumentsLength = validateArgumentsLength$4; var URLSearchParamsModule = web_urlSearchParams_constructor; var InternalStateModule$3 = internalState; var setInternalState$3 = InternalStateModule$3.set; var getInternalURLState = InternalStateModule$3.getterFor('URL'); var URLSearchParams$1 = URLSearchParamsModule.URLSearchParams; var getInternalSearchParamsState = URLSearchParamsModule.getState; var NativeURL = global$8.URL; var TypeError$3 = global$8.TypeError; var parseInt$1 = global$8.parseInt; var floor$2 = Math.floor; var pow$1 = Math.pow; var charAt$2 = uncurryThis$f(''.charAt); var exec$2 = uncurryThis$f(/./.exec); var join = uncurryThis$f([].join); var numberToString$1 = uncurryThis$f(1.0.toString); var pop = uncurryThis$f([].pop); var push$4 = uncurryThis$f([].push); var replace$4 = uncurryThis$f(''.replace); var shift = uncurryThis$f([].shift); var split = uncurryThis$f(''.split); var stringSlice$4 = uncurryThis$f(''.slice); var toLowerCase = uncurryThis$f(''.toLowerCase); var unshift = uncurryThis$f([].unshift); var INVALID_AUTHORITY = 'Invalid authority'; var INVALID_SCHEME = 'Invalid scheme'; var INVALID_HOST = 'Invalid host'; var INVALID_PORT = 'Invalid port'; var ALPHA = /[a-z]/i; // eslint-disable-next-line regexp/no-obscure-range -- safe var ALPHANUMERIC = /[\d+-.a-z]/i; var DIGIT = /\d/; var HEX_START = /^0x/i; var OCT = /^[0-7]+$/; var DEC = /^\d+$/; var HEX = /^[\da-f]+$/i; /* eslint-disable regexp/no-control-character -- safe */ var FORBIDDEN_HOST_CODE_POINT = /[\0\t\n\r #%/:<>?@[\\\]^|]/; var FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT = /[\0\t\n\r #/:<>?@[\\\]^|]/; var LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE = /^[\u0000-\u0020]+|[\u0000-\u0020]+$/g; var TAB_AND_NEW_LINE = /[\t\n\r]/g; /* eslint-enable regexp/no-control-character -- safe */ var EOF; // https://url.spec.whatwg.org/#ipv4-number-parser var parseIPv4 = function (input) { var parts = split(input, '.'); var partsLength, numbers, index, part, radix, number, ipv4; if (parts.length && parts[parts.length - 1] == '') { parts.length--; } partsLength = parts.length; if (partsLength > 4) return input; numbers = []; for (index = 0; index < partsLength; index++) { part = parts[index]; if (part == '') return input; radix = 10; if (part.length > 1 && charAt$2(part, 0) == '0') { radix = exec$2(HEX_START, part) ? 16 : 8; part = stringSlice$4(part, radix == 8 ? 1 : 2); } if (part === '') { number = 0; } else { if (!exec$2(radix == 10 ? DEC : radix == 8 ? OCT : HEX, part)) return input; number = parseInt$1(part, radix); } push$4(numbers, number); } for (index = 0; index < partsLength; index++) { number = numbers[index]; if (index == partsLength - 1) { if (number >= pow$1(256, 5 - partsLength)) return null; } else if (number > 255) return null; } ipv4 = pop(numbers); for (index = 0; index < numbers.length; index++) { ipv4 += numbers[index] * pow$1(256, 3 - index); } return ipv4; }; // https://url.spec.whatwg.org/#concept-ipv6-parser // eslint-disable-next-line max-statements -- TODO var parseIPv6 = function (input) { var address = [0, 0, 0, 0, 0, 0, 0, 0]; var pieceIndex = 0; var compress = null; var pointer = 0; var value, length, numbersSeen, ipv4Piece, number, swaps, swap; var chr = function () { return charAt$2(input, pointer); }; if (chr() == ':') { if (charAt$2(input, 1) != ':') return; pointer += 2; pieceIndex++; compress = pieceIndex; } while (chr()) { if (pieceIndex == 8) return; if (chr() == ':') { if (compress !== null) return; pointer++; pieceIndex++; compress = pieceIndex; continue; } value = length = 0; while (length < 4 && exec$2(HEX, chr())) { value = value * 16 + parseInt$1(chr(), 16); pointer++; length++; } if (chr() == '.') { if (length == 0) return; pointer -= length; if (pieceIndex > 6) return; numbersSeen = 0; while (chr()) { ipv4Piece = null; if (numbersSeen > 0) { if (chr() == '.' && numbersSeen < 4) pointer++; else return; } if (!exec$2(DIGIT, chr())) return; while (exec$2(DIGIT, chr())) { number = parseInt$1(chr(), 10); if (ipv4Piece === null) ipv4Piece = number; else if (ipv4Piece == 0) return; else ipv4Piece = ipv4Piece * 10 + number; if (ipv4Piece > 255) return; pointer++; } address[pieceIndex] = address[pieceIndex] * 256 + ipv4Piece; numbersSeen++; if (numbersSeen == 2 || numbersSeen == 4) pieceIndex++; } if (numbersSeen != 4) return; break; } else if (chr() == ':') { pointer++; if (!chr()) return; } else if (chr()) return; address[pieceIndex++] = value; } if (compress !== null) { swaps = pieceIndex - compress; pieceIndex = 7; while (pieceIndex != 0 && swaps > 0) { swap = address[pieceIndex]; address[pieceIndex--] = address[compress + swaps - 1]; address[compress + --swaps] = swap; } } else if (pieceIndex != 8) return; return address; }; var findLongestZeroSequence = function (ipv6) { var maxIndex = null; var maxLength = 1; var currStart = null; var currLength = 0; var index = 0; for (; index < 8; index++) { if (ipv6[index] !== 0) { if (currLength > maxLength) { maxIndex = currStart; maxLength = currLength; } currStart = null; currLength = 0; } else { if (currStart === null) currStart = index; ++currLength; } } if (currLength > maxLength) { maxIndex = currStart; maxLength = currLength; } return maxIndex; }; // https://url.spec.whatwg.org/#host-serializing var serializeHost = function (host) { var result, index, compress, ignore0; // ipv4 if (typeof host == 'number') { result = []; for (index = 0; index < 4; index++) { unshift(result, host % 256); host = floor$2(host / 256); } return join(result, '.'); // ipv6 } else if (typeof host == 'object') { result = ''; compress = findLongestZeroSequence(host); for (index = 0; index < 8; index++) { if (ignore0 && host[index] === 0) continue; if (ignore0) ignore0 = false; if (compress === index) { result += index ? ':' : '::'; ignore0 = true; } else { result += numberToString$1(host[index], 16); if (index < 7) result += ':'; } } return '[' + result + ']'; } return host; }; var C0ControlPercentEncodeSet = {}; var fragmentPercentEncodeSet = assign({}, C0ControlPercentEncodeSet, { ' ': 1, '"': 1, '<': 1, '>': 1, '`': 1 }); var pathPercentEncodeSet = assign({}, fragmentPercentEncodeSet, { '#': 1, '?': 1, '{': 1, '}': 1 }); var userinfoPercentEncodeSet = assign({}, pathPercentEncodeSet, { '/': 1, ':': 1, ';': 1, '=': 1, '@': 1, '[': 1, '\\': 1, ']': 1, '^': 1, '|': 1 }); var percentEncode = function (chr, set) { var code = codeAt(chr, 0); return code > 0x20 && code < 0x7F && !hasOwn$9(set, chr) ? chr : encodeURIComponent(chr); }; // https://url.spec.whatwg.org/#special-scheme var specialSchemes = { ftp: 21, file: null, http: 80, https: 443, ws: 80, wss: 443 }; // https://url.spec.whatwg.org/#windows-drive-letter var isWindowsDriveLetter = function (string, normalized) { var second; return string.length == 2 && exec$2(ALPHA, charAt$2(string, 0)) && ((second = charAt$2(string, 1)) == ':' || (!normalized && second == '|')); }; // https://url.spec.whatwg.org/#start-with-a-windows-drive-letter var startsWithWindowsDriveLetter = function (string) { var third; return string.length > 1 && isWindowsDriveLetter(stringSlice$4(string, 0, 2)) && ( string.length == 2 || ((third = charAt$2(string, 2)) === '/' || third === '\\' || third === '?' || third === '#') ); }; // https://url.spec.whatwg.org/#single-dot-path-segment var isSingleDot = function (segment) { return segment === '.' || toLowerCase(segment) === '%2e'; }; // https://url.spec.whatwg.org/#double-dot-path-segment var isDoubleDot = function (segment) { segment = toLowerCase(segment); return segment === '..' || segment === '%2e.' || segment === '.%2e' || segment === '%2e%2e'; }; // States: var SCHEME_START = {}; var SCHEME = {}; var NO_SCHEME = {}; var SPECIAL_RELATIVE_OR_AUTHORITY = {}; var PATH_OR_AUTHORITY = {}; var RELATIVE = {}; var RELATIVE_SLASH = {}; var SPECIAL_AUTHORITY_SLASHES = {}; var SPECIAL_AUTHORITY_IGNORE_SLASHES = {}; var AUTHORITY = {}; var HOST = {}; var HOSTNAME = {}; var PORT = {}; var FILE = {}; var FILE_SLASH = {}; var FILE_HOST = {}; var PATH_START = {}; var PATH = {}; var CANNOT_BE_A_BASE_URL_PATH = {}; var QUERY = {}; var FRAGMENT = {}; var URLState = function (url, isBase, base) { var urlString = $toString$1(url); var baseState, failure, searchParams; if (isBase) { failure = this.parse(urlString); if (failure) throw TypeError$3(failure); this.searchParams = null; } else { if (base !== undefined) baseState = new URLState(base, true); failure = this.parse(urlString, null, baseState); if (failure) throw TypeError$3(failure); searchParams = getInternalSearchParamsState(new URLSearchParams$1()); searchParams.bindURL(this); this.searchParams = searchParams; } }; URLState.prototype = { type: 'URL', // https://url.spec.whatwg.org/#url-parsing // eslint-disable-next-line max-statements -- TODO parse: function (input, stateOverride, base) { var url = this; var state = stateOverride || SCHEME_START; var pointer = 0; var buffer = ''; var seenAt = false; var seenBracket = false; var seenPasswordToken = false; var codePoints, chr, bufferCodePoints, failure; input = $toString$1(input); if (!stateOverride) { url.scheme = ''; url.username = ''; url.password = ''; url.host = null; url.port = null; url.path = []; url.query = null; url.fragment = null; url.cannotBeABaseURL = false; input = replace$4(input, LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE, ''); } input = replace$4(input, TAB_AND_NEW_LINE, ''); codePoints = arrayFrom(input); while (pointer <= codePoints.length) { chr = codePoints[pointer]; switch (state) { case SCHEME_START: if (chr && exec$2(ALPHA, chr)) { buffer += toLowerCase(chr); state = SCHEME; } else if (!stateOverride) { state = NO_SCHEME; continue; } else return INVALID_SCHEME; break; case SCHEME: if (chr && (exec$2(ALPHANUMERIC, chr) || chr == '+' || chr == '-' || chr == '.')) { buffer += toLowerCase(chr); } else if (chr == ':') { if (stateOverride && ( (url.isSpecial() != hasOwn$9(specialSchemes, buffer)) || (buffer == 'file' && (url.includesCredentials() || url.port !== null)) || (url.scheme == 'file' && !url.host) )) return; url.scheme = buffer; if (stateOverride) { if (url.isSpecial() && specialSchemes[url.scheme] == url.port) url.port = null; return; } buffer = ''; if (url.scheme == 'file') { state = FILE; } else if (url.isSpecial() && base && base.scheme == url.scheme) { state = SPECIAL_RELATIVE_OR_AUTHORITY; } else if (url.isSpecial()) { state = SPECIAL_AUTHORITY_SLASHES; } else if (codePoints[pointer + 1] == '/') { state = PATH_OR_AUTHORITY; pointer++; } else { url.cannotBeABaseURL = true; push$4(url.path, ''); state = CANNOT_BE_A_BASE_URL_PATH; } } else if (!stateOverride) { buffer = ''; state = NO_SCHEME; pointer = 0; continue; } else return INVALID_SCHEME; break; case NO_SCHEME: if (!base || (base.cannotBeABaseURL && chr != '#')) return INVALID_SCHEME; if (base.cannotBeABaseURL && chr == '#') { url.scheme = base.scheme; url.path = arraySlice$3(base.path); url.query = base.query; url.fragment = ''; url.cannotBeABaseURL = true; state = FRAGMENT; break; } state = base.scheme == 'file' ? FILE : RELATIVE; continue; case SPECIAL_RELATIVE_OR_AUTHORITY: if (chr == '/' && codePoints[pointer + 1] == '/') { state = SPECIAL_AUTHORITY_IGNORE_SLASHES; pointer++; } else { state = RELATIVE; continue; } break; case PATH_OR_AUTHORITY: if (chr == '/') { state = AUTHORITY; break; } else { state = PATH; continue; } case RELATIVE: url.scheme = base.scheme; if (chr == EOF) { url.username = base.username; url.password = base.password; url.host = base.host; url.port = base.port; url.path = arraySlice$3(base.path); url.query = base.query; } else if (chr == '/' || (chr == '\\' && url.isSpecial())) { state = RELATIVE_SLASH; } else if (chr == '?') { url.username = base.username; url.password = base.password; url.host = base.host; url.port = base.port; url.path = arraySlice$3(base.path); url.query = ''; state = QUERY; } else if (chr == '#') { url.username = base.username; url.password = base.password; url.host = base.host; url.port = base.port; url.path = arraySlice$3(base.path); url.query = base.query; url.fragment = ''; state = FRAGMENT; } else { url.username = base.username; url.password = base.password; url.host = base.host; url.port = base.port; url.path = arraySlice$3(base.path); url.path.length--; state = PATH; continue; } break; case RELATIVE_SLASH: if (url.isSpecial() && (chr == '/' || chr == '\\')) { state = SPECIAL_AUTHORITY_IGNORE_SLASHES; } else if (chr == '/') { state = AUTHORITY; } else { url.username = base.username; url.password = base.password; url.host = base.host; url.port = base.port; state = PATH; continue; } break; case SPECIAL_AUTHORITY_SLASHES: state = SPECIAL_AUTHORITY_IGNORE_SLASHES; if (chr != '/' || charAt$2(buffer, pointer + 1) != '/') continue; pointer++; break; case SPECIAL_AUTHORITY_IGNORE_SLASHES: if (chr != '/' && chr != '\\') { state = AUTHORITY; continue; } break; case AUTHORITY: if (chr == '@') { if (seenAt) buffer = '%40' + buffer; seenAt = true; bufferCodePoints = arrayFrom(buffer); for (var i = 0; i < bufferCodePoints.length; i++) { var codePoint = bufferCodePoints[i]; if (codePoint == ':' && !seenPasswordToken) { seenPasswordToken = true; continue; } var encodedCodePoints = percentEncode(codePoint, userinfoPercentEncodeSet); if (seenPasswordToken) url.password += encodedCodePoints; else url.username += encodedCodePoints; } buffer = ''; } else if ( chr == EOF || chr == '/' || chr == '?' || chr == '#' || (chr == '\\' && url.isSpecial()) ) { if (seenAt && buffer == '') return INVALID_AUTHORITY; pointer -= arrayFrom(buffer).length + 1; buffer = ''; state = HOST; } else buffer += chr; break; case HOST: case HOSTNAME: if (stateOverride && url.scheme == 'file') { state = FILE_HOST; continue; } else if (chr == ':' && !seenBracket) { if (buffer == '') return INVALID_HOST; failure = url.parseHost(buffer); if (failure) return failure; buffer = ''; state = PORT; if (stateOverride == HOSTNAME) return; } else if ( chr == EOF || chr == '/' || chr == '?' || chr == '#' || (chr == '\\' && url.isSpecial()) ) { if (url.isSpecial() && buffer == '') return INVALID_HOST; if (stateOverride && buffer == '' && (url.includesCredentials() || url.port !== null)) return; failure = url.parseHost(buffer); if (failure) return failure; buffer = ''; state = PATH_START; if (stateOverride) return; continue; } else { if (chr == '[') seenBracket = true; else if (chr == ']') seenBracket = false; buffer += chr; } break; case PORT: if (exec$2(DIGIT, chr)) { buffer += chr; } else if ( chr == EOF || chr == '/' || chr == '?' || chr == '#' || (chr == '\\' && url.isSpecial()) || stateOverride ) { if (buffer != '') { var port = parseInt$1(buffer, 10); if (port > 0xFFFF) return INVALID_PORT; url.port = (url.isSpecial() && port === specialSchemes[url.scheme]) ? null : port; buffer = ''; } if (stateOverride) return; state = PATH_START; continue; } else return INVALID_PORT; break; case FILE: url.scheme = 'file'; if (chr == '/' || chr == '\\') state = FILE_SLASH; else if (base && base.scheme == 'file') { if (chr == EOF) { url.host = base.host; url.path = arraySlice$3(base.path); url.query = base.query; } else if (chr == '?') { url.host = base.host; url.path = arraySlice$3(base.path); url.query = ''; state = QUERY; } else if (chr == '#') { url.host = base.host; url.path = arraySlice$3(base.path); url.query = base.query; url.fragment = ''; state = FRAGMENT; } else { if (!startsWithWindowsDriveLetter(join(arraySlice$3(codePoints, pointer), ''))) { url.host = base.host; url.path = arraySlice$3(base.path); url.shortenPath(); } state = PATH; continue; } } else { state = PATH; continue; } break; case FILE_SLASH: if (chr == '/' || chr == '\\') { state = FILE_HOST; break; } if (base && base.scheme == 'file' && !startsWithWindowsDriveLetter(join(arraySlice$3(codePoints, pointer), ''))) { if (isWindowsDriveLetter(base.path[0], true)) push$4(url.path, base.path[0]); else url.host = base.host; } state = PATH; continue; case FILE_HOST: if (chr == EOF || chr == '/' || chr == '\\' || chr == '?' || chr == '#') { if (!stateOverride && isWindowsDriveLetter(buffer)) { state = PATH; } else if (buffer == '') { url.host = ''; if (stateOverride) return; state = PATH_START; } else { failure = url.parseHost(buffer); if (failure) return failure; if (url.host == 'localhost') url.host = ''; if (stateOverride) return; buffer = ''; state = PATH_START; } continue; } else buffer += chr; break; case PATH_START: if (url.isSpecial()) { state = PATH; if (chr != '/' && chr != '\\') continue; } else if (!stateOverride && chr == '?') { url.query = ''; state = QUERY; } else if (!stateOverride && chr == '#') { url.fragment = ''; state = FRAGMENT; } else if (chr != EOF) { state = PATH; if (chr != '/') continue; } break; case PATH: if ( chr == EOF || chr == '/' || (chr == '\\' && url.isSpecial()) || (!stateOverride && (chr == '?' || chr == '#')) ) { if (isDoubleDot(buffer)) { url.shortenPath(); if (chr != '/' && !(chr == '\\' && url.isSpecial())) { push$4(url.path, ''); } } else if (isSingleDot(buffer)) { if (chr != '/' && !(chr == '\\' && url.isSpecial())) { push$4(url.path, ''); } } else { if (url.scheme == 'file' && !url.path.length && isWindowsDriveLetter(buffer)) { if (url.host) url.host = ''; buffer = charAt$2(buffer, 0) + ':'; // normalize windows drive letter } push$4(url.path, buffer); } buffer = ''; if (url.scheme == 'file' && (chr == EOF || chr == '?' || chr == '#')) { while (url.path.length > 1 && url.path[0] === '') { shift(url.path); } } if (chr == '?') { url.query = ''; state = QUERY; } else if (chr == '#') { url.fragment = ''; state = FRAGMENT; } } else { buffer += percentEncode(chr, pathPercentEncodeSet); } break; case CANNOT_BE_A_BASE_URL_PATH: if (chr == '?') { url.query = ''; state = QUERY; } else if (chr == '#') { url.fragment = ''; state = FRAGMENT; } else if (chr != EOF) { url.path[0] += percentEncode(chr, C0ControlPercentEncodeSet); } break; case QUERY: if (!stateOverride && chr == '#') { url.fragment = ''; state = FRAGMENT; } else if (chr != EOF) { if (chr == "'" && url.isSpecial()) url.query += '%27'; else if (chr == '#') url.query += '%23'; else url.query += percentEncode(chr, C0ControlPercentEncodeSet); } break; case FRAGMENT: if (chr != EOF) url.fragment += percentEncode(chr, fragmentPercentEncodeSet); break; } pointer++; } }, // https://url.spec.whatwg.org/#host-parsing parseHost: function (input) { var result, codePoints, index; if (charAt$2(input, 0) == '[') { if (charAt$2(input, input.length - 1) != ']') return INVALID_HOST; result = parseIPv6(stringSlice$4(input, 1, -1)); if (!result) return INVALID_HOST; this.host = result; // opaque host } else if (!this.isSpecial()) { if (exec$2(FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT, input)) return INVALID_HOST; result = ''; codePoints = arrayFrom(input); for (index = 0; index < codePoints.length; index++) { result += percentEncode(codePoints[index], C0ControlPercentEncodeSet); } this.host = result; } else { input = toASCII(input); if (exec$2(FORBIDDEN_HOST_CODE_POINT, input)) return INVALID_HOST; result = parseIPv4(input); if (result === null) return INVALID_HOST; this.host = result; } }, // https://url.spec.whatwg.org/#cannot-have-a-username-password-port cannotHaveUsernamePasswordPort: function () { return !this.host || this.cannotBeABaseURL || this.scheme == 'file'; }, // https://url.spec.whatwg.org/#include-credentials includesCredentials: function () { return this.username != '' || this.password != ''; }, // https://url.spec.whatwg.org/#is-special isSpecial: function () { return hasOwn$9(specialSchemes, this.scheme); }, // https://url.spec.whatwg.org/#shorten-a-urls-path shortenPath: function () { var path = this.path; var pathSize = path.length; if (pathSize && (this.scheme != 'file' || pathSize != 1 || !isWindowsDriveLetter(path[0], true))) { path.length--; } }, // https://url.spec.whatwg.org/#concept-url-serializer serialize: function () { var url = this; var scheme = url.scheme; var username = url.username; var password = url.password; var host = url.host; var port = url.port; var path = url.path; var query = url.query; var fragment = url.fragment; var output = scheme + ':'; if (host !== null) { output += '//'; if (url.includesCredentials()) { output += username + (password ? ':' + password : '') + '@'; } output += serializeHost(host); if (port !== null) output += ':' + port; } else if (scheme == 'file') output += '//'; output += url.cannotBeABaseURL ? path[0] : path.length ? '/' + join(path, '/') : ''; if (query !== null) output += '?' + query; if (fragment !== null) output += '#' + fragment; return output; }, // https://url.spec.whatwg.org/#dom-url-href setHref: function (href) { var failure = this.parse(href); if (failure) throw TypeError$3(failure); this.searchParams.update(); }, // https://url.spec.whatwg.org/#dom-url-origin getOrigin: function () { var scheme = this.scheme; var port = this.port; if (scheme == 'blob') try { return new URLConstructor(scheme.path[0]).origin; } catch (error) { return 'null'; } if (scheme == 'file' || !this.isSpecial()) return 'null'; return scheme + '://' + serializeHost(this.host) + (port !== null ? ':' + port : ''); }, // https://url.spec.whatwg.org/#dom-url-protocol getProtocol: function () { return this.scheme + ':'; }, setProtocol: function (protocol) { this.parse($toString$1(protocol) + ':', SCHEME_START); }, // https://url.spec.whatwg.org/#dom-url-username getUsername: function () { return this.username; }, setUsername: function (username) { var codePoints = arrayFrom($toString$1(username)); if (this.cannotHaveUsernamePasswordPort()) return; this.username = ''; for (var i = 0; i < codePoints.length; i++) { this.username += percentEncode(codePoints[i], userinfoPercentEncodeSet); } }, // https://url.spec.whatwg.org/#dom-url-password getPassword: function () { return this.password; }, setPassword: function (password) { var codePoints = arrayFrom($toString$1(password)); if (this.cannotHaveUsernamePasswordPort()) return; this.password = ''; for (var i = 0; i < codePoints.length; i++) { this.password += percentEncode(codePoints[i], userinfoPercentEncodeSet); } }, // https://url.spec.whatwg.org/#dom-url-host getHost: function () { var host = this.host; var port = this.port; return host === null ? '' : port === null ? serializeHost(host) : serializeHost(host) + ':' + port; }, setHost: function (host) { if (this.cannotBeABaseURL) return; this.parse(host, HOST); }, // https://url.spec.whatwg.org/#dom-url-hostname getHostname: function () { var host = this.host; return host === null ? '' : serializeHost(host); }, setHostname: function (hostname) { if (this.cannotBeABaseURL) return; this.parse(hostname, HOSTNAME); }, // https://url.spec.whatwg.org/#dom-url-port getPort: function () { var port = this.port; return port === null ? '' : $toString$1(port); }, setPort: function (port) { if (this.cannotHaveUsernamePasswordPort()) return; port = $toString$1(port); if (port == '') this.port = null; else this.parse(port, PORT); }, // https://url.spec.whatwg.org/#dom-url-pathname getPathname: function () { var path = this.path; return this.cannotBeABaseURL ? path[0] : path.length ? '/' + join(path, '/') : ''; }, setPathname: function (pathname) { if (this.cannotBeABaseURL) return; this.path = []; this.parse(pathname, PATH_START); }, // https://url.spec.whatwg.org/#dom-url-search getSearch: function () { var query = this.query; return query ? '?' + query : ''; }, setSearch: function (search) { search = $toString$1(search); if (search == '') { this.query = null; } else { if ('?' == charAt$2(search, 0)) search = stringSlice$4(search, 1); this.query = ''; this.parse(search, QUERY); } this.searchParams.update(); }, // https://url.spec.whatwg.org/#dom-url-searchparams getSearchParams: function () { return this.searchParams.facade; }, // https://url.spec.whatwg.org/#dom-url-hash getHash: function () { var fragment = this.fragment; return fragment ? '#' + fragment : ''; }, setHash: function (hash) { hash = $toString$1(hash); if (hash == '') { this.fragment = null; return; } if ('#' == charAt$2(hash, 0)) hash = stringSlice$4(hash, 1); this.fragment = ''; this.parse(hash, FRAGMENT); }, update: function () { this.query = this.searchParams.serialize() || null; } }; // `URL` constructor // https://url.spec.whatwg.org/#url-class var URLConstructor = function URL(url /* , base */) { var that = anInstance$3(this, URLPrototype); var base = validateArgumentsLength(arguments.length, 1) > 1 ? arguments[1] : undefined; var state = setInternalState$3(that, new URLState(url, false, base)); if (!DESCRIPTORS$a) { that.href = state.serialize(); that.origin = state.getOrigin(); that.protocol = state.getProtocol(); that.username = state.getUsername(); that.password = state.getPassword(); that.host = state.getHost(); that.hostname = state.getHostname(); that.port = state.getPort(); that.pathname = state.getPathname(); that.search = state.getSearch(); that.searchParams = state.getSearchParams(); that.hash = state.getHash(); } }; var URLPrototype = URLConstructor.prototype; var accessorDescriptor = function (getter, setter) { return { get: function () { return getInternalURLState(this)[getter](); }, set: setter && function (value) { return getInternalURLState(this)[setter](value); }, configurable: true, enumerable: true }; }; if (DESCRIPTORS$a) { // `URL.prototype.href` accessors pair // https://url.spec.whatwg.org/#dom-url-href defineBuiltInAccessor(URLPrototype, 'href', accessorDescriptor('serialize', 'setHref')); // `URL.prototype.origin` getter // https://url.spec.whatwg.org/#dom-url-origin defineBuiltInAccessor(URLPrototype, 'origin', accessorDescriptor('getOrigin')); // `URL.prototype.protocol` accessors pair // https://url.spec.whatwg.org/#dom-url-protocol defineBuiltInAccessor(URLPrototype, 'protocol', accessorDescriptor('getProtocol', 'setProtocol')); // `URL.prototype.username` accessors pair // https://url.spec.whatwg.org/#dom-url-username defineBuiltInAccessor(URLPrototype, 'username', accessorDescriptor('getUsername', 'setUsername')); // `URL.prototype.password` accessors pair // https://url.spec.whatwg.org/#dom-url-password defineBuiltInAccessor(URLPrototype, 'password', accessorDescriptor('getPassword', 'setPassword')); // `URL.prototype.host` accessors pair // https://url.spec.whatwg.org/#dom-url-host defineBuiltInAccessor(URLPrototype, 'host', accessorDescriptor('getHost', 'setHost')); // `URL.prototype.hostname` accessors pair // https://url.spec.whatwg.org/#dom-url-hostname defineBuiltInAccessor(URLPrototype, 'hostname', accessorDescriptor('getHostname', 'setHostname')); // `URL.prototype.port` accessors pair // https://url.spec.whatwg.org/#dom-url-port defineBuiltInAccessor(URLPrototype, 'port', accessorDescriptor('getPort', 'setPort')); // `URL.prototype.pathname` accessors pair // https://url.spec.whatwg.org/#dom-url-pathname defineBuiltInAccessor(URLPrototype, 'pathname', accessorDescriptor('getPathname', 'setPathname')); // `URL.prototype.search` accessors pair // https://url.spec.whatwg.org/#dom-url-search defineBuiltInAccessor(URLPrototype, 'search', accessorDescriptor('getSearch', 'setSearch')); // `URL.prototype.searchParams` getter // https://url.spec.whatwg.org/#dom-url-searchparams defineBuiltInAccessor(URLPrototype, 'searchParams', accessorDescriptor('getSearchParams')); // `URL.prototype.hash` accessors pair // https://url.spec.whatwg.org/#dom-url-hash defineBuiltInAccessor(URLPrototype, 'hash', accessorDescriptor('getHash', 'setHash')); } // `URL.prototype.toJSON` method // https://url.spec.whatwg.org/#dom-url-tojson defineBuiltIn$5(URLPrototype, 'toJSON', function toJSON() { return getInternalURLState(this).serialize(); }, { enumerable: true }); // `URL.prototype.toString` method // https://url.spec.whatwg.org/#URL-stringification-behavior defineBuiltIn$5(URLPrototype, 'toString', function toString() { return getInternalURLState(this).serialize(); }, { enumerable: true }); if (NativeURL) { var nativeCreateObjectURL = NativeURL.createObjectURL; var nativeRevokeObjectURL = NativeURL.revokeObjectURL; // `URL.createObjectURL` method // https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL if (nativeCreateObjectURL) defineBuiltIn$5(URLConstructor, 'createObjectURL', bind$2(nativeCreateObjectURL, NativeURL)); // `URL.revokeObjectURL` method // https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL if (nativeRevokeObjectURL) defineBuiltIn$5(URLConstructor, 'revokeObjectURL', bind$2(nativeRevokeObjectURL, NativeURL)); } setToStringTag$2(URLConstructor, 'URL'); $$p({ global: true, constructor: true, forced: !USE_NATIVE_URL, sham: !DESCRIPTORS$a }, { URL: URLConstructor }); var uncurryThis$e = functionUncurryThis; var requireObjectCoercible$2 = requireObjectCoercible$d; var toString$6 = toString$j; var quot = /"/g; var replace$3 = uncurryThis$e(''.replace); // `CreateHTML` abstract operation // https://tc39.es/ecma262/#sec-createhtml var createHtml = function (string, tag, attribute, value) { var S = toString$6(requireObjectCoercible$2(string)); var p1 = '<' + tag; if (attribute !== '') p1 += ' ' + attribute + '="' + replace$3(toString$6(value), quot, '"') + '"'; return p1 + '>' + S + ''; }; var fails$e = fails$J; // check the existence of a method, lowercase // of a tag and escaping quotes in arguments var stringHtmlForced = function (METHOD_NAME) { return fails$e(function () { var test = ''[METHOD_NAME]('"'); return test !== test.toLowerCase() || test.split('"').length > 3; }); }; var $$o = _export; var createHTML$1 = createHtml; var forcedStringHTMLMethod$1 = stringHtmlForced; // `String.prototype.sub` method // https://tc39.es/ecma262/#sec-string.prototype.sub $$o({ target: 'String', proto: true, forced: forcedStringHTMLMethod$1('sub') }, { sub: function sub() { return createHTML$1(this, 'sub', '', ''); } }); // import DetectionUtil from './util/detection'; // const Util = { // ...DetectionUtil // }; var Util = { /** * Loads a script file by adding it to the DOM. Returns a promise that resolves when the script has loaded. * @param {string} url URL of the script file to load * @param {string} appendLocation Where to append the script tag. Options: 'body' or 'head' * @param {boolean} async If true, the script will be loaded asynchronously * @param {boolean} defer If true, the script will be deferred * @returns {Promise} A promise that resolves with the script element when the script has loaded */ loadScript: function loadScript(url, appendLocation, async, defer) { if (appendLocation === void 0) { appendLocation = 'body'; } if (async === void 0) { async = true; } if (defer === void 0) { defer = false; } return new Promise(function (resolve, reject) { if (!['body', 'head'].includes(appendLocation)) { reject(new Error("Invalid appendLocation: " + appendLocation + ". Use 'body' or 'head'.")); return; } // Check if the script is already loaded var existingScript = Array.from(document.getElementsByTagName('script')).find(function (script) { return script.src === url; }); if (existingScript) { resolve(existingScript); return; } var script = document.createElement('script'); script.src = url; script.async = async; script.defer = defer; script.addEventListener('load', function () { return resolve(script); }); script.addEventListener('error', function () { return reject(new Error("Failed to load script: " + url)); }); document[appendLocation].append(script); }); }, /** * Normalizes text for comparison by converting smart quotes to straight quotes * and normalizing other special characters and whitespace * * @param {string} text The text to normalize * @returns {string} The normalized text */ normalizeText: function normalizeText(text) { if (typeof text !== 'string' || !text) return ''; return text // Western quotes (keep separate for single vs double quote differentiation) .replace(/[\u2018\u2019]/g, "'") // Smart single quotes to straight quotes // All other quotes (combined for efficiency based on ESLint suggestions) .replace(/[\u00AB-\u00BB\u201A-\u201F\u3008\u3009\u300C-\u300F\u301D-\u301F]/g, '"') // Dashes (using range) .replace(/[\u2012-\u2015]/g, '-') // All whitespace in one operation .replace(/\s+/g, ' ').trim(); }, /** * Toggles the inert attribute on the siblings of the provided element * * This function is useful for modal dialogs, as it allows you to disable * all elements outside the modal, ensuring that screen readers * only interact with the modal content. * * @param {HTMLElement} element modal dialog element whose siblings will be affected * @param {boolean} isInert If true, adds the 'inert' attribute. If false, removes it. */ toggleSiblingsInert: function toggleSiblingsInert(element, isInert) { if (!element || !element.parentElement) { // eslint-disable-next-line no-console console.warn('toggleSiblingsInert: Invalid element or no parent element found.'); return; } // get all siblings of the element var siblings = Array.from(element.parentElement.children); siblings.forEach(function (sibling) { // check if the sibling is an element and not a script, style, or link tag if (sibling !== element && sibling.nodeType === Node.ELEMENT_NODE && !['SCRIPT', 'STYLE', 'LINK'].includes(sibling.tagName)) { if (isInert) { sibling.setAttribute('inert', ''); } else if (sibling.hasAttribute('inert')) { sibling.removeAttribute('inert'); } } }); } }; // Send the getClock request every 30 seconds of inactivity var livePersonGetClockInterval = 30000; // Error types var LPErrorTypes = { GET_JWT_TIMEOUT: 'GET_JWT_TIMEOUT', INIT_WS_TIMEOUT: 'INIT_WS_TIMEOUT', ACCEPT_STATUS_TIMEOUT: 'ACCEPT_STATUS_TIMEOUT', INIT_CONNECTION_TIMEOUT: 'INIT_CONNECTION_TIMEOUT', SUBSCRIBE_EX_CONVERSATIONS_TIMEOUT: 'SUBSCRIBE_EX_CONVERSATIONS_TIMEOUT', UNSUBSCRIBE_EX_CONVERSATIONS_TIMEOUT: 'UNSUBSCRIBE_EX_CONVERSATIONS_TIMEOUT', CONSUMER_REQUEST_CONVERSATION_TIMEOUT: 'CONSUMER_REQUEST_CONVERSATION_TIMEOUT', USER_CLOSE_CONVERSATION_TIMEOUT: 'USER_CLOSE_CONVERSATION_TIMEOUT', SEND_MESSAGE_TIMEOUT: 'SEND_MESSAGE_TIMEOUT', WEBSOCKET_NOT_OPEN: 'WEBSOCKET_NOT_OPEN' }; /** * LivePerson library * Forked from https://codepen.io/liveperson/pen/oYyLJr */ var LPUtils = { conversationStateTypes: { OPEN: 'OPEN', CLOSE: 'CLOSE' }, conversationStageTypes: { OPEN: 'OPEN', CLOSE: 'CLOSE' }, acceptStatusTypes: { ACCEPT: 'ACCEPT', READ: 'READ', ACCESS: 'ACCESS', NACK: 'NACK', ACTION: 'ACTION' }, getDomain: function getDomain(account, name) { var domains = account.startsWith('le') ? 'hc1n.dev.lprnd.net' : 'adminlogin.liveperson.net'; var url = "https://" + domains + "/csdr/account/" + account + "/service/" + name + "/baseURI.lpCsds?version=1.0&cb=domainCallback"; return new Promise(function (res, rej) { // Remove existing script tag if it exists var existingScript = document.querySelector("script[src=\"" + url + "\"]"); if (existingScript) { existingScript.remove(); } var script = document.createElement('script'); script.src = url; script.async = true; script.addEventListener('error', function () { return rej(new Error('Network error getting LivePerson domain')); }); window.domainCallback = function (data) { if (data.ResultSet && data.ResultSet.lpData && data.ResultSet.lpData[0] && data.ResultSet.lpData[0].lpServer) { res(data.ResultSet.lpData[0].lpServer); } else { rej(new Error('Invalid response')); } }; document.body.append(script); }); }, signup: function signup(account) { return this.getDomain(account, 'idp').then(function (idpDomain) { var url = "https://" + idpDomain + "/api/account/" + account + "/signup.jsonp?callback=callback"; return new Promise(function (res, rej) { var script = document.createElement('script'); script.src = url; script.async = true; script.addEventListener('error', function () { return rej(new Error('Network error')); }); window.callback = function (idpResp) { if (idpResp && idpResp.jwt) { res(idpResp.jwt); } else { rej(new Error('Invalid response')); } }; document.body.append(script); }); }); }, // fetch jwt from cookie object or create one getJWT: function getJWT(account, cookieObject, cookieKey) { var localJWT = cookieObject[cookieKey]; if (!localJWT) { return this.signup(account).then(function (newJWT) { return newJWT; }); } return localJWT; }, engagement: { buildSessionRequestBody: function buildSessionRequestBody(country, topic, leadId, ipAddress, pageId) { var sessionRequestBody = { appType: 'EXTERNAL' }; if (pageId) { sessionRequestBody = { pageId: pageId }; } if (ipAddress) { sessionRequestBody.appDetails = { ipAddress: ipAddress }; } if (country || topic || leadId || ipAddress) { sessionRequestBody.engagementAttributes = []; } if (!ipAddress && country) { sessionRequestBody.engagementAttributes.push({ type: 'personal', personal: { language: country } }); } if (topic || leadId) { var leadAttribute = { type: 'lead', lead: {} }; if (topic) { leadAttribute.lead.topic = topic; } if (leadId) { leadAttribute.lead.leadId = leadId; } sessionRequestBody.engagementAttributes.push(leadAttribute); } return sessionRequestBody; }, createSession: function createSession(requestData) { var account = requestData.account, country = requestData.country, topic = requestData.topic, leadId = requestData.leadId, ipAddress = requestData.ipAddress, _requestData$visitorI = requestData.visitorId, visitorId = _requestData$visitorI === void 0 ? null : _requestData$visitorI, _requestData$sessionI = requestData.sessionId, sessionId = _requestData$sessionI === void 0 ? null : _requestData$sessionI; return new Promise(function (resolve, reject) { LPUtils.getDomain(account, 'msdkgw').then(function (engagementDomain) { var visitorIdPathParam = visitorId ? "/" + visitorId : ''; var sessionIdQueryParam = sessionId ? "&sid=" + sessionId : ''; var url = "https://" + engagementDomain + "/api/account/" + account + "/app/engagement/visitors" + visitorIdPathParam + "?v=1.0" + sessionIdQueryParam; var requestBody = LPUtils.engagement.buildSessionRequestBody(country, topic, leadId, ipAddress); fetch(url, { body: JSON.stringify(requestBody), method: 'POST', headers: { 'Content-Type': 'application/json' } }).then(function (response) { return response.json(); }).then(function (result) { return resolve(result); })["catch"](function (error) { return reject(error); }); }); }); }, updateSession: function updateSession(requestData) { var account = requestData.account, pageId = requestData.pageId, visitorId = requestData.visitorId, sessionId = requestData.sessionId, country = requestData.country, topic = requestData.topic, leadId = requestData.leadId, ipAddress = requestData.ipAddress; if (!pageId || !visitorId || !sessionId) { throw new Error('Required parameters are missing.'); } return new Promise(function (resolve, reject) { LPUtils.getDomain(account, 'msdkgw').then(function (engagementDomain) { var url = "https://" + engagementDomain + "/api/account/" + account + "/app/engagement/visitors/" + visitorId + "?v=1.0&sid=" + sessionId; var requestBody = LPUtils.engagement.buildSessionRequestBody(country, topic, leadId, ipAddress); fetch(url, { body: JSON.stringify(requestBody), method: 'PUT', headers: { 'Content-Type': 'application/json' } }).then(function (response) { return resolve(response.status); })["catch"](function (error) { return reject(error); }); }); }); } }, waitFor: function waitFor(ms) { return new Promise(function (resolve) { setTimeout(resolve, ms); }); }, /* eslint-disable no-unmodified-loop-condition */ /* eslint-disable no-await-in-loop */ /** * Executes a polling function with exponential backoff retry strategy. * * @param {Function} pollingFunction - The function to be executed. Should return a promise. * @param {Function} retryCondition - A function that determines whether to retry based on the response and error. Should return a boolean or a promise that resolves to a boolean. * @param {Object} [options] - Optional settings. * @param {Array} [options.args] - Arguments to pass to the polling function. * @param {number} [options.maxRetries=3] - Maximum number of retry attempts. * @param {number} [options.delayInSeconds=5] - Initial delay between retries in seconds. * @param {number} [options.attemptNumber] - The current attempt number (used internally). * @param {number} [options.nextInterval] - The next interval for retry (used internally). * @param {number} [options.attemptsLeft] - The number of attempts left (used internally). * @param {number} [options.pollingInterval] - The current polling interval (used internally). * @returns {Promise<*>} - The response from the polling function if successful. * @throws {Error} - Throws the last encountered error if all retries fail. */ exponentialBackoff: function exponentialBackoff(pollingFunction, retryCondition, options) { return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() { var maxRetries, delayInSeconds, attemptNumber, response, error, retry, args, retryFunction; return _regeneratorRuntime().wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: maxRetries = 3; delayInSeconds = 5; attemptNumber = 0; response = null; error = null; retry = false; args = []; if (!options) { options = {}; } if (!options.args) { options.args = []; } args = options.args; maxRetries = options.maxRetries || maxRetries; delayInSeconds = options.delayInSeconds || delayInSeconds; retryFunction = /*#__PURE__*/function () { var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: _context.prev = 0; attemptNumber++; _context.next = 4; return pollingFunction.apply(void 0, args); case 4: response = _context.sent; _context.next = 10; break; case 7: _context.prev = 7; _context.t0 = _context["catch"](0); error = _context.t0; case 10: options.attemptNumber = attemptNumber; options.nextInterval = delayInSeconds; options.attemptsLeft = maxRetries; if (!retryCondition) { _context.next = 19; break; } _context.next = 16; return retryCondition(response, error, options); case 16: _context.t1 = _context.sent; _context.next = 20; break; case 19: _context.t1 = !response || error; case 20: retry = _context.t1; args = options.args || []; case 22: case "end": return _context.stop(); } } }, _callee, null, [[0, 7]]); })); return function retryFunction() { return _ref.apply(this, arguments); }; }(); _context2.next = 15; return retryFunction(); case 15: if (!(maxRetries > 0 && retry)) { _context2.next = 27; break; } response = null; error = null; options.pollingInterval = delayInSeconds; _context2.next = 21; return LPUtils.waitFor(delayInSeconds * 1000); case 21: delayInSeconds *= 2; // Exponential backoff maxRetries--; _context2.next = 25; return retryFunction(); case 25: _context2.next = 15; break; case 27: if (!response) { _context2.next = 29; break; } return _context2.abrupt("return", response); case 29: throw error; case 30: case "end": return _context2.stop(); } } }, _callee2); }))(); } /* eslint-enable no-unmodified-loop-condition */ /* eslint-enable no-await-in-loop */ }; var LPWs = /*#__PURE__*/function () { LPWs.connect = function connect(url) { return new LPWs(url)._connect(); }; LPWs.connectDebug = function connectDebug(url) { return new LPWs(url, true)._connect(); }; function LPWs(url, debug) { var _this = this; this.getClockRequest = debounce(livePersonGetClockInterval, function () { if (_this.debug && !_this.ws) { console.log("[" + new Date().toLocaleString() + "] WebSocket is either not open yet or already closed.\n"); } _this.getClock().then(function (resp) { if (_this.debug) { console.log("[" + new Date().toLocaleString() + "] WebSocket connection pong response: " + resp.code + "\n"); } }); }); this.reqs = {}; this.subs = []; this.publishContentCallbacks = []; this.url = url; this.debug = debug; } var _proto = LPWs.prototype; _proto._connect = function _connect() { var _this2 = this; return new Promise(function (resolve, reject) { var ws = new WebSocket(_this2.url); _this2.ws = ws; ws.addEventListener('open', function () { return resolve(_this2); }); ws.addEventListener('message', function (msg) { return _this2.onmessage(msg); }); ws.addEventListener('close', function (evt) { return reject(evt); }); }); }; _proto.request = function request(type, body, headers) { var _this3 = this; return new Promise(function (resolve, reject) { var _obj$body$event, _obj$body$event2, _obj$body$event2$mess; if (!_this3.ws) { reject(new LPError(LPErrorTypes.WEBSOCKET_NOT_OPEN, 'LivePerson WebSocket connection is not open')); } var obj = { kind: 'req', type: type, body: body || {}, id: (body == null ? void 0 : body.messageId) || Math.floor(Math.random() * 1e9), headers: headers }; _this3.reqs[obj.id] = function (type, code, body) { return resolve({ type: type, code: code, body: body, reqId: obj.id }); }; var str = JSON.stringify(obj); if (_this3.debug) console.log('sending: ' + str); var timestampString = new Date().toISOString(); // If user is sending a message to LivePerson, notify handlers about the message object if (obj.type === 'ms.PublishEvent' && ((_obj$body$event = obj.body.event) == null ? void 0 : _obj$body$event.type) === 'ContentEvent' && (_obj$body$event2 = obj.body.event) != null && (_obj$body$event2$mess = _obj$body$event2.message) != null && _obj$body$event2$mess.length) { Promise.all(_this3.publishContentCallbacks.map(function (callback) { return callback(obj, timestampString); })).then(function () { _this3.ws.send(str); })["catch"](function (error) { console.error('Error in publishContentCallbacks:', error); reject(error); }); } else { _this3.ws.send(str); } }); }; _proto.onNotification = function onNotification(filterFunc, _onNotification) { this.subs.push({ filter: filterFunc, cb: _onNotification }); }; _proto.onPublishContent = function onPublishContent(callback) { this.publishContentCallbacks.push(callback); }; _proto.toFuncName = function toFuncName(reqType) { var str = reqType.slice(1 + reqType.lastIndexOf('.')); return str.charAt(0).toLowerCase() + str.slice(1); }; _proto.registerRequests = function registerRequests(arr) { var _this4 = this; arr.forEach(function (reqType) { _this4[_this4.toFuncName(reqType)] = function (body, headers, id) { return _this4.request(reqType, body, headers, id); }; }); }; _proto.onmessage = function onmessage(msg) { if (this.debug) console.log('recieved: ' + msg.data); var obj = JSON.parse(msg.data); if (obj.kind === 'resp') { var id = obj.reqId; delete obj.reqId; delete obj.kind; this.reqs[id].call(this, obj.type, obj.code, obj.body); delete this.reqs[id]; } else if (obj.kind === 'notification') { this.subs.forEach(function (sub) { if (sub.filter.call(this, obj)) { sub.cb.call(this, obj.body); } }); } // Start the clock interval this.getClockRequest(); }; return LPWs; }(); var LPError = /*#__PURE__*/function (_Error) { _inheritsLoose(LPError, _Error); function LPError(type, message, data) { var _this5; if (data === void 0) { data = {}; } _this5 = _Error.call(this, message) || this; _this5.type = type; _this5.data = data; return _this5; } return LPError; }( /*#__PURE__*/_wrapNativeSuper$1(Error)); /** * Private variables */ var aiChatDrawers = []; var uhfHeaderMarginBottomVal = 2; var azureWebsitesDomain = '.azurewebsites.net'; var aemCloudDomain = '.adobeaemcloud.com'; var isRunningLocally = window.location.port === '9002' || window.location.port === '4502' || window.location.port === '4503'; var isAzureWebsites = window.location.hostname.includes(azureWebsitesDomain); var isAemCloud = window.location.hostname.includes(aemCloudDomain); var livePersonApiRequestTypes = ['GetClock', 'cqm.SubscribeExConversations', 'cqm.UnsubscribeExConversations', 'ms.PublishEvent', 'cm.ConsumerRequestConversation', 'ms.SubscribeMessagingEvents', 'InitConnection', 'cm.UpdateConversationField']; var livePersonChatStateTypes = { DEFAULT: 0, ACTIVE: 'ACTIVE', INACTIVE: 'INACTIVE', GONE: 'GONE', COMPOSING: 'COMPOSING', PAUSE: 'PAUSE' }; var livePersonUserComposingDelay = 3000; // User starts composing again after 3 seconds of inactivity var livePersonUserPauseDelay = 3000; // User state will be set to PAUSE after 3 seconds of inactivity var livePersonResponseTimeout = 5000; // Wait 5 seconds before retrying a request to LP // Wait a second before user can click a chat link again to avoid chat with sales button/link spamming var debouncedChatActionTypeLinkClickDelay = 1000; // JsonPollock script source for LivePerson post-chat survey rendering var jsonPollockScriptSrc = 'https://www.microsoft.com/msonecloudapi/assets/json-pollock.bundle.min.js'; /** * Private functions */ /** * Get the domain for the cookie. * @returns {string} The domain for the cookie. */ function getCookieDomain() { // If on localhost or your IP, or on extensions PROD, or on Azure Websites or AEM Cloud, use the hostname. if (isRunningLocally || isAzureWebsites || isAemCloud) { return window.location.hostname; } // PROD return '.microsoft.com'; } /** * Get the base endpoint for the data connector for communicating with Microsoft OneCloud API. * * @param {string} protocol The protocol to use for the endpoint. Examples: 'https:' or 'wss:' * @returns {string} The base endpoint for the data connector. */ function getDataConnectorBaseEndpoint(protocol) { if (isRunningLocally) { return protocol + "//webassistant-dev.microsoft.com"; // Dev endpoint } if (isAzureWebsites) { return protocol + "//webassistant-ppe.microsoft.com"; // PPE endpoint } return protocol + "//webassistant-prod.microsoft.com"; // PROD endpoint } /** * LivePerson private functions */ function withSubscriptionID(subscriptionID) { return function (notif) { return notif.body.subscriptionId === subscriptionID; }; } function withType(type) { return function (notif) { return notif.type.includes(type); }; } /** * Selectors */ var Selector$A = { DATA_MOUNT: '[data-mount="ai-chat-drawer"]', AI_CHAT_BUTTON: '.ai-chat-button', AI_CHAT_BUTTON_TEXT: '.ai-chat-button__text', AI_CHAT_BUTTON_HEADER_TEXT: '.ai-chat-button .ai-chat-button__text span', AI_CHAT_BUTTON_ANCHOR: '.ai-chat-button a', AI_CHAT_BUTTON_DATA_MOUNT: '[data-mount="ai-chat-button"]', ARTICLE: 'article', BLOCK_FEATURE_TITLE: '.block-feature__title', CHAT_ACTION_TYPE_LINK: '[data-oc-chat]', CLOSE_BUTTON: '.ai-chat-drawer__close', DEFLECTION_FLOW_ELEMENT: '[id^="deflection-"]', FEEDBACK_BUTTON: '.action--ai-feedback', FOCUSABLE_ELEMENTS: 'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex="0"]', TAG_BUTTON: 'button.ai-chat-message--tag', WEB_CHAT_CONTAINER: '.ai-chat-drawer__body__content__messages', WEB_CHAT_SEND_BOX: '.webchat__send-box', WEB_CHAT_SEND_BUTTON: '.webchat__send-button', WEB_CHAT_ACTION_SET_BUTTONS: '.ac-actionSet button', WEB_CHAT_TRANSCRIPT: '.webchat__basic-transcript', WEB_CHAT_BUBBLE: '.webchat__bubble', WEB_CHAT_BUBBLE_FROM_BOT: '.webchat__bubble:not(.webchat__bubble--from-user)', WEB_CHAT_BUBBLE_FROM_USER: '.webchat__bubble--from-user', WEB_CHAT_BUBBLE_CONTENT: '.webchat__bubble__content', WEB_CHAT_STATUS: '.webchat__activity-status', WEB_CHAT_TRANSCRIPT_TRANSCRIPT: '.webchat__basic-transcript__transcript', UHF_HEADER: 'header', UHF_HEADER_CONTAINER: '.universalheader, #headerArea', UHF_MENU_NAV_EXPAND_ELEM: '#uhfCatLogoButton', UHF_FOOTER: '.universalfooter, #footerArea', SEND_TRANSCRIPT_CHECKBOX_CONTAINER: '[id^="sendTranscript"]', STICKY_NAV: '#sticky-nav', STICKY: '.sticky', SURVEY_RESPONSE_STAR_SVG: '.survey-response-button-star', POST_SURVEY_JSON_POLLOCK_BUTTON: 'div.lp-json-pollock-element-button button', HEADER_CONTROLS: '.ai-chat-drawer__header__control' }; /** * Event names */ var EventName$A = { CHANGE: 'change', CLICK: 'click', CLOSE: 'close', INPUT: 'input', KEYDOWN: 'keydown', SCROLL: 'scroll', SUBMIT: 'submit', RESIZE: 'resize', TRANSITION_END: 'transitionend', WEBCHAT_CONNECT_INITIATED: 'webchatconnectinitiated', WEBCHAT_CONNECT_FULFILLED: 'webchatconnectfulfilled', WEBCHAT_MESSAGE_RECEIVED: 'webchatmessagereceived', START_CONVERSATION_FULFILLED: 'startconversationfulfilled', FEEDBACK_SENT: 'feedbackRequestSent', LIVEPERSON_CHAT_START: 'startLPChat', LIVEPERSON_MESSAGE_RENDERED: 'livePersonMessageRendered', LIVEPERSON_SAVE_IDS: 'saveLPIDs', GENERATE_REIMAGINE_UMP: 'generateReimagineUMP', INSTANTIATED_BY_PROACTIVE_CHAT: 'instantiatedByProactiveChatEvent' }; /** * CSS classes */ var ClassName$q = { AI_DISCLAIMER: 'ai-chat-drawer__disclaimer', DISABLED: 'disabled', DISPLAY_NONE: 'd-none', FEEDBACK_BUTTON: 'action--ai-feedback', GET_HEIGHT: 'get-height', LP_SURVEY_QUESTIONNAIRE: 'lp-pcs-questionnaire', LP_SURVEY_RICH_CONTENT: 'lp-pcs-richContent', OVERFLOW_HIDDEN: 'overflow-hidden', RETURN_TO_AI_CHAT: 'return-to-ai-chat', SCREEN_READER_ONLY: 'sr-only', SHOW: 'show', STUCK: 'stuck', SURVEY_RESPONSE_BUTTON_STAR: 'survey-response-button-star', WEBCHAT_BUBBLE_CONTENT_FOLLOW_UP: 'webchat__bubble__content--follow-up', WEBCHAT_BUBBLE_LP_SYSTEM_MESSAGE: 'webchat__bubble--lp-system-message' }; /** * Custom Attributes */ var Attributes$5 = { AI_CHAT_ACTION_TYPE_LINK: 'data-oc-ai-chat', CHAT_ACTION_TYPE_LINK: 'data-oc-chat', IS_HIDDEN: 'data-is-hidden' }; /** * Style options for WebChat */ var AIChatDrawerStyleOptions = { // Basic styling backgroundColor: 'var(--theme-background-neutral-fade)', fontSizeSmall: '0.75rem', monospaceFont: 'SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace', primaryFont: 'inherit', transitionDuration: '.3s', // Bubble bubbleBorderRadius: 'var(--root-radii-s)', bubbleBorderWidth: 0, bubbleFromUserBackground: 'var(--root-color-brilliant-blue-100)', bubbleFromUserBorderRadius: 'var(--root-radii-s)', bubbleFromUserBorderWidth: 0, bubbleFromUserTextColor: 'var(--root-color-dark-slate-900)', bubbleTextColor: 'var(--theme-foreground-base-subtle)', // Send box hideUploadButton: true, sendBoxBackground: 'var(--theme-background-card-normal);', sendBoxButtonColor: 'var(--theme-foreground-accent-subtle-normal)', sendBoxButtonShadeColorOnActive: 'transparent', sendBoxButtonKeyboardFocusIndicatorBorderColor: 'currentColor', sendBoxButtonKeyboardFocusIndicatorBorderRadius: '0.5rem', sendBoxButtonKeyboardFocusIndicatorBorderStyle: 'dotted', sendBoxButtonKeyboardFocusIndicatorBorderWidth: '0.1875rem', sendBoxButtonKeyboardFocusIndicatorInset: '0.375rem', sendBoxDisabledTextColor: '#d2d2d2', sendBoxButtonColorOnDisabled: '#d2d2d2', sendBoxButtonShadeColorOnDisabled: 'transparent', sendBoxHeight: 64, sendBoxMaxHeight: 72, sendBoxTextColor: 'Black', sendBoxPlaceholderColor: 'var(--theme-foreground-base-subtle)', sendBoxTextWrap: true, // Timestamp timestampColor: 'var(--root-color-dark-slate-400)' }; /** * Keys for cookies */ var StorageKeys = { cookieName: 'ocrAIChat', token: 'ocrAIChatToken', tokenCreated: 'ocrAIChatTokenCreated', tuid: 'tuid', chatDrawerState: 'ocrAIChatDrawerState', sourceSite: 'ocrAIChatDrawerSourceSite', lpJWT: 'lpJWT', lpOpenConvs: 'lpOpenConvs', startLPChatActivityIds: 'startLPChatActivityIds', lpSession: 'lpEngagementSession' }; /** * Constants for cookies */ var CookieConstants = { domain: getCookieDomain(), expiryDays: -1, // Session cookie secure: !isRunningLocally, sameSite: 'Strict', path: '/' }; /** * Feedback icon SVG constants */ var FEEDBACK_ICON_SVGS = { POSITIVE_FILLED: "data:image/svg+xml,%3Csvg class='image is-down is-filled ___12fm75w f1w7gpdv fez10in fg4l7m0' fill='%230067b8' aria-hidden='true' width='16' height='16' viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.58 1.05c-.75-.2-1.34.35-1.55.87-.24.6-.45 1.02-.7 1.53-.16.3-.33.65-.53 1.09-.48 1-.95 1.65-1.3 2.04a4.06 4.06 0 0 1-.5.49h-.02L3.11 8.19a2 2 0 0 0-.86 2.43l.52 1.38a2 2 0 0 0 1.28 1.2l5.35 1.69a2.5 2.5 0 0 0 3.15-1.68l1.36-4.65A2 2 0 0 0 12 6h-1.38l.2-.74c.13-.56.24-1.2.23-1.74-.01-.5-.06-1.02-.27-1.46-.22-.48-.6-.83-1.19-1Zm-4.6 6.03Z' %3E%3C/path%3E%3C/svg%3E", NEGATIVE_FILLED: "data:image/svg+xml,%3Csvg class='image is-down is-filled ___12fm75w f1w7gpdv fez10in fg4l7m0' fill='%230067b8' aria-hidden='true' width='16' height='16' viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13.1 4.62a3.5 3.5 0 0 0-4.38-2.73L3.77 3.27a2 2 0 0 0-1.43 1.56l-.23 1.2c-.16.87.46 1.64 1.16 1.93.25.1.55.25.85.46a8.22 8.22 0 0 1 3.02 3.92l.28.7c.14.38.28.73.41 1 .11.23.25.46.42.63.19.19.44.33.75.33.36 0 .67-.12.91-.34.24-.2.4-.48.5-.76.22-.55.29-1.25.3-1.9a14.73 14.73 0 0 0-.13-2h.51a2.5 2.5 0 0 0 2.46-2.96l-.46-2.42Z' %3E%3C/path%3E%3C/svg%3E", FILLED_STAR_SVG: "data:image/svg+xml,%3Csvg class='image star-rating' width='24' height='24' viewBox='0 0 24 24' fill='%230078D4' stroke='%230078D4' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 .587l3.668 7.57 8.332 1.228-6.038 5.938 1.425 8.283L12 18.617l-7.387 4.012 1.425-8.283-6.038-5.938 8.332-1.228z'/%3E%3C/svg%3E", UNFILLED_STAR_SVG: "data:image/svg+xml,%3Csvg class='image star-rating' width='24' height='24' viewBox='0 0 24 24' fill='white' stroke='%230078D4' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 .587l3.668 7.57 8.332 1.228-6.038 5.938 1.425 8.283L12 18.617l-7.387 4.012 1.425-8.283-6.038-5.938 8.332-1.228z'/%3E%3C/svg%3E" }; /** * BotFramework-WebChat notification levels */ var NotificationLevel = { ERROR: 'error', WARN: 'warn', INFO: 'info', SUCCESS: 'success' }; /** * Gets all set cookie values, if available. * @returns {Record | null} All cookie values. */ var getAllCookies = function getAllCookies() { /** @type {Record} */ var cookies = {}; document.cookie.split('; ').forEach(function (pair) { var separatorIndex = pair.indexOf('='); if (separatorIndex !== -1) { var key = pair.slice(0, separatorIndex); var value; try { value = decodeURIComponent(pair.slice(separatorIndex + 1)); } catch (error) { console.error("Error decoding cookie value: " + error); return; } cookies[key] = value; } }); if (Object.keys(cookies).length > 0) { return cookies; } return null; }; /** * Gets a set cookie value for the key provided, if available. * @param {string} key Cookie key. * @returns {string | null} Cookie value, or null. */ var getCookie = function getCookie(key) { var cookies; try { cookies = getAllCookies(); } catch (error) { console.error("Error getting all cookies: " + error); return null; } if (cookies && typeof cookies === 'object') { var value = cookies[key]; if (value !== undefined) { return value; } } return null; }; /** * Sets a cookie with the provided key and value. * @param {string} key Cookie key. * @param {string} value Cookie value. * @param {number} [expiryDays] Number of days before the cookie expires. * @param {string} [domain] Domain for the cookie. * @param {boolean} [secure] Whether the cookie is secure. * @param {boolean} [httpOnly] Whether the cookie is HTTP only. * @param {string} [sameSite] SameSite attribute for the cookie. */ var setCookie = function setCookie(key, value, expiryDays, domain, secure, httpOnly, sameSite, path) { if (secure === void 0) { secure = CookieConstants.secure; } if (httpOnly === void 0) { httpOnly = false; } if (sameSite === void 0) { sameSite = CookieConstants.sameSite; } if (path === void 0) { path = CookieConstants.path; } if (typeof key !== 'string' || typeof value !== 'string' || typeof expiryDays !== 'number' || domain && typeof domain !== 'string') { throw new Error('Error setting cookie: Invalid parameters.'); } var expiryDate = null; if (expiryDays > -1) { expiryDate = new Date(); expiryDate.setTime(expiryDate.getTime() + expiryDays * 24 * 60 * 60 * 1000); } var cookieValue = key + "=" + encodeURIComponent(value); var expiryString = expiryDate ? ";expires=" + expiryDate.toUTCString() : ''; var domainString = domain ? ";domain=" + domain : ''; var secureString = secure ? ';secure' : ''; var httpOnlyString = httpOnly ? ';httponly' : ''; var sameSiteString = ";samesite=" + sameSite; var pathString = ";path=" + path; // eslint-disable-next-line unicorn/no-document-cookie document.cookie = cookieValue + expiryString + domainString + secureString + httpOnlyString + sameSiteString + pathString; }; /** * AI Chat Drawer */ var _UMP_HTML_TEMPLATE = /*#__PURE__*/_classPrivateFieldLooseKey("UMP_HTML_TEMPLATE"); var _setDefaultValuesInMarkup = /*#__PURE__*/_classPrivateFieldLooseKey("setDefaultValuesInMarkup"); var _setDefaultValuesAiChatButton = /*#__PURE__*/_classPrivateFieldLooseKey("setDefaultValuesAiChatButton"); var _addEventHandlers = /*#__PURE__*/_classPrivateFieldLooseKey("addEventHandlers"); var _initUhfIntersectionObserver = /*#__PURE__*/_classPrivateFieldLooseKey("initUhfIntersectionObserver"); var _initStickyNavMutationObserver = /*#__PURE__*/_classPrivateFieldLooseKey("initStickyNavMutationObserver"); var _initWebChatTranscriptObserver = /*#__PURE__*/_classPrivateFieldLooseKey("initWebChatTranscriptObserver"); var _positionAiChatButton = /*#__PURE__*/_classPrivateFieldLooseKey("positionAiChatButton"); var _positionAiChatDrawer = /*#__PURE__*/_classPrivateFieldLooseKey("positionAiChatDrawer"); var _resetSourceSiteUpdatePromise = /*#__PURE__*/_classPrivateFieldLooseKey("resetSourceSiteUpdatePromise"); var _regenerateAIChatDrawerToken = /*#__PURE__*/_classPrivateFieldLooseKey("regenerateAIChatDrawerToken"); var _generateDirectLineToken = /*#__PURE__*/_classPrivateFieldLooseKey("generateDirectLineToken"); var _refreshDirectLineToken = /*#__PURE__*/_classPrivateFieldLooseKey("refreshDirectLineToken"); var _setRefreshTimer = /*#__PURE__*/_classPrivateFieldLooseKey("setRefreshTimer"); var _getLocale = /*#__PURE__*/_classPrivateFieldLooseKey("getLocale"); var _initializeJsonPollock = /*#__PURE__*/_classPrivateFieldLooseKey("initializeJsonPollock"); var _handlePageOpenState = /*#__PURE__*/_classPrivateFieldLooseKey("handlePageOpenState"); var _getSourceSite = /*#__PURE__*/_classPrivateFieldLooseKey("getSourceSite"); var _getLPEndpoint = /*#__PURE__*/_classPrivateFieldLooseKey("getLPEndpoint"); var _getLivePersonIdFromJWT = /*#__PURE__*/_classPrivateFieldLooseKey("getLivePersonIdFromJWT"); var AIChatDrawer = /*#__PURE__*/function () { /** * Create an AIChatDrawer instance * @param {Object} opts - The AI Chat Drawer options. * @param {HTMLElement} opts.el - The chat drawer element. */ function AIChatDrawer(_ref) { var _this = this, _this$aiChatButton, _this$getAIChatDrawer, _this$getAIChatDrawer2, _this$getAIChatDrawer3, _this$getAIChatDrawer4; var _el = _ref.el, styleOptions = _ref.styleOptions; Object.defineProperty(this, _getLivePersonIdFromJWT, { value: _getLivePersonIdFromJWT2 }); Object.defineProperty(this, _getLPEndpoint, { value: _getLPEndpoint2 }); Object.defineProperty(this, _getSourceSite, { value: _getSourceSite2 }); Object.defineProperty(this, _handlePageOpenState, { value: _handlePageOpenState2 }); Object.defineProperty(this, _initializeJsonPollock, { value: _initializeJsonPollock2 }); Object.defineProperty(this, _getLocale, { value: _getLocale2 }); Object.defineProperty(this, _setRefreshTimer, { value: _setRefreshTimer2 }); Object.defineProperty(this, _refreshDirectLineToken, { value: _refreshDirectLineToken2 }); Object.defineProperty(this, _generateDirectLineToken, { value: _generateDirectLineToken2 }); Object.defineProperty(this, _regenerateAIChatDrawerToken, { value: _regenerateAIChatDrawerToken2 }); Object.defineProperty(this, _resetSourceSiteUpdatePromise, { value: _resetSourceSiteUpdatePromise2 }); Object.defineProperty(this, _positionAiChatDrawer, { value: _positionAiChatDrawer2 }); Object.defineProperty(this, _positionAiChatButton, { value: _positionAiChatButton2 }); Object.defineProperty(this, _initWebChatTranscriptObserver, { value: _initWebChatTranscriptObserver2 }); Object.defineProperty(this, _initStickyNavMutationObserver, { value: _initStickyNavMutationObserver2 }); Object.defineProperty(this, _initUhfIntersectionObserver, { value: _initUhfIntersectionObserver2 }); Object.defineProperty(this, _addEventHandlers, { value: _addEventHandlers2 }); Object.defineProperty(this, _setDefaultValuesAiChatButton, { value: _setDefaultValuesAiChatButton2 }); Object.defineProperty(this, _setDefaultValuesInMarkup, { value: _setDefaultValuesInMarkup2 }); Object.defineProperty(this, _UMP_HTML_TEMPLATE, { writable: true, value: "
\n \n \n
" }); this.replaceButtonContentWithStarSvg = function (el) { var button = el.querySelector('button'); if (!button) return; el.classList.add(ClassName$q.SURVEY_RESPONSE_BUTTON_STAR); button.innerHTML = ''; var img = document.createElement('img'); img.src = FEEDBACK_ICON_SVGS.UNFILLED_STAR_SVG; img.alt = 'Star'; button.append(img); button.addEventListener(EventName$A.CLICK, _this.handleStarClick); }; this.handleStarClick = function (event) { event.preventDefault(); // Get all star buttons within the closest WEB_CHAT_BUBBLE_CONTENT parent var parent = event.currentTarget.closest(Selector$A.WEB_CHAT_BUBBLE_CONTENT); if (!parent) return; var starDivs = Array.from(parent.querySelectorAll(Selector$A.SURVEY_RESPONSE_STAR_SVG)); // Get the index of the clicked star var clickedStar = event.currentTarget.closest(Selector$A.SURVEY_RESPONSE_STAR_SVG); var clickedIndex = starDivs.indexOf(clickedStar); // Update the star ratings visually starDivs.forEach(function (div, index) { var btn = div.querySelector('button'); var img = btn.querySelector('img'); if (img) { img.src = index <= clickedIndex ? FEEDBACK_ICON_SVGS.FILLED_STAR_SVG : FEEDBACK_ICON_SVGS.UNFILLED_STAR_SVG; } }); }; this.tryAddSurveyButtonTelemetry = function (el, attempts, forStarButtons) { if (attempts === void 0) { attempts = 0; } if (forStarButtons === void 0) { forStarButtons = false; } var button = el.querySelector('button'); var parentBubble = el.closest(Selector$A.WEB_CHAT_BUBBLE_CONTENT); var text = parentBubble == null ? void 0 : parentBubble.querySelector('.webchat__text-content p'); if (text && button) { var buttonValue = button.getAttribute('title'); button.dataset.biHn = text.textContent; button.dataset.biCN = forStarButtons ? buttonValue + " star rating button" : "" + buttonValue; button.dataset.biId = 'ai-chat-drawer'; } else if (attempts < 3) { setTimeout(function () { return _this.tryAddSurveyButtonTelemetry(el, attempts + 1, forStarButtons); }, 100); } }; this.tryReplaceButtonwithStarSVG = function (el, attempts) { if (attempts === void 0) { attempts = 0; } var parent = el.closest(Selector$A.WEB_CHAT_BUBBLE_CONTENT); if (parent) { var requiresStarReplacement = parent.dataset.requiresStarReplacement === 'true'; if (requiresStarReplacement) { _this.replaceButtonContentWithStarSvg(el); _this.tryAddSurveyButtonTelemetry(el, 0, true); } } else if (attempts < 3) { setTimeout(function () { return _this.tryReplaceButtonwithStarSVG(el, attempts + 1); }, 100); } }; this.onAfterElementRenderedHandler = function (element, template) { // If the element is a button and post-survey is enabled, process it if (template.type === window.JsonPollock.TEMPLATE_TYPES.BUTTON && _this.isPostSurveyEnabled) { _this.tryAddSurveyButtonTelemetry(element, 0, false); _this.tryReplaceButtonwithStarSVG(element); } return element; }; this.el = _el; this.styleOptions = styleOptions || AIChatDrawerStyleOptions; this.closeButton = this.el.querySelector(Selector$A.CLOSE_BUTTON); this.webChatContainer = this.el.querySelector(Selector$A.WEB_CHAT_CONTAINER); this.aiChatButton = document.querySelector(Selector$A.AI_CHAT_BUTTON); this.aiChatButtonHeader = document.querySelector(Selector$A.AI_CHAT_BUTTON_HEADER_TEXT); this.aiChatButtonAnchor = document.querySelector(Selector$A.AI_CHAT_BUTTON_ANCHOR); this.aiChatButtonDataMount = (_this$aiChatButton = this.aiChatButton) == null ? void 0 : _this$aiChatButton.querySelector(Selector$A.AI_CHAT_BUTTON_DATA_MOUNT); this.headerControls = this.el.querySelector(Selector$A.HEADER_CONTROLS); this.aiDisclaimerDiv = null; this.previouslyFocusedElem = null; this.firstFocusableElem = this.closeButton; this.lastFocusableElem = null; this.webChatTextAreaHadFocus = false; this.chatInitialized = false; this.refreshBefore = 120; // Refresh 2 minutes before token expires this.refreshAfter = 3480; // Refresh if token is older than 58 minutes this.tokenEndpoint = this.el.dataset.tokenEndpoint; this.tokenEndpointV2 = this.el.dataset.tokenEndpointV2; this.botEnvironmentParameter = this.el.dataset.botEnvironmentParameter; this.v2PagePaths = (this.el.dataset.v2PagePaths || '').split(',').map(function (s) { return s.trim(); }).filter(Boolean); this.refreshTokenUrl = this.el.dataset.refreshTokenUrl; this.sourceSite = _classPrivateFieldLooseBase(this, _getSourceSite)[_getSourceSite](); this.tuid = null; this.initialChatTextDelay = 2000; // 2 seconds this.messageWaitTimeout = null; this.messageWaitTimeoutDuration = 100000; // 100 seconds // Promise that will be resolved when the sourceSite update is detected this.resolveSourceSiteUpdate = null; this.sourceSiteUpdatePromise = null; _classPrivateFieldLooseBase(this, _resetSourceSiteUpdatePromise)[_resetSourceSiteUpdatePromise](); this.textInputPlaceholder = this.el.dataset.textInputPlaceholder || 'Ask a work question or make a request...'; this.isChatPersistEnabled = this.el.dataset.isChatPersistEnabled === 'true'; this.isInstantiatedByProactiveChat = false; this.drawerTitleText = this.el.querySelector(Selector$A.BLOCK_FEATURE_TITLE).textContent || 'AI-powered assistant'; this.drawerLivePersonTitleText = this.el.dataset.drawerLivePersonTitleText || '[Live Agent] AI-powered assistant'; this.buttonTitleText = this.aiChatButton.querySelector(Selector$A.AI_CHAT_BUTTON_TEXT + " span").textContent || 'AI-powered assistant'; // button and drawer currently have same text, including for flexibility. this.buttonLivePersonTitleText = this.el.dataset.buttonLivePersonTitleText || '[Live Agent] AI-powered assistant'; this.connectivityStatusAltFatalString = this.el.dataset.connectivityStatusAltFatal || 'Please refresh the page.'; this.livePersonInQueueText = this.el.dataset.livePersonInQueueText || 'Connecting you to a live agent. Please wait.'; this.livePersonUserClosedConversationText = this.el.dataset.livePersonUserClosedConversationText || 'Conversation closed by you'; this.livePersonAgentClosedConversationText = this.el.dataset.livePersonAgentClosedConversationText || 'Conversation closed by agent'; this.livePersonSystemClosedConversationText = this.el.dataset.livePersonSystemClosedConversationText || 'Conversation closed by idle system'; this.livePersonDisclaimerText = this.el.dataset.livePersonDisclaimerText || 'You are now chatting with a live agent.'; this.livePersonGenericErrorText = this.el.dataset.livePersonGenericErrorText || 'An error occurred. Please try again later.'; this.surveyBotDisclaimerText = this.el.dataset.surveyBotDisclaimerText || 'You are now chatting with a survey bot.'; this.livePersonNoAgentsText = this.el.dataset.noAgentsText || 'No agents are available to chat.'; this.livePersonSurveyCloseMessage = this.el.dataset.livePersonSurveyCloseMessage || 'Thank you for your time'; this.livePersonReadText = this.el.dataset.readText || 'Read'; this.returnToAiChatText = this.el.dataset.returnToAiChatText || 'End live chat'; this.livePersonDisconnectedReconnectingText = this.el.dataset.livePersonDisconnectedReconnectingText || 'You have been disconnected from live agent. Attempting to reconnect...'; this.livePersonReconnectedText = this.el.dataset.livePersonReconnectedText || 'Reconnected to live agent. You can continue your conversation.'; this.livePersonSendingMessageText = this.el.dataset.livePersonSendingMessageText || 'Sending'; this.livePersonSendFailedText = this.el.dataset.livePersonSendFailedText || 'Send failed.'; this.retryButtonText = this.el.dataset.retryButtonText || 'Retry'; this.transcriptIntroText = this.el.dataset.livePersonTranscriptIntroText || '**FULL CONVERSATION TRANSCRIPT:**'; this.transcriptContinuedText = this.el.dataset.livePersonTranscriptContinuedText || '**FULL CONVERSATION TRANSCRIPT (CONTINUED):**'; this.transcriptFromUserText = this.el.dataset.livePersonTranscriptFromUserText || '**User:**'; this.transcriptFromAssistantText = this.el.dataset.livePersonTranscriptFromAssistantText || '**Assistant:**'; this.aiDisclaimerText = this.el.dataset.aiDisclaimer || 'AI-generated content may be incorrect'; this.closeButtonAriaLabel = this.headerControls ? this.headerControls.getAttribute('aria-label') : 'Close Dialog'; this.chatDrawerAriaLabel = this.el.getAttribute('aria-label') || 'Chatbot Window'; this.livePersonMessageCharLimit = 8000; // LivePerson message character limit this.store = null; this.webChatInstance = null; this.webChatSendBox = null; this.webChatForm = null; this.webChatTextarea = null; this.webChatSendButton = null; this.webChatMaximumCharacters = 250; // Maximum number of chars user can type in web chat this.uhfHeaderElem = document.querySelector(Selector$A.UHF_HEADER); this.uhfNavMenuExpandElem = document.querySelector(Selector$A.UHF_MENU_NAV_EXPAND_ELEM); this.uhfHeaderIntersectionObserver = null; this.uhfHeaderIsVisible = true; // Flag to check if the UHF header is visible this.hideChatBelowHeight = 349.9; // Hide chat below 350px height this.mediaQueryListChatHidden = window.matchMedia("(max-height: " + this.hideChatBelowHeight + "px)"); this.modalDialogBelowWidth = 599.9; // Chat drawer becomes modal dialog below this width this.mediaQueryListModalDialog = window.matchMedia("(max-width: " + this.modalDialogBelowWidth + "px)"); this.uhfFooterElem = document.querySelector(Selector$A.UHF_FOOTER); this.uhfFooterOriginalPadding = this.uhfFooterElem ? window.getComputedStyle(this.uhfFooterElem, null).getPropertyValue('padding-bottom') : ''; this.debouncedResizeDelay = 250; this.stickyNavElem = document.querySelector(Selector$A.STICKY_NAV); this.stickyNavMutationObserver = null; this.botGeneratingResponseText = this.el.dataset.botGeneratingResponseText || 'Generating a response'; this.botFeedbackPositiveAriaLabel = this.el.dataset.botFeedbackPositiveAriaLabel || 'Thumbs up'; this.botFeedbackNegativeAriaLabel = this.el.dataset.botFeedbackNegativeAriaLabel || 'Thumbs down'; this.chatActionTypeLinks = document.querySelectorAll(Selector$A.CHAT_ACTION_TYPE_LINK); this.chatActionTypeLinkText = this.el.dataset.chatActionTypeLinkText || 'Chat with sales'; // LivePerson this.dataConnectorBaseEndpoint = getDataConnectorBaseEndpoint('https:'); this.accountId = null; this.skillId = null; this.isSendTranscript = false; this.corsBypassQueryStringObj = null; // Only applies to local and preview environments this.lpJWT = null; this.lpSession = null; this.lpMessages = {}; this.startLPChatActivityIds = (_this$getAIChatDrawer = (_this$getAIChatDrawer2 = this.getAIChatDrawerCookieObject()) == null ? void 0 : _this$getAIChatDrawer2[StorageKeys.startLPChatActivityIds]) != null ? _this$getAIChatDrawer : []; this.lpOpenConvs = (_this$getAIChatDrawer3 = (_this$getAIChatDrawer4 = this.getAIChatDrawerCookieObject()) == null ? void 0 : _this$getAIChatDrawer4[StorageKeys.lpOpenConvs]) != null ? _this$getAIChatDrawer3 : {}; this.lpSubscriptionId = null; this.lpSubscribedToMessagingEvents = false; // Flag to check if subscribed to messaging events this.curLpChangeSequence = 0; // Keep track of the current change sequence this.lpWebsocket = null; this.isLivePersonChatActive = false; this.isLivePersonAgentAssigned = false; this.isSurveyTextActionPublished = false; this.isPostSurveyEnabled = false; this.isLivePersonChatFeatureEnabled = this.el.dataset.isLPEnabled || false; this.lpSurveyForcedClosed = false; this.debouncedChatStateToComposing = debounce(livePersonUserComposingDelay, this.chatStateToComposing.bind(this), { atBegin: true }); this.debouncedChatStateToPause = debounce(livePersonUserPauseDelay, this.chatStateToPause.bind(this)); this.handleLpUserInput = this.handleLpUserInput.bind(this); this.debouncedOnChatActionTypeLinkClick = debounce(debouncedChatActionTypeLinkClickDelay, this.onChatActionTypeLinkClick.bind(this), { atBegin: true }); _classPrivateFieldLooseBase(this, _addEventHandlers)[_addEventHandlers](); _classPrivateFieldLooseBase(this, _initUhfIntersectionObserver)[_initUhfIntersectionObserver](); _classPrivateFieldLooseBase(this, _initStickyNavMutationObserver)[_initStickyNavMutationObserver](); _classPrivateFieldLooseBase(this, _positionAiChatButton)[_positionAiChatButton](); _classPrivateFieldLooseBase(this, _positionAiChatDrawer)[_positionAiChatDrawer](); this.onMediaQueryListChatHiddenChange(this.mediaQueryListChatHidden); this.onMediaQueryListModalDialogChange(this.mediaQueryListModalDialog); _classPrivateFieldLooseBase(this, _handlePageOpenState)[_handlePageOpenState](); // These text areas will have their text content adjusted during Live Person connection/disconnection events. During these events, we already // push screen-reader accessible messages, so we want to turn off the aria-live regions for these two elements to avoid "double speaking". this.aiChatButton.querySelector(Selector$A.AI_CHAT_BUTTON_TEXT + " span").setAttribute('aria-live', 'off'); this.el.querySelector(Selector$A.BLOCK_FEATURE_TITLE).setAttribute('aria-live', 'off'); aiChatDrawers.push(this); _classPrivateFieldLooseBase(this, _setDefaultValuesInMarkup)[_setDefaultValuesInMarkup](); } /** * Universal Media Player Template */ var _proto = AIChatDrawer.prototype; /** * Pushes click handlers to events array for each chat action type link. This is used to add event handlers * to the chat action type links in the markup. Returns the added events list. * * @returns {Array.<{ * el: Element | Document | Window, * handler: Function, * type: String, * options?: Object * }>} The events added to events array of the component. */ _proto.addChatActionTypeLinkEvents = function addChatActionTypeLinkEvents() { var _this2 = this; var eventsToAdd = []; this.chatActionTypeLinks.forEach(function (element) { var _this2$events; // Clone the element so legacy event handlers are not bound to it var newNode = element.cloneNode(true); // remove data-oc-chat which is used by legacy chat script newNode.removeAttribute(Attributes$5.CHAT_ACTION_TYPE_LINK); // add data-oc-ai-chat to identify this as an AI chat button newNode.setAttribute(Attributes$5.AI_CHAT_ACTION_TYPE_LINK, ''); newNode.setAttribute('aria-controls', 'ai-chat-drawer'); // legacy chat script sets style display none until chat is initialized if (newNode.style.display === 'none') { newNode.style.removeProperty('display'); } eventsToAdd.push({ el: newNode, handler: _this2.debouncedOnChatActionTypeLinkClick, type: EventName$A.CLICK }); if (newNode.tagName !== 'BUTTON') { eventsToAdd.push({ el: newNode, handler: _this2.debouncedOnChatActionTypeLinkClick, type: EventName$A.KEYDOWN }); } (_this2$events = _this2.events).push.apply(_this2$events, eventsToAdd); element.replaceWith(newNode); }); return eventsToAdd; } /** Check if the Direct Line token is valid. * @returns {boolean} Whether the Direct Line token is valid. */; _proto.hasValidToken = function hasValidToken() { var cookieObj = this.getAIChatDrawerCookieObject(); if (typeof cookieObj !== 'object' || cookieObj === null) { return false; } var token = cookieObj[StorageKeys.token]; var tokenCreated = cookieObj[StorageKeys.tokenCreated]; var currentTime = Date.now() / 1000; if (isNaN(tokenCreated)) { return false; } // I used OR logic here to check for bad cases, but it could be easily flipped to AND logic. return !(!token || token === 'undefined' || currentTime - tokenCreated > this.refreshAfter); } /* * Deletes the Chat Drawer Cookie and calls the generate Direct Line token to * Re-establish the cookie. Used when a cookie needs to be force-refreshed. */; /** * Handle click on AI Chat Button * @param {Event} event Click or keydown event on AI Chat Button */ _proto.onAiChatButtonClick = function onAiChatButtonClick(event) { // return if event type is keydown and key is not enter or space bar if (event.type === EventName$A.KEYDOWN && Util$1.getKeyCode(event) !== Util$1.keyCodes.ENTER && Util$1.getKeyCode(event) !== Util$1.keyCodes.SPACE) { return; } event.preventDefault(); event.stopPropagation(); this.chatOpenOrInit(); } /** * Handle keydown event on the AI Chat Drawer. If the tab key is pressed, loop focus between the first and last focusable * elements in the drawer. Note this will not work for mobile screen readers, a different approach will be needed. * @param {KeyboardEvent} event Keydown event on the AI Chat Drawer * @returns {void} */; _proto.onKeyDown = function onKeyDown(event) { if (!this.el.contains(document.activeElement) || Util$1.getKeyCode(event) !== Util$1.keyCodes.TAB) { return; } if ((document.activeElement === this.firstFocusableElem || document.activeElement === this.el) && event.shiftKey) { event.preventDefault(); this.lastFocusableElem.focus(); return; } if (document.activeElement === this.lastFocusableElem && !event.shiftKey) { event.preventDefault(); this.firstFocusableElem.focus(); } } /** * Handles the keydown event on the document. * If the key combination is Ctrl + F6 and the element is not hidden, it performs the necessary focus actions. * If the active element is within the component, it focuses on the search input or the first focusable element in the main content. * If the active element is outside the component, it restores the previously focused element. * @param {KeyboardEvent} event The keydown event on the document */; _proto.onDocumentKeyDown = function onDocumentKeyDown(event) { if (!(event.ctrlKey && event.key === 'F6') || this.el.hidden) { return; } if (this.el.contains(document.activeElement)) { var _this$previouslyFocus; if (this.previouslyFocusedElem === document.body || ((_this$previouslyFocus = this.previouslyFocusedElem) == null ? void 0 : _this$previouslyFocus.offsetParent) === null) { var main = document.querySelector(Selector$A.MAIN_CONTENT); var firstFocusableElemInMain = main == null ? void 0 : main.querySelector(Selector$A.FOCUSABLE_ELEMENTS); firstFocusableElemInMain == null ? void 0 : firstFocusableElemInMain.focus(); } else { this.previouslyFocusedElem.focus(); } } else { this.previouslyFocusedElem = document.activeElement; this.webChatTextarea.focus(); } } /** * Handles the click event on a chat action type link. * Prevents the default action and initializes or opens the chat based on its current state. * If the event type is 'keydown', it only proceeds if the key pressed is 'Enter' or 'Space'. * * @param {Event} event - The event object representing the click or keydown event. */; _proto.onChatActionTypeLinkClick = function onChatActionTypeLinkClick(event) { // return if event type is keydown and key is not enter or space bar if (event.type === EventName$A.KEYDOWN && Util$1.getKeyCode(event) !== Util$1.keyCodes.ENTER && Util$1.getKeyCode(event) !== Util$1.keyCodes.SPACE) { return; } event.preventDefault(); this.chatOpenOrInit(this.chatActionTypeLinkText); } /** * Render the BotFramework Web Chat. */; _proto.renderWebChat = function renderWebChat() { window.WebChat.renderWebChat({ locale: _classPrivateFieldLooseBase(this, _getLocale)[_getLocale](), directLine: this.directLine, sendTypingIndicator: true, store: this.store, styleOptions: this.styleOptions, overrideLocalizedStrings: { TEXT_INPUT_PLACEHOLDER: this.textInputPlaceholder, CONNECTIVITY_STATUS_ALT_FATAL: this.connectivityStatusAltFatalString } }, this.webChatContainer); } /** * Display or update a toast style notification at the top of the chat drawer. * Documentation for BotFramework-WebChat notifications: * https://github.com/microsoft/BotFramework-WebChat/blob/main/docs/NOTIFICATION.md * * @param {string} messageText The text to display in the notification * @param {string} notificationLevel The level of the notification (error, warn, info, success. Default is 'info') * @param {string} notificationId The ID of the notification (optional) * @param {string} altText The alternative text for the notification (optional. Use if the message contains HTML) * * @returns {string} The notification ID */; _proto.setNotification = function setNotification(messageText, notificationLevel, notificationId, altText) { if (notificationLevel === void 0) { notificationLevel = NotificationLevel.INFO; } if (notificationId === void 0) { notificationId = ''; } if (altText === void 0) { altText = ''; } if (!this.store) { console.error('Unable to display notification. BotFramework-WebChat store not found.'); return; } notificationId = notificationId || window.crypto.randomUUID(); var notificationObj = { type: 'WEB_CHAT/SET_NOTIFICATION', payload: { id: notificationId, level: notificationLevel, message: messageText } }; if (altText) { notificationObj.payload.alt = altText; } this.store.dispatch(notificationObj); return notificationId; } /** * Dismisses a notification by its ID. * * This method dispatches an action to the BotFramework-WebChat store to remove a notification. * If the store is not available, it logs an error message. * * @param {string} id - The ID of the notification to dismiss. */; _proto.dismissNotification = function dismissNotification(id) { if (!this.store) { console.error('Unable to dismiss notification. BotFramework-WebChat store not found.'); return; } this.store.dispatch({ type: 'WEB_CHAT/DISMISS_NOTIFICATION', payload: { id: id } }); } /** * Check for LivePerson agent availability * * @returns {Promise} Response from the fetch call */ /* eslint-disable no-await-in-loop */; _proto.checkLivePersonAgentAvailability = /*#__PURE__*/ function () { var _checkLivePersonAgentAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(retries, delay) { var checkAgentAvailabilityEndpoint, headers, options, attempt, response, jsonResponse; return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: if (retries === void 0) { retries = 3; } if (delay === void 0) { delay = 1000; } checkAgentAvailabilityEndpoint = _classPrivateFieldLooseBase(this, _getLPEndpoint)[_getLPEndpoint](this.dataConnectorBaseEndpoint, 'liveperson/v1/check'); headers = new Headers(); headers.append('Content-Type', 'application/json'); options = { method: 'POST', headers: headers, body: JSON.stringify({ metadata: { skillId: this.skillId } }) }; attempt = 1; case 7: if (!(attempt <= retries)) { _context.next = 34; break; } _context.prev = 8; _context.next = 11; return fetch(checkAgentAvailabilityEndpoint, options); case 11: response = _context.sent; if (response.ok) { _context.next = 14; break; } throw new Error("Error checking LivePerson agent availability. Response status: " + response.status); case 14: _context.next = 16; return response.json(); case 16: jsonResponse = _context.sent; return _context.abrupt("return", jsonResponse.availability); case 20: _context.prev = 20; _context.t0 = _context["catch"](8); console.error("Attempt " + attempt + " failed: " + _context.t0.message); if (!(attempt < retries)) { _context.next = 28; break; } _context.next = 26; return new Promise(function (resolve) { return setTimeout(resolve, delay); }); case 26: _context.next = 31; break; case 28: this.setNotification(this.livePersonGenericErrorText, NotificationLevel.ERROR); console.error('All retry attempts failed.'); throw _context.t0; case 31: attempt++; _context.next = 7; break; case 34: case "end": return _context.stop(); } } }, _callee, this, [[8, 20]]); })); function checkLivePersonAgentAvailability(_x, _x2) { return _checkLivePersonAgentAvailability.apply(this, arguments); } return checkLivePersonAgentAvailability; }() /* eslint-enable no-await-in-loop */ /** * Get the lead ID based on the current page's origin and pathname. * @returns {string} The generated lead ID. */ ; _proto.getLeadId = function getLeadId() { return window.location.origin + window.location.pathname; } /** * Creates or updates a live-person engagement session for current client * @returns live-person engagement session create response */; _proto.createLivePersonSession = /*#__PURE__*/ function () { var _createLivePersonSession = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() { var _window$oc$geo$countr, _window$oc, _window$oc$geo, _document$querySelect, _window$oc$lp$topic, _window$oc2, _window$oc2$lp; var country, topic, leadId, ipAddress, cookieObject, localSession, isCreatingSession, requestData, callOptions, isSessionUpdated, result, _result, _this$updateAIChatDra; return _regeneratorRuntime().wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: country = (_window$oc$geo$countr = (_window$oc = window.oc) == null ? void 0 : (_window$oc$geo = _window$oc.geo) == null ? void 0 : _window$oc$geo.country) != null ? _window$oc$geo$countr : (_document$querySelect = document.querySelector('[data-geo-country]')) == null ? void 0 : _document$querySelect.getAttribute('data-geo-country'); topic = (_window$oc$lp$topic = (_window$oc2 = window.oc) == null ? void 0 : (_window$oc2$lp = _window$oc2.lp) == null ? void 0 : _window$oc2$lp.topic) != null ? _window$oc$lp$topic : ''; leadId = this.getLeadId(); ipAddress = ''; // TODO - Get ip-address cookieObject = this.getAIChatDrawerCookieObject(); localSession = cookieObject[StorageKeys.lpSession]; isCreatingSession = false; requestData = { account: this.accountId, country: country, topic: topic, leadId: leadId, ipAddress: ipAddress, pageId: null, visitorId: null, sessionId: null }; // Check if session already exists and matches with current if (!(localSession && localSession.pageId && localSession.visitorId && localSession.sessionId)) { _context2.next = 16; break; } if (!(localSession.topic === topic && localSession.leadId === leadId && localSession.country === country)) { _context2.next = 11; break; } return _context2.abrupt("return", localSession); case 11: requestData.pageId = localSession.pageId; requestData.visitorId = localSession.visitorId; requestData.sessionId = localSession.sessionId; _context2.next = 17; break; case 16: isCreatingSession = true; case 17: callOptions = { // Arguments must be in order of the calling function args: [requestData] }; _context2.prev = 18; isSessionUpdated = false; if (isCreatingSession) { _context2.next = 25; break; } _context2.next = 23; return LPUtils.exponentialBackoff(LPUtils.engagement.updateSession, function (response) { if (response > 499) { // Retry in case of server-side issue from live-person return true; } return false; }, callOptions); case 23: result = _context2.sent; isSessionUpdated = result === 200; case 25: if (isSessionUpdated) { _context2.next = 33; break; } // Clear out any existing session data requestData.pageId = null; requestData.visitorId = null; requestData.sessionId = null; _context2.next = 31; return LPUtils.exponentialBackoff(LPUtils.engagement.createSession, function (response, error, options) { if (!response && !error) { // Set retry flag to true return true; } // Check if current response contains the session id and visitor id if (response.sessionId && response.visitorId) { // Set retry flag to false as we have received the success response return false; // this will return the create session results back via `exponentialBackoff` } var errorMessage = (error == null ? void 0 : error.message) || (response == null ? void 0 : response.message); if (errorMessage) { // Extract the visitor id and retry var _errorMessage$split = errorMessage.split('vid: '), vid = _errorMessage$split[1]; if (vid) { // Update the args - need to add the visitor id if it is provided when retrying a 5xx response requestData.visitorId = vid; options.args = [requestData]; } console.warn('[LP] received error while trying to create session:', error || response, vid); } // Set retry flag to true return true; }, callOptions); case 31: _result = _context2.sent; if (_result.visitorId && _result.sessionId) { requestData.pageId = _result.pageId; requestData.visitorId = _result.visitorId; requestData.sessionId = _result.sessionId; // Update cookie with the LivePerson session this.updateAIChatDrawerCookie((_this$updateAIChatDra = {}, _this$updateAIChatDra[StorageKeys.lpSession] = requestData, _this$updateAIChatDra)); } case 33: _context2.next = 38; break; case 35: _context2.prev = 35; _context2.t0 = _context2["catch"](18); console.error('[LP] failed to create lp-engagement session:', _context2.t0); case 38: return _context2.abrupt("return", requestData); case 39: case "end": return _context2.stop(); } } }, _callee2, this, [[18, 35]]); })); function createLivePersonSession() { return _createLivePersonSession.apply(this, arguments); } return createLivePersonSession; }() /** * Get the LivePerson JWT * * @param {number} retryCount The number of retries * * @returns {Promise} The LivePerson JWT */ ; _proto.getLivePersonJWT = /*#__PURE__*/ function () { var _getLivePersonJWT = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(retryCount) { var _this3 = this; var timeoutPromise; return _regeneratorRuntime().wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: if (retryCount === void 0) { retryCount = 0; } timeoutPromise = function timeoutPromise(ms) { return new Promise(function (_, reject) { return setTimeout(function () { return reject(new LPError(LPErrorTypes.GET_JWT_TIMEOUT, 'Getting JWT for LivePerson timed out')); }, ms); }); }; return _context3.abrupt("return", Promise.race([LPUtils.getJWT(this.accountId, this.getAIChatDrawerCookieObject(), StorageKeys.lpJWT), timeoutPromise(livePersonResponseTimeout)])["catch"](function (error) { _this3.handleLivePersonError(error, function (newRetryCount) { return _this3.getLivePersonJWT(newRetryCount); }, retryCount); })); case 3: case "end": return _context3.stop(); } } }, _callee3, this); })); function getLivePersonJWT(_x3) { return _getLivePersonJWT.apply(this, arguments); } return getLivePersonJWT; }() /** * Get the LivePerson UMS domain * * @returns {Promise} The LivePerson UMS domain */ ; _proto.getLivePersonUmsDomain = /*#__PURE__*/ function () { var _getLivePersonUmsDomain = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() { return _regeneratorRuntime().wrap(function _callee4$(_context4) { while (1) { switch (_context4.prev = _context4.next) { case 0: _context4.prev = 0; return _context4.abrupt("return", LPUtils.getDomain(this.accountId, 'asyncMessagingEnt')); case 4: _context4.prev = 4; _context4.t0 = _context4["catch"](0); console.error('Error fetching UMS domain:', _context4.t0); // Handle the error appropriately, e.g., show an error message to the user or retry the operation return _context4.abrupt("return", null); case 8: case "end": return _context4.stop(); } } }, _callee4, this, [[0, 4]]); })); function getLivePersonUmsDomain() { return _getLivePersonUmsDomain.apply(this, arguments); } return getLivePersonUmsDomain; }() /** * Initialize the LivePerson websocket * * @param {string} umsDomain The LivePerson UMS domain * @param {number} retryCount The number of retries * * @returns {Promise} The LivePerson websocket instance */ ; _proto.initLivePersonWebsocket = /*#__PURE__*/ function () { var _initLivePersonWebsocket = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(umsDomain, retryCount) { var _this4 = this; var timeoutPromise; return _regeneratorRuntime().wrap(function _callee5$(_context5) { while (1) { switch (_context5.prev = _context5.next) { case 0: if (retryCount === void 0) { retryCount = 0; } timeoutPromise = function timeoutPromise(ms) { return new Promise(function (_, reject) { return setTimeout(function () { return reject(new LPError(LPErrorTypes.INIT_WS_TIMEOUT, 'Initializing LivePerson websocket timed out')); }, ms); }); }; return _context5.abrupt("return", Promise.race([LPWs.connect("wss://" + umsDomain + "/ws_api/account/" + this.accountId + "/messaging/consumer?v=3"), timeoutPromise(livePersonResponseTimeout)])["catch"](function (error) { _this4.handleLivePersonError(error, function (newRetryCount) { return _this4.initLivePersonWebsocket(umsDomain, newRetryCount); }, retryCount); })); case 3: case "end": return _context5.stop(); } } }, _callee5, this); })); function initLivePersonWebsocket(_x4, _x5) { return _initLivePersonWebsocket.apply(this, arguments); } return initLivePersonWebsocket; }() /** * Get LivePerson Id from JWT * * @returns {string | null} The LivePerson Id */ ; /** * Update the LivePerson agent state in the UI * * @param {string} state The agent state */ _proto.updateAgentState = function updateAgentState(state) { // Designs do not have all states here. We may remove states if not needed. switch (state) { case livePersonChatStateTypes.ACTIVE: { // is in the chat break; } case livePersonChatStateTypes.INACTIVE: { // navigated away but application is still open break; } case livePersonChatStateTypes.GONE: { // closed the chat application break; } case livePersonChatStateTypes.COMPOSING: { // is typing // Dispatch bot typing activity to the store so it renders in the WebChat this.store.dispatch({ type: 'DIRECT_LINE/INCOMING_ACTIVITY', payload: { activity: { type: 'typing', from: { role: 'bot' }, timestamp: new Date().toISOString() } } }); break; } } } /** * Subscribe to LivePerson messaging events * * @param {string} dialogId The dialogId to subscribe to * @param {string} conversationId The conversationId to subscribe to. For main dialog, conversationId and dialogId * are the same. For survey dialog, conversationId and dialogId are different * @param {number} fromSeq The sequence number to start from * @param {number} retryCount The number of retries */; _proto.subscribeToLivePersonMessagingEvents = function subscribeToLivePersonMessagingEvents(dialogId, conversationId, fromSeq, retryCount) { var _this5 = this; if (fromSeq === void 0) { fromSeq = 0; } if (retryCount === void 0) { retryCount = 0; } this.lpWebsocket.subscribeMessagingEvents({ fromSeq: fromSeq, dialogId: dialogId, conversationId: conversationId }).then(function (response) { return _this5.handleLivePersonResponse(response); })["catch"](function (error) { return _this5.handleLivePersonError(error, function (newRetryCount) { return _this5.subscribeToLivePersonMessagingEvents(dialogId, conversationId, fromSeq, newRetryCount); }, retryCount); }); } /** * Handle response from LivePerson websocket. Throw an error if the response code is an error code. * * @param {Response} response The response from the LivePerson API * * @returns {Response} The response from the LivePerson API */; _proto.handleLivePersonResponse = function handleLivePersonResponse(response) { if (response.code >= 400 && response.code < 600) { throw Object.assign(new Error(response.body), { code: response.code }); } else { return response; } } /** * Handles errors from LivePerson API calls with retry logic. * LivePerson Retry Policy Recommendations: https://developers.liveperson.com/retry-policy-recommendations.html * * @param {Object} error - The error object returned from the LivePerson API. * @param {Function} retryCallback - The callback function to retry the API call. * @param {number} [retryCount=0] - The current retry attempt count. * @param {number} [maxRetries=3] - The maximum number of retry attempts. */; _proto.handleLivePersonError = function handleLivePersonError(error, retryCallback, retryCount, maxRetries) { var _this6 = this; if (retryCount === void 0) { retryCount = 0; } if (maxRetries === void 0) { maxRetries = 3; } // Max number of retries hit if (retryCount >= maxRetries) { console.error("Max retries reached for error type " + error.type + ":", error); if (error.type === LPErrorTypes.SEND_MESSAGE_TIMEOUT) { this.handleLivePersonSendMessageTimeout(error.data.messageId); } if (error.type === LPErrorTypes.USER_CLOSE_CONVERSATION_TIMEOUT) { // User atttempted to close conversation, but the request to LP timed out. // Return user to AI Chat so they are not stuck this.returnUIToAIChatBot(); } return; } if (!error.code || error.code >= 400 && error.code < 500) { if (error.code === 429 && typeof retryCallback === 'function') { // Request is being throttled due to rate-limiting // Too many requests, retry after at least 1 second (or 5 seconds for login requests), avoid bursts of requests var retryInterval = 1000; setTimeout(function () { retryCallback(retryCount + 1).then(function (response) { return _this6.handleLivePersonResponse(response); })["catch"](function (error) { return _this6.handleLivePersonError(error, retryCallback, retryCount + 1, maxRetries); }); }, retryInterval); } else { // Handle other types of errors switch (error.type) { case LPErrorTypes.SEND_MESSAGE_TIMEOUT: { // Retry sending the message retryCallback(error.data.messageId, retryCount + 1); break; } case LPErrorTypes.USER_CLOSE_CONVERSATION_TIMEOUT: { // Retry closing the conversation retryCallback(retryCount + 1); break; } case LPErrorTypes.WEBSOCKET_NOT_OPEN: { console.error('LivePerson websocket not open:', error); // Display a generic error message to the user this.setNotification(this.livePersonGenericErrorText, NotificationLevel.ERROR); break; } case LPErrorTypes.ACCEPT_STATUS_TIMEOUT: { // Retry updating the message accept status retryCallback(error.data.sequence, error.data.status, error.data.dialogId, retryCount + 1); break; } default: { console.error('Client-side error:', error); // Display a generic error message to the user this.setNotification(this.livePersonGenericErrorText, NotificationLevel.ERROR); break; } } } } else if (error.code >= 500 && error.code < 600) { // Server error, retry 3 times with 5, 10, 15 second pause between retries var retryDelays = [5000, 10000, 15000]; var delay = retryDelays[Math.min(retryCount, retryDelays.length - 1)]; setTimeout(function () { retryCallback(retryCount + 1).then(function (response) { return _this6.handleLivePersonResponse(response); })["catch"](function (error) { return _this6.handleLivePersonError(error, retryCallback, retryCount + 1, maxRetries); }); }, delay); } } /** * Update the status of a LivePerson message in the chat. For example, "Read" text will appear after * timestamp when the message is read by LivePerson. * * @param {number} sequence The sequence number of the message * @param {string} status The status of the message * @param {string} dialogId The dialogId of the message */; _proto.updateLivePersonMessageStatus = function updateLivePersonMessageStatus(sequence, status, dialogId) { // Get message element var messageElement = this.lpMessages[dialogId + "-" + sequence]; // Return if message element does not exist if (!messageElement) { return; } // Update the accept status messageElement.dataset.acceptStatus = status; switch (status) { case 'ACCEPT': { break; } case 'READ': { this.markMessageAsRead(messageElement); break; } } } /** * Handle LivePerson conversation notifications * * @param {Object} notificationBody The notification body */; _proto.handleLivePersonConversationNotification = function handleLivePersonConversationNotification(notificationBody) { var _this7 = this; notificationBody.changes.forEach(function (change) { var _this7$updateAIChatDr5; // Check if there are no active dialogs open var isConversationOpen = change.result.conversationDetails.state !== LPUtils.conversationStateTypes.CLOSE || change.result.conversationDetails.stage !== LPUtils.conversationStateTypes.CLOSE; // Get active dialog var activeDialog = change.result.conversationDetails.dialogs.find(function (d) { return d.state === LPUtils.conversationStateTypes.OPEN; }); // Check if post survey is enabled _this7.isPostSurveyEnabled = change.result.conversationDetails.state === LPUtils.conversationStateTypes.CLOSE && change.result.conversationDetails.stage === LPUtils.conversationStateTypes.OPEN; // Conversation is closed or there is no active dialog if (!isConversationOpen || !activeDialog) { if (Object.hasOwn(_this7.lpOpenConvs, change.result.convId)) { var _this7$lpWebsocket; // Only show the message if the survey was completed fully by the user if (!_this7.lpSurveyForcedClosed) { var _change$result, _change$result$conver; _this7.webChatSendMessage(_this7.livePersonSurveyCloseMessage, new Date((_change$result = change.result) == null ? void 0 : (_change$result$conver = _change$result.conversationDetails) == null ? void 0 : _change$result$conver.endTs).toISOString(), 'lp-system', null, null, null); } // Cancel the get clock interval (_this7$lpWebsocket = _this7.lpWebsocket) == null ? void 0 : _this7$lpWebsocket.getClockRequest.cancel(); // Cancel debounced chat states _this7.debouncedChatStateToComposing.cancel({ upcomingOnly: true }); _this7.debouncedChatStateToPause.cancel({ upcomingOnly: true }); // Reset the agent state _this7.updateAgentState(livePersonChatStateTypes.DEFAULT); // Unsubscribe from conversation metadata for this subscriptionId _this7.livePersonUnsubscribeExConversations(notificationBody.subscriptionId)["finally"](function () { var _this7$updateAIChatDr; // Reset subscribed to messaging events flag _this7.lpSubscribedToMessagingEvents = false; // Reset the current change sequence _this7.curLpChangeSequence = 0; // Return the UI to AI chat bot _this7.returnUIToAIChatBot(); // Delete the conversation from open conversations metadata object delete _this7.lpOpenConvs[change.result.convId]; // Update the cookie _this7.updateAIChatDrawerCookie((_this7$updateAIChatDr = {}, _this7$updateAIChatDr[StorageKeys.lpOpenConvs] = _this7.lpOpenConvs, _this7$updateAIChatDr)); }); } return; } // Check if this is a notification for a new conversation if (!_this7.lpOpenConvs[change.result.convId]) { var _this7$updateAIChatDr2; // Create and store conversation metadata _this7.lpOpenConvs[change.result.convId] = { result: { convId: change.result.convId, dialogs: change.result.conversationDetails.dialogs.map(function (dialog) { return { dialogId: dialog.dialogId, dialogType: dialog.dialogType }; }) }, activeDialogId: activeDialog.dialogId, chatState: livePersonChatStateTypes.DEFAULT, closeMsgSent: false }; // Update cookie _this7.updateAIChatDrawerCookie((_this7$updateAIChatDr2 = {}, _this7$updateAIChatDr2[StorageKeys.lpOpenConvs] = _this7.lpOpenConvs, _this7$updateAIChatDr2)); // Send event to PVA to record the new Live Person conversation ID to cosmos DB var eventValue = { skillId: _this7.skillId, LPConversationID: change.result.convId }; _this7.webChatSendEvent(EventName$A.LIVEPERSON_SAVE_IDS, eventValue); // Send transcript to LivePerson if user has elected to do so if (_this7.isSendTranscript) { _this7.sendTranscriptToLivePerson(); } // Subscribe to messaging events with active dialog id _this7.subscribeToLivePersonMessagingEvents(activeDialog.dialogId, change.result.convId); _this7.lpSubscribedToMessagingEvents = true; } // Check if there are new dialogs added to this conversation if (change.result.conversationDetails.dialogs.length !== _this7.lpOpenConvs[change.result.convId].result.dialogs.length) { var _this7$updateAIChatDr4; // if the new dialog is a survey dialog, post the conversation closed message if (change.result.conversationDetails.dialogs.some(function (dialog) { return dialog.dialogType === 'POST_SURVEY'; }) && // Check if the close message has already been sent in this conversation _this7.lpOpenConvs[change.result.convId] && !_this7.lpOpenConvs[change.result.convId].closeMsgSent) { var _change$result2, _change$result2$conve, _this7$updateAIChatDr3; var closeMessage = ''; // Show a message based on who closed the chat if (change.result.conversationDetails && change.result.conversationDetails.closeReason === 'CONSUMER') { closeMessage = _this7.livePersonUserClosedConversationText; } else if (change.result.conversationDetails && change.result.conversationDetails.closeReason === 'AGENT') { closeMessage = _this7.livePersonAgentClosedConversationText; } else { closeMessage = _this7.livePersonSystemClosedConversationText; } var timestamp = new Date().toISOString(); if (change.serverTimestamp) { // If serverTimestamp is available, use it timestamp = new Date(change.serverTimestamp).toISOString(); } else if ((_change$result2 = change.result) != null && (_change$result2$conve = _change$result2.conversationDetails) != null && _change$result2$conve.dialogs) { // If serverTimestamp is not available, use the end timestamp of the main dialog var mainDialog = change.result.conversationDetails.dialogs.find(function (dialog) { return dialog.dialogType === 'MAIN' && dialog.state === 'CLOSE'; }); if (mainDialog && mainDialog.endTs) { timestamp = new Date(mainDialog.endTs).toISOString(); } } _this7.webChatSendMessage(closeMessage, timestamp, 'lp-system', null, null, null); // Update the lpOpenConvs object to track the close message _this7.lpOpenConvs[change.result.convId].closeMsgSent = true; // Update the lpOpenConvs in the cookie _this7.updateAIChatDrawerCookie((_this7$updateAIChatDr3 = {}, _this7$updateAIChatDr3[StorageKeys.lpOpenConvs] = _this7.lpOpenConvs, _this7$updateAIChatDr3)); // Disable the chat message box _this7.toggleWebChatUserTextBoxDisabled(true); } // Track the active dialog // Update the dialog id in case the dialogs have switched _this7.lpOpenConvs[change.result.convId].activeDialogId = activeDialog.dialogId; // Update the cookie _this7.updateAIChatDrawerCookie((_this7$updateAIChatDr4 = {}, _this7$updateAIChatDr4[StorageKeys.lpOpenConvs] = _this7.lpOpenConvs, _this7$updateAIChatDr4)); // Subscribe to messaging events of the new active dialog id _this7.subscribeToLivePersonMessagingEvents(activeDialog.dialogId, change.result.convId); _this7.lpSubscribedToMessagingEvents = true; } // Check if we need to subscribe to messaging events for an existing conversation if (!_this7.lpSubscribedToMessagingEvents) { // Subscribe to messaging events with active dialog id, from the current change sequence _this7.subscribeToLivePersonMessagingEvents(activeDialog.dialogId, change.result.convId, _this7.curLpChangeSequence); _this7.lpSubscribedToMessagingEvents = true; } // Update the current conversation result details in open conversations metadata object _this7.lpOpenConvs[change.result.convId].result = { convId: change.result.convId, dialogs: change.result.conversationDetails.dialogs.map(function (dialog) { return { dialogId: dialog.dialogId, dialogType: dialog.dialogType }; }) }; // Update the cookie _this7.updateAIChatDrawerCookie((_this7$updateAIChatDr5 = {}, _this7$updateAIChatDr5[StorageKeys.lpOpenConvs] = _this7.lpOpenConvs, _this7$updateAIChatDr5)); if (change.type === 'UPSERT') { if (_this7.isPostSurveyEnabled) { _this7.toggleLivePersonDisclaimer(true, _this7.surveyBotDisclaimerText); return; } // Check for agent assignment var hasAgentAssigned = change.result.conversationDetails.participants.some(function (p) { return p.role === 'ASSIGNED_AGENT'; }); if (hasAgentAssigned) { if (!_this7.isLivePersonAgentAssigned) { // Change the disclaimer text to the Speaking With LivePerson disclaimer text _this7.toggleLivePersonDisclaimer(true, _this7.livePersonDisclaimerText); // Re-enable the chat message box, but not any other action-set buttons _this7.toggleWebChatUserTextBoxDisabled(false); // Keep track of agent assigned state _this7.isLivePersonAgentAssigned = true; } _this7.updateAgentState(livePersonChatStateTypes.ACTIVE); } else { _this7.updateAgentState(livePersonChatStateTypes.INACTIVE); } } }); } /** * Publish a message to LivePerson websocket * * @param {string} messageText The message text * @param {string} messageId The message ID * @returns {Promise} A promise that resolves when the message is published */; _proto.publishToLivePersonWebsocket = function publishToLivePersonWebsocket(messageText, messageId) { if (messageId === void 0) { messageId = null; } return this.lpWebsocket.publishEvent({ dialogId: this.lpOpenConvs[Object.keys(this.lpOpenConvs)[0]].activeDialogId, conversationId: Object.keys(this.lpOpenConvs)[0], event: { type: 'ContentEvent', contentType: 'text/plain', message: messageText }, messageId: messageId || Math.floor(Math.random() * 1e9) }); } /** * Send accept status to LivePerson websocket * * @param {string} status The status to send * @param {number} sequence The sequence number * @param {number} retryCount The number of retries */; _proto.acceptStatusToLivePersonWebsocket = function acceptStatusToLivePersonWebsocket(status, sequence, retryCount) { var _this8 = this; if (retryCount === void 0) { retryCount = 0; } var timeoutPromise = function timeoutPromise(ms) { return new Promise(function (_, reject) { return setTimeout(function () { return reject(new LPError(LPErrorTypes.ACCEPT_STATUS_TIMEOUT, 'Accept status to LivePerson timed out', { status: status, sequence: sequence })); }, ms); }); }; Promise.race([this.lpWebsocket.publishEvent({ dialogId: this.lpOpenConvs[Object.keys(this.lpOpenConvs)[0]].activeDialogId, conversationId: Object.keys(this.lpOpenConvs)[0], event: { type: 'AcceptStatusEvent', status: status, sequenceList: [sequence] } }), timeoutPromise(livePersonResponseTimeout)]).then(function (response) { return _this8.handleLivePersonResponse(response); })["catch"](function (error) { _this8.handleLivePersonError(error, function (newRetryCount) { return _this8.acceptStatusToLivePersonWebsocket(status, sequence, newRetryCount); }, retryCount); }); } /** * On close LivePerson websocket * * @param {Event} event The close event */; _proto.onCloseLivePersonWebsocket = /*#__PURE__*/ function () { var _onCloseLivePersonWebsocket = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(event) { var _this9 = this; var notificationId, pollingFunction, retryCondition; return _regeneratorRuntime().wrap(function _callee8$(_context8) { while (1) { switch (_context8.prev = _context8.next) { case 0: if (this.isLivePersonChatActive) { _context8.next = 4; break; } console.warn('LivePerson websocket closed. event:', event); // Return the UI to the AI Chat Bot this.returnUIToAIChatBot(); return _context8.abrupt("return"); case 4: if (!(event.code === 4401 || event.code === 4407)) { _context8.next = 12; break; } console.warn('LivePerson websocket closed - API token expired. event:', event); // LivePerson API token expired // From LivePerson documentation - The client should return to the initation step, issue a fresh token, and reestablish the connection. // Display a message to the user that the connection to LivePerson was closed this.setNotification(this.livePersonSystemClosedConversationText, NotificationLevel.ERROR); this.lpWebsocket.ws = null; this.lpWebsocket = null; this.returnUIToAIChatBot(); _context8.next = 35; break; case 12: // From LivePerson documentation - For any other closeReason, the client should wait a few seconds and then try reconnecting. console.warn('LivePerson websocket closed - unknown reason. event:', event); this.isLivePersonAgentAssigned = false; // If there is an open conversation, try to reconnect after 3 seconds, then back off exponentially if (!(Object.keys(this.lpOpenConvs).length > 0)) { _context8.next = 31; break; } notificationId = null; pollingFunction = /*#__PURE__*/function () { var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() { return _regeneratorRuntime().wrap(function _callee6$(_context6) { while (1) { switch (_context6.prev = _context6.next) { case 0: // eslint-disable-next-line no-console console.log('Attempting to reconnect to LivePerson...'); if (!notificationId) { // Display a warning notification to the user that they were disconnected, and trying to reconnect notificationId = _this9.setNotification(_this9.livePersonDisconnectedReconnectingText, NotificationLevel.WARN); } // Exit early if LivePerson chat is no longer active if (_this9.isLivePersonChatActive) { _context6.next = 7; break; } console.warn('LivePerson chat is no longer active. Returning UI to AI Chat Bot.'); _this9.dismissNotification(notificationId); _this9.returnUIToAIChatBot(); return _context6.abrupt("return", { success: false }); case 7: _context6.prev = 7; _context6.next = 10; return _this9.initLivePersonChat(); case 10: // Reconnected successfully. Update the notification and return a success response, and close the notification // after 10 seconds // eslint-disable-next-line no-console console.log('Reconnected to LivePerson successfully.'); _this9.setNotification(_this9.livePersonReconnectedText, NotificationLevel.SUCCESS, notificationId); setTimeout(function () { return _this9.dismissNotification(notificationId); }, 10000); return _context6.abrupt("return", { success: true }); case 16: _context6.prev = 16; _context6.t0 = _context6["catch"](7); // Did not reconnect successfully. Log the error and return a failure response console.error('Error reconnecting to LivePerson:', _context6.t0); return _context6.abrupt("return", { success: false }); case 20: case "end": return _context6.stop(); } } }, _callee6, null, [[7, 16]]); })); return function pollingFunction() { return _ref2.apply(this, arguments); }; }(); retryCondition = /*#__PURE__*/function () { var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(response, error, _options) { return _regeneratorRuntime().wrap(function _callee7$(_context7) { while (1) { switch (_context7.prev = _context7.next) { case 0: if (_this9.isLivePersonChatActive) { _context7.next = 2; break; } return _context7.abrupt("return", false); case 2: return _context7.abrupt("return", Boolean(error) || response && !response.success); case 3: case "end": return _context7.stop(); } } }, _callee7); })); return function retryCondition(_x7, _x8, _x9) { return _ref3.apply(this, arguments); }; }(); _context8.prev = 18; _context8.next = 21; return LPUtils.exponentialBackoff(pollingFunction, retryCondition, { maxRetries: 7, // Maximum number of retries delayInSeconds: 3 // Initial delay in seconds }); case 21: _context8.next = 29; break; case 23: _context8.prev = 23; _context8.t0 = _context8["catch"](18); // All attempts to reconnect failed. Log the error and return the UI to the AI Chat Bot console.error('Failed to reconnect to LivePerson:', _context8.t0); this.lpWebsocket.ws = null; this.lpWebsocket = null; this.returnUIToAIChatBot(); case 29: _context8.next = 35; break; case 31: // If there are no open conversations, return the UI to the AI Chat Bot console.warn('No open LivePerson conversations. Returning UI to AI Chat Bot.'); this.lpWebsocket.ws = null; this.lpWebsocket = null; this.returnUIToAIChatBot(); case 35: case "end": return _context8.stop(); } } }, _callee8, this, [[18, 23]]); })); function onCloseLivePersonWebsocket(_x6) { return _onCloseLivePersonWebsocket.apply(this, arguments); } return onCloseLivePersonWebsocket; }() /** * Sends an event activity to the bot framework store. * * @param {string} eventName The name of the event * @param {Object} eventValue The value for the event (typically an object) */ ; _proto.webChatSendEvent = function webChatSendEvent(eventName, eventValue) { if (!this.store) { console.error('Error sending event to bot. WebChat store is not defined.'); return; } this.store.dispatch({ type: 'DIRECT_LINE/POST_ACTIVITY', meta: { method: 'keyboard' }, payload: { activity: { channelData: { postBack: true }, name: eventName, type: 'event', value: eventValue } } }); } /** * Dispatch an incoming-activity message to the bot framework store. * The 'store' adds the message bubble to the transcript window, using the 'role' to style the message as 'bot', 'user', or * our custom 'lp-system' message. * Only used when connected to a Live Person conversation, and for post Live Person conversation's survey messages. * * @params {string} message The message to dispatch * @param {string} timestamp The timestamp of the message * @param {string} role The role of the message sender: "bot", "user", or "lp-system" * @param {string} originatorId The originator id of the message sender * @param {string} messageId The id of the message. If not provided, a random id is generated * @param {number} messageSequence The sequence number of the message (only applies when rendering a message received from * LivePerson websocket) */; _proto.webChatSendMessage = function webChatSendMessage(message, timestampForWebChat, roleForWebChat, originatorId, messageId, messageSequence) { if (messageId === void 0) { messageId = null; } if (messageSequence === void 0) { messageSequence = null; } var processedMessage = message.replace(/#\/?md#/g, ''); // Removes all HTML tags from the message to avoid HTML injection into the WebStore processedMessage = new DOMParser().parseFromString(processedMessage, 'text/html').body.textContent; // If id is not provided, generate a random id if (!messageId) { messageId = Math.floor(Math.random() * 1e9); } // Ensure messageId is a string messageId = String(messageId); // Dispatch message to WebChat store so it renders in the WebChat UI this.store.dispatch({ type: 'DIRECT_LINE/INCOMING_ACTIVITY', payload: { activity: { type: 'message', text: processedMessage, from: { id: originatorId, role: roleForWebChat }, id: messageId, sequence: messageSequence, timestamp: timestampForWebChat } } }); } /** * Replaces the button content with an SVG star icon. * * @param {HTMLElement} el - The element containing the button to replace. */; /** * Initialize the LivePerson connection * * @param {number} retryCount The number of retries */ _proto.initLivePersonConnection = function initLivePersonConnection(retryCount) { var _this10 = this; if (retryCount === void 0) { retryCount = 0; } var timeoutPromise = function timeoutPromise(ms) { return new Promise(function (_, reject) { return setTimeout(function () { return reject(new LPError(LPErrorTypes.INIT_CONNECTION_TIMEOUT, 'Initializing LivePerson connection timed out')); }, ms); }); }; // Resolve the promise that completes first Promise.race([this.lpWebsocket.initConnection({}, [{ type: '.ams.headers.ConsumerAuthentication', jwt: this.lpJWT }, { type: '.ams.headers.ClientProperties', features: ['AUTO_MESSAGES', 'RICH_CONTENT', 'QUICK_REPLIES', 'MULTI_DIALOG', 'MARKDOWN_HYPERLINKS'] }]), timeoutPromise(livePersonResponseTimeout)]).then(function (response) { return _this10.handleLivePersonResponse(response); })["catch"](function (error) { _this10.handleLivePersonError(error, function (newRetryCount) { return _this10.initLivePersonConnection(newRetryCount); }, retryCount); }); } /** * Subscribe to LivePerson open conversations metadata * * @param {number} retryCount The number of retries * * @returns {Promise} A promise that resolves when the LivePerson websocket is subscribed to conversations metadata. * Existing conversations that match the filter will also be sent. The promise rejects if the * request times out. */; _proto.livePersonSubscribeExConversations = /*#__PURE__*/ function () { var _livePersonSubscribeExConversations = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(retryCount) { var _this11 = this; var timeoutPromise; return _regeneratorRuntime().wrap(function _callee9$(_context9) { while (1) { switch (_context9.prev = _context9.next) { case 0: if (retryCount === void 0) { retryCount = 0; } timeoutPromise = function timeoutPromise(ms) { return new Promise(function (_, reject) { return setTimeout(function () { return reject(new LPError(LPErrorTypes.SUBSCRIBE_CONVERSATION_TIMEOUT, 'Subscribing to LivePerson conversation metadata timed out')); }, ms); }); }; return _context9.abrupt("return", Promise.race([this.lpWebsocket.subscribeExConversations({ stage: [LPUtils.conversationStageTypes.OPEN, LPUtils.conversationStageTypes.CLOSE], convState: [LPUtils.conversationStateTypes.OPEN, LPUtils.conversationStateTypes.CLOSE] }), timeoutPromise(livePersonResponseTimeout)]).then(function (response) { return _this11.handleLivePersonResponse(response); })["catch"](function (error) { _this11.handleLivePersonError(error, function (newRetryCount) { return _this11.livePersonSubscribeExConversations(newRetryCount); }, retryCount); })); case 3: case "end": return _context9.stop(); } } }, _callee9, this); })); function livePersonSubscribeExConversations(_x10) { return _livePersonSubscribeExConversations.apply(this, arguments); } return livePersonSubscribeExConversations; }() /** * Unsubscribe from LivePerson conversation * * @param {string} subscriptionId The subscriptionId to unsubscribe from * @param {number} retryCount The number of retries * * @returns {Promise} A promise that resolves when the LivePerson websocket is unsubscribed from the conversation */ ; _proto.livePersonUnsubscribeExConversations = /*#__PURE__*/ function () { var _livePersonUnsubscribeExConversations = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(subscriptionId, retryCount) { var _this12 = this; var timeoutPromise; return _regeneratorRuntime().wrap(function _callee10$(_context10) { while (1) { switch (_context10.prev = _context10.next) { case 0: if (retryCount === void 0) { retryCount = 0; } timeoutPromise = function timeoutPromise(ms) { return new Promise(function (_, reject) { return setTimeout(function () { return reject(new LPError(LPErrorTypes.UNSUBSCRIBE_CONVERSATION_TIMEOUT, 'Unsubscribing from LivePerson conversation metadata timed out')); }, ms); }); }; return _context10.abrupt("return", Promise.race([this.lpWebsocket.unsubscribeExConversations({ subscriptionId: subscriptionId }), timeoutPromise(livePersonResponseTimeout)]).then(function (response) { return _this12.handleLivePersonResponse(response); })["catch"](function (error) { _this12.handleLivePersonError(error, function (newRetryCount) { return _this12.livePersonUnsubscribeExConversations(subscriptionId, newRetryCount); }, retryCount); })); case 3: case "end": return _context10.stop(); } } }, _callee10, this); })); function livePersonUnsubscribeExConversations(_x11, _x12) { return _livePersonUnsubscribeExConversations.apply(this, arguments); } return livePersonUnsubscribeExConversations; }() /** * Disables all survey response buttons in the last message to prevent further interaction. * */ ; _proto.disablePreviousQuestionSurveyResponseButtons = function disablePreviousQuestionSurveyResponseButtons() { if (!this.isPostSurveyEnabled) return; // Get all survey messages except the last one (current question awaiting a response) var surveyMessages = Array.from(this.el.querySelectorAll("section" + Selector$A.WEB_CHAT_TRANSCRIPT_TRANSCRIPT + " " + Selector$A.ARTICLE)).slice(0, -1); // Iterate over the survey messages and disable buttons surveyMessages.forEach(function (message) { var buttons = message.querySelectorAll(Selector$A.POST_SURVEY_JSON_POLLOCK_BUTTON); buttons.forEach(function (button) { button.disabled = true; }); }); } /** * Consumer request conversation to LivePerson * * @param {number} retryCount The number of retries */; _proto.livePersonConsumerRequestConversation = function livePersonConsumerRequestConversation(retryCount) { var _this13 = this; if (retryCount === void 0) { retryCount = 0; } var timeoutPromise = function timeoutPromise(ms) { return new Promise(function (_, reject) { return setTimeout(function () { return reject(new LPError(LPErrorTypes.CONSUMER_REQUEST_CONVERSATION_TIMEOUT, 'Consumer request conversation to LivePerson timed out')); }, ms); }); }; Promise.race([this.lpWebsocket.consumerRequestConversation({ skillId: this.skillId, conversationContext: { visitorId: this.lpSession.visitorId, sessionId: this.lpSession.sessionId, lang: document.documentElement.lang, type: 'SharkContext', features: ['AUTO_MESSAGES', 'RICH_CONTENT', 'QUICK_REPLIES', 'MULTI_DIALOG', 'MARKDOWN_HYPERLINKS'] } }), timeoutPromise(livePersonResponseTimeout)]).then(function (response) { return _this13.handleLivePersonResponse(response); })["catch"](function (error) { _this13.handleLivePersonError(error, function (newRetryCount) { return _this13.livePersonConsumerRequestConversation(newRetryCount); }, retryCount); }); } /** * Updates or waits for a LivePerson message element in the DOM, setting its originator and optionally updating its timestamp. * * - If the message element already exists, updates its `originator` dataset property. * - If the element has a `data-lp-message-id` attribute, calls `webChatSendMessage` to update the message with the server timestamp. * - If the element does not exist, observes the DOM for its appearance, updates its `originator`, and resolves when found or after a timeout. * * @async * @param {string} messageText - The text content of the message. * @param {string} dialogId - The dialog ID associated with the message. * @param {string|number} sequence - The sequence number of the message within the dialog. * @param {string} originatorId - The ID of the message originator. * @param {string} roleForWebChat - The role (e.g., 'user', 'agent') for the web chat. * @param {string} timestampFromServerString - The timestamp string from the server. * @returns {Promise} Resolves with the message element when found or updated, or `null` if not found within the timeout. */; _proto.updateLivePersonMessageInDOM = /*#__PURE__*/ function () { var _updateLivePersonMessageInDOM = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(messageText, dialogId, sequence, originatorId, roleForWebChat, timestampFromServerString) { var _this14 = this; return _regeneratorRuntime().wrap(function _callee11$(_context11) { while (1) { switch (_context11.prev = _context11.next) { case 0: return _context11.abrupt("return", new Promise(function (resolve) { // Check if element already exists var messageElem = _this14.webChatTranscriptElem.querySelector("[data-lp-message-dialog-id=\"" + dialogId + "\"][data-lp-message-sequence=\"" + sequence + "\"]"); if (messageElem) { messageElem.dataset.originator = roleForWebChat; // If message has an has a data-lp-message-id attribute, it was already rendered from a user message send. Call webChatSendMessage to // update the message in the transcript with the timestamp from the server to ensure that the message is rendered // in the correct order var messageId = messageElem.dataset.lpMessageId; if (messageId) { _this14.webChatSendMessage(messageText, timestampFromServerString, roleForWebChat, originatorId, messageId, sequence); resolve(messageElem); return; } resolve(messageElem); return; } // Set up observer to wait for the element to appear var observer = new MutationObserver(function () { var messageElem = _this14.webChatTranscriptElem.querySelector("[data-lp-message-dialog-id=\"" + dialogId + "\"][data-lp-message-sequence=\"" + sequence + "\"]"); if (messageElem) { messageElem.dataset.originator = roleForWebChat; observer.disconnect(); clearTimeout(observerTimeout); resolve(messageElem); } }); // Start observing the transcript for changes observer.observe(_this14.webChatTranscriptElem, { childList: true, subtree: true, attributes: true, attributeFilter: ['data-lp-message-dialog-id', 'data-lp-message-sequence'] }); // Set a timeout to avoid hanging indefinitely var observerTimeout = setTimeout(function () { observer.disconnect(); console.warn("Message element for dialogId=" + dialogId + ", sequence=" + sequence + " not found within timeout period"); resolve(null); }, 5000); })); case 1: case "end": return _context11.stop(); } } }, _callee11); })); function updateLivePersonMessageInDOM(_x13, _x14, _x15, _x16, _x17, _x18) { return _updateLivePersonMessageInDOM.apply(this, arguments); } return updateLivePersonMessageInDOM; }() /** * Renders quick reply options inside a LivePerson survey chat message element using JsonPollock. * * @param {Object} quickRepliesData - The data object representing quick replies to render. * @param {HTMLElement} messageElem - The DOM element representing the chat message bubble. * @param {boolean} [requiresStarReplacement=false] - Indicates if rating star replacement is required for the survey. * * @throws {Error} Logs an error if rendering fails or required elements are not found. */ ; _proto.renderQuickReplies = function renderQuickReplies(quickRepliesData, messageElem, requiresStarReplacement) { if (requiresStarReplacement === void 0) { requiresStarReplacement = false; } if (!quickRepliesData || !messageElem) return; try { var container = window.JsonPollock.render(quickRepliesData); var bubbleContent = messageElem.querySelector(Selector$A.WEB_CHAT_BUBBLE_CONTENT); if (!bubbleContent) { console.error('webchat__bubble__content element not found in the messageElem'); return; } // Append the rendered container bubbleContent.append(container); // If post-survey is enabled if (this.isPostSurveyEnabled) { // Set data attribute based on requiresStarReplacement flag bubbleContent.dataset.requiresStarReplacement = requiresStarReplacement.toString(); // Add class to distinguish survey questions bubbleContent.classList.add(ClassName$q.LP_SURVEY_QUESTIONNAIRE); // If requiresStarReplacement is false, add 'lp-pcs-richContent' class for styling rich content if (!requiresStarReplacement) { bubbleContent.classList.add(ClassName$q.LP_SURVEY_RICH_CONTENT); } } } catch (error) { console.error('Error rendering quick replies:', error); } } /** * Accepts a message via the LivePerson WebSocket if the role is not 'user'. * * @param {string} roleForWebChat - The role associated with the web chat message. * @param {number} sequence - The sequence number for the message. */; _proto.acceptMessageIfNotUser = function acceptMessageIfNotUser(roleForWebChat, sequence) { if (roleForWebChat !== 'user') { this.acceptStatusToLivePersonWebsocket(LPUtils.acceptStatusTypes.ACCEPT, sequence); } } /** * Handle LivePerson opened websocket * * @returns {Promise} A promise that resolves when the LivePerson websocket is opened */; _proto.handleLivePersonOpenedSocket = /*#__PURE__*/ function () { var _handleLivePersonOpenedSocket = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() { var _this15 = this, _subscribeExConversat; var userId, subscribeExConversationsResponse; return _regeneratorRuntime().wrap(function _callee12$(_context12) { while (1) { switch (_context12.prev = _context12.next) { case 0: this.lpWebsocket.registerRequests(livePersonApiRequestTypes); userId = _classPrivateFieldLooseBase(this, _getLivePersonIdFromJWT)[_getLivePersonIdFromJWT](); if (userId) { _context12.next = 6; break; } console.error('No LivePerson userId found'); this.setNotification(NotificationLevel.ERROR, this.livePersonGenericErrorText); return _context12.abrupt("return"); case 6: this.initLivePersonConnection(); this.lpWebsocket.onNotification(withType('MessagingEvent'), function (body) { var _body$changes; return (_body$changes = body.changes) == null ? void 0 : _body$changes.forEach(function (change) { var originatorId = change.originatorMetadata.id; var roleForWebChat = change.originatorId === userId ? 'user' : 'bot'; if (change.sequence) { _this15.curLpChangeSequence = change.sequence; } // publish the survey response to LivePerson Chat if (!_this15.isSurveyTextActionPublished && change.sequence) { window.JsonPollock.registerAction('publishText', function (data) { _this15.acceptStatusToLivePersonWebsocket(LPUtils.acceptStatusTypes.ACTION, change.sequence); _this15.handleLivePersonSendMessage(data.actionData.text); }); _this15.isSurveyTextActionPublished = true; } switch (change.event.type) { case 'RichContentEvent': { // Extract message text from the first element of content var messageTextElement = change.event.content.elements.find(function (el) { return el.type === 'text'; }); var messageText = messageTextElement ? messageTextElement.text : ''; var serverTimestampString = new Date(change.serverTimestamp).toISOString(); _this15.webChatSendMessage(messageText, serverTimestampString, roleForWebChat, originatorId, null, change.sequence); // Update message in DOM _this15.updateLivePersonMessageInDOM(messageText, change.dialogId, change.sequence, originatorId, roleForWebChat, serverTimestampString).then(function (messageElem) { _this15.lpMessages[change.dialogId + "-" + change.sequence] = messageElem; // Prepare buttons data for JSON-Pollock rendering var buttonElements = change.event.content.elements.filter(function (el) { return el.type === 'button'; }); if (buttonElements.length > 0) { var quickRepliesData = { type: change.event.content.type, elements: buttonElements.map(function (button) { return { type: button.type, title: button.title, tooltip: button.tooltip, click: { actions: button.click.actions } }; }) }; _this15.renderQuickReplies(quickRepliesData, messageElem, false); } }); break; } case 'ContentEvent': { var _serverTimestampString = new Date(change.serverTimestamp).toISOString(); if (roleForWebChat === 'user' && (change.event.message.startsWith(_this15.transcriptIntroText) || change.event.message.startsWith(_this15.transcriptContinuedText))) { // Don't render transcript messages the user sent to LivePerson in the WebChat UI break; } // If the transcript does not already contain the message, render it in the WebChat UI if (!_this15.webChatTranscriptElem.querySelector("[data-lp-message-dialog-id=\"" + change.dialogId + "\"][data-lp-message-sequence=\"" + change.sequence + "\"]")) { _this15.webChatSendMessage(change.event.message, _serverTimestampString, roleForWebChat, originatorId, null, change.sequence); } // Update message in DOM _this15.updateLivePersonMessageInDOM(change.event.message, change.dialogId, change.sequence, originatorId, roleForWebChat, _serverTimestampString).then(function (messageElem) { var _change$metadata, _change$metadata$; _this15.lpMessages[change.dialogId + "-" + change.sequence] = messageElem; // Accept the message to acknowledge as received - note this is not a READ receipt _this15.acceptMessageIfNotUser(roleForWebChat, change.sequence); // Handle quick replies if present if (change.event.quickReplies && Array.isArray(change.event.quickReplies.replies)) { var quickRepliesData = { type: 'horizontal', elements: change.event.quickReplies.replies.map(function (reply) { return { type: reply.type, title: reply.title, tooltip: reply.tooltip, click: { actions: reply.click.actions } }; }) }; _this15.renderQuickReplies(quickRepliesData, messageElem, true); } else if (((_change$metadata = change.metadata) == null ? void 0 : (_change$metadata$ = _change$metadata[0]) == null ? void 0 : _change$metadata$.type) === 'Question' && _this15.isPostSurveyEnabled) { // If the message is a question and part of the survey that ALSO doesn't have quick replies... re-enable the chat message box // Regrettably, this is a workaround for the fact that the LivePerson API doesn't provide a way to determine if a message is a question // with buttons or a freeform text question. _this15.toggleWebChatUserTextBoxDisabled(false); } }); break; } case 'ChatStateEvent': { if (roleForWebChat !== 'user' && roleForWebChat !== 'lp-system') { _this15.updateAgentState(change.event.chatState); } break; } case 'AcceptStatusEvent': { change.event.sequenceList.forEach(function (sequence) { return _this15.updateLivePersonMessageStatus(sequence, change.event.status, change.dialogId); }); break; } } }); }); // If there is an existing subscriptionId, user is reconnecting to websocket. Set lpSubscribedToMessagingEvents to false // since we are getting a new subscriptionId from livePersonSubscribeExConversations if (this.lpSubscriptionId) { this.lpSubscribedToMessagingEvents = false; } // subscribe to open conversations metadata _context12.next = 11; return this.livePersonSubscribeExConversations(); case 11: subscribeExConversationsResponse = _context12.sent; if ((_subscribeExConversat = subscribeExConversationsResponse.body) != null && _subscribeExConversat.subscriptionId) { _context12.next = 16; break; } console.error('No subscriptionId found in LivePerson subscribeExConversations response'); this.setNotification(NotificationLevel.ERROR, this.livePersonGenericErrorText); return _context12.abrupt("return"); case 16: this.lpSubscriptionId = subscribeExConversationsResponse.body.subscriptionId; // handle notifications for open conversations this.lpWebsocket.onNotification(withSubscriptionID(this.lpSubscriptionId), function (notificationBody) { _this15.handleLivePersonConversationNotification(notificationBody); }); // If no open conversations, request a new conversation if (!Object.keys(this.lpOpenConvs)[0]) { this.livePersonConsumerRequestConversation(); } // Add event listener for textarea changes this.webChatTextarea.addEventListener(EventName$A.INPUT, this.handleLpUserInput); // Listen for user publishing content (sending messages) to LivePerson this.lpWebsocket.onPublishContent(function (contentObj, timestampString) { return new Promise(function (resolve, reject) { try { if (contentObj.body.event.message.startsWith(_this15.transcriptIntroText) || contentObj.body.event.message.startsWith(_this15.transcriptContinuedText)) { // Don't render transcript messages the user is sending to LivePerson resolve(); return; } // Render the message in the WebChat UI immediately, that way when success/error/timeout happens, // we can find the rendered message by id and update it as needed _this15.webChatSendMessage(contentObj.body.event.message, timestampString, 'user', userId, contentObj.id, null); // Use setTimeout to wait until the message is rendered in the WebChat UI setTimeout(function () { // Dispatch event that LivePerson message is rendered var event = new CustomEvent(EventName$A.LIVEPERSON_MESSAGE_RENDERED, { detail: { messageId: contentObj.id } }); window.dispatchEvent(event); // Resolve the promise when done resolve(); }); } catch (error) { // Add messageId to error object data error.data.messageId = contentObj.id; // Reject the promise if there's an error reject(error); } }); }); // Add event listener for closing the LivePerson websocket this.lpWebsocket.ws.addEventListener(EventName$A.CLOSE, function (event) { return _this15.onCloseLivePersonWebsocket(event); }); case 22: case "end": return _context12.stop(); } } }, _callee12, this); })); function handleLivePersonOpenedSocket() { return _handleLivePersonOpenedSocket.apply(this, arguments); } return handleLivePersonOpenedSocket; }() /** * Initialize the LivePerson chat * * @returns {Promise} A promise that resolves when the LivePerson chat is initialized */ ; _proto.initLivePersonChat = /*#__PURE__*/ function () { var _initLivePersonChat = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() { var _this16 = this; var isExistingConversation, isAgentAvailable, _this$updateAIChatDra2, _this$lpWebsocket$ws, umsDomain, chatTranscript, mutationConfig; return _regeneratorRuntime().wrap(function _callee13$(_context13) { while (1) { switch (_context13.prev = _context13.next) { case 0: // Disable the chat box and any action buttons until agent is connected this.toggleWebChatDisabled(true); isExistingConversation = Object.keys(this.lpOpenConvs).length > 0; isAgentAvailable = false; if (isExistingConversation) { _context13.next = 7; break; } _context13.next = 6; return this.checkLivePersonAgentAvailability(); case 6: isAgentAvailable = _context13.sent; case 7: if (!(isExistingConversation || isAgentAvailable)) { _context13.next = 48; break; } _context13.next = 10; return this.createLivePersonSession(); case 10: this.lpSession = _context13.sent; if (this.lpSession.sessionId) { _context13.next = 15; break; } console.error('No LivePerson Session found'); this.toggleWebChatDisabled(false); return _context13.abrupt("return"); case 15: _context13.next = 17; return this.getLivePersonJWT(); case 17: this.lpJWT = _context13.sent; if (this.lpJWT) { _context13.next = 22; break; } console.error('No LivePerson JWT found'); this.toggleWebChatDisabled(false); return _context13.abrupt("return"); case 22: // Update cookie with the LivePerson JWT this.updateAIChatDrawerCookie((_this$updateAIChatDra2 = {}, _this$updateAIChatDra2[StorageKeys.lpJWT] = this.lpJWT, _this$updateAIChatDra2)); _context13.next = 25; return this.getLivePersonUmsDomain(); case 25: umsDomain = _context13.sent; if (umsDomain) { _context13.next = 30; break; } console.error('No LivePerson UMS domain found'); this.toggleWebChatDisabled(false); return _context13.abrupt("return"); case 30: if (!(!this.lpWebsocket || ((_this$lpWebsocket$ws = this.lpWebsocket.ws) == null ? void 0 : _this$lpWebsocket$ws.readyState) !== WebSocket.OPEN)) { _context13.next = 34; break; } _context13.next = 33; return this.initLivePersonWebsocket(umsDomain); case 33: this.lpWebsocket = _context13.sent; case 34: if (this.lpWebsocket) { _context13.next = 38; break; } console.error('No LivePerson websocket found'); this.toggleWebChatDisabled(false); return _context13.abrupt("return"); case 38: _context13.next = 40; return _classPrivateFieldLooseBase(this, _initializeJsonPollock)[_initializeJsonPollock](); case 40: this.handleLivePersonOpenedSocket(); // Begin watching the transcript window for new Article elements; specifically the messages // from an Agent. We will add intersection observers to the new elements to detect when the User // has read them. if (!this.lpMutationObserver) { chatTranscript = this.el.querySelector(Selector$A.WEB_CHAT_TRANSCRIPT_TRANSCRIPT); this.lpMutationObserver = new MutationObserver(function (mutations) { for (var _iterator = _createForOfIteratorHelperLoose$6(mutations), _step; !(_step = _iterator()).done;) { var mutation = _step.value; if (mutation.type === 'childList') { mutation.addedNodes.forEach(function (node) { if (node.nodeName.toLowerCase() === Selector$A.ARTICLE && !node.querySelector(Selector$A.WEB_CHAT_BUBBLE_FROM_USER)) { // filter out articles that are from user messages _this16.observeArticleForLivePersonRead(node); _this16.disablePreviousQuestionSurveyResponseButtons(); // Disable previous survey response buttons } }); } } }); mutationConfig = { childList: true, subtree: false }; this.lpMutationObserver.observe(chatTranscript, mutationConfig); } // Set this to true once connected to a live agent this.isLivePersonChatActive = true; // Switch to LivePerson Chat In Queue disclaimer text once connected to a live agent this.toggleLivePersonDisclaimer(true, this.livePersonInQueueText); this.updateDrawerTitleText(this.drawerLivePersonTitleText); this.updateButtonTitleText(this.buttonLivePersonTitleText); _context13.next = 50; break; case 48: // Post a message to the user that no agent is available. this.webChatSendMessage(this.livePersonNoAgentsText, new Date().toISOString(), 'bot', null, null, null); this.toggleWebChatDisabled(false); case 50: case "end": return _context13.stop(); } } }, _callee13, this); })); function initLivePersonChat() { return _initLivePersonChat.apply(this, arguments); } return initLivePersonChat; }() /** * Handle user closing main LivePerson conversation * * @param {number} retryCount The current retry count */ ; _proto.handleUserCloseLivePersonConversation = /*#__PURE__*/ function () { var _handleUserCloseLivePersonConversation = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(retryCount) { var _this17 = this; var conversationId, timeoutPromise; return _regeneratorRuntime().wrap(function _callee14$(_context14) { while (1) { switch (_context14.prev = _context14.next) { case 0: if (retryCount === void 0) { retryCount = 0; } if (this.isPostSurveyEnabled) { this.lpSurveyForcedClosed = true; // The End live chat button was clicked *during* the survey. Track this so we don't send a survey close message. } conversationId = Object.keys(this.lpOpenConvs)[0]; if (conversationId) { timeoutPromise = function timeoutPromise(ms) { return new Promise(function (_, reject) { return setTimeout(function () { return reject(new LPError(LPErrorTypes.USER_CLOSE_CONVERSATION_TIMEOUT, 'User closing LivePerson conversation timed out')); }, ms); }); }; Promise.race([this.lpWebsocket.updateConversationField({ conversationId: conversationId, conversationField: [{ field: 'DialogChange', type: 'UPDATE', dialog: { dialogId: this.lpOpenConvs[conversationId].activeDialogId, state: LPUtils.conversationStateTypes.CLOSE, closedCause: 'Closed by consumer' } }] }), timeoutPromise(livePersonResponseTimeout)]).then(function (response) { return _this17.handleLivePersonResponse(response); })["catch"](function (error) { _this17.handleLivePersonError(error, function (newRetryCount) { return _this17.handleUserCloseLivePersonConversation(newRetryCount); }, retryCount); }); } else { console.warn('User closing LivePerson conversation, but no LivePerson conversation found...'); this.returnUIToAIChatBot(); } case 4: case "end": return _context14.stop(); } } }, _callee14, this); })); function handleUserCloseLivePersonConversation(_x19) { return _handleUserCloseLivePersonConversation.apply(this, arguments); } return handleUserCloseLivePersonConversation; }() /** * Return the UI to the AI Chat Bot state */ ; _proto.returnUIToAIChatBot = function returnUIToAIChatBot() { var _this$lpMutationObser; // ensure the forced close state is reset this.lpSurveyForcedClosed = false; // Set isLivePersonChatActive to false this.isLivePersonChatActive = false; // Switch back to AI Chat disclaimer text this.toggleLivePersonDisclaimer(false); // Reset the agent assigned state this.isLivePersonAgentAssigned = false; // Enable the chat box this.toggleWebChatDisabled(false); // Reset isSendTranscript flag this.isSendTranscript = false; // Focus the WebChat textarea this.webChatTextarea.focus(); // Remove the mutation observer (_this$lpMutationObser = this.lpMutationObserver) == null ? void 0 : _this$lpMutationObser.disconnect(); // Remove the event listener for textarea changes this.webChatTextarea.removeEventListener(EventName$A.INPUT, this.handleLpUserInput); // Return text to the standard AI Chat text this.updateDrawerTitleText(this.drawerTitleText); this.updateButtonTitleText(this.buttonTitleText); // Reset and close the LivePerson websocket to ensure a fresh connection next time if (this.lpWebsocket) { if (this.lpWebsocket.ws && this.lpWebsocket.ws.readyState === WebSocket.OPEN) { // Only try to close if it's open this.lpWebsocket.ws.close(); } this.lpWebsocket = null; } // Reset the subscription ID so a new one will be created on reconnect this.lpSubscriptionId = null; // Clear any stored conversations this.lpOpenConvs = {}; this.lpMessages = {}; this.curLpChangeSequence = 0; this.lpSubscribedToMessagingEvents = false; } /** * Observe article elements for LivePerson read status * * @param {HTMLElement} article The article element to observe */; _proto.observeArticleForLivePersonRead = function observeArticleForLivePersonRead(article) { var _this18 = this; var articleObserver = new IntersectionObserver(function (entries, observer) { entries.forEach(function (entry) { if (entry.intersectionRatio >= 0.9 && entry.target.dataset.lpMessageSequence && entry.target.dataset.lpMessageSequence !== 'pending') { var sequence = entry.target.dataset.lpMessageSequence; _this18.acceptStatusToLivePersonWebsocket(LPUtils.acceptStatusTypes.READ, sequence); observer.unobserve(entry.target); observer.disconnect(); } }); }, { threshold: 0.9 }); articleObserver.observe(article); } /** * Update AI Chat Drawer title text * * @param {string} text The text to update the title with */; _proto.updateDrawerTitleText = function updateDrawerTitleText(text) { this.el.querySelector(Selector$A.BLOCK_FEATURE_TITLE).textContent = text; } /** * Update AI Chat Button title text * * @param {string} text The text to update the title with */; _proto.updateButtonTitleText = function updateButtonTitleText(text) { this.aiChatButton.querySelector(Selector$A.AI_CHAT_BUTTON_TEXT + " span").textContent = text; } /** * Shows or Hides the Live Person specific 'Disclaimer Text', while hiding any other disclaimer text. * @param {boolean} true if we should switch to the Live Person disclaimer, false if we should switch it back to the AI-Assistant disclaimer */; _proto.toggleLivePersonDisclaimer = function toggleLivePersonDisclaimer(isShown, disclaimerText) { var _this19 = this; if (isShown) { var lpDisclaimerTextSpan = document.createElement('span'); lpDisclaimerTextSpan.textContent = disclaimerText; var lpDisclaimerButton = document.createElement('a'); lpDisclaimerButton.href = '#'; lpDisclaimerButton.setAttribute('role', 'button'); lpDisclaimerButton.classList.add(ClassName$q.RETURN_TO_AI_CHAT); lpDisclaimerButton.innerHTML = "" + this.returnToAiChatText + ""; lpDisclaimerButton.addEventListener(EventName$A.CLICK, function (event) { event.preventDefault(); _this19.handleUserCloseLivePersonConversation(); }); lpDisclaimerButton.addEventListener(EventName$A.KEYDOWN, function (event) { if (event.key === ' ' || event.key === 'Enter') { event.preventDefault(); _this19.handleUserCloseLivePersonConversation(); } }); this.aiDisclaimerDiv.innerHTML = ''; this.aiDisclaimerDiv.append(lpDisclaimerTextSpan, ' ', lpDisclaimerButton); } else { // Set disclaimer back to the AI Disclaimer Text this.aiDisclaimerDiv.innerHTML = this.aiDisclaimerText; } } /** * Open the chat drawer. * @param {string} initialChatText Optional initial chat text to send to bot */; _proto.chatOpen = /*#__PURE__*/ function () { var _chatOpen = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(initialChatText) { var _this$updateAIChatDra3, _this20 = this; return _regeneratorRuntime().wrap(function _callee15$(_context15) { while (1) { switch (_context15.prev = _context15.next) { case 0: if (initialChatText === void 0) { initialChatText = ''; } this.previouslyFocusedElem = document.activeElement; this.el.hidden = false; this.updateAIChatDrawerCookie((_this$updateAIChatDra3 = {}, _this$updateAIChatDra3[StorageKeys.chatDrawerState] = 'OPEN', _this$updateAIChatDra3)); // If source site has changed, send updated source site to bot, and update cookie if (!(this.sourceSite !== this.getAIChatDrawerCookieObject()[StorageKeys.sourceSite])) { _context15.next = 7; break; } _context15.next = 7; return this.updateSourceSite(this.sourceSite); case 7: requestAnimationFrame(function () { _this20.el.classList.add(ClassName$q.SHOW); if (_this20.mediaQueryListModalDialog.matches) { _this20.toggleModalDialogMode(true); } else { _this20.toggleModalDialogMode(false); } }); if (this.aiChatButton) { this.showChatButton(false); } if (initialChatText && this.webChatInstance) { this.store.dispatch({ type: 'WEB_CHAT/SEND_MESSAGE', payload: { text: initialChatText } }); } this.webChatTextarea.focus(); case 11: case "end": return _context15.stop(); } } }, _callee15, this); })); function chatOpen(_x20) { return _chatOpen.apply(this, arguments); } return chatOpen; }() /** * Close the chat drawer, reenable web chat elements if they were disabled, and focus the search input in banner if it exists, * otherwise focus the previously focused element. */ ; _proto.chatClose = function chatClose() { var _this$updateAIChatDra4; this.el.classList.remove(ClassName$q.SHOW); this.toggleModalDialogMode(false); this.updateAIChatDrawerCookie((_this$updateAIChatDra4 = {}, _this$updateAIChatDra4[StorageKeys.chatDrawerState] = 'CLOSED', _this$updateAIChatDra4)); if (this.aiChatButton) { this.showChatButton(true); } clearTimeout(this.messageWaitTimeout); if (this.previouslyFocusedElem) { this.previouslyFocusedElem.focus(); } } /** * Opens the chat drawer if it is already initialized, otherwise initializes the chat drawer. * * @param {string} [initialChatText=''] - The initial text to be sent to the bot when opening or initializing the drawer. */; _proto.chatOpenOrInit = function chatOpenOrInit(initialChatText) { if (initialChatText === void 0) { initialChatText = ''; } if (this.chatInitialized) { this.chatOpen(initialChatText); } else { this.initChat(initialChatText); } } /** * Returns a Promise that resolves when the first message from the bot has rendered. If a message from the bot is already * rendered, the Promise resolves immediately. * * @returns {Promise} */; _proto.welcomeMessageRendered = function welcomeMessageRendered() { var _this21 = this; return new Promise(function (resolve, reject) { var transcript = _this21.el.querySelector(Selector$A.WEB_CHAT_TRANSCRIPT); if (!transcript) { reject(new Error('Transcript element not found. Cannot observe for welcome message.')); return; } // Check if a webchat bubble from the bot already exists var existingBotBubble = transcript.querySelector(Selector$A.WEB_CHAT_BUBBLE_FROM_BOT); if (existingBotBubble) { resolve(); return; } var observer = new MutationObserver(function (mutationsList, observer) { for (var _iterator2 = _createForOfIteratorHelperLoose$6(mutationsList), _step2; !(_step2 = _iterator2()).done;) { var mutation = _step2.value; for (var _iterator3 = _createForOfIteratorHelperLoose$6(mutation.addedNodes), _step3; !(_step3 = _iterator3()).done;) { var addedNode = _step3.value; if (addedNode.nodeType === Node.ELEMENT_NODE) { var botBubble = addedNode.querySelector(Selector$A.WEB_CHAT_BUBBLE_FROM_BOT); if (botBubble) { observer.disconnect(); resolve(); return; } } } } }); observer.observe(transcript, { childList: true, subtree: true }); }); } /** * Handle connect fulfilled event on the WebChat instance. Store a reference to the WebChat instance, and store references * to the send box, form, textarea, and send button elements. Append disclaimer text above send box. Open the chat drawer. */; _proto.onWebChatConnectFulfilled = function onWebChatConnectFulfilled() { this.webChatInstance = window.WebChat; this.chatInitialized = true; this.webChatSendBox = this.el.querySelector(Selector$A.WEB_CHAT_SEND_BOX); this.webChatForm = this.webChatSendBox.querySelector('form'); this.webChatTextarea = this.webChatForm.querySelector('textarea'); this.webChatTextarea.maxLength = this.webChatMaximumCharacters; this.webChatSendButton = this.webChatSendBox.querySelector(Selector$A.WEB_CHAT_SEND_BUTTON); this.firstFocusableElem = this.closeButton; this.lastFocusableElem = this.webChatSendButton; // Append disclaimer text above send box if (this.webChatSendBox && !this.aiDisclaimerDiv) { this.aiDisclaimerDiv = document.createElement('small'); this.aiDisclaimerDiv.classList.add(ClassName$q.AI_DISCLAIMER); this.aiDisclaimerDiv.innerHTML = this.aiDisclaimerText; this.webChatSendBox.insertAdjacentElement('beforebegin', this.aiDisclaimerDiv); } this.chatOpen(); } /** * Handle start conversation fulfilled event on the WebChat instance. If initial chat text was passed in, send it to the bot * after the welcome message has rendered. * * @param {CustomEvent} event 'startconversationfulfilled' event on the WebChat instance */; _proto.onStartConversationFulfilled = /*#__PURE__*/ function () { var _onStartConversationFulfilled = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(event) { var initialChatText, eventValue; return _regeneratorRuntime().wrap(function _callee16$(_context16) { while (1) { switch (_context16.prev = _context16.next) { case 0: initialChatText = event.data; if (!(initialChatText && this.webChatInstance)) { _context16.next = 8; break; } _context16.next = 4; return this.welcomeMessageRendered(); case 4: this.store.dispatch({ type: 'WEB_CHAT/SEND_MESSAGE', payload: { text: initialChatText } }); _classPrivateFieldLooseBase(this, _initWebChatTranscriptObserver)[_initWebChatTranscriptObserver](); _context16.next = 9; break; case 8: _classPrivateFieldLooseBase(this, _initWebChatTranscriptObserver)[_initWebChatTranscriptObserver](); case 9: // Disable any previously sent transcript checkboxes and "Continue" buttons that start a new chat with LivePerson, // as they could be confusing to the user this.hideLivePersonChatIntroElems(); if (Object.keys(this.lpOpenConvs).length) { // There is possibly an active conversation with LivePerson // Don't send transcript again since user is reconnecting and not starting chat from "startLPChat" event this.isSendTranscript = false; // Attempt to reconnect to LivePerson this.initLivePersonChat(); } // If user opened chat drawer via proactive chat, send proactive chat event to bot if (this.isInstantiatedByProactiveChat) { eventValue = { instantiatedByProactiveChat: this.isInstantiatedByProactiveChat }; this.webChatSendEvent(EventName$A.INSTANTIATED_BY_PROACTIVE_CHAT, eventValue); } case 12: case "end": return _context16.stop(); } } }, _callee16, this); })); function onStartConversationFulfilled(_x21) { return _onStartConversationFulfilled.apply(this, arguments); } return onStartConversationFulfilled; }() /** * Handle transition end event on the chat drawer. */ ; _proto.onAIChatDrawerTransitionEnd = function onAIChatDrawerTransitionEnd() { // When chat drawer has finished sliding off screen, add hidden attribute so elements inside cannot be focused/interacted with if (!this.el.classList.contains(ClassName$q.SHOW)) { this.el.hidden = true; } } /** * Detect when message from bot is appended to the WebChat transcript. If a message from the bot is appended, reenable the * WebChat elements if they were disabled, and focus the textarea in drawer if it had focus before the message was appended. * * @param {MutationRecord[]} mutationsList - List of mutations */; _proto.onWebChatTranscriptMutation = function onWebChatTranscriptMutation(mutationsList) { for (var _iterator4 = _createForOfIteratorHelperLoose$6(mutationsList), _step4; !(_step4 = _iterator4()).done;) { var mutation = _step4.value; for (var _iterator5 = _createForOfIteratorHelperLoose$6(mutation.addedNodes), _step5; !(_step5 = _iterator5()).done;) { var addedNode = _step5.value; if (addedNode.nodeType !== Node.ELEMENT_NODE) { continue; } var botBubble = addedNode.querySelector(Selector$A.WEB_CHAT_BUBBLE_FROM_BOT); // Not a message from bot, or bot is still generating a response if (!botBubble || botBubble.textContent.startsWith(this.botGeneratingResponseText)) { continue; } // Message from bot rendered, reenable web chat elements. // Don't handle this for live person messages. if (!this.isLivePersonChatActive) { this.toggleWebChatDisabled(false); } // Clear timeout clearTimeout(this.messageWaitTimeout); if (this.webChatTextAreaHadFocus) { this.webChatTextarea.focus(); } return; // Exit once bot bubble is found and handled } } } /** * Hide live person messages and transcript form that would trigger a new chat with LivePerson. */; _proto.hideLivePersonChatIntroElems = function hideLivePersonChatIntroElems() { // get all of the intro messages and forms var introElems = this.getLPIntroMessageElements(); introElems.forEach(function (elem) { // Find the parent 'article' element and hide it var articleElem = elem.closest(Selector$A.ARTICLE); if (articleElem) { articleElem.hidden = true; } }); } /** * Initialize chat. * @param {string} initialChatText Optional initial chat text to send to bot */; _proto.initChat = /*#__PURE__*/ function () { var _initChat = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(initialChatText) { var _this22 = this; var token; return _regeneratorRuntime().wrap(function _callee18$(_context18) { while (1) { switch (_context18.prev = _context18.next) { case 0: if (initialChatText === void 0) { initialChatText = ''; } _context18.next = 3; return _classPrivateFieldLooseBase(this, _generateDirectLineToken)[_generateDirectLineToken](); case 3: token = _context18.sent; // Create Redux store for WebChat this.store = window.WebChat.createStore({}, function (_ref4) { var dispatch = _ref4.dispatch; return function (next) { return /*#__PURE__*/function () { var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(action) { var cookieCreation, currentTime, result; return _regeneratorRuntime().wrap(function _callee17$(_context17) { while (1) { switch (_context17.prev = _context17.next) { case 0: _context17.t0 = action.type; _context17.next = _context17.t0 === 'DIRECT_LINE/CONNECT' ? 3 : _context17.t0 === 'DIRECT_LINE/CONNECT_FULFILLED' ? 5 : _context17.t0 === 'DIRECT_LINE/POST_ACTIVITY' ? 8 : _context17.t0 === 'DIRECT_LINE/POST_ACTIVITY_FULFILLED' ? 11 : _context17.t0 === 'DIRECT_LINE/INCOMING_ACTIVITY' ? 13 : _context17.t0 === 'WEB_CHAT/SEND_MESSAGE' ? 15 : 23; break; case 3: _this22.handlePreConnect(); return _context17.abrupt("break", 24); case 5: _this22.handleConnectFulfilled(dispatch); _this22.sendLPFeatureFlagToBot(dispatch); return _context17.abrupt("break", 24); case 8: if (!(_this22.isLivePersonChatActive && action.payload.activity.name !== EventName$A.LIVEPERSON_SAVE_IDS)) { _context17.next = 10; break; } return _context17.abrupt("return"); case 10: return _context17.abrupt("break", 24); case 11: _this22.handlePostActivityFulfilled(action, initialChatText); return _context17.abrupt("break", 24); case 13: _this22.handleIncomingActivity(action, dispatch); return _context17.abrupt("break", 24); case 15: if (!_this22.isLivePersonChatActive) { _context17.next = 20; break; } // Change the composing state to pause before sending a message _this22.debouncedChatStateToPause.cancel({ upcomingOnly: true }); _this22.chatStateToPause(); // Send the message text to LivePerson _this22.handleLivePersonSendMessage(action.payload.text); // Return early to prevent dispatching the action to next middleware or store return _context17.abrupt("return"); case 20: // Refresh/Regenerate the token if (token) { cookieCreation = _this22.getAIChatDrawerCookieObject()[StorageKeys.tokenCreated]; currentTime = Date.now() / 1000; if (currentTime - cookieCreation < _this22.refreshAfter) { _classPrivateFieldLooseBase(_this22, _refreshDirectLineToken)[_refreshDirectLineToken](); } } else { _classPrivateFieldLooseBase(_this22, _regenerateAIChatDrawerToken)[_regenerateAIChatDrawerToken](); } _this22.handleWebChatSendMessage(action); return _context17.abrupt("break", 24); case 23: return _context17.abrupt("break", 24); case 24: // Dispatch the action to next middleware or store result = next(action); return _context17.abrupt("return", result); case 26: case "end": return _context17.stop(); } } }, _callee17); })); return function (_x23) { return _ref5.apply(this, arguments); }; }(); }; }); this.directLine = window.WebChat.createDirectLine({ token: token, webSocket: true }); // Makes connection to Engine through direct line, with the defined actions and parameters this.renderWebChat(); case 7: case "end": return _context18.stop(); } } }, _callee18, this); })); function initChat(_x22) { return _initChat.apply(this, arguments); } return initChat; }() /** * Sends an event to the Copilot Chatbot which will update its LivePerson feature flag * to the current state of the client. * @param {Function} dispatch - The dispatch function (Redux) */ ; _proto.sendLPFeatureFlagToBot = function sendLPFeatureFlagToBot(dispatch) { dispatch({ type: 'DIRECT_LINE/POST_ACTIVITY', meta: { method: 'keyboard' }, payload: { activity: { type: 'event', name: 'livePersonFeatureFlagEvent', value: { livePersonFeatureFlag: this.isLivePersonChatFeatureEnabled }, channelData: { postBack: true } } } }); } /** * Split the transcript into chunks that are within the LivePerson message character limit. * * @param {string} transcript The transcript to split * @returns {string[]} An array of transcript chunks */; _proto.splitTranscript = function splitTranscript(transcript) { var chunks = []; var startIndex = 0; var continuedText = this.transcriptContinuedText + "\n\n"; var continuedTextLength = continuedText.length; while (startIndex < transcript.length) { var endIndex = startIndex + this.livePersonMessageCharLimit; if (chunks.length > 0) { endIndex -= continuedTextLength; } if (endIndex > transcript.length) { endIndex = transcript.length; } else { // Ensure we don't split in the middle of a word var lastSpaceIndex = transcript.lastIndexOf(' ', endIndex); if (lastSpaceIndex > startIndex) { endIndex = lastSpaceIndex; } } var chunk = transcript.slice(startIndex, endIndex).trim(); if (chunks.length > 0) { chunk = continuedText + chunk; } chunks.push(chunk); startIndex = endIndex; } return chunks; } /** * Send the chat transcript to LivePerson. If the transcript exceeds the character limit, split it into multiple messages. * * @returns {void} */; _proto.sendTranscriptToLivePerson = function sendTranscriptToLivePerson() { var _this23 = this; var messageBubbleElems = Array.from(this.webChatTranscriptElem.querySelectorAll(Selector$A.WEB_CHAT_BUBBLE)); if (!messageBubbleElems.length) { console.error('No messages found in the WebChat transcript'); return; } var fullTranscript = this.transcriptIntroText + "\n\n"; messageBubbleElems.forEach(function (messageBubbleElem) { var fromText = messageBubbleElem.classList.contains(Selector$A.WEB_CHAT_BUBBLE_FROM_USER.replace('.', '')) ? _this23.transcriptFromUserText : _this23.transcriptFromAssistantText; var messageTextContent = messageBubbleElem.textContent.trim(); fullTranscript += fromText + " " + messageTextContent + "\n\n"; }); var fullTranscriptCharCount = fullTranscript.length; if (fullTranscriptCharCount > this.livePersonMessageCharLimit) { // Send multiple messages if the full transcript exceeds the character limit var messages = this.splitTranscript(fullTranscript, this.livePersonMessageCharLimit); messages.forEach( /*#__PURE__*/function () { var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(message) { return _regeneratorRuntime().wrap(function _callee19$(_context19) { while (1) { switch (_context19.prev = _context19.next) { case 0: _context19.next = 2; return _this23.handleLivePersonSendMessage(message); case 2: _context19.next = 4; return new Promise(function (resolve) { return setTimeout(resolve, 500); }); case 4: case "end": return _context19.stop(); } } }, _callee19); })); return function (_x24) { return _ref6.apply(this, arguments); }; }()); } else { // Send the full transcript as a single message this.handleLivePersonSendMessage(fullTranscript); } } /** * Handle feedback event activity sent from the Copilot. * Update accessibility properties for the feedback buttons. * Add event listeners to feedback buttons. * @param {Object} action - The action object (Redux) * @param {Function} dispatch - The dispatch function (Redux) */; _proto.handleFeedbackRequestFromBot = function handleFeedbackRequestFromBot(action, dispatch) { var _this24 = this; var messageId = action.payload.activity.value; var positiveActionSet = document.getElementById(messageId + "-positive"); var negativeActionSet = document.getElementById(messageId + "-negative"); if (positiveActionSet) { var positiveButton = positiveActionSet.querySelector('button'); positiveButton.classList.add(ClassName$q.FEEDBACK_BUTTON); positiveButton.setAttribute('aria-label', this.botFeedbackPositiveAriaLabel); positiveButton.querySelector('div').setAttribute('aria-hidden', 'true'); positiveButton.addEventListener(EventName$A.CLICK, function () { _this24.handleFeedbackButtonClick(dispatch, messageId, 'positive', positiveButton); }); var positiveButtonImg = positiveButton.querySelector('img'); if (positiveButtonImg) { positiveButtonImg.setAttribute('alt', ''); } } if (negativeActionSet) { var negativeButton = negativeActionSet.querySelector('button'); negativeButton.classList.add(ClassName$q.FEEDBACK_BUTTON); negativeButton.setAttribute('aria-label', this.botFeedbackNegativeAriaLabel); negativeButton.querySelector('div').setAttribute('aria-hidden', 'true'); negativeButton.addEventListener(EventName$A.CLICK, function () { _this24.handleFeedbackButtonClick(dispatch, messageId, 'negative', negativeButton); }); var negativeButtonImg = negativeButton.querySelector('img'); if (negativeButtonImg) { negativeButtonImg.setAttribute('alt', ''); } } } /** * Handle incoming adaptive card from the bot. * Add a class to the follow-up bubble content to remove the background. * Disable the deflection flow buttons after click. * * @param {Object} adaptiveCardData - The adaptive card data */; _proto.handleIncomingAdaptiveCard = function handleIncomingAdaptiveCard(adaptiveCardData) { var _adaptiveCardData$id, _adaptiveCardData$bod; if ((_adaptiveCardData$id = adaptiveCardData.id) != null && _adaptiveCardData$id.startsWith('follow-up')) { var adaptiveCardId = adaptiveCardData.id; // Use setTimeout to ensure the adaptive card is rendered before adding the class window.setTimeout(function () { var followUpAdaptiveCardElem = document.getElementById(adaptiveCardId); if (followUpAdaptiveCardElem) { // Add class to remove background from follow-up bubble content var webChatBubbleContent = followUpAdaptiveCardElem.closest(Selector$A.WEB_CHAT_BUBBLE_CONTENT); webChatBubbleContent.classList.add(ClassName$q.WEBCHAT_BUBBLE_CONTENT_FOLLOW_UP); } }); } else if ((_adaptiveCardData$bod = adaptiveCardData.body) != null && _adaptiveCardData$bod.length) { for (var _iterator6 = _createForOfIteratorHelperLoose$6(adaptiveCardData.body), _step6; !(_step6 = _iterator6()).done;) { var _bodyItem$id; var bodyItem = _step6.value; if ((_bodyItem$id = bodyItem.id) != null && _bodyItem$id.startsWith('deflection-')) { var _ret = function () { var deflectionFlowId = bodyItem.id; // Wait until deflection flow card is rendered using setTimeout window.setTimeout(function () { var _document$getElementB; var deflectionFlowCardElem = (_document$getElementB = document.getElementById(deflectionFlowId)) == null ? void 0 : _document$getElementB.closest(Selector$A.ARTICLE); if (deflectionFlowCardElem) { (function () { var deflectionFlowButtons = deflectionFlowCardElem.querySelectorAll('button'); for (var _iterator7 = _createForOfIteratorHelperLoose$6(deflectionFlowButtons), _step7; !(_step7 = _iterator7()).done;) { var button = _step7.value; // Disable all buttons after any one of them is clicked button.addEventListener(EventName$A.CLICK, function () { for (var _iterator8 = _createForOfIteratorHelperLoose$6(deflectionFlowButtons), _step8; !(_step8 = _iterator8()).done;) { var btn = _step8.value; btn.disabled = true; } }); } })(); } }); return "break"; // break out of loop after finding deflection flow item }(); if (_ret === "break") break; } } } } /** * Handle incoming activity from the WebChat store. * * @param {Object} action - The action object (Redux) * @param {Function} dispatch - The dispatch function (Redux) */; _proto.handleIncomingActivity = function handleIncomingActivity(action, dispatch) { var _activity$from, _activity$attachments, _activity$attachments2, _activity$from2; var activity = action.payload.activity; if (activity.type === 'message' && ((_activity$from = activity.from) == null ? void 0 : _activity$from.role) === 'bot' && (_activity$attachments = activity.attachments) != null && _activity$attachments.length && ((_activity$attachments2 = activity.attachments[0].content) == null ? void 0 : _activity$attachments2.type) === 'AdaptiveCard') { var adaptiveCardData = activity.attachments[0].content; this.handleIncomingAdaptiveCard(adaptiveCardData); } if (activity.type === 'message' && ((_activity$from2 = activity.from) == null ? void 0 : _activity$from2.role) === 'bot' && !this.isLivePersonChatActive) { // emit an event that a message is received. Developers can listen to this event to perform additional actions, such as fire telemetry events. var event = new Event(EventName$A.WEBCHAT_MESSAGE_RECEIVED); window.dispatchEvent(event); } if (this.isLivePersonChatActive && activity.type === 'message') { this.handleLivePersonIncomingActivity(activity); } if (activity.type === 'event' && activity.name === EventName$A.FEEDBACK_SENT) { this.handleFeedbackRequestFromBot(action, dispatch); } if (activity.type === 'event' && activity.name === EventName$A.GENERATE_REIMAGINE_UMP) { this.handleReimagineUMPRequest(action, dispatch); } if (activity.type === 'event' && activity.name === EventName$A.LIVEPERSON_CHAT_START && !Object.keys(this.lpOpenConvs).length) { var _this$updateAIChatDra5; this.skillId = activity.value.skillId; this.accountId = activity.value.accountId; this.isSendTranscript = activity.value.sendTranscript; // If this "startLPChat" activity has already been seen (from bot chat history), don't start a new LivePerson chat if (this.startLPChatActivityIds.includes(activity.id)) { return; } this.startLPChatActivityIds.push(activity.id); this.updateAIChatDrawerCookie((_this$updateAIChatDra5 = {}, _this$updateAIChatDra5[StorageKeys.startLPChatActivityIds] = this.startLPChatActivityIds, _this$updateAIChatDra5)); this.initLivePersonChat(); } } /* * @returns {NodeList} - The list of elements that are part of the LivePerson chat intro messages and send transcript forms */; _proto.getLPIntroMessageElements = function getLPIntroMessageElements() { return this.el.querySelectorAll("[id^=\"form-\"], [id^=\"greeting-\"], [id^=\"post-\"]"); } /** * Handle sending a message to the bot from the WebChat. * * @param {Object} action - The action object (Redux) */; _proto.handleWebChatSendMessage = /*#__PURE__*/ function () { var _handleWebChatSendMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(action) { var _this25 = this; return _regeneratorRuntime().wrap(function _callee20$(_context20) { while (1) { switch (_context20.prev = _context20.next) { case 0: if (document.activeElement === this.webChatTextarea) { this.webChatTextAreaHadFocus = true; } // Ensure channelData exists and add pageUrl action.payload = action.payload || {}; action.payload.channelData = Object.assign({}, action.payload.channelData, { pageUrl: window.location.href }); this.toggleWebChatDisabled(true); this.messageWaitTimeout = setTimeout(function () { _this25.toggleWebChatDisabled(false); }, this.messageWaitTimeoutDuration); // If source site has changed, send updated source site to bot, and update cookie if (!(this.sourceSite !== this.getAIChatDrawerCookieObject()[StorageKeys.sourceSite])) { _context20.next = 8; break; } _context20.next = 8; return this.updateSourceSite(this.sourceSite); case 8: case "end": return _context20.stop(); } } }, _callee20, this); })); function handleWebChatSendMessage(_x25) { return _handleWebChatSendMessage.apply(this, arguments); } return handleWebChatSendMessage; }() /** * Update the chat state of the user in the LivePerson chat. * * @param {string} state The chat state * @returns {Promise} A promise that resolves when the chat state is updated */ ; _proto.chatStateTo = /*#__PURE__*/ function () { var _chatStateTo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(state) { var conversationId; return _regeneratorRuntime().wrap(function _callee21$(_context21) { while (1) { switch (_context21.prev = _context21.next) { case 0: conversationId = Object.keys(this.lpOpenConvs)[0]; return _context21.abrupt("return", this.lpWebsocket.publishEvent({ dialogId: this.lpOpenConvs[conversationId].activeDialogId, conversationId: Object.keys(this.lpOpenConvs)[0], event: { type: 'ChatStateEvent', chatState: state } })); case 2: case "end": return _context21.stop(); } } }, _callee21, this); })); function chatStateTo(_x26) { return _chatStateTo.apply(this, arguments); } return chatStateTo; }() /** * Set the user's chat state to COMPOSING for LivePerson */ ; _proto.chatStateToComposing = function chatStateToComposing() { try { this.chatStateTo(livePersonChatStateTypes.COMPOSING); } catch (error) { console.error('Error setting user chat state to COMPOSING:', error); } } /** * Set the user's chat state to PAUSE for LivePerson */; _proto.chatStateToPause = function chatStateToPause() { try { this.chatStateTo(livePersonChatStateTypes.PAUSE); } catch (error) { console.error('Error setting user chat state to PAUSE:', error); } } /** * Returns whether the AI Chat Drawer is visually suppressed or not. * The AI Chat Drawer is visually suppressed if the isHidden attribute is set to true. * This is used in scenarios where the AI Chat Drawer should be rendered in HTML, but should not be (or become) visible to the user. * @returns {boolean} - Whether the AI Chat Drawer is visually suppressed or not */; _proto.getIsHidden = function getIsHidden() { return this.el.getAttribute(Attributes$5.IS_HIDDEN) !== null; } /** * Debounce input event on WebChat textarea to set the user's chat state to COMPOSING and PAUSE for LivePerson. */; _proto.handleLpUserInput = function handleLpUserInput() { this.debouncedChatStateToComposing(); this.debouncedChatStateToPause(); } /** * Handle sending message to LivePerson. * * @param {string} messageText The text to send to LivePerson * @param {string} messageId The message ID (only used when retrying sending a message) * @param {number} retryCount The current retry count */; _proto.handleLivePersonSendMessage = function handleLivePersonSendMessage(messageText, messageId, retryCount) { var _this26 = this; if (messageId === void 0) { messageId = null; } if (retryCount === void 0) { retryCount = 0; } var isTranscriptMessage = messageText.startsWith(this.transcriptIntroText) || messageText.startsWith(this.transcriptContinuedText); messageText = new DOMParser().parseFromString(messageText, 'text/html').body.textContent; // Generate a messageId if one wasn't provided, and immediately render the message in the // WebChat UI with the generated messageId (if not a transcript message) if (!messageId && !isTranscriptMessage) { messageId = Math.floor(Math.random() * 1e9); // Render the message in the WebChat UI with the generated messageId var timestampString = new Date().toISOString(); var userId = _classPrivateFieldLooseBase(this, _getLivePersonIdFromJWT)[_getLivePersonIdFromJWT](); this.webChatSendMessage(messageText, timestampString, 'user', userId, messageId, null); // Preemptively set the dialog-id and sequence attributes on the message element // This will prevent duplicate messages when LivePerson sends back a ContentEvent setTimeout(function () { var renderedMessageElem = _this26.webChatTranscriptElem.querySelector("[data-lp-message-id=\"" + messageId + "\"]"); if (renderedMessageElem) { var _this26$lpOpenConvs$O; var activeDialogId = (_this26$lpOpenConvs$O = _this26.lpOpenConvs[Object.keys(_this26.lpOpenConvs)[0]]) == null ? void 0 : _this26$lpOpenConvs$O.activeDialogId; if (activeDialogId) { renderedMessageElem.dataset.lpMessageDialogId = activeDialogId; // We don't know the sequence yet, but we can use a placeholder that will prevent duplicates renderedMessageElem.dataset.lpMessageSequence = 'pending'; } } // Dispatch event that LivePerson message is rendered var event = new CustomEvent(EventName$A.LIVEPERSON_MESSAGE_RENDERED, { detail: { messageId: messageId } }); window.dispatchEvent(event); }, 0); } var timeoutPromise = function timeoutPromise(ms) { return new Promise(function (_, reject) { return setTimeout(function () { return reject(new LPError(LPErrorTypes.SEND_MESSAGE_TIMEOUT, 'Send message to LivePerson timed out', { messageId: messageId })); }, ms); }); }; // Resolve the promise that completes first Promise.race([this.publishToLivePersonWebsocket(messageText, messageId), timeoutPromise(livePersonResponseTimeout)]).then(function (response) { var _response$body; _this26.handleLivePersonResponse(response); var messageId = response.reqId; var renderedMessageElem = _this26.webChatTranscriptElem.querySelector("[data-lp-message-id=\"" + messageId + "\"]"); if (renderedMessageElem && ((_response$body = response.body) == null ? void 0 : _response$body.sequence) >= 0) { // Add data-lp-message-dialog-id and data-lp-message-sequence attributes to the found message element renderedMessageElem.dataset.lpMessageDialogId = _this26.lpOpenConvs[Object.keys(_this26.lpOpenConvs)[0]].activeDialogId; renderedMessageElem.dataset.lpMessageSequence = response.body.sequence; // Update the message element to show the timestamp _this26.markMessageAsSent(renderedMessageElem); } })["catch"](function (error) { error.data.messageId = messageId; _this26.handleLivePersonError(error, function (messageId, newRetryCount) { return _this26.handleLivePersonSendMessage(messageText, messageId, newRetryCount); }, retryCount); }); } /** * Handle LivePerson incoming activity. * * @param {Object} activity - The activity for a LivePerson incoming message */; _proto.handleLivePersonIncomingActivity = function handleLivePersonIncomingActivity(activity) { var _this27 = this; var activityText = activity.text, activityId = activity.id, messageSequence = activity.sequence; if (!activityText) { console.error('No text found in LivePerson message activity'); return; } // Use MutationObserver to wait until message is rendered in the WebChat transcript var observer = new MutationObserver(function (mutationsList, observer) { var _activity$from3; for (var _iterator9 = _createForOfIteratorHelperLoose$6(mutationsList), _step9; !(_step9 = _iterator9()).done;) { var mutation = _step9.value; if (mutation.type === 'childList') { for (var _iterator10 = _createForOfIteratorHelperLoose$6(mutation.addedNodes), _step10; !(_step10 = _iterator10()).done;) { var node = _step10.value; if (node.nodeType === Node.ELEMENT_NODE) { var messageBubbleElem = node.querySelector(Selector$A.WEB_CHAT_BUBBLE); /* eslint-disable max-depth */ if (messageBubbleElem && Util.normalizeText(messageBubbleElem.textContent) === Util.normalizeText(activityText)) { switch ((_activity$from3 = activity.from) == null ? void 0 : _activity$from3.role) { case 'lp-system': { // Add class to system message bubble to style it differently messageBubbleElem.classList.add(ClassName$q.WEBCHAT_BUBBLE_LP_SYSTEM_MESSAGE); // Add screen-reader-only class to timestamp to hide it visually var timestampElem = node.querySelector(Selector$A.WEB_CHAT_STATUS); timestampElem == null ? void 0 : timestampElem.classList.add(ClassName$q.SCREEN_READER_ONLY); break; } case 'user': { // Activity is from user, either from user sending a message, or from websocket event var articleElem = messageBubbleElem.closest(Selector$A.ARTICLE); if (articleElem) { // Add data-lp-message-id attribute to the article element articleElem.dataset.lpMessageId = activityId; if (messageSequence !== null && messageSequence !== undefined && messageSequence >= 0) { // Activity is from LivePerson data and has a sequence // Add data-lp-message-dialog-id and data-lp-message-sequence attributes to the article element articleElem.dataset.lpMessageDialogId = _this27.lpOpenConvs[Object.keys(_this27.lpOpenConvs)[0]].activeDialogId; articleElem.dataset.lpMessageSequence = messageSequence; } else if (!articleElem.dataset.lpMessageSequence || articleElem.dataset.lpMessageSequence === 'pending') { // Message from user is still pending _this27.markMessageAsSending(articleElem); } } break; } case 'bot': { // Message is from LivePerson bot var _articleElem = messageBubbleElem.closest(Selector$A.ARTICLE); if (_articleElem) { // Add data-lp-message-dialog-id attribute to the article element _articleElem.dataset.lpMessageDialogId = _this27.lpOpenConvs[Object.keys(_this27.lpOpenConvs)[0]].activeDialogId; // Add data-lp-message-sequence attribute to the article element _articleElem.dataset.lpMessageSequence = messageSequence; } break; } // No default } // Stop observing once the element is found and modified observer.disconnect(); return; } /* eslint-enable max-depth */ } } } } }); // Start observing the target node for configured mutations var targetNode = document.querySelector(Selector$A.WEB_CHAT_TRANSCRIPT); var config = { childList: true, subtree: true }; observer.observe(targetNode, config); } /** * Handles the timeout for sending a message via LivePerson. * * This function is triggered when a message fails to send within a specified timeout period. * It attempts to find the message element in the web chat transcript using the provided messageId. * If the message element is found, it marks the message as failed to send. * * @param {string} messageId - The unique identifier of the message that failed to send. */; _proto.handleLivePersonSendMessageTimeout = function handleLivePersonSendMessageTimeout(messageId) { var messageElem = this.webChatTranscriptElem.querySelector("[data-lp-message-id=\"" + messageId + "\"]"); if (!messageElem) { console.error("Message element with messageId " + messageId + " not found"); return; } // Set the message sequence to -1 to indicate that the message failed to send messageElem.dataset.lpMessageSequence = -1; // Mark the message as failed to send this.markMessageAsSendFailed(messageElem); } /** * Creates a quick component and appends it to the associated Adaptive Card container's DOM * then initializes the UMP with the provided data from the event action. * @param {} action */; _proto.handleReimagineUMPRequest = function handleReimagineUMPRequest(action) { // The UMP script and package should be added to pages already. /* eslint-disable no-undef */ if (!ump) { console.error('UMP is not defined'); return; } var _action$payload$activ = action.payload.activity.value, dataVideo = _action$payload$activ.dataVideo, messageId = _action$payload$activ.messageId; var umpContainer = document.getElementById("" + messageId); if (!umpContainer) { console.error("UMP container with messageId " + messageId + " not found"); return; } umpContainer.innerHTML = _classPrivateFieldLooseBase(this, _UMP_HTML_TEMPLATE)[_UMP_HTML_TEMPLATE]; var umplayer = umpContainer.querySelector('universal-media-player'); ump(umplayer, dataVideo); /* eslint-enable no-undef */ } /* * Handle feedback button click. * Updates the icon to the filled svg icon. * Post a 'feedback' event activity to the bot. * @param {Function} dispatch - The dispatch function (Redux) * @param {string} messageId - The message ID * @param {string} interactionResult - The interaction result (positive/negative) */; _proto.handleFeedbackButtonClick = function handleFeedbackButtonClick(dispatch, messageId, interactionResult, thisButton) { // Updates icon in the button var iconSrc = thisButton.querySelector('img').src; if (iconSrc && interactionResult === 'positive') { thisButton.querySelector('img').setAttribute('src', FEEDBACK_ICON_SVGS.POSITIVE_FILLED); } else if (iconSrc && interactionResult === 'negative') { thisButton.querySelector('img').setAttribute('src', FEEDBACK_ICON_SVGS.NEGATIVE_FILLED); } // Send the event activity to the bot dispatch({ type: 'DIRECT_LINE/POST_ACTIVITY', meta: { method: 'keyboard' }, payload: { activity: { channelData: { postBack: true }, name: "feedback" + interactionResult + "Request", type: 'event', text: messageId, value: { sourceSite: this.sourceSite } } } }); } /** * Code to run while connecting to the bot. Dispatch a custom event to indicate that the WebChat * connection is being initiated. */; _proto.handlePreConnect = function handlePreConnect() { var event = new Event(EventName$A.WEBCHAT_CONNECT_INITIATED); window.dispatchEvent(event); } /** * Handle connect fulfilled event on the WebChat instance. Send a 'startConversation' event to the bot. * @param {Function} dispatch - The dispatch function (Redux) */; _proto.handleConnectFulfilled = function handleConnectFulfilled(dispatch) { dispatch({ meta: { method: 'keyboard' }, payload: { activity: { channelData: { postBack: true, pageUrl: window.location.href }, name: 'startConversation', type: 'event', value: { sourceSite: this.sourceSite, leadId: this.getLeadId() } } }, type: 'DIRECT_LINE/POST_ACTIVITY' }); var event = new Event(EventName$A.WEBCHAT_CONNECT_FULFILLED); window.dispatchEvent(event); } /** * Handle post activity fulfilled event on the WebChat instance. If the activity is a 'startConversation' event, dispatch * a custom event to send initial chat text to the bot. * @param {Object} action - The action object (Redux) * @param {string} initialChatText - Optional initial chat text to send to bot */; _proto.handlePostActivityFulfilled = function handlePostActivityFulfilled(action, initialChatText) { var _action$payload$activ2 = action.payload.activity, type = _action$payload$activ2.type, name = _action$payload$activ2.name; if (type === 'event' && name === 'startConversation') { var event = new Event(EventName$A.START_CONVERSATION_FULFILLED); event.data = initialChatText; window.dispatchEvent(event); } if (type === 'event' && name === 'sourceSiteEvent') { // Resolve the sourceSite update promise this.resolveSourceSiteUpdate(); } } /** * Set the isHidden attribute on the AI Chat Drawer. If true, the AI Chat Drawer will be visually suppressed and not shown to the user. * @param {boolean} isHidden - Whether the AI Chat Drawer should be visually suppressed or not */; _proto.setIsHidden = function setIsHidden(isHidden) { if (isHidden) { this.el.setAttribute(Attributes$5.IS_HIDDEN, ''); // Set attribute with no value this.showChatButton(false); } else { this.el.removeAttribute(Attributes$5.IS_HIDDEN); // AI Chat Drawer is unhidden, need to add events for chat action type links var eventsToAdd = this.addChatActionTypeLinkEvents(); if (eventsToAdd.length) { Util$1.addEvents(eventsToAdd); } } } /** * Marks a message as sending by appending a bulleted span to the status message. * * @param {HTMLElement} element - The HTML element representing the message to be marked as sending. */; _proto.markMessageAsSending = function markMessageAsSending(element) { this.appendBulletedSpanToStatusMessage(element, this.livePersonSendingMessageText); } /** * Marks a message as sent by removing the "* Sending" status message. * * @param {HTMLElement} element - The HTML element representing the message to be marked as sent. */; _proto.markMessageAsSent = function markMessageAsSent(element) { // Remove * Sending from the status message this.removeBulletedSpanFromStatusMessage(element); } /** * Marks a message as failed to send and provides a retry option. * * @param {HTMLElement} element - The message element to mark as failed. * @returns {void} */; _proto.markMessageAsSendFailed = function markMessageAsSendFailed(element) { var _this28 = this; if (!element) { console.error('No message element found'); return; } var statusMessage = element.querySelector(Selector$A.WEB_CHAT_STATUS); if (!statusMessage) { console.error('No status message found in message element'); return; } // Clear existing HTML from statusMessage statusMessage.innerHTML = ''; var sendFailedSpan = document.createElement('span'); sendFailedSpan.textContent = this.livePersonSendFailedText; statusMessage.append(sendFailedSpan); // Add retry button var retryButton = document.createElement('a'); retryButton.setAttribute('role', 'button'); retryButton.setAttribute('href', '#'); retryButton.textContent = this.retryButtonText; retryButton.dataset.biCompnm = 'AI Chat Drawer'; retryButton.dataset.biId = 'ai-chat-drawer'; retryButton.dataset.biCn = this.retryButtonText; retryButton.dataset.biEcn = 'Retry'; var handleRetryButtonClick = function handleRetryButtonClick(event) { event.preventDefault(); // Get the text content of the message bubble var messageText = element.querySelector(Selector$A.WEB_CHAT_BUBBLE_CONTENT).textContent; if (!messageText) { console.error('No message text found in message bubble'); return; } // Send a new message to LivePerson with the same text _this28.handleLivePersonSendMessage(messageText); }; retryButton.addEventListener(EventName$A.CLICK, handleRetryButtonClick); retryButton.addEventListener(EventName$A.KEYDOWN, function (event) { if (event.key === 'Enter' || event.key === ' ') { handleRetryButtonClick(event); } }); statusMessage.append(retryButton); } /** * Mark the message as read in the WebChat transcript. * * @param {HTMLElement} element - The message element to mark as read */; _proto.markMessageAsRead = function markMessageAsRead(element) { this.appendBulletedSpanToStatusMessage(element, this.livePersonReadText); } /** * Appends a bulleted span with the specified text to the status message element within the given element. * * @param {HTMLElement} element - The parent element containing the status message element. * @param {string} textToAppend - The text to append as a bulleted span. */; _proto.appendBulletedSpanToStatusMessage = function appendBulletedSpanToStatusMessage(element, textToAppend) { var _statusMessage$textCo; if (!element) { return; } var statusMessage = element.querySelector(Selector$A.WEB_CHAT_STATUS); if (!statusMessage) { return; } var isAlreadyMarked = (_statusMessage$textCo = statusMessage.textContent) == null ? void 0 : _statusMessage$textCo.includes(textToAppend); if (!isAlreadyMarked) { var bulletedSpan = document.createElement('span'); bulletedSpan.innerHTML = "• " + textToAppend; statusMessage.append(bulletedSpan); } } /** * Removes any span elements that start with a bullet point (•) from the status message within the given element. * * @param {HTMLElement} element - The parent element containing the status message. */; _proto.removeBulletedSpanFromStatusMessage = function removeBulletedSpanFromStatusMessage(element) { if (!element) { return; } var statusMessage = element.querySelector(Selector$A.WEB_CHAT_STATUS); if (!statusMessage) { return; } var spans = statusMessage.querySelectorAll('span'); for (var _iterator11 = _createForOfIteratorHelperLoose$6(spans), _step11; !(_step11 = _iterator11()).done;) { var span = _step11.value; if (span.textContent.startsWith('•')) { span.remove(); } } } /** * Code to run when the UHF header intersects with the viewport. Add/remove scroll listener to align chat drawer with bottom * of UHF header, or top of viewport. * @param {IntersectionObserverEntry[]} entries - Array of intersection observer entries */; _proto.onUhfHeaderIntersect = function onUhfHeaderIntersect(entries) { var _this29 = this; entries.forEach(function (entry) { if (entry.isIntersecting) { // UHF header is visible. Add scroll listener to align chat drawer with bottom of UHF header _this29.uhfHeaderIsVisible = true; document.addEventListener(EventName$A.SCROLL, _this29.boundOnScrollWithUhfVisible, false); _this29.boundOnScrollWithUhfVisible(); } else { // UHF header is not visible. Remove scroll listener, align chat drawer to top of viewport. _this29.uhfHeaderIsVisible = false; document.removeEventListener(EventName$A.SCROLL, _this29.boundOnScrollWithUhfVisible, false); _this29.el.style.top = 0; _this29.el.style.height = '100%'; } }); } /** * Code to run when the sticky nav is stuck/unstuck. Align chat drawer with bottom of sticky nav when stuck, otherwise align * to top of viewport. * @param {MutationRecord[]} mutations - Array of mutation records */; _proto.onStickyNavMutation = function onStickyNavMutation(mutations) { var _this30 = this; mutations.forEach(function (mutation) { var classHasChanged = mutation.target.getAttribute('class') !== mutation.oldValue; // Ignore mutations that don't involve the sticky nav being stuck/unstuck if (!classHasChanged || mutation.target.classList.contains(ClassName$q.GET_HEIGHT) || mutation.oldValue.includes(ClassName$q.GET_HEIGHT)) { return; } var isStuck = mutation.target.classList.contains(ClassName$q.STUCK); if (isStuck) { // Sticky nav is stuck. Align chat drawer with bottom of sticky nav. var stickyNavBottom = _this30.stickyNavElem.getBoundingClientRect().bottom; _this30.el.style.top = stickyNavBottom + "px"; _this30.el.style.height = "calc(100% - " + stickyNavBottom + "px)"; } else if (_this30.uhfHeaderElem && _this30.uhfHeaderElem.getBoundingClientRect().bottom > 0) { // When the sticky nav transitions from desktop to mobile and is in unstuck, it aligns to the top of the viewport. // If the UHF header is still in view, align the chat drawer to the bottom of the UHF header. _this30.onScrollWithUhfVisible(); } else { // Sticky nav went from stuck to unstuck. Align chat drawer to top of viewport. _this30.el.style.top = 0; _this30.el.style.height = '100%'; } }); } /** * Code to run when the page is scrolled and the UHF header is visible. Align chat drawer with bottom of UHF header. */; _proto.onScrollWithUhfVisible = function onScrollWithUhfVisible() { var _this31 = this; if (!this.uhfHeaderElem) { return; } var ticking = false; if (!ticking) { window.requestAnimationFrame(function () { var uhfHeaderBottom = _this31.uhfHeaderElem.getBoundingClientRect().bottom + uhfHeaderMarginBottomVal; // At smaller viewports (<860px), the nav bar turns into a dropdown with position:absolute, and a margin-bottom is added to the header. // Align the chat drawer below the dropdown to avoid overlapping the nav menu when it takes full width at VP1 (360px). var marginBottom = parseFloat(window.getComputedStyle(_this31.uhfHeaderElem).marginBottom); var totalUhfBottom = uhfHeaderBottom + marginBottom; _this31.el.style.top = totalUhfBottom + "px"; _this31.el.style.height = "calc(100% - " + totalUhfBottom + "px)"; ticking = false; }); ticking = true; } } /** * Code to run when the browser is resized, to adjust the chat drawer's position and related UI elements. * - If the UHF header is visible, aligns the chat drawer with the bottom of the UHF header. * - Toggles the UHF footer padding based on the chat button/drawer visibility. */; _proto.onBrowserResize = function onBrowserResize() { if (this.uhfHeaderIsVisible) { // If the UHF header is visible, align chat drawer with bottom of UHF header this.onScrollWithUhfVisible(); } // Toggle the UHF footer bottom padding based on whether the chat is hidden or not this.toggleUHFBottomPadding(this.mediaQueryListChatHidden.matches); } /** * Code to run when the media query list for chat hidden changes. Toggle the UHF footer padding based on whether the chat is * hidden or not. * * @param {MediaQueryListEvent} event - The media query list event */; _proto.onMediaQueryListChatHiddenChange = function onMediaQueryListChatHiddenChange(event) { this.toggleUHFBottomPadding(event.matches); } /** * Handles changes to the media query list for modal dialog mode. * Toggles modal dialog mode based on whether the media query matches. * * @param {MediaQueryListEvent} event - The event object representing the change in the media query list. */; _proto.onMediaQueryListModalDialogChange = function onMediaQueryListModalDialogChange(event) { if (event.matches) { // If the media query matches, enter modal dialog mode this.toggleModalDialogMode(true); } else { // If the media query does not match, exit modal dialog mode this.toggleModalDialogMode(false); } } /** * Toggles the modal dialog mode for the AI Chat Drawer. * * If the drawer is open, this method will: * - Add or remove the 'overflow-hidden' class on the body element based on the modal dialog mode. * - Set the 'aria-modal' attribute on the drawer element to indicate modal or non-modal state. * - Set or unset the 'inert' attribute on the drawer's sibling elements for accessibility. * * @param {boolean} isModalDialogMode - Whether to enable (true) or disable (false) modal dialog mode. */; _proto.toggleModalDialogMode = function toggleModalDialogMode(isModalDialogMode) { var isDrawerOpen = this.el.classList.contains(ClassName$q.SHOW); if (!isDrawerOpen) { // If the drawer is not open, set back to non-modal dialog mode isModalDialogMode = false; } // Toggle overflow-hidden class on the body element document.body.classList.toggle(ClassName$q.OVERFLOW_HIDDEN, isModalDialogMode); // Toggle aria-modal to indicate that the AI Chat Drawer is a modal dialog or non-modal dialog this.el.setAttribute('aria-modal', isModalDialogMode ? 'true' : 'false'); // Toggle AI Chat Drawer element siblings as inert Util.toggleSiblingsInert(this.el, isModalDialogMode); } /** * Toggles the visibility of the AI Chat Button component. * If the Drawer is visibly suppressed, the chat button is not allowed to become visible by this method. * @param {show} A boolean indicating whether to show or hide the chat button */; _proto.showChatButton = function showChatButton(show) { if (this.getIsHidden()) { return; // Do not allow the chat button to be changed to a visible state if the AI Chat Drawer is visually suppressed } this.aiChatButton.classList.toggle(ClassName$q.DISPLAY_NONE, !show); // Do allow hiding it though, roflcopter this.aiChatButton.hidden = !show; } /** * Toggle the UHF footer padding based on whether the chat is hidden or not. * @param {boolean} isHidden - Whether the chat is hidden or not */; _proto.toggleUHFBottomPadding = function toggleUHFBottomPadding(isHidden) { if (!this.uhfFooterElem) { return; } this.uhfFooterElem.style.paddingBottom = isHidden ? this.uhfFooterOriginalPadding : this.aiChatButton.offsetHeight + "px"; } /* * Toggles the user text input and submit buttons for the WebChat * @param {boolean} isDisabled - Whether to disable or enable the user text input and submit button */; _proto.toggleWebChatUserTextBoxDisabled = function toggleWebChatUserTextBoxDisabled(isDisabled) { if (!this.webChatInstance) { return; } this.webChatForm.ariaDisabled = isDisabled; this.webChatTextarea.ariaDisabled = isDisabled; this.webChatTextarea.readOnly = isDisabled; this.webChatSendButton.ariaDisabled = isDisabled; } /** * Disable/Enable web chat elements. * @param {boolean} isDisabled - Whether to disable or enable web chat elements */; _proto.toggleWebChatDisabled = function toggleWebChatDisabled(isDisabled) { this.toggleWebChatUserTextBoxDisabled(isDisabled); // Toggle disabling all buttons in chat history var actionSetButtons = this.webChatContainer.querySelectorAll(Selector$A.WEB_CHAT_ACTION_SET_BUTTONS); for (var _iterator12 = _createForOfIteratorHelperLoose$6(actionSetButtons), _step12; !(_step12 = _iterator12()).done;) { var _button$closest, _button$closest2; var button = _step12.value; var isStartLivePersonChatButton = ((_button$closest = button.closest(Selector$A.ARTICLE)) == null ? void 0 : _button$closest.querySelector(Selector$A.SEND_TRANSCRIPT_CHECKBOX_CONTAINER)) !== null; var isDeflectionFlowButton = ((_button$closest2 = button.closest(Selector$A.ARTICLE)) == null ? void 0 : _button$closest2.querySelector(Selector$A.DEFLECTION_FLOW_ELEMENT)) !== null; // Skip disabling/enabling "Continue" buttons that start a new chat with LivePerson or deflection flow buttons if (isStartLivePersonChatButton || isDeflectionFlowButton) { continue; } button.ariaDisabled = isDisabled; button.classList.toggle(ClassName$q.DISABLED, isDisabled); button.tabIndex = isDisabled ? -1 : 0; } // Update last focusable element in the chat drawer if (isDisabled) { var allFocusableDrawerElems = this.el.querySelectorAll(Selector$A.FOCUSABLE_ELEMENTS); this.lastFocusableElem = allFocusableDrawerElems[allFocusableDrawerElems.length - 1]; } else { this.lastFocusableElem = this.webChatSendButton; } } /** * Update the source site value. Dispatch a new activity to the bot with the updated source site value, and update cookies * with the new source site. Wait for the source site update promise to resolve, then reset the source site update promise. * @param {string} newSourceSite - The new source site value */; _proto.updateSourceSite = /*#__PURE__*/ function () { var _updateSourceSite = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(newSourceSite) { var _this$updateAIChatDra6; return _regeneratorRuntime().wrap(function _callee22$(_context22) { while (1) { switch (_context22.prev = _context22.next) { case 0: // Dispatch a new activity to the bot with the updated sourceSite value this.store.dispatch({ type: 'DIRECT_LINE/POST_ACTIVITY', meta: { method: 'keyboard' }, payload: { activity: { type: 'event', name: 'sourceSiteEvent', value: { sourceSite: newSourceSite }, channelData: { postBack: true } } } }); // Update cookie with the new source site this.updateAIChatDrawerCookie((_this$updateAIChatDra6 = {}, _this$updateAIChatDra6[StorageKeys.sourceSite] = newSourceSite, _this$updateAIChatDra6)); // Wait for the sourceSite update promise to resolve _context22.next = 4; return this.sourceSiteUpdatePromise; case 4: // Reset the sourceSite update promise _classPrivateFieldLooseBase(this, _resetSourceSiteUpdatePromise)[_resetSourceSiteUpdatePromise](); case 5: case "end": return _context22.stop(); } } }, _callee22, this); })); function updateSourceSite(_x27) { return _updateSourceSite.apply(this, arguments); } return updateSourceSite; }() /** * Get the AI Chat Drawer cookie object. * @returns {Object | null} The AI Chat Drawer cookie object, or null if it cannot be parsed. */ ; _proto.getAIChatDrawerCookieObject = function getAIChatDrawerCookieObject() { var cookieObj = null; var cookieString = getCookie(StorageKeys.cookieName); if (!cookieString) { return null; } try { cookieObj = JSON.parse(cookieString); } catch (error) { console.error('Failed to parse AI Chat Drawer cookie', error); } return cookieObj; } /** * Update the AI Chat Drawer cookie with the new cookie object. * @param {Object} newCookieObject The new cookie object to update the AI Chat Drawer cookie with. */; _proto.updateAIChatDrawerCookie = function updateAIChatDrawerCookie(newCookieObject) { var existingCookieObject = this.getAIChatDrawerCookieObject(); var updatedCookieObject = Object.assign({}, existingCookieObject, newCookieObject); setCookie(StorageKeys.cookieName, JSON.stringify(updatedCookieObject), CookieConstants.expiryDays, CookieConstants.domain); } /** * Delete the AI Chat Drawer cookie. */; _proto.deleteAIChatDrawerCookie = function deleteAIChatDrawerCookie() { // Set the Expiration to a negative value, so the browser auto-deletes the cookie. setCookie(StorageKeys.cookieName, '', -1, CookieConstants.domain); } /** * Remove event handlers. * @this AIChatDrawer */; _proto.remove = function remove() { var _this$uhfHeaderInters, _this$stickyNavMutati, _this$webChatTranscri, _this$webChatTextarea, _this$lpMutationObser2; // remove events, intersection observer, etc. Util$1.removeEvents(this.events); document.removeEventListener(EventName$A.SCROLL, this.boundOnScrollWithUhfVisible); (_this$uhfHeaderInters = this.uhfHeaderIntersectionObserver) == null ? void 0 : _this$uhfHeaderInters.disconnect(); (_this$stickyNavMutati = this.stickyNavMutationObserver) == null ? void 0 : _this$stickyNavMutati.disconnect(); (_this$webChatTranscri = this.webChatTranscriptMutationObserver) == null ? void 0 : _this$webChatTranscri.disconnect(); (_this$webChatTextarea = this.webChatTextarea) == null ? void 0 : _this$webChatTextarea.removeEventListener(EventName$A.INPUT, this.handleLpUserInput); (_this$lpMutationObser2 = this.lpMutationObserver) == null ? void 0 : _this$lpMutationObser2.disconnect(); // remove this reference from array of instances var index = aiChatDrawers.indexOf(this); aiChatDrawers.splice(index, 1); // Create and dispatch custom event this[EventName$A.ON_REMOVE] = new CustomEvent(EventName$A.ON_REMOVE, { bubbles: true }); this.el.dispatchEvent(this[EventName$A.ON_REMOVE]); } /** * Get instances. * @returns {Object} A object instance */; AIChatDrawer.getInstances = function getInstances() { return aiChatDrawers; }; return AIChatDrawer; }(); function _setDefaultValuesInMarkup2() { // Update drawer title text this.updateDrawerTitleText(this.drawerTitleText); // Set header controls aria label if (this.headerControls) { this.headerControls.setAttribute('aria-label', this.closeButtonAriaLabel); } // Update el's aria label this.el.setAttribute('aria-label', this.chatDrawerAriaLabel); // Update chat button's default values _classPrivateFieldLooseBase(this, _setDefaultValuesAiChatButton)[_setDefaultValuesAiChatButton](); } function _setDefaultValuesAiChatButton2() { // Return if there is no click group if (!this.aiChatButton) { return; } // Update the default theme-day if (!this.aiChatButton.classList.contains('theme-day') && !this.aiChatButton.classList.contains('theme-night')) { this.aiChatButton.classList.add('theme-day'); } // Update the floating button header text if (this.aiChatButtonHeader && !this.aiChatButtonHeader.textContent) { this.aiChatButtonHeader.textContent = this.buttonTitleText; } // Update the floating badge aria label if (this.aiChatButtonAnchor && !this.aiChatButtonAnchor.getAttribute('aria-label')) { this.aiChatButtonAnchor.setAttribute('aria-label', 'Expand AI-powered assistant chat dialog'); } } function _addEventHandlers2() { var _this32 = this; this.events = []; var elementsToBind = [this.closeButton, this.uhfNavMenuExpandElem]; // Hide the chat drawer when the close button and UHF nav menu expand button (at mobile viewport) are clicked elementsToBind.forEach(function (element) { if (element) { _this32.events.push({ el: element, handler: _this32.chatClose.bind(_this32), type: EventName$A.CLICK }); } }); if (this.aiChatButtonDataMount) { this.events.push({ el: this.aiChatButtonDataMount, handler: this.onAiChatButtonClick.bind(this), type: EventName$A.CLICK }); if (this.aiChatButtonDataMount.tagName !== 'BUTTON') { this.events.push({ el: this.aiChatButtonDataMount, handler: this.onAiChatButtonClick.bind(this), type: EventName$A.KEYDOWN }); } } if (!this.getIsHidden()) { this.addChatActionTypeLinkEvents(); } this.events.push({ el: this.el, handler: this.onAIChatDrawerTransitionEnd.bind(this), type: EventName$A.TRANSITION_END }, { el: this.el, handler: this.onKeyDown.bind(this), type: EventName$A.KEYDOWN }, { el: document, handler: this.onDocumentKeyDown.bind(this), type: EventName$A.KEYDOWN }, { el: window, handler: this.onWebChatConnectFulfilled.bind(this), type: EventName$A.WEBCHAT_CONNECT_FULFILLED }, { el: window, handler: this.onStartConversationFulfilled.bind(this), type: EventName$A.START_CONVERSATION_FULFILLED }, { el: window, handler: debounce(this.debouncedResizeDelay, this.onBrowserResize.bind(this)), type: EventName$A.RESIZE }, { el: this.mediaQueryListChatHidden, handler: this.onMediaQueryListChatHiddenChange.bind(this), type: EventName$A.CHANGE }, { el: this.mediaQueryListModalDialog, handler: this.onMediaQueryListModalDialogChange.bind(this), type: EventName$A.CHANGE }); this.boundOnScrollWithUhfVisible = this.onScrollWithUhfVisible.bind(this); Util$1.addEvents(this.events); } function _initUhfIntersectionObserver2() { if (!this.uhfHeaderElem) { return; } var options = { rootMargin: "0px 0px " + uhfHeaderMarginBottomVal + "px 0px" }; this.uhfHeaderIntersectionObserver = new IntersectionObserver(this.onUhfHeaderIntersect.bind(this), options); this.uhfHeaderIntersectionObserver.observe(this.uhfHeaderElem); } function _initStickyNavMutationObserver2() { if (!this.stickyNavElem) { return; } var stickyParentElem = this.stickyNavElem.closest(Selector$A.STICKY); this.stickyNavMutationObserver = new MutationObserver(this.onStickyNavMutation.bind(this)); this.stickyNavMutationObserver.observe(stickyParentElem, { attributeFilter: ['class'], attributeOldValue: true }); } function _initWebChatTranscriptObserver2() { this.webChatTranscriptElem = this.el.querySelector(Selector$A.WEB_CHAT_TRANSCRIPT); if (!this.webChatTranscriptElem) { console.error('Web Chat transcript element not found.'); return; } this.webChatTranscriptMutationObserver = new MutationObserver(this.onWebChatTranscriptMutation.bind(this)); this.webChatTranscriptMutationObserver.observe(this.webChatTranscriptElem, { subtree: true, childList: true }); } function _positionAiChatButton2() { if (!this.aiChatButton) { return; } var uhfFooter = document.querySelector(Selector$A.UHF_FOOTER); if (uhfFooter) { // insert before the UHF footer uhfFooter.insertAdjacentElement('beforebegin', this.aiChatButton); this.showChatButton(true); } else { // insert before the closing body tag document.body.insertAdjacentElement('beforeend', this.aiChatButton); this.showChatButton(true); } } function _positionAiChatDrawer2() { var uhfFooter = document.querySelector(Selector$A.UHF_FOOTER); if (uhfFooter) { uhfFooter.insertAdjacentElement('beforebegin', this.el); } else { document.body.insertAdjacentElement('beforeend', this.el); } this.el.hidden = true; } function _resetSourceSiteUpdatePromise2() { var _this33 = this; this.sourceSiteUpdatePromise = new Promise(function (resolve) { _this33.resolveSourceSiteUpdate = resolve; }); } function _regenerateAIChatDrawerToken2() { return _regenerateAIChatDrawerToken3.apply(this, arguments); } function _regenerateAIChatDrawerToken3() { _regenerateAIChatDrawerToken3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() { return _regeneratorRuntime().wrap(function _callee23$(_context23) { while (1) { switch (_context23.prev = _context23.next) { case 0: this.deleteAIChatDrawerCookie(); _classPrivateFieldLooseBase(this, _generateDirectLineToken)[_generateDirectLineToken](); case 2: case "end": return _context23.stop(); } } }, _callee23, this); })); return _regenerateAIChatDrawerToken3.apply(this, arguments); } function _generateDirectLineToken2() { return _generateDirectLineToken3.apply(this, arguments); } function _generateDirectLineToken3() { _generateDirectLineToken3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() { var token, cookieObj, _cookieObject, requestOptions, res, _yield$res$json, directLineToken, expiration, cookieObject; return _regeneratorRuntime().wrap(function _callee24$(_context24) { while (1) { switch (_context24.prev = _context24.next) { case 0: token = null; cookieObj = this.getAIChatDrawerCookieObject(); if (typeof cookieObj === 'object' && cookieObj !== null) { token = cookieObj[StorageKeys.token]; } _context24.prev = 3; if (this.hasValidToken()) { _context24.next = 18; break; } requestOptions = { method: 'GET', redirect: 'follow', headers: { 'ms-cv': window.mscv } }; _context24.next = 8; return fetch(this.tokenEndpoint, requestOptions); case 8: res = _context24.sent; _context24.next = 11; return res.json(); case 11: _yield$res$json = _context24.sent; directLineToken = _yield$res$json.token; expiration = _yield$res$json.expires_in; token = directLineToken; cookieObject = (_cookieObject = {}, _cookieObject[StorageKeys.token] = token, _cookieObject[StorageKeys.tokenCreated] = Date.now() / 1000, _cookieObject[StorageKeys.tuid] = this.tuid, _cookieObject[StorageKeys.lpOpenConvs] = {}, _cookieObject[StorageKeys.startLPChatActivityIds] = [], _cookieObject); this.updateAIChatDrawerCookie(cookieObject); _classPrivateFieldLooseBase(this, _setRefreshTimer)[_setRefreshTimer](expiration); case 18: return _context24.abrupt("return", token); case 21: _context24.prev = 21; _context24.t0 = _context24["catch"](3); console.error('Error generating Direct Line token:', _context24.t0); clearTimeout(this.messageWaitTimeout); this.toggleWebChatDisabled(false); // Display generic error notification if possible this.setNotification(NotificationLevel.ERROR, this.livePersonGenericErrorText); // TODO if drawer is not open, any way to notify user that the AI Chat Drawer won't work, refresh? case 27: case "end": return _context24.stop(); } } }, _callee24, this, [[3, 21]]); })); return _generateDirectLineToken3.apply(this, arguments); } function _refreshDirectLineToken2() { return _refreshDirectLineToken3.apply(this, arguments); } function _refreshDirectLineToken3() { _refreshDirectLineToken3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() { var _cookieObject2, requestOptions, res, _yield$res$json2, directLineToken, expiration, cookieObject; return _regeneratorRuntime().wrap(function _callee25$(_context25) { while (1) { switch (_context25.prev = _context25.next) { case 0: _context25.prev = 0; requestOptions = { method: 'POST', redirect: 'follow', headers: { authorization: "Bearer " + this.getAIChatDrawerCookieObject()[StorageKeys.token] } }; _context25.next = 4; return fetch(this.refreshTokenUrl, requestOptions); case 4: res = _context25.sent; _context25.next = 7; return res.json(); case 7: _yield$res$json2 = _context25.sent; directLineToken = _yield$res$json2.token; expiration = _yield$res$json2.expires_in; cookieObject = (_cookieObject2 = {}, _cookieObject2[StorageKeys.token] = directLineToken, _cookieObject2[StorageKeys.tokenCreated] = Date.now() / 1000, _cookieObject2[StorageKeys.tuid] = this.tuid, _cookieObject2); this.updateAIChatDrawerCookie(cookieObject); _classPrivateFieldLooseBase(this, _setRefreshTimer)[_setRefreshTimer](expiration); _context25.next = 20; break; case 15: _context25.prev = 15; _context25.t0 = _context25["catch"](0); console.error('Error refreshing Direct Line token:', _context25.t0); clearTimeout(this.messageWaitTimeout); this.toggleWebChatDisabled(false); case 20: case "end": return _context25.stop(); } } }, _callee25, this, [[0, 15]]); })); return _refreshDirectLineToken3.apply(this, arguments); } function _setRefreshTimer2(expiration) { var _this34 = this; var computedExpiration = 0; if (expiration > this.refreshBefore) { computedExpiration = (expiration - this.refreshBefore) * 1000; } else { throw new Error('Error refreshing Direct Line Token.'); } // Set a timeout to refresh the token x mins before it expires setTimeout(function () { return _classPrivateFieldLooseBase(_this34, _refreshDirectLineToken)[_refreshDirectLineToken](); }, computedExpiration); } function _getLocale2() { // if document.documentElement.lang is in format 'll-CC', return it // if (document.documentElement.lang?.includes('-')) { // return document.documentElement.lang; // } // return navigator.languages && navigator.languages.length // ? navigator.languages[0] // : navigator.language; return 'en-US'; } function _initializeJsonPollock2() { return _initializeJsonPollock3.apply(this, arguments); } function _initializeJsonPollock3() { _initializeJsonPollock3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() { return _regeneratorRuntime().wrap(function _callee26$(_context26) { while (1) { switch (_context26.prev = _context26.next) { case 0: _context26.prev = 0; _context26.next = 3; return Util.loadScript(jsonPollockScriptSrc, 'body'); case 3: if (window.JsonPollock) { _context26.next = 6; break; } console.error('JsonPollock not found.'); return _context26.abrupt("return"); case 6: window.JsonPollock.init({ maxAllowedElements: 200, onAfterElementRendered: this.onAfterElementRenderedHandler }); _context26.next = 12; break; case 9: _context26.prev = 9; _context26.t0 = _context26["catch"](0); console.error('Error loading JsonPollock:', _context26.t0); case 12: case "end": return _context26.stop(); } } }, _callee26, this, [[0, 9]]); })); return _initializeJsonPollock3.apply(this, arguments); } function _handlePageOpenState2() { try { var cookieObject = this.getAIChatDrawerCookieObject(); var lastState = cookieObject ? cookieObject[StorageKeys.chatDrawerState] : null; var isMobileViewport = window.matchMedia("(max-width: " + (ViewPort.MD - 0.2) + "px)").matches; // If at mobile viewport and the chat drawer is open, set lastState to 'CLOSED' to close the chat drawer on navigated page. if (isMobileViewport && lastState === 'OPEN') { var _this$updateAIChatDra7; this.updateAIChatDrawerCookie((_this$updateAIChatDra7 = {}, _this$updateAIChatDra7[StorageKeys.chatDrawerState] = 'CLOSED', _this$updateAIChatDra7)); lastState = 'CLOSED'; } var token = cookieObject ? cookieObject[StorageKeys.token] : null; // If the cookie exists and is still valid for the Direct Line, refresh it if (token) { var cookieCreation = this.getAIChatDrawerCookieObject()[StorageKeys.tokenCreated]; var currentTime = Date.now() / 1000; if (currentTime - cookieCreation < this.refreshAfter) { _classPrivateFieldLooseBase(this, _refreshDirectLineToken)[_refreshDirectLineToken](); } } if (this.isChatPersistEnabled && lastState === 'OPEN' && this.hasValidToken()) { this.chatOpenOrInit(); } } catch (error) { console.error('Failed to get chat drawer state from cookies', error); } } function _getSourceSite2() { try { var url = new URL(window.location.href); var domain = url.hostname; var path = url.pathname.split('/'); var langLoc = document.documentElement.lang.toLowerCase(); // find index of langLoc in path var langLocIndex = -1; // Map of language locales to possible source sites. // Special cases for Serbian language locales. var langLocs = { 'sr-rs': ['sr-rs', 'sr-latn-rs', 'sr-cyrl-rs'], "default": [langLoc] }; var possibleLangLocs = langLocs[langLoc] || langLocs["default"]; langLocIndex = possibleLangLocs.map(function (loc) { return path.indexOf(loc); }).find(function (index) { return index > -1; }); if (domain === 'azure.microsoft.com' || url.pathname.startsWith('/content/azure/acom')) { return 'azure'; } // Example: www.microsoft.com/fr-fr/isv/offer-benefits => isv if (langLocIndex > -1 && path.length > langLocIndex + 1) { var siteNameWithoutHtmlExtension = path[langLocIndex + 1].replace('.html', ''); return siteNameWithoutHtmlExtension; } } catch (error) { console.error('Failed to get source site:', error); } return 'azure'; // fallback } function _getLPEndpoint2(baseEndpoint, path) { // passing in path such as 'lp/check' var endpointURL = new URL(baseEndpoint); endpointURL.pathname = path; return endpointURL.href; } function _getLivePersonIdFromJWT2() { try { var payload = JSON.parse(atob(this.lpJWT.split('.')[1])); return payload.sub; } catch (error) { console.error('Error decoding JWT:', error); return null; } } // `SameValue` abstract operation // https://tc39.es/ecma262/#sec-samevalue // eslint-disable-next-line es/no-object-is -- safe var sameValue$1 = Object.is || function is(x, y) { // eslint-disable-next-line no-self-compare -- NaN check return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y; }; var call$4 = functionCall; var fixRegExpWellKnownSymbolLogic = fixRegexpWellKnownSymbolLogic; var anObject$3 = anObject$l; var isNullOrUndefined$4 = isNullOrUndefined$b; var requireObjectCoercible$1 = requireObjectCoercible$d; var sameValue = sameValue$1; var toString$5 = toString$j; var getMethod$1 = getMethod$7; var regExpExec = regexpExecAbstract; // @@search logic fixRegExpWellKnownSymbolLogic('search', function (SEARCH, nativeSearch, maybeCallNative) { return [ // `String.prototype.search` method // https://tc39.es/ecma262/#sec-string.prototype.search function search(regexp) { var O = requireObjectCoercible$1(this); var searcher = isNullOrUndefined$4(regexp) ? undefined : getMethod$1(regexp, SEARCH); return searcher ? call$4(searcher, regexp, O) : new RegExp(regexp)[SEARCH](toString$5(O)); }, // `RegExp.prototype[@@search]` method // https://tc39.es/ecma262/#sec-regexp.prototype-@@search function (string) { var rx = anObject$3(this); var S = toString$5(string); var res = maybeCallNative(nativeSearch, rx, S); if (res.done) return res.value; var previousLastIndex = rx.lastIndex; if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0; var result = regExpExec(rx, S); if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex; return result === null ? -1 : result.index; } ]; }); var isObject$9 = isObject$o; var floor$1 = Math.floor; // `IsIntegralNumber` abstract operation // https://tc39.es/ecma262/#sec-isintegralnumber // eslint-disable-next-line es/no-number-isinteger -- safe var isIntegralNumber$1 = Number.isInteger || function isInteger(it) { return !isObject$9(it) && isFinite(it) && floor$1(it) === it; }; var $$n = _export; var isIntegralNumber = isIntegralNumber$1; var abs = Math.abs; // `Number.isSafeInteger` method // https://tc39.es/ecma262/#sec-number.issafeinteger $$n({ target: 'Number', stat: true }, { isSafeInteger: function isSafeInteger(number) { return isIntegralNumber(number) && abs(number) <= 0x1FFFFFFFFFFFFF; } }); var isCallable$4 = isCallable$u; var isObject$8 = isObject$o; var setPrototypeOf$1 = objectSetPrototypeOf; // makes subclassing work correct for wrapped built-ins var inheritIfRequired$3 = function ($this, dummy, Wrapper) { var NewTarget, NewTargetPrototype; if ( // it can work only with native `setPrototypeOf` setPrototypeOf$1 && // we haven't completely correct pre-ES6 way for getting `new.target`, so use this isCallable$4(NewTarget = dummy.constructor) && NewTarget !== Wrapper && isObject$8(NewTargetPrototype = NewTarget.prototype) && NewTargetPrototype !== Wrapper.prototype ) setPrototypeOf$1($this, NewTargetPrototype); return $this; }; var uncurryThis$d = functionUncurryThis; // `thisNumberValue` abstract operation // https://tc39.es/ecma262/#sec-thisnumbervalue var thisNumberValue$2 = uncurryThis$d(1.0.valueOf); var DESCRIPTORS$9 = descriptors; var global$7 = global$B; var uncurryThis$c = functionUncurryThis; var isForced$2 = isForced_1; var defineBuiltIn$4 = defineBuiltIn$i; var hasOwn$8 = hasOwnProperty_1; var inheritIfRequired$2 = inheritIfRequired$3; var isPrototypeOf$3 = objectIsPrototypeOf; var isSymbol$2 = isSymbol$5; var toPrimitive = toPrimitive$2; var fails$d = fails$J; var getOwnPropertyNames$1 = objectGetOwnPropertyNames.f; var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f; var defineProperty$5 = objectDefineProperty.f; var thisNumberValue$1 = thisNumberValue$2; var trim = stringTrim.trim; var NUMBER = 'Number'; var NativeNumber = global$7[NUMBER]; var NumberPrototype = NativeNumber.prototype; var TypeError$2 = global$7.TypeError; var arraySlice$2 = uncurryThis$c(''.slice); var charCodeAt$1 = uncurryThis$c(''.charCodeAt); // `ToNumeric` abstract operation // https://tc39.es/ecma262/#sec-tonumeric var toNumeric = function (value) { var primValue = toPrimitive(value, 'number'); return typeof primValue == 'bigint' ? primValue : toNumber(primValue); }; // `ToNumber` abstract operation // https://tc39.es/ecma262/#sec-tonumber var toNumber = function (argument) { var it = toPrimitive(argument, 'number'); var first, third, radix, maxCode, digits, length, index, code; if (isSymbol$2(it)) throw TypeError$2('Cannot convert a Symbol value to a number'); if (typeof it == 'string' && it.length > 2) { it = trim(it); first = charCodeAt$1(it, 0); if (first === 43 || first === 45) { third = charCodeAt$1(it, 2); if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix } else if (first === 48) { switch (charCodeAt$1(it, 1)) { case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i default: return +it; } digits = arraySlice$2(it, 2); length = digits.length; for (index = 0; index < length; index++) { code = charCodeAt$1(digits, index); // parseInt parses a string to a first unavailable symbol // but ToNumber should return NaN if a string contains unavailable symbols if (code < 48 || code > maxCode) return NaN; } return parseInt(digits, radix); } } return +it; }; // `Number` constructor // https://tc39.es/ecma262/#sec-number-constructor if (isForced$2(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) { var NumberWrapper = function Number(value) { var n = arguments.length < 1 ? 0 : NativeNumber(toNumeric(value)); var dummy = this; // check on 1..constructor(foo) case return isPrototypeOf$3(NumberPrototype, dummy) && fails$d(function () { thisNumberValue$1(dummy); }) ? inheritIfRequired$2(Object(n), dummy, NumberWrapper) : n; }; for (var keys$1 = DESCRIPTORS$9 ? getOwnPropertyNames$1(NativeNumber) : ( // ES3: 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' + // ES2015 (in case, if modules with ES2015 Number statics required before): 'EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,' + // ESNext 'fromString,range' ).split(','), j = 0, key; keys$1.length > j; j++) { if (hasOwn$8(NativeNumber, key = keys$1[j]) && !hasOwn$8(NumberWrapper, key)) { defineProperty$5(NumberWrapper, key, getOwnPropertyDescriptor(NativeNumber, key)); } } NumberWrapper.prototype = NumberPrototype; NumberPrototype.constructor = NumberWrapper; defineBuiltIn$4(global$7, NUMBER, NumberWrapper, { constructor: true }); } var _EventName$ON_INIT$1, _EventName$ON_REFRESH, _EventName$ON_REMOVE$2, _EventName$ON_SELECT$1, _EventName$ON_UPDATE$2; var cookieExpiryDays = 30; var cookieKey = 'PMGSKUMarketCk'; /** @type {MarketSelector[]} */ var instances$r = []; var queryParamKey = 'market'; /** * CSS selector. * @enum {string} */ var Selector$z = { AFFECTED: '[data-oc-market-selector]', DATA_MOUNT: '[data-mount="market-selector"]', FW_LINKS: '[data-regenerate-fwlink="true"]', SELECT_MENU: '.custom-select-input', FW_LINKS_W365: '.oc-w365-fwlink' }; /** * JS event name. * @enum {string} */ var EventName$z = { ON_INIT: 'onInit', ON_REFRESHED: 'onRefreshed', ON_REMOVE: 'onRemove', ON_SELECT: 'onSelect', ON_UPDATE: 'onUpdate' }; /** * Handles change events on select menus. * @this {MarketSelector} Parent component. * @param {HTMLSelectElement} selectMenu Select element. */ function _change(selectMenu) { if (selectMenu.selectedOptions.length) { this.el.dispatchEvent(this[EventName$z.ON_SELECT]); // update regenerating FWLinks, and add the information to On_Refreshed Event this.fwlinkParams = selectMenu.selectedOptions[0].dataset.fwlinkParams; this[EventName$z.ON_REFRESHED].detail.fwlinkParams = this.fwlinkParams; _setFWLinksQueryParams(this.fwlinkParams); _removeW365FwdLinkLcid(); _setMarket.call(this, selectMenu.selectedOptions[0].value); } } /** * Gets a set cookie value for the key provided, if available. * @param {string} key Cookie key. * @returns {string | null} Cookie value, or null. */ function _getCookie(key) { var cookies = _getAllCookies(); if (cookies) { var value = cookies[key]; if (value !== undefined) { return value; } } return null; } /** * Gets all set cookie values, if available. * @returns {Record | null} All cookie values. */ function _getAllCookies() { /** @type {Record} */ var cookies = {}; document.cookie.split('; ').forEach(function (pair) { var separatorIndex = pair.indexOf('='); if (separatorIndex !== -1) { var key = pair.slice(0, separatorIndex); var value = decodeURIComponent(pair.slice(separatorIndex + 1)); cookies[key] = value; } }); if (Object.keys(cookies).length > 0) { return cookies; } return null; } /** * Gets the geodetected country code which was previously set by an edge-side include. * @returns {string | null} Geodetected country code, or null. */ function _getGeoCountry() { if (window.oc && window.oc.geo && window.oc.geo.country && typeof window.oc.geo.country === 'string') { return window.oc.geo.country; } return null; } /** * Updates all regenerating FWLinks href's to the option's designated query params. * @param {string} queryParams */ function _setFWLinksQueryParams(queryParams) { var fwLinks = document.querySelectorAll(Selector$z.FW_LINKS); fwLinks.forEach(function (link) { try { var url = new URL(link.getAttribute('href')); var searchParams = new URLSearchParams(queryParams); var urlSearchParams = new URLSearchParams(url.search); searchParams.forEach(function (key, value) { urlSearchParams.set(value, key); }); // 'clcid' is not a guaranteed part of the new Query Search Params. Delete this from the original fwlink's destination // url if the
elements (which change the URL) not inside the collapsible element if (event.currentTarget.tagName === 'A') { event.preventDefault(); } _this.toggle(); } }, { el: opts.el, type: 'keydown', handler: function handler(event) { var collapseShow = document.querySelectorAll('.collapse'); var closeBtn = document.querySelectorAll('button.collapse-me'); if (event.which === 27) { collapseShow.forEach(function (item) { if (item.classList.contains(ClassName$h.SHOW)) { _this.hide(item); } }); var collapsedBtn = document.querySelectorAll('.collapsed'); if (closeBtn[0] === document.activeElement && collapsedBtn.length > 0) { collapsedBtn[0].focus(); } } } }, { el: this.collapseAnchor, type: 'keydown', handler: function handler(event) { if (event.which === 27) { var collapseShow = document.querySelectorAll('.collapse'); collapseShow.forEach(function (item) { if (item.classList.contains(ClassName$h.SHOW)) { _this.hide(item); } }); opts.el.focus(); } } }]; Util$1.addEvents(this.events); } instances$l.push(this); } /** * Toggles the collapse from show to hide and vice versa */ var _proto = MultiCollapse.prototype; _proto.toggle = function toggle() { var _this2 = this; this.el.forEach(function (item) { if (item.classList.contains(ClassName$h.SHOW)) { _this2.hide(item); } else { _this2.show(item); } }); } /** * Shows the collapse */; _proto.show = function show(element) { var _this3 = this; if (element.classList.contains(ClassName$h.SHOW)) { return; } // Create and dispatch custom event this[EventName$p.SHOW] = new CustomEvent(EventName$p.SHOW, { cancelable: true }); element.dispatchEvent(this[EventName$p.SHOW]); if (this[EventName$p.SHOW].defaultPrevented) { return; } element.classList.remove(ClassName$h.COLLAPSE); element.classList.add(ClassName$h.COLLAPSING); if (this.toggleArray.length) { this.toggleArray.forEach(function (elem) { elem.classList.remove(ClassName$h.COLLAPSED); elem.setAttribute('aria-expanded', true); }); } var complete = function complete() { element.classList.remove(ClassName$h.COLLAPSING); element.classList.add(ClassName$h.SHOW); _this3.isCollapsed = false; element.dispatchEvent(_this3[EventName$p.SHOWN]); }; element.addEventListener(Util$1.TRANSITION_END, complete.bind(this), { once: true }); Util$1.emulateTransitionEnd(element, 0); } /** * Hides the collapse */; _proto.hide = function hide(element) { var _this4 = this; if (!element.classList.contains(ClassName$h.SHOW)) { return; } // Create and dispatch custom event this[EventName$p.HIDE] = new CustomEvent(EventName$p.HIDE, { cancelable: true }); element.dispatchEvent(this[EventName$p.HIDE]); if (this[EventName$p.HIDE].defaultPrevented) { return; } element.classList.add(ClassName$h.COLLAPSING); element.classList.remove(ClassName$h.SHOW); this.toggleArray.forEach(function (toggle) { var toggleSelector = Util$1.getSelectorFromElement(toggle); if (toggleSelector !== null) { var toggleArray = Array.from(document.querySelectorAll(toggleSelector)); toggleArray.forEach(function (el) { if (!el.classList.contains(ClassName$h.SHOW)) { toggle.classList.add(ClassName$h.COLLAPSED); toggle.setAttribute('aria-expanded', false); } }); } }); var complete = function complete() { element.classList.remove(ClassName$h.COLLAPSING); element.classList.add(ClassName$h.COLLAPSE); _this4.isCollapsed = true; element.dispatchEvent(_this4[EventName$p.HIDDEN]); }; element.addEventListener(Util$1.TRANSITION_END, complete.bind(this), { once: true }); Util$1.emulateTransitionEnd(element, 0); } /** * Update instance (added for API consistency) */; _proto.update = function update() { var _this5 = this; // Create and dispatch custom event this[EventName$p.ON_UPDATE] = new CustomEvent(EventName$p.ON_UPDATE, { bubbles: true }); this.el.forEach(function (item) { item.dispatchEvent(_this5[EventName$p.ON_UPDATE]); }); } /** * Remove the event listener and the instance */; _proto.remove = function remove() { var _this6 = this; Util$1.removeEvents(this.events); // remove this collapse reference from array of instances var index = instances$l.indexOf(this); instances$l.splice(index, 1); // Create and dispatch custom event this[EventName$p.ON_REMOVE] = new CustomEvent(EventName$p.ON_REMOVE, { bubbles: true }); this.el.forEach(function (item) { item.dispatchEvent(_this6[EventName$p.ON_REMOVE]); }); } /** * Get instances. * @returns {Object[]} An array of instances */; MultiCollapse.getInstances = function getInstances() { return instances$l; }; return MultiCollapse; }(); var Selector$o = { DATA_MOUNT: '[data-mount="mobile-display"]', MOBILE_SHOWN: '[data-mobile-display="block"]', MOBILE_HIDDEN: '[data-mobile-display="none"]' }; var EventName$o = { ON_REMOVE: 'onRemove', ON_UPDATE: 'onUpdate' }; var DISPLAY = { DISPLAY: 'display', BLOCK: 'block', NONE: 'none' }; var instances$k = []; /** * Class representing Mobile Display. */ var MobileDisplay = /*#__PURE__*/function () { function MobileDisplay(opts) { this.el = opts.el; this.isMobile = Util$1.detectMobile(true); this.mobileShown = this.el.querySelectorAll(Selector$o.MOBILE_SHOWN); this.mobileHidden = this.el.querySelectorAll(Selector$o.MOBILE_HIDDEN); if (this.isMobile) { this.mobileShown.forEach(function (mobileContent) { mobileContent.style.setProperty(DISPLAY.DISPLAY, DISPLAY.BLOCK, 'important'); }); this.mobileHidden.forEach(function (mobileContent) { mobileContent.style.setProperty(DISPLAY.DISPLAY, DISPLAY.NONE, 'important'); }); } else { this.mobileShown.forEach(function (mobileContent) { mobileContent.style.setProperty(DISPLAY.DISPLAY, DISPLAY.NONE, 'important'); }); } instances$k.push(this); } /** * Update instance. */ var _proto = MobileDisplay.prototype; _proto.update = function update() { // Create and dispatch custom event this[EventName$o.ON_UPDATE] = new CustomEvent(EventName$o.ON_UPDATE, { bubbles: true }); this.el.dispatchEvent(this[EventName$o.ON_UPDATE]); } /** * Remove the instance */; _proto.remove = function remove() { var index = instances$k.indexOf(this); instances$k.splice(index, 1); // Create and dispatch custom event this[EventName$o.ON_REMOVE] = new CustomEvent(EventName$o.ON_REMOVE, { bubbles: true }); this.el.dispatchEvent(this[EventName$o.ON_REMOVE]); } /** * Get mobile display instances. * @returns {Object[]} An array of mobile display instances */; MobileDisplay.getInstances = function getInstances() { return instances$k; }; return MobileDisplay; }(); // TODO: Remove from `core-js@4` var $$k = _export; var DESCRIPTORS$7 = descriptors; var create$2 = objectCreate; // `Object.create` method // https://tc39.es/ecma262/#sec-object.create $$k({ target: 'Object', stat: true, sham: !DESCRIPTORS$7 }, { create: create$2 }); var imagesloaded = {exports: {}}; var evEmitter = {exports: {}}; (function (module) { (function (global, factory) { // universal module definition if (module.exports) { // CommonJS - Browserify, Webpack module.exports = factory(); } else { // Browser globals global.EvEmitter = factory(); } })(typeof window != 'undefined' ? window : commonjsGlobal, function () { function EvEmitter() {} var proto = EvEmitter.prototype; proto.on = function (eventName, listener) { if (!eventName || !listener) return this; // set events hash var events = this._events = this._events || {}; // set listeners array var listeners = events[eventName] = events[eventName] || []; // only add once if (!listeners.includes(listener)) { listeners.push(listener); } return this; }; proto.once = function (eventName, listener) { if (!eventName || !listener) return this; // add event this.on(eventName, listener); // set once flag // set onceEvents hash var onceEvents = this._onceEvents = this._onceEvents || {}; // set onceListeners object var onceListeners = onceEvents[eventName] = onceEvents[eventName] || {}; // set flag onceListeners[listener] = true; return this; }; proto.off = function (eventName, listener) { var listeners = this._events && this._events[eventName]; if (!listeners || !listeners.length) return this; var index = listeners.indexOf(listener); if (index != -1) { listeners.splice(index, 1); } return this; }; proto.emitEvent = function (eventName, args) { var listeners = this._events && this._events[eventName]; if (!listeners || !listeners.length) return this; // copy over to avoid interference if .off() in listener listeners = listeners.slice(0); args = args || []; // once stuff var onceListeners = this._onceEvents && this._onceEvents[eventName]; for (var _iterator = _createForOfIteratorHelperLoose$6(listeners), _step; !(_step = _iterator()).done;) { var listener = _step.value; var isOnce = onceListeners && onceListeners[listener]; if (isOnce) { // remove listener // remove before trigger to prevent recursion this.off(eventName, listener); // unset once flag delete onceListeners[listener]; } // trigger listener listener.apply(this, args); } return this; }; proto.allOff = function () { delete this._events; delete this._onceEvents; return this; }; return EvEmitter; }); })(evEmitter); (function (module) { (function (window, factory) { // universal module definition if (module.exports) { // CommonJS module.exports = factory(window, evEmitter.exports); } else { // browser global window.imagesLoaded = factory(window, window.EvEmitter); } })(typeof window !== 'undefined' ? window : commonjsGlobal, function factory(window, EvEmitter) { var $ = window.jQuery; var console = window.console; // -------------------------- helpers -------------------------- // // turn element or nodeList into an array function makeArray(obj) { // use object if already an array if (Array.isArray(obj)) return obj; var isArrayLike = typeof obj == 'object' && typeof obj.length == 'number'; // convert nodeList to array if (isArrayLike) return [].concat(obj); // array of single index return [obj]; } // -------------------------- imagesLoaded -------------------------- // /** * @param {[Array, Element, NodeList, String]} elem * @param {[Object, Function]} options - if function, use as callback * @param {Function} onAlways - callback function * @returns {ImagesLoaded} */ function ImagesLoaded(elem, options, onAlways) { // coerce ImagesLoaded() without new, to be new ImagesLoaded() if (!(this instanceof ImagesLoaded)) { return new ImagesLoaded(elem, options, onAlways); } // use elem as selector string var queryElem = elem; if (typeof elem == 'string') { queryElem = document.querySelectorAll(elem); } // bail if bad element if (!queryElem) { console.error("Bad element for imagesLoaded " + (queryElem || elem)); return; } this.elements = makeArray(queryElem); this.options = {}; // shift arguments if no options set if (typeof options == 'function') { onAlways = options; } else { Object.assign(this.options, options); } if (onAlways) this.on('always', onAlways); this.getImages(); // add jQuery Deferred object if ($) this.jqDeferred = new $.Deferred(); // HACK check async to allow time to bind listeners setTimeout(this.check.bind(this)); } ImagesLoaded.prototype = Object.create(EvEmitter.prototype); ImagesLoaded.prototype.getImages = function () { this.images = []; // filter & find items if we have an item selector this.elements.forEach(this.addElementImages, this); }; var elementNodeTypes = [1, 9, 11]; /** * @param {Node} elem */ ImagesLoaded.prototype.addElementImages = function (elem) { // filter siblings if (elem.nodeName === 'IMG') { this.addImage(elem); } // get background image on element if (this.options.background === true) { this.addElementBackgroundImages(elem); } // find children // no non-element nodes, #143 var nodeType = elem.nodeType; if (!nodeType || !elementNodeTypes.includes(nodeType)) return; var childImgs = elem.querySelectorAll('img'); // concat childElems to filterFound array for (var _iterator = _createForOfIteratorHelperLoose$6(childImgs), _step; !(_step = _iterator()).done;) { var img = _step.value; this.addImage(img); } // get child background images if (typeof this.options.background == 'string') { var children = elem.querySelectorAll(this.options.background); for (var _iterator2 = _createForOfIteratorHelperLoose$6(children), _step2; !(_step2 = _iterator2()).done;) { var child = _step2.value; this.addElementBackgroundImages(child); } } }; var reURL = /url\((['"])?(.*?)\1\)/gi; ImagesLoaded.prototype.addElementBackgroundImages = function (elem) { var style = getComputedStyle(elem); // Firefox returns null if in a hidden iframe https://bugzil.la/548397 if (!style) return; // get url inside url("...") var matches = reURL.exec(style.backgroundImage); while (matches !== null) { var url = matches && matches[2]; if (url) { this.addBackground(url, elem); } matches = reURL.exec(style.backgroundImage); } }; /** * @param {Image} img */ ImagesLoaded.prototype.addImage = function (img) { var loadingImage = new LoadingImage(img); this.images.push(loadingImage); }; ImagesLoaded.prototype.addBackground = function (url, elem) { var background = new Background(url, elem); this.images.push(background); }; ImagesLoaded.prototype.check = function () { var _this = this; this.progressedCount = 0; this.hasAnyBroken = false; // complete if no images if (!this.images.length) { this.complete(); return; } /* eslint-disable-next-line func-style */ var onProgress = function onProgress(image, elem, message) { // HACK - Chrome triggers event before object properties have changed. #83 setTimeout(function () { _this.progress(image, elem, message); }); }; this.images.forEach(function (loadingImage) { loadingImage.once('progress', onProgress); loadingImage.check(); }); }; ImagesLoaded.prototype.progress = function (image, elem, message) { this.progressedCount++; this.hasAnyBroken = this.hasAnyBroken || !image.isLoaded; // progress event this.emitEvent('progress', [this, image, elem]); if (this.jqDeferred && this.jqDeferred.notify) { this.jqDeferred.notify(this, image); } // check if completed if (this.progressedCount === this.images.length) { this.complete(); } if (this.options.debug && console) { console.log("progress: " + message, image, elem); } }; ImagesLoaded.prototype.complete = function () { var eventName = this.hasAnyBroken ? 'fail' : 'done'; this.isComplete = true; this.emitEvent(eventName, [this]); this.emitEvent('always', [this]); if (this.jqDeferred) { var jqMethod = this.hasAnyBroken ? 'reject' : 'resolve'; this.jqDeferred[jqMethod](this); } }; // -------------------------- -------------------------- // function LoadingImage(img) { this.img = img; } LoadingImage.prototype = Object.create(EvEmitter.prototype); LoadingImage.prototype.check = function () { // If complete is true and browser supports natural sizes, // try to check for image status manually. var isComplete = this.getIsImageComplete(); if (isComplete) { // report based on naturalWidth this.confirm(this.img.naturalWidth !== 0, 'naturalWidth'); return; } // If none of the checks above matched, simulate loading on detached element. this.proxyImage = new Image(); // add crossOrigin attribute. #204 if (this.img.crossOrigin) { this.proxyImage.crossOrigin = this.img.crossOrigin; } this.proxyImage.addEventListener('load', this); this.proxyImage.addEventListener('error', this); // bind to image as well for Firefox. #191 this.img.addEventListener('load', this); this.img.addEventListener('error', this); this.proxyImage.src = this.img.currentSrc || this.img.src; }; LoadingImage.prototype.getIsImageComplete = function () { // check for non-zero, non-undefined naturalWidth // fixes Safari+InfiniteScroll+Masonry bug infinite-scroll#671 return this.img.complete && this.img.naturalWidth; }; LoadingImage.prototype.confirm = function (isLoaded, message) { this.isLoaded = isLoaded; var parentNode = this.img.parentNode; // emit progress with parent or self var elem = parentNode.nodeName === 'PICTURE' ? parentNode : this.img; this.emitEvent('progress', [this, elem, message]); }; // ----- events ----- // // trigger specified handler for event type LoadingImage.prototype.handleEvent = function (event) { var method = 'on' + event.type; if (this[method]) { this[method](event); } }; LoadingImage.prototype.onload = function () { this.confirm(true, 'onload'); this.unbindEvents(); }; LoadingImage.prototype.onerror = function () { this.confirm(false, 'onerror'); this.unbindEvents(); }; LoadingImage.prototype.unbindEvents = function () { this.proxyImage.removeEventListener('load', this); this.proxyImage.removeEventListener('error', this); this.img.removeEventListener('load', this); this.img.removeEventListener('error', this); }; // -------------------------- Background -------------------------- // function Background(url, element) { this.url = url; this.element = element; this.img = new Image(); } // inherit LoadingImage prototype Background.prototype = Object.create(LoadingImage.prototype); Background.prototype.check = function () { this.img.addEventListener('load', this); this.img.addEventListener('error', this); this.img.src = this.url; // check if image is already complete var isComplete = this.getIsImageComplete(); if (isComplete) { this.confirm(this.img.naturalWidth !== 0, 'naturalWidth'); this.unbindEvents(); } }; Background.prototype.unbindEvents = function () { this.img.removeEventListener('load', this); this.img.removeEventListener('error', this); }; Background.prototype.confirm = function (isLoaded, message) { this.isLoaded = isLoaded; this.emitEvent('progress', [this, this.element, message]); }; // -------------------------- jQuery -------------------------- // ImagesLoaded.makeJQueryPlugin = function (jQuery) { jQuery = jQuery || window.jQuery; if (!jQuery) return; // set local variable $ = jQuery; // $().imagesLoaded() $.fn.imagesLoaded = function (options, onAlways) { var instance = new ImagesLoaded(this, options, onAlways); return instance.jqDeferred.promise($(this)); }; }; // try making plugin ImagesLoaded.makeJQueryPlugin(); // -------------------------- -------------------------- // return ImagesLoaded; }); })(imagesloaded); var imagesLoaded = imagesloaded.exports; var instances$j = []; var EventName$n = { SHOW: 'onShow', SHOWN: 'onShown', HIDE: 'onHide', HIDDEN: 'onHidden', ON_REMOVE: 'onRemove', ON_UPDATE: 'onUpdate' }; var ClassName$g = { SHOW: 'show', COLLAPSE: 'collapse', COLLAPSING: 'collapsing', COLLAPSED: 'collapsed' }; var Dimension = { WIDTH: 'width', HEIGHT: 'height' }; var Selector$n = { ACTIVES: '.show, .collapsing', DATA_MOUNT: '[data-mount="collapse"]' }; function _getDimension() { var hasWidth = this.el.classList.contains(Dimension.WIDTH); return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT; } function _addAriaAndCollapsedClass(element, triggerArray) { var isOpen = element.classList.contains(ClassName$g.SHOW); if (triggerArray.length) { triggerArray.forEach(function (triggerItem) { triggerItem.classList.toggle(ClassName$g.COLLAPSED, !isOpen); triggerItem.setAttribute('aria-expanded', isOpen); }); } } var _getCollapses = /*#__PURE__*/_classPrivateFieldLooseKey("getCollapses"); var _areSiblingsTransitioning = /*#__PURE__*/_classPrivateFieldLooseKey("areSiblingsTransitioning"); var Collapse = /*#__PURE__*/function () { /** * Create a Collapse instance * @param {Object} opts - the Collapse options * @param {HTMLElement} opts.el - the Collapse trigger element * @param {boolean} [opts.toggle=false] - whether to toggle the Collapse on initialization * @param {HTMLElement} [opts.parent] - the parent (accordion) element for group management * @param {boolean} [opts.addEventListener=true] - whether to add event listeners on Collapse trigger *Possible carryover from Bootstrap */ function Collapse(_ref) { var _this = this; var el = _ref.el, _ref$toggle = _ref.toggle, toggle = _ref$toggle === void 0 ? false : _ref$toggle, parent = _ref.parent, _ref$addEventListener = _ref.addEventListener, addEventListener = _ref$addEventListener === void 0 ? true : _ref$addEventListener; Object.defineProperty(this, _areSiblingsTransitioning, { value: _areSiblingsTransitioning2 }); Object.defineProperty(this, _getCollapses, { value: _getCollapses2 }); this.isTransitioning = false; this.isCollapsed = true; this.triggerElement = el; if (this.triggerElement.getAttribute('aria-expanded').toString() === 'true') { this.isCollapsed = false; } // Get the affected selectors var selector = Util$1.getSelectorFromElement(this.triggerElement); this.el = document.querySelector(selector); // The toggleArray is all of the buttons that control this Collapse's content this.toggleArray = Array.from(document.querySelectorAll("[href=\"#" + this.el.id + "\"],[data-target=\"#" + this.el.id + "\"]")); this.events = []; // Create custom events. this[EventName$n.SHOWN] = new CustomEvent(EventName$n.SHOWN); this[EventName$n.HIDDEN] = new CustomEvent(EventName$n.HIDDEN); // Find all auto-initialized Collapse buttons var toggleList = Array.from(document.querySelectorAll(Selector$n.DATA_MOUNT)); toggleList.forEach(function (elem) { // Find buttons with same the data-target as the triggerElement var selector = Util$1.getSelectorFromElement(elem); var filterElement = Array.from(document.querySelectorAll(selector)).filter(function (foundElem) { return foundElem === _this.triggerElement; }); // If any buttons have the same data-target as the triggerElement, add them to the toggleArray if (selector !== null && filterElement.length) { _this.toggleArray.push(elem); } }); this.parent = this.el.getAttribute('data-parent'); if (!parent) { _addAriaAndCollapsedClass.bind(this)(this.el, this.toggleArray); } if (toggle) { this.toggle(); } // Add event handlers if (addEventListener) { this.events = [{ el: el, type: 'click', handler: function handler(event) { // preventDefault only for elements (which change the URL) not inside the collapsible element if (event.currentTarget.tagName === 'A') { event.preventDefault(); } // If other collapses are transitioning, prevent interaction with this one if (_classPrivateFieldLooseBase(_this, _areSiblingsTransitioning)[_areSiblingsTransitioning]()) { return; } _this.toggle(); } }]; Util$1.addEvents(this.events); } instances$j.push(this); } var _proto = Collapse.prototype; /** * Toggles the collapse from show to hide and vice versa */ _proto.toggle = function toggle() { if (this.el.classList.contains(ClassName$g.SHOW)) { this.hide(); } else { this.show(); } } /** * Shows the collapse */; _proto.show = function show() { var _this2 = this; if (this.isTransitioning || this.el.classList.contains(ClassName$g.SHOW)) { return; } // Create and dispatch custom event this[EventName$n.SHOW] = new CustomEvent(EventName$n.SHOW, { cancelable: true }); this.el.dispatchEvent(this[EventName$n.SHOW]); if (this[EventName$n.SHOW].defaultPrevented) { return; } var dimension = _getDimension.bind(this)(); this.el.classList.remove(ClassName$g.COLLAPSE); this.el.classList.add(ClassName$g.COLLAPSING); this.el.style[dimension] = 0; if (this.toggleArray.length) { this.toggleArray.forEach(function (elem) { elem.classList.remove(ClassName$g.COLLAPSED); elem.setAttribute('aria-expanded', 'true'); }); } this.isTransitioning = true; // If we have a parent (group management), hide the other elements when other is shown if (this.parent) { var collapseInstances = _classPrivateFieldLooseBase(this, _getCollapses)[_getCollapses](); collapseInstances.forEach(function (collapse) { if (collapse !== _this2 && collapse.parent === _this2.parent && !collapse.isCollapsed) { // Hide the collapse collapse.toggle(); } }); } var complete = function complete() { _this2.el.classList.remove(ClassName$g.COLLAPSING); _this2.el.classList.add(ClassName$g.COLLAPSE); _this2.el.classList.add(ClassName$g.SHOW); _this2.el.style[dimension] = ''; _this2.isTransitioning = false; _this2.isCollapsed = false; _this2.el.dispatchEvent(_this2[EventName$n.SHOWN]); }; var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); var scrollSize = "scroll" + capitalizedDimension; var transitionDuration = Util$1.getTransitionDurationFromElement(this.el); this.el.addEventListener(Util$1.TRANSITION_END, complete.bind(this), { once: true }); Util$1.emulateTransitionEnd(this.el, transitionDuration); this.el.style[dimension] = this.el[scrollSize] + "px"; } /** * Hides the collapse */; _proto.hide = function hide() { var _this3 = this; if (this.isTransitioning || !this.el.classList.contains(ClassName$g.SHOW)) { return; } // Create and dispatch custom event this[EventName$n.HIDE] = new CustomEvent(EventName$n.HIDE, { cancelable: true }); this.el.dispatchEvent(this[EventName$n.HIDE]); if (this[EventName$n.HIDE].defaultPrevented) { return; } var dimension = _getDimension.bind(this)(); this.el.style[dimension] = this.el.getBoundingClientRect()[dimension] + "px"; Util$1.reflow(this.el); this.el.classList.add(ClassName$g.COLLAPSING); this.el.classList.remove(ClassName$g.COLLAPSE); this.el.classList.remove(ClassName$g.SHOW); this.toggleArray.forEach(function (toggle) { var toggleSelector = Util$1.getSelectorFromElement(toggle); if (toggleSelector !== null) { var toggleArray = Array.from(document.querySelectorAll(toggleSelector)); toggleArray.forEach(function (el) { if (!el.classList.contains(ClassName$g.SHOW)) { toggle.classList.add(ClassName$g.COLLAPSED); toggle.setAttribute('aria-expanded', 'false'); } }); } }); this.isTransitioning = true; var complete = function complete() { _this3.isTransitioning = false; _this3.el.classList.remove(ClassName$g.COLLAPSING); _this3.el.classList.add(ClassName$g.COLLAPSE); _this3.isCollapsed = true; _this3.el.dispatchEvent(_this3[EventName$n.HIDDEN]); }; this.el.style[dimension] = ''; var transitionDuration = Util$1.getTransitionDurationFromElement(this.el); this.el.addEventListener(Util$1.TRANSITION_END, complete.bind(this), { once: true }); Util$1.emulateTransitionEnd(this.el, transitionDuration); } /** * Update instance */; _proto.update = function update() { // Create and dispatch custom event this[EventName$n.ON_UPDATE] = new CustomEvent(EventName$n.ON_UPDATE, { bubbles: true }); this.el.dispatchEvent(this[EventName$n.ON_UPDATE]); } /** * Remove the event listener and the instance */; _proto.remove = function remove() { Util$1.removeEvents(this.events); // remove this collapse reference from array of instances var index = instances$j.indexOf(this); instances$j.splice(index, 1); // Create and dispatch custom event this[EventName$n.ON_REMOVE] = new CustomEvent(EventName$n.ON_REMOVE, { bubbles: true }); this.el.dispatchEvent(this[EventName$n.ON_REMOVE]); } /** * Get instances. * @returns {Object[]} An array of instances */; Collapse.getInstances = function getInstances() { return instances$j; }; return Collapse; }(); function _getCollapses2() { var collapses = []; if (this.parent) { collapses = Collapse.getInstances(); } return collapses; } function _areSiblingsTransitioning2() { var _this4 = this; var collapses = _classPrivateFieldLooseBase(this, _getCollapses)[_getCollapses](); var isTransitioning = false; collapses.forEach(function (collapse) { if (collapse !== _this4 && collapse.parent === _this4.parent && collapse.isTransitioning) { isTransitioning = true; } }); return isTransitioning; } var _excluded$1 = ["accordionIndex"]; var instances$i = []; var Selector$m = { DATA_MOUNT: '[data-mount="multi-feature-vertical-tab"]', COLLAPSE: '[data-mount="collapse"]', TAB: '[data-mount="m365-tab"]', ACCORDION: '.accordion', ACCORDION_BODY: '.accordion-body', ACCORDION_TARGET: '.accordion-target', COLLAPSE_SHOW: '.collapse.show', ACTIVE_ACCORDION_TARGET: '.accordion-target.active', MULTI_FEATURE_TAB_PANEL: '.multi-feature-tab-panel', TAB_WINDOW: '.tab-window', CAROUSEL_CONTROL: '.carousel-controls', CAROUSEL_PREV_BUTTON: '.carousel-control-prev', CAROUSEL_NEXT_BUTTON: '.carousel-control-next', LAZY_LOAD_IMAGE: 'img.lazyload' }; var ClassName$f = { DISPLAY: { BLOCK: 'block', NONE: 'd-none' }, ACTIVE: 'active', SHOW: 'show', COLLAPSED: 'collapsed', TAB_PANEL: 'tab-panel', DISABLE_VERTICAL_SCROLL: 'multi-feature-disable-scroll', IMAGE_LOADED: 'lazyloaded' }; var EventName$m = { ON_REMOVE: 'onRemove', ON_UPDATE: 'onUpdate' }; var Height = { ACCORDION_SNEAK_PEAK_HEIGHT: 32, SR_HEIGHT: 56 }; /** * Set accordion height so it is never taller than the accordion target */ function _setAccordionHeight() { var _this = this; if (this.inCustomViewport()) { imagesLoaded(this.el, function () { setTimeout(function () { var maxAccordionHeight; var firstCollapseHeight; _this.accordionHeaders.forEach(function (acc, i) { var display = acc.accordionBody.style.display; var accTarget = acc.accordionTarget; if (accTarget) { var isTarActive = accTarget.classList.contains(ClassName$f.ACTIVE); if (!isTarActive) { accTarget.classList.add(ClassName$f.ACTIVE); } var dNone = accTarget.classList.contains(ClassName$f.DISPLAY.NONE); // Set visible styles acc.accordionBody.style.display = ClassName$f.DISPLAY.BLOCK; if (dNone) { accTarget.classList.remove(ClassName$f.DISPLAY.NONE); } // Calculate heights var accordionTargetHeight = accTarget.offsetHeight; if (!maxAccordionHeight || accordionTargetHeight < maxAccordionHeight) { maxAccordionHeight = accordionTargetHeight; } // On resize tab window width is changed. So, set tab window width to auto calculate height and set it back to same if (i === 0) { var tabWindow = acc.accordionBody.querySelector(Selector$m.TAB_WINDOW); if (tabWindow) { var defaultTabWindowWidth = tabWindow.style.width; tabWindow.style.width = 'auto'; firstCollapseHeight = acc.accordionBody.offsetHeight + acc.offsetHeight; tabWindow.style.width = defaultTabWindowWidth; } } // Reset styles to original state acc.accordionBody.style.display = display; if (dNone) { accTarget.classList.add(ClassName$f.DISPLAY.NONE); } if (!isTarActive) { accTarget.classList.remove(ClassName$f.ACTIVE); } } _this.accordion.style.minHeight = firstCollapseHeight + Height.ACCORDION_SNEAK_PEAK_HEIGHT + "px"; if (maxAccordionHeight) { _this.accordion.style.height = maxAccordionHeight + "px"; _this.accordion.style.overflowY = 'auto'; } }); }, 300); }); } else { this.accordion.style.minHeight = ''; this.accordion.style.height = ''; this.accordion.style.overflowY = ''; } } /** * Based on active tab or accordion set the Multi feature tour height * @param {HTMLElement} target - Active tab or accordion target * @param {number} delay - Delay milliseconds to set height */ function setVerticalTabHeight(target, delay) { var _this2 = this; if (delay === void 0) { delay = 200; } if (this.inCustomViewport()) { setTimeout(function () { var srHeight = 0; if (target && target.classList.contains(ClassName$f.TAB_PANEL)) { srHeight = Height.SR_HEIGHT; } _this2.el.style.minHeight = (target && target.offsetHeight + srHeight) + "px"; }, delay); } else { this.el.style.minHeight = ''; } } /** * Set multi feature tour height when image is loaded * @param {HTMLElement} rootElement - Root element which may contain lazy load images */ function setVerticalTabHeightForLazyLoadImages(rootElement) { var _this3 = this; var lazyLoadImages = (rootElement == null ? void 0 : rootElement.querySelectorAll(Selector$m.LAZY_LOAD_IMAGE)) || []; lazyLoadImages.forEach(function (img) { var mutationObserver = new MutationObserver(function (mutations, observer) { for (var _iterator = _createForOfIteratorHelperLoose$6(mutations), _step; !(_step = _iterator()).done;) { var mutation = _step.value; if (mutation.target.classList.contains(ClassName$f.IMAGE_LOADED)) { setVerticalTabHeight.call(_this3, rootElement, 0); observer.disconnect(); } } }); mutationObserver.observe(img, { attributes: true, attributeFilter: ['class'] }); }); } /** * Display the accordion element and set height to vertical tab container */ function _showAccordionContent(accordionHeader) { var _this4 = this; if (accordionHeader.collapseInstance) { accordionHeader.collapseInstance.remove(); } // check if any active tab is present and remove active before making respective accordion to active this.tabs.forEach(function (tab) { tab.tabmultifeaturepanel.classList.remove(ClassName$f.ACTIVE); if (tab.classList.contains(ClassName$f.ACTIVE)) { tab.classList.remove(ClassName$f.ACTIVE); tab.tabBody.classList.remove(ClassName$f.ACTIVE); tab.tabBody.classList.remove(ClassName$f.SHOW); } }); if (this.inCustomViewport() && accordionHeader.collapseInstance) { accordionHeader.collapseInstance.show(); } // remove any other accordion's active state var MobileGroupManagementandViewport = this.disableMobileGroupManagement && this.inMobileViewport(); this.accordionHeaders.forEach(function (accordion) { if (accordion.accordionTarget && accordion.accordionTarget.classList.contains(ClassName$f.ACTIVE) && !MobileGroupManagementandViewport) { accordion.accordionTarget.classList.remove(ClassName$f.ACTIVE); } if (accordion !== accordionHeader && _this4.inCustomViewport() && accordionHeader.collapseInstance && !_this4.resize) { accordion.collapseInstance.hide(); } }); if (this.resize) { this.resize = false; } // toggle the accordion state if (accordionHeader.accordionTarget) { if (accordionHeader.accordionTarget.classList.contains(ClassName$f.ACTIVE) || accordionHeader.classList.contains(ClassName$f.COLLAPSED)) { accordionHeader.accordionTarget.classList.remove(ClassName$f.ACTIVE); } else { accordionHeader.accordionTarget.classList.add(ClassName$f.ACTIVE); } } setVerticalTabHeight.call(this, accordionHeader.accordionTarget); setVerticalTabHeightForLazyLoadImages.call(this, accordionHeader.accordionTarget); _getIndexAndUpdateCarouselButtons.call(this); } /** * Display the tab element and set height to vertical tab container */ function _showTabContent(tab) { if (tab.parentAccordionTarget && tab.parentAccordionTarget.classList.contains(ClassName$f.ACTIVE)) { tab.parentAccordionTarget.classList.remove(ClassName$f.ACTIVE); } tab.tabmultifeaturepanel.classList.add(ClassName$f.ACTIVE); setVerticalTabHeight.call(this, tab.tabBody); setVerticalTabHeightForLazyLoadImages.call(this, tab.tabBody); _getIndexAndUpdateCarouselButtons.call(this); } function _getIndexAndUpdateCarouselButtons() { if (this.carouselControls) { var _getActiveAccordionTa = _getActiveAccordionTabIndex.call(this), accordionIndex = _getActiveAccordionTa.accordionIndex, tabIndex = _getActiveAccordionTa.tabIndex; _enableDisableCarouselButtons.call(this, accordionIndex, tabIndex); } } /** * Based on window size set heights to vertical tab container and accordion element */ function _setHeightOnResize() { this.resize = true; var activetab = this.tabs.find(function (tab) { return tab.classList.contains(ClassName$f.ACTIVE); }); var activeCollapse = this.el.querySelector(Selector$m.COLLAPSE_SHOW); if (this.disableMobileGroupManagement && !this.inMobileViewport()) { _showAccordionContent.call(this, this.accordionHeaders[0]); } else if (activetab) { var tabTarget = Util$1.getSelectorFromElement(activetab); var tabBody = document.querySelector(tabTarget); setVerticalTabHeight.call(this, tabBody); } else if (activeCollapse) { var activeAccTarget = activeCollapse.querySelector(Selector$m.ACTIVE_ACCORDION_TARGET); if (activeAccTarget) { setVerticalTabHeight.call(this, activeAccTarget); } } else { _showAccordionContent.call(this, this.accordionHeaders[0]); } _setAccordionHeight.call(this); } function _onKeycodeEvent(e, tab) { var keycode = Util$1.getKeyCode(e); switch (keycode) { case Util$1.keyCodes.SPACE: case Util$1.keyCodes.ENTER: _showTabContent.call(this, tab); break; } } /** * For each tab set respective tab body and parent accordion target */ function _setupTabs(tabs) { tabs.forEach(function (tab) { var tabTarget = Util$1.getSelectorFromElement(tab); var tabBody = document.querySelector(tabTarget); var tabmultifeaturepanel = tabBody.closest(Selector$m.MULTI_FEATURE_TAB_PANEL); var accordionBody = tabBody.closest(Selector$m.ACCORDION_BODY); var accordionTarget = accordionBody.querySelector(Selector$m.ACCORDION_TARGET); tab.tabmultifeaturepanel = tabmultifeaturepanel; tab.tabBody = tabBody; tab.parentAccordionTarget = accordionTarget; }); } /** * For each accordion header set respective accordion body and accordion target */ function _setupAccordions(accordionHeaders) { accordionHeaders.forEach(function (accordionHeader) { var opts = { el: accordionHeader }; accordionHeader.collapseInstance = new Collapse(opts); var accordionSelector = Util$1.getSelectorFromElement(accordionHeader); accordionHeader.accordionBody = document.querySelector(accordionSelector); accordionHeader.accordionTarget = accordionHeader.accordionBody.querySelector(Selector$m.ACCORDION_TARGET); }); } /** * Enable or Disable buttons based on selected item */ function _enableDisableCarouselButtons(accordionIndex, tabIndex) { if (tabIndex < 0 && accordionIndex === 0) { this.prevButton.setAttribute('disabled', ''); } else if (this.prevButton.hasAttribute('disabled')) { this.prevButton.removeAttribute('disabled'); } if (this.accordionHeaders.length - 1 === accordionIndex && this.accordionHeaders[accordionIndex].tabs.length - 1 === tabIndex) { this.nextButton.setAttribute('disabled', ''); } else if (this.nextButton.hasAttribute('disabled')) { this.nextButton.removeAttribute('disabled'); } } function _getActiveAccordion() { var activeAccordion = this.accordionHeaders.find(function (accordionHeader) { return !accordionHeader.classList.contains(ClassName$f.COLLAPSED); }); this.activeAccordion = activeAccordion; return activeAccordion; } /** * Get Active accordion and tab index */ function _getActiveAccordionTabIndex() { var _getActiveAccordion$c = _getActiveAccordion.call(this), accordionIndex = _getActiveAccordion$c.accordionIndex, activeAccordion = _objectWithoutPropertiesLoose(_getActiveAccordion$c, _excluded$1); var activeTab = activeAccordion.tabs.find(function (tab) { return tab.classList.contains(ClassName$f.ACTIVE); }); var tabIndex = activeTab ? activeTab.tabInd : -1; return { accordionIndex: accordionIndex, tabIndex: tabIndex }; } /** * show previous item */ function _showPreviousContent() { var _this5 = this; var _getActiveAccordionTa2 = _getActiveAccordionTabIndex.call(this), accordionIndex = _getActiveAccordionTa2.accordionIndex, tabIndex = _getActiveAccordionTa2.tabIndex; if (tabIndex === 0) { _showAccordionContent.call(this, this.accordionHeaders[accordionIndex]); tabIndex -= 1; } else { if (tabIndex < 0) { _showAccordionContent.call(this, this.accordionHeaders[accordionIndex - 1]); var activeAccordion = _getActiveAccordion.call(this); accordionIndex = activeAccordion.accordionIndex; tabIndex = this.accordionHeaders[accordionIndex].tabs.length; } var tabToShow = this.tabs.find(function (tab) { return tab === _this5.accordionHeaders[accordionIndex].tabs[tabIndex - 1]; }); var tabInstanceToShow = this.tabInstances.find(function (tabInst) { return tabInst.el === tabToShow; }); if (tabInstanceToShow) { tabInstanceToShow.show(); _showTabContent.call(this, tabToShow); } } } /** * show next item */ function _showNextContent() { var _this6 = this; var _getActiveAccordionTa3 = _getActiveAccordionTabIndex.call(this), accordionIndex = _getActiveAccordionTa3.accordionIndex, tabIndex = _getActiveAccordionTa3.tabIndex; if (tabIndex && this.activeAccordion.tabs.length - 1 === tabIndex && this.accordionHeaders.length - 1 !== accordionIndex) { _showAccordionContent.call(this, this.accordionHeaders[accordionIndex + 1]); } else { var tabToShow = this.tabs.find(function (tab) { return tab === _this6.accordionHeaders[accordionIndex].tabs[tabIndex + 1]; }); if (tabToShow) { var tabInstanceToShow = this.tabInstances.find(function (tabInst) { return tabInst.el === tabToShow; }); if (tabInstanceToShow) { tabInstanceToShow.show(); _showTabContent.call(this, tabToShow); } } else if (this.accordionHeaders[accordionIndex + 1]) { _showAccordionContent.call(this, this.accordionHeaders[accordionIndex + 1]); } } } /** * set respective accordion and tab index */ function _setupAccordionTabIndex() { var _this7 = this; this.accordionHeaders.forEach(function (accordion, accorIdIndex) { accordion.accordionIndex = accorIdIndex; accordion.tabs = [].slice.call(accordion.accordionBody.querySelectorAll(Selector$m.TAB)); accordion.tabs.forEach(function (accordionTab, tabIndex) { _this7.tabs.find(function (tab) { return tab === accordionTab; }).tabInd = tabIndex; }); }); } /** * Class representing MultiFeatureVerticalTab. */ var MultiFeatureVerticalTab = /*#__PURE__*/function () { function MultiFeatureVerticalTab(opts) { var _this8 = this; this.el = opts.el; this.accordion = this.el.querySelector(Selector$m.ACCORDION); this.accordionHeaders = [].slice.call(this.el.querySelectorAll(Selector$m.COLLAPSE)); this.tabs = [].slice.call(this.el.querySelectorAll(Selector$m.TAB)); this.customViewports = opts.customViewports || ['md', 'lg', 'xl']; this.disableVerticalScroll = this.el.classList.contains(ClassName$f.DISABLE_VERTICAL_SCROLL); this.disableMobileGroupManagement = this.accordion.dataset.disableMobileGroupManagement === 'true'; this.mobileViewports = opts.mobileViewports || ['xs', 'sm']; this.resize = false; this.carouselControls = this.el.parentElement.querySelector(Selector$m.CAROUSEL_CONTROL); this.events = []; // map accordion body and accordion target to respective accordion header _setupAccordions.call(this, this.accordionHeaders); // map tab body and parent accordion target to respective tab element _setupTabs.call(this, this.tabs); this.tabs.forEach(function (tab) { _this8.events.push({ el: tab, type: 'click', handler: _showTabContent.bind(_this8, tab) }, { el: tab, type: 'keydown', handler: function handler(e) { _onKeycodeEvent.call(_this8, e, tab); } }); }); this.accordionHeaders.forEach(function (accordionHeader) { _this8.events.push({ el: accordionHeader, type: 'click', handler: _showAccordionContent.bind(_this8, accordionHeader) }); }); if (!this.disableVerticalScroll) { this.events.push({ el: window, type: 'resize', handler: throttle(200, _setHeightOnResize.bind(this)) }); } if (this.carouselControls) { this.prevButton = this.carouselControls.querySelector(Selector$m.CAROUSEL_PREV_BUTTON); this.nextButton = this.carouselControls.querySelector(Selector$m.CAROUSEL_NEXT_BUTTON); _setupAccordionTabIndex.call(this); this.tabInstances = window.m365.TabExtension.getInstances(); this.activeAccordion = this.accordionHeaders.find(function (acc) { return !acc.classList.contains(ClassName$f.COLLAPSED); }); if (this.activeAccordion) { _enableDisableCarouselButtons.call(this, this.activeAccordion.accordionIndex, -1); } else { _enableDisableCarouselButtons.call(this, this.accordionHeaders[0].accordionIndex, -1); } this.events.push({ el: this.prevButton, type: 'click', handler: _showPreviousContent.bind(this) }, { el: this.nextButton, type: 'click', handler: _showNextContent.bind(this) }); } Util$1.addEvents(this.events); _showAccordionContent.call(this, this.accordionHeaders[0]); if (!this.disableVerticalScroll) { _setAccordionHeight.call(this); } instances$i.push(this); } var _proto = MultiFeatureVerticalTab.prototype; _proto.inCustomViewport = function inCustomViewport() { var viewport = Util$1.detectViewport(); return this.customViewports.indexOf(viewport) > -1; }; _proto.inMobileViewport = function inMobileViewport() { var viewport = Util$1.detectViewport(); return this.mobileViewports.indexOf(viewport) > -1; } /** * Update instance. */; _proto.update = function update() { // Create and dispatch custom event this[EventName$m.ON_UPDATE] = new CustomEvent(EventName$m.ON_UPDATE, { bubbles: true }); this.el.dispatchEvent(this[EventName$m.ON_UPDATE]); } /** * Remove the instance */; _proto.remove = function remove() { Util$1.removeEvents(this.events); var index = instances$i.indexOf(this); instances$i.splice(index, 1); // Create and dispatch custom event this[EventName$m.ON_REMOVE] = new CustomEvent(EventName$m.ON_REMOVE, { bubbles: true }); this.el.dispatchEvent(this[EventName$m.ON_REMOVE]); } /** * Get multifeature vertical tab instances. * @returns {Object[]} An array of multifeature vertical tab instances */; MultiFeatureVerticalTab.getInstances = function getInstances() { return instances$i; }; return MultiFeatureVerticalTab; }(); var aCallable$1 = aCallable$a; var toObject$3 = toObject$d; var IndexedObject = indexedObject; var lengthOfArrayLike$1 = lengthOfArrayLike$b; var $TypeError$1 = TypeError; // `Array.prototype.{ reduce, reduceRight }` methods implementation var createMethod = function (IS_RIGHT) { return function (that, callbackfn, argumentsLength, memo) { aCallable$1(callbackfn); var O = toObject$3(that); var self = IndexedObject(O); var length = lengthOfArrayLike$1(O); var index = IS_RIGHT ? length - 1 : 0; var i = IS_RIGHT ? -1 : 1; if (argumentsLength < 2) while (true) { if (index in self) { memo = self[index]; index += i; break; } index += i; if (IS_RIGHT ? index < 0 : length <= index) { throw $TypeError$1('Reduce of empty array with no initial value'); } } for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) { memo = callbackfn(memo, self[index], index, O); } return memo; }; }; var arrayReduce = { // `Array.prototype.reduce` method // https://tc39.es/ecma262/#sec-array.prototype.reduce left: createMethod(false), // `Array.prototype.reduceRight` method // https://tc39.es/ecma262/#sec-array.prototype.reduceright right: createMethod(true) }; var $$j = _export; var $reduce = arrayReduce.left; var arrayMethodIsStrict$2 = arrayMethodIsStrict$8; var CHROME_VERSION = engineV8Version; var IS_NODE = engineIsNode; var STRICT_METHOD$2 = arrayMethodIsStrict$2('reduce'); // Chrome 80-82 has a critical bug // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982 var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83; // `Array.prototype.reduce` method // https://tc39.es/ecma262/#sec-array.prototype.reduce $$j({ target: 'Array', proto: true, forced: !STRICT_METHOD$2 || CHROME_BUG }, { reduce: function reduce(callbackfn /* , initialValue */) { var length = arguments.length; return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined); } }); var _excluded = ["feedback"]; var Selector$l = { DATA_MOUNT: '.needs-validation, [data-mount="validation"]', INPUTS: 'input, select, textarea', SUBMIT: '[type="submit"]', FEEDBACK_LIST: '[data-mount="feedback-list"]', FEEDBACK_EL: 'data-feedback', FEEDBACK_CONTENT: 'data-feedback-content', CHECKBOX_REQUIRED: 'data-form-check-required', CHECKBOX_MAX: 'data-form-check-max' }; var EventName$l = { ON_VALID: 'onValid', ON_REMOVE: 'onRemove', ON_UPDATE: 'onUpdate' }; var ClassName$e = { DISPLAY: { NONE: 'd-none' }, IS_INVALID: 'is-invalid' }; var formValidations = []; /** * Private functions. */ /** * Create link to input field with feedback at bottom of form * @param {HTMLInputElement} input - The form input field. */ function _createFeedbackLink$1(input) { if (!input.feedback.link) { var feedbackItem = document.createElement('li'); var feedbackLink = document.createElement('a'); var feedbackTextNode = document.createTextNode(input.feedback.content); feedbackLink.setAttribute('href', "#" + input.id); input.feedback.focusControls = new Util$1.FocusControls({ el: feedbackLink }); feedbackLink.append(feedbackTextNode); feedbackItem.append(feedbackLink); input.feedback.link = feedbackItem; if (input.group) { input.group.siblings.forEach(function (sibling) { sibling.feedback.link = feedbackItem; sibling.feedback.focusControls = input.feedback.focusControls; }); } } this.feedbackList.append(input.feedback.link); if (!input.feedback.focusControls) { input.feedback.focusControls = new Util$1.FocusControls({ el: input.feedback.link.querySelector('a') }); } input.feedback.linkRemoved = false; if (input.group) { input.group.siblings.forEach(function (sibling) { sibling.feedback.linkRemoved = false; }); } this.feedbackListContainer.classList.remove(ClassName$e.DISPLAY.NONE); } /** * Remove link to input field with feedback at bottom of form * @param {HTMLElement} input - The form input field. */ function _removeFeedbackLink$1(input) { if (input.group) { input.group.siblings.forEach(function (sibling) { sibling.feedback.linkRemoved = true; sibling.feedback.focusControls.remove(); }); } else { input.feedback.linkRemoved = true; input.feedback.focusControls.remove(); } input.feedback.link.remove(); if (this.feedbackList.children.length === 0) { this.feedbackListContainer.classList.add(ClassName$e.DISPLAY.NONE); } } /** * Generate feedback data object from data attributes * @param {HTMLInputElement} input - The form input field. * @returns {Object} Object with feedback data. */ function _getFeedbackData(input) { var feedback = { id: input.getAttribute(Selector$l.FEEDBACK_EL) }; if (feedback.id) { feedback.content = input.getAttribute(Selector$l.FEEDBACK_CONTENT); feedback.el = this.el.querySelector("#" + feedback.id); feedback.linkRemoved = true; } return feedback; } /** * Events for when input is valid * @param {HTMLInputElement} input - The form input field. */ function _onValid(input) { input.classList.remove(ClassName$e.IS_INVALID); input.setAttribute('aria-invalid', 'false'); if (input.group) { input.group.siblings.forEach(function (sibling) { sibling.classList.remove(ClassName$e.IS_INVALID); sibling.setAttribute('aria-invalid', false); }); } if (input.feedback.el) { input.feedback.el.classList.remove(ClassName$e.IS_INVALID); input.feedback.el.textContent = ''; if (this.feedbackList && input.feedback.link && !input.feedback.linkRemoved) { _removeFeedbackLink$1.bind(this)(input); } } } /** * Events for when input is invalid * @param {HTMLElement | Object} input - The form input field. * @param {Object} input.feedback - The feedback options. * @param {HTMLElement} input.feedback.el - The input feedback element. * @param {string} input.feedback.content - The feedback content. */ function _onInvalid(input) { input.classList.add(ClassName$e.IS_INVALID); input.setAttribute('aria-invalid', true); if (input.group) { input.group.siblings.forEach(function (sibling) { sibling.classList.add(ClassName$e.IS_INVALID); sibling.setAttribute('aria-invalid', true); }); } if (input.feedback.el && input.feedback.content) { input.feedback.el.classList.add(ClassName$e.IS_INVALID); input.feedback.el.textContent = input.feedback.content; if (this.feedbackList && input.feedback.linkRemoved) { _createFeedbackLink$1.bind(this)(input); } } } /** * Generate group data object from input * @param {HTMLInputElement} input - The form input field. * @returns {Object} Object with group data. */ function _inputCheckReducer(input) { var name = input.name, type = input.type; // eslint-disable-next-line unicorn/no-array-reduce return [].slice.call(this.inputs).reduce(function (obj, _input) { if (_input.type === type && _input.name === name) { if (obj.siblings) { obj.siblings.push(_input); } else { obj.siblings = [_input]; } var requiredMin = _input.getAttribute(Selector$l.CHECKBOX_REQUIRED); var maxValid = _input.getAttribute(Selector$l.CHECKBOX_MAX); // Selector.CHECKBOX_REQUIRED attribute accepts either a boolean or integer // If it's a boolean convert to an integer if (requiredMin) { var requiredMinInt = Number(requiredMin); if (isNaN(requiredMinInt)) { requiredMinInt = requiredMin === 'true' ? 1 : 0; } obj.requiredMin = requiredMinInt; } if (maxValid) { var maxValidInt = Number(maxValid); var maxValidIntIsNaN = isNaN(maxValidInt); if (!maxValidIntIsNaN) { obj.maxValid = maxValidInt; } } if (_input.getAttribute(Selector$l.FEEDBACK_EL)) { if (obj.feedback) { obj.feedback.push(_input); } else { obj.feedback = [_input]; } } } return obj; }, {}); } /** * Setup inputs with required data. * @param {HTMLInputElement} input - The form input field. */ function _inputInit(input) { var type = input.type, required = input.required; var feedbackEl = input; if (required) { // the default aria-invalid attribute is false but some screen readers do not respect this input.setAttribute('aria-invalid', 'false'); } if (type === 'radio' || type === 'checkbox') { var group = _inputCheckReducer.bind(this)(input); var feedback = group.feedback, _group = _objectWithoutPropertiesLoose(group, _excluded); if (_group.siblings.length > 1) { input.group = _group; } if (feedback) { feedbackEl = feedback[0]; } } input.feedback = _getFeedbackData.bind(this)(feedbackEl); } /** * Set first element to receive focus in the feedback list */ function _setFeedbackListFocusEl() { var tagNames = ['H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'P']; var prevEl = this.feedbackList.previousElementSibling; this.feedbackListFocusEl = this.feedbackListContainer; if (prevEl && tagNames.indexOf(prevEl.tagName) > -1) { this.feedbackListFocusEl = prevEl; } this.feedbackListFocusEl.tabIndex = -1; } /** * Unset current element to receive focus in the feedbacklist */ function _unsetFeedbackListFocusEl() { this.feedbackListFocusEl.removeAttribute('tabIndex'); } // Moved event declarations outside of constructor for calling in update. /** * Adds submit event to events array */ function _setupSubmitEvent() { var _this = this; this.events.push({ el: this.el, type: 'submit', handler: function handler(e) { _this.onSubmit(e); } }); } /** * Adds blur and change events for all input, select, and textarea elements to events array */ function _setupInputEvents() { var _this2 = this; // Set up inputs this.inputs.forEach(function (input) { _inputInit.bind(_this2)(input); _this2.events.push({ el: input, type: 'blur', handler: function handler() { setTimeout(function () { _this2.validate(input, true); }, 0); } }, { el: input, type: 'change', handler: function handler() { _this2.validate(input, true); } }); }); } /** * Class representing form validation. */ var FormValidation = /*#__PURE__*/function () { /** * Create a FormValidation instance * @param {Object} opts - The form validation options * @param {HTMLElement} opts.el - The form DOM node * @param {Boolean} [opts.preventFormSubmission=false] - Flag to prevent form submission * @param {Boolean} [opts.allowEmptySubmit=false] - Flag that determines whether to allow empty forms to submit * @param {HTMLElement} [opts.feedbackListContainer] - The feedback list container DOM node */ function FormValidation(_ref) { var el = _ref.el, _ref$preventFormSubmi = _ref.preventFormSubmission, preventFormSubmission = _ref$preventFormSubmi === void 0 ? false : _ref$preventFormSubmi, _ref$allowEmptySubmit = _ref.allowEmptySubmit, allowEmptySubmit = _ref$allowEmptySubmit === void 0 ? false : _ref$allowEmptySubmit, feedbackListContainer = _ref.feedbackListContainer; this.el = el; // Property `preventFormSubmission` takes precedence over `allowEmptySubmit` this.preventFormSubmission = preventFormSubmission || this.el.dataset.preventFormSubmission !== undefined; this.allowEmptySubmit = allowEmptySubmit || this.el.dataset.allowEmptySubmit !== undefined; this.inputs = this.el.querySelectorAll(Selector$l.INPUTS); this.submit = this.el.querySelector(Selector$l.SUBMIT); this.feedbackListContainer = feedbackListContainer || this.el.querySelector(Selector$l.FEEDBACK_LIST); if (this.feedbackListContainer) { this.feedbackList = this.feedbackListContainer.querySelector('ol'); _setFeedbackListFocusEl.call(this); } this.events = []; _setupSubmitEvent.call(this); formValidations.push(this); // Hide empty feedback list if (this.feedbackList && this.feedbackList.children.length === 0) { this.feedbackListContainer.classList.add(ClassName$e.DISPLAY.NONE); } _setupInputEvents.call(this); // Add event handlers. Util$1.addEvents(this.events); } /** * Validate form input * @param {HTMLInputElement} input - The form input field. * @param {boolean} [onlyOnValid] - Only runs if valid. */ var _proto = FormValidation.prototype; _proto.validate = function validate(input, onlyOnValid) { if (onlyOnValid === void 0) { onlyOnValid = false; } var activeEl = document.activeElement; // Don't validate input groups until focus has left the group if (input.group && input.name === activeEl.name) { return; } if (this.isInputValid(input)) { _onValid.bind(this)(input); } else if (!onlyOnValid) { _onInvalid.bind(this)(input); } } /** * Check if input is valid * @param {HTMLInputElement} input - The form input field. * @returns {Boolean} - true if input is valid. */; _proto.isInputValid = function isInputValid(input) { // Radio and check groups if (input.group && (input.group.requiredMin || input.group.maxValid)) { // get number of checked inputs in the group var checked = input.group.siblings.filter(function (sibling) { return sibling.checked === true; }); // compare against required min or max if (input.group.requiredMin && checked.length < input.group.requiredMin || input.group.maxValid && checked.length > input.group.maxValid) { return false; } return true; } return input.checkValidity(); } /** * Check if form is valid * @returns {Boolean} - true if all form inputs are valid. */; _proto.isFormValid = function isFormValid() { var _this3 = this; var checkValidity = [].slice.call(this.inputs).some(function (input) { return _this3.isInputValid(input) === false; }); return !checkValidity; } /** * Check if form is empty * @returns {Boolean} - false if any form inputs are checked or have a value. */; _proto.isFormEmpty = function isFormEmpty() { var notEmpty = [].slice.call(this.inputs).some(function (input) { var type = input.type, value = input.value, checked = input.checked; if (type === 'radio' || type === 'checkbox') { if (checked) { return true; } } else if (value !== null && value !== undefined && value.trim().length) { return true; } return false; }); return !notEmpty; } /** * Submit form * @param {Event} e - The event object. */; _proto.onSubmit = function onSubmit(e) { var _this4 = this; e.preventDefault(); this.inputs.forEach(function (input) { _this4.validate(input); }); if (this.isFormValid()) { // Create and dispatch custom event this[EventName$l.ON_VALID] = new CustomEvent(EventName$l.ON_VALID, { bubbles: true }); this.el.dispatchEvent(this[EventName$l.ON_VALID]); if (!this.preventFormSubmission && (!this.isFormEmpty() || this.allowEmptySubmit)) { this.el.submit(); } } else if (this.feedbackListFocusEl) { this.feedbackListFocusEl.focus(); } } /** * Update form validation. * @param {Object} opts - The form validation options * @param {Boolean} [opts.preventFormSubmission] - Flag to prevent form submission * @param {HTMLElement} [opts.feedbackListContainer] - The feedback list container DOM node * @param {Boolean} [opts.allowEmptySubmit] - Flag that determines whether to allow empty forms to submit */; _proto.update = function update(opts) { if (opts === void 0) { opts = {}; } if (opts) { this.inputs = this.el.querySelectorAll(Selector$l.INPUTS); this.submit = this.el.querySelector(Selector$l.SUBMIT); // Remove event handlers Util$1.removeEvents(this.events); // Rebuild events array this.events = []; _setupSubmitEvent.call(this); _setupInputEvents.call(this); Util$1.addEvents(this.events); // Property `preventFormSubmission` takes precedence over `allowEmptySubmit` if (opts.preventFormSubmission) { this.preventFormSubmission = opts.preventFormSubmission; } if (opts.feedbackListContainer) { _unsetFeedbackListFocusEl.call(this); this.feedbackListContainer = opts.feedbackListContainer; this.feedbackList = this.feedbackListContainer.querySelector('ol'); _setFeedbackListFocusEl.call(this); if (this.feedbackList.children.length === 0) { this.feedbackListContainer.classList.add(ClassName$e.DISPLAY.NONE); } else { this.feedbackListContainer.classList.remove(ClassName$e.DISPLAY.NONE); } } if (opts.allowEmptySubmit) { this.allowEmptySubmit = opts.allowEmptySubmit; } } // Create and dispatch custom event this[EventName$l.ON_UPDATE] = new CustomEvent(EventName$l.ON_UPDATE, { bubbles: true }); this.el.dispatchEvent(this[EventName$l.ON_UPDATE]); } /** * Remove the form validation. */; _proto.remove = function remove() { // Remove event handlers Util$1.removeEvents(this.events); // Remove this form validation reference from array of instances var index = formValidations.indexOf(this); formValidations.splice(index, 1); // Create and dispatch custom event this[EventName$l.ON_REMOVE] = new CustomEvent(EventName$l.ON_REMOVE, { bubbles: true }); this.el.dispatchEvent(this[EventName$l.ON_REMOVE]); } /** * Get an array of form validation instances. * @returns {Object[]} Array of form validation instances. */; FormValidation.getInstances = function getInstances() { return formValidations; }; return FormValidation; }(); // This file is a workaround for a bug in web browsers' "native" // ES6 importing system which is uncapable of importing "*.json" files. // https://github.com/catamphetamine/libphonenumber-js/issues/239 var metadata = { "version": 4, "country_calling_codes": { "1": ["US", "AG", "AI", "AS", "BB", "BM", "BS", "CA", "DM", "DO", "GD", "GU", "JM", "KN", "KY", "LC", "MP", "MS", "PR", "SX", "TC", "TT", "VC", "VG", "VI"], "7": ["RU", "KZ"], "20": ["EG"], "27": ["ZA"], "30": ["GR"], "31": ["NL"], "32": ["BE"], "33": ["FR"], "34": ["ES"], "36": ["HU"], "39": ["IT", "VA"], "40": ["RO"], "41": ["CH"], "43": ["AT"], "44": ["GB", "GG", "IM", "JE"], "45": ["DK"], "46": ["SE"], "47": ["NO", "SJ"], "48": ["PL"], "49": ["DE"], "51": ["PE"], "52": ["MX"], "53": ["CU"], "54": ["AR"], "55": ["BR"], "56": ["CL"], "57": ["CO"], "58": ["VE"], "60": ["MY"], "61": ["AU", "CC", "CX"], "62": ["ID"], "63": ["PH"], "64": ["NZ"], "65": ["SG"], "66": ["TH"], "81": ["JP"], "82": ["KR"], "84": ["VN"], "86": ["CN"], "90": ["TR"], "91": ["IN"], "92": ["PK"], "93": ["AF"], "94": ["LK"], "95": ["MM"], "98": ["IR"], "211": ["SS"], "212": ["MA", "EH"], "213": ["DZ"], "216": ["TN"], "218": ["LY"], "220": ["GM"], "221": ["SN"], "222": ["MR"], "223": ["ML"], "224": ["GN"], "225": ["CI"], "226": ["BF"], "227": ["NE"], "228": ["TG"], "229": ["BJ"], "230": ["MU"], "231": ["LR"], "232": ["SL"], "233": ["GH"], "234": ["NG"], "235": ["TD"], "236": ["CF"], "237": ["CM"], "238": ["CV"], "239": ["ST"], "240": ["GQ"], "241": ["GA"], "242": ["CG"], "243": ["CD"], "244": ["AO"], "245": ["GW"], "246": ["IO"], "247": ["AC"], "248": ["SC"], "249": ["SD"], "250": ["RW"], "251": ["ET"], "252": ["SO"], "253": ["DJ"], "254": ["KE"], "255": ["TZ"], "256": ["UG"], "257": ["BI"], "258": ["MZ"], "260": ["ZM"], "261": ["MG"], "262": ["RE", "YT"], "263": ["ZW"], "264": ["NA"], "265": ["MW"], "266": ["LS"], "267": ["BW"], "268": ["SZ"], "269": ["KM"], "290": ["SH", "TA"], "291": ["ER"], "297": ["AW"], "298": ["FO"], "299": ["GL"], "350": ["GI"], "351": ["PT"], "352": ["LU"], "353": ["IE"], "354": ["IS"], "355": ["AL"], "356": ["MT"], "357": ["CY"], "358": ["FI", "AX"], "359": ["BG"], "370": ["LT"], "371": ["LV"], "372": ["EE"], "373": ["MD"], "374": ["AM"], "375": ["BY"], "376": ["AD"], "377": ["MC"], "378": ["SM"], "380": ["UA"], "381": ["RS"], "382": ["ME"], "383": ["XK"], "385": ["HR"], "386": ["SI"], "387": ["BA"], "389": ["MK"], "420": ["CZ"], "421": ["SK"], "423": ["LI"], "500": ["FK"], "501": ["BZ"], "502": ["GT"], "503": ["SV"], "504": ["HN"], "505": ["NI"], "506": ["CR"], "507": ["PA"], "508": ["PM"], "509": ["HT"], "590": ["GP", "BL", "MF"], "591": ["BO"], "592": ["GY"], "593": ["EC"], "594": ["GF"], "595": ["PY"], "596": ["MQ"], "597": ["SR"], "598": ["UY"], "599": ["CW", "BQ"], "670": ["TL"], "672": ["NF"], "673": ["BN"], "674": ["NR"], "675": ["PG"], "676": ["TO"], "677": ["SB"], "678": ["VU"], "679": ["FJ"], "680": ["PW"], "681": ["WF"], "682": ["CK"], "683": ["NU"], "685": ["WS"], "686": ["KI"], "687": ["NC"], "688": ["TV"], "689": ["PF"], "690": ["TK"], "691": ["FM"], "692": ["MH"], "850": ["KP"], "852": ["HK"], "853": ["MO"], "855": ["KH"], "856": ["LA"], "880": ["BD"], "886": ["TW"], "960": ["MV"], "961": ["LB"], "962": ["JO"], "963": ["SY"], "964": ["IQ"], "965": ["KW"], "966": ["SA"], "967": ["YE"], "968": ["OM"], "970": ["PS"], "971": ["AE"], "972": ["IL"], "973": ["BH"], "974": ["QA"], "975": ["BT"], "976": ["MN"], "977": ["NP"], "992": ["TJ"], "993": ["TM"], "994": ["AZ"], "995": ["GE"], "996": ["KG"], "998": ["UZ"] }, "countries": { "AC": ["247", "00", "(?:[01589]\\d|[46])\\d{4}", [5, 6], 0, 0, 0, 0, 0, 0, 0, [["6[2-467]\\d{3}", [5]], ["4\\d{4}", [5]], 0, 0, 0, 0, ["(?:0[1-9]|[1589]\\d)\\d{4}", [6]]]], "AD": ["376", "00", "(?:1|6\\d)\\d{7}|[135-9]\\d{5}", [6, 8, 9], [["(\\d{3})(\\d{3})", "$1 $2", ["[135-9]"]], ["(\\d{4})(\\d{4})", "$1 $2", ["1"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["6"]]], 0, 0, 0, 0, 0, 0, [["[78]\\d{5}", [6]], ["690\\d{6}|[356]\\d{5}", [6, 9]], ["180[02]\\d{4}", [8]], ["[19]\\d{5}", [6]]]], "AE": ["971", "00", "(?:[4-7]\\d|9[0-689])\\d{7}|800\\d{2,9}|[2-4679]\\d{7}", [5, 6, 7, 8, 9, 10, 11, 12], [["(\\d{3})(\\d{2,9})", "$1 $2", ["60|8"]], ["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["[236]|[479][2-8]"], "0$1"], ["(\\d{3})(\\d)(\\d{5})", "$1 $2 $3", ["[479]"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["5"], "0$1"]], "0", 0, 0, 0, 0, 0, [["[2-4679][2-8]\\d{6}", [8]], ["5[024-68]\\d{7}", [9]], ["400\\d{6}|800\\d{2,9}"], ["900[02]\\d{5}", [9]], 0, 0, ["600[25]\\d{5}", [9]], 0, 0, ["700[05]\\d{5}", [9]]]], "AF": ["93", "00", "[2-7]\\d{8}", [9], [["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[2-7]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:[25][0-8]|[34][0-4]|6[0-5])[2-9]\\d{6}"], ["7\\d{8}"]]], "AG": ["1", "011", "(?:268|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "1|([457]\\d{6})$", "268$1", 0, "268", [["268(?:4(?:6[0-38]|84)|56[0-2])\\d{4}"], ["268(?:464|7(?:1[3-9]|[28]\\d|3[0246]|64|7[0-689]))\\d{4}"], ["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"], ["900[2-9]\\d{6}"], ["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"], 0, 0, ["26840[69]\\d{4}"], ["26848[01]\\d{4}"]]], "AI": ["1", "011", "(?:264|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "1|([2457]\\d{6})$", "264$1", 0, "264", [["264(?:292|4(?:6[12]|9[78]))\\d{4}"], ["264(?:235|4(?:69|76)|5(?:3[6-9]|8[1-4])|7(?:29|72))\\d{4}"], ["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"], ["900[2-9]\\d{6}"], ["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"], 0, 0, ["264724\\d{4}"]]], "AL": ["355", "00", "(?:700\\d\\d|900)\\d{3}|8\\d{5,7}|(?:[2-5]|6\\d)\\d{7}", [6, 7, 8, 9], [["(\\d{3})(\\d{3,4})", "$1 $2", ["80|9"], "0$1"], ["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["4[2-6]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[2358][2-5]|4"], "0$1"], ["(\\d{3})(\\d{5})", "$1 $2", ["[23578]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["6"], "0$1"]], "0", 0, 0, 0, 0, 0, [["4505[0-2]\\d{3}|(?:[2358][16-9]\\d[2-9]|4410)\\d{4}|(?:[2358][2-5][2-9]|4(?:[2-57-9][2-9]|6\\d))\\d{5}", [8]], ["6(?:[78][2-9]|9\\d)\\d{6}", [9]], ["800\\d{4}", [7]], ["900[1-9]\\d\\d", [6]], ["700[2-9]\\d{4}", [8]], 0, 0, 0, 0, ["808[1-9]\\d\\d", [6]]]], "AM": ["374", "00", "(?:[1-489]\\d|55|60|77)\\d{6}", [8], [["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["[89]0"], "0 $1"], ["(\\d{3})(\\d{5})", "$1 $2", ["2|3[12]"], "(0$1)"], ["(\\d{2})(\\d{6})", "$1 $2", ["1|47"], "(0$1)"], ["(\\d{2})(\\d{6})", "$1 $2", ["[3-9]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:(?:1[0-25]|47)\\d|2(?:2[2-46]|3[1-8]|4[2-69]|5[2-7]|6[1-9]|8[1-7])|3[12]2)\\d{5}"], ["(?:33|4[1349]|55|77|88|9[13-9])\\d{6}"], ["800\\d{5}"], ["90[016]\\d{5}"], 0, 0, 0, 0, ["60(?:2[78]|3[5-9]|4[02-9]|5[0-46-9]|[6-8]\\d|9[01])\\d{4}"], ["80[1-4]\\d{5}"]]], "AO": ["244", "00", "[29]\\d{8}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[29]"]]], 0, 0, 0, 0, 0, 0, [["2\\d(?:[0134][25-9]|[25-9]\\d)\\d{5}"], ["9[1-59]\\d{7}"]]], "AR": ["54", "00", "(?:11|[89]\\d\\d)\\d{8}|[2368]\\d{9}", [10, 11], [["(\\d{4})(\\d{2})(\\d{4})", "$1 $2-$3", ["2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9])", "2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8]))|2(?:2[24-9]|3[1-59]|47)", "2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5[56][46]|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]", "2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|58|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|54(?:4|5[13-7]|6[89])|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:454|85[56])[46]|3(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"], "0$1", 1], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2-$3", ["1"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{4})", "$1-$2-$3", ["[68]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2-$3", ["[23]"], "0$1", 1], ["(\\d)(\\d{4})(\\d{2})(\\d{4})", "$2 15-$3-$4", ["9(?:2[2-469]|3[3-578])", "9(?:2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9]))", "9(?:2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8])))|92(?:2[24-9]|3[1-59]|47)", "9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5(?:[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]", "9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|5(?:4(?:4|5[13-7]|6[89])|[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"], "0$1", 0, "$1 $2 $3-$4"], ["(\\d)(\\d{2})(\\d{4})(\\d{4})", "$2 15-$3-$4", ["91"], "0$1", 0, "$1 $2 $3-$4"], ["(\\d{3})(\\d{3})(\\d{5})", "$1-$2-$3", ["8"], "0$1"], ["(\\d)(\\d{3})(\\d{3})(\\d{4})", "$2 15-$3-$4", ["9"], "0$1", 0, "$1 $2 $3-$4"]], "0", 0, "0?(?:(11|2(?:2(?:02?|[13]|2[13-79]|4[1-6]|5[2457]|6[124-8]|7[1-4]|8[13-6]|9[1267])|3(?:02?|1[467]|2[03-6]|3[13-8]|[49][2-6]|5[2-8]|[67])|4(?:7[3-578]|9)|6(?:[0136]|2[24-6]|4[6-8]?|5[15-8])|80|9(?:0[1-3]|[19]|2\\d|3[1-6]|4[02568]?|5[2-4]|6[2-46]|72?|8[23]?))|3(?:3(?:2[79]|6|8[2578])|4(?:0[0-24-9]|[12]|3[5-8]?|4[24-7]|5[4-68]?|6[02-9]|7[126]|8[2379]?|9[1-36-8])|5(?:1|2[1245]|3[237]?|4[1-46-9]|6[2-4]|7[1-6]|8[2-5]?)|6[24]|7(?:[069]|1[1568]|2[15]|3[145]|4[13]|5[14-8]|7[2-57]|8[126])|8(?:[01]|2[15-7]|3[2578]?|4[13-6]|5[4-8]?|6[1-357-9]|7[36-8]?|8[5-8]?|9[124])))15)?", "9$1", 0, 0, [["3888[013-9]\\d{5}|3(?:7(?:1[15]|81)|8(?:21|4[16]|69|9[12]))[46]\\d{5}|(?:29(?:54|66)|3(?:7(?:55|77)|865))[2-8]\\d{5}|(?:2(?:2(?:2[59]|44|52)|3(?:26|44)|473|9(?:[07]2|2[26]|34|46))|3327)[45]\\d{5}|(?:2(?:284|3(?:02|23)|657|920)|3(?:4(?:8[27]|92)|541|878))[2-7]\\d{5}|(?:2(?:(?:26|62)2|320|477|9(?:42|83))|3(?:329|4(?:[47]6|62|89)|564))[2-6]\\d{5}|(?:(?:11[1-8]|670)\\d|2(?:2(?:0[45]|1[2-6]|3[3-6])|3(?:[06]4|7[45])|494|6(?:04|1[2-8]|[36][45]|4[3-6])|80[45]|9(?:[17][4-6]|[48][45]|9[3-6]))|3(?:364|4(?:1[2-7]|[235][4-6]|84)|5(?:1[2-9]|[38][4-6])|6(?:2[45]|44)|7[069][45]|8(?:0[45]|[17][2-6]|3[4-6]|[58][3-6])))\\d{6}|2(?:2(?:21|4[23]|6[145]|7[1-4]|8[356]|9[267])|3(?:16|3[13-8]|43|5[346-8]|9[3-5])|475|6(?:2[46]|4[78]|5[1568])|9(?:03|2[1457-9]|3[1356]|4[08]|[56][23]|82))4\\d{5}|(?:2(?:2(?:57|81)|3(?:24|46|92)|9(?:01|23|64))|3(?:4(?:42|71)|5(?:25|37|4[347]|71)|7(?:18|5[17])))[3-6]\\d{5}|(?:2(?:2(?:02|2[3467]|4[156]|5[45]|6[6-8]|91)|3(?:1[47]|25|[45][25]|96)|47[48]|625|932)|3(?:38[2578]|4(?:0[0-24-9]|3[78]|4[457]|58|6[03-9]|72|83|9[136-8])|5(?:2[124]|[368][23]|4[2689]|7[2-6])|7(?:16|2[15]|3[145]|4[13]|5[468]|7[2-5]|8[26])|8(?:2[5-7]|3[278]|4[3-5]|5[78]|6[1-378]|[78]7|94)))[4-6]\\d{5}", [10]], ["93(?:7(?:1[15]|81)[46]|8(?:(?:21|4[16]|69|9[12])[46]|88[013-9]))\\d{5}|9(?:29(?:54|66)|3(?:7(?:55|77)|865))[2-8]\\d{5}|9(?:2(?:2(?:2[59]|44|52)|3(?:26|44)|473|9(?:[07]2|2[26]|34|46))|3327)[45]\\d{5}|9(?:2(?:284|3(?:02|23)|657|920)|3(?:4(?:8[27]|92)|541|878))[2-7]\\d{5}|9(?:2(?:(?:26|62)2|320|477|9(?:42|83))|3(?:329|4(?:[47]6|62|89)|564))[2-6]\\d{5}|(?:675\\d|9(?:11[1-8]\\d|2(?:2(?:0[45]|1[2-6]|3[3-6])|3(?:[06]4|7[45])|494|6(?:04|1[2-8]|[36][45]|4[3-6])|80[45]|9(?:[17][4-6]|[48][45]|9[3-6]))|3(?:364|4(?:1[2-7]|[235][4-6]|84)|5(?:1[2-9]|[38][4-6])|6(?:2[45]|44)|7[069][45]|8(?:0[45]|[17][2-6]|3[4-6]|[58][3-6]))))\\d{6}|92(?:2(?:21|4[23]|6[145]|7[1-4]|8[356]|9[267])|3(?:16|3[13-8]|43|5[346-8]|9[3-5])|475|6(?:2[46]|4[78]|5[1568])|9(?:03|2[1457-9]|3[1356]|4[08]|[56][23]|82))4\\d{5}|9(?:2(?:2(?:57|81)|3(?:24|46|92)|9(?:01|23|64))|3(?:4(?:42|71)|5(?:25|37|4[347]|71)|7(?:18|5[17])))[3-6]\\d{5}|9(?:2(?:2(?:02|2[3467]|4[156]|5[45]|6[6-8]|91)|3(?:1[47]|25|[45][25]|96)|47[48]|625|932)|3(?:38[2578]|4(?:0[0-24-9]|3[78]|4[457]|58|6[03-9]|72|83|9[136-8])|5(?:2[124]|[368][23]|4[2689]|7[2-6])|7(?:16|2[15]|3[145]|4[13]|5[468]|7[2-5]|8[26])|8(?:2[5-7]|3[278]|4[3-5]|5[78]|6[1-378]|[78]7|94)))[4-6]\\d{5}"], ["800\\d{7,8}"], ["60[04579]\\d{7}", [10]], 0, 0, ["810\\d{7}", [10]]]], "AS": ["1", "011", "(?:[58]\\d\\d|684|900)\\d{7}", [10], 0, "1", 0, "1|([267]\\d{6})$", "684$1", 0, "684", [["6846(?:22|33|44|55|77|88|9[19])\\d{4}"], ["684(?:2(?:48|5[2468]|72)|7(?:3[13]|70|82))\\d{4}"], ["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"], ["900[2-9]\\d{6}"], ["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"]]], "AT": ["43", "00", "1\\d{3,12}|2\\d{6,12}|43(?:(?:0\\d|5[02-9])\\d{3,9}|2\\d{4,5}|[3467]\\d{4}|8\\d{4,6}|9\\d{4,7})|5\\d{4,12}|8\\d{7,12}|9\\d{8,12}|(?:[367]\\d|4[0-24-9])\\d{4,11}", [4, 5, 6, 7, 8, 9, 10, 11, 12, 13], [["(\\d)(\\d{3,12})", "$1 $2", ["1(?:11|[2-9])"], "0$1"], ["(\\d{3})(\\d{2})", "$1 $2", ["517"], "0$1"], ["(\\d{2})(\\d{3,5})", "$1 $2", ["5[079]"], "0$1"], ["(\\d{3})(\\d{3,10})", "$1 $2", ["(?:31|4)6|51|6(?:5[0-3579]|[6-9])|7(?:20|32|8)|[89]"], "0$1"], ["(\\d{4})(\\d{3,9})", "$1 $2", ["[2-467]|5[2-6]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["5"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4,7})", "$1 $2 $3", ["5"], "0$1"]], "0", 0, 0, 0, 0, 0, [["1(?:11\\d|[2-9]\\d{3,11})|(?:316|463|(?:51|66|73)2)\\d{3,10}|(?:2(?:1[467]|2[13-8]|5[2357]|6[1-46-8]|7[1-8]|8[124-7]|9[1458])|3(?:1[1-578]|3[23568]|4[5-7]|5[1378]|6[1-38]|8[3-68])|4(?:2[1-8]|35|7[1368]|8[2457])|5(?:2[1-8]|3[357]|4[147]|5[12578]|6[37])|6(?:13|2[1-47]|4[135-8]|5[468])|7(?:2[1-8]|35|4[13478]|5[68]|6[16-8]|7[1-6]|9[45]))\\d{4,10}"], ["6(?:5[0-3579]|6[013-9]|[7-9]\\d)\\d{4,10}", [7, 8, 9, 10, 11, 12, 13]], ["800\\d{6,10}", [9, 10, 11, 12, 13]], ["(?:8[69][2-68]|9(?:0[01]|3[019]))\\d{6,10}", [9, 10, 11, 12, 13]], 0, 0, 0, 0, ["5(?:0[1-9]|17|[79]\\d)\\d{2,10}|7[28]0\\d{6,10}", [5, 6, 7, 8, 9, 10, 11, 12, 13]], ["8(?:10|2[018])\\d{6,10}|828\\d{5}", [8, 9, 10, 11, 12, 13]]]], "AU": ["61", "001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011", "1(?:[0-79]\\d{7}(?:\\d(?:\\d{2})?)?|8[0-24-9]\\d{7})|[2-478]\\d{8}|1\\d{4,7}", [5, 6, 7, 8, 9, 10, 12], [["(\\d{2})(\\d{3,4})", "$1 $2", ["16"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2,4})", "$1 $2 $3", ["16"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["14|4"], "0$1"], ["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["[2378]"], "(0$1)"], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["1(?:30|[89])"]]], "0", 0, "0|(183[12])", 0, 0, 0, [["(?:(?:2(?:[0-26-9]\\d|3[0-8]|4[02-9]|5[0135-9])|3(?:[0-3589]\\d|4[0-578]|6[1-9]|7[0-35-9])|7(?:[013-57-9]\\d|2[0-8]))\\d{3}|8(?:51(?:0(?:0[03-9]|[12479]\\d|3[2-9]|5[0-8]|6[1-9]|8[0-7])|1(?:[0235689]\\d|1[0-69]|4[0-589]|7[0-47-9])|2(?:0[0-79]|[18][13579]|2[14-9]|3[0-46-9]|[4-6]\\d|7[89]|9[0-4]))|(?:6[0-8]|[78]\\d)\\d{3}|9(?:[02-9]\\d{3}|1(?:(?:[0-58]\\d|6[0135-9])\\d|7(?:0[0-24-9]|[1-9]\\d)|9(?:[0-46-9]\\d|5[0-79])))))\\d{3}", [9]], ["4(?:83[0-38]|93[0-6])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[016-9]|7[02-9]|8[0-24-9]|9[0-27-9])\\d{6}", [9]], ["180(?:0\\d{3}|2)\\d{3}", [7, 10]], ["190[0-26]\\d{6}", [10]], 0, 0, 0, ["163\\d{2,6}", [5, 6, 7, 8, 9]], ["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}", [9]], ["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}", [6, 8, 10, 12]]], "0011"], "AW": ["297", "00", "(?:[25-79]\\d\\d|800)\\d{4}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[25-9]"]]], 0, 0, 0, 0, 0, 0, [["5(?:2\\d|8[1-9])\\d{4}"], ["(?:290|5[69]\\d|6(?:[03]0|22|4[0-2]|[69]\\d)|7(?:[34]\\d|7[07])|9(?:6[45]|9[4-8]))\\d{4}"], ["800\\d{4}"], ["900\\d{4}"], 0, 0, 0, 0, ["(?:28\\d|501)\\d{4}"]]], "AX": ["358", "00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))", "2\\d{4,9}|35\\d{4,5}|(?:60\\d\\d|800)\\d{4,6}|7\\d{5,11}|(?:[14]\\d|3[0-46-9]|50)\\d{4,8}", [5, 6, 7, 8, 9, 10, 11, 12], 0, "0", 0, 0, 0, 0, "18", [["18[1-8]\\d{3,6}", [6, 7, 8, 9]], ["4946\\d{2,6}|(?:4[0-8]|50)\\d{4,8}", [6, 7, 8, 9, 10]], ["800\\d{4,6}", [7, 8, 9]], ["[67]00\\d{5,6}", [8, 9]], 0, 0, ["20\\d{4,8}|60[12]\\d{5,6}|7(?:099\\d{4,5}|5[03-9]\\d{3,7})|20[2-59]\\d\\d|(?:606|7(?:0[78]|1|3\\d))\\d{7}|(?:10|29|3[09]|70[1-5]\\d)\\d{4,8}"]], "00"], "AZ": ["994", "00", "365\\d{6}|(?:[124579]\\d|60|88)\\d{7}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["90"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["1[28]|2|365|46", "1[28]|2|365[45]|46", "1[28]|2|365(?:4|5[02])|46"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[13-9]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:2[12]428|3655[02])\\d{4}|(?:2(?:22[0-79]|63[0-28])|3654)\\d{5}|(?:(?:1[28]|46)\\d|2(?:[014-6]2|[23]3))\\d{6}"], ["36554\\d{4}|(?:[16]0|4[04]|5[015]|7[07]|99)\\d{7}"], ["88\\d{7}"], ["900200\\d{3}"]]], "BA": ["387", "00", "6\\d{8}|(?:[35689]\\d|49|70)\\d{6}", [8, 9], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["6[1-3]|[7-9]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2-$3", ["[3-5]|6[56]"], "0$1"], ["(\\d{2})(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3 $4", ["6"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:3(?:[05-79][2-9]|1[4579]|[23][24-9]|4[2-4689]|8[2457-9])|49[2-579]|5(?:0[2-49]|[13][2-9]|[268][2-4679]|4[4689]|5[2-79]|7[2-69]|9[2-4689]))\\d{5}", [8]], ["6040\\d{5}|6(?:03|[1-356]|44|7\\d)\\d{6}"], ["8[08]\\d{6}", [8]], ["9[0246]\\d{6}", [8]], 0, 0, ["703[235]0\\d{3}|70(?:2[0-5]|3[0146]|[56]0)\\d{4}", [8]], 0, 0, ["8[12]\\d{6}", [8]]]], "BB": ["1", "011", "(?:246|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "1|([2-9]\\d{6})$", "246$1", 0, "246", [["246521[0369]\\d{3}|246(?:2(?:2[78]|7[0-4])|4(?:1[024-6]|2\\d|3[2-9])|5(?:20|[34]\\d|54|7[1-3])|6(?:2\\d|38)|7[35]7|9(?:1[89]|63))\\d{4}"], ["246(?:(?:2(?:[3568]\\d|4[0-57-9])|3(?:5[2-9]|6[0-6])|4(?:46|5\\d)|69[5-7]|8(?:[2-5]\\d|83))\\d|52(?:1[147]|20))\\d{3}"], ["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"], ["(?:246976|900[2-9]\\d\\d)\\d{4}"], ["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"], 0, ["246(?:292|367|4(?:1[7-9]|3[01]|4[47-9]|67)|7(?:1[2-9]|2\\d|3[016]|53))\\d{4}"], 0, ["24631\\d{5}"]]], "BD": ["880", "00", "[1-469]\\d{9}|8[0-79]\\d{7,8}|[2-79]\\d{8}|[2-9]\\d{7}|[3-9]\\d{6}|[57-9]\\d{5}", [6, 7, 8, 9, 10], [["(\\d{2})(\\d{4,6})", "$1-$2", ["31[5-8]|[459]1"], "0$1"], ["(\\d{3})(\\d{3,7})", "$1-$2", ["3(?:[67]|8[013-9])|4(?:6[168]|7|[89][18])|5(?:6[128]|9)|6(?:28|4[14]|5)|7[2-589]|8(?:0[014-9]|[12])|9[358]|(?:3[2-5]|4[235]|5[2-578]|6[0389]|76|8[3-7]|9[24])1|(?:44|66)[01346-9]"], "0$1"], ["(\\d{4})(\\d{3,6})", "$1-$2", ["[13-9]|22"], "0$1"], ["(\\d)(\\d{7,8})", "$1-$2", ["2"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:4(?:31\\d\\d|423)|5222)\\d{3}(?:\\d{2})?|8332[6-9]\\d\\d|(?:3(?:03[56]|224)|4(?:22[25]|653))\\d{3,4}|(?:3(?:42[47]|529|823)|4(?:027|525|65(?:28|8))|562|6257|7(?:1(?:5[3-5]|6[12]|7[156]|89)|22[589]56|32|42675|52(?:[25689](?:56|8)|[347]8)|71(?:6[1267]|75|89)|92374)|82(?:2[59]|32)56|9(?:03[23]56|23(?:256|373)|31|5(?:1|2[4589]56)))\\d{3}|(?:3(?:02[348]|22[35]|324|422)|4(?:22[67]|32[236-9]|6(?:2[46]|5[57])|953)|5526|6(?:024|6655)|81)\\d{4,5}|(?:2(?:7(?:1[0-267]|2[0-289]|3[0-29]|4[01]|5[1-3]|6[013]|7[0178]|91)|8(?:0[125]|1[1-6]|2[0157-9]|3[1-69]|41|6[1-35]|7[1-5]|8[1-8]|9[0-6])|9(?:0[0-2]|1[0-4]|2[568]|3[3-6]|5[5-7]|6[0136-9]|7[0-7]|8[014-9]))|3(?:0(?:2[025-79]|3[2-4])|181|22[12]|32[2356]|824)|4(?:02[09]|22[348]|32[045]|523|6(?:27|54))|666(?:22|53)|7(?:22[57-9]|42[56]|82[35])8|8(?:0[124-9]|2(?:181|2[02-4679]8)|4[12]|[5-7]2)|9(?:[04]2|2(?:2|328)|81))\\d{4}|(?:2(?:222|[45]\\d)\\d|3(?:1(?:2[5-7]|[5-7])|425|822)|4(?:033|1\\d|[257]1|332|4(?:2[246]|5[25])|6(?:2[35]|56|62)|8(?:23|54)|92[2-5])|5(?:02[03489]|22[457]|32[35-79]|42[46]|6(?:[18]|53)|724|826)|6(?:023|2(?:2[2-5]|5[3-5]|8)|32[3478]|42[34]|52[47]|6(?:[18]|6(?:2[34]|5[24]))|[78]2[2-5]|92[2-6])|7(?:02|21\\d|[3-589]1|6[12]|72[24])|8(?:217|3[12]|[5-7]1)|9[24]1)\\d{5}|(?:(?:3[2-8]|5[2-57-9]|6[03-589])1|4[4689][18])\\d{5}|[59]1\\d{5}"], ["(?:1[13-9]\\d|644)\\d{7}|(?:3[78]|44|66)[02-9]\\d{7}", [10]], ["80[03]\\d{7}", [10]], 0, 0, 0, 0, 0, ["96(?:0[469]|1[0-47]|3[389]|6[69]|7[78])\\d{6}", [10]]]], "BE": ["32", "00", "4\\d{8}|[1-9]\\d{7}", [8, 9], [["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["(?:80|9)0"], "0$1"], ["(\\d)(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[239]|4[23]"], "0$1"], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[15-8]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["4"], "0$1"]], "0", 0, 0, 0, 0, 0, [["80[2-8]\\d{5}|(?:1[0-69]|[23][2-8]|4[23]|5\\d|6[013-57-9]|71|8[1-79]|9[2-4])\\d{6}", [8]], ["4[5-9]\\d{7}", [9]], ["800[1-9]\\d{4}", [8]], ["(?:70(?:2[0-57]|3[04-7]|44|6[569]|7[0579])|90(?:0[0-8]|1[36]|2[0-3568]|3[0-689]|[47][2-68]|5[1-68]|6[0-378]|9[34679]))\\d{4}", [8]], 0, 0, ["78(?:0[57]|1[014-8]|2[25]|3[15-8]|48|[56]0|7[06-8]|9\\d)\\d{4}", [8]], 0, 0, ["7879\\d{4}", [8]]]], "BF": ["226", "00", "[025-7]\\d{7}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[025-7]"]]], 0, 0, 0, 0, 0, 0, [["2(?:0(?:49|5[23]|6[5-7]|9[016-9])|4(?:4[569]|5[4-6]|6[5-7]|7[0179])|5(?:[34]\\d|50|6[5-7]))\\d{4}"], ["(?:0[1-35-7]|5[1-8]|[67]\\d)\\d{6}"]]], "BG": ["359", "00", "[2-7]\\d{6,7}|[89]\\d{6,8}|2\\d{5}", [6, 7, 8, 9], [["(\\d)(\\d)(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["2"], "0$1"], ["(\\d{3})(\\d{4})", "$1 $2", ["43[1-6]|70[1-9]"], "0$1"], ["(\\d)(\\d{3})(\\d{3,4})", "$1 $2 $3", ["2"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2,3})", "$1 $2 $3", ["[356]|4[124-7]|7[1-9]|8[1-6]|9[1-7]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["(?:70|8)0"], "0$1"], ["(\\d{3})(\\d{3})(\\d{2})", "$1 $2 $3", ["43[1-7]|7"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[48]|9[08]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["9"], "0$1"]], "0", 0, 0, 0, 0, 0, [["2\\d{5,7}|(?:43[1-6]|70[1-9])\\d{4,5}|(?:[36]\\d|4[124-7]|[57][1-9]|8[1-6]|9[1-7])\\d{5,6}", [6, 7, 8]], ["(?:43[07-9]|99[69]\\d)\\d{5}|(?:8[7-9]|98)\\d{7}", [8, 9]], ["800\\d{5}", [8]], ["90\\d{6}", [8]], 0, 0, 0, 0, 0, ["700\\d{5}", [8]]]], "BH": ["973", "00", "[136-9]\\d{7}", [8], [["(\\d{4})(\\d{4})", "$1 $2", ["[13679]|8[047]"]]], 0, 0, 0, 0, 0, 0, [["(?:1(?:3[1356]|6[0156]|7\\d)\\d|6(?:1[16]\\d|500|6(?:0\\d|3[12]|44|7[7-9]|88)|9[69][69])|7(?:1(?:11|78)|7\\d\\d))\\d{4}"], ["(?:3(?:[1-79]\\d|8[0-47-9])\\d|6(?:3(?:00|33|6[16])|6(?:3[03-9]|[69]\\d|7[0-6])))\\d{4}"], ["80\\d{6}"], ["(?:87|9[014578])\\d{6}"], 0, 0, 0, 0, 0, ["84\\d{6}"]]], "BI": ["257", "00", "(?:[267]\\d|31)\\d{6}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[2367]"]]], 0, 0, 0, 0, 0, 0, [["(?:22|31)\\d{6}"], ["(?:29|6[1257-9]|7[125-9])\\d{6}"]]], "BJ": ["229", "00", "(?:[25689]\\d|40)\\d{6}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[24-689]"]]], 0, 0, 0, 0, 0, 0, [["2(?:02|1[037]|2[45]|3[68]|4\\d)\\d{5}"], ["(?:40|5[1-9]|6\\d|9[013-9])\\d{6}"], 0, 0, 0, 0, ["81\\d{6}"], 0, ["857[58]\\d{4}"]]], "BL": ["590", "00", "(?:590|(?:69|80)\\d|976)\\d{6}", [9], 0, "0", 0, 0, 0, 0, 0, [["590(?:2[7-9]|5[12]|87)\\d{4}"], ["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"], ["80[0-5]\\d{6}"], 0, 0, 0, 0, 0, ["976[01]\\d{5}"]]], "BM": ["1", "011", "(?:441|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "1|([2-8]\\d{6})$", "441$1", 0, "441", [["441(?:[46]\\d\\d|5(?:4\\d|60|89))\\d{4}"], ["441(?:[2378]\\d|5[0-39])\\d{5}"], ["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"], ["900[2-9]\\d{6}"], ["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"]]], "BN": ["673", "00", "[2-578]\\d{6}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[2-578]"]]], 0, 0, 0, 0, 0, 0, [["22[0-7]\\d{4}|(?:2[013-9]|[34]\\d|5[0-25-9])\\d{5}"], ["(?:22[89]|[78]\\d\\d)\\d{4}"], 0, 0, 0, 0, 0, 0, ["5[34]\\d{5}"]]], "BO": ["591", "00(?:1\\d)?", "(?:[2-467]\\d\\d|8001)\\d{5}", [8, 9], [["(\\d)(\\d{7})", "$1 $2", ["[23]|4[46]"]], ["(\\d{8})", "$1", ["[67]"]], ["(\\d{3})(\\d{2})(\\d{4})", "$1 $2 $3", ["8"]]], "0", 0, "0(1\\d)?", 0, 0, 0, [["(?:2(?:2\\d\\d|5(?:11|[258]\\d|9[67])|6(?:12|2\\d|9[34])|8(?:2[34]|39|62))|3(?:3\\d\\d|4(?:6\\d|8[24])|8(?:25|42|5[257]|86|9[25])|9(?:[27]\\d|3[2-4]|4[248]|5[24]|6[2-6]))|4(?:4\\d\\d|6(?:11|[24689]\\d|72)))\\d{4}", [8]], ["[67]\\d{7}", [8]], ["8001[07]\\d{4}", [9]]]], "BQ": ["599", "00", "(?:[34]1|7\\d)\\d{5}", [7], 0, 0, 0, 0, 0, 0, "[347]", [["(?:318[023]|41(?:6[023]|70)|7(?:1[578]|2[05]|50)\\d)\\d{3}"], ["(?:31(?:8[14-8]|9[14578])|416[14-9]|7(?:0[01]|7[07]|8\\d|9[056])\\d)\\d{3}"]]], "BR": ["55", "00(?:1[245]|2[1-35]|31|4[13]|[56]5|99)", "(?:[1-46-9]\\d\\d|5(?:[0-46-9]\\d|5[0-46-9]))\\d{8}|[1-9]\\d{9}|[3589]\\d{8}|[34]\\d{7}", [8, 9, 10, 11], [["(\\d{4})(\\d{4})", "$1-$2", ["300|4(?:0[02]|37)", "4(?:02|37)0|[34]00"]], ["(\\d{3})(\\d{2,3})(\\d{4})", "$1 $2 $3", ["(?:[358]|90)0"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2-$3", ["(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-57]"], "($1)"], ["(\\d{2})(\\d{5})(\\d{4})", "$1 $2-$3", ["[16][1-9]|[2-57-9]"], "($1)"]], "0", 0, "(?:0|90)(?:(1[245]|2[1-35]|31|4[13]|[56]5|99)(\\d{10,11}))?", "$2", 0, 0, [["(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-5]\\d{7}", [10]], ["(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])(?:7|9\\d)\\d{7}", [10, 11]], ["800\\d{6,7}", [9, 10]], ["300\\d{6}|[59]00\\d{6,7}", [9, 10]], 0, 0, 0, 0, 0, ["(?:30[03]\\d{3}|4(?:0(?:0\\d|20)|370))\\d{4}|300\\d{5}", [8, 10]]]], "BS": ["1", "011", "(?:242|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "1|([3-8]\\d{6})$", "242$1", 0, "242", [["242(?:3(?:02|[236][1-9]|4[0-24-9]|5[0-68]|7[347]|8[0-4]|9[2-467])|461|502|6(?:0[1-4]|12|2[013]|[45]0|7[67]|8[78]|9[89])|7(?:02|88))\\d{4}"], ["242(?:3(?:5[79]|7[56]|95)|4(?:[23][1-9]|4[1-35-9]|5[1-8]|6[2-8]|7\\d|81)|5(?:2[45]|3[35]|44|5[1-46-9]|65|77)|6[34]6|7(?:27|38)|8(?:0[1-9]|1[02-9]|2\\d|[89]9))\\d{4}"], ["242300\\d{4}|8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"], ["900[2-9]\\d{6}"], ["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"], 0, ["242225\\d{4}"]]], "BT": ["975", "00", "[17]\\d{7}|[2-8]\\d{6}", [7, 8], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["[2-68]|7[246]"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["1[67]|7"]]], 0, 0, 0, 0, 0, 0, [["(?:2[3-6]|[34][5-7]|5[236]|6[2-46]|7[246]|8[2-4])\\d{5}", [7]], ["(?:1[67]|77)\\d{6}", [8]]]], "BW": ["267", "00", "(?:0800|(?:[37]|800)\\d)\\d{6}|(?:[2-6]\\d|90)\\d{5}", [7, 8, 10], [["(\\d{2})(\\d{5})", "$1 $2", ["90"]], ["(\\d{3})(\\d{4})", "$1 $2", ["[24-6]|3[15-79]"]], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[37]"]], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["0"]], ["(\\d{3})(\\d{4})(\\d{3})", "$1 $2 $3", ["8"]]], 0, 0, 0, 0, 0, 0, [["(?:2(?:4[0-48]|6[0-24]|9[0578])|3(?:1[0-35-9]|55|[69]\\d|7[013])|4(?:6[03]|7[1267]|9[0-5])|5(?:3[03489]|4[0489]|7[1-47]|88|9[0-49])|6(?:2[1-35]|5[149]|8[067]))\\d{4}", [7]], ["(?:321|7(?:[1-7]\\d|8[01]))\\d{5}", [8]], ["(?:0800|800\\d)\\d{6}", [10]], ["90\\d{5}", [7]], 0, 0, 0, 0, ["79(?:1(?:[01]\\d|2[0-7])|2[0-7]\\d)\\d{3}", [8]]]], "BY": ["375", "810", "(?:[12]\\d|33|44|902)\\d{7}|8(?:0[0-79]\\d{5,7}|[1-7]\\d{9})|8(?:1[0-489]|[5-79]\\d)\\d{7}|8[1-79]\\d{6,7}|8[0-79]\\d{5}|8\\d{5}", [6, 7, 8, 9, 10, 11], [["(\\d{3})(\\d{3})", "$1 $2", ["800"], "8 $1"], ["(\\d{3})(\\d{2})(\\d{2,4})", "$1 $2 $3", ["800"], "8 $1"], ["(\\d{4})(\\d{2})(\\d{3})", "$1 $2-$3", ["1(?:5[169]|6[3-5]|7[179])|2(?:1[35]|2[34]|3[3-5])", "1(?:5[169]|6(?:3[1-3]|4|5[125])|7(?:1[3-9]|7[0-24-6]|9[2-7]))|2(?:1[35]|2[34]|3[3-5])"], "8 0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2-$3-$4", ["1(?:[56]|7[467])|2[1-3]"], "8 0$1"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2-$3-$4", ["[1-4]"], "8 0$1"], ["(\\d{3})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["[89]"], "8 $1"]], "8", 0, "0|80?", 0, 0, 0, [["(?:1(?:5(?:1[1-5]|[24]\\d|6[2-4]|9[1-7])|6(?:[235]\\d|4[1-7])|7\\d\\d)|2(?:1(?:[246]\\d|3[0-35-9]|5[1-9])|2(?:[235]\\d|4[0-8])|3(?:[26]\\d|3[02-79]|4[024-7]|5[03-7])))\\d{5}", [9]], ["(?:2(?:5[5-79]|9[1-9])|(?:33|44)\\d)\\d{6}", [9]], ["800\\d{3,7}|8(?:0[13]|20\\d)\\d{7}"], ["(?:810|902)\\d{7}", [10]], 0, 0, 0, 0, ["249\\d{6}", [9]]], "8~10"], "BZ": ["501", "00", "(?:0800\\d|[2-8])\\d{6}", [7, 11], [["(\\d{3})(\\d{4})", "$1-$2", ["[2-8]"]], ["(\\d)(\\d{3})(\\d{4})(\\d{3})", "$1-$2-$3-$4", ["0"]]], 0, 0, 0, 0, 0, 0, [["(?:2(?:[02]\\d|36|[68]0)|[3-58](?:[02]\\d|[68]0)|7(?:[02]\\d|32|[68]0))\\d{4}", [7]], ["6[0-35-7]\\d{5}", [7]], ["0800\\d{7}", [11]]]], "CA": ["1", "011", "(?:[2-8]\\d|90)\\d{8}|3\\d{6}", [7, 10], 0, "1", 0, 0, 0, 0, 0, [["(?:2(?:04|[23]6|[48]9|50|63)|3(?:06|43|6[578])|4(?:03|1[68]|3[178]|50|68|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|13|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|73)|90[25])[2-9]\\d{6}", [10]], ["", [10]], ["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}", [10]], ["900[2-9]\\d{6}", [10]], ["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|(?:5(?:00|2[125-7]|33|44|66|77|88)|622)[2-9]\\d{6}", [10]], 0, ["310\\d{4}", [7]], 0, ["600[2-9]\\d{6}", [10]]]], "CC": ["61", "001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011", "1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}", [6, 7, 8, 9, 10, 12], 0, "0", 0, "0|([59]\\d{7})$", "8$1", 0, 0, [["8(?:51(?:0(?:02|31|60|89)|1(?:18|76)|223)|91(?:0(?:1[0-2]|29)|1(?:[28]2|50|79)|2(?:10|64)|3(?:[06]8|22)|4[29]8|62\\d|70[23]|959))\\d{3}", [9]], ["4(?:83[0-38]|93[0-6])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[016-9]|7[02-9]|8[0-24-9]|9[0-27-9])\\d{6}", [9]], ["180(?:0\\d{3}|2)\\d{3}", [7, 10]], ["190[0-26]\\d{6}", [10]], 0, 0, 0, 0, ["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}", [9]], ["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}", [6, 8, 10, 12]]], "0011"], "CD": ["243", "00", "[189]\\d{8}|[1-68]\\d{6}", [7, 9], [["(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3", ["88"], "0$1"], ["(\\d{2})(\\d{5})", "$1 $2", ["[1-6]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[89]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["12\\d{7}|[1-6]\\d{6}"], ["88\\d{5}|(?:8[0-59]|9[017-9])\\d{7}"]]], "CF": ["236", "00", "(?:[27]\\d{3}|8776)\\d{4}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[278]"]]], 0, 0, 0, 0, 0, 0, [["2[12]\\d{6}"], ["7[02457]\\d{6}"], 0, ["8776\\d{4}"]]], "CG": ["242", "00", "222\\d{6}|(?:0\\d|80)\\d{7}", [9], [["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["8"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[02]"]]], 0, 0, 0, 0, 0, 0, [["222[1-589]\\d{5}"], ["026(?:1[0-5]|6[6-9])\\d{4}|0(?:[14-6]\\d\\d|2(?:40|5[5-8]|6[07-9]))\\d{5}"], 0, ["80(?:0\\d\\d|120)\\d{4}"]]], "CH": ["41", "00", "8\\d{11}|[2-9]\\d{8}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["8[047]|90"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[2-79]|81"], "0$1"], ["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4 $5", ["8"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:2[12467]|3[1-4]|4[134]|5[256]|6[12]|[7-9]1)\\d{7}"], ["7[35-9]\\d{7}"], ["800\\d{6}"], ["90[016]\\d{6}"], ["878\\d{6}"], 0, ["5[18]\\d{7}"], ["74[0248]\\d{6}"], 0, ["84[0248]\\d{6}"]]], "CI": ["225", "00", "[02]\\d{9}", [10], [["(\\d{2})(\\d{2})(\\d)(\\d{5})", "$1 $2 $3 $4", ["2"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{4})", "$1 $2 $3 $4", ["0"]]], 0, 0, 0, 0, 0, 0, [["2(?:[15]\\d{3}|7(?:2(?:0[23]|1[2357]|2[245]|3[45]|4[3-5])|3(?:06|1[69]|[2-6]7)))\\d{5}"], ["0704[0-7]\\d{5}|0(?:[15]\\d\\d|7(?:0[0-37-9]|[4-9][7-9]))\\d{6}"]]], "CK": ["682", "00", "[2-578]\\d{4}", [5], [["(\\d{2})(\\d{3})", "$1 $2", ["[2-578]"]]], 0, 0, 0, 0, 0, 0, [["(?:2\\d|3[13-7]|4[1-5])\\d{3}"], ["[578]\\d{4}"]]], "CL": ["56", "(?:0|1(?:1[0-69]|2[02-5]|5[13-58]|69|7[0167]|8[018]))0", "12300\\d{6}|6\\d{9,10}|[2-9]\\d{8}", [9, 10, 11], [["(\\d{5})(\\d{4})", "$1 $2", ["219", "2196"], "($1)"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["44"]], ["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["2[1-36]"], "($1)"], ["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["9[2-9]"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["3[2-5]|[47]|5[1-3578]|6[13-57]|8(?:0[1-9]|[1-9])"], "($1)"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["60|8"]], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"]], ["(\\d{3})(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3 $4", ["60"]]], 0, 0, 0, 0, 0, 0, [["2(?:1982[0-6]|3314[05-9])\\d{3}|(?:2(?:1(?:160|962)|3(?:2\\d\\d|3(?:[0346]\\d|1[0-35-9]|2[1-9]|5[0-24-9]|7[0-3])|600)|646[59])|80[1-9]\\d\\d|9(?:3(?:[0-57-9]\\d\\d|6(?:0[02-9]|[1-9]\\d))|6(?:[0-8]\\d\\d|9(?:[02-79]\\d|1[05-9]))|7[1-9]\\d\\d|9(?:[03-9]\\d\\d|1(?:[0235-9]\\d|4[0-24-9])|2(?:[0-79]\\d|8[0-46-9]))))\\d{4}|(?:22|3[2-5]|[47][1-35]|5[1-3578]|6[13-57]|8[1-9]|9[2458])\\d{7}", [9]], ["", [9]], ["(?:123|8)00\\d{6}", [9, 11]], 0, 0, 0, 0, 0, ["44\\d{7}", [9]], ["600\\d{7,8}", [10, 11]]]], "CM": ["237", "00", "[26]\\d{8}|88\\d{6,7}", [8, 9], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["88"]], ["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4 $5", ["[26]|88"]]], 0, 0, 0, 0, 0, 0, [["2(?:22|33)\\d{6}", [9]], ["(?:24[23]|6[25-9]\\d)\\d{6}", [9]], ["88\\d{6,7}"]]], "CN": ["86", "00|1(?:[12]\\d|79)\\d\\d00", "1[127]\\d{8,9}|2\\d{9}(?:\\d{2})?|[12]\\d{6,7}|86\\d{6}|(?:1[03-689]\\d|6)\\d{7,9}|(?:[3-579]\\d|8[0-57-9])\\d{6,9}", [7, 8, 9, 10, 11, 12], [["(\\d{2})(\\d{5,6})", "$1 $2", ["(?:10|2[0-57-9])[19]", "(?:10|2[0-57-9])(?:10|9[56])", "(?:10|2[0-57-9])(?:100|9[56])"], "0$1"], ["(\\d{3})(\\d{5,6})", "$1 $2", ["3(?:[157]|35|49|9[1-68])|4(?:[17]|2[179]|6[47-9]|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]|4[13]|5[1-5])|(?:4[35]|59|85)[1-9]", "(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))[19]", "85[23](?:10|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:10|9[56])", "85[23](?:100|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:100|9[56])"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["(?:4|80)0"]], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["10|2(?:[02-57-9]|1[1-9])", "10|2(?:[02-57-9]|1[1-9])", "10[0-79]|2(?:[02-57-9]|1[1-79])|(?:10|21)8(?:0[1-9]|[1-9])"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["3(?:[3-59]|7[02-68])|4(?:[26-8]|3[3-9]|5[2-9])|5(?:3[03-9]|[468]|7[028]|9[2-46-9])|6|7(?:[0-247]|3[04-9]|5[0-4689]|6[2368])|8(?:[1-358]|9[1-7])|9(?:[013479]|5[1-5])|(?:[34]1|55|79|87)[02-9]"], "0$1", 1], ["(\\d{3})(\\d{7,8})", "$1 $2", ["9"]], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["80"], "0$1", 1], ["(\\d{3})(\\d{4})(\\d{4})", "$1 $2 $3", ["[3-578]"], "0$1", 1], ["(\\d{3})(\\d{4})(\\d{4})", "$1 $2 $3", ["1[3-9]"]], ["(\\d{2})(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3 $4", ["[12]"], "0$1", 1]], "0", 0, "0|(1(?:[12]\\d|79)\\d\\d)", 0, 0, 0, [["(?:10(?:[02-79]\\d\\d|[18](?:0[1-9]|[1-9]\\d))|21(?:[18](?:0[1-9]|[1-9]\\d)|[2-79]\\d\\d))\\d{5}|(?:43[35]|754)\\d{7,8}|8(?:078\\d{7}|51\\d{7,8})|(?:10|(?:2|85)1|43[35]|754)(?:100\\d\\d|95\\d{3,4})|(?:2[02-57-9]|3(?:11|7[179])|4(?:[15]1|3[12])|5(?:1\\d|2[37]|3[12]|51|7[13-79]|9[15])|7(?:[39]1|5[57]|6[09])|8(?:71|98))(?:[02-8]\\d{7}|1(?:0(?:0\\d\\d(?:\\d{3})?|[1-9]\\d{5})|[1-9]\\d{6})|9(?:[0-46-9]\\d{6}|5\\d{3}(?:\\d(?:\\d{2})?)?))|(?:3(?:1[02-9]|35|49|5\\d|7[02-68]|9[1-68])|4(?:1[02-9]|2[179]|3[46-9]|5[2-9]|6[47-9]|7\\d|8[23])|5(?:3[03-9]|4[36]|5[02-9]|6[1-46]|7[028]|80|9[2-46-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[17]\\d|2[248]|3[04-9]|4[3-6]|5[0-3689]|6[2368]|9[02-9])|8(?:1[236-8]|2[5-7]|3\\d|5[2-9]|7[02-9]|8[36-8]|9[1-7])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:[02-8]\\d{6}|1(?:0(?:0\\d\\d(?:\\d{2})?|[1-9]\\d{4})|[1-9]\\d{5})|9(?:[0-46-9]\\d{5}|5\\d{3,5}))", [7, 8, 9, 10, 11]], ["1740[0-5]\\d{6}|1(?:[38]\\d|4[57]|[59][0-35-9]|6[25-7]|7[0-35-8])\\d{8}", [11]], ["(?:(?:10|21)8|8)00\\d{7}", [10, 12]], ["16[08]\\d{5}", [8]], 0, 0, 0, 0, 0, ["400\\d{7}|950\\d{7,8}|(?:10|2[0-57-9]|3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))96\\d{3,4}", [7, 8, 9, 10, 11]]], "00"], "CO": ["57", "00(?:4(?:[14]4|56)|[579])", "(?:60\\d\\d|9101)\\d{6}|(?:1\\d|3)\\d{9}", [10, 11], [["(\\d{3})(\\d{7})", "$1 $2", ["6"], "($1)"], ["(\\d{3})(\\d{7})", "$1 $2", ["3[0-357]|91"]], ["(\\d)(\\d{3})(\\d{7})", "$1-$2-$3", ["1"], "0$1", 0, "$1 $2 $3"]], "0", 0, "0(4(?:[14]4|56)|[579])?", 0, 0, 0, [["601055(?:[0-4]\\d|50)\\d\\d|6010(?:[0-4]\\d|5[0-4])\\d{4}|60[124-8][2-9]\\d{6}", [10]], ["3333(?:0(?:0\\d|1[0-5])|[4-9]\\d\\d)\\d{3}|(?:3(?:24[1-9]|3(?:00|3[0-24-9]))|9101)\\d{6}|3(?:0[0-5]|1\\d|2[0-3]|5[01]|70)\\d{7}", [10]], ["1800\\d{7}", [11]], ["19(?:0[01]|4[78])\\d{7}", [11]]]], "CR": ["506", "00", "(?:8\\d|90)\\d{8}|(?:[24-8]\\d{3}|3005)\\d{4}", [8, 10], [["(\\d{4})(\\d{4})", "$1 $2", ["[2-7]|8[3-9]"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1-$2-$3", ["[89]"]]], 0, 0, "(19(?:0[0-2468]|1[09]|20|66|77|99))", 0, 0, 0, [["210[7-9]\\d{4}|2(?:[024-7]\\d|1[1-9])\\d{5}", [8]], ["(?:3005\\d|6500[01])\\d{3}|(?:5[07]|6[0-4]|7[0-3]|8[3-9])\\d{6}", [8]], ["800\\d{7}", [10]], ["90[059]\\d{7}", [10]], 0, 0, 0, 0, ["(?:210[0-6]|4\\d{3}|5100)\\d{4}", [8]]]], "CU": ["53", "119", "[27]\\d{6,7}|[34]\\d{5,7}|(?:5|8\\d\\d)\\d{7}", [6, 7, 8, 10], [["(\\d{2})(\\d{4,6})", "$1 $2", ["2[1-4]|[34]"], "(0$1)"], ["(\\d)(\\d{6,7})", "$1 $2", ["7"], "(0$1)"], ["(\\d)(\\d{7})", "$1 $2", ["5"], "0$1"], ["(\\d{3})(\\d{7})", "$1 $2", ["8"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:3[23]|48)\\d{4,6}|(?:31|4[36]|8(?:0[25]|78)\\d)\\d{6}|(?:2[1-4]|4[1257]|7\\d)\\d{5,6}"], ["5\\d{7}", [8]], ["800\\d{7}", [10]], 0, 0, 0, 0, 0, 0, ["807\\d{7}", [10]]]], "CV": ["238", "0", "(?:[2-59]\\d\\d|800)\\d{4}", [7], [["(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3", ["[2-589]"]]], 0, 0, 0, 0, 0, 0, [["2(?:2[1-7]|3[0-8]|4[12]|5[1256]|6\\d|7[1-3]|8[1-5])\\d{4}"], ["(?:36|5[1-389]|9\\d)\\d{5}"], ["800\\d{4}"], 0, 0, 0, 0, 0, ["(?:3[3-5]|4[356])\\d{5}"]]], "CW": ["599", "00", "(?:[34]1|60|(?:7|9\\d)\\d)\\d{5}", [7, 8], [["(\\d{3})(\\d{4})", "$1 $2", ["[3467]"]], ["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["9[4-8]"]]], 0, 0, 0, 0, 0, "[69]", [["9(?:4(?:3[0-5]|4[14]|6\\d)|50\\d|7(?:2[014]|3[02-9]|4[4-9]|6[357]|77|8[7-9])|8(?:3[39]|[46]\\d|7[01]|8[57-9]))\\d{4}"], ["953[01]\\d{4}|9(?:5[12467]|6[5-9])\\d{5}"], 0, 0, 0, 0, 0, ["955\\d{5}", [8]], 0, ["60[0-2]\\d{4}", [7]]]], "CX": ["61", "001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011", "1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}", [6, 7, 8, 9, 10, 12], 0, "0", 0, "0|([59]\\d{7})$", "8$1", 0, 0, [["8(?:51(?:0(?:01|30|59|88)|1(?:17|46|75)|2(?:22|35))|91(?:00[6-9]|1(?:[28]1|49|78)|2(?:09|63)|3(?:12|26|75)|4(?:56|97)|64\\d|7(?:0[01]|1[0-2])|958))\\d{3}", [9]], ["4(?:83[0-38]|93[0-6])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[016-9]|7[02-9]|8[0-24-9]|9[0-27-9])\\d{6}", [9]], ["180(?:0\\d{3}|2)\\d{3}", [7, 10]], ["190[0-26]\\d{6}", [10]], 0, 0, 0, 0, ["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}", [9]], ["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}", [6, 8, 10, 12]]], "0011"], "CY": ["357", "00", "(?:[279]\\d|[58]0)\\d{6}", [8], [["(\\d{2})(\\d{6})", "$1 $2", ["[257-9]"]]], 0, 0, 0, 0, 0, 0, [["2[2-6]\\d{6}"], ["9[4-79]\\d{6}"], ["800\\d{5}"], ["90[09]\\d{5}"], ["700\\d{5}"], 0, ["(?:50|77)\\d{6}"], 0, 0, ["80[1-9]\\d{5}"]]], "CZ": ["420", "00", "(?:[2-578]\\d|60)\\d{7}|9\\d{8,11}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[2-8]|9[015-7]"]], ["(\\d{2})(\\d{3})(\\d{3})(\\d{2})", "$1 $2 $3 $4", ["96"]], ["(\\d{2})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["9"]], ["(\\d{3})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["9"]]], 0, 0, 0, 0, 0, 0, [["(?:2\\d|3[1257-9]|4[16-9]|5[13-9])\\d{7}"], ["(?:60[1-8]|7(?:0[2-5]|[2379]\\d))\\d{6}"], ["800\\d{6}"], ["9(?:0[05689]|76)\\d{6}"], ["70[01]\\d{6}"], 0, ["9(?:5\\d|7[2-4])\\d{6}"], 0, ["9[17]0\\d{6}"], ["8[134]\\d{7}"]]], "DE": ["49", "00", "[2579]\\d{5,14}|49(?:[34]0|69|8\\d)\\d\\d?|49(?:37|49|60|7[089]|9\\d)\\d{1,3}|49(?:2[024-9]|3[2-689]|7[1-7])\\d{1,8}|(?:1|[368]\\d|4[0-8])\\d{3,13}|49(?:[015]\\d|2[13]|31|[46][1-8])\\d{1,9}", [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [["(\\d{2})(\\d{3,13})", "$1 $2", ["3[02]|40|[68]9"], "0$1"], ["(\\d{3})(\\d{3,12})", "$1 $2", ["2(?:0[1-389]|1[124]|2[18]|3[14])|3(?:[35-9][15]|4[015])|906|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1", "2(?:0[1-389]|12[0-8])|3(?:[35-9][15]|4[015])|906|2(?:[13][14]|2[18])|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1"], "0$1"], ["(\\d{4})(\\d{2,11})", "$1 $2", ["[24-6]|3(?:[3569][02-46-9]|4[2-4679]|7[2-467]|8[2-46-8])|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]", "[24-6]|3(?:3(?:0[1-467]|2[127-9]|3[124578]|7[1257-9]|8[1256]|9[145])|4(?:2[135]|4[13578]|9[1346])|5(?:0[14]|2[1-3589]|6[1-4]|7[13468]|8[13568])|6(?:2[1-489]|3[124-6]|6[13]|7[12579]|8[1-356]|9[135])|7(?:2[1-7]|4[145]|6[1-5]|7[1-4])|8(?:21|3[1468]|6|7[1467]|8[136])|9(?:0[12479]|2[1358]|4[134679]|6[1-9]|7[136]|8[147]|9[1468]))|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]|3[68]4[1347]|3(?:47|60)[1356]|3(?:3[46]|46|5[49])[1246]|3[4579]3[1357]"], "0$1"], ["(\\d{3})(\\d{4})", "$1 $2", ["138"], "0$1"], ["(\\d{5})(\\d{2,10})", "$1 $2", ["3"], "0$1"], ["(\\d{3})(\\d{5,11})", "$1 $2", ["181"], "0$1"], ["(\\d{3})(\\d)(\\d{4,10})", "$1 $2 $3", ["1(?:3|80)|9"], "0$1"], ["(\\d{3})(\\d{7,8})", "$1 $2", ["1[67]"], "0$1"], ["(\\d{3})(\\d{7,12})", "$1 $2", ["8"], "0$1"], ["(\\d{5})(\\d{6})", "$1 $2", ["185", "1850", "18500"], "0$1"], ["(\\d{3})(\\d{4})(\\d{4})", "$1 $2 $3", ["7"], "0$1"], ["(\\d{4})(\\d{7})", "$1 $2", ["18[68]"], "0$1"], ["(\\d{5})(\\d{6})", "$1 $2", ["15[0568]"], "0$1"], ["(\\d{4})(\\d{7})", "$1 $2", ["15[1279]"], "0$1"], ["(\\d{3})(\\d{8})", "$1 $2", ["18"], "0$1"], ["(\\d{3})(\\d{2})(\\d{7,8})", "$1 $2 $3", ["1(?:6[023]|7)"], "0$1"], ["(\\d{4})(\\d{2})(\\d{7})", "$1 $2 $3", ["15[279]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{8})", "$1 $2 $3", ["15"], "0$1"]], "0", 0, 0, 0, 0, 0, [["32\\d{9,11}|49[1-6]\\d{10}|322\\d{6}|49[0-7]\\d{3,9}|(?:[34]0|[68]9)\\d{3,13}|(?:2(?:0[1-689]|[1-3569]\\d|4[0-8]|7[1-7]|8[0-7])|3(?:[3569]\\d|4[0-79]|7[1-7]|8[1-8])|4(?:1[02-9]|[2-48]\\d|5[0-6]|6[0-8]|7[0-79])|5(?:0[2-8]|[124-6]\\d|[38][0-8]|[79][0-7])|6(?:0[02-9]|[1-358]\\d|[47][0-8]|6[1-9])|7(?:0[2-8]|1[1-9]|[27][0-7]|3\\d|[4-6][0-8]|8[0-5]|9[013-7])|8(?:0[2-9]|1[0-79]|2\\d|3[0-46-9]|4[0-6]|5[013-9]|6[1-8]|7[0-8]|8[0-24-6])|9(?:0[6-9]|[1-4]\\d|[589][0-7]|6[0-8]|7[0-467]))\\d{3,12}", [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]], ["15[0-25-9]\\d{8}|1(?:6[023]|7\\d)\\d{7,8}", [10, 11]], ["800\\d{7,12}", [10, 11, 12, 13, 14, 15]], ["(?:137[7-9]|900(?:[135]|9\\d))\\d{6}", [10, 11]], ["700\\d{8}", [11]], 0, ["18(?:1\\d{5,11}|[2-9]\\d{8})", [8, 9, 10, 11, 12, 13, 14]], ["16(?:4\\d{1,10}|[89]\\d{1,11})", [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]], 0, ["180\\d{5,11}|13(?:7[1-6]\\d\\d|8)\\d{4}", [7, 8, 9, 10, 11, 12, 13, 14]]]], "DJ": ["253", "00", "(?:2\\d|77)\\d{6}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[27]"]]], 0, 0, 0, 0, 0, 0, [["2(?:1[2-5]|7[45])\\d{5}"], ["77\\d{6}"]]], "DK": ["45", "00", "[2-9]\\d{7}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[2-9]"]]], 0, 0, 0, 0, 0, 0, [["(?:[2-7]\\d|8[126-9]|9[1-46-9])\\d{6}"], [""], ["80\\d{6}"], ["90\\d{6}"]]], "DM": ["1", "011", "(?:[58]\\d\\d|767|900)\\d{7}", [10], 0, "1", 0, "1|([2-7]\\d{6})$", "767$1", 0, "767", [["767(?:2(?:55|66)|4(?:2[01]|4[0-25-9])|50[0-4])\\d{4}"], ["767(?:2(?:[2-4689]5|7[5-7])|31[5-7]|61[1-8]|70[1-6])\\d{4}"], ["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"], ["900[2-9]\\d{6}"], ["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"]]], "DO": ["1", "011", "(?:[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, 0, 0, 0, "8001|8[024]9", [["8(?:[04]9[2-9]\\d\\d|29(?:2(?:[0-59]\\d|6[04-9]|7[0-27]|8[0237-9])|3(?:[0-35-9]\\d|4[7-9])|[45]\\d\\d|6(?:[0-27-9]\\d|[3-5][1-9]|6[0135-8])|7(?:0[013-9]|[1-37]\\d|4[1-35689]|5[1-4689]|6[1-57-9]|8[1-79]|9[1-8])|8(?:0[146-9]|1[0-48]|[248]\\d|3[1-79]|5[01589]|6[013-68]|7[124-8]|9[0-8])|9(?:[0-24]\\d|3[02-46-9]|5[0-79]|60|7[0169]|8[57-9]|9[02-9])))\\d{4}"], ["8[024]9[2-9]\\d{6}"], ["8(?:00(?:14|[2-9]\\d)|(?:33|44|55|66|77|88)[2-9]\\d)\\d{5}"], ["900[2-9]\\d{6}"], ["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"]]], "DZ": ["213", "00", "(?:[1-4]|[5-79]\\d|80)\\d{7}", [8, 9], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[1-4]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["9"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[5-8]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["9619\\d{5}|(?:1\\d|2[013-79]|3[0-8]|4[013-689])\\d{6}"], ["(?:5(?:4[0-29]|5\\d|6[0-2])|6(?:[569]\\d|7[0-6])|7[7-9]\\d)\\d{6}", [9]], ["800\\d{6}", [9]], ["80[3-689]1\\d{5}", [9]], 0, 0, 0, 0, ["98[23]\\d{6}", [9]], ["80[12]1\\d{5}", [9]]]], "EC": ["593", "00", "1\\d{9,10}|(?:[2-7]|9\\d)\\d{7}", [8, 9, 10, 11], [["(\\d)(\\d{3})(\\d{4})", "$1 $2-$3", ["[2-7]"], "(0$1)", 0, "$1-$2-$3"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["9"], "0$1"], ["(\\d{4})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["1"]]], "0", 0, 0, 0, 0, 0, [["[2-7][2-7]\\d{6}", [8]], ["964[0-2]\\d{5}|9(?:39|[57][89]|6[0-36-9]|[89]\\d)\\d{6}", [9]], ["1800\\d{7}|1[78]00\\d{6}", [10, 11]], 0, 0, 0, 0, 0, ["[2-7]890\\d{4}", [8]]]], "EE": ["372", "00", "8\\d{9}|[4578]\\d{7}|(?:[3-8]\\d|90)\\d{5}", [7, 8, 10], [["(\\d{3})(\\d{4})", "$1 $2", ["[369]|4[3-8]|5(?:[0-2]|5[0-478]|6[45])|7[1-9]|88", "[369]|4[3-8]|5(?:[02]|1(?:[0-8]|95)|5[0-478]|6(?:4[0-4]|5[1-589]))|7[1-9]|88"]], ["(\\d{4})(\\d{3,4})", "$1 $2", ["[45]|8(?:00|[1-49])", "[45]|8(?:00[1-9]|[1-49])"]], ["(\\d{2})(\\d{2})(\\d{4})", "$1 $2 $3", ["7"]], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["8"]]], 0, 0, 0, 0, 0, 0, [["(?:3[23589]|4[3-8]|6\\d|7[1-9]|88)\\d{5}", [7]], ["(?:5\\d{5}|8(?:1(?:0(?:000|[3-9]\\d\\d)|(?:1(?:0[236]|1\\d)|(?:23|[3-79]\\d)\\d)\\d)|2(?:0(?:000|(?:19|[2-7]\\d)\\d)|(?:(?:[124-6]\\d|3[5-9])\\d|7(?:[3679]\\d|8[13-9])|8(?:[2-6]\\d|7[01]))\\d)|[349]\\d{4}))\\d\\d|5(?:(?:[02]\\d|5[0-478])\\d|1(?:[0-8]\\d|95)|6(?:4[0-4]|5[1-589]))\\d{3}", [7, 8]], ["800(?:(?:0\\d\\d|1)\\d|[2-9])\\d{3}"], ["(?:40\\d\\d|900)\\d{4}", [7, 8]], ["70[0-2]\\d{5}", [8]]]], "EG": ["20", "00", "[189]\\d{8,9}|[24-6]\\d{8}|[135]\\d{7}", [8, 9, 10], [["(\\d)(\\d{7,8})", "$1 $2", ["[23]"], "0$1"], ["(\\d{2})(\\d{6,7})", "$1 $2", ["1[35]|[4-6]|8[2468]|9[235-7]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["[189]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["13[23]\\d{6}|(?:15|57)\\d{6,7}|(?:2[2-4]|3|4[05-8]|5[05]|6[24-689]|8[2468]|9[235-7])\\d{7}", [8, 9]], ["1[0-25]\\d{8}", [10]], ["800\\d{7}", [10]], ["900\\d{7}", [10]]]], "EH": ["212", "00", "[5-8]\\d{8}", [9], 0, "0", 0, 0, 0, 0, "528[89]", [["528[89]\\d{5}"], ["(?:6(?:[0-79]\\d|8[0-247-9])|7(?:[017]\\d|2[0-2]|6[0-8]|8[0-3]))\\d{6}"], ["80\\d{7}"], ["89\\d{7}"], 0, 0, 0, 0, ["592(?:4[0-2]|93)\\d{4}"]]], "ER": ["291", "00", "[178]\\d{6}", [7], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["[178]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:1(?:1[12568]|[24]0|55|6[146])|8\\d\\d)\\d{4}"], ["(?:17[1-3]|7\\d\\d)\\d{4}"]]], "ES": ["34", "00", "[5-9]\\d{8}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[89]00"]], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[5-9]"]]], 0, 0, 0, 0, 0, 0, [["96906(?:0[0-8]|1[1-9]|[2-9]\\d)\\d\\d|9(?:69(?:0[0-57-9]|[1-9]\\d)|73(?:[0-8]\\d|9[1-9]))\\d{4}|(?:8(?:[1356]\\d|[28][0-8]|[47][1-9])|9(?:[135]\\d|[268][0-8]|4[1-9]|7[124-9]))\\d{6}"], ["(?:590[16]00\\d|9(?:6906(?:09|10)|7390\\d\\d))\\d\\d|(?:6\\d|7[1-48])\\d{7}"], ["[89]00\\d{6}"], ["80[367]\\d{6}"], ["70\\d{7}"], 0, ["51\\d{7}"], 0, 0, ["90[12]\\d{6}"]]], "ET": ["251", "00", "(?:11|[2-579]\\d)\\d{7}", [9], [["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[1-579]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["11667[01]\\d{3}|(?:11(?:1(?:1[124]|2[2-7]|3[1-5]|5[5-8]|8[6-8])|2(?:13|3[6-8]|5[89]|7[05-9]|8[2-6])|3(?:2[01]|3[0-289]|4[1289]|7[1-4]|87)|4(?:1[69]|3[2-49]|4[0-3]|6[5-8])|5(?:1[578]|44|5[0-4])|6(?:1[78]|2[69]|39|4[5-7]|5[1-5]|6[0-59]|8[015-8]))|2(?:2(?:11[1-9]|22[0-7]|33\\d|44[1467]|66[1-68])|5(?:11[124-6]|33[2-8]|44[1467]|55[14]|66[1-3679]|77[124-79]|880))|3(?:3(?:11[0-46-8]|(?:22|55)[0-6]|33[0134689]|44[04]|66[01467])|4(?:44[0-8]|55[0-69]|66[0-3]|77[1-5]))|4(?:6(?:119|22[0-24-7]|33[1-5]|44[13-69]|55[14-689]|660|88[1-4])|7(?:(?:11|22)[1-9]|33[13-7]|44[13-6]|55[1-689]))|5(?:7(?:227|55[05]|(?:66|77)[14-8])|8(?:11[149]|22[013-79]|33[0-68]|44[013-8]|550|66[1-5]|77\\d)))\\d{4}"], ["7001\\d{5}|(?:7(?:0[1-9]|1[01]|77|86|99)|9\\d\\d)\\d{6}"]]], "FI": ["358", "00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))", "[1-35689]\\d{4}|7\\d{10,11}|(?:[124-7]\\d|3[0-46-9])\\d{8}|[1-9]\\d{5,8}", [5, 6, 7, 8, 9, 10, 11, 12], [["(\\d)(\\d{4,9})", "$1 $2", ["[2568][1-8]|3(?:0[1-9]|[1-9])|9"], "0$1"], ["(\\d{3})(\\d{3,7})", "$1 $2", ["[12]00|[368]|70[07-9]"], "0$1"], ["(\\d{2})(\\d{4,8})", "$1 $2", ["[1245]|7[135]"], "0$1"], ["(\\d{2})(\\d{6,10})", "$1 $2", ["7"], "0$1"]], "0", 0, 0, 0, 0, "1[03-79]|[2-9]", [["(?:1[3-79][1-8]|[235689][1-8]\\d)\\d{2,6}", [5, 6, 7, 8, 9]], ["4946\\d{2,6}|(?:4[0-8]|50)\\d{4,8}", [6, 7, 8, 9, 10]], ["800\\d{4,6}", [7, 8, 9]], ["[67]00\\d{5,6}", [8, 9]], 0, 0, ["20\\d{4,8}|60[12]\\d{5,6}|7(?:099\\d{4,5}|5[03-9]\\d{3,7})|20[2-59]\\d\\d|(?:606|7(?:0[78]|1|3\\d))\\d{7}|(?:10|29|3[09]|70[1-5]\\d)\\d{4,8}"]], "00"], "FJ": ["679", "0(?:0|52)", "45\\d{5}|(?:0800\\d|[235-9])\\d{6}", [7, 11], [["(\\d{3})(\\d{4})", "$1 $2", ["[235-9]|45"]], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["0"]]], 0, 0, 0, 0, 0, 0, [["603\\d{4}|(?:3[0-5]|6[25-7]|8[58])\\d{5}", [7]], ["(?:[279]\\d|45|5[01568]|8[034679])\\d{5}", [7]], ["0800\\d{7}", [11]]], "00"], "FK": ["500", "00", "[2-7]\\d{4}", [5], 0, 0, 0, 0, 0, 0, 0, [["[2-47]\\d{4}"], ["[56]\\d{4}"]]], "FM": ["691", "00", "(?:[39]\\d\\d|820)\\d{4}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[389]"]]], 0, 0, 0, 0, 0, 0, [["31(?:00[67]|208|309)\\d\\d|(?:3(?:[2357]0[1-9]|602|804|905)|(?:820|9[2-6]\\d)\\d)\\d{3}"], ["31(?:00[67]|208|309)\\d\\d|(?:3(?:[2357]0[1-9]|602|804|905)|(?:820|9[2-7]\\d)\\d)\\d{3}"]]], "FO": ["298", "00", "[2-9]\\d{5}", [6], [["(\\d{6})", "$1", ["[2-9]"]]], 0, 0, "(10(?:01|[12]0|88))", 0, 0, 0, [["(?:20|[34]\\d|8[19])\\d{4}"], ["(?:[27][1-9]|5\\d|9[16])\\d{4}"], ["80[257-9]\\d{3}"], ["90(?:[13-5][15-7]|2[125-7]|9\\d)\\d\\d"], 0, 0, 0, 0, ["(?:6[0-36]|88)\\d{4}"]]], "FR": ["33", "00", "[1-9]\\d{8}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"], "0 $1"], ["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4 $5", ["[1-79]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:[1-35]\\d|4[1-9])\\d{7}"], ["(?:6(?:[0-24-8]\\d|3[0-8]|9[589])|7(?:00|[3-9]\\d))\\d{6}"], ["80[0-5]\\d{6}"], ["836(?:0[0-36-9]|[1-9]\\d)\\d{4}|8(?:1[2-9]|2[2-47-9]|3[0-57-9]|[569]\\d|8[0-35-9])\\d{6}"], 0, 0, ["80[6-9]\\d{6}"], 0, ["9\\d{8}"], ["8(?:1[01]|2[0156]|4[02]|84)\\d{6}"]]], "GA": ["241", "00", "(?:[067]\\d|11)\\d{6}|[2-7]\\d{6}", [7, 8], [["(\\d)(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[2-7]"], "0$1"], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["0"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["11|[67]"], "0$1"]], 0, 0, "0(11\\d{6}|60\\d{6}|61\\d{6}|6[256]\\d{6}|7[467]\\d{6})", "$1", 0, 0, [["[01]1\\d{6}", [8]], ["(?:(?:0[2-7]|7[467])\\d|6(?:0[0-4]|10|[256]\\d))\\d{5}|[2-7]\\d{6}"]]], "GB": ["44", "00", "[1-357-9]\\d{9}|[18]\\d{8}|8\\d{6}", [7, 9, 10], [["(\\d{3})(\\d{4})", "$1 $2", ["800", "8001", "80011", "800111", "8001111"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3", ["845", "8454", "84546", "845464"], "0$1"], ["(\\d{3})(\\d{6})", "$1 $2", ["800"], "0$1"], ["(\\d{5})(\\d{4,5})", "$1 $2", ["1(?:38|5[23]|69|76|94)", "1(?:(?:38|69)7|5(?:24|39)|768|946)", "1(?:3873|5(?:242|39[4-6])|(?:697|768)[347]|9467)"], "0$1"], ["(\\d{4})(\\d{5,6})", "$1 $2", ["1(?:[2-69][02-9]|[78])"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["[25]|7(?:0|6[02-9])", "[25]|7(?:0|6(?:[03-9]|2[356]))"], "0$1"], ["(\\d{4})(\\d{6})", "$1 $2", ["7"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["[1389]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:1(?:1(?:3(?:[0-58]\\d\\d|73[0235])|4(?:[0-5]\\d\\d|69[7-9]|70[013579])|(?:(?:5[0-26-9]|[78][0-49])\\d|6(?:[0-4]\\d|50))\\d)|2(?:(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-47-9]|7[013-9]|9\\d)\\d\\d|1(?:[0-7]\\d\\d|8(?:[02]\\d|1[0-246-9])))|(?:3(?:0\\d|1[0-8]|[25][02-9]|3[02-579]|[468][0-46-9]|7[1-35-79]|9[2-578])|4(?:0[03-9]|[137]\\d|[28][02-57-9]|4[02-69]|5[0-8]|[69][0-79])|5(?:0[1-35-9]|[16]\\d|2[024-9]|3[015689]|4[02-9]|5[03-9]|7[0-35-9]|8[0-468]|9[0-57-9])|6(?:0[034689]|1\\d|2[0-35689]|[38][013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|9[0-24578])|7(?:0[0246-9]|2\\d|3[0236-8]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-57-9]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\\d|8[02-9]|9[02569])|9(?:0[02-589]|[18]\\d|2[02-689]|3[1-57-9]|4[2-9]|5[0-579]|6[2-47-9]|7[0-24578]|9[2-57]))\\d\\d)|2(?:0[013478]|3[0189]|4[017]|8[0-46-9]|9[0-2])\\d{3})\\d{4}|1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-47-9]|8[3-5])))|3(?:6(?:38[2-5]|47[23])|8(?:47[04-9]|64[0157-9]))|4(?:044[1-7]|20(?:2[23]|8\\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[1-3]))|5(?:2(?:4(?:3[2-79]|6\\d)|76\\d)|6(?:26[06-9]|686))|6(?:06(?:4\\d|7[4-79])|295[5-7]|35[34]\\d|47(?:24|61)|59(?:5[08]|6[67]|74)|9(?:55[0-4]|77[23]))|7(?:26(?:6[13-9]|7[0-7])|(?:442|688)\\d|50(?:2[0-3]|[3-68]2|76))|8(?:27[56]\\d|37(?:5[2-5]|8[239])|843[2-58])|9(?:0(?:0(?:6[1-8]|85)|52\\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\\d{3}", [9, 10]], ["7(?:457[0-57-9]|700[01]|911[028])\\d{5}|7(?:[1-3]\\d\\d|4(?:[0-46-9]\\d|5[0-689])|5(?:0[0-8]|[13-9]\\d|2[0-35-9])|7(?:0[1-9]|[1-7]\\d|8[02-9]|9[0-689])|8(?:[014-9]\\d|[23][0-8])|9(?:[024-9]\\d|1[02-9]|3[0-689]))\\d{6}", [10]], ["80[08]\\d{7}|800\\d{6}|8001111"], ["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[2-49]))\\d{7}|845464\\d", [7, 10]], ["70\\d{8}", [10]], 0, ["(?:3[0347]|55)\\d{8}", [10]], ["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}", [10]], ["56\\d{8}", [10]]], 0, " x"], "GD": ["1", "011", "(?:473|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "1|([2-9]\\d{6})$", "473$1", 0, "473", [["473(?:2(?:3[0-2]|69)|3(?:2[89]|86)|4(?:[06]8|3[5-9]|4[0-49]|5[5-79]|73|90)|63[68]|7(?:58|84)|800|938)\\d{4}"], ["473(?:4(?:0[2-79]|1[04-9]|2[0-5]|58)|5(?:2[01]|3[3-8])|901)\\d{4}"], ["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"], ["900[2-9]\\d{6}"], ["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"]]], "GE": ["995", "00", "(?:[3-57]\\d\\d|800)\\d{6}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["70"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["32"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[57]"]], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[348]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:3(?:[256]\\d|4[124-9]|7[0-4])|4(?:1\\d|2[2-7]|3[1-79]|4[2-8]|7[239]|9[1-7]))\\d{6}"], ["5(?:(?:0555|1(?:[17]77|555))[5-9]|757(?:7[7-9]|8[01]))\\d{3}|5(?:0070|11(?:33|51)|[25]222|3333)[0-4]\\d{3}|5(?:00(?:0\\d|5[05])|11(?:00|[124]\\d|3[01])|5200|75(?:00|[57]5)|8(?:0(?:[01]\\d|2[0-4])|58[89]|8(?:55|88)))\\d{4}|(?:5(?:[14]4|5[0157-9]|68|7[0147-9]|9[1-35-9])|790)\\d{6}"], ["800\\d{6}"], 0, 0, 0, 0, 0, ["70[67]\\d{6}"]]], "GF": ["594", "00", "(?:[56]94|80\\d|976)\\d{6}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[569]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"], "0$1"]], "0", 0, 0, 0, 0, 0, [["594(?:[0239]\\d|1[0-2]|4[03-9]|5[6-9]|6[0-3]|80)\\d{4}"], ["694(?:[0-249]\\d|3[0-8])\\d{4}"], ["80[0-5]\\d{6}"], 0, 0, 0, 0, 0, ["976\\d{6}"]]], "GG": ["44", "00", "(?:1481|[357-9]\\d{3})\\d{6}|8\\d{6}(?:\\d{2})?", [7, 9, 10], 0, "0", 0, "0|([25-9]\\d{5})$", "1481$1", 0, 0, [["1481[25-9]\\d{5}", [10]], ["7(?:(?:781|839)\\d|911[17])\\d{5}", [10]], ["80[08]\\d{7}|800\\d{6}|8001111"], ["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[0-3]))\\d{7}|845464\\d", [7, 10]], ["70\\d{8}", [10]], 0, ["(?:3[0347]|55)\\d{8}", [10]], ["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}", [10]], ["56\\d{8}", [10]]]], "GH": ["233", "00", "(?:[235]\\d{3}|800)\\d{5}", [8, 9], [["(\\d{3})(\\d{5})", "$1 $2", ["8"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[235]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["3082[0-5]\\d{4}|3(?:0(?:[237]\\d|8[01])|[167](?:2[0-6]|7\\d|80)|2(?:2[0-5]|7\\d|80)|3(?:2[0-3]|7\\d|80)|4(?:2[013-9]|3[01]|7\\d|80)|5(?:2[0-7]|7\\d|80)|8(?:2[0-2]|7\\d|80)|9(?:[28]0|7\\d))\\d{5}", [9]], ["(?:2(?:[0346-9]\\d|5[67])|5(?:[0457]\\d|6[01]|9[1-9]))\\d{6}", [9]], ["800\\d{5}", [8]]]], "GI": ["350", "00", "(?:[25]\\d\\d|606)\\d{5}", [8], [["(\\d{3})(\\d{5})", "$1 $2", ["2"]]], 0, 0, 0, 0, 0, 0, [["21(?:6[24-7]\\d|90[0-2])\\d{3}|2(?:00|2[25])\\d{5}"], ["(?:5[146-8]\\d|606)\\d{5}"]]], "GL": ["299", "00", "(?:19|[2-689]\\d|70)\\d{4}", [6], [["(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3", ["19|[2-9]"]]], 0, 0, 0, 0, 0, 0, [["(?:19|3[1-7]|6[14689]|70|8[14-79]|9\\d)\\d{4}"], ["[245]\\d{5}"], ["80\\d{4}"], 0, 0, 0, 0, 0, ["3[89]\\d{4}"]]], "GM": ["220", "00", "[2-9]\\d{6}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[2-9]"]]], 0, 0, 0, 0, 0, 0, [["(?:4(?:[23]\\d\\d|4(?:1[024679]|[6-9]\\d))|5(?:5(?:3\\d|4[0-7])|6[67]\\d|7(?:1[04]|2[035]|3[58]|48))|8\\d{3})\\d{3}"], ["(?:[23679]\\d|5[0-389])\\d{5}"]]], "GN": ["224", "00", "722\\d{6}|(?:3|6\\d)\\d{7}", [8, 9], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["3"]], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[67]"]]], 0, 0, 0, 0, 0, 0, [["3(?:0(?:24|3[12]|4[1-35-7]|5[13]|6[189]|[78]1|9[1478])|1\\d\\d)\\d{4}", [8]], ["6[0-356]\\d{7}", [9]], 0, 0, 0, 0, 0, 0, ["722\\d{6}", [9]]]], "GP": ["590", "00", "(?:590|(?:69|80)\\d|976)\\d{6}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[569]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"], "0$1"]], "0", 0, 0, 0, 0, 0, [["590(?:0[1-68]|[14][0-24-9]|2[0-68]|3[1289]|5[3-579]|6[0-289]|7[08]|8[0-689]|9\\d)\\d{4}"], ["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"], ["80[0-5]\\d{6}"], 0, 0, 0, 0, 0, ["976[01]\\d{5}"]]], "GQ": ["240", "00", "222\\d{6}|(?:3\\d|55|[89]0)\\d{7}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[235]"]], ["(\\d{3})(\\d{6})", "$1 $2", ["[89]"]]], 0, 0, 0, 0, 0, 0, [["33[0-24-9]\\d[46]\\d{4}|3(?:33|5\\d)\\d[7-9]\\d{4}"], ["(?:222|55\\d)\\d{6}"], ["80\\d[1-9]\\d{5}"], ["90\\d[1-9]\\d{5}"]]], "GR": ["30", "00", "5005000\\d{3}|8\\d{9,11}|(?:[269]\\d|70)\\d{8}", [10, 11, 12], [["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["21|7"]], ["(\\d{4})(\\d{6})", "$1 $2", ["2(?:2|3[2-57-9]|4[2-469]|5[2-59]|6[2-9]|7[2-69]|8[2-49])|5"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["[2689]"]], ["(\\d{3})(\\d{3,4})(\\d{5})", "$1 $2 $3", ["8"]]], 0, 0, 0, 0, 0, 0, [["2(?:1\\d\\d|2(?:2[1-46-9]|[36][1-8]|4[1-7]|5[1-4]|7[1-5]|[89][1-9])|3(?:1\\d|2[1-57]|[35][1-3]|4[13]|7[1-7]|8[124-6]|9[1-79])|4(?:1\\d|2[1-8]|3[1-4]|4[13-5]|6[1-578]|9[1-5])|5(?:1\\d|[29][1-4]|3[1-5]|4[124]|5[1-6])|6(?:1\\d|[269][1-6]|3[1245]|4[1-7]|5[13-9]|7[14]|8[1-5])|7(?:1\\d|2[1-5]|3[1-6]|4[1-7]|5[1-57]|6[135]|9[125-7])|8(?:1\\d|2[1-5]|[34][1-4]|9[1-57]))\\d{6}", [10]], ["68[57-9]\\d{7}|(?:69|94)\\d{8}", [10]], ["800\\d{7,9}"], ["90[19]\\d{7}", [10]], ["70\\d{8}", [10]], 0, ["5005000\\d{3}", [10]], 0, 0, ["8(?:0[16]|12|[27]5|50)\\d{7}", [10]]]], "GT": ["502", "00", "(?:1\\d{3}|[2-7])\\d{7}", [8, 11], [["(\\d{4})(\\d{4})", "$1 $2", ["[2-7]"]], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"]]], 0, 0, 0, 0, 0, 0, [["[267][2-9]\\d{6}", [8]], ["[3-5]\\d{7}", [8]], ["18[01]\\d{8}", [11]], ["19\\d{9}", [11]]]], "GU": ["1", "011", "(?:[58]\\d\\d|671|900)\\d{7}", [10], 0, "1", 0, "1|([3-9]\\d{6})$", "671$1", 0, "671", [["671(?:3(?:00|3[39]|4[349]|55|6[26])|4(?:00|56|7[1-9]|8[0236-9])|5(?:55|6[2-5]|88)|6(?:3[2-578]|4[24-9]|5[34]|78|8[235-9])|7(?:[0479]7|2[0167]|3[45]|8[7-9])|8(?:[2-57-9]8|6[48])|9(?:2[29]|6[79]|7[1279]|8[7-9]|9[78]))\\d{4}"], [""], ["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"], ["900[2-9]\\d{6}"], ["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"]]], "GW": ["245", "00", "[49]\\d{8}|4\\d{6}", [7, 9], [["(\\d{3})(\\d{4})", "$1 $2", ["40"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[49]"]]], 0, 0, 0, 0, 0, 0, [["443\\d{6}", [9]], ["9(?:5\\d|6[569]|77)\\d{6}", [9]], 0, 0, 0, 0, 0, 0, ["40\\d{5}", [7]]]], "GY": ["592", "001", "9008\\d{3}|(?:[2-467]\\d\\d|862)\\d{4}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[2-46-9]"]]], 0, 0, 0, 0, 0, 0, [["(?:2(?:1[6-9]|2[0-35-9]|3[1-4]|5[3-9]|6\\d|7[0-24-79])|3(?:2[25-9]|3\\d)|4(?:4[0-24]|5[56])|77[1-57])\\d{4}"], ["(?:6\\d\\d|70[015-7])\\d{4}"], ["(?:289|862)\\d{4}"], ["9008\\d{3}"]]], "HK": ["852", "00(?:30|5[09]|[126-9]?)", "8[0-46-9]\\d{6,7}|9\\d{4,7}|(?:[2-7]|9\\d{3})\\d{7}", [5, 6, 7, 8, 9, 11], [["(\\d{3})(\\d{2,5})", "$1 $2", ["900", "9003"]], ["(\\d{4})(\\d{4})", "$1 $2", ["[2-7]|8[1-4]|9(?:0[1-9]|[1-8])"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["8"]], ["(\\d{3})(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["9"]]], 0, 0, 0, 0, 0, 0, [["(?:2(?:[13-9]\\d|2[013-9])\\d|3(?:(?:[1569][0-24-9]|4[0-246-9]|7[0-24-69])\\d|8(?:[45][0-8]|6[01]|9\\d))|58(?:0[1-8]|1[2-9]))\\d{4}", [8]], ["(?:4(?:44[5-9]|6(?:0[0-7]|1[0-6]|4[0-57-9]|6[0-4]|7[0-8]))|573[0-6]|6(?:26[013-8]|66[0-3])|70(?:7[1-5]|8[0-4])|848[015-9]|9(?:29[013-9]|59[0-4]))\\d{4}|(?:4(?:4[01]|6[2358])|5(?:[1-59][0-46-9]|6[0-4689]|7[0-246-9])|6(?:0[1-9]|[13-59]\\d|[268][0-57-9]|7[0-79])|84[09]|9(?:0[1-9]|1[02-9]|[2358][0-8]|[467]\\d))\\d{5}", [8]], ["800\\d{6}", [9]], ["900(?:[0-24-9]\\d{7}|3\\d{1,4})", [5, 6, 7, 8, 11]], ["8(?:1[0-4679]\\d|2(?:[0-36]\\d|7[0-4])|3(?:[034]\\d|2[09]|70))\\d{4}", [8]], 0, ["30(?:0[1-9]|[15-7]\\d|2[047]|89)\\d{4}", [8]], ["7(?:1(?:0[0-38]|1[0-3679]|3[013]|69|9[0136])|2(?:[02389]\\d|1[18]|7[27-9])|3(?:[0-38]\\d|7[0-369]|9[2357-9])|47\\d|5(?:[178]\\d|5[0-5])|6(?:0[0-7]|2[236-9]|[35]\\d)|7(?:[27]\\d|8[7-9])|8(?:[23689]\\d|7[1-9])|9(?:[025]\\d|6[0-246-8]|7[0-36-9]|8[238]))\\d{4}", [8]]], "00"], "HN": ["504", "00", "8\\d{10}|[237-9]\\d{7}", [8, 11], [["(\\d{4})(\\d{4})", "$1-$2", ["[237-9]"]]], 0, 0, 0, 0, 0, 0, [["2(?:2(?:0[0-359]|1[1-367]|[23]\\d|4[03-6]|5[57]|6[245]|7[0135689]|8[01346-9]|9[0-2])|4(?:0[78]|2[3-59]|3[13-9]|4[0-68]|5[1-35])|5(?:0[7-9]|16|4[03-5]|5\\d|6[014-6]|7[04]|80)|6(?:[056]\\d|17|2[067]|3[04]|4[0-378]|[78][0-8]|9[01])|7(?:6[46-9]|7[02-9]|8[034]|91)|8(?:79|8[0-357-9]|9[1-57-9]))\\d{4}", [8]], ["[37-9]\\d{7}", [8]], ["8002\\d{7}", [11]]]], "HR": ["385", "00", "(?:[24-69]\\d|3[0-79])\\d{7}|80\\d{5,7}|[1-79]\\d{7}|6\\d{5,6}", [6, 7, 8, 9], [["(\\d{2})(\\d{2})(\\d{2,3})", "$1 $2 $3", ["6[01]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2,3})", "$1 $2 $3", ["8"], "0$1"], ["(\\d)(\\d{4})(\\d{3})", "$1 $2 $3", ["1"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[67]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["9"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[2-5]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["8"], "0$1"]], "0", 0, 0, 0, 0, 0, [["1\\d{7}|(?:2[0-3]|3[1-5]|4[02-47-9]|5[1-3])\\d{6,7}", [8, 9]], ["98\\d{6,7}|975(?:1\\d|77|9[67])\\d{4}|9(?:0[1-9]|[1259]\\d|7[0679])\\d{6}", [8, 9]], ["80[01]\\d{4,6}", [7, 8, 9]], ["6[01459]\\d{6}|6[01]\\d{4,5}", [6, 7, 8]], ["7[45]\\d{6}", [8]], 0, ["62\\d{6,7}|72\\d{6}", [8, 9]]]], "HT": ["509", "00", "[2-489]\\d{7}", [8], [["(\\d{2})(\\d{2})(\\d{4})", "$1 $2 $3", ["[2-489]"]]], 0, 0, 0, 0, 0, 0, [["2(?:2\\d|5[1-5]|81|9[149])\\d{5}"], ["[34]\\d{7}"], ["8\\d{7}"], 0, 0, 0, 0, 0, ["9(?:[67][0-4]|8[0-3589]|9\\d)\\d{5}"]]], "HU": ["36", "00", "[235-7]\\d{8}|[1-9]\\d{7}", [8, 9], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["1"], "(06 $1)"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[27][2-9]|3[2-7]|4[24-9]|5[2-79]|6|8[2-57-9]|9[2-69]"], "(06 $1)"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[2-9]"], "06 $1"]], "06", 0, 0, 0, 0, 0, [["(?:1\\d|[27][2-9]|3[2-7]|4[24-9]|5[2-79]|6[23689]|8[2-57-9]|9[2-69])\\d{6}", [8]], ["(?:[257]0|3[01])\\d{7}", [9]], ["(?:[48]0\\d|680[29])\\d{5}"], ["9[01]\\d{6}", [8]], 0, 0, ["38\\d{7}", [9]], 0, ["21\\d{7}", [9]]]], "ID": ["62", "00[89]", "(?:(?:00[1-9]|8\\d)\\d{4}|[1-36])\\d{6}|00\\d{10}|[1-9]\\d{8,10}|[2-9]\\d{7}", [7, 8, 9, 10, 11, 12, 13], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["15"]], ["(\\d{2})(\\d{5,9})", "$1 $2", ["2[124]|[36]1"], "(0$1)"], ["(\\d{3})(\\d{5,7})", "$1 $2", ["800"], "0$1"], ["(\\d{3})(\\d{5,8})", "$1 $2", ["[2-79]"], "(0$1)"], ["(\\d{3})(\\d{3,4})(\\d{3})", "$1-$2-$3", ["8[1-35-9]"], "0$1"], ["(\\d{3})(\\d{6,8})", "$1 $2", ["1"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["804"], "0$1"], ["(\\d{3})(\\d)(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["80"], "0$1"], ["(\\d{3})(\\d{4})(\\d{4,5})", "$1-$2-$3", ["8"], "0$1"]], "0", 0, 0, 0, 0, 0, [["2[124]\\d{7,8}|619\\d{8}|2(?:1(?:14|500)|2\\d{3})\\d{3}|61\\d{5,8}|(?:2(?:[35][1-4]|6[0-8]|7[1-6]|8\\d|9[1-8])|3(?:1|[25][1-8]|3[1-68]|4[1-3]|6[1-3568]|7[0-469]|8\\d)|4(?:0[1-589]|1[01347-9]|2[0-36-8]|3[0-24-68]|43|5[1-378]|6[1-5]|7[134]|8[1245])|5(?:1[1-35-9]|2[25-8]|3[124-9]|4[1-3589]|5[1-46]|6[1-8])|6(?:[25]\\d|3[1-69]|4[1-6])|7(?:02|[125][1-9]|[36]\\d|4[1-8]|7[0-36-9])|9(?:0[12]|1[013-8]|2[0-479]|5[125-8]|6[23679]|7[159]|8[01346]))\\d{5,8}", [7, 8, 9, 10, 11]], ["8[1-35-9]\\d{7,10}", [9, 10, 11, 12]], ["00[17]803\\d{7}|(?:177\\d|800)\\d{5,7}|001803\\d{6}", [8, 9, 10, 11, 12, 13]], ["809\\d{7}", [10]], 0, 0, ["(?:1500|8071\\d{3})\\d{3}", [7, 10]], 0, 0, ["804\\d{7}", [10]]]], "IE": ["353", "00", "(?:1\\d|[2569])\\d{6,8}|4\\d{6,9}|7\\d{8}|8\\d{8,9}", [7, 8, 9, 10], [["(\\d{2})(\\d{5})", "$1 $2", ["2[24-9]|47|58|6[237-9]|9[35-9]"], "(0$1)"], ["(\\d{3})(\\d{5})", "$1 $2", ["[45]0"], "(0$1)"], ["(\\d)(\\d{3,4})(\\d{4})", "$1 $2 $3", ["1"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[2569]|4[1-69]|7[14]"], "(0$1)"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["70"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["81"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[78]"], "0$1"], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["1"]], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["4"], "(0$1)"], ["(\\d{2})(\\d)(\\d{3})(\\d{4})", "$1 $2 $3 $4", ["8"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:1\\d|21)\\d{6,7}|(?:2[24-9]|4(?:0[24]|5\\d|7)|5(?:0[45]|1\\d|8)|6(?:1\\d|[237-9])|9(?:1\\d|[35-9]))\\d{5}|(?:23|4(?:[1-469]|8\\d)|5[23679]|6[4-6]|7[14]|9[04])\\d{7}"], ["8(?:22|[35-9]\\d)\\d{6}", [9]], ["1800\\d{6}", [10]], ["15(?:1[2-8]|[2-8]0|9[089])\\d{6}", [10]], ["700\\d{6}", [9]], 0, ["818\\d{6}", [9]], 0, ["76\\d{7}", [9]], ["18[59]0\\d{6}", [10]]]], "IL": ["972", "0(?:0|1[2-9])", "1\\d{6}(?:\\d{3,5})?|[57]\\d{8}|[1-489]\\d{7}", [7, 8, 9, 10, 11, 12], [["(\\d{4})(\\d{3})", "$1-$2", ["125"]], ["(\\d{4})(\\d{2})(\\d{2})", "$1-$2-$3", ["121"]], ["(\\d)(\\d{3})(\\d{4})", "$1-$2-$3", ["[2-489]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1-$2-$3", ["[57]"], "0$1"], ["(\\d{4})(\\d{3})(\\d{3})", "$1-$2-$3", ["12"]], ["(\\d{4})(\\d{6})", "$1-$2", ["159"]], ["(\\d)(\\d{3})(\\d{3})(\\d{3})", "$1-$2-$3-$4", ["1[7-9]"]], ["(\\d{3})(\\d{1,2})(\\d{3})(\\d{4})", "$1-$2 $3-$4", ["15"]]], "0", 0, 0, 0, 0, 0, [["153\\d{8,9}|29[1-9]\\d{5}|(?:2[0-8]|[3489]\\d)\\d{6}", [8, 11, 12]], ["5(?:(?:[02368]\\d|[19][2-9]|4[1-9])\\d|5(?:01|1[79]|2[2-9]|3[0-3]|4[34]|5[015689]|6[6-8]|7[0-267]|8[7-9]|9[1-9]))\\d{5}", [9]], ["1(?:255|80[019]\\d{3})\\d{3}", [7, 10]], ["1212\\d{4}|1(?:200|9(?:0[0-2]|19))\\d{6}", [8, 10]], 0, 0, ["1599\\d{6}", [10]], 0, ["7(?:380|8(?:33|55|77|81))\\d{5}|7(?:18|2[23]|3[237]|47|6[258]|7\\d|82|9[2-9])\\d{6}", [9]], ["1700\\d{6}", [10]]]], "IM": ["44", "00", "1624\\d{6}|(?:[3578]\\d|90)\\d{8}", [10], 0, "0", 0, "0|([25-8]\\d{5})$", "1624$1", 0, "74576|(?:16|7[56])24", [["1624(?:230|[5-8]\\d\\d)\\d{3}"], ["76245[06]\\d{4}|7(?:4576|[59]24\\d|624[0-4689])\\d{5}"], ["808162\\d{4}"], ["8(?:440[49]06|72299\\d)\\d{3}|(?:8(?:45|70)|90[0167])624\\d{4}"], ["70\\d{8}"], 0, ["3440[49]06\\d{3}|(?:3(?:08162|3\\d{4}|45624|7(?:0624|2299))|55\\d{4})\\d{4}"], 0, ["56\\d{8}"]]], "IN": ["91", "00", "(?:000800|[2-9]\\d\\d)\\d{7}|1\\d{7,12}", [8, 9, 10, 11, 12, 13], [["(\\d{8})", "$1", ["5(?:0|2[23]|3[03]|[67]1|88)", "5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|888)", "5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|8888)"], 0, 1], ["(\\d{4})(\\d{4,5})", "$1 $2", ["180", "1800"], 0, 1], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["140"], 0, 1], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["11|2[02]|33|4[04]|79[1-7]|80[2-46]", "11|2[02]|33|4[04]|79(?:[1-6]|7[19])|80(?:[2-4]|6[0-589])", "11|2[02]|33|4[04]|79(?:[124-6]|3(?:[02-9]|1[0-24-9])|7(?:1|9[1-6]))|80(?:[2-4]|6[0-589])"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["1(?:2[0-249]|3[0-25]|4[145]|[68]|7[1257])|2(?:1[257]|3[013]|4[01]|5[0137]|6[0158]|78|8[1568])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|5[12]|[78]1)|6(?:12|[2-4]1|5[17]|6[13]|80)|7(?:12|3[134]|4[47]|61|88)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91)|(?:43|59|75)[15]|(?:1[59]|29|67|72)[14]", "1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|674|7(?:(?:2[14]|3[34]|5[15])[2-6]|61[346]|88[0-8])|8(?:70[2-6]|84[235-7]|91[3-7])|(?:1(?:29|60|8[06])|261|552|6(?:12|[2-47]1|5[17]|6[13]|80)|7(?:12|31|4[47])|8(?:16|2[014]|3[126]|6[136]|7[78]|83))[2-7]", "1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|6(?:12(?:[2-6]|7[0-8])|74[2-7])|7(?:(?:2[14]|5[15])[2-6]|3171|61[346]|88(?:[2-7]|82))|8(?:70[2-6]|84(?:[2356]|7[19])|91(?:[3-6]|7[19]))|73[134][2-6]|(?:74[47]|8(?:16|2[014]|3[126]|6[136]|7[78]|83))(?:[2-6]|7[19])|(?:1(?:29|60|8[06])|261|552|6(?:[2-4]1|5[17]|6[13]|7(?:1|4[0189])|80)|7(?:12|88[01]))[2-7]"], "0$1", 1], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2[2457-9]|3[2-5]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1[013-9]|28|3[129]|4[1-35689]|5[29]|6[02-5]|70)|807", "1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2(?:[2457]|84|95)|3(?:[2-4]|55)|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1(?:[013-8]|9[6-9])|28[6-8]|3(?:17|2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4|5[0-367])|70[13-7])|807[19]", "1(?:[2-479]|5(?:[0236-9]|5[013-9]))|[2-5]|6(?:2(?:84|95)|355|83)|73179|807(?:1|9[1-3])|(?:1552|6(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[124-6])\\d|7(?:1(?:[013-8]\\d|9[6-9])|28[6-8]|3(?:2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]\\d|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4\\d|5[0-367])|70[13-7]))[2-7]"], "0$1", 1], ["(\\d{5})(\\d{5})", "$1 $2", ["[6-9]"], "0$1", 1], ["(\\d{4})(\\d{2,4})(\\d{4})", "$1 $2 $3", ["1(?:6|8[06])", "1(?:6|8[06]0)"], 0, 1], ["(\\d{4})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["18"], 0, 1]], "0", 0, 0, 0, 0, 0, [["2717(?:[2-7]\\d|95)\\d{4}|(?:271[0-689]|782[0-6])[2-7]\\d{5}|(?:170[24]|2(?:(?:[02][2-79]|90)\\d|80[13468])|(?:3(?:23|80)|683|79[1-7])\\d|4(?:20[24]|72[2-8])|552[1-7])\\d{6}|(?:11|33|4[04]|80)[2-7]\\d{7}|(?:342|674|788)(?:[0189][2-7]|[2-7]\\d)\\d{5}|(?:1(?:2[0-249]|3[0-25]|4[145]|[59][14]|6[014]|7[1257]|8[01346])|2(?:1[257]|3[013]|4[01]|5[0137]|6[0158]|78|8[1568]|9[14])|3(?:26|4[13]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[014-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|6(?:12|[2-47]1|5[17]|6[13]|80)|7(?:12|2[14]|3[134]|4[47]|5[15]|[67]1)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91))[2-7]\\d{6}|(?:1(?:2[35-8]|3[346-9]|4[236-9]|[59][0235-9]|6[235-9]|7[34689]|8[257-9])|2(?:1[134689]|3[24-8]|4[2-8]|5[25689]|6[2-4679]|7[3-79]|8[2-479]|9[235-9])|3(?:01|1[79]|2[1245]|4[5-8]|5[125689]|6[235-7]|7[157-9]|8[2-46-8])|4(?:1[14578]|2[5689]|3[2-467]|5[4-7]|6[35]|73|8[2689]|9[2389])|5(?:[16][146-9]|2[14-8]|3[1346]|4[14-69]|5[46]|7[2-4]|8[2-8]|9[246])|6(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[124-6])|7(?:1[013-9]|2[0235-9]|3[2679]|4[1-35689]|5[2-46-9]|[67][02-9]|8[013-7]|9[089])|8(?:1[1357-9]|2[235-8]|3[03-57-9]|4[0-24-9]|5\\d|6[2457-9]|7[1-6]|8[1256]|9[2-4]))\\d[2-7]\\d{5}", [10]], ["(?:61279|7(?:887[02-9]|9(?:313|79[07-9]))|8(?:079[04-9]|(?:84|91)7[02-8]))\\d{5}|(?:6(?:12|[2-47]1|5[17]|6[13]|80)[0189]|7(?:1(?:2[0189]|9[0-5])|2(?:[14][017-9]|8[0-59])|3(?:2[5-8]|[34][017-9]|9[016-9])|4(?:1[015-9]|[29][89]|39|8[389])|5(?:[15][017-9]|2[04-9]|9[7-9])|6(?:0[0-47]|1[0-257-9]|2[0-4]|3[19]|5[4589])|70[0289]|88[089]|97[02-8])|8(?:0(?:6[67]|7[02-8])|70[017-9]|84[01489]|91[0-289]))\\d{6}|(?:7(?:31|4[47])|8(?:16|2[014]|3[126]|6[136]|7[78]|83))(?:[0189]\\d|7[02-8])\\d{5}|(?:6(?:[09]\\d|1[04679]|2[03689]|3[05-9]|4[0489]|50|6[069]|7[07]|8[7-9])|7(?:0\\d|2[0235-79]|3[05-8]|40|5[0346-8]|6[6-9]|7[1-9]|8[0-79]|9[089])|8(?:0[01589]|1[0-57-9]|2[235-9]|3[03-57-9]|[45]\\d|6[02457-9]|7[1-69]|8[0-25-9]|9[02-9])|9\\d\\d)\\d{7}|(?:6(?:(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578]|8[124-6])\\d|7(?:[235689]\\d|4[0189]))|7(?:1(?:[013-8]\\d|9[6-9])|28[6-8]|3(?:2[0-49]|9[2-5])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]\\d|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4\\d|5[0-367])|70[13-7]|881))[0189]\\d{5}", [10]], ["000800\\d{7}|1(?:600\\d{6}|80(?:0\\d{4,9}|3\\d{9}))"], ["186[12]\\d{9}", [13]], 0, 0, ["140\\d{7}", [10]], 0, 0, ["1860\\d{7}", [11]]]], "IO": ["246", "00", "3\\d{6}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["3"]]], 0, 0, 0, 0, 0, 0, [["37\\d{5}"], ["38\\d{5}"]]], "IQ": ["964", "00", "(?:1|7\\d\\d)\\d{7}|[2-6]\\d{7,8}", [8, 9, 10], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["1"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[2-6]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["7"], "0$1"]], "0", 0, 0, 0, 0, 0, [["1\\d{7}|(?:2[13-5]|3[02367]|4[023]|5[03]|6[026])\\d{6,7}", [8, 9]], ["7[3-9]\\d{8}", [10]]]], "IR": ["98", "00", "[1-9]\\d{9}|(?:[1-8]\\d\\d|9)\\d{3,4}", [4, 5, 6, 7, 10], [["(\\d{4,5})", "$1", ["96"], "0$1"], ["(\\d{2})(\\d{4,5})", "$1 $2", ["(?:1[137]|2[13-68]|3[1458]|4[145]|5[1468]|6[16]|7[1467]|8[13467])[12689]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["9"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["[1-8]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:1[137]|2[13-68]|3[1458]|4[145]|5[1468]|6[16]|7[1467]|8[13467])(?:[03-57]\\d{7}|[16]\\d{3}(?:\\d{4})?|[289]\\d{3}(?:\\d(?:\\d{3})?)?)|94(?:000[09]|2(?:121|[2689]0\\d)|30[0-2]\\d|4(?:111|40\\d))\\d{4}", [6, 7, 10]], ["9(?:(?:0(?:[0-35]\\d|4[4-6])|(?:[13]\\d|2[0-3])\\d)\\d|9(?:[0-46]\\d\\d|5[15]0|8(?:1\\d|88)|9(?:0[0-3]|[19]\\d|21|77|8[7-9])))\\d{5}", [10]], 0, 0, 0, 0, ["96(?:0[12]|2[16-8]|3(?:08|[14]5|[23]|66)|4(?:0|80)|5[01]|6[89]|86|9[19])", [4, 5]]]], "IS": ["354", "00|1(?:0(?:01|[12]0)|100)", "(?:38\\d|[4-9])\\d{6}", [7, 9], [["(\\d{3})(\\d{4})", "$1 $2", ["[4-9]"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["3"]]], 0, 0, 0, 0, 0, 0, [["(?:4(?:1[0-24-69]|2[0-7]|[37][0-8]|4[0-24589]|5[0-68]|6\\d|8[0-36-8])|5(?:05|[156]\\d|2[02578]|3[0-579]|4[03-7]|7[0-2578]|8[0-35-9]|9[013-689])|872)\\d{4}", [7]], ["(?:38[589]\\d\\d|6(?:1[1-8]|2[0-6]|3[026-9]|4[014679]|5[0159]|6[0-69]|70|8[06-8]|9\\d)|7(?:5[057]|[6-9]\\d)|8(?:2[0-59]|[3-69]\\d|8[238]))\\d{4}"], ["80[0-8]\\d{4}", [7]], ["90(?:0\\d|1[5-79]|2[015-79]|3[135-79]|4[125-7]|5[25-79]|7[1-37]|8[0-35-7])\\d{3}", [7]], 0, 0, ["809\\d{4}", [7]], 0, ["49[0-24-79]\\d{4}", [7]]], "00"], "IT": ["39", "00", "0\\d{5,10}|1\\d{8,10}|3(?:[0-8]\\d{7,10}|9\\d{7,8})|(?:55|70)\\d{8}|8\\d{5}(?:\\d{2,4})?", [6, 7, 8, 9, 10, 11], [["(\\d{2})(\\d{4,6})", "$1 $2", ["0[26]"]], ["(\\d{3})(\\d{3,6})", "$1 $2", ["0[13-57-9][0159]|8(?:03|4[17]|9[2-5])", "0[13-57-9][0159]|8(?:03|4[17]|9(?:2|3[04]|[45][0-4]))"]], ["(\\d{4})(\\d{2,6})", "$1 $2", ["0(?:[13-579][2-46-8]|8[236-8])"]], ["(\\d{4})(\\d{4})", "$1 $2", ["894"]], ["(\\d{2})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["0[26]|5"]], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["1(?:44|[679])|[378]"]], ["(\\d{3})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["0[13-57-9][0159]|14"]], ["(\\d{2})(\\d{4})(\\d{5})", "$1 $2 $3", ["0[26]"]], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["0"]], ["(\\d{3})(\\d{4})(\\d{4,5})", "$1 $2 $3", ["3"]]], 0, 0, 0, 0, 0, 0, [["0669[0-79]\\d{1,6}|0(?:1(?:[0159]\\d|[27][1-5]|31|4[1-4]|6[1356]|8[2-57])|2\\d\\d|3(?:[0159]\\d|2[1-4]|3[12]|[48][1-6]|6[2-59]|7[1-7])|4(?:[0159]\\d|[23][1-9]|4[245]|6[1-5]|7[1-4]|81)|5(?:[0159]\\d|2[1-5]|3[2-6]|4[1-79]|6[4-6]|7[1-578]|8[3-8])|6(?:[0-57-9]\\d|6[0-8])|7(?:[0159]\\d|2[12]|3[1-7]|4[2-46]|6[13569]|7[13-6]|8[1-59])|8(?:[0159]\\d|2[3-578]|3[1-356]|[6-8][1-5])|9(?:[0159]\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\d{2,7}"], ["3[1-9]\\d{8}|3[2-9]\\d{7}", [9, 10]], ["80(?:0\\d{3}|3)\\d{3}", [6, 9]], ["(?:0878\\d{3}|89(?:2\\d|3[04]|4(?:[0-4]|[5-9]\\d\\d)|5[0-4]))\\d\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\d{6}", [6, 8, 9, 10]], ["1(?:78\\d|99)\\d{6}", [9, 10]], 0, 0, 0, ["55\\d{8}", [10]], ["84(?:[08]\\d{3}|[17])\\d{3}", [6, 9]]]], "JE": ["44", "00", "1534\\d{6}|(?:[3578]\\d|90)\\d{8}", [10], 0, "0", 0, "0|([0-24-8]\\d{5})$", "1534$1", 0, 0, [["1534[0-24-8]\\d{5}"], ["7(?:(?:(?:50|82)9|937)\\d|7(?:00[378]|97[7-9]))\\d{5}"], ["80(?:07(?:35|81)|8901)\\d{4}"], ["(?:8(?:4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|90(?:066[59]|1810|71(?:07|55)))\\d{4}"], ["701511\\d{4}"], 0, ["(?:3(?:0(?:07(?:35|81)|8901)|3\\d{4}|4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|55\\d{4})\\d{4}"], ["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}"], ["56\\d{8}"]]], "JM": ["1", "011", "(?:[58]\\d\\d|658|900)\\d{7}", [10], 0, "1", 0, 0, 0, 0, "658|876", [["8766060\\d{3}|(?:658(?:2(?:[0-8]\\d|9[0-46-9])|[3-9]\\d\\d)|876(?:52[35]|6(?:0[1-3579]|1[02357-9]|[23]\\d|40|5[06]|6[2-589]|7[025-7]|8[04]|9[4-9])|7(?:0[2-689]|[1-6]\\d|8[056]|9[45])|9(?:0[1-8]|1[02378]|[2-8]\\d|9[2-468])))\\d{4}"], ["(?:658295|876(?:2(?:0[1-9]|[13-9]\\d|2[013-9])|[348]\\d\\d|5(?:0[1-9]|[1-9]\\d)|6(?:4[89]|6[67])|7(?:0[07]|7\\d|8[1-47-9]|9[0-36-9])|9(?:[01]9|9[0579])))\\d{4}"], ["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"], ["900[2-9]\\d{6}"], ["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"]]], "JO": ["962", "00", "(?:(?:[2689]|7\\d)\\d|32|53)\\d{6}", [8, 9], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["[2356]|87"], "(0$1)"], ["(\\d{3})(\\d{5,6})", "$1 $2", ["[89]"], "0$1"], ["(\\d{2})(\\d{7})", "$1 $2", ["70"], "0$1"], ["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["7"], "0$1"]], "0", 0, 0, 0, 0, 0, [["87(?:000|90[01])\\d{3}|(?:2(?:6(?:2[0-35-9]|3[0-578]|4[24-7]|5[0-24-8]|[6-8][023]|9[0-3])|7(?:0[1-79]|10|2[014-7]|3[0-689]|4[019]|5[0-3578]))|32(?:0[1-69]|1[1-35-7]|2[024-7]|3\\d|4[0-3]|[5-7][023])|53(?:0[0-3]|[13][023]|2[0-59]|49|5[0-35-9]|6[15]|7[45]|8[1-6]|9[0-36-9])|6(?:2(?:[05]0|22)|3(?:00|33)|4(?:0[0-25]|1[2-7]|2[0569]|[38][07-9]|4[025689]|6[0-589]|7\\d|9[0-2])|5(?:[01][056]|2[034]|3[0-57-9]|4[178]|5[0-69]|6[0-35-9]|7[1-379]|8[0-68]|9[0239]))|87(?:20|7[078]|99))\\d{4}", [8]], ["7(?:[78][0-25-9]|9\\d)\\d{6}", [9]], ["80\\d{6}", [8]], ["9\\d{7}", [8]], ["70\\d{7}", [9]], 0, ["8(?:10|8\\d)\\d{5}", [8]], ["74(?:66|77)\\d{5}", [9]], 0, ["85\\d{6}", [8]]]], "JP": ["81", "010", "00[1-9]\\d{6,14}|[257-9]\\d{9}|(?:00|[1-9]\\d\\d)\\d{6}", [8, 9, 10, 11, 12, 13, 14, 15, 16, 17], [["(\\d{3})(\\d{3})(\\d{3})", "$1-$2-$3", ["(?:12|57|99)0"], "0$1"], ["(\\d{4})(\\d)(\\d{4})", "$1-$2-$3", ["1(?:26|3[79]|4[56]|5[4-68]|6[3-5])|499|5(?:76|97)|746|8(?:3[89]|47|51|63)|9(?:80|9[16])", "1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:76|97)9|7468|8(?:3(?:8[7-9]|96)|477|51[2-9]|636)|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]", "1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:769|979[2-69])|7468|8(?:3(?:8[7-9]|96[2457-9])|477|51[2-9]|636[457-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1-$2-$3", ["60"], "0$1"], ["(\\d)(\\d{4})(\\d{4})", "$1-$2-$3", ["[36]|4(?:2[09]|7[01])", "[36]|4(?:2(?:0|9[02-69])|7(?:0[019]|1))"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1-$2-$3", ["1(?:1|5[45]|77|88|9[69])|2(?:2[1-37]|3[0-269]|4[59]|5|6[24]|7[1-358]|8[1369]|9[0-38])|4(?:[28][1-9]|3[0-57]|[45]|6[248]|7[2-579]|9[29])|5(?:2|3[045]|4[0-369]|5[29]|8[02389]|9[0-389])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9[2-6])|8(?:2[124589]|3[27-9]|49|51|6|7[0-468]|8[68]|9[019])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9[1-489])", "1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2(?:[127]|3[014-9])|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9[19])|62|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|8[1-9])|5(?:2|3[045]|4[0-369]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0-2469])|49|51|6(?:[0-24]|36|5[0-3589]|72|9[01459])|7[0-468]|8[68])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3[34]|4[0178]))|(?:49|55|83)[29]|(?:264|837)[016-9]|2(?:57|93)[015-9]|(?:25[0468]|422|838)[01]|(?:47[59]|59[89]|8(?:6[68]|9))[019]", "1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3[045]|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0169])|3(?:[29]|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[23]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|72|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:8294|96)[1-3]|2(?:57|93)[015-9]|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|8292|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]", "1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|7[015-9]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17|3[015-9]))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3[045]|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9(?:[019]|4[1-3]|6(?:[0-47-9]|5[01346-9])))|3(?:[29]|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[23]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|72|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|829(?:2|66)|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{4})", "$1-$2-$3", ["[14]|[289][2-9]|5[3-9]|7[2-4679]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1-$2-$3", ["800"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4})", "$1-$2-$3", ["[257-9]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:1(?:1[235-8]|2[3-6]|3[3-9]|4[2-6]|[58][2-8]|6[2-7]|7[2-9]|9[1-9])|(?:2[2-9]|[36][1-9])\\d|4(?:[2-578]\\d|6[02-8]|9[2-59])|5(?:[2-589]\\d|6[1-9]|7[2-8])|7(?:[25-9]\\d|3[4-9]|4[02-9])|8(?:[2679]\\d|3[2-9]|4[5-9]|5[1-9]|8[03-9])|9(?:[2-58]\\d|[679][1-9]))\\d{6}", [9]], ["[7-9]0[1-9]\\d{7}", [10]], ["00777(?:[01]|5\\d)\\d\\d|(?:00(?:7778|882[1245])|(?:120|800\\d)\\d\\d)\\d{4}|00(?:37|66|78)\\d{6,13}"], ["990\\d{6}", [9]], ["60\\d{7}", [9]], 0, ["570\\d{6}", [9]], ["20\\d{8}", [10]], ["50[1-9]\\d{7}", [10]]]], "KE": ["254", "000", "(?:[17]\\d\\d|900)\\d{6}|(?:2|80)0\\d{6,7}|[4-6]\\d{6,8}", [7, 8, 9, 10], [["(\\d{2})(\\d{5,7})", "$1 $2", ["[24-6]"], "0$1"], ["(\\d{3})(\\d{6})", "$1 $2", ["[17]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[89]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:4[245]|5[1-79]|6[01457-9])\\d{5,7}|(?:4[136]|5[08]|62)\\d{7}|(?:[24]0|66)\\d{6,7}", [7, 8, 9]], ["(?:1(?:0[0-6]|1[0-5]|2[014]|30)|7\\d\\d)\\d{6}", [9]], ["800[2-8]\\d{5,6}", [9, 10]], ["900[02-9]\\d{5}", [9]]]], "KG": ["996", "00", "8\\d{9}|(?:[235-8]\\d|99)\\d{7}", [9, 10], [["(\\d{4})(\\d{5})", "$1 $2", ["3(?:1[346]|[24-79])"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[235-79]|88"], "0$1"], ["(\\d{3})(\\d{3})(\\d)(\\d{2,3})", "$1 $2 $3 $4", ["8"], "0$1"]], "0", 0, 0, 0, 0, 0, [["312(?:5[0-79]\\d|9(?:[0-689]\\d|7[0-24-9]))\\d{3}|(?:3(?:1(?:2[0-46-8]|3[1-9]|47|[56]\\d)|2(?:22|3[0-479]|6[0-7])|4(?:22|5[6-9]|6\\d)|5(?:22|3[4-7]|59|6\\d)|6(?:22|5[35-7]|6\\d)|7(?:22|3[468]|4[1-9]|59|[67]\\d)|9(?:22|4[1-8]|6\\d))|6(?:09|12|2[2-4])\\d)\\d{5}", [9]], ["312(?:58\\d|973)\\d{3}|(?:2(?:0[0-35]|2\\d)|5[0-24-7]\\d|7(?:[07]\\d|55)|88[08]|99[05-9])\\d{6}", [9]], ["800\\d{6,7}"]]], "KH": ["855", "00[14-9]", "1\\d{9}|[1-9]\\d{7,8}", [8, 9, 10], [["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[1-9]"], "0$1"], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["1"]]], "0", 0, 0, 0, 0, 0, [["23(?:4(?:[2-4]|[56]\\d)|[568]\\d\\d)\\d{4}|23[236-9]\\d{5}|(?:2[4-6]|3[2-6]|4[2-4]|[5-7][2-5])(?:(?:[237-9]|4[56]|5\\d)\\d{5}|6\\d{5,6})", [8, 9]], ["(?:(?:1[28]|3[18]|9[67])\\d|6[016-9]|7(?:[07-9]|[16]\\d)|8(?:[013-79]|8\\d))\\d{6}|(?:1\\d|9[0-57-9])\\d{6}|(?:2[3-6]|3[2-6]|4[2-4]|[5-7][2-5])48\\d{5}", [8, 9]], ["1800(?:1\\d|2[019])\\d{4}", [10]], ["1900(?:1\\d|2[09])\\d{4}", [10]]]], "KI": ["686", "00", "(?:[37]\\d|6[0-79])\\d{6}|(?:[2-48]\\d|50)\\d{3}", [5, 8], 0, "0", 0, 0, 0, 0, 0, [["(?:[24]\\d|3[1-9]|50|65(?:02[12]|12[56]|22[89]|[3-5]00)|7(?:27\\d\\d|3100|5(?:02[12]|12[56]|22[89]|[34](?:00|81)|500))|8[0-5])\\d{3}"], ["(?:63\\d{3}|73(?:0[0-5]\\d|140))\\d{3}|[67]200[01]\\d{3}", [8]], 0, 0, 0, 0, 0, 0, ["30(?:0[01]\\d\\d|12(?:11|20))\\d\\d", [8]]]], "KM": ["269", "00", "[3478]\\d{6}", [7], [["(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3", ["[3478]"]]], 0, 0, 0, 0, 0, 0, [["7[4-7]\\d{5}"], ["[34]\\d{6}"], 0, ["8\\d{6}"]]], "KN": ["1", "011", "(?:[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "1|([2-7]\\d{6})$", "869$1", 0, "869", [["869(?:2(?:29|36)|302|4(?:6[015-9]|70)|56[5-7])\\d{4}"], ["869(?:48[89]|55[6-8]|66\\d|76[02-7])\\d{4}"], ["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"], ["900[2-9]\\d{6}"], ["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"]]], "KP": ["850", "00|99", "85\\d{6}|(?:19\\d|[2-7])\\d{7}", [8, 10], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["8"], "0$1"], ["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["[2-7]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:(?:195|2)\\d|3[19]|4[159]|5[37]|6[17]|7[39]|85)\\d{6}"], ["19[1-3]\\d{7}", [10]]]], "KR": ["82", "00(?:[125689]|3(?:[46]5|91)|7(?:00|27|3|55|6[126]))", "00[1-9]\\d{8,11}|(?:[12]|5\\d{3})\\d{7}|[13-6]\\d{9}|(?:[1-6]\\d|80)\\d{7}|[3-6]\\d{4,5}|(?:00|7)0\\d{8}", [5, 6, 8, 9, 10, 11, 12, 13, 14], [["(\\d{2})(\\d{3,4})", "$1-$2", ["(?:3[1-3]|[46][1-4]|5[1-5])1"], "0$1"], ["(\\d{4})(\\d{4})", "$1-$2", ["1"]], ["(\\d)(\\d{3,4})(\\d{4})", "$1-$2-$3", ["2"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1-$2-$3", ["60|8"], "0$1"], ["(\\d{2})(\\d{3,4})(\\d{4})", "$1-$2-$3", ["[1346]|5[1-5]"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4})", "$1-$2-$3", ["[57]"], "0$1"], ["(\\d{2})(\\d{5})(\\d{4})", "$1-$2-$3", ["5"], "0$1"]], "0", 0, "0(8(?:[1-46-8]|5\\d\\d))?", 0, 0, 0, [["(?:2|3[1-3]|[46][1-4]|5[1-5])[1-9]\\d{6,7}|(?:3[1-3]|[46][1-4]|5[1-5])1\\d{2,3}", [5, 6, 8, 9, 10]], ["1(?:05(?:[0-8]\\d|9[0-6])|22[13]\\d)\\d{4,5}|1(?:0[1-46-9]|[16-9]\\d|2[013-9])\\d{6,7}", [9, 10]], ["00(?:308\\d{6,7}|798\\d{7,9})|(?:00368|80)\\d{7}", [9, 11, 12, 13, 14]], ["60[2-9]\\d{6}", [9]], ["50\\d{8,9}", [10, 11]], 0, ["1(?:5(?:22|33|44|66|77|88|99)|6(?:[07]0|44|6[168]|88)|8(?:00|33|55|77|99))\\d{4}", [8]], ["15\\d{7,8}", [9, 10]], ["70\\d{8}", [10]]]], "KW": ["965", "00", "18\\d{5}|(?:[2569]\\d|41)\\d{6}", [7, 8], [["(\\d{4})(\\d{3,4})", "$1 $2", ["[169]|2(?:[235]|4[1-35-9])|52"]], ["(\\d{3})(\\d{5})", "$1 $2", ["[245]"]]], 0, 0, 0, 0, 0, 0, [["2(?:[23]\\d\\d|4(?:[1-35-9]\\d|44)|5(?:0[034]|[2-46]\\d|5[1-3]|7[1-7]))\\d{4}", [8]], ["(?:41\\d\\d|5(?:(?:[05]\\d|1[0-7]|6[56])\\d|2(?:22|5[25])|7(?:55|77)|88[58])|6(?:(?:0[034679]|5[015-9]|6\\d)\\d|1(?:00|11|66)|222|3[36]3|444|7(?:0[013-9]|[67]\\d)|888|9(?:[069]\\d|3[039]))|9(?:(?:0[09]|22|[4679]\\d|8[057-9])\\d|1(?:1[01]|99)|3(?:00|33)|5(?:00|5\\d)))\\d{4}", [8]], ["18\\d{5}", [7]]]], "KY": ["1", "011", "(?:345|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "1|([2-9]\\d{6})$", "345$1", 0, "345", [["345(?:2(?:22|3[23]|44|66)|333|444|6(?:23|38|40)|7(?:30|4[35-79]|6[6-9]|77)|8(?:00|1[45]|[48]8)|9(?:14|4[035-9]))\\d{4}"], ["345(?:32[1-9]|42[0-4]|5(?:1[67]|2[5-79]|4[6-9]|50|76)|649|82[56]|9(?:1[679]|2[2-9]|3[06-9]|90))\\d{4}"], ["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"], ["(?:345976|900[2-9]\\d\\d)\\d{4}"], ["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"], 0, 0, ["345849\\d{4}"]]], "KZ": ["7", "810", "(?:33622|8\\d{8})\\d{5}|[78]\\d{9}", [10, 14], 0, "8", 0, 0, 0, 0, "33|7", [["(?:33622|7(?:1(?:0(?:[23]\\d|4[0-3]|59|63)|1(?:[23]\\d|4[0-79]|59)|2(?:[23]\\d|59)|3(?:2\\d|3[0-79]|4[0-35-9]|59)|4(?:[24]\\d|3[013-9]|5[1-9])|5(?:2\\d|3[1-9]|4[0-7]|59)|6(?:[2-4]\\d|5[19]|61)|72\\d|8(?:[27]\\d|3[1-46-9]|4[0-5]))|2(?:1(?:[23]\\d|4[46-9]|5[3469])|2(?:2\\d|3[0679]|46|5[12679])|3(?:[2-4]\\d|5[139])|4(?:2\\d|3[1-35-9]|59)|5(?:[23]\\d|4[0-246-8]|59|61)|6(?:2\\d|3[1-9]|4[0-4]|59)|7(?:[2379]\\d|40|5[279])|8(?:[23]\\d|4[0-3]|59)|9(?:2\\d|3[124578]|59))))\\d{5}", [10]], ["7(?:0[0-25-8]|47|6[0-4]|7[15-8]|85)\\d{7}", [10]], ["8(?:00|108\\d{3})\\d{7}"], ["809\\d{7}", [10]], ["808\\d{7}", [10]], 0, 0, 0, ["751\\d{7}", [10]]], "8~10"], "LA": ["856", "00", "[23]\\d{9}|3\\d{8}|(?:[235-8]\\d|41)\\d{6}", [8, 9, 10], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["2[13]|3[14]|[4-8]"], "0$1"], ["(\\d{2})(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3 $4", ["30[013-9]"], "0$1"], ["(\\d{2})(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["[23]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:2[13]|[35-7][14]|41|8[1468])\\d{6}", [8]], ["(?:20(?:[239]\\d|5[24-9]|7[6-8]|88)|302\\d)\\d{6}", [10]], 0, 0, 0, 0, ["30[013-9]\\d{6}", [9]]]], "LB": ["961", "00", "[27-9]\\d{7}|[13-9]\\d{6}", [7, 8], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["[13-69]|7(?:[2-57]|62|8[0-7]|9[04-9])|8[02-9]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[27-9]"]]], "0", 0, 0, 0, 0, 0, [["7(?:62|8[0-7]|9[04-9])\\d{4}|(?:[14-69]\\d|2(?:[14-69]\\d|[78][1-9])|7[2-57]|8[02-9])\\d{5}"], ["793(?:[01]\\d|2[0-4])\\d{3}|(?:(?:3|81)\\d|7(?:[01]\\d|6[013-9]|8[89]|9[12]))\\d{5}"], 0, ["9[01]\\d{6}", [8]], 0, 0, 0, 0, 0, ["80\\d{6}", [8]]]], "LC": ["1", "011", "(?:[58]\\d\\d|758|900)\\d{7}", [10], 0, "1", 0, "1|([2-8]\\d{6})$", "758$1", 0, "758", [["758(?:234|4(?:30|5\\d|6[2-9]|8[0-2])|57[0-2]|(?:63|75)8)\\d{4}"], ["758(?:28[4-7]|384|4(?:6[01]|8[4-9])|5(?:1[89]|20|84)|7(?:1[2-9]|2\\d|3[0-3])|812)\\d{4}"], ["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"], ["900[2-9]\\d{6}"], ["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"]]], "LI": ["423", "00", "[68]\\d{8}|(?:[2378]\\d|90)\\d{5}", [7, 9], [["(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3", ["[2379]|8(?:0[09]|7)", "[2379]|8(?:0(?:02|9)|7)"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["8"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["69"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["6"]]], "0", 0, "0|(1001)", 0, 0, 0, [["(?:2(?:01|1[27]|2[02]|3\\d|6[02-578]|96)|3(?:[24]0|33|7[0135-7]|8[048]|9[0269]))\\d{4}", [7]], ["(?:6(?:(?:4[5-9]|5[0-4])\\d|6(?:[0245]\\d|[17]0|3[7-9]))\\d|7(?:[37-9]\\d|42|56))\\d{4}"], ["8002[28]\\d\\d|80(?:05\\d|9)\\d{4}"], ["90(?:02[258]|1(?:23|3[14])|66[136])\\d\\d", [7]], 0, 0, ["870(?:28|87)\\d\\d", [7]]]], "LK": ["94", "00", "[1-9]\\d{8}", [9], [["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["7"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[1-689]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:12[2-9]|602|8[12]\\d|9(?:1\\d|22|9[245]))\\d{6}|(?:11|2[13-7]|3[1-8]|4[157]|5[12457]|6[35-7])[2-57]\\d{6}"], ["7(?:[0-25-8]\\d|4[0-4])\\d{6}"], 0, 0, 0, 0, ["1973\\d{5}"]]], "LR": ["231", "00", "(?:2|33|5\\d|77|88)\\d{7}|[4-6]\\d{6}", [7, 8, 9], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["[4-6]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["2"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[3578]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:2\\d{3}|33333)\\d{4}", [8, 9]], ["(?:(?:330|555|(?:77|88)\\d)\\d|4[67])\\d{5}|[56]\\d{6}", [7, 9]], 0, ["332(?:02|[34]\\d)\\d{4}", [9]]]], "LS": ["266", "00", "(?:[256]\\d\\d|800)\\d{5}", [8], [["(\\d{4})(\\d{4})", "$1 $2", ["[2568]"]]], 0, 0, 0, 0, 0, 0, [["2\\d{7}"], ["[56]\\d{7}"], ["800[256]\\d{4}"]]], "LT": ["370", "00", "(?:[3469]\\d|52|[78]0)\\d{6}", [8], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["52[0-7]"], "(8-$1)", 1], ["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["[7-9]"], "8 $1", 1], ["(\\d{2})(\\d{6})", "$1 $2", ["37|4(?:[15]|6[1-8])"], "(8-$1)", 1], ["(\\d{3})(\\d{5})", "$1 $2", ["[3-6]"], "(8-$1)", 1]], "8", 0, "[08]", 0, 0, 0, [["(?:3[1478]|4[124-6]|52)\\d{6}"], ["6\\d{7}"], ["80[02]\\d{5}"], ["9(?:0[0239]|10)\\d{5}"], ["70[05]\\d{5}"], 0, ["70[67]\\d{5}"], 0, ["[89]01\\d{5}"], ["808\\d{5}"]]], "LU": ["352", "00", "35[013-9]\\d{4,8}|6\\d{8}|35\\d{2,4}|(?:[2457-9]\\d|3[0-46-9])\\d{2,9}", [4, 5, 6, 7, 8, 9, 10, 11], [["(\\d{2})(\\d{3})", "$1 $2", ["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]], ["(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3", ["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]], ["(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3", ["20[2-689]"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})", "$1 $2 $3 $4", ["2(?:[0367]|4[3-8])"]], ["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["80[01]|90[015]"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3 $4", ["20"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["6"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})", "$1 $2 $3 $4 $5", ["2(?:[0367]|4[3-8])"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{1,5})", "$1 $2 $3 $4", ["[3-57]|8[13-9]|9(?:0[89]|[2-579])|(?:2|80)[2-9]"]]], 0, 0, "(15(?:0[06]|1[12]|[35]5|4[04]|6[26]|77|88|99)\\d)", 0, 0, 0, [["(?:35[013-9]|80[2-9]|90[89])\\d{1,8}|(?:2[2-9]|3[0-46-9]|[457]\\d|8[13-9]|9[2-579])\\d{2,9}"], ["6(?:[269][18]|5[1568]|7[189]|81)\\d{6}", [9]], ["800\\d{5}", [8]], ["90[015]\\d{5}", [8]], 0, 0, 0, 0, ["20(?:1\\d{5}|[2-689]\\d{1,7})", [4, 5, 6, 7, 8, 9, 10]], ["801\\d{5}", [8]]]], "LV": ["371", "00", "(?:[268]\\d|90)\\d{6}", [8], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[269]|8[01]"]]], 0, 0, 0, 0, 0, 0, [["6\\d{7}"], ["23(?:23[0-57-9]|33[0238])\\d{3}|2(?:[0-24-9]\\d\\d|3(?:0[07]|[14-9]\\d|2[024-9]|3[0-24-9]))\\d{4}"], ["80\\d{6}"], ["90\\d{6}"], 0, 0, 0, 0, 0, ["81\\d{6}"]]], "LY": ["218", "00", "[2-9]\\d{8}", [9], [["(\\d{2})(\\d{7})", "$1-$2", ["[2-9]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:2(?:0[56]|[1-6]\\d|7[124579]|8[124])|3(?:1\\d|2[2356])|4(?:[17]\\d|2[1-357]|5[2-4]|8[124])|5(?:[1347]\\d|2[1-469]|5[13-5]|8[1-4])|6(?:[1-479]\\d|5[2-57]|8[1-5])|7(?:[13]\\d|2[13-79])|8(?:[124]\\d|5[124]|84))\\d{6}"], ["9[1-6]\\d{7}"]]], "MA": ["212", "00", "[5-8]\\d{8}", [9], [["(\\d{5})(\\d{4})", "$1-$2", ["5(?:29|38)", "5(?:29[89]|389)", "5(?:29[89]|389)0"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["5[45]"], "0$1"], ["(\\d{4})(\\d{5})", "$1-$2", ["5(?:2[2-489]|3[5-9]|9)|892", "5(?:2(?:[2-49]|8[235-9])|3[5-9]|9)|892"], "0$1"], ["(\\d{2})(\\d{7})", "$1-$2", ["8"], "0$1"], ["(\\d{3})(\\d{6})", "$1-$2", ["[5-7]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["5(?:29(?:[189][05]|2[29]|3[01])|389[05])\\d{4}|5(?:2(?:[0-25-7]\\d|3[1-578]|4[02-46-8]|8[0235-7]|90)|3(?:[0-47]\\d|5[02-9]|6[02-8]|8[08]|9[3-9])|(?:4[067]|5[03])\\d)\\d{5}"], ["(?:6(?:[0-79]\\d|8[0-247-9])|7(?:[017]\\d|2[0-2]|6[0-8]|8[0-3]))\\d{6}"], ["80\\d{7}"], ["89\\d{7}"], 0, 0, 0, 0, ["592(?:4[0-2]|93)\\d{4}"]]], "MC": ["377", "00", "(?:[3489]|6\\d)\\d{7}", [8, 9], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["4"], "0$1"], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[389]"]], ["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4 $5", ["6"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:870|9[2-47-9]\\d)\\d{5}", [8]], ["4(?:[46]\\d|5[1-9])\\d{5}|(?:3|6\\d)\\d{7}"], ["(?:800|90\\d)\\d{5}", [8]]]], "MD": ["373", "00", "(?:[235-7]\\d|[89]0)\\d{6}", [8], [["(\\d{3})(\\d{5})", "$1 $2", ["[89]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["22|3"], "0$1"], ["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["[25-7]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:(?:2[1-9]|3[1-79])\\d|5(?:33|5[257]))\\d{5}"], ["562\\d{5}|(?:6\\d|7[16-9])\\d{6}"], ["800\\d{5}"], ["90[056]\\d{5}"], 0, 0, ["803\\d{5}"], 0, ["3[08]\\d{6}"], ["808\\d{5}"]]], "ME": ["382", "00", "(?:20|[3-79]\\d)\\d{6}|80\\d{6,7}", [8, 9], [["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[2-9]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:20[2-8]|3(?:[0-2][2-7]|3[24-7])|4(?:0[2-467]|1[2467])|5(?:0[2467]|1[24-7]|2[2-467]))\\d{5}", [8]], ["6(?:[07-9]\\d|3[024]|6[0-25])\\d{5}", [8]], ["80(?:[0-2578]|9\\d)\\d{5}"], ["9(?:4[1568]|5[178])\\d{5}", [8]], 0, 0, ["77[1-9]\\d{5}", [8]], 0, ["78[1-49]\\d{5}", [8]]]], "MF": ["590", "00", "(?:590|(?:69|80)\\d|976)\\d{6}", [9], 0, "0", 0, 0, 0, 0, 0, [["590(?:0[079]|[14]3|[27][79]|30|5[0-268]|87)\\d{4}"], ["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"], ["80[0-5]\\d{6}"], 0, 0, 0, 0, 0, ["976[01]\\d{5}"]]], "MG": ["261", "00", "[23]\\d{8}", [9], [["(\\d{2})(\\d{2})(\\d{3})(\\d{2})", "$1 $2 $3 $4", ["[23]"], "0$1"]], "0", 0, "0|([24-9]\\d{6})$", "20$1", 0, 0, [["2072[29]\\d{4}|20(?:2\\d|4[47]|5[3467]|6[279]|7[35]|8[268]|9[245])\\d{5}"], ["3[2-489]\\d{7}"], 0, 0, 0, 0, 0, 0, ["22\\d{7}"]]], "MH": ["692", "011", "329\\d{4}|(?:[256]\\d|45)\\d{5}", [7], [["(\\d{3})(\\d{4})", "$1-$2", ["[2-6]"]]], "1", 0, 0, 0, 0, 0, [["(?:247|528|625)\\d{4}"], ["(?:(?:23|54)5|329|45[356])\\d{4}"], 0, 0, 0, 0, 0, 0, ["635\\d{4}"]]], "MK": ["389", "00", "[2-578]\\d{7}", [8], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["2|34[47]|4(?:[37]7|5[47]|64)"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[347]"], "0$1"], ["(\\d{3})(\\d)(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[58]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:(?:2(?:62|77)0|3444)\\d|4[56]440)\\d{3}|(?:34|4[357])700\\d{3}|(?:2(?:[0-3]\\d|5[0-578]|6[01]|82)|3(?:1[3-68]|[23][2-68]|4[23568])|4(?:[23][2-68]|4[3-68]|5[2568]|6[25-8]|7[24-68]|8[4-68]))\\d{5}"], ["7(?:3555|4747|9(?:[019]77|42[0-4]))\\d{3}|7(?:[0-25-8]\\d\\d|3(?:[1-4]\\d|7[01578])|4(?:2\\d|60|7[01578])|9(?:[23]\\d|4[01]|7[015]))\\d{4}"], ["800\\d{5}"], ["5\\d{7}"], 0, 0, 0, 0, 0, ["8(?:0[1-9]|[1-9]\\d)\\d{5}"]]], "ML": ["223", "00", "[24-9]\\d{7}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[24-9]"]]], 0, 0, 0, 0, 0, 0, [["2(?:07[0-8]|12[67])\\d{4}|(?:2(?:02|1[4-689])|4(?:0[0-4]|4[1-39]))\\d{5}"], ["2(?:0(?:01|79)|17\\d)\\d{4}|(?:5[01]|[679]\\d|8[2-49])\\d{6}"], ["80\\d{6}"]]], "MM": ["95", "00", "1\\d{5,7}|95\\d{6}|(?:[4-7]|9[0-46-9])\\d{6,8}|(?:2|8\\d)\\d{5,8}", [6, 7, 8, 9, 10], [["(\\d)(\\d{2})(\\d{3})", "$1 $2 $3", ["16|2"], "0$1"], ["(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3", ["[45]|6(?:0[23]|[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-6]"], "0$1"], ["(\\d)(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[12]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[4-7]|8[1-35]"], "0$1"], ["(\\d)(\\d{3})(\\d{4,6})", "$1 $2 $3", ["9(?:2[0-4]|[35-9]|4[137-9])"], "0$1"], ["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["2"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["8"], "0$1"], ["(\\d)(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["92"], "0$1"], ["(\\d)(\\d{5})(\\d{4})", "$1 $2 $3", ["9"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:1(?:(?:2\\d|3[56]|[89][0-6])\\d|4(?:2[2-469]|39|46|6[25]|7[0-3]|83)|6)|2(?:2(?:00|8[34])|4(?:0\\d|2[246]|39|46|62|7[0-3]|83)|51\\d\\d)|4(?:2(?:2\\d\\d|48[0-3])|3(?:20\\d|4(?:70|83)|56)|420\\d|5470)|6(?:0(?:[23]|88\\d)|(?:124|[56]2\\d)\\d|247[23]|3(?:20\\d|470)|4(?:2[04]\\d|47[23])|7(?:(?:3\\d|8[01459])\\d|4(?:39|60|7[013]))))\\d{4}|5(?:2(?:2\\d{5,6}|47[023]\\d{4})|(?:347[23]|4(?:2(?:1|86)|470)|522\\d|6(?:20\\d|483)|7(?:20\\d|48[0-2])|8(?:20\\d|47[02])|9(?:20\\d|47[01]))\\d{4})|7(?:(?:0470|4(?:25\\d|470)|5(?:202|470|96\\d))\\d{4}|1(?:20\\d{4,5}|4(?:70|83)\\d{4}))|8(?:1(?:2\\d{5,6}|4(?:10|7[01]\\d)\\d{3})|2(?:2\\d{5,6}|(?:320|490\\d)\\d{3})|(?:3(?:2\\d\\d|470)|4[24-7]|5(?:2\\d|4[1-9]|51)\\d|6[23])\\d{4})|(?:1[2-6]\\d|4(?:2[24-8]|3[2-7]|[46][2-6]|5[3-5])|5(?:[27][2-8]|3[2-68]|4[24-8]|5[23]|6[2-4]|8[24-7]|9[2-7])|6(?:[19]20|42[03-6]|(?:52|7[45])\\d)|7(?:[04][24-8]|[15][2-7]|22|3[2-4])|8(?:1[2-689]|2[2-8]|[35]2\\d))\\d{4}|25\\d{5,6}|(?:2[2-9]|6(?:1[2356]|[24][2-6]|3[24-6]|5[2-4]|6[2-8]|7[235-7]|8[245]|9[24])|8(?:3[24]|5[245]))\\d{4}", [6, 7, 8, 9]], ["(?:17[01]|9(?:2(?:[0-4]|[56]\\d\\d)|(?:3(?:[0-36]|4\\d)|(?:6\\d|9[4-8])\\d|7(?:3|40|[5-9]\\d)|8(?:78|[89]\\d))\\d|4(?:(?:[0245]\\d|[1379])\\d|88)|5[0-6])\\d)\\d{4}|9[69]1\\d{6}|9(?:[68]\\d|9[089])\\d{5}", [7, 8, 9, 10]], ["80080(?:[01][1-9]|2\\d)\\d{3}", [10]], 0, 0, 0, 0, 0, ["1333\\d{4}|[12]468\\d{4}", [8]]]], "MN": ["976", "001", "[12]\\d{7,9}|[5-9]\\d{7}", [8, 9, 10], [["(\\d{2})(\\d{2})(\\d{4})", "$1 $2 $3", ["[12]1"], "0$1"], ["(\\d{4})(\\d{4})", "$1 $2", ["[5-9]"]], ["(\\d{3})(\\d{5,6})", "$1 $2", ["[12]2[1-3]"], "0$1"], ["(\\d{4})(\\d{5,6})", "$1 $2", ["[12](?:27|3[2-8]|4[2-68]|5[1-4689])", "[12](?:27|3[2-8]|4[2-68]|5[1-4689])[0-3]"], "0$1"], ["(\\d{5})(\\d{4,5})", "$1 $2", ["[12]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["[12]2[1-3]\\d{5,6}|7(?:0[0-5]\\d|128)\\d{4}|(?:[12](?:1|27)|5[368])\\d{6}|[12](?:3[2-8]|4[2-68]|5[1-4689])\\d{6,7}"], ["(?:83[01]|920)\\d{5}|(?:5[05]|6[06]|8[015689]|9[013-9])\\d{6}", [8]], 0, 0, 0, 0, 0, 0, ["712[0-79]\\d{4}|7(?:1[013-9]|[25-8]\\d)\\d{5}", [8]]]], "MO": ["853", "00", "0800\\d{3}|(?:28|[68]\\d)\\d{6}", [7, 8], [["(\\d{4})(\\d{3})", "$1 $2", ["0"]], ["(\\d{4})(\\d{4})", "$1 $2", ["[268]"]]], 0, 0, 0, 0, 0, 0, [["(?:28[2-9]|8(?:11|[2-57-9]\\d))\\d{5}", [8]], ["6800[0-79]\\d{3}|6(?:[235]\\d\\d|6(?:0[0-5]|[1-9]\\d)|8(?:0[1-9]|[14-8]\\d|2[5-9]|[39][0-4]))\\d{4}", [8]], ["0800\\d{3}", [7]]]], "MP": ["1", "011", "[58]\\d{9}|(?:67|90)0\\d{7}", [10], 0, "1", 0, "1|([2-9]\\d{6})$", "670$1", 0, "670", [["670(?:2(?:3[3-7]|56|8[4-8])|32[1-38]|4(?:33|8[348])|5(?:32|55|88)|6(?:64|70|82)|78[3589]|8[3-9]8|989)\\d{4}"], [""], ["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"], ["900[2-9]\\d{6}"], ["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"]]], "MQ": ["596", "00", "(?:69|80)\\d{7}|(?:59|97)6\\d{6}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[569]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"], "0$1"]], "0", 0, 0, 0, 0, 0, [["596(?:[03-7]\\d|10|2[7-9]|8[09]|9[4-9])\\d{4}"], ["69(?:6(?:[0-46-9]\\d|5[0-6])|727)\\d{4}"], ["80[0-5]\\d{6}"], 0, 0, 0, 0, 0, ["976(?:6\\d|7[0-367])\\d{4}"]]], "MR": ["222", "00", "(?:[2-4]\\d\\d|800)\\d{5}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[2-48]"]]], 0, 0, 0, 0, 0, 0, [["(?:25[08]|35\\d|45[1-7])\\d{5}"], ["[2-4][0-46-9]\\d{6}"], ["800\\d{5}"]]], "MS": ["1", "011", "(?:[58]\\d\\d|664|900)\\d{7}", [10], 0, "1", 0, "1|([34]\\d{6})$", "664$1", 0, "664", [["6644(?:1[0-3]|91)\\d{4}"], ["664(?:3(?:49|9[1-6])|49[2-6])\\d{4}"], ["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"], ["900[2-9]\\d{6}"], ["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"]]], "MT": ["356", "00", "3550\\d{4}|(?:[2579]\\d\\d|800)\\d{5}", [8], [["(\\d{4})(\\d{4})", "$1 $2", ["[2357-9]"]]], 0, 0, 0, 0, 0, 0, [["20(?:3[1-4]|6[059])\\d{4}|2(?:0[19]|[1-357]\\d|60)\\d{5}"], ["(?:7(?:210|[79]\\d\\d)|9(?:[29]\\d\\d|69[67]|8(?:1[1-3]|89|97)))\\d{4}"], ["800(?:02|[3467]\\d)\\d{3}"], ["5(?:0(?:0(?:37|43)|(?:6\\d|70|9[0168])\\d)|[12]\\d0[1-5])\\d{3}"], 0, 0, ["501\\d{5}"], ["7117\\d{4}"], ["3550\\d{4}"]]], "MU": ["230", "0(?:0|[24-7]0|3[03])", "(?:5|8\\d\\d)\\d{7}|[2-468]\\d{6}", [7, 8, 10], [["(\\d{3})(\\d{4})", "$1 $2", ["[2-46]|8[013]"]], ["(\\d{4})(\\d{4})", "$1 $2", ["5"]], ["(\\d{5})(\\d{5})", "$1 $2", ["8"]]], 0, 0, 0, 0, 0, 0, [["(?:2(?:[0346-8]\\d|1[0-7])|4(?:[013568]\\d|2[4-7])|54(?:[3-5]\\d|71)|6\\d\\d|8(?:14|3[129]))\\d{4}", [7, 8]], ["5(?:4(?:2[1-389]|7[1-9])|87[15-8])\\d{4}|5(?:2[5-9]|4[3-689]|[57]\\d|8[0-689]|9[0-8])\\d{5}", [8]], ["802\\d{7}|80[0-2]\\d{4}", [7, 10]], ["30\\d{5}", [7]], 0, 0, 0, 0, ["3(?:20|9\\d)\\d{4}", [7]]], "020"], "MV": ["960", "0(?:0|19)", "(?:800|9[0-57-9]\\d)\\d{7}|[34679]\\d{6}", [7, 10], [["(\\d{3})(\\d{4})", "$1-$2", ["[3467]|9[13-9]"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["[89]"]]], 0, 0, 0, 0, 0, 0, [["(?:3(?:0[0-3]|3[0-59])|6(?:[58][024689]|6[024-68]|7[02468]))\\d{4}", [7]], ["46[46]\\d{4}|(?:7\\d|9[13-9])\\d{5}", [7]], ["800\\d{7}", [10]], ["900\\d{7}", [10]], 0, 0, ["4(?:0[01]|50)\\d{4}", [7]]], "00"], "MW": ["265", "00", "(?:[1289]\\d|31|77)\\d{7}|1\\d{6}", [7, 9], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["1[2-9]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["2"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[137-9]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:1[2-9]|2[12]\\d\\d)\\d{5}"], ["111\\d{6}|(?:31|77|[89][89])\\d{7}", [9]]]], "MX": ["52", "0[09]", "1(?:(?:44|99)[1-9]|65[0-689])\\d{7}|(?:1(?:[017]\\d|[235][1-9]|4[0-35-9]|6[0-46-9]|8[1-79]|9[1-8])|[2-9]\\d)\\d{8}", [10, 11], [["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["33|5[56]|81"], 0, 1], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["[2-9]"], 0, 1], ["(\\d)(\\d{2})(\\d{4})(\\d{4})", "$2 $3 $4", ["1(?:33|5[56]|81)"], 0, 1], ["(\\d)(\\d{3})(\\d{3})(\\d{4})", "$2 $3 $4", ["1"], 0, 1]], "01", 0, "0(?:[12]|4[45])|1", 0, 0, 0, [["657[12]\\d{6}|(?:2(?:0[01]|2[1-9]|3[1-35-8]|4[13-9]|7[1-689]|8[1-578]|9[467])|3(?:1[1-79]|[2458][1-9]|3\\d|7[1-8]|9[1-5])|4(?:1[1-57-9]|[25-7][1-9]|3[1-8]|4\\d|8[1-35-9]|9[2-689])|5(?:[56]\\d|88|9[1-79])|6(?:1[2-68]|[2-4][1-9]|5[1-3689]|6[1-57-9]|7[1-7]|8[67]|9[4-8])|7(?:[1-467][1-9]|5[13-9]|8[1-69]|9[17])|8(?:1\\d|2[13-689]|3[1-6]|4[124-6]|6[1246-9]|7[1-378]|9[12479])|9(?:1[346-9]|2[1-4]|3[2-46-8]|5[1348]|6[1-9]|7[12]|8[1-8]|9\\d))\\d{7}", [10]], ["657[12]\\d{6}|(?:1(?:2(?:2[1-9]|3[1-35-8]|4[13-9]|7[1-689]|8[1-578]|9[467])|3(?:1[1-79]|[2458][1-9]|3\\d|7[1-8]|9[1-5])|4(?:1[1-57-9]|[24-7][1-9]|3[1-8]|8[1-35-9]|9[2-689])|5(?:[56]\\d|88|9[1-79])|6(?:1[2-68]|[2-4][1-9]|5[1-3689]|6[1-57-9]|7[1-7]|8[67]|9[4-8])|7(?:[1-467][1-9]|5[13-9]|8[1-69]|9[17])|8(?:1\\d|2[13-689]|3[1-6]|4[124-6]|6[1246-9]|7[1-378]|9[12479])|9(?:1[346-9]|2[1-4]|3[2-46-8]|5[1348]|[69][1-9]|7[12]|8[1-8]))|2(?:2[1-9]|3[1-35-8]|4[13-9]|7[1-689]|8[1-578]|9[467])|3(?:1[1-79]|[2458][1-9]|3\\d|7[1-8]|9[1-5])|4(?:1[1-57-9]|[25-7][1-9]|3[1-8]|4\\d|8[1-35-9]|9[2-689])|5(?:[56]\\d|88|9[1-79])|6(?:1[2-68]|[2-4][1-9]|5[1-3689]|6[1-57-9]|7[1-7]|8[67]|9[4-8])|7(?:[1-467][1-9]|5[13-9]|8[1-69]|9[17])|8(?:1\\d|2[13-689]|3[1-6]|4[124-6]|6[1246-9]|7[1-378]|9[12479])|9(?:1[346-9]|2[1-4]|3[2-46-8]|5[1348]|6[1-9]|7[12]|8[1-8]|9\\d))\\d{7}"], ["8(?:00|88)\\d{7}", [10]], ["900\\d{7}", [10]], ["500\\d{7}", [10]], 0, 0, 0, 0, ["300\\d{7}", [10]]], "00"], "MY": ["60", "00", "1\\d{8,9}|(?:3\\d|[4-9])\\d{7}", [8, 9, 10], [["(\\d)(\\d{3})(\\d{4})", "$1-$2 $3", ["[4-79]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1-$2 $3", ["1(?:[02469]|[378][1-9]|53)|8", "1(?:[02469]|[37][1-9]|53|8(?:[1-46-9]|5[7-9]))|8"], "0$1"], ["(\\d)(\\d{4})(\\d{4})", "$1-$2 $3", ["3"], "0$1"], ["(\\d)(\\d{3})(\\d{2})(\\d{4})", "$1-$2-$3-$4", ["1(?:[367]|80)"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1-$2 $3", ["15"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4})", "$1-$2 $3", ["1"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:3(?:2[0-36-9]|3[0-368]|4[0-278]|5[0-24-8]|6[0-467]|7[1246-9]|8\\d|9[0-57])\\d|4(?:2[0-689]|[3-79]\\d|8[1-35689])|5(?:2[0-589]|[3468]\\d|5[0-489]|7[1-9]|9[23])|6(?:2[2-9]|3[1357-9]|[46]\\d|5[0-6]|7[0-35-9]|85|9[015-8])|7(?:[2579]\\d|3[03-68]|4[0-8]|6[5-9]|8[0-35-9])|8(?:[24][2-8]|3[2-5]|5[2-7]|6[2-589]|7[2-578]|[89][2-9])|9(?:0[57]|13|[25-7]\\d|[3489][0-8]))\\d{5}", [8, 9]], ["1(?:1888[689]|4400|8(?:47|8[27])[0-4])\\d{4}|1(?:0(?:[23568]\\d|4[0-6]|7[016-9]|9[0-8])|1(?:[1-5]\\d\\d|6(?:0[5-9]|[1-9]\\d)|7(?:[0134]\\d|2[1-9]|5[0-6]))|(?:[269]\\d|[37][1-9]|4[235-9])\\d|5(?:31|9\\d\\d)|8(?:1[23]|[236]\\d|4[06]|5(?:46|[7-9])|7[016-9]|8[01]|9[0-8]))\\d{5}", [9, 10]], ["1[378]00\\d{6}", [10]], ["1600\\d{6}", [10]], 0, 0, 0, 0, ["15(?:4(?:6[0-4]\\d|8(?:0[125]|[17]\\d|21|3[01]|4[01589]|5[014]|6[02]))|6(?:32[0-6]|78\\d))\\d{4}", [10]]]], "MZ": ["258", "00", "(?:2|8\\d)\\d{7}", [8, 9], [["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["2|8[2-79]"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["8"]]], 0, 0, 0, 0, 0, 0, [["2(?:[1346]\\d|5[0-2]|[78][12]|93)\\d{5}", [8]], ["8[2-79]\\d{7}", [9]], ["800\\d{6}", [9]]]], "NA": ["264", "00", "[68]\\d{7,8}", [8, 9], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["88"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["6"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["87"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["8"], "0$1"]], "0", 0, 0, 0, 0, 0, [["64426\\d{3}|6(?:1(?:2[2-7]|3[01378]|4[0-4])|254|32[0237]|4(?:27|41|5[25])|52[236-8]|626|7(?:2[2-4]|30))\\d{4,5}|6(?:1(?:(?:0\\d|2[0189]|3[24-69]|4[5-9])\\d|17|69|7[014])|2(?:17|5[0-36-8]|69|70)|3(?:17|2[14-689]|34|6[289]|7[01]|81)|4(?:17|2[0-2]|4[06]|5[0137]|69|7[01])|5(?:17|2[0459]|69|7[01])|6(?:17|25|38|42|69|7[01])|7(?:17|2[569]|3[13]|6[89]|7[01]))\\d{4}"], ["(?:60|8[1245])\\d{7}", [9]], ["80\\d{7}", [9]], ["8701\\d{5}", [9]], 0, 0, 0, 0, ["8(?:3\\d\\d|86)\\d{5}"]]], "NC": ["687", "00", "(?:050|[2-57-9]\\d\\d)\\d{3}", [6], [["(\\d{2})(\\d{2})(\\d{2})", "$1.$2.$3", ["[02-57-9]"]]], 0, 0, 0, 0, 0, 0, [["(?:2[03-9]|3[0-5]|4[1-7]|88)\\d{4}"], ["(?:5[0-4]|[79]\\d|8[0-79])\\d{4}"], ["050\\d{3}"], ["36\\d{4}"]]], "NE": ["227", "00", "[027-9]\\d{7}", [8], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["08"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[089]|2[013]|7[04]"]]], 0, 0, 0, 0, 0, 0, [["2(?:0(?:20|3[1-8]|4[13-5]|5[14]|6[14578]|7[1-578])|1(?:4[145]|5[14]|6[14-68]|7[169]|88))\\d{4}"], ["(?:23|7[04]|[89]\\d)\\d{6}"], ["08\\d{6}"], ["09\\d{6}"]]], "NF": ["672", "00", "[13]\\d{5}", [6], [["(\\d{2})(\\d{4})", "$1 $2", ["1[0-3]"]], ["(\\d)(\\d{5})", "$1 $2", ["[13]"]]], 0, 0, "([0-258]\\d{4})$", "3$1", 0, 0, [["(?:1(?:06|17|28|39)|3[0-2]\\d)\\d{3}"], ["(?:14|3[58])\\d{4}"]]], "NG": ["234", "009", "(?:[124-7]|9\\d{3})\\d{6}|[1-9]\\d{7}|[78]\\d{9,13}", [7, 8, 10, 11, 12, 13, 14], [["(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3", ["78"], "0$1"], ["(\\d)(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[12]|9(?:0[3-9]|[1-9])"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2,3})", "$1 $2 $3", ["[3-7]|8[2-9]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[7-9]"], "0$1"], ["(\\d{3})(\\d{4})(\\d{4,5})", "$1 $2 $3", ["[78]"], "0$1"], ["(\\d{3})(\\d{5})(\\d{5,6})", "$1 $2 $3", ["[78]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:(?:[1-356]\\d|4[02-8]|8[2-9])\\d|9(?:0[3-9]|[1-9]\\d))\\d{5}|7(?:0(?:[013-689]\\d|2[0-24-9])\\d{3,4}|[1-79]\\d{6})|(?:[12]\\d|4[147]|5[14579]|6[1578]|7[1-3578])\\d{5}", [7, 8]], ["(?:702[0-24-9]|8(?:01|19)[01])\\d{6}|(?:70[13-689]|8(?:0[2-9]|1[0-8])|9(?:0[1-9]|1[2356]))\\d{7}", [10]], ["800\\d{7,11}", [10, 11, 12, 13, 14]], 0, 0, 0, ["700\\d{7,11}", [10, 11, 12, 13, 14]]]], "NI": ["505", "00", "(?:1800|[25-8]\\d{3})\\d{4}", [8], [["(\\d{4})(\\d{4})", "$1 $2", ["[125-8]"]]], 0, 0, 0, 0, 0, 0, [["2\\d{7}"], ["(?:5(?:5[0-7]|[78]\\d)|6(?:20|3[035]|4[045]|5[05]|77|8[1-9]|9[059])|(?:7[5-8]|8\\d)\\d)\\d{5}"], ["1800\\d{4}"]]], "NL": ["31", "00", "(?:[124-7]\\d\\d|3(?:[02-9]\\d|1[0-8]))\\d{6}|8\\d{6,9}|9\\d{6,10}|1\\d{4,5}", [5, 6, 7, 8, 9, 10, 11], [["(\\d{3})(\\d{4,7})", "$1 $2", ["[89]0"], "0$1"], ["(\\d{2})(\\d{7})", "$1 $2", ["66"], "0$1"], ["(\\d)(\\d{8})", "$1 $2", ["6"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["1[16-8]|2[259]|3[124]|4[17-9]|5[124679]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[1-578]|91"], "0$1"], ["(\\d{3})(\\d{3})(\\d{5})", "$1 $2 $3", ["9"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:1(?:[035]\\d|1[13-578]|6[124-8]|7[24]|8[0-467])|2(?:[0346]\\d|2[2-46-9]|5[125]|9[479])|3(?:[03568]\\d|1[3-8]|2[01]|4[1-8])|4(?:[0356]\\d|1[1-368]|7[58]|8[15-8]|9[23579])|5(?:[0358]\\d|[19][1-9]|2[1-57-9]|4[13-8]|6[126]|7[0-3578])|7\\d\\d)\\d{6}", [9]], ["(?:6[1-58]|970\\d)\\d{7}", [9, 11]], ["800\\d{4,7}", [7, 8, 9, 10]], ["90[069]\\d{4,7}", [7, 8, 9, 10]], 0, 0, ["140(?:1[035]|2[0346]|3[03568]|4[0356]|5[0358]|8[458])|(?:140(?:1[16-8]|2[259]|3[124]|4[17-9]|5[124679]|7)|8[478]\\d{6})\\d", [5, 6, 9]], ["66\\d{7}", [9]], ["(?:85|91)\\d{7}", [9]]]], "NO": ["47", "00", "(?:0|[2-9]\\d{3})\\d{4}", [5, 8], [["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["[489]|59"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[235-7]"]]], 0, 0, 0, 0, 0, "[02-689]|7[0-8]", [["(?:2[1-4]|3[1-3578]|5[1-35-7]|6[1-4679]|7[0-8])\\d{6}", [8]], ["(?:4[015-8]|59|9\\d)\\d{6}", [8]], ["80[01]\\d{5}", [8]], ["82[09]\\d{5}", [8]], ["880\\d{5}", [8]], 0, ["(?:0[2-9]|81(?:0(?:0[7-9]|1\\d)|5\\d\\d))\\d{3}"], 0, ["85[0-5]\\d{5}", [8]], ["810(?:0[0-6]|[2-8]\\d)\\d{3}", [8]]]], "NP": ["977", "00", "(?:1\\d|9)\\d{9}|[1-9]\\d{7}", [8, 10, 11], [["(\\d)(\\d{7})", "$1-$2", ["1[2-6]"], "0$1"], ["(\\d{2})(\\d{6})", "$1-$2", ["1[01]|[2-8]|9(?:[1-59]|[67][2-6])"], "0$1"], ["(\\d{3})(\\d{7})", "$1-$2", ["9"]]], "0", 0, 0, 0, 0, 0, [["(?:1[0-6]\\d|99[02-6])\\d{5}|(?:2[13-79]|3[135-8]|4[146-9]|5[135-7]|6[13-9]|7[15-9]|8[1-46-9]|9[1-7])[2-6]\\d{5}", [8]], ["9(?:6[0-3]|7[024-6]|8[0-24-68])\\d{7}", [10]], ["1(?:66001|800\\d\\d)\\d{5}", [11]]]], "NR": ["674", "00", "(?:444|(?:55|8\\d)\\d|666)\\d{4}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[4-68]"]]], 0, 0, 0, 0, 0, 0, [["444\\d{4}"], ["(?:55[3-9]|666|8\\d\\d)\\d{4}"]]], "NU": ["683", "00", "(?:[47]|888\\d)\\d{3}", [4, 7], [["(\\d{3})(\\d{4})", "$1 $2", ["8"]]], 0, 0, 0, 0, 0, 0, [["[47]\\d{3}", [4]], ["888[4-9]\\d{3}", [7]]]], "NZ": ["64", "0(?:0|161)", "[29]\\d{7,9}|50\\d{5}(?:\\d{2,3})?|6[0-35-9]\\d{6}|7\\d{7,8}|8\\d{4,9}|(?:11\\d|[34])\\d{7}", [5, 6, 7, 8, 9, 10], [["(\\d{2})(\\d{3,8})", "$1 $2", ["8[1-579]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2,3})", "$1 $2 $3", ["50[036-8]|[89]0", "50(?:[0367]|88)|[89]0"], "0$1"], ["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["24|[346]|7[2-57-9]|9[2-9]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["2(?:10|74)|[59]|80"], "0$1"], ["(\\d{2})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["1|2[028]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,5})", "$1 $2 $3", ["2(?:[169]|7[0-35-9])|7|86"], "0$1"]], "0", 0, 0, 0, 0, 0, [["24099\\d{3}|(?:3[2-79]|[49][2-9]|6[235-9]|7[2-57-9])\\d{6}", [8]], ["2[0-27-9]\\d{7,8}|21\\d{6}", [8, 9, 10]], ["508\\d{6,7}|80\\d{6,8}", [8, 9, 10]], ["(?:11\\d{5}|50(?:0[08]|30|66|77|88))\\d{3}|90\\d{6,8}", [7, 8, 9, 10]], ["70\\d{7}", [9]], 0, ["8(?:1[6-9]|22|3\\d|4[045]|5[459]|7[0-3579]|90)\\d{2,7}"], ["[28]6\\d{6,7}", [8, 9]]], "00"], "OM": ["968", "00", "(?:1505|[279]\\d{3}|500)\\d{4}|800\\d{5,6}", [7, 8, 9], [["(\\d{3})(\\d{4,6})", "$1 $2", ["[58]"]], ["(\\d{2})(\\d{6})", "$1 $2", ["2"]], ["(\\d{4})(\\d{4})", "$1 $2", ["[179]"]]], 0, 0, 0, 0, 0, 0, [["2[2-6]\\d{6}", [8]], ["1505\\d{4}|(?:7(?:[1289]\\d|7[0-4])|9(?:0[1-9]|[1-9]\\d))\\d{5}", [8]], ["8007\\d{4,5}|(?:500|800[05])\\d{4}"], ["900\\d{5}", [8]]]], "PA": ["507", "00", "(?:00800|8\\d{3})\\d{6}|[68]\\d{7}|[1-57-9]\\d{6}", [7, 8, 10, 11], [["(\\d{3})(\\d{4})", "$1-$2", ["[1-57-9]"]], ["(\\d{4})(\\d{4})", "$1-$2", ["[68]"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["8"]]], 0, 0, 0, 0, 0, 0, [["(?:1(?:0\\d|1[479]|2[37]|3[0137]|4[17]|5[05]|6[58]|7[0167]|8[2358]|9[1389])|2(?:[0235-79]\\d|1[0-7]|4[013-9]|8[02-9])|3(?:[089]\\d|1[0-7]|2[0-5]|33|4[0-79]|5[0-35]|6[068]|7[0-8])|4(?:00|3[0-579]|4\\d|7[0-57-9])|5(?:[01]\\d|2[0-7]|[56]0|79)|7(?:0[09]|2[0-26-8]|3[03]|4[04]|5[05-9]|6[056]|7[0-24-9]|8[5-9]|90)|8(?:09|2[89]|3\\d|4[0-24-689]|5[014]|8[02])|9(?:0[5-9]|1[0135-8]|2[036-9]|3[35-79]|40|5[0457-9]|6[05-9]|7[04-9]|8[35-8]|9\\d))\\d{4}", [7]], ["(?:1[16]1|21[89]|6\\d{3}|8(?:1[01]|7[23]))\\d{4}", [7, 8]], ["800\\d{4,5}|(?:00800|800\\d)\\d{6}"], ["(?:8(?:22|55|60|7[78]|86)|9(?:00|81))\\d{4}", [7]]]], "PE": ["51", "00|19(?:1[124]|77|90)00", "(?:[14-8]|9\\d)\\d{7}", [8, 9], [["(\\d{3})(\\d{5})", "$1 $2", ["80"], "(0$1)"], ["(\\d)(\\d{7})", "$1 $2", ["1"], "(0$1)"], ["(\\d{2})(\\d{6})", "$1 $2", ["[4-8]"], "(0$1)"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["9"]]], "0", 0, 0, 0, 0, 0, [["(?:(?:4[34]|5[14])[0-8]\\d|7(?:173|3[0-8]\\d)|8(?:10[05689]|6(?:0[06-9]|1[6-9]|29)|7(?:0[569]|[56]0)))\\d{4}|(?:1[0-8]|4[12]|5[236]|6[1-7]|7[246]|8[2-4])\\d{6}", [8]], ["9\\d{8}", [9]], ["800\\d{5}", [8]], ["805\\d{5}", [8]], ["80[24]\\d{5}", [8]], 0, 0, 0, 0, ["801\\d{5}", [8]]], "00", " Anexo "], "PF": ["689", "00", "4\\d{5}(?:\\d{2})?|8\\d{7,8}", [6, 8, 9], [["(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3", ["44"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["4|8[7-9]"]], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"]]], 0, 0, 0, 0, 0, 0, [["4(?:0[4-689]|9[4-68])\\d{5}", [8]], ["8[7-9]\\d{6}", [8]], ["80[0-5]\\d{6}", [9]], 0, 0, 0, ["44\\d{4}", [6]], 0, ["499\\d{5}", [8]]]], "PG": ["675", "00|140[1-3]", "(?:180|[78]\\d{3})\\d{4}|(?:[2-589]\\d|64)\\d{5}", [7, 8], [["(\\d{3})(\\d{4})", "$1 $2", ["18|[2-69]|85"]], ["(\\d{4})(\\d{4})", "$1 $2", ["[78]"]]], 0, 0, 0, 0, 0, 0, [["(?:(?:3[0-2]|4[257]|5[34]|9[78])\\d|64[1-9]|85[02-46-9])\\d{4}", [7]], ["(?:7\\d|8[128])\\d{6}", [8]], ["180\\d{4}", [7]], 0, 0, 0, 0, ["27[01]\\d{4}", [7]], ["2(?:0[0-57]|7[568])\\d{4}", [7]]], "00"], "PH": ["63", "00", "(?:[2-7]|9\\d)\\d{8}|2\\d{5}|(?:1800|8)\\d{7,9}", [6, 8, 9, 10, 11, 12, 13], [["(\\d)(\\d{5})", "$1 $2", ["2"], "(0$1)"], ["(\\d{4})(\\d{4,6})", "$1 $2", ["3(?:23|39|46)|4(?:2[3-6]|[35]9|4[26]|76)|544|88[245]|(?:52|64|86)2", "3(?:230|397|461)|4(?:2(?:35|[46]4|51)|396|4(?:22|63)|59[347]|76[15])|5(?:221|446)|642[23]|8(?:622|8(?:[24]2|5[13]))"], "(0$1)"], ["(\\d{5})(\\d{4})", "$1 $2", ["346|4(?:27|9[35])|883", "3469|4(?:279|9(?:30|56))|8834"], "(0$1)"], ["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["2"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[3-7]|8[2-8]"], "(0$1)"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["[89]"], "0$1"], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"]], ["(\\d{4})(\\d{1,2})(\\d{3})(\\d{4})", "$1 $2 $3 $4", ["1"]]], "0", 0, 0, 0, 0, 0, [["(?:(?:2[3-8]|3[2-68]|4[2-9]|5[2-6]|6[2-58]|7[24578])\\d{3}|88(?:22\\d\\d|42))\\d{4}|(?:2|8[2-8]\\d\\d)\\d{5}", [6, 8, 9, 10]], ["(?:8(?:1[37]|9[5-8])|9(?:0[5-9]|1[0-24-9]|[235-7]\\d|4[2-9]|8[135-9]|9[1-9]))\\d{7}", [10]], ["1800\\d{7,9}", [11, 12, 13]]]], "PK": ["92", "00", "122\\d{6}|[24-8]\\d{10,11}|9(?:[013-9]\\d{8,10}|2(?:[01]\\d\\d|2(?:[06-8]\\d|1[01]))\\d{7})|(?:[2-8]\\d{3}|92(?:[0-7]\\d|8[1-9]))\\d{6}|[24-9]\\d{8}|[89]\\d{7}", [8, 9, 10, 11, 12], [["(\\d{3})(\\d{3})(\\d{2,7})", "$1 $2 $3", ["[89]0"], "0$1"], ["(\\d{4})(\\d{5})", "$1 $2", ["1"]], ["(\\d{3})(\\d{6,7})", "$1 $2", ["2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:2[2-8]|3[27-9]|4[2-6]|6[3569]|9[25-8])", "9(?:2[3-8]|98)|(?:2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:22|3[27-9]|4[2-6]|6[3569]|9[25-7]))[2-9]"], "(0$1)"], ["(\\d{2})(\\d{7,8})", "$1 $2", ["(?:2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)[2-9]"], "(0$1)"], ["(\\d{5})(\\d{5})", "$1 $2", ["58"], "(0$1)"], ["(\\d{3})(\\d{7})", "$1 $2", ["3"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91"], "(0$1)"], ["(\\d{3})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["[24-9]"], "(0$1)"]], "0", 0, 0, 0, 0, 0, [["(?:(?:21|42)[2-9]|58[126])\\d{7}|(?:2[25]|4[0146-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)[2-9]\\d{6,7}|(?:2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:2[2-8]|3[27-9]|4[2-6]|6[3569]|9[25-8]))[2-9]\\d{5,6}", [9, 10]], ["3(?:[0-24]\\d|3[0-7]|55|64)\\d{7}", [10]], ["800\\d{5}(?:\\d{3})?", [8, 11]], ["900\\d{5}", [8]], ["122\\d{6}", [9]], 0, ["(?:2(?:[125]|3[2358]|4[2-4]|9[2-8])|4(?:[0-246-9]|5[3479])|5(?:[1-35-7]|4[2-467])|6(?:0[468]|[1-8])|7(?:[14]|2[236])|8(?:[16]|2[2-689]|3[23578]|4[3478]|5[2356])|9(?:1|22|3[27-9]|4[2-6]|6[3569]|9[2-7]))111\\d{6}", [11, 12]]]], "PL": ["48", "00", "(?:6|8\\d\\d)\\d{7}|[1-9]\\d{6}(?:\\d{2})?|[26]\\d{5}", [6, 7, 8, 9, 10], [["(\\d{5})", "$1", ["19"]], ["(\\d{3})(\\d{3})", "$1 $2", ["11|20|64"]], ["(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3", ["(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])1", "(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])19"]], ["(\\d{3})(\\d{2})(\\d{2,3})", "$1 $2 $3", ["64"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["21|39|45|5[0137]|6[0469]|7[02389]|8(?:0[14]|8)"]], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["1[2-8]|[2-7]|8[1-79]|9[145]"]], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["8"]]], 0, 0, 0, 0, 0, 0, [["47\\d{7}|(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])(?:[02-9]\\d{6}|1(?:[0-8]\\d{5}|9\\d{3}(?:\\d{2})?))", [7, 9]], ["21(?:1(?:[145]\\d|3[1-5])|2[0-4]\\d)\\d{4}|(?:45|5[0137]|6[069]|7[2389]|88)\\d{7}", [9]], ["800\\d{6,7}", [9, 10]], ["70[01346-8]\\d{6}", [9]], 0, 0, ["804\\d{6}", [9]], ["64\\d{4,7}", [6, 7, 8, 9]], ["39\\d{7}", [9]], ["801\\d{6}", [9]]]], "PM": ["508", "00", "(?:[45]|80\\d\\d)\\d{5}", [6, 9], [["(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3", ["[45]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:4[1-356]|50)\\d{4}", [6]], ["(?:4[02-4]|5[056])\\d{4}", [6]], ["80[0-5]\\d{6}", [9]]]], "PR": ["1", "011", "(?:[589]\\d\\d|787)\\d{7}", [10], 0, "1", 0, 0, 0, 0, "787|939", [["(?:787|939)[2-9]\\d{6}"], [""], ["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"], ["900[2-9]\\d{6}"], ["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"]]], "PS": ["970", "00", "[2489]2\\d{6}|(?:1\\d|5)\\d{8}", [8, 9, 10], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["[2489]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["5"], "0$1"], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["1"]]], "0", 0, 0, 0, 0, 0, [["(?:22[2-47-9]|42[45]|82[014-68]|92[3569])\\d{5}", [8]], ["5[69]\\d{7}", [9]], ["1800\\d{6}", [10]], 0, 0, 0, 0, 0, 0, ["1700\\d{6}", [10]]]], "PT": ["351", "00", "1693\\d{5}|(?:[26-9]\\d|30)\\d{7}", [9], [["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["2[12]"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["16|[236-9]"]]], 0, 0, 0, 0, 0, 0, [["2(?:[12]\\d|3[1-689]|4[1-59]|[57][1-9]|6[1-35689]|8[1-69]|9[1256])\\d{6}"], ["6(?:[06]92(?:30|9\\d)|[35]92(?:3[03]|9\\d))\\d{3}|(?:(?:16|6[0356])93|9(?:[1-36]\\d\\d|480))\\d{5}"], ["80[02]\\d{6}"], ["(?:6(?:0[178]|4[68])\\d|76(?:0[1-57]|1[2-47]|2[237]))\\d{5}"], ["884[0-4689]\\d{5}"], 0, ["70(?:7\\d|8[17])\\d{5}"], ["6222\\d{5}"], ["30\\d{7}"], ["80(?:8\\d|9[1579])\\d{5}"]]], "PW": ["680", "01[12]", "(?:[24-8]\\d\\d|345|900)\\d{4}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[2-9]"]]], 0, 0, 0, 0, 0, 0, [["(?:2(?:55|77)|345|488|5(?:35|44|87)|6(?:22|54|79)|7(?:33|47)|8(?:24|55|76)|900)\\d{4}"], ["(?:(?:46|83)[0-5]|6[2-4689]0)\\d{4}|(?:45|77|88)\\d{5}"]]], "PY": ["595", "00", "59\\d{4,6}|9\\d{5,10}|(?:[2-46-8]\\d|5[0-8])\\d{4,7}", [6, 7, 8, 9, 10, 11], [["(\\d{3})(\\d{3,6})", "$1 $2", ["[2-9]0"], "0$1"], ["(\\d{2})(\\d{5})", "$1 $2", ["[26]1|3[289]|4[1246-8]|7[1-3]|8[1-36]"], "(0$1)"], ["(\\d{3})(\\d{4,5})", "$1 $2", ["2[279]|3[13-5]|4[359]|5|6(?:[34]|7[1-46-8])|7[46-8]|85"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["2[14-68]|3[26-9]|4[1246-8]|6(?:1|75)|7[1-35]|8[1-36]"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["87"]], ["(\\d{3})(\\d{6})", "$1 $2", ["9(?:[5-79]|8[1-6])"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[2-8]"], "0$1"], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["9"]]], "0", 0, 0, 0, 0, 0, [["(?:[26]1|3[289]|4[1246-8]|7[1-3]|8[1-36])\\d{5,7}|(?:2(?:2[4-68]|[4-68]\\d|7[15]|9[1-5])|3(?:18|3[167]|4[2357]|51|[67]\\d)|4(?:3[12]|5[13]|9[1-47])|5(?:[1-4]\\d|5[02-4])|6(?:3[1-3]|44|7[1-8])|7(?:4[0-4]|5\\d|6[1-578]|75|8[0-8])|858)\\d{5,6}", [7, 8, 9]], ["9(?:51|6[129]|[78][1-6]|9[1-5])\\d{6}", [9]], ["9800\\d{5,7}", [9, 10, 11]], 0, 0, 0, ["[2-9]0\\d{4,7}", [6, 7, 8, 9]], 0, ["8700[0-4]\\d{4}", [9]]]], "QA": ["974", "00", "[2-7]\\d{7}|800\\d{4}(?:\\d{2})?|2\\d{6}", [7, 8, 9], [["(\\d{3})(\\d{4})", "$1 $2", ["2[126]|8"]], ["(\\d{4})(\\d{4})", "$1 $2", ["[2-7]"]]], 0, 0, 0, 0, 0, 0, [["414[1-4]\\d{4}|(?:23|4[04])\\d{6}", [8]], ["(?:2[89]|[35-7]\\d)\\d{6}", [8]], ["800\\d{4}(?:\\d{2})?", [7, 9]], 0, 0, 0, 0, ["2(?:[12]\\d|61)\\d{4}", [7]]]], "RE": ["262", "00", "976\\d{6}|(?:26|[68]\\d)\\d{7}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[2689]"], "0$1"]], "0", 0, 0, 0, 0, "26[23]|69|[89]", [["26(?:2\\d\\d|3(?:0\\d|1[01]))\\d{4}"], ["(?:69(?:2\\d\\d|3(?:0[0-46]|1[013]|2[0-2]|3[0-39]|4\\d|5[0-5]|6[0-6]|7[0-27]|8[0-8]|9[0-479]))|976(?:2[27]|3[0-37]|9\\d))\\d{4}"], ["80\\d{7}"], ["89[1-37-9]\\d{6}"], 0, 0, 0, 0, 0, ["8(?:1[019]|2[0156]|84|90)\\d{6}"]]], "RO": ["40", "00", "(?:[2378]\\d|90)\\d{7}|[23]\\d{5}", [6, 9], [["(\\d{3})(\\d{3})", "$1 $2", ["2[3-6]", "2[3-6]\\d9"], "0$1"], ["(\\d{2})(\\d{4})", "$1 $2", ["219|31"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[23]1"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[237-9]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["[23][13-6]\\d{7}|(?:2(?:19\\d|[3-6]\\d9)|31\\d\\d)\\d\\d"], ["7020\\d{5}|7(?:0[013-9]|1[0-3]|[2-7]\\d|8[03-8]|9[019])\\d{6}", [9]], ["800\\d{6}", [9]], ["90[0136]\\d{6}", [9]], 0, 0, ["(?:37\\d|80[578])\\d{6}", [9]], 0, 0, ["801\\d{6}", [9]]], 0, " int "], "RS": ["381", "00", "38[02-9]\\d{6,9}|6\\d{7,9}|90\\d{4,8}|38\\d{5,6}|(?:7\\d\\d|800)\\d{3,9}|(?:[12]\\d|3[0-79])\\d{5,10}", [6, 7, 8, 9, 10, 11, 12], [["(\\d{3})(\\d{3,9})", "$1 $2", ["(?:2[389]|39)0|[7-9]"], "0$1"], ["(\\d{2})(\\d{5,10})", "$1 $2", ["[1-36]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:11[1-9]\\d|(?:2[389]|39)(?:0[2-9]|[2-9]\\d))\\d{3,8}|(?:1[02-9]|2[0-24-7]|3[0-8])[2-9]\\d{4,9}", [7, 8, 9, 10, 11, 12]], ["6(?:[0-689]|7\\d)\\d{6,7}", [8, 9, 10]], ["800\\d{3,9}"], ["(?:78\\d|90[0169])\\d{3,7}", [6, 7, 8, 9, 10]], 0, 0, ["7[06]\\d{4,10}"]]], "RU": ["7", "810", "8\\d{13}|[347-9]\\d{9}", [10, 14], [["(\\d{4})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["7(?:1[0-8]|2[1-9])", "7(?:1(?:[0-6]2|7|8[27])|2(?:1[23]|[2-9]2))", "7(?:1(?:[0-6]2|7|8[27])|2(?:13[03-69]|62[013-9]))|72[1-57-9]2"], "8 ($1)", 1], ["(\\d{5})(\\d)(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["7(?:1[0-68]|2[1-9])", "7(?:1(?:[06][3-6]|[18]|2[35]|[3-5][3-5])|2(?:[13][3-5]|[24-689]|7[457]))", "7(?:1(?:0(?:[356]|4[023])|[18]|2(?:3[013-9]|5)|3[45]|43[013-79]|5(?:3[1-8]|4[1-7]|5)|6(?:3[0-35-9]|[4-6]))|2(?:1(?:3[178]|[45])|[24-689]|3[35]|7[457]))|7(?:14|23)4[0-8]|71(?:33|45)[1-79]"], "8 ($1)", 1], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["7"], "8 ($1)", 1], ["(\\d{3})(\\d{3})(\\d{2})(\\d{2})", "$1 $2-$3-$4", ["[349]|8(?:[02-7]|1[1-8])"], "8 ($1)", 1], ["(\\d{4})(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["8"], "8 ($1)"]], "8", 0, 0, 0, 0, "3[04-689]|[489]", [["(?:3(?:0[12]|4[1-35-79]|5[1-3]|65|8[1-58]|9[0145])|4(?:01|1[1356]|2[13467]|7[1-5]|8[1-7]|9[1-689])|8(?:1[1-8]|2[01]|3[13-6]|4[0-8]|5[15]|6[1-35-79]|7[1-37-9]))\\d{7}", [10]], ["9\\d{9}", [10]], ["8(?:0[04]|108\\d{3})\\d{7}"], ["80[39]\\d{7}", [10]], ["808\\d{7}", [10]]], "8~10"], "RW": ["250", "00", "(?:06|[27]\\d\\d|[89]00)\\d{6}", [8, 9], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["0"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[7-9]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["2"]]], "0", 0, 0, 0, 0, 0, [["(?:06|2[23568]\\d)\\d{6}"], ["7[2389]\\d{7}", [9]], ["800\\d{6}", [9]], ["900\\d{6}", [9]]]], "SA": ["966", "00", "92\\d{7}|(?:[15]|8\\d)\\d{8}", [9, 10], [["(\\d{4})(\\d{5})", "$1 $2", ["9"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["5"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["81"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["8"]]], "0", 0, 0, 0, 0, 0, [["1(?:1\\d|2[24-8]|3[35-8]|4[3-68]|6[2-5]|7[235-7])\\d{6}", [9]], ["579[01]\\d{5}|5(?:[013-689]\\d|7[0-35-8])\\d{6}", [9]], ["800\\d{7}", [10]], ["925\\d{6}", [9]], 0, 0, ["811\\d{7}", [10]], 0, 0, ["920\\d{6}", [9]]]], "SB": ["677", "0[01]", "(?:[1-6]|[7-9]\\d\\d)\\d{4}", [5, 7], [["(\\d{2})(\\d{5})", "$1 $2", ["7|8[4-9]|9(?:[1-8]|9[0-8])"]]], 0, 0, 0, 0, 0, 0, [["(?:1[4-79]|[23]\\d|4[0-2]|5[03]|6[0-37])\\d{3}", [5]], ["48\\d{3}|(?:(?:7[1-9]|8[4-9])\\d|9(?:1[2-9]|2[013-9]|3[0-2]|[46]\\d|5[0-46-9]|7[0-689]|8[0-79]|9[0-8]))\\d{4}"], ["1[38]\\d{3}", [5]], 0, 0, 0, 0, 0, ["5[12]\\d{3}", [5]]]], "SC": ["248", "010|0[0-2]", "800\\d{4}|(?:[249]\\d|64)\\d{5}", [7], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["[246]|9[57]"]]], 0, 0, 0, 0, 0, 0, [["4[2-46]\\d{5}"], ["2[125-8]\\d{5}"], ["800[08]\\d{3}"], 0, 0, 0, 0, 0, ["971\\d{4}|(?:64|95)\\d{5}"]], "00"], "SD": ["249", "00", "[19]\\d{8}", [9], [["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[19]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["1(?:5\\d|8[35-7])\\d{6}"], ["(?:1[0-2]|9[0-3569])\\d{7}"]]], "SE": ["46", "00", "(?:[26]\\d\\d|9)\\d{9}|[1-9]\\d{8}|[1-689]\\d{7}|[1-4689]\\d{6}|2\\d{5}", [6, 7, 8, 9, 10], [["(\\d{2})(\\d{2,3})(\\d{2})", "$1-$2 $3", ["20"], "0$1", 0, "$1 $2 $3"], ["(\\d{3})(\\d{4})", "$1-$2", ["9(?:00|39|44|9)"], "0$1", 0, "$1 $2"], ["(\\d{2})(\\d{3})(\\d{2})", "$1-$2 $3", ["[12][136]|3[356]|4[0246]|6[03]|90[1-9]"], "0$1", 0, "$1 $2 $3"], ["(\\d)(\\d{2,3})(\\d{2})(\\d{2})", "$1-$2 $3 $4", ["8"], "0$1", 0, "$1 $2 $3 $4"], ["(\\d{3})(\\d{2,3})(\\d{2})", "$1-$2 $3", ["1[2457]|2(?:[247-9]|5[0138])|3[0247-9]|4[1357-9]|5[0-35-9]|6(?:[125689]|4[02-57]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"], "0$1", 0, "$1 $2 $3"], ["(\\d{3})(\\d{2,3})(\\d{3})", "$1-$2 $3", ["9(?:00|39|44)"], "0$1", 0, "$1 $2 $3"], ["(\\d{2})(\\d{2,3})(\\d{2})(\\d{2})", "$1-$2 $3 $4", ["1[13689]|2[0136]|3[1356]|4[0246]|54|6[03]|90[1-9]"], "0$1", 0, "$1 $2 $3 $4"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1-$2 $3 $4", ["10|7"], "0$1", 0, "$1 $2 $3 $4"], ["(\\d)(\\d{3})(\\d{3})(\\d{2})", "$1-$2 $3 $4", ["8"], "0$1", 0, "$1 $2 $3 $4"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1-$2 $3 $4", ["[13-5]|2(?:[247-9]|5[0138])|6(?:[124-689]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"], "0$1", 0, "$1 $2 $3 $4"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{3})", "$1-$2 $3 $4", ["9"], "0$1", 0, "$1 $2 $3 $4"], ["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1-$2 $3 $4 $5", ["[26]"], "0$1", 0, "$1 $2 $3 $4 $5"]], "0", 0, 0, 0, 0, 0, [["(?:(?:[12][136]|3[356]|4[0246]|6[03]|8\\d)\\d|90[1-9])\\d{4,6}|(?:1(?:2[0-35]|4[0-4]|5[0-25-9]|7[13-6]|[89]\\d)|2(?:2[0-7]|4[0136-8]|5[0138]|7[018]|8[01]|9[0-57])|3(?:0[0-4]|1\\d|2[0-25]|4[056]|7[0-2]|8[0-3]|9[023])|4(?:1[013-8]|3[0135]|5[14-79]|7[0-246-9]|8[0156]|9[0-689])|5(?:0[0-6]|[15][0-5]|2[0-68]|3[0-4]|4\\d|6[03-5]|7[013]|8[0-79]|9[01])|6(?:1[1-3]|2[0-4]|4[02-57]|5[0-37]|6[0-3]|7[0-2]|8[0247]|9[0-356])|9(?:1[0-68]|2\\d|3[02-5]|4[0-3]|5[0-4]|[68][01]|7[0135-8]))\\d{5,6}", [7, 8, 9]], ["7[02369]\\d{7}", [9]], ["20\\d{4,7}", [6, 7, 8, 9]], ["649\\d{6}|99[1-59]\\d{4}(?:\\d{3})?|9(?:00|39|44)[1-8]\\d{3,6}", [7, 8, 9, 10]], ["75[1-8]\\d{6}", [9]], 0, ["10[1-8]\\d{6}", [9]], ["74[02-9]\\d{6}", [9]], 0, ["77[0-7]\\d{6}", [9]]]], "SG": ["65", "0[0-3]\\d", "(?:(?:1\\d|8)\\d\\d|7000)\\d{7}|[3689]\\d{7}", [8, 10, 11], [["(\\d{4})(\\d{4})", "$1 $2", ["[369]|8(?:0[1-5]|[1-9])"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["8"]], ["(\\d{4})(\\d{4})(\\d{3})", "$1 $2 $3", ["7"]], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"]]], 0, 0, 0, 0, 0, 0, [["662[0-24-9]\\d{4}|6(?:[0-578]\\d|6[013-57-9]|9[0-35-9])\\d{5}", [8]], ["8(?:05[0-7]|95[0-2])\\d{4}|(?:8(?:0[1-4]|[1-8]\\d|9[0-4])|9[0-8]\\d)\\d{5}", [8]], ["(?:18|8)00\\d{7}", [10, 11]], ["1900\\d{7}", [11]], 0, 0, ["7000\\d{7}", [11]], 0, ["(?:3[12]\\d|666)\\d{5}", [8]]]], "SH": ["290", "00", "(?:[256]\\d|8)\\d{3}", [4, 5], 0, 0, 0, 0, 0, 0, "[256]", [["2(?:[0-57-9]\\d|6[4-9])\\d\\d"], ["[56]\\d{4}", [5]], 0, 0, 0, 0, 0, 0, ["262\\d\\d", [5]]]], "SI": ["386", "00|10(?:22|66|88|99)", "[1-7]\\d{7}|8\\d{4,7}|90\\d{4,6}", [5, 6, 7, 8], [["(\\d{2})(\\d{3,6})", "$1 $2", ["8[09]|9"], "0$1"], ["(\\d{3})(\\d{5})", "$1 $2", ["59|8"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[37][01]|4[0139]|51|6"], "0$1"], ["(\\d)(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[1-57]"], "(0$1)"]], "0", 0, 0, 0, 0, 0, [["(?:[1-357][2-8]|4[24-8])\\d{6}", [8]], ["65(?:1\\d|55|6[01]|70)\\d{4}|(?:[37][01]|4[0139]|51|6[489])\\d{6}", [8]], ["80\\d{4,6}", [6, 7, 8]], ["89[1-3]\\d{2,5}|90\\d{4,6}"], 0, 0, 0, 0, ["(?:59\\d\\d|8(?:1(?:[67]\\d|8[0-589])|2(?:0\\d|2[0-37-9]|8[0-2489])|3[389]\\d))\\d{4}", [8]]], "00"], "SJ": ["47", "00", "0\\d{4}|(?:[489]\\d|[57]9)\\d{6}", [5, 8], 0, 0, 0, 0, 0, 0, "79", [["79\\d{6}", [8]], ["(?:4[015-8]|59|9\\d)\\d{6}", [8]], ["80[01]\\d{5}", [8]], ["82[09]\\d{5}", [8]], ["880\\d{5}", [8]], 0, ["(?:0[2-9]|81(?:0(?:0[7-9]|1\\d)|5\\d\\d))\\d{3}"], 0, ["85[0-5]\\d{5}", [8]], ["810(?:0[0-6]|[2-8]\\d)\\d{3}", [8]]]], "SK": ["421", "00", "[2-689]\\d{8}|[2-59]\\d{6}|[2-5]\\d{5}", [6, 7, 9], [["(\\d)(\\d{2})(\\d{3,4})", "$1 $2 $3", ["21"], "0$1"], ["(\\d{2})(\\d{2})(\\d{2,3})", "$1 $2 $3", ["[3-5][1-8]1", "[3-5][1-8]1[67]"], "0$1"], ["(\\d)(\\d{3})(\\d{3})(\\d{2})", "$1/$2 $3 $4", ["2"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[689]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1/$2 $3 $4", ["[3-5]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:2(?:16|[2-9]\\d{3})|(?:(?:[3-5][1-8]\\d|819)\\d|601[1-5])\\d)\\d{4}|(?:2|[3-5][1-8])1[67]\\d{3}|[3-5][1-8]16\\d\\d"], ["909[1-9]\\d{5}|9(?:0[1-8]|1[0-24-9]|4[03-57-9]|5\\d)\\d{6}", [9]], ["800\\d{6}", [9]], ["9(?:00|[78]\\d)\\d{6}", [9]], 0, 0, ["96\\d{7}", [9]], ["9090\\d{3}", [7]], ["6(?:02|5[0-4]|9[0-6])\\d{6}", [9]], ["8[5-9]\\d{7}", [9]]]], "SL": ["232", "00", "(?:[237-9]\\d|66)\\d{6}", [8], [["(\\d{2})(\\d{6})", "$1 $2", ["[236-9]"], "(0$1)"]], "0", 0, 0, 0, 0, 0, [["22[2-4][2-9]\\d{4}"], ["(?:25|3[0-5]|66|7[2-9]|8[08]|9[09])\\d{6}"]]], "SM": ["378", "00", "(?:0549|[5-7]\\d)\\d{6}", [8, 10], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[5-7]"]], ["(\\d{4})(\\d{6})", "$1 $2", ["0"]]], 0, 0, "([89]\\d{5})$", "0549$1", 0, 0, [["0549(?:8[0157-9]|9\\d)\\d{4}", [10]], ["6[16]\\d{6}", [8]], 0, ["7[178]\\d{6}", [8]], 0, 0, 0, 0, ["5[158]\\d{6}", [8]]]], "SN": ["221", "00", "(?:[378]\\d|93)\\d{7}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"]], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[379]"]]], 0, 0, 0, 0, 0, 0, [["3(?:0(?:1[0-2]|80)|282|3(?:8[1-9]|9[3-9])|611)\\d{5}"], ["7(?:(?:[06-8]\\d|21|90)\\d|5(?:01|[19]0|25|[38]3|[4-7]\\d))\\d{5}"], ["800\\d{6}"], ["88[4689]\\d{6}"], 0, 0, 0, 0, ["(?:3(?:392|9[01]\\d)\\d|93(?:3[13]0|929))\\d{4}"], ["81[02468]\\d{6}"]]], "SO": ["252", "00", "[346-9]\\d{8}|[12679]\\d{7}|[1-5]\\d{6}|[1348]\\d{5}", [6, 7, 8, 9], [["(\\d{2})(\\d{4})", "$1 $2", ["8[125]"]], ["(\\d{6})", "$1", ["[134]"]], ["(\\d)(\\d{6})", "$1 $2", ["[15]|2[0-79]|3[0-46-8]|4[0-7]"]], ["(\\d)(\\d{7})", "$1 $2", ["24|[67]"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[3478]|64|90"]], ["(\\d{2})(\\d{5,7})", "$1 $2", ["1|28|6(?:0[5-7]|[1-35-9])|9[2-9]"]]], "0", 0, 0, 0, 0, 0, [["(?:1\\d|2[0-79]|3[0-46-8]|4[0-7]|5[57-9])\\d{5}|(?:[134]\\d|8[125])\\d{4}", [6, 7]], ["(?:(?:15|(?:3[59]|4[89]|79|8[08])\\d|6(?:0[5-7]|[1-9]\\d)|9(?:0\\d|[2-9]))\\d|2(?:4\\d|8))\\d{5}|[67]\\d{7}", [7, 8, 9]]]], "SR": ["597", "00", "(?:[2-5]|68|[78]\\d)\\d{5}", [6, 7], [["(\\d{2})(\\d{2})(\\d{2})", "$1-$2-$3", ["56"]], ["(\\d{3})(\\d{3})", "$1-$2", ["[2-5]"]], ["(\\d{3})(\\d{4})", "$1-$2", ["[6-8]"]]], 0, 0, 0, 0, 0, 0, [["(?:2[1-3]|3[0-7]|(?:4|68)\\d|5[2-58])\\d{4}"], ["(?:7[124-7]|8[124-9])\\d{5}", [7]], 0, 0, 0, 0, 0, 0, ["56\\d{4}", [6]]]], "SS": ["211", "00", "[19]\\d{8}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[19]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["1[89]\\d{7}"], ["(?:12|9[1257-9])\\d{7}"]]], "ST": ["239", "00", "(?:22|9\\d)\\d{5}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[29]"]]], 0, 0, 0, 0, 0, 0, [["22\\d{5}"], ["900[5-9]\\d{3}|9(?:0[1-9]|[89]\\d)\\d{4}"]]], "SV": ["503", "00", "[267]\\d{7}|[89]00\\d{4}(?:\\d{4})?", [7, 8, 11], [["(\\d{3})(\\d{4})", "$1 $2", ["[89]"]], ["(\\d{4})(\\d{4})", "$1 $2", ["[267]"]], ["(\\d{3})(\\d{4})(\\d{4})", "$1 $2 $3", ["[89]"]]], 0, 0, 0, 0, 0, 0, [["2(?:[1-6]\\d{3}|[79]90[034]|890[0245])\\d{3}", [8]], ["66(?:[02-9]\\d\\d|1(?:[02-9]\\d|16))\\d{3}|(?:6[0-57-9]|7\\d)\\d{6}", [8]], ["800\\d{4}(?:\\d{4})?", [7, 11]], ["900\\d{4}(?:\\d{4})?", [7, 11]]]], "SX": ["1", "011", "7215\\d{6}|(?:[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "1|(5\\d{6})$", "721$1", 0, "721", [["7215(?:4[2-8]|8[239]|9[056])\\d{4}"], ["7215(?:1[02]|2\\d|5[034679]|8[014-8])\\d{4}"], ["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"], ["900[2-9]\\d{6}"], ["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"]]], "SY": ["963", "00", "[1-39]\\d{8}|[1-5]\\d{7}", [8, 9], [["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[1-5]"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["9"], "0$1", 1]], "0", 0, 0, 0, 0, 0, [["21\\d{6,7}|(?:1(?:[14]\\d|[2356])|2[235]|3(?:[13]\\d|4)|4[134]|5[1-3])\\d{6}"], ["9[1-689]\\d{7}", [9]]]], "SZ": ["268", "00", "0800\\d{4}|(?:[237]\\d|900)\\d{6}", [8, 9], [["(\\d{4})(\\d{4})", "$1 $2", ["[0237]"]], ["(\\d{5})(\\d{4})", "$1 $2", ["9"]]], 0, 0, 0, 0, 0, 0, [["[23][2-5]\\d{6}", [8]], ["7[6-9]\\d{6}", [8]], ["0800\\d{4}", [8]], ["900\\d{6}", [9]], 0, 0, 0, 0, ["70\\d{6}", [8]]]], "TA": ["290", "00", "8\\d{3}", [4], 0, 0, 0, 0, 0, 0, "8", [["8\\d{3}"]]], "TC": ["1", "011", "(?:[58]\\d\\d|649|900)\\d{7}", [10], 0, "1", 0, "1|([2-479]\\d{6})$", "649$1", 0, "649", [["649(?:266|712|9(?:4\\d|50))\\d{4}"], ["649(?:2(?:3[129]|4[1-79])|3\\d\\d|4[34][1-3])\\d{4}"], ["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"], ["900[2-9]\\d{6}"], ["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"], 0, 0, 0, ["649(?:71[01]|966)\\d{4}"]]], "TD": ["235", "00|16", "(?:22|[69]\\d|77)\\d{6}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[2679]"]]], 0, 0, 0, 0, 0, 0, [["22(?:[37-9]0|5[0-5]|6[89])\\d{4}"], ["(?:6[023568]|77|9\\d)\\d{6}"]], "00"], "TG": ["228", "00", "[279]\\d{7}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[279]"]]], 0, 0, 0, 0, 0, 0, [["2(?:2[2-7]|3[23]|4[45]|55|6[67]|77)\\d{5}"], ["(?:7[09]|9[0-36-9])\\d{6}"]]], "TH": ["66", "00[1-9]", "(?:001800|[2-57]|[689]\\d)\\d{7}|1\\d{7,9}", [8, 9, 10, 13], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["2"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[13-9]"], "0$1"], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["1"]]], "0", 0, 0, 0, 0, 0, [["(?:1[0689]|2\\d|3[2-9]|4[2-5]|5[2-6]|7[3-7])\\d{6}", [8]], ["671[0-8]\\d{5}|(?:14|6[1-6]|[89]\\d)\\d{7}", [9]], ["(?:001800\\d|1800)\\d{6}", [10, 13]], ["1900\\d{6}", [10]], 0, 0, 0, 0, ["6[08]\\d{7}", [9]]]], "TJ": ["992", "810", "(?:00|[1-57-9]\\d)\\d{7}", [9], [["(\\d{6})(\\d)(\\d{2})", "$1 $2 $3", ["331", "3317"]], ["(\\d{3})(\\d{2})(\\d{4})", "$1 $2 $3", ["[34]7|91[78]"]], ["(\\d{4})(\\d)(\\d{4})", "$1 $2 $3", ["3[1-5]"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[0-57-9]"]]], 0, 0, 0, 0, 0, 0, [["(?:3(?:1[3-5]|2[245]|3[12]|4[24-7]|5[25]|72)|4(?:46|74|87))\\d{6}"], ["41[18]\\d{6}|(?:[034]0|[17][017]|2[02]|5[05]|8[08]|9\\d)\\d{7}"]], "8~10"], "TK": ["690", "00", "[2-47]\\d{3,6}", [4, 5, 6, 7], 0, 0, 0, 0, 0, 0, 0, [["(?:2[2-4]|[34]\\d)\\d{2,5}"], ["7[2-4]\\d{2,5}"]]], "TL": ["670", "00", "7\\d{7}|(?:[2-47]\\d|[89]0)\\d{5}", [7, 8], [["(\\d{3})(\\d{4})", "$1 $2", ["[2-489]|70"]], ["(\\d{4})(\\d{4})", "$1 $2", ["7"]]], 0, 0, 0, 0, 0, 0, [["(?:2[1-5]|3[1-9]|4[1-4])\\d{5}", [7]], ["7[2-8]\\d{6}", [8]], ["80\\d{5}", [7]], ["90\\d{5}", [7]], ["70\\d{5}", [7]]]], "TM": ["993", "810", "[1-6]\\d{7}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2-$3-$4", ["12"], "(8 $1)"], ["(\\d{3})(\\d)(\\d{2})(\\d{2})", "$1 $2-$3-$4", ["[1-5]"], "(8 $1)"], ["(\\d{2})(\\d{6})", "$1 $2", ["6"], "8 $1"]], "8", 0, 0, 0, 0, 0, [["(?:1(?:2\\d|3[1-9])|2(?:22|4[0-35-8])|3(?:22|4[03-9])|4(?:22|3[128]|4\\d|6[15])|5(?:22|5[7-9]|6[014-689]))\\d{5}"], ["6\\d{7}"]], "8~10"], "TN": ["216", "00", "[2-57-9]\\d{7}", [8], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[2-57-9]"]]], 0, 0, 0, 0, 0, 0, [["81200\\d{3}|(?:3[0-2]|7\\d)\\d{6}"], ["3(?:001|[12]40)\\d{4}|(?:(?:[259]\\d|4[0-7])\\d|3(?:1[1-35]|6[0-4]|91))\\d{5}"], ["8010\\d{4}"], ["88\\d{6}"], 0, 0, 0, 0, 0, ["8[12]10\\d{4}"]]], "TO": ["676", "00", "(?:0800|(?:[5-8]\\d\\d|999)\\d)\\d{3}|[2-8]\\d{4}", [5, 7], [["(\\d{2})(\\d{3})", "$1-$2", ["[2-4]|50|6[09]|7[0-24-69]|8[05]"]], ["(\\d{4})(\\d{3})", "$1 $2", ["0"]], ["(\\d{3})(\\d{4})", "$1 $2", ["[5-9]"]]], 0, 0, 0, 0, 0, 0, [["(?:2\\d|3[0-8]|4[0-4]|50|6[09]|7[0-24-69]|8[05])\\d{3}", [5]], ["(?:55[4-6]|6(?:[09]\\d|3[02]|8[15-9])|(?:7\\d|8[46-9])\\d|999)\\d{4}", [7]], ["0800\\d{3}", [7]], 0, 0, 0, 0, 0, ["55[0-37-9]\\d{4}", [7]]]], "TR": ["90", "00", "4\\d{6}|8\\d{11,12}|(?:[2-58]\\d\\d|900)\\d{7}", [7, 10, 12, 13], [["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["512|8[01589]|90"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["5(?:[0-59]|61)", "5(?:[0-59]|616)", "5(?:[0-59]|6161)"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[24][1-8]|3[1-9]"], "(0$1)", 1], ["(\\d{3})(\\d{3})(\\d{6,7})", "$1 $2 $3", ["80"], "0$1", 1]], "0", 0, 0, 0, 0, 0, [["(?:2(?:[13][26]|[28][2468]|[45][268]|[67][246])|3(?:[13][28]|[24-6][2468]|[78][02468]|92)|4(?:[16][246]|[23578][2468]|4[26]))\\d{7}", [10]], ["56161\\d{5}|5(?:0[15-7]|1[06]|24|[34]\\d|5[1-59]|9[46])\\d{7}", [10]], ["8(?:00\\d{7}(?:\\d{2,3})?|11\\d{7})", [10, 12, 13]], ["(?:8[89]8|900)\\d{7}", [10]], ["592(?:21[12]|461)\\d{4}", [10]], 0, ["444\\d{4}", [7]], ["512\\d{7}", [10]], ["850\\d{7}", [10]]]], "TT": ["1", "011", "(?:[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "1|([2-46-8]\\d{6})$", "868$1", 0, "868", [["868(?:2(?:01|1[5-9]|[23]\\d|4[0-2])|6(?:0[7-9]|1[02-8]|2[1-9]|[3-69]\\d|7[0-79])|82[124])\\d{4}"], ["868(?:(?:2[5-9]|3\\d)\\d|4(?:3[0-6]|[6-9]\\d)|6(?:20|78|8\\d)|7(?:0[1-9]|1[02-9]|[2-9]\\d))\\d{4}"], ["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"], ["900[2-9]\\d{6}"], ["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"]]], "TV": ["688", "00", "(?:2|7\\d\\d|90)\\d{4}", [5, 6, 7], [["(\\d{2})(\\d{3})", "$1 $2", ["2"]], ["(\\d{2})(\\d{4})", "$1 $2", ["90"]], ["(\\d{2})(\\d{5})", "$1 $2", ["7"]]], 0, 0, 0, 0, 0, 0, [["2[02-9]\\d{3}", [5]], ["(?:7[01]\\d|90)\\d{4}", [6, 7]]]], "TW": ["886", "0(?:0[25-79]|19)", "[2-689]\\d{8}|7\\d{9,10}|[2-8]\\d{7}|2\\d{6}", [7, 8, 9, 10, 11], [["(\\d{2})(\\d)(\\d{4})", "$1 $2 $3", ["202"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[258]0"], "0$1"], ["(\\d)(\\d{3,4})(\\d{4})", "$1 $2 $3", ["[23568]|4(?:0[02-48]|[1-47-9])|7[1-9]", "[23568]|4(?:0[2-48]|[1-47-9])|(?:400|7)[1-9]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[49]"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4,5})", "$1 $2 $3", ["7"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:2[2-8]\\d|370|55[01]|7[1-9])\\d{6}|4(?:(?:0(?:0[1-9]|[2-48]\\d)|1[023]\\d)\\d{4,5}|(?:[239]\\d\\d|4(?:0[56]|12|49))\\d{5})|6(?:[01]\\d{7}|4(?:0[56]|12|24|4[09])\\d{4,5})|8(?:(?:2(?:3\\d|4[0-269]|[578]0|66)|36[24-9]|90\\d\\d)\\d{4}|4(?:0[56]|12|24|4[09])\\d{4,5})|(?:2(?:2(?:0\\d\\d|4(?:0[68]|[249]0|3[0-467]|5[0-25-9]|6[0235689]))|(?:3(?:[09]\\d|1[0-4])|(?:4\\d|5[0-49]|6[0-29]|7[0-5])\\d)\\d)|(?:(?:3[2-9]|5[2-8]|6[0-35-79]|8[7-9])\\d\\d|4(?:2(?:[089]\\d|7[1-9])|(?:3[0-4]|[78]\\d|9[01])\\d))\\d)\\d{3}", [8, 9]], ["(?:40001[0-2]|9[0-8]\\d{4})\\d{3}", [9]], ["80[0-79]\\d{6}|800\\d{5}", [8, 9]], ["20(?:[013-9]\\d\\d|2)\\d{4}", [7, 9]], ["99\\d{7}", [9]], 0, ["50[0-46-9]\\d{6}", [9]], 0, ["7010(?:[0-2679]\\d|3[0-7]|8[0-5])\\d{5}|70\\d{8}", [10, 11]]], 0, "#"], "TZ": ["255", "00[056]", "(?:[25-8]\\d|41|90)\\d{7}", [9], [["(\\d{3})(\\d{2})(\\d{4})", "$1 $2 $3", ["[89]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[24]"], "0$1"], ["(\\d{2})(\\d{7})", "$1 $2", ["5"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[67]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["2[2-8]\\d{7}"], ["77[2-9]\\d{6}|(?:6[125-9]|7[13-689])\\d{7}"], ["80[08]\\d{6}"], ["90\\d{7}"], 0, 0, 0, 0, ["41\\d{7}"], ["8(?:40|6[01])\\d{6}"]]], "UA": ["380", "00", "[89]\\d{9}|[3-9]\\d{8}", [9, 10], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["6[12][29]|(?:3[1-8]|4[136-8]|5[12457]|6[49])2|(?:56|65)[24]", "6[12][29]|(?:35|4[1378]|5[12457]|6[49])2|(?:56|65)[24]|(?:3[1-46-8]|46)2[013-9]"], "0$1"], ["(\\d{4})(\\d{5})", "$1 $2", ["3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6[0135689]|7[4-6])|6(?:[12][3-7]|[459])", "3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6(?:[015689]|3[02389])|7[4-6])|6(?:[12][3-7]|[459])"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[3-7]|89|9[1-9]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[89]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:3[1-8]|4[13-8]|5[1-7]|6[12459])\\d{7}", [9]], ["(?:39|50|6[36-8]|7[1-3]|9[1-9])\\d{7}", [9]], ["800[1-8]\\d{5,6}"], ["900[239]\\d{5,6}"], 0, 0, 0, 0, ["89[1-579]\\d{6}", [9]]], "0~0"], "UG": ["256", "00[057]", "800\\d{6}|(?:[29]0|[347]\\d)\\d{7}", [9], [["(\\d{4})(\\d{5})", "$1 $2", ["202", "2024"], "0$1"], ["(\\d{3})(\\d{6})", "$1 $2", ["[27-9]|4(?:6[45]|[7-9])"], "0$1"], ["(\\d{2})(\\d{7})", "$1 $2", ["[34]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["20(?:(?:240|30[67])\\d|6(?:00[0-2]|30[0-4]))\\d{3}|(?:20(?:[017]\\d|2[5-9]|32|5[0-4]|6[15-9])|[34]\\d{3})\\d{5}"], ["726[01]\\d{5}|7(?:[01578]\\d|20|36|[46][0-4]|9[89])\\d{6}"], ["800[1-3]\\d{5}"], ["90[1-3]\\d{6}"]]], "US": ["1", "011", "[2-9]\\d{9}|3\\d{6}", [10], [["(\\d{3})(\\d{4})", "$1-$2", ["310"], 0, 1], ["(\\d{3})(\\d{3})(\\d{4})", "($1) $2-$3", ["[2-9]"], 0, 1, "$1-$2-$3"]], "1", 0, 0, 0, 0, 0, [["505(?:[2-57-9]\\d\\d|6(?:[0-35-9]\\d|44))\\d{4}|(?:2(?:0[1-35-9]|1[02-9]|2[03-589]|3[149]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-57-9]|1[02-9]|2[01356]|3[0-24679]|4[167]|5[12]|6[014]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[19]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|[34][016]|5[01679]|6[0-279]|78|8[0-29])|7(?:0[1-46-8]|1[2-9]|2[04-7]|3[1247]|4[037]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[068]|3[0-289]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-389]|8[04-69]))[2-9]\\d{6}"], [""], ["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"], ["900[2-9]\\d{6}"], ["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"]]], "UY": ["598", "0(?:0|1[3-9]\\d)", "4\\d{9}|[1249]\\d{7}|(?:[49]\\d|80)\\d{5}", [7, 8, 10], [["(\\d{3})(\\d{4})", "$1 $2", ["405|8|90"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["9"], "0$1"], ["(\\d{4})(\\d{4})", "$1 $2", ["[124]"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["4"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:1(?:770|987)|(?:2\\d|4[2-7])\\d\\d)\\d{4}", [8]], ["9[1-9]\\d{6}", [8]], ["(?:4\\d{5}|80[05])\\d{4}|405\\d{4}", [7, 10]], ["90[0-8]\\d{4}", [7]]], "00", " int. "], "UZ": ["998", "810", "(?:33|55|[679]\\d|88)\\d{7}", [9], [["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[35-9]"], "8 $1"]], "8", 0, 0, 0, 0, 0, [["(?:6(?:1(?:22|3[124]|4[1-4]|5[1-3578]|64)|2(?:22|3[0-57-9]|41)|5(?:22|3[3-7]|5[024-8])|6\\d\\d|7(?:[23]\\d|7[69])|9(?:22|4[1-8]|6[135]))|7(?:0(?:5[4-9]|6[0146]|7[124-6]|9[135-8])|(?:1[12]|8\\d)\\d|2(?:22|3[13-57-9]|4[1-3579]|5[14])|3(?:2\\d|3[1578]|4[1-35-7]|5[1-57]|61)|4(?:2\\d|3[1-579]|7[1-79])|5(?:22|5[1-9]|6[1457])|6(?:22|3[12457]|4[13-8])|9(?:22|5[1-9])))\\d{5}"], ["(?:(?:33|88|9[0-57-9])\\d{3}|55(?:50[013]|90\\d)|6(?:1(?:2(?:2[01]|98)|35[0-4]|50\\d|61[23]|7(?:[01][017]|4\\d|55|9[5-9]))|2(?:(?:11|7\\d)\\d|2(?:[12]1|9[01379])|5(?:[126]\\d|3[0-4]))|5(?:19[01]|2(?:27|9[26])|(?:30|59|7\\d)\\d)|6(?:2(?:1[5-9]|2[0367]|38|41|52|60)|(?:3[79]|9[0-3])\\d|4(?:56|83)|7(?:[07]\\d|1[017]|3[07]|4[047]|5[057]|67|8[0178]|9[79]))|7(?:2(?:24|3[237]|4[5-9]|7[15-8])|5(?:7[12]|8[0589])|7(?:0\\d|[39][07])|9(?:0\\d|7[079]))|9(?:2(?:1[1267]|3[01]|5\\d|7[0-4])|(?:5[67]|7\\d)\\d|6(?:2[0-26]|8\\d)))|7(?:[07]\\d{3}|1(?:13[01]|6(?:0[47]|1[67]|66)|71[3-69]|98\\d)|2(?:2(?:2[79]|95)|3(?:2[5-9]|6[0-6])|57\\d|7(?:0\\d|1[17]|2[27]|3[37]|44|5[057]|66|88))|3(?:2(?:1[0-6]|21|3[469]|7[159])|(?:33|9[4-6])\\d|5(?:0[0-4]|5[579]|9\\d)|7(?:[0-3579]\\d|4[0467]|6[67]|8[078]))|4(?:2(?:29|5[0257]|6[0-7]|7[1-57])|5(?:1[0-4]|8\\d|9[5-9])|7(?:0\\d|1[024589]|2[0-27]|3[0137]|[46][07]|5[01]|7[5-9]|9[079])|9(?:7[015-9]|[89]\\d))|5(?:112|2(?:0\\d|2[29]|[49]4)|3[1568]\\d|52[6-9]|7(?:0[01578]|1[017]|[23]7|4[047]|[5-7]\\d|8[78]|9[079]))|6(?:2(?:2[1245]|4[2-4])|39\\d|41[179]|5(?:[349]\\d|5[0-2])|7(?:0[017]|[13]\\d|22|44|55|67|88))|9(?:22[128]|3(?:2[0-4]|7\\d)|57[02569]|7(?:2[05-9]|3[37]|4\\d|60|7[2579]|87|9[07]))))\\d{4}"]], "8~10"], "VA": ["39", "00", "0\\d{5,10}|3[0-8]\\d{7,10}|55\\d{8}|8\\d{5}(?:\\d{2,4})?|(?:1\\d|39)\\d{7,8}", [6, 7, 8, 9, 10, 11], 0, 0, 0, 0, 0, 0, "06698", [["06698\\d{1,6}"], ["3[1-9]\\d{8}|3[2-9]\\d{7}", [9, 10]], ["80(?:0\\d{3}|3)\\d{3}", [6, 9]], ["(?:0878\\d{3}|89(?:2\\d|3[04]|4(?:[0-4]|[5-9]\\d\\d)|5[0-4]))\\d\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\d{6}", [6, 8, 9, 10]], ["1(?:78\\d|99)\\d{6}", [9, 10]], 0, 0, 0, ["55\\d{8}", [10]], ["84(?:[08]\\d{3}|[17])\\d{3}", [6, 9]]]], "VC": ["1", "011", "(?:[58]\\d\\d|784|900)\\d{7}", [10], 0, "1", 0, "1|([2-7]\\d{6})$", "784$1", 0, "784", [["784(?:266|3(?:6[6-9]|7\\d|8[0-6])|4(?:38|5[0-36-8]|8[0-8])|5(?:55|7[0-2]|93)|638|784)\\d{4}"], ["784(?:4(?:3[0-5]|5[45]|89|9[0-8])|5(?:2[6-9]|3[0-4])|720)\\d{4}"], ["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"], ["900[2-9]\\d{6}"], ["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"], 0, 0, 0, ["78451[0-2]\\d{4}"]]], "VE": ["58", "00", "[68]00\\d{7}|(?:[24]\\d|[59]0)\\d{8}", [10], [["(\\d{3})(\\d{7})", "$1-$2", ["[24-689]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:2(?:12|3[457-9]|[467]\\d|[58][1-9]|9[1-6])|[4-6]00)\\d{7}"], ["4(?:1[24-8]|2[46])\\d{7}"], ["800\\d{7}"], ["90[01]\\d{7}"], 0, 0, ["501\\d{7}"]]], "VG": ["1", "011", "(?:284|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "1|([2-578]\\d{6})$", "284$1", 0, "284", [["284496[0-5]\\d{3}|284(?:229|4(?:22|9[45])|774|8(?:52|6[459]))\\d{4}"], ["284496[6-9]\\d{3}|284(?:245|3(?:0[0-3]|4[0-7]|68|9[34])|4(?:4[0-6]|68|99)|5(?:4[0-7]|68|9[69]))\\d{4}"], ["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"], ["900[2-9]\\d{6}"], ["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"]]], "VI": ["1", "011", "[58]\\d{9}|(?:34|90)0\\d{7}", [10], 0, "1", 0, "1|([2-9]\\d{6})$", "340$1", 0, "340", [["340(?:2(?:0[0-38]|2[06-8]|4[49]|77)|3(?:32|44)|4(?:2[23]|44|7[34]|89)|5(?:1[34]|55)|6(?:2[56]|4[23]|77|9[023])|7(?:1[2-57-9]|2[57]|7\\d)|884|998)\\d{4}"], [""], ["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"], ["900[2-9]\\d{6}"], ["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-7]|33|44|66|77|88)[2-9]\\d{6}"]]], "VN": ["84", "00", "[12]\\d{9}|[135-9]\\d{8}|[16]\\d{7}|[16-8]\\d{6}", [7, 8, 9, 10], [["(\\d{2})(\\d{5})", "$1 $2", ["80"], "0$1", 1], ["(\\d{4})(\\d{4,6})", "$1 $2", ["1"], 0, 1], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[69]"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[3578]"], "0$1", 1], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["2[48]"], "0$1", 1], ["(\\d{3})(\\d{4})(\\d{3})", "$1 $2 $3", ["2"], "0$1", 1]], "0", 0, 0, 0, 0, 0, [["2(?:0[3-9]|1[0-689]|2[0-25-9]|3[2-9]|4[2-8]|5[124-9]|6[0-39]|7[0-7]|8[2-79]|9[0-4679])\\d{7}", [10]], ["(?:5(?:2[238]|59)|89[6-9]|99[013-9])\\d{6}|(?:3\\d|5[689]|7[06-9]|8[1-8]|9[0-8])\\d{7}", [9]], ["1800\\d{4,6}|12(?:0[13]|28)\\d{4}", [8, 9, 10]], ["1900\\d{4,6}", [8, 9, 10]], 0, 0, ["(?:[17]99|80\\d)\\d{4}|69\\d{5,6}", [7, 8]], 0, ["672\\d{6}", [9]]]], "VU": ["678", "00", "[57-9]\\d{6}|(?:[238]\\d|48)\\d{3}", [5, 7], [["(\\d{3})(\\d{4})", "$1 $2", ["[57-9]"]]], 0, 0, 0, 0, 0, 0, [["(?:38[0-8]|48[4-9])\\d\\d|(?:2[02-9]|3[4-7]|88)\\d{3}", [5]], ["(?:[58]\\d|7[013-7])\\d{5}", [7]], ["81[18]\\d\\d", [5]], 0, 0, 0, ["(?:3[03]|900\\d)\\d{3}"], 0, ["9(?:0[1-9]|1[01])\\d{4}", [7]]]], "WF": ["681", "00", "(?:40|72)\\d{4}|8\\d{5}(?:\\d{3})?", [6, 9], [["(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3", ["[478]"]], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"]]], 0, 0, 0, 0, 0, 0, [["72\\d{4}", [6]], ["(?:72|8[23])\\d{4}", [6]], ["80[0-5]\\d{6}", [9]]]], "WS": ["685", "0", "(?:[2-6]|8\\d{5})\\d{4}|[78]\\d{6}|[68]\\d{5}", [5, 6, 7, 10], [["(\\d{5})", "$1", ["[2-5]|6[1-9]"]], ["(\\d{3})(\\d{3,7})", "$1 $2", ["[68]"]], ["(\\d{2})(\\d{5})", "$1 $2", ["7"]]], 0, 0, 0, 0, 0, 0, [["6[1-9]\\d{3}|(?:[2-5]|60)\\d{4}", [5, 6]], ["(?:7[1-35-7]|8(?:[3-7]|9\\d{3}))\\d{5}", [7, 10]], ["800\\d{3}", [6]]]], "XK": ["383", "00", "[23]\\d{7,8}|(?:4\\d\\d|[89]00)\\d{5}", [8, 9], [["(\\d{3})(\\d{5})", "$1 $2", ["[89]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[2-4]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[23]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:2[89]|39)0\\d{6}|[23][89]\\d{6}"], ["4[3-9]\\d{6}", [8]], ["800\\d{5}", [8]], ["900\\d{5}", [8]]]], "YE": ["967", "00", "(?:1|7\\d)\\d{7}|[1-7]\\d{6}", [7, 8, 9], [["(\\d)(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[1-6]|7[24-68]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["7"], "0$1"]], "0", 0, 0, 0, 0, 0, [["78[0-7]\\d{4}|17\\d{6}|(?:[12][2-68]|3[2358]|4[2-58]|5[2-6]|6[3-58]|7[24-6])\\d{5}", [7, 8]], ["7[0137]\\d{7}", [9]]]], "YT": ["262", "00", "80\\d{7}|(?:26|63)9\\d{6}", [9], 0, "0", 0, 0, 0, 0, "269|63", [["269(?:0[0-367]|5[0-3]|6\\d|[78]0)\\d{4}"], ["639(?:0[0-79]|1[019]|[267]\\d|3[09]|40|5[05-9]|9[04-79])\\d{4}"], ["80\\d{7}"]]], "ZA": ["27", "00", "[1-79]\\d{8}|8\\d{4,9}", [5, 6, 7, 8, 9, 10], [["(\\d{2})(\\d{3,4})", "$1 $2", ["8[1-4]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2,3})", "$1 $2 $3", ["8[1-4]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["860"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[1-9]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["8"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:2(?:0330|4302)|52087)0\\d{3}|(?:1[0-8]|2[1-378]|3[1-69]|4\\d|5[1346-8])\\d{7}", [9]], ["(?:1(?:3492[0-25]|4495[0235]|549(?:20|5[01]))|4[34]492[01])\\d{3}|8[1-4]\\d{3,7}|(?:2[27]|47|54)4950\\d{3}|(?:1(?:049[2-4]|9[12]\\d\\d)|(?:6\\d|7[0-46-9])\\d{3}|8(?:5\\d{3}|7(?:08[67]|158|28[5-9]|310)))\\d{4}|(?:1[6-8]|28|3[2-69]|4[025689]|5[36-8])4920\\d{3}|(?:12|[2-5]1)492\\d{4}", [5, 6, 7, 8, 9]], ["80\\d{7}", [9]], ["(?:86[2-9]|9[0-2]\\d)\\d{6}", [9]], 0, 0, ["861\\d{6,7}", [9, 10]], 0, ["87(?:08[0-589]|15[0-79]|28[0-4]|31[1-9])\\d{4}|87(?:[02][0-79]|1[0-46-9]|3[02-9]|[4-9]\\d)\\d{5}", [9]], ["860\\d{6}", [9]]]], "ZM": ["260", "00", "800\\d{6}|(?:21|63|[79]\\d)\\d{7}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[28]"], "0$1"], ["(\\d{2})(\\d{7})", "$1 $2", ["[79]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["21[1-8]\\d{6}"], ["(?:7[5-79]|9[5-8])\\d{7}"], ["800\\d{6}"], 0, 0, 0, 0, 0, ["63\\d{7}"]]], "ZW": ["263", "00", "2(?:[0-57-9]\\d{6,8}|6[0-24-9]\\d{6,7})|[38]\\d{9}|[35-8]\\d{8}|[3-6]\\d{7}|[1-689]\\d{6}|[1-3569]\\d{5}|[1356]\\d{4}", [5, 6, 7, 8, 9, 10], [["(\\d{3})(\\d{3,5})", "$1 $2", ["2(?:0[45]|2[278]|[49]8)|3(?:[09]8|17)|6(?:[29]8|37|75)|[23][78]|(?:33|5[15]|6[68])[78]"], "0$1"], ["(\\d)(\\d{3})(\\d{2,4})", "$1 $2 $3", ["[49]"], "0$1"], ["(\\d{3})(\\d{4})", "$1 $2", ["80"], "0$1"], ["(\\d{2})(\\d{7})", "$1 $2", ["24|8[13-59]|(?:2[05-79]|39|5[45]|6[15-8])2", "2(?:02[014]|4|[56]20|[79]2)|392|5(?:42|525)|6(?:[16-8]21|52[013])|8[13-59]"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["7"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["2(?:1[39]|2[0157]|[378]|[56][14])|3(?:12|29)", "2(?:1[39]|2[0157]|[378]|[56][14])|3(?:123|29)"], "0$1"], ["(\\d{4})(\\d{6})", "$1 $2", ["8"], "0$1"], ["(\\d{2})(\\d{3,5})", "$1 $2", ["1|2(?:0[0-36-9]|12|29|[56])|3(?:1[0-689]|[24-6])|5(?:[0236-9]|1[2-4])|6(?:[013-59]|7[0-46-9])|(?:33|55|6[68])[0-69]|(?:29|3[09]|62)[0-79]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["29[013-9]|39|54"], "0$1"], ["(\\d{4})(\\d{3,5})", "$1 $2", ["(?:25|54)8", "258|5483"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:1(?:(?:3\\d|9)\\d|[4-8])|2(?:(?:(?:0(?:2[014]|5)|(?:2[0157]|31|84|9)\\d\\d|[56](?:[14]\\d\\d|20)|7(?:[089]|2[03]|[35]\\d\\d))\\d|4(?:2\\d\\d|8))\\d|1(?:2|[39]\\d{4}))|3(?:(?:123|(?:29\\d|92)\\d)\\d\\d|7(?:[19]|[56]\\d))|5(?:0|1[2-478]|26|[37]2|4(?:2\\d{3}|83)|5(?:25\\d\\d|[78])|[689]\\d)|6(?:(?:[16-8]21|28|52[013])\\d\\d|[39])|8(?:[1349]28|523)\\d\\d)\\d{3}|(?:4\\d\\d|9[2-9])\\d{4,5}|(?:(?:2(?:(?:(?:0|8[146])\\d|7[1-7])\\d|2(?:[278]\\d|92)|58(?:2\\d|3))|3(?:[26]|9\\d{3})|5(?:4\\d|5)\\d\\d)\\d|6(?:(?:(?:[0-246]|[78]\\d)\\d|37)\\d|5[2-8]))\\d\\d|(?:2(?:[569]\\d|8[2-57-9])|3(?:[013-59]\\d|8[37])|6[89]8)\\d{3}"], ["7(?:[178]\\d|3[1-9])\\d{6}", [9]], ["80(?:[01]\\d|20|8[0-8])\\d{3}", [7]], 0, 0, 0, 0, 0, ["86(?:1[12]|22|30|44|55|77|8[368])\\d{6}", [10]]]] }, "nonGeographic": { "800": ["800", 0, "(?:00|[1-9]\\d)\\d{6}", [8], [["(\\d{4})(\\d{4})", "$1 $2", ["\\d"]]], 0, 0, 0, 0, 0, 0, [0, 0, ["(?:00|[1-9]\\d)\\d{6}"]]], "808": ["808", 0, "[1-9]\\d{7}", [8], [["(\\d{4})(\\d{4})", "$1 $2", ["[1-9]"]]], 0, 0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0, 0, 0, 0, ["[1-9]\\d{7}"]]], "870": ["870", 0, "7\\d{11}|[35-7]\\d{8}", [9, 12], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[35-7]"]]], 0, 0, 0, 0, 0, 0, [0, ["(?:[356]|774[45])\\d{8}|7[6-8]\\d{7}"]]], "878": ["878", 0, "10\\d{10}", [12], [["(\\d{2})(\\d{5})(\\d{5})", "$1 $2 $3", ["1"]]], 0, 0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0, 0, 0, ["10\\d{10}"]]], "881": ["881", 0, "[0-36-9]\\d{8}", [9], [["(\\d)(\\d{3})(\\d{5})", "$1 $2 $3", ["[0-36-9]"]]], 0, 0, 0, 0, 0, 0, [0, ["[0-36-9]\\d{8}"]]], "882": ["882", 0, "[13]\\d{6}(?:\\d{2,5})?|285\\d{9}|(?:[19]\\d|49)\\d{6}", [7, 8, 9, 10, 11, 12], [["(\\d{2})(\\d{5})", "$1 $2", ["16|342"]], ["(\\d{2})(\\d{6})", "$1 $2", ["4"]], ["(\\d{2})(\\d{2})(\\d{4})", "$1 $2 $3", ["[19]"]], ["(\\d{2})(\\d{4})(\\d{3})", "$1 $2 $3", ["3[23]"]], ["(\\d{2})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["1"]], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["34[57]"]], ["(\\d{3})(\\d{4})(\\d{4})", "$1 $2 $3", ["34"]], ["(\\d{2})(\\d{4,5})(\\d{5})", "$1 $2 $3", ["[1-3]"]]], 0, 0, 0, 0, 0, 0, [0, ["342\\d{4}|(?:337|49)\\d{6}|3(?:2|47|7\\d{3})\\d{7}", [7, 8, 9, 10, 12]], 0, 0, 0, 0, 0, 0, ["1(?:3(?:0[0347]|[13][0139]|2[035]|4[013568]|6[0459]|7[06]|8[15-8]|9[0689])\\d{4}|6\\d{5,10})|(?:(?:285\\d\\d|3(?:45|[69]\\d{3}))\\d|9[89])\\d{6}"]]], "883": ["883", 0, "(?:210|370\\d\\d)\\d{7}|51\\d{7}(?:\\d{3})?", [9, 10, 12], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["510"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["2"]], ["(\\d{4})(\\d{4})(\\d{4})", "$1 $2 $3", ["51[13]"]], ["(\\d{3})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["[35]"]]], 0, 0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0, 0, 0, ["(?:210|(?:370[1-9]|51[013]0)\\d)\\d{7}|5100\\d{5}"]]], "888": ["888", 0, "\\d{11}", [11], [["(\\d{3})(\\d{3})(\\d{5})", "$1 $2 $3"]], 0, 0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0, ["\\d{11}"]]], "979": ["979", 0, "[1359]\\d{8}", [9], [["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["[1359]"]]], 0, 0, 0, 0, 0, 0, [0, 0, 0, ["[1359]\\d{8}"]]] } }; function withMetadataArgument(func, _arguments) { var args = Array.prototype.slice.call(_arguments); args.push(metadata); return func.apply(this, args); } var objectGetOwnPropertyNamesExternal = {}; /* eslint-disable es/no-object-getownpropertynames -- safe */ var classof$1 = classofRaw$2; var toIndexedObject$3 = toIndexedObject$d; var $getOwnPropertyNames$1 = objectGetOwnPropertyNames.f; var arraySlice$1 = arraySliceSimple; var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : []; var getWindowNames = function (it) { try { return $getOwnPropertyNames$1(it); } catch (error) { return arraySlice$1(windowNames); } }; // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window objectGetOwnPropertyNamesExternal.f = function getOwnPropertyNames(it) { return windowNames && classof$1(it) == 'Window' ? getWindowNames(it) : $getOwnPropertyNames$1(toIndexedObject$3(it)); }; var wellKnownSymbolWrapped = {}; var wellKnownSymbol$4 = wellKnownSymbol$t; wellKnownSymbolWrapped.f = wellKnownSymbol$4; var global$6 = global$B; var path$1 = global$6; var path = path$1; var hasOwn$7 = hasOwnProperty_1; var wrappedWellKnownSymbolModule$1 = wellKnownSymbolWrapped; var defineProperty$4 = objectDefineProperty.f; var wellKnownSymbolDefine = function (NAME) { var Symbol = path.Symbol || (path.Symbol = {}); if (!hasOwn$7(Symbol, NAME)) defineProperty$4(Symbol, NAME, { value: wrappedWellKnownSymbolModule$1.f(NAME) }); }; var call$3 = functionCall; var getBuiltIn$3 = getBuiltIn$d; var wellKnownSymbol$3 = wellKnownSymbol$t; var defineBuiltIn$3 = defineBuiltIn$i; var symbolDefineToPrimitive = function () { var Symbol = getBuiltIn$3('Symbol'); var SymbolPrototype = Symbol && Symbol.prototype; var valueOf = SymbolPrototype && SymbolPrototype.valueOf; var TO_PRIMITIVE = wellKnownSymbol$3('toPrimitive'); if (SymbolPrototype && !SymbolPrototype[TO_PRIMITIVE]) { // `Symbol.prototype[@@toPrimitive]` method // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive // eslint-disable-next-line no-unused-vars -- required for .length defineBuiltIn$3(SymbolPrototype, TO_PRIMITIVE, function (hint) { return call$3(valueOf, this); }, { arity: 1 }); } }; var $$i = _export; var global$5 = global$B; var call$2 = functionCall; var uncurryThis$a = functionUncurryThis; var DESCRIPTORS$6 = descriptors; var NATIVE_SYMBOL$4 = symbolConstructorDetection; var fails$c = fails$J; var hasOwn$6 = hasOwnProperty_1; var isPrototypeOf$2 = objectIsPrototypeOf; var anObject$2 = anObject$l; var toIndexedObject$2 = toIndexedObject$d; var toPropertyKey = toPropertyKey$4; var $toString = toString$j; var createPropertyDescriptor = createPropertyDescriptor$6; var nativeObjectCreate = objectCreate; var objectKeys = objectKeys$4; var getOwnPropertyNamesModule$1 = objectGetOwnPropertyNames; var getOwnPropertyNamesExternal = objectGetOwnPropertyNamesExternal; var getOwnPropertySymbolsModule$1 = objectGetOwnPropertySymbols; var getOwnPropertyDescriptorModule$1 = objectGetOwnPropertyDescriptor; var definePropertyModule = objectDefineProperty; var definePropertiesModule = objectDefineProperties; var propertyIsEnumerableModule = objectPropertyIsEnumerable; var defineBuiltIn$2 = defineBuiltIn$i; var shared$2 = shared$7.exports; var sharedKey = sharedKey$4; var hiddenKeys$1 = hiddenKeys$6; var uid$1 = uid$4; var wellKnownSymbol$2 = wellKnownSymbol$t; var wrappedWellKnownSymbolModule = wellKnownSymbolWrapped; var defineWellKnownSymbol$1 = wellKnownSymbolDefine; var defineSymbolToPrimitive = symbolDefineToPrimitive; var setToStringTag$1 = setToStringTag$7; var InternalStateModule$2 = internalState; var $forEach = arrayIteration.forEach; var HIDDEN = sharedKey('hidden'); var SYMBOL = 'Symbol'; var PROTOTYPE = 'prototype'; var setInternalState$2 = InternalStateModule$2.set; var getInternalState = InternalStateModule$2.getterFor(SYMBOL); var ObjectPrototype$1 = Object[PROTOTYPE]; var $Symbol = global$5.Symbol; var SymbolPrototype$1 = $Symbol && $Symbol[PROTOTYPE]; var TypeError$1 = global$5.TypeError; var QObject = global$5.QObject; var nativeGetOwnPropertyDescriptor$1 = getOwnPropertyDescriptorModule$1.f; var nativeDefineProperty = definePropertyModule.f; var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f; var nativePropertyIsEnumerable = propertyIsEnumerableModule.f; var push$2 = uncurryThis$a([].push); var AllSymbols = shared$2('symbols'); var ObjectPrototypeSymbols = shared$2('op-symbols'); var WellKnownSymbolsStore = shared$2('wks'); // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 var setSymbolDescriptor = DESCRIPTORS$6 && fails$c(function () { return nativeObjectCreate(nativeDefineProperty({}, 'a', { get: function () { return nativeDefineProperty(this, 'a', { value: 7 }).a; } })).a != 7; }) ? function (O, P, Attributes) { var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor$1(ObjectPrototype$1, P); if (ObjectPrototypeDescriptor) delete ObjectPrototype$1[P]; nativeDefineProperty(O, P, Attributes); if (ObjectPrototypeDescriptor && O !== ObjectPrototype$1) { nativeDefineProperty(ObjectPrototype$1, P, ObjectPrototypeDescriptor); } } : nativeDefineProperty; var wrap = function (tag, description) { var symbol = AllSymbols[tag] = nativeObjectCreate(SymbolPrototype$1); setInternalState$2(symbol, { type: SYMBOL, tag: tag, description: description }); if (!DESCRIPTORS$6) symbol.description = description; return symbol; }; var $defineProperty = function defineProperty(O, P, Attributes) { if (O === ObjectPrototype$1) $defineProperty(ObjectPrototypeSymbols, P, Attributes); anObject$2(O); var key = toPropertyKey(P); anObject$2(Attributes); if (hasOwn$6(AllSymbols, key)) { if (!Attributes.enumerable) { if (!hasOwn$6(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {})); O[HIDDEN][key] = true; } else { if (hasOwn$6(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false; Attributes = nativeObjectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) }); } return setSymbolDescriptor(O, key, Attributes); } return nativeDefineProperty(O, key, Attributes); }; var $defineProperties = function defineProperties(O, Properties) { anObject$2(O); var properties = toIndexedObject$2(Properties); var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties)); $forEach(keys, function (key) { if (!DESCRIPTORS$6 || call$2($propertyIsEnumerable, properties, key)) $defineProperty(O, key, properties[key]); }); return O; }; var $create = function create(O, Properties) { return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties); }; var $propertyIsEnumerable = function propertyIsEnumerable(V) { var P = toPropertyKey(V); var enumerable = call$2(nativePropertyIsEnumerable, this, P); if (this === ObjectPrototype$1 && hasOwn$6(AllSymbols, P) && !hasOwn$6(ObjectPrototypeSymbols, P)) return false; return enumerable || !hasOwn$6(this, P) || !hasOwn$6(AllSymbols, P) || hasOwn$6(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true; }; var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) { var it = toIndexedObject$2(O); var key = toPropertyKey(P); if (it === ObjectPrototype$1 && hasOwn$6(AllSymbols, key) && !hasOwn$6(ObjectPrototypeSymbols, key)) return; var descriptor = nativeGetOwnPropertyDescriptor$1(it, key); if (descriptor && hasOwn$6(AllSymbols, key) && !(hasOwn$6(it, HIDDEN) && it[HIDDEN][key])) { descriptor.enumerable = true; } return descriptor; }; var $getOwnPropertyNames = function getOwnPropertyNames(O) { var names = nativeGetOwnPropertyNames(toIndexedObject$2(O)); var result = []; $forEach(names, function (key) { if (!hasOwn$6(AllSymbols, key) && !hasOwn$6(hiddenKeys$1, key)) push$2(result, key); }); return result; }; var $getOwnPropertySymbols = function (O) { var IS_OBJECT_PROTOTYPE = O === ObjectPrototype$1; var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject$2(O)); var result = []; $forEach(names, function (key) { if (hasOwn$6(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || hasOwn$6(ObjectPrototype$1, key))) { push$2(result, AllSymbols[key]); } }); return result; }; // `Symbol` constructor // https://tc39.es/ecma262/#sec-symbol-constructor if (!NATIVE_SYMBOL$4) { $Symbol = function Symbol() { if (isPrototypeOf$2(SymbolPrototype$1, this)) throw TypeError$1('Symbol is not a constructor'); var description = !arguments.length || arguments[0] === undefined ? undefined : $toString(arguments[0]); var tag = uid$1(description); var setter = function (value) { if (this === ObjectPrototype$1) call$2(setter, ObjectPrototypeSymbols, value); if (hasOwn$6(this, HIDDEN) && hasOwn$6(this[HIDDEN], tag)) this[HIDDEN][tag] = false; setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value)); }; if (DESCRIPTORS$6 && USE_SETTER) setSymbolDescriptor(ObjectPrototype$1, tag, { configurable: true, set: setter }); return wrap(tag, description); }; SymbolPrototype$1 = $Symbol[PROTOTYPE]; defineBuiltIn$2(SymbolPrototype$1, 'toString', function toString() { return getInternalState(this).tag; }); defineBuiltIn$2($Symbol, 'withoutSetter', function (description) { return wrap(uid$1(description), description); }); propertyIsEnumerableModule.f = $propertyIsEnumerable; definePropertyModule.f = $defineProperty; definePropertiesModule.f = $defineProperties; getOwnPropertyDescriptorModule$1.f = $getOwnPropertyDescriptor; getOwnPropertyNamesModule$1.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames; getOwnPropertySymbolsModule$1.f = $getOwnPropertySymbols; wrappedWellKnownSymbolModule.f = function (name) { return wrap(wellKnownSymbol$2(name), name); }; if (DESCRIPTORS$6) { // https://github.com/tc39/proposal-Symbol-description nativeDefineProperty(SymbolPrototype$1, 'description', { configurable: true, get: function description() { return getInternalState(this).description; } }); { defineBuiltIn$2(ObjectPrototype$1, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true }); } } } $$i({ global: true, constructor: true, wrap: true, forced: !NATIVE_SYMBOL$4, sham: !NATIVE_SYMBOL$4 }, { Symbol: $Symbol }); $forEach(objectKeys(WellKnownSymbolsStore), function (name) { defineWellKnownSymbol$1(name); }); $$i({ target: SYMBOL, stat: true, forced: !NATIVE_SYMBOL$4 }, { useSetter: function () { USE_SETTER = true; }, useSimple: function () { USE_SETTER = false; } }); $$i({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL$4, sham: !DESCRIPTORS$6 }, { // `Object.create` method // https://tc39.es/ecma262/#sec-object.create create: $create, // `Object.defineProperty` method // https://tc39.es/ecma262/#sec-object.defineproperty defineProperty: $defineProperty, // `Object.defineProperties` method // https://tc39.es/ecma262/#sec-object.defineproperties defineProperties: $defineProperties, // `Object.getOwnPropertyDescriptor` method // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors getOwnPropertyDescriptor: $getOwnPropertyDescriptor }); $$i({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL$4 }, { // `Object.getOwnPropertyNames` method // https://tc39.es/ecma262/#sec-object.getownpropertynames getOwnPropertyNames: $getOwnPropertyNames }); // `Symbol.prototype[@@toPrimitive]` method // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive defineSymbolToPrimitive(); // `Symbol.prototype[@@toStringTag]` property // https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag setToStringTag$1($Symbol, SYMBOL); hiddenKeys$1[HIDDEN] = true; var NATIVE_SYMBOL$3 = symbolConstructorDetection; /* eslint-disable es/no-symbol -- safe */ var symbolRegistryDetection = NATIVE_SYMBOL$3 && !!Symbol['for'] && !!Symbol.keyFor; var $$h = _export; var getBuiltIn$2 = getBuiltIn$d; var hasOwn$5 = hasOwnProperty_1; var toString$4 = toString$j; var shared$1 = shared$7.exports; var NATIVE_SYMBOL_REGISTRY$1 = symbolRegistryDetection; var StringToSymbolRegistry = shared$1('string-to-symbol-registry'); var SymbolToStringRegistry$1 = shared$1('symbol-to-string-registry'); // `Symbol.for` method // https://tc39.es/ecma262/#sec-symbol.for $$h({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY$1 }, { 'for': function (key) { var string = toString$4(key); if (hasOwn$5(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string]; var symbol = getBuiltIn$2('Symbol')(string); StringToSymbolRegistry[string] = symbol; SymbolToStringRegistry$1[symbol] = string; return symbol; } }); var $$g = _export; var hasOwn$4 = hasOwnProperty_1; var isSymbol$1 = isSymbol$5; var tryToString = tryToString$6; var shared = shared$7.exports; var NATIVE_SYMBOL_REGISTRY = symbolRegistryDetection; var SymbolToStringRegistry = shared('symbol-to-string-registry'); // `Symbol.keyFor` method // https://tc39.es/ecma262/#sec-symbol.keyfor $$g({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, { keyFor: function keyFor(sym) { if (!isSymbol$1(sym)) throw TypeError(tryToString(sym) + ' is not a symbol'); if (hasOwn$4(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym]; } }); var $$f = _export; var getBuiltIn$1 = getBuiltIn$d; var apply$1 = functionApply; var call$1 = functionCall; var uncurryThis$9 = functionUncurryThis; var fails$b = fails$J; var isArray = isArray$6; var isCallable$3 = isCallable$u; var isObject$7 = isObject$o; var isSymbol = isSymbol$5; var arraySlice = arraySlice$8; var NATIVE_SYMBOL$2 = symbolConstructorDetection; var $stringify = getBuiltIn$1('JSON', 'stringify'); var exec$1 = uncurryThis$9(/./.exec); var charAt$1 = uncurryThis$9(''.charAt); var charCodeAt = uncurryThis$9(''.charCodeAt); var replace$2 = uncurryThis$9(''.replace); var numberToString = uncurryThis$9(1.0.toString); var tester = /[\uD800-\uDFFF]/g; var low = /^[\uD800-\uDBFF]$/; var hi = /^[\uDC00-\uDFFF]$/; var WRONG_SYMBOLS_CONVERSION = !NATIVE_SYMBOL$2 || fails$b(function () { var symbol = getBuiltIn$1('Symbol')(); // MS Edge converts symbol values to JSON as {} return $stringify([symbol]) != '[null]' // WebKit converts symbol values to JSON as null || $stringify({ a: symbol }) != '{}' // V8 throws on boxed symbols || $stringify(Object(symbol)) != '{}'; }); // https://github.com/tc39/proposal-well-formed-stringify var ILL_FORMED_UNICODE = fails$b(function () { return $stringify('\uDF06\uD834') !== '"\\udf06\\ud834"' || $stringify('\uDEAD') !== '"\\udead"'; }); var stringifyWithSymbolsFix = function (it, replacer) { var args = arraySlice(arguments); var $replacer = replacer; if (!isObject$7(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined if (!isArray(replacer)) replacer = function (key, value) { if (isCallable$3($replacer)) value = call$1($replacer, this, key, value); if (!isSymbol(value)) return value; }; args[1] = replacer; return apply$1($stringify, null, args); }; var fixIllFormed = function (match, offset, string) { var prev = charAt$1(string, offset - 1); var next = charAt$1(string, offset + 1); if ((exec$1(low, match) && !exec$1(hi, next)) || (exec$1(hi, match) && !exec$1(low, prev))) { return '\\u' + numberToString(charCodeAt(match, 0), 16); } return match; }; if ($stringify) { // `JSON.stringify` method // https://tc39.es/ecma262/#sec-json.stringify $$f({ target: 'JSON', stat: true, arity: 3, forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE }, { // eslint-disable-next-line no-unused-vars -- required for `.length` stringify: function stringify(it, replacer, space) { var args = arraySlice(arguments); var result = apply$1(WRONG_SYMBOLS_CONVERSION ? stringifyWithSymbolsFix : $stringify, null, args); return ILL_FORMED_UNICODE && typeof result == 'string' ? replace$2(result, tester, fixIllFormed) : result; } }); } var $$e = _export; var NATIVE_SYMBOL$1 = symbolConstructorDetection; var fails$a = fails$J; var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols; var toObject$2 = toObject$d; // V8 ~ Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives // https://bugs.chromium.org/p/v8/issues/detail?id=3443 var FORCED$4 = !NATIVE_SYMBOL$1 || fails$a(function () { getOwnPropertySymbolsModule.f(1); }); // `Object.getOwnPropertySymbols` method // https://tc39.es/ecma262/#sec-object.getownpropertysymbols $$e({ target: 'Object', stat: true, forced: FORCED$4 }, { getOwnPropertySymbols: function getOwnPropertySymbols(it) { var $getOwnPropertySymbols = getOwnPropertySymbolsModule.f; return $getOwnPropertySymbols ? $getOwnPropertySymbols(toObject$2(it)) : []; } }); var $$d = _export; var DESCRIPTORS$5 = descriptors; var global$4 = global$B; var uncurryThis$8 = functionUncurryThis; var hasOwn$3 = hasOwnProperty_1; var isCallable$2 = isCallable$u; var isPrototypeOf$1 = objectIsPrototypeOf; var toString$3 = toString$j; var defineProperty$3 = objectDefineProperty.f; var copyConstructorProperties = copyConstructorProperties$2; var NativeSymbol = global$4.Symbol; var SymbolPrototype = NativeSymbol && NativeSymbol.prototype; if (DESCRIPTORS$5 && isCallable$2(NativeSymbol) && (!('description' in SymbolPrototype) || // Safari 12 bug NativeSymbol().description !== undefined )) { var EmptyStringDescriptionStore = {}; // wrap Symbol constructor for correct work with undefined description var SymbolWrapper = function Symbol() { var description = arguments.length < 1 || arguments[0] === undefined ? undefined : toString$3(arguments[0]); var result = isPrototypeOf$1(SymbolPrototype, this) ? new NativeSymbol(description) // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)' : description === undefined ? NativeSymbol() : NativeSymbol(description); if (description === '') EmptyStringDescriptionStore[result] = true; return result; }; copyConstructorProperties(SymbolWrapper, NativeSymbol); SymbolWrapper.prototype = SymbolPrototype; SymbolPrototype.constructor = SymbolWrapper; var NATIVE_SYMBOL = String(NativeSymbol('test')) == 'Symbol(test)'; var thisSymbolValue = uncurryThis$8(SymbolPrototype.valueOf); var symbolDescriptiveString = uncurryThis$8(SymbolPrototype.toString); var regexp = /^Symbol\((.*)\)[^)]+$/; var replace$1 = uncurryThis$8(''.replace); var stringSlice$3 = uncurryThis$8(''.slice); defineProperty$3(SymbolPrototype, 'description', { configurable: true, get: function description() { var symbol = thisSymbolValue(this); if (hasOwn$3(EmptyStringDescriptionStore, symbol)) return ''; var string = symbolDescriptiveString(symbol); var desc = NATIVE_SYMBOL ? stringSlice$3(string, 7, -1) : replace$1(string, regexp, '$1'); return desc === '' ? undefined : desc; } }); $$d({ global: true, constructor: true, forced: true }, { Symbol: SymbolWrapper }); } var defineWellKnownSymbol = wellKnownSymbolDefine; // `Symbol.iterator` well-known symbol // https://tc39.es/ecma262/#sec-symbol.iterator defineWellKnownSymbol('iterator'); var $$c = _export; var getBuiltIn = getBuiltIn$d; var apply = functionApply; var bind$1 = functionBind; var aConstructor = aConstructor$2; var anObject$1 = anObject$l; var isObject$6 = isObject$o; var create$1 = objectCreate; var fails$9 = fails$J; var nativeConstruct = getBuiltIn('Reflect', 'construct'); var ObjectPrototype = Object.prototype; var push$1 = [].push; // `Reflect.construct` method // https://tc39.es/ecma262/#sec-reflect.construct // MS Edge supports only 2 arguments and argumentsList argument is optional // FF Nightly sets third argument as `new.target`, but does not create `this` from it var NEW_TARGET_BUG = fails$9(function () { function F() { /* empty */ } return !(nativeConstruct(function () { /* empty */ }, [], F) instanceof F); }); var ARGS_BUG = !fails$9(function () { nativeConstruct(function () { /* empty */ }); }); var FORCED$3 = NEW_TARGET_BUG || ARGS_BUG; $$c({ target: 'Reflect', stat: true, forced: FORCED$3, sham: FORCED$3 }, { construct: function construct(Target, args /* , newTarget */) { aConstructor(Target); anObject$1(args); var newTarget = arguments.length < 3 ? Target : aConstructor(arguments[2]); if (ARGS_BUG && !NEW_TARGET_BUG) return nativeConstruct(Target, args, newTarget); if (Target == newTarget) { // w/o altered newTarget, optimization for 0-4 arguments switch (args.length) { case 0: return new Target(); case 1: return new Target(args[0]); case 2: return new Target(args[0], args[1]); case 3: return new Target(args[0], args[1], args[2]); case 4: return new Target(args[0], args[1], args[2], args[3]); } // w/o altered newTarget, lot of arguments case var $args = [null]; apply(push$1, $args, args); return new (apply(bind$1, Target, $args))(); } // with altered newTarget, not support built-in constructors var proto = newTarget.prototype; var instance = create$1(isObject$6(proto) ? proto : ObjectPrototype); var result = apply(Target, instance, args); return isObject$6(result) ? result : instance; } }); var internalMetadata = {exports: {}}; // FF26- bug: ArrayBuffers are non-extensible, but Object.isExtensible does not report it var fails$8 = fails$J; var arrayBufferNonExtensible = fails$8(function () { if (typeof ArrayBuffer == 'function') { var buffer = new ArrayBuffer(8); // eslint-disable-next-line es/no-object-isextensible, es/no-object-defineproperty -- safe if (Object.isExtensible(buffer)) Object.defineProperty(buffer, 'a', { value: 8 }); } }); var fails$7 = fails$J; var isObject$5 = isObject$o; var classof = classofRaw$2; var ARRAY_BUFFER_NON_EXTENSIBLE = arrayBufferNonExtensible; // eslint-disable-next-line es/no-object-isextensible -- safe var $isExtensible = Object.isExtensible; var FAILS_ON_PRIMITIVES$2 = fails$7(function () { $isExtensible(1); }); // `Object.isExtensible` method // https://tc39.es/ecma262/#sec-object.isextensible var objectIsExtensible = (FAILS_ON_PRIMITIVES$2 || ARRAY_BUFFER_NON_EXTENSIBLE) ? function isExtensible(it) { if (!isObject$5(it)) return false; if (ARRAY_BUFFER_NON_EXTENSIBLE && classof(it) == 'ArrayBuffer') return false; return $isExtensible ? $isExtensible(it) : true; } : $isExtensible; var fails$6 = fails$J; var freezing = !fails$6(function () { // eslint-disable-next-line es/no-object-isextensible, es/no-object-preventextensions -- required for testing return Object.isExtensible(Object.preventExtensions({})); }); var $$b = _export; var uncurryThis$7 = functionUncurryThis; var hiddenKeys = hiddenKeys$6; var isObject$4 = isObject$o; var hasOwn$2 = hasOwnProperty_1; var defineProperty$2 = objectDefineProperty.f; var getOwnPropertyNamesModule = objectGetOwnPropertyNames; var getOwnPropertyNamesExternalModule = objectGetOwnPropertyNamesExternal; var isExtensible$1 = objectIsExtensible; var uid = uid$4; var FREEZING = freezing; var REQUIRED = false; var METADATA = uid('meta'); var id$1 = 0; var setMetadata = function (it) { defineProperty$2(it, METADATA, { value: { objectID: 'O' + id$1++, // object ID weakData: {} // weak collections IDs } }); }; var fastKey$1 = function (it, create) { // return a primitive with prefix if (!isObject$4(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; if (!hasOwn$2(it, METADATA)) { // can't set metadata to uncaught frozen object if (!isExtensible$1(it)) return 'F'; // not necessary to add metadata if (!create) return 'E'; // add missing metadata setMetadata(it); // return object ID } return it[METADATA].objectID; }; var getWeakData$1 = function (it, create) { if (!hasOwn$2(it, METADATA)) { // can't set metadata to uncaught frozen object if (!isExtensible$1(it)) return true; // not necessary to add metadata if (!create) return false; // add missing metadata setMetadata(it); // return the store of weak collections IDs } return it[METADATA].weakData; }; // add metadata on freeze-family methods calling var onFreeze = function (it) { if (FREEZING && REQUIRED && isExtensible$1(it) && !hasOwn$2(it, METADATA)) setMetadata(it); return it; }; var enable = function () { meta.enable = function () { /* empty */ }; REQUIRED = true; var getOwnPropertyNames = getOwnPropertyNamesModule.f; var splice = uncurryThis$7([].splice); var test = {}; test[METADATA] = 1; // prevent exposing of metadata key if (getOwnPropertyNames(test).length) { getOwnPropertyNamesModule.f = function (it) { var result = getOwnPropertyNames(it); for (var i = 0, length = result.length; i < length; i++) { if (result[i] === METADATA) { splice(result, i, 1); break; } } return result; }; $$b({ target: 'Object', stat: true, forced: true }, { getOwnPropertyNames: getOwnPropertyNamesExternalModule.f }); } }; var meta = internalMetadata.exports = { enable: enable, fastKey: fastKey$1, getWeakData: getWeakData$1, onFreeze: onFreeze }; hiddenKeys[METADATA] = true; var $$a = _export; var global$3 = global$B; var uncurryThis$6 = functionUncurryThis; var isForced$1 = isForced_1; var defineBuiltIn$1 = defineBuiltIn$i; var InternalMetadataModule$1 = internalMetadata.exports; var iterate$2 = iterate$5; var anInstance$2 = anInstance$6; var isCallable$1 = isCallable$u; var isNullOrUndefined$3 = isNullOrUndefined$b; var isObject$3 = isObject$o; var fails$5 = fails$J; var checkCorrectnessOfIteration = checkCorrectnessOfIteration$3; var setToStringTag = setToStringTag$7; var inheritIfRequired$1 = inheritIfRequired$3; var collection$2 = function (CONSTRUCTOR_NAME, wrapper, common) { var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1; var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1; var ADDER = IS_MAP ? 'set' : 'add'; var NativeConstructor = global$3[CONSTRUCTOR_NAME]; var NativePrototype = NativeConstructor && NativeConstructor.prototype; var Constructor = NativeConstructor; var exported = {}; var fixMethod = function (KEY) { var uncurriedNativeMethod = uncurryThis$6(NativePrototype[KEY]); defineBuiltIn$1(NativePrototype, KEY, KEY == 'add' ? function add(value) { uncurriedNativeMethod(this, value === 0 ? 0 : value); return this; } : KEY == 'delete' ? function (key) { return IS_WEAK && !isObject$3(key) ? false : uncurriedNativeMethod(this, key === 0 ? 0 : key); } : KEY == 'get' ? function get(key) { return IS_WEAK && !isObject$3(key) ? undefined : uncurriedNativeMethod(this, key === 0 ? 0 : key); } : KEY == 'has' ? function has(key) { return IS_WEAK && !isObject$3(key) ? false : uncurriedNativeMethod(this, key === 0 ? 0 : key); } : function set(key, value) { uncurriedNativeMethod(this, key === 0 ? 0 : key, value); return this; } ); }; var REPLACE = isForced$1( CONSTRUCTOR_NAME, !isCallable$1(NativeConstructor) || !(IS_WEAK || NativePrototype.forEach && !fails$5(function () { new NativeConstructor().entries().next(); })) ); if (REPLACE) { // create collection constructor Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER); InternalMetadataModule$1.enable(); } else if (isForced$1(CONSTRUCTOR_NAME, true)) { var instance = new Constructor(); // early implementations not supports chaining var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance; // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false var THROWS_ON_PRIMITIVES = fails$5(function () { instance.has(1); }); // most early implementations doesn't supports iterables, most modern - not close it correctly // eslint-disable-next-line no-new -- required for testing var ACCEPT_ITERABLES = checkCorrectnessOfIteration(function (iterable) { new NativeConstructor(iterable); }); // for early implementations -0 and +0 not the same var BUGGY_ZERO = !IS_WEAK && fails$5(function () { // V8 ~ Chromium 42- fails only with 5+ elements var $instance = new NativeConstructor(); var index = 5; while (index--) $instance[ADDER](index, index); return !$instance.has(-0); }); if (!ACCEPT_ITERABLES) { Constructor = wrapper(function (dummy, iterable) { anInstance$2(dummy, NativePrototype); var that = inheritIfRequired$1(new NativeConstructor(), dummy, Constructor); if (!isNullOrUndefined$3(iterable)) iterate$2(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP }); return that; }); Constructor.prototype = NativePrototype; NativePrototype.constructor = Constructor; } if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) { fixMethod('delete'); fixMethod('has'); IS_MAP && fixMethod('get'); } if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER); // weak collections should not contains .clear method if (IS_WEAK && NativePrototype.clear) delete NativePrototype.clear; } exported[CONSTRUCTOR_NAME] = Constructor; $$a({ global: true, constructor: true, forced: Constructor != NativeConstructor }, exported); setToStringTag(Constructor, CONSTRUCTOR_NAME); if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP); return Constructor; }; var defineProperty$1 = objectDefineProperty.f; var create = objectCreate; var defineBuiltIns$2 = defineBuiltIns$4; var bind = functionBindContext; var anInstance$1 = anInstance$6; var isNullOrUndefined$2 = isNullOrUndefined$b; var iterate$1 = iterate$5; var defineIterator = iteratorDefine; var createIterResultObject = createIterResultObject$3; var setSpecies$1 = setSpecies$3; var DESCRIPTORS$4 = descriptors; var fastKey = internalMetadata.exports.fastKey; var InternalStateModule$1 = internalState; var setInternalState$1 = InternalStateModule$1.set; var internalStateGetterFor$1 = InternalStateModule$1.getterFor; var collectionStrong$1 = { getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) { var Constructor = wrapper(function (that, iterable) { anInstance$1(that, Prototype); setInternalState$1(that, { type: CONSTRUCTOR_NAME, index: create(null), first: undefined, last: undefined, size: 0 }); if (!DESCRIPTORS$4) that.size = 0; if (!isNullOrUndefined$2(iterable)) iterate$1(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP }); }); var Prototype = Constructor.prototype; var getInternalState = internalStateGetterFor$1(CONSTRUCTOR_NAME); var define = function (that, key, value) { var state = getInternalState(that); var entry = getEntry(that, key); var previous, index; // change existing entry if (entry) { entry.value = value; // create new entry } else { state.last = entry = { index: index = fastKey(key, true), key: key, value: value, previous: previous = state.last, next: undefined, removed: false }; if (!state.first) state.first = entry; if (previous) previous.next = entry; if (DESCRIPTORS$4) state.size++; else that.size++; // add to index if (index !== 'F') state.index[index] = entry; } return that; }; var getEntry = function (that, key) { var state = getInternalState(that); // fast case var index = fastKey(key); var entry; if (index !== 'F') return state.index[index]; // frozen object case for (entry = state.first; entry; entry = entry.next) { if (entry.key == key) return entry; } }; defineBuiltIns$2(Prototype, { // `{ Map, Set }.prototype.clear()` methods // https://tc39.es/ecma262/#sec-map.prototype.clear // https://tc39.es/ecma262/#sec-set.prototype.clear clear: function clear() { var that = this; var state = getInternalState(that); var data = state.index; var entry = state.first; while (entry) { entry.removed = true; if (entry.previous) entry.previous = entry.previous.next = undefined; delete data[entry.index]; entry = entry.next; } state.first = state.last = undefined; if (DESCRIPTORS$4) state.size = 0; else that.size = 0; }, // `{ Map, Set }.prototype.delete(key)` methods // https://tc39.es/ecma262/#sec-map.prototype.delete // https://tc39.es/ecma262/#sec-set.prototype.delete 'delete': function (key) { var that = this; var state = getInternalState(that); var entry = getEntry(that, key); if (entry) { var next = entry.next; var prev = entry.previous; delete state.index[entry.index]; entry.removed = true; if (prev) prev.next = next; if (next) next.previous = prev; if (state.first == entry) state.first = next; if (state.last == entry) state.last = prev; if (DESCRIPTORS$4) state.size--; else that.size--; } return !!entry; }, // `{ Map, Set }.prototype.forEach(callbackfn, thisArg = undefined)` methods // https://tc39.es/ecma262/#sec-map.prototype.foreach // https://tc39.es/ecma262/#sec-set.prototype.foreach forEach: function forEach(callbackfn /* , that = undefined */) { var state = getInternalState(this); var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined); var entry; while (entry = entry ? entry.next : state.first) { boundFunction(entry.value, entry.key, this); // revert to the last existing entry while (entry && entry.removed) entry = entry.previous; } }, // `{ Map, Set}.prototype.has(key)` methods // https://tc39.es/ecma262/#sec-map.prototype.has // https://tc39.es/ecma262/#sec-set.prototype.has has: function has(key) { return !!getEntry(this, key); } }); defineBuiltIns$2(Prototype, IS_MAP ? { // `Map.prototype.get(key)` method // https://tc39.es/ecma262/#sec-map.prototype.get get: function get(key) { var entry = getEntry(this, key); return entry && entry.value; }, // `Map.prototype.set(key, value)` method // https://tc39.es/ecma262/#sec-map.prototype.set set: function set(key, value) { return define(this, key === 0 ? 0 : key, value); } } : { // `Set.prototype.add(value)` method // https://tc39.es/ecma262/#sec-set.prototype.add add: function add(value) { return define(this, value = value === 0 ? 0 : value, value); } }); if (DESCRIPTORS$4) defineProperty$1(Prototype, 'size', { get: function () { return getInternalState(this).size; } }); return Constructor; }, setStrong: function (Constructor, CONSTRUCTOR_NAME, IS_MAP) { var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator'; var getInternalCollectionState = internalStateGetterFor$1(CONSTRUCTOR_NAME); var getInternalIteratorState = internalStateGetterFor$1(ITERATOR_NAME); // `{ Map, Set }.prototype.{ keys, values, entries, @@iterator }()` methods // https://tc39.es/ecma262/#sec-map.prototype.entries // https://tc39.es/ecma262/#sec-map.prototype.keys // https://tc39.es/ecma262/#sec-map.prototype.values // https://tc39.es/ecma262/#sec-map.prototype-@@iterator // https://tc39.es/ecma262/#sec-set.prototype.entries // https://tc39.es/ecma262/#sec-set.prototype.keys // https://tc39.es/ecma262/#sec-set.prototype.values // https://tc39.es/ecma262/#sec-set.prototype-@@iterator defineIterator(Constructor, CONSTRUCTOR_NAME, function (iterated, kind) { setInternalState$1(this, { type: ITERATOR_NAME, target: iterated, state: getInternalCollectionState(iterated), kind: kind, last: undefined }); }, function () { var state = getInternalIteratorState(this); var kind = state.kind; var entry = state.last; // revert to the last existing entry while (entry && entry.removed) entry = entry.previous; // get next entry if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) { // or finish the iteration state.target = undefined; return createIterResultObject(undefined, true); } // return step by kind if (kind == 'keys') return createIterResultObject(entry.key, false); if (kind == 'values') return createIterResultObject(entry.value, false); return createIterResultObject([entry.key, entry.value], false); }, IS_MAP ? 'entries' : 'values', !IS_MAP, true); // `{ Map, Set }.prototype[@@species]` accessors // https://tc39.es/ecma262/#sec-get-map-@@species // https://tc39.es/ecma262/#sec-get-set-@@species setSpecies$1(CONSTRUCTOR_NAME); } }; var collection$1 = collection$2; var collectionStrong = collectionStrong$1; // `Map` constructor // https://tc39.es/ecma262/#sec-map-objects collection$1('Map', function (init) { return function Map() { return init(this, arguments.length ? arguments[0] : undefined); }; }, collectionStrong); var $$9 = _export; var setPrototypeOf = objectSetPrototypeOf; // `Object.setPrototypeOf` method // https://tc39.es/ecma262/#sec-object.setprototypeof $$9({ target: 'Object', stat: true }, { setPrototypeOf: setPrototypeOf }); var $$8 = _export; var fails$4 = fails$J; var toObject$1 = toObject$d; var nativeGetPrototypeOf = objectGetPrototypeOf; var CORRECT_PROTOTYPE_GETTER = correctPrototypeGetter; var FAILS_ON_PRIMITIVES$1 = fails$4(function () { nativeGetPrototypeOf(1); }); // `Object.getPrototypeOf` method // https://tc39.es/ecma262/#sec-object.getprototypeof $$8({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES$1, sham: !CORRECT_PROTOTYPE_GETTER }, { getPrototypeOf: function getPrototypeOf(it) { return nativeGetPrototypeOf(toObject$1(it)); } }); function _typeof$2(obj) { "@babel/helpers - typeof"; return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof$2(obj); } function _defineProperties$2(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass$2(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$2(Constructor.prototype, protoProps); if (staticProps) _defineProperties$2(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof$2(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); } function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } // https://stackoverflow.com/a/46971044/970769 // "Breaking changes in Typescript 2.1" // "Extending built-ins like Error, Array, and Map may no longer work." // "As a recommendation, you can manually adjust the prototype immediately after any super(...) calls." // https://github.com/Microsoft/TypeScript-wiki/blob/main/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work var ParseError = /*#__PURE__*/function (_Error) { _inherits(ParseError, _Error); var _super = _createSuper(ParseError); function ParseError(code) { var _this; _classCallCheck$2(this, ParseError); _this = _super.call(this, code); // Set the prototype explicitly. // Any subclass of FooError will have to manually set the prototype as well. Object.setPrototypeOf(_assertThisInitialized(_this), ParseError.prototype); _this.name = _this.constructor.name; return _this; } return _createClass$2(ParseError); }( /*#__PURE__*/_wrapNativeSuper(Error)); var $$7 = _export; var fails$3 = fails$J; var toIndexedObject$1 = toIndexedObject$d; var nativeGetOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f; var DESCRIPTORS$3 = descriptors; var FAILS_ON_PRIMITIVES = fails$3(function () { nativeGetOwnPropertyDescriptor(1); }); var FORCED$2 = !DESCRIPTORS$3 || FAILS_ON_PRIMITIVES; // `Object.getOwnPropertyDescriptor` method // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor $$7({ target: 'Object', stat: true, forced: FORCED$2, sham: !DESCRIPTORS$3 }, { getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) { return nativeGetOwnPropertyDescriptor(toIndexedObject$1(it), key); } }); var $$6 = _export; var DESCRIPTORS$2 = descriptors; var ownKeys$7 = ownKeys$9; var toIndexedObject = toIndexedObject$d; var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor; var createProperty = createProperty$6; // `Object.getOwnPropertyDescriptors` method // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors $$6({ target: 'Object', stat: true, sham: !DESCRIPTORS$2 }, { getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) { var O = toIndexedObject(object); var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; var keys = ownKeys$7(O); var result = {}; var index = 0; var key, descriptor; while (keys.length > index) { descriptor = getOwnPropertyDescriptor(O, key = keys[index++]); if (descriptor !== undefined) createProperty(result, key, descriptor); } return result; } }); var $$5 = _export; var DESCRIPTORS$1 = descriptors; var defineProperties = objectDefineProperties.f; // `Object.defineProperties` method // https://tc39.es/ecma262/#sec-object.defineproperties // eslint-disable-next-line es/no-object-defineproperties -- safe $$5({ target: 'Object', stat: true, forced: Object.defineProperties !== defineProperties, sham: !DESCRIPTORS$1 }, { defineProperties: defineProperties }); var defineProperty = objectDefineProperty.f; var proxyAccessor$1 = function (Target, Source, key) { key in Target || defineProperty(Target, key, { configurable: true, get: function () { return Source[key]; }, set: function (it) { Source[key] = it; } }); }; var DESCRIPTORS = descriptors; var global$2 = global$B; var uncurryThis$5 = functionUncurryThis; var isForced = isForced_1; var inheritIfRequired = inheritIfRequired$3; var createNonEnumerableProperty = createNonEnumerableProperty$7; var getOwnPropertyNames = objectGetOwnPropertyNames.f; var isPrototypeOf = objectIsPrototypeOf; var isRegExp$1 = isRegexp; var toString$2 = toString$j; var getRegExpFlags$1 = regexpGetFlags; var stickyHelpers = regexpStickyHelpers; var proxyAccessor = proxyAccessor$1; var defineBuiltIn = defineBuiltIn$i; var fails$2 = fails$J; var hasOwn$1 = hasOwnProperty_1; var enforceInternalState$1 = internalState.enforce; var setSpecies = setSpecies$3; var wellKnownSymbol$1 = wellKnownSymbol$t; var UNSUPPORTED_DOT_ALL = regexpUnsupportedDotAll; var UNSUPPORTED_NCG = regexpUnsupportedNcg; var MATCH = wellKnownSymbol$1('match'); var NativeRegExp = global$2.RegExp; var RegExpPrototype = NativeRegExp.prototype; var SyntaxError = global$2.SyntaxError; var exec = uncurryThis$5(RegExpPrototype.exec); var charAt = uncurryThis$5(''.charAt); var replace = uncurryThis$5(''.replace); var stringIndexOf$1 = uncurryThis$5(''.indexOf); var stringSlice$2 = uncurryThis$5(''.slice); // TODO: Use only proper RegExpIdentifierName var IS_NCG = /^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/; var re1 = /a/g; var re2 = /a/g; // "new" should create a new object, old webkit bug var CORRECT_NEW = new NativeRegExp(re1) !== re1; var MISSED_STICKY = stickyHelpers.MISSED_STICKY; var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y; var BASE_FORCED = DESCRIPTORS && (!CORRECT_NEW || MISSED_STICKY || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG || fails$2(function () { re2[MATCH] = false; // RegExp constructor can alter flags and IsRegExp works correct with @@match return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i'; })); var handleDotAll = function (string) { var length = string.length; var index = 0; var result = ''; var brackets = false; var chr; for (; index <= length; index++) { chr = charAt(string, index); if (chr === '\\') { result += chr + charAt(string, ++index); continue; } if (!brackets && chr === '.') { result += '[\\s\\S]'; } else { if (chr === '[') { brackets = true; } else if (chr === ']') { brackets = false; } result += chr; } } return result; }; var handleNCG = function (string) { var length = string.length; var index = 0; var result = ''; var named = []; var names = {}; var brackets = false; var ncg = false; var groupid = 0; var groupname = ''; var chr; for (; index <= length; index++) { chr = charAt(string, index); if (chr === '\\') { chr = chr + charAt(string, ++index); } else if (chr === ']') { brackets = false; } else if (!brackets) switch (true) { case chr === '[': brackets = true; break; case chr === '(': if (exec(IS_NCG, stringSlice$2(string, index + 1))) { index += 2; ncg = true; } result += chr; groupid++; continue; case chr === '>' && ncg: if (groupname === '' || hasOwn$1(names, groupname)) { throw new SyntaxError('Invalid capture group name'); } names[groupname] = true; named[named.length] = [groupname, groupid]; ncg = false; groupname = ''; continue; } if (ncg) groupname += chr; else result += chr; } return [result, named]; }; // `RegExp` constructor // https://tc39.es/ecma262/#sec-regexp-constructor if (isForced('RegExp', BASE_FORCED)) { var RegExpWrapper = function RegExp(pattern, flags) { var thisIsRegExp = isPrototypeOf(RegExpPrototype, this); var patternIsRegExp = isRegExp$1(pattern); var flagsAreUndefined = flags === undefined; var groups = []; var rawPattern = pattern; var rawFlags, dotAll, sticky, handled, result, state; if (!thisIsRegExp && patternIsRegExp && flagsAreUndefined && pattern.constructor === RegExpWrapper) { return pattern; } if (patternIsRegExp || isPrototypeOf(RegExpPrototype, pattern)) { pattern = pattern.source; if (flagsAreUndefined) flags = getRegExpFlags$1(rawPattern); } pattern = pattern === undefined ? '' : toString$2(pattern); flags = flags === undefined ? '' : toString$2(flags); rawPattern = pattern; if (UNSUPPORTED_DOT_ALL && 'dotAll' in re1) { dotAll = !!flags && stringIndexOf$1(flags, 's') > -1; if (dotAll) flags = replace(flags, /s/g, ''); } rawFlags = flags; if (MISSED_STICKY && 'sticky' in re1) { sticky = !!flags && stringIndexOf$1(flags, 'y') > -1; if (sticky && UNSUPPORTED_Y) flags = replace(flags, /y/g, ''); } if (UNSUPPORTED_NCG) { handled = handleNCG(pattern); pattern = handled[0]; groups = handled[1]; } result = inheritIfRequired(NativeRegExp(pattern, flags), thisIsRegExp ? this : RegExpPrototype, RegExpWrapper); if (dotAll || sticky || groups.length) { state = enforceInternalState$1(result); if (dotAll) { state.dotAll = true; state.raw = RegExpWrapper(handleDotAll(pattern), rawFlags); } if (sticky) state.sticky = true; if (groups.length) state.groups = groups; } if (pattern !== rawPattern) try { // fails in old engines, but we have no alternatives for unsupported regex syntax createNonEnumerableProperty(result, 'source', rawPattern === '' ? '(?:)' : rawPattern); } catch (error) { /* empty */ } return result; }; for (var keys = getOwnPropertyNames(NativeRegExp), index = 0; keys.length > index;) { proxyAccessor(RegExpWrapper, NativeRegExp, keys[index++]); } RegExpPrototype.constructor = RegExpWrapper; RegExpWrapper.prototype = RegExpPrototype; defineBuiltIn(global$2, 'RegExp', RegExpWrapper, { constructor: true }); } // https://tc39.es/ecma262/#sec-get-regexp-@@species setSpecies('RegExp'); // The minimum length of the national significant number. var MIN_LENGTH_FOR_NSN = 2; // The ITU says the maximum length should be 15, // but one can find longer numbers in Germany. var MAX_LENGTH_FOR_NSN = 17; // The maximum length of the country calling code. var MAX_LENGTH_COUNTRY_CODE = 3; // Digits accepted in phone numbers // (ascii, fullwidth, arabic-indic, and eastern arabic digits). var VALID_DIGITS = "0-9\uFF10-\uFF19\u0660-\u0669\u06F0-\u06F9"; // `DASHES` will be right after the opening square bracket of the "character class" var DASHES = "-\u2010-\u2015\u2212\u30FC\uFF0D"; var SLASHES = "\uFF0F/"; var DOTS = "\uFF0E."; var WHITESPACE = " \xA0\xAD\u200B\u2060\u3000"; var BRACKETS = "()\uFF08\uFF09\uFF3B\uFF3D\\[\\]"; // export const OPENING_BRACKETS = '(\uFF08\uFF3B\\\[' var TILDES = "~\u2053\u223C\uFF5E"; // Regular expression of acceptable punctuation found in phone numbers. This // excludes punctuation found as a leading character only. This consists of dash // characters, white space characters, full stops, slashes, square brackets, // parentheses and tildes. Full-width variants are also present. var VALID_PUNCTUATION = "".concat(DASHES).concat(SLASHES).concat(DOTS).concat(WHITESPACE).concat(BRACKETS).concat(TILDES); var PLUS_CHARS = "+\uFF0B"; // const LEADING_PLUS_CHARS_PATTERN = new RegExp('^[' + PLUS_CHARS + ']+') // Copy-pasted from: // https://github.com/substack/semver-compare/blob/master/index.js // // Inlining this function because some users reported issues with // importing from `semver-compare` in a browser with ES6 "native" modules. // // Fixes `semver-compare` not being able to compare versions with alpha/beta/etc "tags". // https://github.com/catamphetamine/libphonenumber-js/issues/381 function compare (a, b) { a = a.split('-'); b = b.split('-'); var pa = a[0].split('.'); var pb = b[0].split('.'); for (var i = 0; i < 3; i++) { var na = Number(pa[i]); var nb = Number(pb[i]); if (na > nb) return 1; if (nb > na) return -1; if (!isNaN(na) && isNaN(nb)) return 1; if (isNaN(na) && !isNaN(nb)) return -1; } if (a[1] && b[1]) { return a[1] > b[1] ? 1 : a[1] < b[1] ? -1 : 0; } return !a[1] && b[1] ? 1 : a[1] && !b[1] ? -1 : 0; } function _typeof$1(obj) { "@babel/helpers - typeof"; return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof$1(obj); } function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties$1(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); if (staticProps) _defineProperties$1(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } var V3 = '1.2.0'; // Moved `001` country code to "nonGeographic" section of metadata. var V4 = '1.7.35'; var DEFAULT_EXT_PREFIX = ' ext. '; var CALLING_CODE_REG_EXP = /^\d+$/; /** * See: https://gitlab.com/catamphetamine/libphonenumber-js/blob/master/METADATA.md */ var Metadata = /*#__PURE__*/function () { function Metadata(metadata) { _classCallCheck$1(this, Metadata); validateMetadata(metadata); this.metadata = metadata; setVersion.call(this, metadata); } _createClass$1(Metadata, [{ key: "getCountries", value: function getCountries() { return Object.keys(this.metadata.countries).filter(function (_) { return _ !== '001'; }); } }, { key: "getCountryMetadata", value: function getCountryMetadata(countryCode) { return this.metadata.countries[countryCode]; } }, { key: "nonGeographic", value: function nonGeographic() { if (this.v1 || this.v2 || this.v3) return; // `nonGeographical` was a typo. // It's present in metadata generated from `1.7.35` to `1.7.37`. // The test case could be found by searching for "nonGeographical". return this.metadata.nonGeographic || this.metadata.nonGeographical; } }, { key: "hasCountry", value: function hasCountry(country) { return this.getCountryMetadata(country) !== undefined; } }, { key: "hasCallingCode", value: function hasCallingCode(callingCode) { if (this.getCountryCodesForCallingCode(callingCode)) { return true; } if (this.nonGeographic()) { if (this.nonGeographic()[callingCode]) { return true; } } else { // A hacky workaround for old custom metadata (generated before V4). var countryCodes = this.countryCallingCodes()[callingCode]; if (countryCodes && countryCodes.length === 1 && countryCodes[0] === '001') { return true; } } } }, { key: "isNonGeographicCallingCode", value: function isNonGeographicCallingCode(callingCode) { if (this.nonGeographic()) { return this.nonGeographic()[callingCode] ? true : false; } else { return this.getCountryCodesForCallingCode(callingCode) ? false : true; } } // Deprecated. }, { key: "country", value: function country(countryCode) { return this.selectNumberingPlan(countryCode); } }, { key: "selectNumberingPlan", value: function selectNumberingPlan(countryCode, callingCode) { // Supports just passing `callingCode` as the first argument. if (countryCode && CALLING_CODE_REG_EXP.test(countryCode)) { callingCode = countryCode; countryCode = null; } if (countryCode && countryCode !== '001') { if (!this.hasCountry(countryCode)) { throw new Error("Unknown country: ".concat(countryCode)); } this.numberingPlan = new NumberingPlan(this.getCountryMetadata(countryCode), this); } else if (callingCode) { if (!this.hasCallingCode(callingCode)) { throw new Error("Unknown calling code: ".concat(callingCode)); } this.numberingPlan = new NumberingPlan(this.getNumberingPlanMetadata(callingCode), this); } else { this.numberingPlan = undefined; } return this; } }, { key: "getCountryCodesForCallingCode", value: function getCountryCodesForCallingCode(callingCode) { var countryCodes = this.countryCallingCodes()[callingCode]; if (countryCodes) { // Metadata before V4 included "non-geographic entity" calling codes // inside `country_calling_codes` (for example, `"881":["001"]`). // Now the semantics of `country_calling_codes` has changed: // it's specifically for "countries" now. // Older versions of custom metadata will simply skip parsing // "non-geographic entity" phone numbers with new versions // of this library: it's not considered a bug, // because such numbers are extremely rare, // and developers extremely rarely use custom metadata. if (countryCodes.length === 1 && countryCodes[0].length === 3) { return; } return countryCodes; } } }, { key: "getCountryCodeForCallingCode", value: function getCountryCodeForCallingCode(callingCode) { var countryCodes = this.getCountryCodesForCallingCode(callingCode); if (countryCodes) { return countryCodes[0]; } } }, { key: "getNumberingPlanMetadata", value: function getNumberingPlanMetadata(callingCode) { var countryCode = this.getCountryCodeForCallingCode(callingCode); if (countryCode) { return this.getCountryMetadata(countryCode); } if (this.nonGeographic()) { var metadata = this.nonGeographic()[callingCode]; if (metadata) { return metadata; } } else { // A hacky workaround for old custom metadata (generated before V4). // In that metadata, there was no concept of "non-geographic" metadata // so metadata for `001` country code was stored along with other countries. // The test case can be found by searching for: // "should work around `nonGeographic` metadata not existing". var countryCodes = this.countryCallingCodes()[callingCode]; if (countryCodes && countryCodes.length === 1 && countryCodes[0] === '001') { return this.metadata.countries['001']; } } } // Deprecated. }, { key: "countryCallingCode", value: function countryCallingCode() { return this.numberingPlan.callingCode(); } // Deprecated. }, { key: "IDDPrefix", value: function IDDPrefix() { return this.numberingPlan.IDDPrefix(); } // Deprecated. }, { key: "defaultIDDPrefix", value: function defaultIDDPrefix() { return this.numberingPlan.defaultIDDPrefix(); } // Deprecated. }, { key: "nationalNumberPattern", value: function nationalNumberPattern() { return this.numberingPlan.nationalNumberPattern(); } // Deprecated. }, { key: "possibleLengths", value: function possibleLengths() { return this.numberingPlan.possibleLengths(); } // Deprecated. }, { key: "formats", value: function formats() { return this.numberingPlan.formats(); } // Deprecated. }, { key: "nationalPrefixForParsing", value: function nationalPrefixForParsing() { return this.numberingPlan.nationalPrefixForParsing(); } // Deprecated. }, { key: "nationalPrefixTransformRule", value: function nationalPrefixTransformRule() { return this.numberingPlan.nationalPrefixTransformRule(); } // Deprecated. }, { key: "leadingDigits", value: function leadingDigits() { return this.numberingPlan.leadingDigits(); } // Deprecated. }, { key: "hasTypes", value: function hasTypes() { return this.numberingPlan.hasTypes(); } // Deprecated. }, { key: "type", value: function type(_type) { return this.numberingPlan.type(_type); } // Deprecated. }, { key: "ext", value: function ext() { return this.numberingPlan.ext(); } }, { key: "countryCallingCodes", value: function countryCallingCodes() { if (this.v1) return this.metadata.country_phone_code_to_countries; return this.metadata.country_calling_codes; } // Deprecated. }, { key: "chooseCountryByCountryCallingCode", value: function chooseCountryByCountryCallingCode(callingCode) { return this.selectNumberingPlan(callingCode); } }, { key: "hasSelectedNumberingPlan", value: function hasSelectedNumberingPlan() { return this.numberingPlan !== undefined; } }]); return Metadata; }(); var NumberingPlan = /*#__PURE__*/function () { function NumberingPlan(metadata, globalMetadataObject) { _classCallCheck$1(this, NumberingPlan); this.globalMetadataObject = globalMetadataObject; this.metadata = metadata; setVersion.call(this, globalMetadataObject.metadata); } _createClass$1(NumberingPlan, [{ key: "callingCode", value: function callingCode() { return this.metadata[0]; } // Formatting information for regions which share // a country calling code is contained by only one region // for performance reasons. For example, for NANPA region // ("North American Numbering Plan Administration", // which includes USA, Canada, Cayman Islands, Bahamas, etc) // it will be contained in the metadata for `US`. }, { key: "getDefaultCountryMetadataForRegion", value: function getDefaultCountryMetadataForRegion() { return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode()); } // Is always present. }, { key: "IDDPrefix", value: function IDDPrefix() { if (this.v1 || this.v2) return; return this.metadata[1]; } // Is only present when a country supports multiple IDD prefixes. }, { key: "defaultIDDPrefix", value: function defaultIDDPrefix() { if (this.v1 || this.v2) return; return this.metadata[12]; } }, { key: "nationalNumberPattern", value: function nationalNumberPattern() { if (this.v1 || this.v2) return this.metadata[1]; return this.metadata[2]; } // "possible length" data is always present in Google's metadata. }, { key: "possibleLengths", value: function possibleLengths() { if (this.v1) return; return this.metadata[this.v2 ? 2 : 3]; } }, { key: "_getFormats", value: function _getFormats(metadata) { return metadata[this.v1 ? 2 : this.v2 ? 3 : 4]; } // For countries of the same region (e.g. NANPA) // formats are all stored in the "main" country for that region. // E.g. "RU" and "KZ", "US" and "CA". }, { key: "formats", value: function formats() { var _this = this; var formats = this._getFormats(this.metadata) || this._getFormats(this.getDefaultCountryMetadataForRegion()) || []; return formats.map(function (_) { return new Format(_, _this); }); } }, { key: "nationalPrefix", value: function nationalPrefix() { return this.metadata[this.v1 ? 3 : this.v2 ? 4 : 5]; } }, { key: "_getNationalPrefixFormattingRule", value: function _getNationalPrefixFormattingRule(metadata) { return metadata[this.v1 ? 4 : this.v2 ? 5 : 6]; } // For countries of the same region (e.g. NANPA) // national prefix formatting rule is stored in the "main" country for that region. // E.g. "RU" and "KZ", "US" and "CA". }, { key: "nationalPrefixFormattingRule", value: function nationalPrefixFormattingRule() { return this._getNationalPrefixFormattingRule(this.metadata) || this._getNationalPrefixFormattingRule(this.getDefaultCountryMetadataForRegion()); } }, { key: "_nationalPrefixForParsing", value: function _nationalPrefixForParsing() { return this.metadata[this.v1 ? 5 : this.v2 ? 6 : 7]; } }, { key: "nationalPrefixForParsing", value: function nationalPrefixForParsing() { // If `national_prefix_for_parsing` is not set explicitly, // then infer it from `national_prefix` (if any) return this._nationalPrefixForParsing() || this.nationalPrefix(); } }, { key: "nationalPrefixTransformRule", value: function nationalPrefixTransformRule() { return this.metadata[this.v1 ? 6 : this.v2 ? 7 : 8]; } }, { key: "_getNationalPrefixIsOptionalWhenFormatting", value: function _getNationalPrefixIsOptionalWhenFormatting() { return !!this.metadata[this.v1 ? 7 : this.v2 ? 8 : 9]; } // For countries of the same region (e.g. NANPA) // "national prefix is optional when formatting" flag is // stored in the "main" country for that region. // E.g. "RU" and "KZ", "US" and "CA". }, { key: "nationalPrefixIsOptionalWhenFormattingInNationalFormat", value: function nationalPrefixIsOptionalWhenFormattingInNationalFormat() { return this._getNationalPrefixIsOptionalWhenFormatting(this.metadata) || this._getNationalPrefixIsOptionalWhenFormatting(this.getDefaultCountryMetadataForRegion()); } }, { key: "leadingDigits", value: function leadingDigits() { return this.metadata[this.v1 ? 8 : this.v2 ? 9 : 10]; } }, { key: "types", value: function types() { return this.metadata[this.v1 ? 9 : this.v2 ? 10 : 11]; } }, { key: "hasTypes", value: function hasTypes() { // Versions 1.2.0 - 1.2.4: can be `[]`. /* istanbul ignore next */ if (this.types() && this.types().length === 0) { return false; } // Versions <= 1.2.4: can be `undefined`. // Version >= 1.2.5: can be `0`. return !!this.types(); } }, { key: "type", value: function type(_type2) { if (this.hasTypes() && getType(this.types(), _type2)) { return new Type(getType(this.types(), _type2), this); } } }, { key: "ext", value: function ext() { if (this.v1 || this.v2) return DEFAULT_EXT_PREFIX; return this.metadata[13] || DEFAULT_EXT_PREFIX; } }]); return NumberingPlan; }(); var Format = /*#__PURE__*/function () { function Format(format, metadata) { _classCallCheck$1(this, Format); this._format = format; this.metadata = metadata; } _createClass$1(Format, [{ key: "pattern", value: function pattern() { return this._format[0]; } }, { key: "format", value: function format() { return this._format[1]; } }, { key: "leadingDigitsPatterns", value: function leadingDigitsPatterns() { return this._format[2] || []; } }, { key: "nationalPrefixFormattingRule", value: function nationalPrefixFormattingRule() { return this._format[3] || this.metadata.nationalPrefixFormattingRule(); } }, { key: "nationalPrefixIsOptionalWhenFormattingInNationalFormat", value: function nationalPrefixIsOptionalWhenFormattingInNationalFormat() { return !!this._format[4] || this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat(); } }, { key: "nationalPrefixIsMandatoryWhenFormattingInNationalFormat", value: function nationalPrefixIsMandatoryWhenFormattingInNationalFormat() { // National prefix is omitted if there's no national prefix formatting rule // set for this country, or when the national prefix formatting rule // contains no national prefix itself, or when this rule is set but // national prefix is optional for this phone number format // (and it is not enforced explicitly) return this.usesNationalPrefix() && !this.nationalPrefixIsOptionalWhenFormattingInNationalFormat(); } // Checks whether national prefix formatting rule contains national prefix. }, { key: "usesNationalPrefix", value: function usesNationalPrefix() { return this.nationalPrefixFormattingRule() && // Check that national prefix formatting rule is not a "dummy" one. !FIRST_GROUP_ONLY_PREFIX_PATTERN.test(this.nationalPrefixFormattingRule()) // In compressed metadata, `this.nationalPrefixFormattingRule()` is `0` // when `national_prefix_formatting_rule` is not present. // So, `true` or `false` are returned explicitly here, so that // `0` number isn't returned. ? true : false; } }, { key: "internationalFormat", value: function internationalFormat() { return this._format[5] || this.format(); } }]); return Format; }(); /** * A pattern that is used to determine if the national prefix formatting rule * has the first group only, i.e., does not start with the national prefix. * Note that the pattern explicitly allows for unbalanced parentheses. */ var FIRST_GROUP_ONLY_PREFIX_PATTERN = /^\(?$1\)?$/; var Type = /*#__PURE__*/function () { function Type(type, metadata) { _classCallCheck$1(this, Type); this.type = type; this.metadata = metadata; } _createClass$1(Type, [{ key: "pattern", value: function pattern() { if (this.metadata.v1) return this.type; return this.type[0]; } }, { key: "possibleLengths", value: function possibleLengths() { if (this.metadata.v1) return; return this.type[1] || this.metadata.possibleLengths(); } }]); return Type; }(); function getType(types, type) { switch (type) { case 'FIXED_LINE': return types[0]; case 'MOBILE': return types[1]; case 'TOLL_FREE': return types[2]; case 'PREMIUM_RATE': return types[3]; case 'PERSONAL_NUMBER': return types[4]; case 'VOICEMAIL': return types[5]; case 'UAN': return types[6]; case 'PAGER': return types[7]; case 'VOIP': return types[8]; case 'SHARED_COST': return types[9]; } } function validateMetadata(metadata) { if (!metadata) { throw new Error('[libphonenumber-js] `metadata` argument not passed. Check your arguments.'); } // `country_phone_code_to_countries` was renamed to // `country_calling_codes` in `1.0.18`. if (!is_object(metadata) || !is_object(metadata.countries)) { throw new Error("[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got ".concat(is_object(metadata) ? 'an object of shape: { ' + Object.keys(metadata).join(', ') + ' }' : 'a ' + type_of(metadata) + ': ' + metadata, ".")); } } // Babel transforms `typeof` into some "branches" // so istanbul will show this as "branch not covered". /* istanbul ignore next */ var is_object = function is_object(_) { return _typeof$1(_) === 'object'; }; // Babel transforms `typeof` into some "branches" // so istanbul will show this as "branch not covered". /* istanbul ignore next */ var type_of = function type_of(_) { return _typeof$1(_); }; /** * Returns "country calling code" for a country. * Throws an error if the country doesn't exist or isn't supported by this library. * @param {string} country * @param {object} metadata * @return {string} * @example * // Returns "44" * getCountryCallingCode("GB") */ function getCountryCallingCode(country, metadata) { metadata = new Metadata(metadata); if (metadata.hasCountry(country)) { return metadata.country(country).countryCallingCode(); } throw new Error("Unknown country: ".concat(country)); } function isSupportedCountry(country, metadata) { // metadata = new Metadata(metadata) // return metadata.hasCountry(country) return metadata.countries[country] !== undefined; } function setVersion(metadata) { var version = metadata.version; if (typeof version === 'number') { this.v1 = version === 1; this.v2 = version === 2; this.v3 = version === 3; this.v4 = version === 4; } else { if (!version) { this.v1 = true; } else if (compare(version, V3) === -1) { this.v2 = true; } else if (compare(version, V4) === -1) { this.v3 = true; } else { this.v4 = true; } } } // const ISO_COUNTRY_CODE = /^[A-Z]{2}$/ // function isCountryCode(countryCode) { // return ISO_COUNTRY_CODE.test(countryCodeOrCountryCallingCode) // } var RFC3966_EXTN_PREFIX = ';ext='; /** * Helper method for constructing regular expressions for parsing. Creates * an expression that captures up to max_length digits. * @return {string} RegEx pattern to capture extension digits. */ var getExtensionDigitsPattern = function getExtensionDigitsPattern(maxLength) { return "([".concat(VALID_DIGITS, "]{1,").concat(maxLength, "})"); }; /** * Helper initialiser method to create the regular-expression pattern to match * extensions. * Copy-pasted from Google's `libphonenumber`: * https://github.com/google/libphonenumber/blob/55b2646ec9393f4d3d6661b9c82ef9e258e8b829/javascript/i18n/phonenumbers/phonenumberutil.js#L759-L766 * @return {string} RegEx pattern to capture extensions. */ function createExtensionPattern(purpose) { // We cap the maximum length of an extension based on the ambiguity of the way // the extension is prefixed. As per ITU, the officially allowed length for // extensions is actually 40, but we don't support this since we haven't seen real // examples and this introduces many false interpretations as the extension labels // are not standardized. /** @type {string} */ var extLimitAfterExplicitLabel = '20'; /** @type {string} */ var extLimitAfterLikelyLabel = '15'; /** @type {string} */ var extLimitAfterAmbiguousChar = '9'; /** @type {string} */ var extLimitWhenNotSure = '6'; /** @type {string} */ var possibleSeparatorsBetweenNumberAndExtLabel = "[ \xA0\\t,]*"; // Optional full stop (.) or colon, followed by zero or more spaces/tabs/commas. /** @type {string} */ var possibleCharsAfterExtLabel = "[:\\.\uFF0E]?[ \xA0\\t,-]*"; /** @type {string} */ var optionalExtnSuffix = "#?"; // Here the extension is called out in more explicit way, i.e mentioning it obvious // patterns like "ext.". /** @type {string} */ var explicitExtLabels = "(?:e?xt(?:ensi(?:o\u0301?|\xF3))?n?|\uFF45?\uFF58\uFF54\uFF4E?|\u0434\u043E\u0431|anexo)"; // One-character symbols that can be used to indicate an extension, and less // commonly used or more ambiguous extension labels. /** @type {string} */ var ambiguousExtLabels = "(?:[x\uFF58#\uFF03~\uFF5E]|int|\uFF49\uFF4E\uFF54)"; // When extension is not separated clearly. /** @type {string} */ var ambiguousSeparator = "[- ]+"; // This is the same as possibleSeparatorsBetweenNumberAndExtLabel, but not matching // comma as extension label may have it. /** @type {string} */ var possibleSeparatorsNumberExtLabelNoComma = "[ \xA0\\t]*"; // ",," is commonly used for auto dialling the extension when connected. First // comma is matched through possibleSeparatorsBetweenNumberAndExtLabel, so we do // not repeat it here. Semi-colon works in Iphone and Android also to pop up a // button with the extension number following. /** @type {string} */ var autoDiallingAndExtLabelsFound = "(?:,{2}|;)"; /** @type {string} */ var rfcExtn = RFC3966_EXTN_PREFIX + getExtensionDigitsPattern(extLimitAfterExplicitLabel); /** @type {string} */ var explicitExtn = possibleSeparatorsBetweenNumberAndExtLabel + explicitExtLabels + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterExplicitLabel) + optionalExtnSuffix; /** @type {string} */ var ambiguousExtn = possibleSeparatorsBetweenNumberAndExtLabel + ambiguousExtLabels + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterAmbiguousChar) + optionalExtnSuffix; /** @type {string} */ var americanStyleExtnWithSuffix = ambiguousSeparator + getExtensionDigitsPattern(extLimitWhenNotSure) + "#"; /** @type {string} */ var autoDiallingExtn = possibleSeparatorsNumberExtLabelNoComma + autoDiallingAndExtLabelsFound + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterLikelyLabel) + optionalExtnSuffix; /** @type {string} */ var onlyCommasExtn = possibleSeparatorsNumberExtLabelNoComma + "(?:,)+" + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterAmbiguousChar) + optionalExtnSuffix; // The first regular expression covers RFC 3966 format, where the extension is added // using ";ext=". The second more generic where extension is mentioned with explicit // labels like "ext:". In both the above cases we allow more numbers in extension than // any other extension labels. The third one captures when single character extension // labels or less commonly used labels are used. In such cases we capture fewer // extension digits in order to reduce the chance of falsely interpreting two // numbers beside each other as a number + extension. The fourth one covers the // special case of American numbers where the extension is written with a hash // at the end, such as "- 503#". The fifth one is exclusively for extension // autodialling formats which are used when dialling and in this case we accept longer // extensions. The last one is more liberal on the number of commas that acts as // extension labels, so we have a strict cap on the number of digits in such extensions. return rfcExtn + "|" + explicitExtn + "|" + ambiguousExtn + "|" + americanStyleExtnWithSuffix + "|" + autoDiallingExtn + "|" + onlyCommasExtn; } // Checks we have at least three leading digits, and only valid punctuation, // alpha characters and digits in the phone number. Does not include extension // data. The symbol 'x' is allowed here as valid punctuation since it is often // used as a placeholder for carrier codes, for example in Brazilian phone // numbers. We also allow multiple '+' characters at the start. // // Corresponds to the following: // [digits]{minLengthNsn}| // plus_sign* // (([punctuation]|[star])*[digits]){3,}([punctuation]|[star]|[digits]|[alpha])* // // The first reg-ex is to allow short numbers (two digits long) to be parsed if // they are entered as "15" etc, but only if there is no punctuation in them. // The second expression restricts the number of digits to three or more, but // then allows them to be in international form, and to have alpha-characters // and punctuation. We split up the two reg-exes here and combine them when // creating the reg-ex VALID_PHONE_NUMBER_PATTERN itself so we can prefix it // with ^ and append $ to each branch. // // "Note VALID_PUNCTUATION starts with a -, // so must be the first in the range" (c) Google devs. // (wtf did they mean by saying that; probably nothing) // var MIN_LENGTH_PHONE_NUMBER_PATTERN = '[' + VALID_DIGITS + ']{' + MIN_LENGTH_FOR_NSN + '}'; // // And this is the second reg-exp: // (see MIN_LENGTH_PHONE_NUMBER_PATTERN for a full description of this reg-exp) // var VALID_PHONE_NUMBER = '[' + PLUS_CHARS + ']{0,1}' + '(?:' + '[' + VALID_PUNCTUATION + ']*' + '[' + VALID_DIGITS + ']' + '){3,}' + '[' + VALID_PUNCTUATION + VALID_DIGITS + ']*'; // This regular expression isn't present in Google's `libphonenumber` // and is only used to determine whether the phone number being input // is too short for it to even consider it a "valid" number. // This is just a way to differentiate between a really invalid phone // number like "abcde" and a valid phone number that a user has just // started inputting, like "+1" or "1": both these cases would be // considered `NOT_A_NUMBER` by Google's `libphonenumber`, but this // library can provide a more detailed error message — whether it's // really "not a number", or is it just a start of a valid phone number. var VALID_PHONE_NUMBER_START_REG_EXP = new RegExp('^' + '[' + PLUS_CHARS + ']{0,1}' + '(?:' + '[' + VALID_PUNCTUATION + ']*' + '[' + VALID_DIGITS + ']' + '){1,2}' + '$', 'i'); var VALID_PHONE_NUMBER_WITH_EXTENSION = VALID_PHONE_NUMBER + // Phone number extensions '(?:' + createExtensionPattern() + ')?'; // The combined regular expression for valid phone numbers: // var VALID_PHONE_NUMBER_PATTERN = new RegExp( // Either a short two-digit-only phone number '^' + MIN_LENGTH_PHONE_NUMBER_PATTERN + '$' + '|' + // Or a longer fully parsed phone number (min 3 characters) '^' + VALID_PHONE_NUMBER_WITH_EXTENSION + '$', 'i'); // Checks to see if the string of characters could possibly be a phone number at // all. At the moment, checks to see that the string begins with at least 2 // digits, ignoring any punctuation commonly found in phone numbers. This method // does not require the number to be normalized in advance - but does assume // that leading non-number symbols have been removed, such as by the method // `extract_possible_number`. // function isViablePhoneNumber(number) { return number.length >= MIN_LENGTH_FOR_NSN && VALID_PHONE_NUMBER_PATTERN.test(number); } // This is just a way to differentiate between a really invalid phone // number like "abcde" and a valid phone number that a user has just // started inputting, like "+1" or "1": both these cases would be // considered `NOT_A_NUMBER` by Google's `libphonenumber`, but this // library can provide a more detailed error message — whether it's // really "not a number", or is it just a start of a valid phone number. function isViablePhoneNumberStart(number) { return VALID_PHONE_NUMBER_START_REG_EXP.test(number); } // 1 or more valid digits, for use when parsing. var EXTN_PATTERN = new RegExp('(?:' + createExtensionPattern() + ')$', 'i'); // Strips any extension (as in, the part of the number dialled after the call is // connected, usually indicated with extn, ext, x or similar) from the end of // the number, and returns it. function extractExtension(number) { var start = number.search(EXTN_PATTERN); if (start < 0) { return {}; } // If we find a potential extension, and the number preceding this is a viable // number, we assume it is an extension. var numberWithoutExtension = number.slice(0, start); var matches = number.match(EXTN_PATTERN); var i = 1; while (i < matches.length) { if (matches[i]) { return { number: numberWithoutExtension, ext: matches[i] }; } i++; } } // These mappings map a character (key) to a specific digit that should // replace it for normalization purposes. Non-European digits that // may be used in phone numbers are mapped to a European equivalent. // // E.g. in Iraq they don't write `+442323234` but rather `+٤٤٢٣٢٣٢٣٤`. // var DIGITS = { '0': '0', '1': '1', '2': '2', '3': '3', '4': '4', '5': '5', '6': '6', '7': '7', '8': '8', '9': '9', "\uFF10": '0', // Fullwidth digit 0 "\uFF11": '1', // Fullwidth digit 1 "\uFF12": '2', // Fullwidth digit 2 "\uFF13": '3', // Fullwidth digit 3 "\uFF14": '4', // Fullwidth digit 4 "\uFF15": '5', // Fullwidth digit 5 "\uFF16": '6', // Fullwidth digit 6 "\uFF17": '7', // Fullwidth digit 7 "\uFF18": '8', // Fullwidth digit 8 "\uFF19": '9', // Fullwidth digit 9 "\u0660": '0', // Arabic-indic digit 0 "\u0661": '1', // Arabic-indic digit 1 "\u0662": '2', // Arabic-indic digit 2 "\u0663": '3', // Arabic-indic digit 3 "\u0664": '4', // Arabic-indic digit 4 "\u0665": '5', // Arabic-indic digit 5 "\u0666": '6', // Arabic-indic digit 6 "\u0667": '7', // Arabic-indic digit 7 "\u0668": '8', // Arabic-indic digit 8 "\u0669": '9', // Arabic-indic digit 9 "\u06F0": '0', // Eastern-Arabic digit 0 "\u06F1": '1', // Eastern-Arabic digit 1 "\u06F2": '2', // Eastern-Arabic digit 2 "\u06F3": '3', // Eastern-Arabic digit 3 "\u06F4": '4', // Eastern-Arabic digit 4 "\u06F5": '5', // Eastern-Arabic digit 5 "\u06F6": '6', // Eastern-Arabic digit 6 "\u06F7": '7', // Eastern-Arabic digit 7 "\u06F8": '8', // Eastern-Arabic digit 8 "\u06F9": '9' // Eastern-Arabic digit 9 }; function parseDigit(character) { return DIGITS[character]; } function _createForOfIteratorHelperLoose$5(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray$6(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray$6(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$6(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$6(o, minLen); } function _arrayLikeToArray$6(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } /** * Parses phone number characters from a string. * Drops all punctuation leaving only digits and the leading `+` sign (if any). * Also converts wide-ascii and arabic-indic numerals to conventional numerals. * E.g. in Iraq they don't write `+442323234` but rather `+٤٤٢٣٢٣٢٣٤`. * @param {string} string * @return {string} * @example * ```js * // Outputs '8800555'. * parseIncompletePhoneNumber('8 (800) 555') * // Outputs '+7800555'. * parseIncompletePhoneNumber('+7 800 555') * ``` */ function parseIncompletePhoneNumber(string) { var result = ''; // Using `.split('')` here instead of normal `for ... of` // because the importing application doesn't neccessarily include an ES6 polyfill. // The `.split('')` approach discards "exotic" UTF-8 characters // (the ones consisting of four bytes) but digits // (including non-European ones) don't fall into that range // so such "exotic" characters would be discarded anyway. for (var _iterator = _createForOfIteratorHelperLoose$5(string.split('')), _step; !(_step = _iterator()).done;) { var character = _step.value; result += parsePhoneNumberCharacter(character, result) || ''; } return result; } /** * Parses next character while parsing phone number digits (including a `+`) * from text: discards everything except `+` and digits, and `+` is only allowed * at the start of a phone number. * For example, is used in `react-phone-number-input` where it uses * [`input-format`](https://gitlab.com/catamphetamine/input-format). * @param {string} character - Yet another character from raw input string. * @param {string?} prevParsedCharacters - Previous parsed characters. * @param {object} meta - Optional custom use-case-specific metadata. * @return {string?} The parsed character. */ function parsePhoneNumberCharacter(character, prevParsedCharacters) { // Only allow a leading `+`. if (character === '+') { // If this `+` is not the first parsed character // then discard it. if (prevParsedCharacters) { return; } return '+'; } // Allow digits. return parseDigit(character); } var userAgent$1 = engineUserAgent; var firefox = userAgent$1.match(/firefox\/(\d+)/i); var engineFfVersion = !!firefox && +firefox[1]; var UA = engineUserAgent; var engineIsIeOrEdge = /MSIE|Trident/.test(UA); var userAgent = engineUserAgent; var webkit = userAgent.match(/AppleWebKit\/(\d+)\./); var engineWebkitVersion = !!webkit && +webkit[1]; var $$4 = _export; var uncurryThis$4 = functionUncurryThis; var aCallable = aCallable$a; var toObject = toObject$d; var lengthOfArrayLike = lengthOfArrayLike$b; var deletePropertyOrThrow = deletePropertyOrThrow$2; var toString$1 = toString$j; var fails$1 = fails$J; var internalSort = arraySort$1; var arrayMethodIsStrict$1 = arrayMethodIsStrict$8; var FF = engineFfVersion; var IE_OR_EDGE = engineIsIeOrEdge; var V8 = engineV8Version; var WEBKIT = engineWebkitVersion; var test = []; var nativeSort = uncurryThis$4(test.sort); var push = uncurryThis$4(test.push); // IE8- var FAILS_ON_UNDEFINED = fails$1(function () { test.sort(undefined); }); // V8 bug var FAILS_ON_NULL = fails$1(function () { test.sort(null); }); // Old WebKit var STRICT_METHOD$1 = arrayMethodIsStrict$1('sort'); var STABLE_SORT = !fails$1(function () { // feature detection can be too slow, so check engines versions if (V8) return V8 < 70; if (FF && FF > 3) return; if (IE_OR_EDGE) return true; if (WEBKIT) return WEBKIT < 603; var result = ''; var code, chr, value, index; // generate an array with more 512 elements (Chakra and old V8 fails only in this case) for (code = 65; code < 76; code++) { chr = String.fromCharCode(code); switch (code) { case 66: case 69: case 70: case 72: value = 3; break; case 68: case 71: value = 4; break; default: value = 2; } for (index = 0; index < 47; index++) { test.push({ k: chr + index, v: value }); } } test.sort(function (a, b) { return b.v - a.v; }); for (index = 0; index < test.length; index++) { chr = test[index].k.charAt(0); if (result.charAt(result.length - 1) !== chr) result += chr; } return result !== 'DGBEFHACIJK'; }); var FORCED$1 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD$1 || !STABLE_SORT; var getSortCompare = function (comparefn) { return function (x, y) { if (y === undefined) return -1; if (x === undefined) return 1; if (comparefn !== undefined) return +comparefn(x, y) || 0; return toString$1(x) > toString$1(y) ? 1 : -1; }; }; // `Array.prototype.sort` method // https://tc39.es/ecma262/#sec-array.prototype.sort $$4({ target: 'Array', proto: true, forced: FORCED$1 }, { sort: function sort(comparefn) { if (comparefn !== undefined) aCallable(comparefn); var array = toObject(this); if (STABLE_SORT) return comparefn === undefined ? nativeSort(array) : nativeSort(array, comparefn); var items = []; var arrayLength = lengthOfArrayLike(array); var itemsLength, index; for (index = 0; index < arrayLength; index++) { if (index in array) push(items, array[index]); } internalSort(items, getSortCompare(comparefn)); itemsLength = lengthOfArrayLike(items); index = 0; while (index < itemsLength) array[index] = items[index++]; while (index < arrayLength) deletePropertyOrThrow(array, index++); return array; } }); function _createForOfIteratorHelperLoose$4(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray$5(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray$5(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$5(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$5(o, minLen); } function _arrayLikeToArray$5(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } /** * Merges two arrays. * @param {*} a * @param {*} b * @return {*} */ function mergeArrays(a, b) { var merged = a.slice(); for (var _iterator = _createForOfIteratorHelperLoose$4(b), _step; !(_step = _iterator()).done;) { var element = _step.value; if (a.indexOf(element) < 0) { merged.push(element); } } return merged.sort(function (a, b) { return a - b; }); // ES6 version, requires Set polyfill. // let merged = new Set(a) // for (const element of b) { // merged.add(i) // } // return Array.from(merged).sort((a, b) => a - b) } function checkNumberLength(nationalNumber, metadata) { return checkNumberLengthForType(nationalNumber, undefined, metadata); } // Checks whether a number is possible for the country based on its length. // Should only be called for the "new" metadata which has "possible lengths". function checkNumberLengthForType(nationalNumber, type, metadata) { var type_info = metadata.type(type); // There should always be "" set for every type element. // This is declared in the XML schema. // For size efficiency, where a sub-description (e.g. fixed-line) // has the same "" as the "general description", this is missing, // so we fall back to the "general description". Where no numbers of the type // exist at all, there is one possible length (-1) which is guaranteed // not to match the length of any real phone number. var possible_lengths = type_info && type_info.possibleLengths() || metadata.possibleLengths(); // let local_lengths = type_info && type.possibleLengthsLocal() || metadata.possibleLengthsLocal() // Metadata before version `1.0.18` didn't contain `possible_lengths`. if (!possible_lengths) { return 'IS_POSSIBLE'; } if (type === 'FIXED_LINE_OR_MOBILE') { // No such country in metadata. /* istanbul ignore next */ if (!metadata.type('FIXED_LINE')) { // The rare case has been encountered where no fixedLine data is available // (true for some non-geographic entities), so we just check mobile. return checkNumberLengthForType(nationalNumber, 'MOBILE', metadata); } var mobile_type = metadata.type('MOBILE'); if (mobile_type) { // Merge the mobile data in if there was any. "Concat" creates a new // array, it doesn't edit possible_lengths in place, so we don't need a copy. // Note that when adding the possible lengths from mobile, we have // to again check they aren't empty since if they are this indicates // they are the same as the general desc and should be obtained from there. possible_lengths = mergeArrays(possible_lengths, mobile_type.possibleLengths()); // The current list is sorted; we need to merge in the new list and // re-sort (duplicates are okay). Sorting isn't so expensive because // the lists are very small. // if (local_lengths) { // local_lengths = mergeArrays(local_lengths, mobile_type.possibleLengthsLocal()) // } else { // local_lengths = mobile_type.possibleLengthsLocal() // } } } // If the type doesn't exist then return 'INVALID_LENGTH'. else if (type && !type_info) { return 'INVALID_LENGTH'; } var actual_length = nationalNumber.length; // In `libphonenumber-js` all "local-only" formats are dropped for simplicity. // // This is safe because there is never an overlap beween the possible lengths // // and the local-only lengths; this is checked at build time. // if (local_lengths && local_lengths.indexOf(nationalNumber.length) >= 0) // { // return 'IS_POSSIBLE_LOCAL_ONLY' // } var minimum_length = possible_lengths[0]; if (minimum_length === actual_length) { return 'IS_POSSIBLE'; } if (minimum_length > actual_length) { return 'TOO_SHORT'; } if (possible_lengths[possible_lengths.length - 1] < actual_length) { return 'TOO_LONG'; } // We skip the first element since we've already checked it. return possible_lengths.indexOf(actual_length, 1) >= 0 ? 'IS_POSSIBLE' : 'INVALID_LENGTH'; } function isPossiblePhoneNumber$2(input, options, metadata) { /* istanbul ignore if */ if (options === undefined) { options = {}; } metadata = new Metadata(metadata); if (options.v2) { if (!input.countryCallingCode) { throw new Error('Invalid phone number object passed'); } metadata.selectNumberingPlan(input.countryCallingCode); } else { if (!input.phone) { return false; } if (input.country) { if (!metadata.hasCountry(input.country)) { throw new Error("Unknown country: ".concat(input.country)); } metadata.country(input.country); } else { if (!input.countryCallingCode) { throw new Error('Invalid phone number object passed'); } metadata.selectNumberingPlan(input.countryCallingCode); } } // Old metadata (< 1.0.18) had no "possible length" data. if (metadata.possibleLengths()) { return isPossibleNumber(input.phone || input.nationalNumber, metadata); } else { // There was a bug between `1.7.35` and `1.7.37` where "possible_lengths" // were missing for "non-geographical" numbering plans. // Just assume the number is possible in such cases: // it's unlikely that anyone generated their custom metadata // in that short period of time (one day). // This code can be removed in some future major version update. if (input.countryCallingCode && metadata.isNonGeographicCallingCode(input.countryCallingCode)) { // "Non-geographic entities" did't have `possibleLengths` // due to a bug in metadata generation process. return true; } else { throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.'); } } } function isPossibleNumber(nationalNumber, metadata) { //, isInternational) { switch (checkNumberLength(nationalNumber, metadata)) { case 'IS_POSSIBLE': return true; // This library ignores "local-only" phone numbers (for simplicity). // See the readme for more info on what are "local-only" phone numbers. // case 'IS_POSSIBLE_LOCAL_ONLY': // return !isInternational default: return false; } } function _slicedToArray$1(arr, i) { return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$4(arr, i) || _nonIterableRest$1(); } function _nonIterableRest$1() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _iterableToArrayLimit$1(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayWithHoles$1(arr) { if (Array.isArray(arr)) return arr; } function _createForOfIteratorHelperLoose$3(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray$4(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray$4(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$4(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$4(o, minLen); } function _arrayLikeToArray$4(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } /** * @param {string} text - Phone URI (RFC 3966). * @return {object} `{ ?number, ?ext }`. */ function parseRFC3966(text) { var number; var ext; // Replace "tel:" with "tel=" for parsing convenience. text = text.replace(/^tel:/, 'tel='); for (var _iterator = _createForOfIteratorHelperLoose$3(text.split(';')), _step; !(_step = _iterator()).done;) { var part = _step.value; var _part$split = part.split('='), _part$split2 = _slicedToArray$1(_part$split, 2), name = _part$split2[0], value = _part$split2[1]; switch (name) { case 'tel': number = value; break; case 'ext': ext = value; break; case 'phone-context': // Only "country contexts" are supported. // "Domain contexts" are ignored. if (value[0] === '+') { number = value + number; } break; } } // If the phone number is not viable, then abort. if (!isViablePhoneNumber(number)) { return {}; } var result = { number: number }; if (ext) { result.ext = ext; } return result; } /** * @param {object} - `{ ?number, ?extension }`. * @return {string} Phone URI (RFC 3966). */ function formatRFC3966(_ref) { var number = _ref.number, ext = _ref.ext; if (!number) { return ''; } if (number[0] !== '+') { throw new Error("\"formatRFC3966()\" expects \"number\" to be in E.164 format."); } return "tel:".concat(number).concat(ext ? ';ext=' + ext : ''); } /** * Checks whether the entire input sequence can be matched * against the regular expression. * @return {boolean} */ function matchesEntirely(text, regular_expression) { // If assigning the `''` default value is moved to the arguments above, // code coverage would decrease for some weird reason. text = text || ''; return new RegExp('^(?:' + regular_expression + ')$').test(text); } function _createForOfIteratorHelperLoose$2(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray$3(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray$3(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$3(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen); } function _arrayLikeToArray$3(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } var NON_FIXED_LINE_PHONE_TYPES = ['MOBILE', 'PREMIUM_RATE', 'TOLL_FREE', 'SHARED_COST', 'VOIP', 'PERSONAL_NUMBER', 'PAGER', 'UAN', 'VOICEMAIL']; // Finds out national phone number type (fixed line, mobile, etc) function getNumberType(input, options, metadata) { // If assigning the `{}` default value is moved to the arguments above, // code coverage would decrease for some weird reason. options = options || {}; // When `parse()` returned `{}` // meaning that the phone number is not a valid one. if (!input.country) { return; } metadata = new Metadata(metadata); metadata.selectNumberingPlan(input.country, input.countryCallingCode); var nationalNumber = options.v2 ? input.nationalNumber : input.phone; // The following is copy-pasted from the original function: // https://github.com/googlei18n/libphonenumber/blob/3ea547d4fbaa2d0b67588904dfa5d3f2557c27ff/javascript/i18n/phonenumbers/phonenumberutil.js#L2835 // Is this national number even valid for this country if (!matchesEntirely(nationalNumber, metadata.nationalNumberPattern())) { return; } // Is it fixed line number if (isNumberTypeEqualTo(nationalNumber, 'FIXED_LINE', metadata)) { // Because duplicate regular expressions are removed // to reduce metadata size, if "mobile" pattern is "" // then it means it was removed due to being a duplicate of the fixed-line pattern. // if (metadata.type('MOBILE') && metadata.type('MOBILE').pattern() === '') { return 'FIXED_LINE_OR_MOBILE'; } // `MOBILE` type pattern isn't included if it matched `FIXED_LINE` one. // For example, for "US" country. // Old metadata (< `1.0.18`) had a specific "types" data structure // that happened to be `undefined` for `MOBILE` in that case. // Newer metadata (>= `1.0.18`) has another data structure that is // not `undefined` for `MOBILE` in that case (it's just an empty array). // So this `if` is just for backwards compatibility with old metadata. if (!metadata.type('MOBILE')) { return 'FIXED_LINE_OR_MOBILE'; } // Check if the number happens to qualify as both fixed line and mobile. // (no such country in the minimal metadata set) /* istanbul ignore if */ if (isNumberTypeEqualTo(nationalNumber, 'MOBILE', metadata)) { return 'FIXED_LINE_OR_MOBILE'; } return 'FIXED_LINE'; } for (var _iterator = _createForOfIteratorHelperLoose$2(NON_FIXED_LINE_PHONE_TYPES), _step; !(_step = _iterator()).done;) { var type = _step.value; if (isNumberTypeEqualTo(nationalNumber, type, metadata)) { return type; } } } function isNumberTypeEqualTo(nationalNumber, type, metadata) { type = metadata.type(type); if (!type || !type.pattern()) { return false; } // Check if any possible number lengths are present; // if so, we use them to avoid checking // the validation pattern if they don't match. // If they are absent, this means they match // the general description, which we have // already checked before a specific number type. if (type.possibleLengths() && type.possibleLengths().indexOf(nationalNumber.length) < 0) { return false; } return matchesEntirely(nationalNumber, type.pattern()); } /** * Checks if a given phone number is valid. * * If the `number` is a string, it will be parsed to an object, * but only if it contains only valid phone number characters (including punctuation). * If the `number` is an object, it is used as is. * * The optional `defaultCountry` argument is the default country. * I.e. it does not restrict to just that country, * e.g. in those cases where several countries share * the same phone numbering rules (NANPA, Britain, etc). * For example, even though the number `07624 369230` * belongs to the Isle of Man ("IM" country code) * calling `isValidNumber('07624369230', 'GB', metadata)` * still returns `true` because the country is not restricted to `GB`, * it's just that `GB` is the default one for the phone numbering rules. * For restricting the country see `isValidNumberForRegion()` * though restricting a country might not be a good idea. * https://github.com/googlei18n/libphonenumber/blob/master/FAQ.md#when-should-i-use-isvalidnumberforregion * * Examples: * * ```js * isValidNumber('+78005553535', metadata) * isValidNumber('8005553535', 'RU', metadata) * isValidNumber('88005553535', 'RU', metadata) * isValidNumber({ phone: '8005553535', country: 'RU' }, metadata) * ``` */ function isValidNumber(input, options, metadata) { // If assigning the `{}` default value is moved to the arguments above, // code coverage would decrease for some weird reason. options = options || {}; metadata = new Metadata(metadata); // This is just to support `isValidNumber({})` // for cases when `parseNumber()` returns `{}`. if (!input.country) { return false; } metadata.selectNumberingPlan(input.country, input.countryCallingCode); // By default, countries only have type regexps when it's required for // distinguishing different countries having the same `countryCallingCode`. if (metadata.hasTypes()) { return getNumberType(input, options, metadata.metadata) !== undefined; } // If there are no type regexps for this country in metadata then use // `nationalNumberPattern` as a "better than nothing" replacement. var national_number = options.v2 ? input.nationalNumber : input.phone; return matchesEntirely(national_number, metadata.nationalNumberPattern()); } // // E.g. "(999) 111-22-33" -> "999 111 22 33" // // For some reason Google's metadata contains ``s with brackets and dashes. // Meanwhile, there's no single opinion about using punctuation in international phone numbers. // // For example, Google's `` for USA is `+1 213-373-4253`. // And here's a quote from WikiPedia's "North American Numbering Plan" page: // https://en.wikipedia.org/wiki/North_American_Numbering_Plan // // "The country calling code for all countries participating in the NANP is 1. // In international format, an NANP number should be listed as +1 301 555 01 00, // where 301 is an area code (Maryland)." // // I personally prefer the international format without any punctuation. // For example, brackets are remnants of the old age, meaning that the // phone number part in brackets (so called "area code") can be omitted // if dialing within the same "area". // And hyphens were clearly introduced for splitting local numbers into memorizable groups. // For example, remembering "5553535" is difficult but "555-35-35" is much simpler. // Imagine a man taking a bus from home to work and seeing an ad with a phone number. // He has a couple of seconds to memorize that number until it passes by. // If it were spaces instead of hyphens the man wouldn't necessarily get it, // but with hyphens instead of spaces the grouping is more explicit. // I personally think that hyphens introduce visual clutter, // so I prefer replacing them with spaces in international numbers. // In the modern age all output is done on displays where spaces are clearly distinguishable // so hyphens can be safely replaced with spaces without losing any legibility. // function applyInternationalSeparatorStyle(formattedNumber) { return formattedNumber.replace(new RegExp("[".concat(VALID_PUNCTUATION, "]+"), 'g'), ' ').trim(); } // first group is not used in the national pattern (e.g. Argentina) so the $1 // group does not match correctly. Therefore, we use `\d`, so that the first // group actually used in the pattern will be matched. var FIRST_GROUP_PATTERN = /($\d)/; function formatNationalNumberUsingFormat(number, format, _ref) { var useInternationalFormat = _ref.useInternationalFormat, withNationalPrefix = _ref.withNationalPrefix; _ref.carrierCode; _ref.metadata; var formattedNumber = number.replace(new RegExp(format.pattern()), useInternationalFormat ? format.internationalFormat() : // This library doesn't use `domestic_carrier_code_formatting_rule`, // because that one is only used when formatting phone numbers // for dialing from a mobile phone, and this is not a dialing library. // carrierCode && format.domesticCarrierCodeFormattingRule() // // First, replace the $CC in the formatting rule with the desired carrier code. // // Then, replace the $FG in the formatting rule with the first group // // and the carrier code combined in the appropriate way. // ? format.format().replace(FIRST_GROUP_PATTERN, format.domesticCarrierCodeFormattingRule().replace('$CC', carrierCode)) // : ( // withNationalPrefix && format.nationalPrefixFormattingRule() // ? format.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule()) // : format.format() // ) withNationalPrefix && format.nationalPrefixFormattingRule() ? format.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule()) : format.format()); if (useInternationalFormat) { return applyInternationalSeparatorStyle(formattedNumber); } return formattedNumber; } /** * Pattern that makes it easy to distinguish whether a region has a single * international dialing prefix or not. If a region has a single international * prefix (e.g. 011 in USA), it will be represented as a string that contains * a sequence of ASCII digits, and possibly a tilde, which signals waiting for * the tone. If there are multiple available international prefixes in a * region, they will be represented as a regex string that always contains one * or more characters that are not ASCII digits or a tilde. */ var SINGLE_IDD_PREFIX_REG_EXP = /^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/; // For regions that have multiple IDD prefixes // a preferred IDD prefix is returned. function getIddPrefix(country, callingCode, metadata) { var countryMetadata = new Metadata(metadata); countryMetadata.selectNumberingPlan(country, callingCode); if (countryMetadata.defaultIDDPrefix()) { return countryMetadata.defaultIDDPrefix(); } if (SINGLE_IDD_PREFIX_REG_EXP.test(countryMetadata.IDDPrefix())) { return countryMetadata.IDDPrefix(); } } function _createForOfIteratorHelperLoose$1(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray$2(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray$2(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$2(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen); } function _arrayLikeToArray$2(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$6(Object(source), !0).forEach(function (key) { _defineProperty$6(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } function _defineProperty$6(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var DEFAULT_OPTIONS = { formatExtension: function formatExtension(formattedNumber, extension, metadata) { return "".concat(formattedNumber).concat(metadata.ext()).concat(extension); } }; // Formats a phone number // // Example use cases: // // ```js // formatNumber('8005553535', 'RU', 'INTERNATIONAL') // formatNumber('8005553535', 'RU', 'INTERNATIONAL', metadata) // formatNumber({ phone: '8005553535', country: 'RU' }, 'INTERNATIONAL') // formatNumber({ phone: '8005553535', country: 'RU' }, 'INTERNATIONAL', metadata) // formatNumber('+78005553535', 'NATIONAL') // formatNumber('+78005553535', 'NATIONAL', metadata) // ``` // function formatNumber(input, format, options, metadata) { // Apply default options. if (options) { options = _objectSpread$6(_objectSpread$6({}, DEFAULT_OPTIONS), options); } else { options = DEFAULT_OPTIONS; } metadata = new Metadata(metadata); if (input.country && input.country !== '001') { // Validate `input.country`. if (!metadata.hasCountry(input.country)) { throw new Error("Unknown country: ".concat(input.country)); } metadata.country(input.country); } else if (input.countryCallingCode) { metadata.selectNumberingPlan(input.countryCallingCode); } else return input.phone || ''; var countryCallingCode = metadata.countryCallingCode(); var nationalNumber = options.v2 ? input.nationalNumber : input.phone; // This variable should have been declared inside `case`s // but Babel has a bug and it says "duplicate variable declaration". var number; switch (format) { case 'NATIONAL': // Legacy argument support. // (`{ country: ..., phone: '' }`) if (!nationalNumber) { return ''; } number = formatNationalNumber(nationalNumber, input.carrierCode, 'NATIONAL', metadata, options); return addExtension(number, input.ext, metadata, options.formatExtension); case 'INTERNATIONAL': // Legacy argument support. // (`{ country: ..., phone: '' }`) if (!nationalNumber) { return "+".concat(countryCallingCode); } number = formatNationalNumber(nationalNumber, null, 'INTERNATIONAL', metadata, options); number = "+".concat(countryCallingCode, " ").concat(number); return addExtension(number, input.ext, metadata, options.formatExtension); case 'E.164': // `E.164` doesn't define "phone number extensions". return "+".concat(countryCallingCode).concat(nationalNumber); case 'RFC3966': return formatRFC3966({ number: "+".concat(countryCallingCode).concat(nationalNumber), ext: input.ext }); // For reference, here's Google's IDD formatter: // https://github.com/google/libphonenumber/blob/32719cf74e68796788d1ca45abc85dcdc63ba5b9/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L1546 // Not saying that this IDD formatter replicates it 1:1, but it seems to work. // Who would even need to format phone numbers in IDD format anyway? case 'IDD': if (!options.fromCountry) { return; // throw new Error('`fromCountry` option not passed for IDD-prefixed formatting.') } var formattedNumber = formatIDD(nationalNumber, input.carrierCode, countryCallingCode, options.fromCountry, metadata); return addExtension(formattedNumber, input.ext, metadata, options.formatExtension); default: throw new Error("Unknown \"format\" argument passed to \"formatNumber()\": \"".concat(format, "\"")); } } function formatNationalNumber(number, carrierCode, formatAs, metadata, options) { var format = chooseFormatForNumber(metadata.formats(), number); if (!format) { return number; } return formatNationalNumberUsingFormat(number, format, { useInternationalFormat: formatAs === 'INTERNATIONAL', withNationalPrefix: format.nationalPrefixIsOptionalWhenFormattingInNationalFormat() && options && options.nationalPrefix === false ? false : true, carrierCode: carrierCode, metadata: metadata }); } function chooseFormatForNumber(availableFormats, nationalNnumber) { for (var _iterator = _createForOfIteratorHelperLoose$1(availableFormats), _step; !(_step = _iterator()).done;) { var format = _step.value; // Validate leading digits. // The test case for "else path" could be found by searching for // "format.leadingDigitsPatterns().length === 0". if (format.leadingDigitsPatterns().length > 0) { // The last leading_digits_pattern is used here, as it is the most detailed var lastLeadingDigitsPattern = format.leadingDigitsPatterns()[format.leadingDigitsPatterns().length - 1]; // If leading digits don't match then move on to the next phone number format if (nationalNnumber.search(lastLeadingDigitsPattern) !== 0) { continue; } } // Check that the national number matches the phone number format regular expression if (matchesEntirely(nationalNnumber, format.pattern())) { return format; } } } function addExtension(formattedNumber, ext, metadata, formatExtension) { return ext ? formatExtension(formattedNumber, ext, metadata) : formattedNumber; } function formatIDD(nationalNumber, carrierCode, countryCallingCode, fromCountry, metadata) { var fromCountryCallingCode = getCountryCallingCode(fromCountry, metadata.metadata); // When calling within the same country calling code. if (fromCountryCallingCode === countryCallingCode) { var formattedNumber = formatNationalNumber(nationalNumber, carrierCode, 'NATIONAL', metadata); // For NANPA regions, return the national format for these regions // but prefix it with the country calling code. if (countryCallingCode === '1') { return countryCallingCode + ' ' + formattedNumber; } // If regions share a country calling code, the country calling code need // not be dialled. This also applies when dialling within a region, so this // if clause covers both these cases. Technically this is the case for // dialling from La Reunion to other overseas departments of France (French // Guiana, Martinique, Guadeloupe), but not vice versa - so we don't cover // this edge case for now and for those cases return the version including // country calling code. Details here: // http://www.petitfute.com/voyage/225-info-pratiques-reunion // return formattedNumber; } var iddPrefix = getIddPrefix(fromCountry, undefined, metadata.metadata); if (iddPrefix) { return "".concat(iddPrefix, " ").concat(countryCallingCode, " ").concat(formatNationalNumber(nationalNumber, null, 'INTERNATIONAL', metadata)); } } function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$5(Object(source), !0).forEach(function (key) { _defineProperty$5(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } function _defineProperty$5(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } var PhoneNumber = /*#__PURE__*/function () { function PhoneNumber(countryCallingCode, nationalNumber, metadata) { _classCallCheck(this, PhoneNumber); if (!countryCallingCode) { throw new TypeError('`country` or `countryCallingCode` not passed'); } if (!nationalNumber) { throw new TypeError('`nationalNumber` not passed'); } if (!metadata) { throw new TypeError('`metadata` not passed'); } var _metadata = new Metadata(metadata); // If country code is passed then derive `countryCallingCode` from it. // Also store the country code as `.country`. if (isCountryCode(countryCallingCode)) { this.country = countryCallingCode; _metadata.country(countryCallingCode); countryCallingCode = _metadata.countryCallingCode(); } this.countryCallingCode = countryCallingCode; this.nationalNumber = nationalNumber; this.number = '+' + this.countryCallingCode + this.nationalNumber; this.metadata = metadata; } _createClass(PhoneNumber, [{ key: "setExt", value: function setExt(ext) { this.ext = ext; } }, { key: "isPossible", value: function isPossible() { return isPossiblePhoneNumber$2(this, { v2: true }, this.metadata); } }, { key: "isValid", value: function isValid() { return isValidNumber(this, { v2: true }, this.metadata); } }, { key: "isNonGeographic", value: function isNonGeographic() { var metadata = new Metadata(this.metadata); return metadata.isNonGeographicCallingCode(this.countryCallingCode); } }, { key: "isEqual", value: function isEqual(phoneNumber) { return this.number === phoneNumber.number && this.ext === phoneNumber.ext; } // // Is just an alias for `this.isValid() && this.country === country`. // // https://github.com/googlei18n/libphonenumber/blob/master/FAQ.md#when-should-i-use-isvalidnumberforregion // isValidForRegion(country) { // return isValidNumberForRegion(this, country, { v2: true }, this.metadata) // } }, { key: "getType", value: function getType() { return getNumberType(this, { v2: true }, this.metadata); } }, { key: "format", value: function format(_format, options) { return formatNumber(this, _format, options ? _objectSpread$5(_objectSpread$5({}, options), {}, { v2: true }) : { v2: true }, this.metadata); } }, { key: "formatNational", value: function formatNational(options) { return this.format('NATIONAL', options); } }, { key: "formatInternational", value: function formatInternational(options) { return this.format('INTERNATIONAL', options); } }, { key: "getURI", value: function getURI(options) { return this.format('RFC3966', options); } }]); return PhoneNumber; }(); var isCountryCode = function isCountryCode(value) { return /^[A-Z]{2}$/.test(value); }; var CAPTURING_DIGIT_PATTERN = new RegExp('([' + VALID_DIGITS + '])'); function stripIddPrefix(number, country, callingCode, metadata) { if (!country) { return; } // Check if the number is IDD-prefixed. var countryMetadata = new Metadata(metadata); countryMetadata.selectNumberingPlan(country, callingCode); var IDDPrefixPattern = new RegExp(countryMetadata.IDDPrefix()); if (number.search(IDDPrefixPattern) !== 0) { return; } // Strip IDD prefix. number = number.slice(number.match(IDDPrefixPattern)[0].length); // If there're any digits after an IDD prefix, // then those digits are a country calling code. // Since no country code starts with a `0`, // the code below validates that the next digit (if present) is not `0`. var matchedGroups = number.match(CAPTURING_DIGIT_PATTERN); if (matchedGroups && matchedGroups[1] != null && matchedGroups[1].length > 0) { if (matchedGroups[1] === '0') { return; } } return number; } /** * Strips any national prefix (such as 0, 1) present in a * (possibly incomplete) number provided. * "Carrier codes" are only used in Colombia and Brazil, * and only when dialing within those countries from a mobile phone to a fixed line number. * Sometimes it won't actually strip national prefix * and will instead prepend some digits to the `number`: * for example, when number `2345678` is passed with `VI` country selected, * it will return `{ number: "3402345678" }`, because `340` area code is prepended. * @param {string} number — National number digits. * @param {object} metadata — Metadata with country selected. * @return {object} `{ nationalNumber: string, nationalPrefix: string? carrierCode: string? }`. Even if a national prefix was extracted, it's not necessarily present in the returned object, so don't rely on its presence in the returned object in order to find out whether a national prefix has been extracted or not. */ function extractNationalNumberFromPossiblyIncompleteNumber(number, metadata) { if (number && metadata.numberingPlan.nationalPrefixForParsing()) { // See METADATA.md for the description of // `national_prefix_for_parsing` and `national_prefix_transform_rule`. // Attempt to parse the first digits as a national prefix. var prefixPattern = new RegExp('^(?:' + metadata.numberingPlan.nationalPrefixForParsing() + ')'); var prefixMatch = prefixPattern.exec(number); if (prefixMatch) { var nationalNumber; var carrierCode; // https://gitlab.com/catamphetamine/libphonenumber-js/-/blob/master/METADATA.md#national_prefix_for_parsing--national_prefix_transform_rule // If a `national_prefix_for_parsing` has any "capturing groups" // then it means that the national (significant) number is equal to // those "capturing groups" transformed via `national_prefix_transform_rule`, // and nothing could be said about the actual national prefix: // what is it and was it even there. // If a `national_prefix_for_parsing` doesn't have any "capturing groups", // then everything it matches is a national prefix. // To determine whether `national_prefix_for_parsing` matched any // "capturing groups", the value of the result of calling `.exec()` // is looked at, and if it has non-undefined values where there're // "capturing groups" in the regular expression, then it means // that "capturing groups" have been matched. // It's not possible to tell whether there'll be any "capturing gropus" // before the matching process, because a `national_prefix_for_parsing` // could exhibit both behaviors. var capturedGroupsCount = prefixMatch.length - 1; var hasCapturedGroups = capturedGroupsCount > 0 && prefixMatch[capturedGroupsCount]; if (metadata.nationalPrefixTransformRule() && hasCapturedGroups) { nationalNumber = number.replace(prefixPattern, metadata.nationalPrefixTransformRule()); // If there's more than one captured group, // then carrier code is the second one. if (capturedGroupsCount > 1) { carrierCode = prefixMatch[1]; } } // If there're no "capturing groups", // or if there're "capturing groups" but no // `national_prefix_transform_rule`, // then just strip the national prefix from the number, // and possibly a carrier code. // Seems like there could be more. else { // `prefixBeforeNationalNumber` is the whole substring matched by // the `national_prefix_for_parsing` regular expression. // There seem to be no guarantees that it's just a national prefix. // For example, if there's a carrier code, it's gonna be a // part of `prefixBeforeNationalNumber` too. var prefixBeforeNationalNumber = prefixMatch[0]; nationalNumber = number.slice(prefixBeforeNationalNumber.length); // If there's at least one captured group, // then carrier code is the first one. if (hasCapturedGroups) { carrierCode = prefixMatch[1]; } } // Tries to guess whether a national prefix was present in the input. // This is not something copy-pasted from Google's library: // they don't seem to have an equivalent for that. // So this isn't an "officially approved" way of doing something like that. // But since there seems no other existing method, this library uses it. var nationalPrefix; if (hasCapturedGroups) { var possiblePositionOfTheFirstCapturedGroup = number.indexOf(prefixMatch[1]); var possibleNationalPrefix = number.slice(0, possiblePositionOfTheFirstCapturedGroup); // Example: an Argentinian (AR) phone number `0111523456789`. // `prefixMatch[0]` is `01115`, and `$1` is `11`, // and the rest of the phone number is `23456789`. // The national number is transformed via `9$1` to `91123456789`. // National prefix `0` is detected being present at the start. // if (possibleNationalPrefix.indexOf(metadata.numberingPlan.nationalPrefix()) === 0) { if (possibleNationalPrefix === metadata.numberingPlan.nationalPrefix()) { nationalPrefix = metadata.numberingPlan.nationalPrefix(); } } else { nationalPrefix = prefixMatch[0]; } return { nationalNumber: nationalNumber, nationalPrefix: nationalPrefix, carrierCode: carrierCode }; } } return { nationalNumber: number }; } /** * Strips national prefix and carrier code from a complete phone number. * The difference from the non-"FromCompleteNumber" function is that * it won't extract national prefix if the resultant number is too short * to be a complete number for the selected phone numbering plan. * @param {string} number — Complete phone number digits. * @param {Metadata} metadata — Metadata with a phone numbering plan selected. * @return {object} `{ nationalNumber: string, carrierCode: string? }`. */ function extractNationalNumber(number, metadata) { // Parsing national prefixes and carrier codes // is only required for local phone numbers // but some people don't understand that // and sometimes write international phone numbers // with national prefixes (or maybe even carrier codes). // http://ucken.blogspot.ru/2016/03/trunk-prefixes-in-skype4b.html // Google's original library forgives such mistakes // and so does this library, because it has been requested: // https://github.com/catamphetamine/libphonenumber-js/issues/127 var _extractNationalNumbe = extractNationalNumberFromPossiblyIncompleteNumber(number, metadata), carrierCode = _extractNationalNumbe.carrierCode, nationalNumber = _extractNationalNumbe.nationalNumber; if (nationalNumber !== number) { if (!shouldHaveExtractedNationalPrefix(number, nationalNumber, metadata)) { // Don't strip the national prefix. return { nationalNumber: number }; } // Check the national (significant) number length after extracting national prefix and carrier code. // Legacy generated metadata (before `1.0.18`) didn't support the "possible lengths" feature. if (metadata.possibleLengths()) { // The number remaining after stripping the national prefix and carrier code // should be long enough to have a possible length for the country. // Otherwise, don't strip the national prefix and carrier code, // since the original number could be a valid number. // This check has been copy-pasted "as is" from Google's original library: // https://github.com/google/libphonenumber/blob/876268eb1ad6cdc1b7b5bef17fc5e43052702d57/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L3236-L3250 // It doesn't check for the "possibility" of the original `number`. // I guess it's fine not checking that one. It works as is anyway. if (!isPossibleIncompleteNationalNumber(nationalNumber, metadata)) { // Don't strip the national prefix. return { nationalNumber: number }; } } } return { nationalNumber: nationalNumber, carrierCode: carrierCode }; } // In some countries, the same digit could be a national prefix // or a leading digit of a valid phone number. // For example, in Russia, national prefix is `8`, // and also `800 555 35 35` is a valid number // in which `8` is not a national prefix, but the first digit // of a national (significant) number. // Same's with Belarus: // `82004910060` is a valid national (significant) number, // but `2004910060` is not. // To support such cases (to prevent the code from always stripping // national prefix), a condition is imposed: a national prefix // is not extracted when the original number is "viable" and the // resultant number is not, a "viable" national number being the one // that matches `national_number_pattern`. function shouldHaveExtractedNationalPrefix(nationalNumberBefore, nationalNumberAfter, metadata) { // The equivalent in Google's code is: // https://github.com/google/libphonenumber/blob/e326fa1fc4283bb05eb35cb3c15c18f98a31af33/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L2969-L3004 if (matchesEntirely(nationalNumberBefore, metadata.nationalNumberPattern()) && !matchesEntirely(nationalNumberAfter, metadata.nationalNumberPattern())) { return false; } // This "is possible" national number (length) check has been commented out // because it's superceded by the (effectively) same check done in the // `extractNationalNumber()` function after it calls `shouldHaveExtractedNationalPrefix()`. // In other words, why run the same check twice if it could only be run once. // // Check the national (significant) number length after extracting national prefix and carrier code. // // Fixes a minor "weird behavior" bug: https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/57 // // (Legacy generated metadata (before `1.0.18`) didn't support the "possible lengths" feature). // if (metadata.possibleLengths()) { // if (isPossibleIncompleteNationalNumber(nationalNumberBefore, metadata) && // !isPossibleIncompleteNationalNumber(nationalNumberAfter, metadata)) { // return false // } // } return true; } function isPossibleIncompleteNationalNumber(nationalNumber, metadata) { switch (checkNumberLength(nationalNumber, metadata)) { case 'TOO_SHORT': case 'INVALID_LENGTH': // This library ignores "local-only" phone numbers (for simplicity). // See the readme for more info on what are "local-only" phone numbers. // case 'IS_POSSIBLE_LOCAL_ONLY': return false; default: return true; } } /** * Sometimes some people incorrectly input international phone numbers * without the leading `+`. This function corrects such input. * @param {string} number — Phone number digits. * @param {string?} country * @param {string?} callingCode * @param {object} metadata * @return {object} `{ countryCallingCode: string?, number: string }`. */ function extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country, callingCode, metadata) { var countryCallingCode = country ? getCountryCallingCode(country, metadata) : callingCode; if (number.indexOf(countryCallingCode) === 0) { metadata = new Metadata(metadata); metadata.selectNumberingPlan(country, callingCode); var possibleShorterNumber = number.slice(countryCallingCode.length); var _extractNationalNumbe = extractNationalNumber(possibleShorterNumber, metadata), possibleShorterNationalNumber = _extractNationalNumbe.nationalNumber; var _extractNationalNumbe2 = extractNationalNumber(number, metadata), nationalNumber = _extractNationalNumbe2.nationalNumber; // If the number was not valid before but is valid now, // or if it was too long before, we consider the number // with the country calling code stripped to be a better result // and keep that instead. // For example, in Germany (+49), `49` is a valid area code, // so if a number starts with `49`, it could be both a valid // national German number or an international number without // a leading `+`. if (!matchesEntirely(nationalNumber, metadata.nationalNumberPattern()) && matchesEntirely(possibleShorterNationalNumber, metadata.nationalNumberPattern()) || checkNumberLength(nationalNumber, metadata) === 'TOO_LONG') { return { countryCallingCode: countryCallingCode, number: possibleShorterNumber }; } } return { number: number }; } /** * Converts a phone number digits (possibly with a `+`) * into a calling code and the rest phone number digits. * The "rest phone number digits" could include * a national prefix, carrier code, and national * (significant) number. * @param {string} number — Phone number digits (possibly with a `+`). * @param {string} [country] — Default country. * @param {string} [callingCode] — Default calling code (some phone numbering plans are non-geographic). * @param {object} metadata * @return {object} `{ countryCallingCode: string?, number: string }` * @example * // Returns `{ countryCallingCode: "1", number: "2133734253" }`. * extractCountryCallingCode('2133734253', 'US', null, metadata) * extractCountryCallingCode('2133734253', null, '1', metadata) * extractCountryCallingCode('+12133734253', null, null, metadata) * extractCountryCallingCode('+12133734253', 'RU', null, metadata) */ function extractCountryCallingCode(number, country, callingCode, metadata) { if (!number) { return {}; } // If this is not an international phone number, // then either extract an "IDD" prefix, or extract a // country calling code from a number by autocorrecting it // by prepending a leading `+` in cases when it starts // with the country calling code. // https://wikitravel.org/en/International_dialling_prefix // https://github.com/catamphetamine/libphonenumber-js/issues/376 if (number[0] !== '+') { // Convert an "out-of-country" dialing phone number // to a proper international phone number. var numberWithoutIDD = stripIddPrefix(number, country, callingCode, metadata); // If an IDD prefix was stripped then // convert the number to international one // for subsequent parsing. if (numberWithoutIDD && numberWithoutIDD !== number) { number = '+' + numberWithoutIDD; } else { // Check to see if the number starts with the country calling code // for the default country. If so, we remove the country calling code, // and do some checks on the validity of the number before and after. // https://github.com/catamphetamine/libphonenumber-js/issues/376 if (country || callingCode) { var _extractCountryCallin = extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country, callingCode, metadata), countryCallingCode = _extractCountryCallin.countryCallingCode, shorterNumber = _extractCountryCallin.number; if (countryCallingCode) { return { countryCallingCode: countryCallingCode, number: shorterNumber }; } } return { number: number }; } } // Fast abortion: country codes do not begin with a '0' if (number[1] === '0') { return {}; } metadata = new Metadata(metadata); // The thing with country phone codes // is that they are orthogonal to each other // i.e. there's no such country phone code A // for which country phone code B exists // where B starts with A. // Therefore, while scanning digits, // if a valid country code is found, // that means that it is the country code. // var i = 2; while (i - 1 <= MAX_LENGTH_COUNTRY_CODE && i <= number.length) { var _countryCallingCode = number.slice(1, i); if (metadata.hasCallingCode(_countryCallingCode)) { metadata.selectNumberingPlan(_countryCallingCode); return { countryCallingCode: _countryCallingCode, number: number.slice(i) }; } i++; } return {}; } function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); } function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } var USE_NON_GEOGRAPHIC_COUNTRY_CODE = false; function getCountryByCallingCode(callingCode, nationalPhoneNumber, metadata) { /* istanbul ignore if */ if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) { if (metadata.isNonGeographicCallingCode(callingCode)) { return '001'; } } // Is always non-empty, because `callingCode` is always valid var possibleCountries = metadata.getCountryCodesForCallingCode(callingCode); if (!possibleCountries) { return; } // If there's just one country corresponding to the country code, // then just return it, without further phone number digits validation. if (possibleCountries.length === 1) { return possibleCountries[0]; } return selectCountryFromList(possibleCountries, nationalPhoneNumber, metadata.metadata); } function selectCountryFromList(possibleCountries, nationalPhoneNumber, metadata) { // Re-create `metadata` because it will be selecting a `country`. metadata = new Metadata(metadata); for (var _iterator = _createForOfIteratorHelperLoose(possibleCountries), _step; !(_step = _iterator()).done;) { var country = _step.value; metadata.country(country); // Leading digits check would be the simplest and fastest one. // Leading digits patterns are only defined for about 20% of all countries. // https://gitlab.com/catamphetamine/libphonenumber-js/blob/master/METADATA.md#leading_digits // Matching "leading digits" is a sufficient but not necessary condition. if (metadata.leadingDigits()) { if (nationalPhoneNumber && nationalPhoneNumber.search(metadata.leadingDigits()) === 0) { return country; } } // Else perform full validation with all of those // fixed-line/mobile/etc regular expressions. else if (getNumberType({ phone: nationalPhoneNumber, country: country }, undefined, metadata.metadata)) { return country; } } } // This prevents malicious input from consuming CPU. var MAX_INPUT_STRING_LENGTH = 250; // This consists of the plus symbol, digits, and arabic-indic digits. var PHONE_NUMBER_START_PATTERN = new RegExp('[' + PLUS_CHARS + VALID_DIGITS + ']'); // Regular expression of trailing characters that we want to remove. // A trailing `#` is sometimes used when writing phone numbers with extensions in US. // Example: "+1 (645) 123 1234-910#" number has extension "910". var AFTER_PHONE_NUMBER_END_PATTERN = new RegExp('[^' + VALID_DIGITS + '#' + ']+$'); // // ```js // parse('8 (800) 555-35-35', 'RU') // parse('8 (800) 555-35-35', 'RU', metadata) // parse('8 (800) 555-35-35', { country: { default: 'RU' } }) // parse('8 (800) 555-35-35', { country: { default: 'RU' } }, metadata) // parse('+7 800 555 35 35') // parse('+7 800 555 35 35', metadata) // ``` // function parse(text, options, metadata) { // If assigning the `{}` default value is moved to the arguments above, // code coverage would decrease for some weird reason. options = options || {}; metadata = new Metadata(metadata); // Validate `defaultCountry`. if (options.defaultCountry && !metadata.hasCountry(options.defaultCountry)) { if (options.v2) { throw new ParseError('INVALID_COUNTRY'); } throw new Error("Unknown country: ".concat(options.defaultCountry)); } // Parse the phone number. var _parseInput = parseInput(text, options.v2, options.extract), formattedPhoneNumber = _parseInput.number, ext = _parseInput.ext, error = _parseInput.error; // If the phone number is not viable then return nothing. if (!formattedPhoneNumber) { if (options.v2) { if (error === 'TOO_SHORT') { throw new ParseError('TOO_SHORT'); } throw new ParseError('NOT_A_NUMBER'); } return {}; } var _parsePhoneNumber = parsePhoneNumber$2(formattedPhoneNumber, options.defaultCountry, options.defaultCallingCode, metadata), country = _parsePhoneNumber.country, nationalNumber = _parsePhoneNumber.nationalNumber, countryCallingCode = _parsePhoneNumber.countryCallingCode, carrierCode = _parsePhoneNumber.carrierCode; if (!metadata.hasSelectedNumberingPlan()) { if (options.v2) { throw new ParseError('INVALID_COUNTRY'); } return {}; } // Validate national (significant) number length. if (!nationalNumber || nationalNumber.length < MIN_LENGTH_FOR_NSN) { // Won't throw here because the regexp already demands length > 1. /* istanbul ignore if */ if (options.v2) { throw new ParseError('TOO_SHORT'); } // Google's demo just throws an error in this case. return {}; } // Validate national (significant) number length. // // A sidenote: // // They say that sometimes national (significant) numbers // can be longer than `MAX_LENGTH_FOR_NSN` (e.g. in Germany). // https://github.com/googlei18n/libphonenumber/blob/7e1748645552da39c4e1ba731e47969d97bdb539/resources/phonenumber.proto#L36 // Such numbers will just be discarded. // if (nationalNumber.length > MAX_LENGTH_FOR_NSN) { if (options.v2) { throw new ParseError('TOO_LONG'); } // Google's demo just throws an error in this case. return {}; } if (options.v2) { var phoneNumber = new PhoneNumber(countryCallingCode, nationalNumber, metadata.metadata); if (country) { phoneNumber.country = country; } if (carrierCode) { phoneNumber.carrierCode = carrierCode; } if (ext) { phoneNumber.ext = ext; } return phoneNumber; } // Check if national phone number pattern matches the number. // National number pattern is different for each country, // even for those ones which are part of the "NANPA" group. var valid = (options.extended ? metadata.hasSelectedNumberingPlan() : country) ? matchesEntirely(nationalNumber, metadata.nationalNumberPattern()) : false; if (!options.extended) { return valid ? result(country, nationalNumber, ext) : {}; } // isInternational: countryCallingCode !== undefined return { country: country, countryCallingCode: countryCallingCode, carrierCode: carrierCode, valid: valid, possible: valid ? true : options.extended === true && metadata.possibleLengths() && isPossibleNumber(nationalNumber, metadata) ? true : false, phone: nationalNumber, ext: ext }; } /** * Extracts a formatted phone number from text. * Doesn't guarantee that the extracted phone number * is a valid phone number (for example, doesn't validate its length). * @param {string} text * @param {boolean} [extract] — If `false`, then will parse the entire `text` as a phone number. * @param {boolean} [throwOnError] — By default, it won't throw if the text is too long. * @return {string} * @example * // Returns "(213) 373-4253". * extractFormattedPhoneNumber("Call (213) 373-4253 for assistance.") */ function extractFormattedPhoneNumber(text, extract, throwOnError) { if (!text) { return; } if (text.length > MAX_INPUT_STRING_LENGTH) { if (throwOnError) { throw new ParseError('TOO_LONG'); } return; } if (extract === false) { return text; } // Attempt to extract a possible number from the string passed in var startsAt = text.search(PHONE_NUMBER_START_PATTERN); if (startsAt < 0) { return; } return text // Trim everything to the left of the phone number .slice(startsAt) // Remove trailing non-numerical characters .replace(AFTER_PHONE_NUMBER_END_PATTERN, ''); } /** * @param {string} text - Input. * @param {boolean} v2 - Legacy API functions don't pass `v2: true` flag. * @param {boolean} [extract] - Whether to extract a phone number from `text`, or attempt to parse the entire text as a phone number. * @return {object} `{ ?number, ?ext }`. */ function parseInput(text, v2, extract) { // Parse RFC 3966 phone number URI. if (text && text.indexOf('tel:') === 0) { return parseRFC3966(text); } var number = extractFormattedPhoneNumber(text, extract, v2); // If the phone number is not viable, then abort. if (!number) { return {}; } if (!isViablePhoneNumber(number)) { if (isViablePhoneNumberStart(number)) { return { error: 'TOO_SHORT' }; } return {}; } // Attempt to parse extension first, since it doesn't require region-specific // data and we want to have the non-normalised number here. var withExtensionStripped = extractExtension(number); if (withExtensionStripped.ext) { return withExtensionStripped; } return { number: number }; } /** * Creates `parse()` result object. */ function result(country, nationalNumber, ext) { var result = { country: country, phone: nationalNumber }; if (ext) { result.ext = ext; } return result; } /** * Parses a viable phone number. * @param {string} formattedPhoneNumber — Example: "(213) 373-4253". * @param {string} [defaultCountry] * @param {string} [defaultCallingCode] * @param {Metadata} metadata * @return {object} Returns `{ country: string?, countryCallingCode: string?, nationalNumber: string? }`. */ function parsePhoneNumber$2(formattedPhoneNumber, defaultCountry, defaultCallingCode, metadata) { // Extract calling code from phone number. var _extractCountryCallin = extractCountryCallingCode(parseIncompletePhoneNumber(formattedPhoneNumber), defaultCountry, defaultCallingCode, metadata.metadata), countryCallingCode = _extractCountryCallin.countryCallingCode, number = _extractCountryCallin.number; // Choose a country by `countryCallingCode`. var country; if (countryCallingCode) { metadata.selectNumberingPlan(countryCallingCode); } // If `formattedPhoneNumber` is in "national" format // then `number` is defined and `countryCallingCode` isn't. else if (number && (defaultCountry || defaultCallingCode)) { metadata.selectNumberingPlan(defaultCountry, defaultCallingCode); if (defaultCountry) { country = defaultCountry; } countryCallingCode = defaultCallingCode || getCountryCallingCode(defaultCountry, metadata.metadata); } else return {}; if (!number) { return { countryCallingCode: countryCallingCode }; } var _extractNationalNumbe = extractNationalNumber(parseIncompletePhoneNumber(number), metadata), nationalNumber = _extractNationalNumbe.nationalNumber, carrierCode = _extractNationalNumbe.carrierCode; // Sometimes there are several countries // corresponding to the same country phone code // (e.g. NANPA countries all having `1` country phone code). // Therefore, to reliably determine the exact country, // national (significant) number should have been parsed first. // // When `metadata.json` is generated, all "ambiguous" country phone codes // get their countries populated with the full set of // "phone number type" regular expressions. // var exactCountry = getCountryByCallingCode(countryCallingCode, nationalNumber, metadata); if (exactCountry) { country = exactCountry; /* istanbul ignore if */ if (exactCountry === '001') ; else { metadata.country(country); } } return { country: country, countryCallingCode: countryCallingCode, nationalNumber: nationalNumber, carrierCode: carrierCode }; } function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$4(Object(source), !0).forEach(function (key) { _defineProperty$4(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } function _defineProperty$4(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function parsePhoneNumber$1(text, options, metadata) { return parse(text, _objectSpread$4(_objectSpread$4({}, options), {}, { v2: true }), metadata); } function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) { _defineProperty$3(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } function _defineProperty$3(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function parsePhoneNumber() { var _normalizeArguments = normalizeArguments(arguments), text = _normalizeArguments.text, options = _normalizeArguments.options, metadata = _normalizeArguments.metadata; return parsePhoneNumber$1(text, options, metadata); } function normalizeArguments(args) { var _Array$prototype$slic = Array.prototype.slice.call(args), _Array$prototype$slic2 = _slicedToArray(_Array$prototype$slic, 4), arg_1 = _Array$prototype$slic2[0], arg_2 = _Array$prototype$slic2[1], arg_3 = _Array$prototype$slic2[2], arg_4 = _Array$prototype$slic2[3]; var text; var options; var metadata; // If the phone number is passed as a string. // `parsePhoneNumber('88005553535', ...)`. if (typeof arg_1 === 'string') { text = arg_1; } else throw new TypeError('A text for parsing must be a string.'); // If "default country" argument is being passed then move it to `options`. // `parsePhoneNumber('88005553535', 'RU', [options], metadata)`. if (!arg_2 || typeof arg_2 === 'string') { if (arg_4) { options = arg_3; metadata = arg_4; } else { options = undefined; metadata = arg_3; } if (arg_2) { options = _objectSpread$3({ defaultCountry: arg_2 }, options); } } // `defaultCountry` is not passed. // Example: `parsePhoneNumber('+78005553535', [options], metadata)`. else if (isObject$2(arg_2)) { if (arg_3) { options = arg_2; metadata = arg_3; } else { metadata = arg_2; } } else throw new Error("Invalid second argument: ".concat(arg_2)); return { text: text, options: options, metadata: metadata }; } // Otherwise istanbul would show this as "branch not covered". /* istanbul ignore next */ var isObject$2 = function isObject(_) { return _typeof(_) === 'object'; }; function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { _defineProperty$2(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } function _defineProperty$2(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function parsePhoneNumberFromString(text, options, metadata) { // Validate `defaultCountry`. if (options && options.defaultCountry && !isSupportedCountry(options.defaultCountry, metadata)) { options = _objectSpread$2(_objectSpread$2({}, options), {}, { defaultCountry: undefined }); } // Parse phone number. try { return parsePhoneNumber$1(text, options, metadata); } catch (error) { /* istanbul ignore else */ if (error instanceof ParseError) ; else { throw error; } } } function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } function _defineProperty$1(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function isValidPhoneNumber$1() { var _normalizeArguments = normalizeArguments(arguments), text = _normalizeArguments.text, options = _normalizeArguments.options, metadata = _normalizeArguments.metadata; options = _objectSpread$1(_objectSpread$1({}, options), {}, { extract: false }); var phoneNumber = parsePhoneNumberFromString(text, options, metadata); return phoneNumber && phoneNumber.isValid() || false; } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function isPossiblePhoneNumber$1() { var _normalizeArguments = normalizeArguments(arguments), text = _normalizeArguments.text, options = _normalizeArguments.options, metadata = _normalizeArguments.metadata; options = _objectSpread(_objectSpread({}, options), {}, { extract: false }); var phoneNumber = parsePhoneNumberFromString(text, options, metadata); return phoneNumber && phoneNumber.isPossible() || false; } function parsePhoneNumberWithError() { return withMetadataArgument(parsePhoneNumber, arguments); } function isValidPhoneNumber() { return withMetadataArgument(isValidPhoneNumber$1, arguments); } function isPossiblePhoneNumber() { return withMetadataArgument(isPossiblePhoneNumber$1, arguments); } var instances$h = []; var Selector$k = { DATA_MOUNT: '[data-mount="m365-validation"]', EMAIL: '[name="email"]', SMS: '[name="sms"]', SMS_EMAIL: '[name="sms-email"]', SUBMIT: '[type="submit"]', INPUTS: 'input' }; var EventName$k = { ON_REMOVE: 'onRemove', ON_UPDATE: 'onUpdate' }; var ClassName$d = { ACTIVE: 'active', DISPLAY: { NONE: 'd-none' }, IS_INVALID: 'is-invalid' }; /** * Create link to input field with feedback at bottom of form * @param {Node} input - The form input field. */ function _createFeedbackLink(input) { if (!input.feedback.link) { var feedbackItem = document.createElement('li'); var feedbackLink = document.createElement('a'); var feedbackTextNode = document.createTextNode(input.feedback.content); feedbackLink.setAttribute('href', "#" + input.id); input.feedback.focusControls = new Util$1.FocusControls({ el: feedbackLink }); feedbackLink.append(feedbackTextNode); feedbackItem.append(feedbackLink); input.feedback.link = feedbackItem; if (input.group) { input.group.siblings.forEach(function (sibling) { sibling.feedback.link = feedbackItem; sibling.feedback.focusControls = input.feedback.focusControls; }); } } if (this && this.defaultValidation.feedbackList) { this.defaultValidation.feedbackList.append(input.feedback.link); } if (!input.feedback.focusControls) { input.feedback.focusControls = new Util$1.FocusControls({ el: input.feedback.link.querySelector('a') }); } input.feedback.linkRemoved = false; if (input.group) { input.group.siblings.forEach(function (sibling) { sibling.feedback.linkRemoved = false; }); } if (this && this.defaultValidation.feedbackListContainer) { this.defaultValidation.feedbackListContainer.classList.remove(ClassName$d.DISPLAY.NONE); } } /** * Remove link to input field with feedback at bottom of form * @param {Node} input - The form input field. */ function _removeFeedbackLink(input) { if (input.group) { input.group.siblings.forEach(function (sibling) { sibling.feedback.linkRemoved = true; sibling.feedback.focusControls.remove(); }); } else { input.feedback.linkRemoved = true; input.feedback.focusControls.remove(); } input.feedback.link.remove(); if (this.feedbackList && this.feedbackList.children.length === 0 && this.feedbackListContainer) { this.feedbackListContainer.classList.add(ClassName$d.DISPLAY.NONE); } } function inValidData(input) { input.classList.add(ClassName$d.IS_INVALID); input.setAttribute('aria-invalid', true); if (input.feedback.el && input.feedback.content) { input.feedback.el.classList.add(ClassName$d.IS_INVALID); input.feedback.el.textContent = input.feedback.content; if (input.feedback.linkRemoved) { _createFeedbackLink.bind(this)(input); } } } function validData(input) { input.classList.remove(ClassName$d.IS_INVALID); input.setAttribute('aria-invalid', false); if (input.feedback.el) { input.feedback.el.classList.remove(ClassName$d.IS_INVALID); input.feedback.el.textContent = ''; if (input.feedback.link && !input.feedback.linkRemoved) { _removeFeedbackLink.bind(this)(input); } } } /** * validate email based on regex */ function validateEmail(input, smsAndEmail) { if (input.value) { var emailPattern = /^[\w!$%&'*+=?^{}~-]+(\.[\w!$%&'*+=?^{}~-]+)*@(\w[\w-]*(\.[\w-]+)*\.(aero|arpa|biz|com|co{2}p|edu|gov|info|int|mil|museum|name|net|org|pro|travel|mobi|[a-z]{2})|((?:\d{1,3}\.){3}\d{1,3}))(:\d{1,5})?$/i; var emailPatternTest = input.value.match(emailPattern); if (emailPatternTest) { validData.call(this, input); return true; } if (smsAndEmail) { return false; } inValidData.call(this, input); this.isValid = false; return false; } return false; } /** * based on change of input value do the validation respectively */ function onChange(input) { if (this.hasSubmitted) { var nameAttr = input.getAttribute('name'); switch (nameAttr) { case 'email': { validateEmail.call(this, input); break; } case 'sms': { this.validateSms(input); break; } case 'sms-email': { var isValidEmail = validateEmail.call(this, input, true); if (!isValidEmail) { this.validateSms(input); } break; } // No default } this.hasSubmitted = false; } } /** * Class representing Validation Extension */ var ValidationExtension = /*#__PURE__*/function () { function ValidationExtension(opts) { var _this = this; this.el = opts.el; opts.preventFormSubmission = true; this.defaultValidation = new FormValidation(opts); this.hasSubmitted = false; this.isValid = false; this.emails = this.el.querySelectorAll(Selector$k.EMAIL); this.onlySms = this.el.querySelectorAll(Selector$k.SMS); this.smsEmails = this.el.querySelectorAll(Selector$k.SMS_EMAIL); this.submit = this.el.querySelector(Selector$k.SUBMIT); this.inputs = this.el.querySelectorAll(Selector$k.INPUTS); this.events = []; this.events.push({ el: this.el, type: 'submit', handler: function handler(e) { _this.onSubmit(e); } }); this.inputs.forEach(function (input) { _this.events.push({ el: input, type: 'change', handler: onChange.bind(_this, input) }); }); Util$1.addEvents(this.events); instances$h.push(this); } var _proto = ValidationExtension.prototype; _proto.onSubmit = function onSubmit(e) { var _this2 = this; e.preventDefault(); this.hasSubmitted = true; var shouldSubmit = true; if (this.emails.length > 0) { this.emails.forEach(function (email) { var isValidEMail = validateEmail.call(_this2, email); shouldSubmit = shouldSubmit && isValidEMail; }); } if (this.onlySms.length > 0) { this.onlySms.forEach(function (sms) { var isValidsms = _this2.validateSms(sms); shouldSubmit = shouldSubmit && isValidsms; }); } if (this.smsEmails.length > 0) { this.smsEmails.forEach(function (smsEmail) { var isValidEmail = validateEmail.call(_this2, smsEmail, true); var smsEmailSubmit = shouldSubmit && isValidEmail; if (!isValidEmail) { var isValidSms = _this2.validateSms(smsEmail); smsEmailSubmit = shouldSubmit && isValidSms; } shouldSubmit = shouldSubmit && smsEmailSubmit; }); } if (shouldSubmit) { this.isValid = true; this.defaultValidation.onSubmit(e); } else if (this.defaultValidation.feedbackListFocusEl) { this.defaultValidation.feedbackListFocusEl.focus(); } else if (this.inputs.length) { var firstInvalidInput = Array.from(this.inputs).find(function (input) { return input.classList.contains(ClassName$d.IS_INVALID); }); if (firstInvalidInput) { firstInvalidInput.focus(); } } } // eslint-disable-next-line complexity ; _proto.validateSms = function validateSms(input) { if (input.value) { var digitPattern = /\+|\d+/g; var digitGroup = input.value.match(digitPattern); if (digitGroup) { var digits = digitGroup.join(''); var possible = true; try { var phoneNumber = parsePhoneNumberWithError(input.value); var phoneNumberType = phoneNumber ? phoneNumber.getType() : undefined; var isValidType = phoneNumberType === 'MOBILE' || phoneNumberType === 'FIXED_LINE_OR_MOBILE'; if (isValidType && isPossiblePhoneNumber(digits) && isValidPhoneNumber(digits)) { validData.call(this, input); return true; } possible = false; } catch (_unused) { possible = false; } if (!possible) { try { var phoneNumberAsUS = parsePhoneNumberWithError(input.value, 'US'); var _isValidType = phoneNumberAsUS.getType() !== 'TOLL_FREE' && phoneNumberAsUS.getType() !== undefined; // eslint-disable-next-line max-depth if (_isValidType && isPossiblePhoneNumber(phoneNumberAsUS.number, 'US') || isPossiblePhoneNumber(digits, 'US') && isValidPhoneNumber(digits, 'US') && phoneNumberAsUS.getType() !== 'TOLL_FREE') { validData.call(this, input); return true; } } catch (_unused2) { possible = false; } } if (!possible) { try { var phoneNumberWithCountry = parsePhoneNumberWithError(digits); // eslint-disable-next-line max-depth if (phoneNumberWithCountry.country !== 'US') { var isPossible = isPossiblePhoneNumber(phoneNumberWithCountry.number, phoneNumberWithCountry.country); // eslint-disable-next-line max-depth if (isPossible) { validData.call(this, input); return true; } } inValidData.call(this, input); this.isValid = false; return false; } catch (_unused3) { inValidData.call(this, input); this.isValid = false; return false; } } } else { inValidData.call(this, input); this.isValid = false; return false; } } return false; } /** * Update instance. */; _proto.update = function update() { // Create and dispatch custom event this[EventName$k.ON_UPDATE] = new CustomEvent(EventName$k.ON_UPDATE, { bubbles: true }); this.el.dispatchEvent(this[EventName$k.ON_UPDATE]); } /** * Remove the instance */; _proto.remove = function remove() { // Remove event handlers Util$1.removeEvents(this.events); // Remove this form validation reference from array of instances var index = instances$h.indexOf(this); instances$h.splice(index, 1); this[EventName$k.ON_REMOVE] = new CustomEvent(EventName$k.ON_REMOVE, { bubbles: true }); this.el.dispatchEvent(this[EventName$k.ON_REMOVE]); } /** * Get validation Extension instances. * @returns {Object[]} An array of validation Extension instances */; ValidationExtension.getInstances = function getInstances() { return instances$h; }; return ValidationExtension; }(); var PointerType = { TOUCH: 'touch', PEN: 'pen' }; var EventName$j = { POINTER_DOWN: 'pointerdown', POINTER_UP: 'pointerup', TOUCH_START: 'touchstart', TOUCH_MOVE: 'touchmove', TOUCH_END: 'touchend' }; var ClassName$c = { POINTER_EVENT: 'pointer-event' }; function _handleSwipe() { var absDeltax = Math.abs(this.touchDeltaX); if (absDeltax <= this.swipeThreshold) { return; } var direction = absDeltax / this.touchDeltaX; // swipe left if (direction > 0) { this.negativeCallback(); } // swipe right if (direction < 0) { this.positiveCallback(); } } function _onSwipeStart(event) { if (this.pointerEvent && PointerType[event.pointerType.toUpperCase()]) { this.touchStartX = event.clientX; } else if (!this.pointerEvent) { this.touchStartX = event.touches[0].clientX; } } function _onSwipeMove(event) { // ensure swiping with one touch and not pinching if (event.touches && event.touches.length > 1) { this.touchDeltaX = 0; } else { this.touchDeltaX = event.touches[0].clientX - this.touchStartX; } } function _onSwipeEnd(event) { if (this.pointerEvent && PointerType[event.pointerType.toUpperCase()]) { this.touchDeltaX = event.clientX - this.touchStartX; } _handleSwipe.call(this); } /** * Class for handling touch events. */ var TouchUtil = /*#__PURE__*/function () { /** * Create a TouchUtil instance * @param {Object} opts - The touch events options. * @param {HTMLElement} opts.el - The swipeable DOM node. * @param {Function} opts.positiveCallback - Callback function to be called after swiping in a positive direction. * @param {Function} opts.negativeCallback - Callback function to be called after swiping in a negative direction. * @param {number} [opts.swipeThreshold=40] - The minimum swipe size * @param {string} [opts.pointerEventClassName="pointer-event"] - The classname to add for pointer events */ function TouchUtil(opts) { this.el = opts.el; this.positiveCallback = opts.positiveCallback; this.negativeCallback = opts.negativeCallback; this.swipeThreshold = opts.swipeThreshold || 40; this.pointerEventClassName = opts.pointerEventClassName || ClassName$c.POINTER_EVENT; this.touchStartX = 0; this.touchDeltaX = 0; this.touchSupported = 'ontouchstart' in document.documentElement || Boolean(navigator.maxTouchPoints > 0); this.pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent); this.onSwipeStart = _onSwipeStart.bind(this); this.onSwipeMove = _onSwipeMove.bind(this); this.onSwipeEnd = _onSwipeEnd.bind(this); } /** * Add the touch event listeners. */ var _proto = TouchUtil.prototype; _proto.addEventListeners = function addEventListeners() { if (this.touchSupported) { if (this.pointerEvent) { this.el.addEventListener(EventName$j.POINTER_DOWN, this.onSwipeStart); this.el.addEventListener(EventName$j.POINTER_UP, this.onSwipeEnd); this.el.classList.add(this.pointerEventClassName); } else { this.el.addEventListener(EventName$j.TOUCH_START, this.onSwipeStart); this.el.addEventListener(EventName$j.TOUCH_MOVE, this.onSwipeMove); this.el.addEventListener(EventName$j.TOUCH_END, this.onSwipeEnd); } } } /** * Remove the touch event listeners. */; _proto.removeEventListeners = function removeEventListeners() { if (this.touchSupported) { if (this.pointerEvent) { this.el.removeEventListener(EventName$j.POINTER_DOWN, this.onSwipeStart); this.el.removeEventListener(EventName$j.POINTER_UP, this.onSwipeEnd); this.el.classList.remove(this.pointerEventClassName); } else { this.el.removeEventListener(EventName$j.TOUCH_START, this.onSwipeStart); this.el.removeEventListener(EventName$j.TOUCH_MOVE, this.onSwipeMove); this.el.removeEventListener(EventName$j.TOUCH_END, this.onSwipeEnd); } } }; return TouchUtil; }(); var ClassName$b = { ACTIVE: 'active', SLIDE: 'slide', SLIDE_IN: 'sliding-in', SNEAK_PEAK: 'carousel-sneak-peek', PRODUCT_CARD: 'carousel-product-card', VARIABLE_HEIGHT: 'carousel-variable-height', RIGHT: 'carousel-item-right', LEFT: 'carousel-item-left', NEXT: 'carousel-item-next', PREV: 'carousel-item-prev', GET_HEIGHT: 'get-height', MARGIN_X_0: 'mx-0', PADDING_X_0: 'px-0' }; /** * @enum {string} */ var Direction$2 = { NEXT: 'next', PREV: 'prev', LEFT: 'left', RIGHT: 'right' }; var Selector$j = { ACTIVE: '.active', ACTIVE_ITEM: '.active.carousel-item', ITEM: '.carousel-item', ITEM_IMG: '.carousel-item img', INDICATORS: '.carousel-indicators', DATA_SLIDE_PREV: '[data-slide="prev"]', DATA_SLIDE_NEXT: '[data-slide="next"]', DATA_MOUNT: '[data-mount="carousel"]', DATA_LOOP: 'data-loop', DATA_STATUS: 'data-status', CAROUSEL_INNER: '.carousel-inner', ROW: '.row', SLIDE_ITEM: '.slide-item', VISIBLE_STATUS: '[aria-hidden="true"]', SR_STATUS: '[aria-live]', BACK_TO_CONTROLS: '.back-to-controls' }; var EventName$i = { ON_CHANGE: 'onChange', ON_UPDATE: 'onUpdate', ON_REMOVE: 'onRemove' }; /** * Private functions. */ function _getItemIndex(element) { var items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$j.ITEM)) : []; return items.indexOf(element); } function _getInitialSlideIndex() { var activeItem = this.el.querySelector(Selector$j.ACTIVE_ITEM); return _getItemIndex.bind(this)(activeItem); } function _getNextSlide() { var index = this.currentSlideIndex + 1; // If index exceeds slide length, return to index 0 return index > this.slides.length - 1 ? 0 : index; } function _getPrevSlide() { var index = this.currentSlideIndex - 1; // If index is less than 0, move to last slide index return index < 0 ? this.slides.length - 1 : index; } function _getSlide(num) { // Record highest number, 0 or passed-in value var max = Math.max(num, 0); // Return lowest number, either previous number or the maximum slide index return Math.min(max, this.slides.length - 1); } function _getStatusContainer() { // Check if we are maintaining a status message for this carousel // and that the element exists on the page var statusContainer = this.el.getAttribute(Selector$j.DATA_STATUS); return statusContainer ? document.getElementById(statusContainer) : null; } function _shouldLoopSlides() { // Loop by default unless data-loop is set to false return !(this.el.getAttribute(Selector$j.DATA_LOOP) === 'false'); } function _onFirstSlide() { return this.currentSlideIndex === 0; } function _onLastSlide() { return this.currentSlideIndex === this.slides.length - 1; } function _shouldGoForward() { return _onLastSlide.bind(this)() ? this.loopSlides : true; } function _shouldGoBack() { return _onFirstSlide.bind(this)() ? this.loopSlides : true; } function _prevBtnOnClick() { this.goToPrevSlide(); } function _nextBtnOnClick() { // Add events to manage focus order for accessibility Util$1.addEvents(this.nextBtnEvents); this.goToNextSlide(); } function _backToControlsBtnOnClick() { if (!this.backToControlsBtn) { return; } // focus logic: prefer "previous" button, then "next", otherwise carousel container if (!this.prevBtn.disabled) { this.prevBtn.focus(); return; } if (!this.nextBtn.disabled) { this.nextBtn.focus(); return; } this.el.setAttribute('tabindex', -1); this.el.focus(); } function _imgOnDrag(event) { // Prevent images inside slides from being dragged and interfering with touch interaction event.preventDefault(); } /** * * @param {Direction} direction - the direction to slide * @param {number} nextElementIndex - the next slide's index * @this CarouselControls */ function _slide(direction, nextElementIndex) { var _this = this; var activeElement = this.slides[this.currentSlideIndex]; var nextElement = this.slides[nextElementIndex]; var directionalClassName; var orderClassName; if (direction === Direction$2.NEXT) { directionalClassName = ClassName$b.LEFT; orderClassName = ClassName$b.NEXT; } else { directionalClassName = ClassName$b.RIGHT; orderClassName = ClassName$b.PREV; } if (nextElement && nextElement.classList.contains(ClassName$b.ACTIVE)) { this.isSliding = false; return; } if (!activeElement || !nextElement) { // Some weirdness is happening, so we bail return; } this.isSliding = true; _setActiveIndicatorElement.bind(this)(nextElementIndex); if (this.el.classList.contains(ClassName$b.SNEAK_PEAK)) { _removeNextPrevClasses.bind(this)(); } if (this.el.classList.contains(ClassName$b.SLIDE)) { if (this.el.classList.contains(ClassName$b.VARIABLE_HEIGHT)) { this.el.classList.add(ClassName$b.MARGIN_X_0, ClassName$b.PADDING_X_0); } nextElement.classList.add(orderClassName, ClassName$b.SLIDE_IN); Util$1.reflow(nextElement); activeElement.classList.add(directionalClassName); nextElement.classList.add(directionalClassName); var transitionDuration = Util$1.getTransitionDurationFromElement(activeElement); setTimeout(function () { nextElement.classList.remove(directionalClassName, orderClassName, ClassName$b.SLIDE_IN); nextElement.classList.add(ClassName$b.ACTIVE); activeElement.classList.remove(ClassName$b.ACTIVE, orderClassName, directionalClassName); if (_this.el.classList.contains(ClassName$b.VARIABLE_HEIGHT)) { _this.el.classList.remove(ClassName$b.MARGIN_X_0, ClassName$b.PADDING_X_0); } _this.isSliding = false; }, transitionDuration); } else { activeElement.classList.remove(ClassName$b.ACTIVE); nextElement.classList.add(ClassName$b.ACTIVE); this.isSliding = false; } _setSlideAttributes.bind(this)(nextElementIndex); this.didSlide = true; this.currentSlideIndex = nextElementIndex; if (this.el.classList.contains(ClassName$b.SNEAK_PEAK)) { _addNextPrevClasses.bind(this)(); } _setButtonAttributes.bind(this)(); // Update the status message if (this.statusContainer) { _setStatusMessage.bind(this)(nextElementIndex); } } function _setActiveIndicatorElement(index) { if (this.indicators) { var indicators = [].slice.call(this.indicators.querySelectorAll(Selector$j.ACTIVE)); indicators.forEach(function (indicator) { indicator.classList.remove(ClassName$b.ACTIVE); }); var nextIndicator = this.indicators.children[index]; if (nextIndicator) { nextIndicator.classList.add(ClassName$b.ACTIVE); } } } function _removeNextPrevClasses() { var nextElementIndex = _getNextSlide.bind(this)(); var prevElementIndex = _getPrevSlide.bind(this)(); this.slides[prevElementIndex].classList.remove(ClassName$b.PREV); this.slides[nextElementIndex].classList.remove(ClassName$b.NEXT); } function _addNextPrevClasses() { var nextElementIndex = _getNextSlide.bind(this)(); var prevElementIndex = _getPrevSlide.bind(this)(); this.slides[nextElementIndex].classList.add(ClassName$b.NEXT); this.slides[prevElementIndex].classList.add(ClassName$b.PREV); } function _setSlideAttributes(index) { for (var i = 0; i < this.slides.length; i++) { if (i === index) { this.slides[i].removeAttribute('aria-hidden'); if (this.el.classList.contains(ClassName$b.PRODUCT_CARD)) { // Product card carousel needs the first product card focusable, not the whole slide var slideItems = [].slice.call(this.slides[i].querySelectorAll(Selector$j.SLIDE_ITEM)); this.slides[i].removeAttribute('tabindex'); slideItems[0].firstElementChild.setAttribute('tabindex', 0); } else { this.slides[i].setAttribute('tabindex', 0); } } else { this.slides[i].removeAttribute('tabindex'); this.slides[i].setAttribute('aria-hidden', 'true'); } } } function _setActiveClass(index) { for (var i = 0; i < this.slides.length; i++) { if (i === index) { this.slides[i].classList.add(ClassName$b.ACTIVE); } else { this.slides[i].classList.remove(ClassName$b.ACTIVE); } } } function _setButtonAttributes() { if (!this.loopSlides) { if (_onFirstSlide.bind(this)()) { this.prevBtn.setAttribute('disabled', ''); this.prevBtn.setAttribute('tabindex', -1); this.nextBtn.removeAttribute('disabled'); } else if (_onLastSlide.bind(this)()) { this.prevBtn.removeAttribute('disabled'); this.prevBtn.removeAttribute('tabindex'); this.nextBtn.setAttribute('disabled', ''); } else { this.prevBtn.removeAttribute('disabled'); this.prevBtn.removeAttribute('tabindex'); this.nextBtn.removeAttribute('disabled'); } } else if (this.loopSlides) { this.prevBtn.removeAttribute('disabled'); this.prevBtn.removeAttribute('tabindex'); this.nextBtn.removeAttribute('disabled'); } } /** * @desc finds appropriate title text for a carousel slide * @param {HTMLElement} searchNode - the Node to search * @returns {String?} Appropriate text, or empty string if none is found */ function _getSlideTitleText(searchNode) { var headerSelectors = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']; var i; var headerNode = null; for (i = 0; i < headerSelectors.length; i++) { headerNode = searchNode.querySelector(headerSelectors[i]); if (headerNode) { return headerNode.textContent; } } var imageNodeList = searchNode.querySelectorAll('img'); if (imageNodeList.length === 1 && imageNodeList[0].hasAttribute('alt')) { return imageNodeList[0].getAttribute('alt'); } return ''; } function _setStatusMessage(index) { // Sets status message if a status container (visible, screen reader, or both) was registered at initialization if (this.visibleStatusContainer || this.srStatusContainer) { // for carousels that display multiple items at once, like product cards, each item is a slideItem // one or more slideItems are grouped together in a slide. var slideItems = [].slice.call(this.el.querySelectorAll(Selector$j.SLIDE_ITEM)); // all slideItems var activeSlide = this.slides[index]; // The currently shown slide var activeSlideItems = activeSlide.querySelectorAll(Selector$j.SLIDE_ITEM); // the slideItems in the currently shown slide var start = slideItems.indexOf(activeSlideItems[0]) + 1; var separator = '–'; var end = slideItems.indexOf(activeSlideItems[activeSlideItems.length - 1]) + 1; var data = { start: start, separator: separator, end: end, total: slideItems.length, slideNumber: index + 1 }; // Check if there are no slideItems and we're instead just dealing with regular slides if (!slideItems || slideItems.length < 1) { data.start = index + 1; data.end = index + 1; data.total = this.slides.length; } // Check if we're showing exactly one thing if (activeSlide && start === end) { // Make title of shown slide available to template if there's only one data.slideTitle = _getSlideTitleText(activeSlide); } if (this.srStatusContainer && this.srStatusTemplate) { this.srStatusContainer.textContent = Util$1.interpolateString(this.srStatusTemplate, data); } // If we are only showing one item, set separator and end to an empty string for the visible template only if (start === end) { data.separator = ''; data.end = ''; } if (this.visibleStatusContainer && this.visibleStatusTemplate) { this.visibleStatusContainer.textContent = Util$1.interpolateString(this.visibleStatusTemplate, data); } } } function _setSlideHeights$1() { // Enforce consistent height (flexbox messes with animation) var slideArray = [].slice.call(this.slides); var maxHeight = slideArray[0].clientHeight; slideArray.forEach(function (slide) { if (!slide.classList.contains(ClassName$b.ACTIVE)) { slide.classList.add(ClassName$b.GET_HEIGHT); } if (slide.clientHeight > maxHeight) { maxHeight = slide.clientHeight; } slide.classList.remove(ClassName$b.GET_HEIGHT); }); slideArray.forEach(function (slide) { slide.style.height = maxHeight + "px"; }); } function _removeSlideHeights$1() { var slideArray = [].slice.call(this.slides); slideArray.forEach(function (slide) { slide.style.height = ''; }); } function _recalculateSlideHeights() { var _this2 = this; _removeSlideHeights$1.bind(this)(); imagesLoaded(this.el, function () { _setSlideHeights$1.bind(_this2)(); }); } /** * @this CarouselControls */ function _handleKeyDown(event) { var keycode = event.keycode || event.which; if (keycode === Util$1.keyCodes.TAB && this.didSlide) { _focusOnSlide.bind(this)(this.currentSlideIndex); this.didSlide = false; event.preventDefault(); } _removeControlEventListeners.call(this); } function _focusOnSlide(index) { this.slides[index].focus(); } /** * @this CarouselControls */ function _removeControlEventListeners() { this.didSlide = false; Util$1.removeEvents(this.nextBtnEvents); } /** * @this CarouselControls */ function _reallocateSlideItems() { var inner = this.el.querySelector(Selector$j.CAROUSEL_INNER); var activeSlide = this.el.querySelector(Selector$j.ACTIVE_ITEM); var slideItemsContainer = activeSlide.querySelector(Selector$j.ROW); var slideItems = [].slice.call(this.el.querySelectorAll(Selector$j.SLIDE_ITEM)); var activeSlideItems = activeSlide.querySelectorAll(Selector$j.SLIDE_ITEM); var maxItems = Math.round(slideItemsContainer.clientWidth / activeSlideItems[0].clientWidth); var slidesNeeded = Math.ceil(slideItems.length / maxItems); var slidesToAdd = slidesNeeded - this.slides.length; // Reset CSS properties _removeSlideHeights$1.bind(this)(); this.prevBtn.style.display = ''; this.nextBtn.style.display = ''; if (this.statusContainer) { this.statusContainer.style.display = ''; this.statusContainer.nextElementSibling.style.display = ''; } if (slidesToAdd > 0) { // We need to add more slides for (var i = 0; i < slidesToAdd; i++) { var newNode = this.slides[this.slides.length - 1].cloneNode(true); inner.append(newNode); var newParent = newNode.querySelector(Selector$j.ROW); // Clear out duplicated slide items while (newParent.firstChild) { newParent.lastChild.remove(); } } } else if (slidesToAdd < 0) { // We need to remove some slides for (var _i = 0; _i > slidesToAdd; _i--) { inner.lastChild.remove(); } } // Reallocate the slide items among the slides var slideItemsContainers = this.el.querySelectorAll(Selector$j.ROW); var itemsToAppend; var _loop = function _loop(_i2) { var remainder = slideItems.length % maxItems; if (remainder > 0) { itemsToAppend = slideItems.splice(slideItems.length - remainder, remainder); } else { itemsToAppend = slideItems.splice(slideItems.length - maxItems, maxItems); } itemsToAppend.forEach(function (item) { slideItemsContainers[_i2].append(item); }); }; for (var _i2 = slideItemsContainers.length - 1; _i2 >= 0; _i2--) { _loop(_i2); } // Update the slides property this.slides = this.el.querySelectorAll(Selector$j.ITEM); // Reset current slide index if it's on a slide that's been removed if (this.currentSlideIndex > this.slides.length - 1) { this.currentSlideIndex = this.slides.length - 1; } // If there is only one slide, hide the controls, status msg, and cta if (this.slides.length === 1) { this.prevBtn.style.display = 'none'; this.nextBtn.style.display = 'none'; if (this.statusContainer) { this.statusContainer.style.display = 'none'; this.statusContainer.nextElementSibling.style.display = 'none'; } } _recalculateSlideHeights.bind(this)(); } function _setupDom() { // Reallocate slide items for product card carousel if (this.el.classList.contains(ClassName$b.PRODUCT_CARD)) { _reallocateSlideItems.bind(this)(); } // Carousels that aren't layered can't use flexbox to ensure consistent height // so we need an option to set slide height via JS if (this.el.classList.contains(ClassName$b.VARIABLE_HEIGHT)) { _recalculateSlideHeights.bind(this)(); } // Make sure slide attributes and indicators are up to date _setSlideAttributes.bind(this)(this.currentSlideIndex); _setActiveClass.bind(this)(this.currentSlideIndex); _setActiveIndicatorElement.bind(this)(this.currentSlideIndex); // For layered carousel layouts, add prev and next classes to slides if (this.el.classList.contains(ClassName$b.SNEAK_PEAK)) { _addNextPrevClasses.bind(this)(); } // Update button attributes, for non-looping carousels _setButtonAttributes.bind(this)(); // Update the status message if (this.statusContainer) { _setStatusMessage.bind(this)(this.currentSlideIndex); this.statusContainer.parentNode.classList.remove('d-none'); } } function _generateEvents$2() { var events = [{ el: this.prevBtn, type: 'click', handler: this.prevOnClick }, { el: this.nextBtn, type: 'click', handler: this.nextOnClick }]; if (this.itemImg) { this.itemImg.forEach(function (img) { events.push({ el: img, type: 'dragstart', handler: _imgOnDrag }); }); } // Product card and variable height carousels need an event listener for window resize if (this.el.classList.contains(ClassName$b.PRODUCT_CARD) || this.el.classList.contains(ClassName$b.VARIABLE_HEIGHT)) { events.push({ el: window, type: 'resize', handler: debounce(300, _setupDom.bind(this)), options: { passive: true } }); } // Can be null if (this.backToControlsBtn) { events.push({ el: this.backToControlsBtn, type: 'click', handler: this.backToControlsBtnOnClick }); } return events; } /** * Class representing carousel controls. */ var CarouselControls = /*#__PURE__*/function () { /** * Create a CarouselControls instance. * @param {Object} opts - The carousel controls options. * @param {HTMLElement} opts.el - The carousel DOM node. * @param {NodeListOf | HTMLElement[]} [opts.slides] - List of carousel slides. * @param {number} [opts.initialSlideIndex] - Index of the first carousel slide. * @param {boolean} [opts.loopSlides] - Whether the carousel should loop. Defaults to true. * @param {HTMLElement} [opts.statusContainer] - Element that contains the status message templates. * @param {Function} [opts.prevOnClick] - Function to override the previous button click handler. * @param {Function} [opts.nextOnClick] - Function to override the next button click handler. */ function CarouselControls(opts) { var _this3 = this; this.el = opts.el; this.slides = opts.slides || this.el.querySelectorAll(Selector$j.ITEM); this.currentSlideIndex = opts.initialSlideIndex || _getInitialSlideIndex.bind(this)(); this.loopSlides = typeof opts.loopSlides === 'boolean' ? opts.loopSlides : _shouldLoopSlides.bind(this)(); this.statusContainer = opts.statusContainer || _getStatusContainer.bind(this)(); this.prevOnClick = opts.prevOnClick || _prevBtnOnClick.bind(this); this.nextOnClick = opts.nextOnClick || _nextBtnOnClick.bind(this); this.backToControlsBtnOnClick = _backToControlsBtnOnClick.bind(this); // Internal variables this.isSliding = false; this.didSlide = false; this.touchUtil = new TouchUtil({ el: this.el, positiveCallback: this.goToNextSlide.bind(this), negativeCallback: this.goToPrevSlide.bind(this) }); // Select control nodes this.prevBtn = this.el.querySelector(Selector$j.DATA_SLIDE_PREV); this.nextBtn = this.el.querySelector(Selector$j.DATA_SLIDE_NEXT); this.backToControlsBtn = this.el.querySelector(Selector$j.BACK_TO_CONTROLS); this.indicators = this.el.querySelector(Selector$j.INDICATORS); this.itemImg = this.el.querySelectorAll(Selector$j.ITEM_IMG); if (this.statusContainer) { this.visibleStatusContainer = this.statusContainer.querySelector(Selector$j.VISIBLE_STATUS); this.srStatusContainer = this.statusContainer.querySelector(Selector$j.SR_STATUS); if (this.visibleStatusContainer) { this.visibleStatusTemplate = this.visibleStatusContainer.textContent; } if (this.srStatusContainer) { this.srStatusTemplate = this.srStatusContainer.textContent; } } // Attach event listeners this.events = _generateEvents$2.call(this); Util$1.addEvents(this.events); this.touchUtil.addEventListeners(); // Event listeners that need to be added/removed based on user interaction for accessibility // After someone activates the next button, but before the slide animation is over, the next tab keypress // needs to direct focus to the next slide this.nextBtnEvents = [{ el: this.nextBtn, type: 'keydown', handler: _handleKeyDown.bind(this) }, { el: this.nextBtn, type: 'blur', handler: _removeControlEventListeners.bind(this) }]; // Fix for product card and variable height carousels placed inside other interactive elements like tabs or modals if (this.el.classList.contains(ClassName$b.PRODUCT_CARD) || this.el.classList.contains(ClassName$b.VARIABLE_HEIGHT)) { this.observer = new IntersectionObserver(function (entries) { if (entries[0].isIntersecting) { _setupDom.call(_this3); } }); this.observer.observe(this.el); } // Setup DOM _setupDom.bind(this)(); } /** * Remove the carousel controls event handlers. */ var _proto = CarouselControls.prototype; _proto.remove = function remove() { // Remove event listeners Util$1.removeEvents(this.events); this.touchUtil.removeEventListeners(); _removeControlEventListeners.call(this); // Disconnect intersection observer if (this.el.classList.contains(ClassName$b.PRODUCT_CARD) || this.el.classList.contains(ClassName$b.VARIABLE_HEIGHT)) { this.observer.disconnect(); } // Create and dispatch custom event this[EventName$i.ON_REMOVE] = new CustomEvent(EventName$i.ON_REMOVE, { bubbles: true }); this.el.dispatchEvent(this[EventName$i.ON_REMOVE]); } /** * Update the carousel controls instance. * @param {Object} opts - The carousel controls options. * @param {NodeListOf | HTMLElement[]} [opts.slides] - List of carousel slides. * @param {number} [opts.initialSlideIndex] - Index of the first carousel slide. * @param {boolean} [opts.loopSlides] - Whether the carousel should loop. * @param {Function} [opts.prevOnClick] - Function to override the previous button click handler. * @param {Function} [opts.nextOnClick] - Function to override the next button click handler. */; _proto.update = function update(opts) { if (opts === void 0) { opts = {}; } // Remove event handlers Util$1.removeEvents(this.events); // For layered carousel layouts, remove prev and next classes from existing slides if (this.el.classList.contains(ClassName$b.SNEAK_PEAK)) { _removeNextPrevClasses.bind(this)(); } // Update opts if (opts.slides) { this.slides = opts.slides; } else { this.slides = this.el.querySelectorAll(Selector$j.ITEM); } if (opts.initialSlideIndex) { this.initialSlideIndex = opts.initialSlideIndex; } if (typeof opts.loopSlides === 'boolean') { this.loopSlides = opts.loopSlides; } if (opts.prevOnClick) { this.prevOnClick = opts.prevOnClick; } if (opts.nextOnClick) { this.nextOnClick = opts.nextOnClick; } // Rebuild events array this.events = _generateEvents$2.call(this); // Add event handlers Util$1.addEvents(this.events); // Setup DOM _setupDom.bind(this)(); // Create and dispatch custom event this[EventName$i.ON_UPDATE] = new CustomEvent(EventName$i.ON_UPDATE, { bubbles: true }); this.el.dispatchEvent(this[EventName$i.ON_UPDATE]); } /** * Go forward to the next slide. */; _proto.goToNextSlide = function goToNextSlide() { if (!this.isSliding && _shouldGoForward.bind(this)()) { // Create and dispatch custom event this[EventName$i.ON_CHANGE] = new CustomEvent(EventName$i.ON_CHANGE, { bubbles: true, cancelable: true }); this.el.dispatchEvent(this[EventName$i.ON_CHANGE]); if (this[EventName$i.ON_CHANGE].defaultPrevented) { return; } _slide.bind(this)(Direction$2.NEXT, _getNextSlide.bind(this)()); } } /** * Go back to the previous slide. */; _proto.goToPrevSlide = function goToPrevSlide() { if (!this.isSliding && _shouldGoBack.bind(this)()) { // Create and dispatch custom event this[EventName$i.ON_CHANGE] = new CustomEvent(EventName$i.ON_CHANGE, { bubbles: true, cancelable: true }); this.el.dispatchEvent(this[EventName$i.ON_CHANGE]); if (this[EventName$i.ON_CHANGE].defaultPrevented) { return; } _slide.bind(this)(Direction$2.PREV, _getPrevSlide.bind(this)()); } } /** * Go to a specific slide. * @param {number} num - 0-based index of the slide to change to. */; _proto.goToSlide = function goToSlide(num) { if (!this.isSliding) { // Create and dispatch custom event this[EventName$i.ON_CHANGE] = new CustomEvent(EventName$i.ON_CHANGE, { bubbles: true, cancelable: true }); this.el.dispatchEvent(this[EventName$i.ON_CHANGE]); if (this[EventName$i.ON_CHANGE].defaultPrevented) { return; } _slide.bind(this)(Direction$2.PREV, _getSlide.bind(this)(num)); } }; return CarouselControls; }(); var carousels = []; /** * Class representing a carousel. */ var Carousel = /*#__PURE__*/function () { /** * Create a Carousel instance * @param {Object} opts - The carousel options. * @param {HTMLElement} opts.el - The carousel DOM node. * @param {CarouselControls} [opts.controls] - The carousel controls instance. */ function Carousel(opts) { this.el = opts.el; this.controls = opts.controls || new CarouselControls(opts); carousels.push(this); } /** * Remove the carousel. */ var _proto = Carousel.prototype; _proto.remove = function remove() { // remove any references from controls this.controls.remove(); delete this.controls; // remove this carousel reference from array of instances var index = carousels.indexOf(this); carousels.splice(index, 1); } /** * Update the carousel. */; _proto.update = function update(opts) { if (opts === void 0) { opts = {}; } this.controls.update(opts); } /** * Get an array of carousel instances. * @returns {Object[]} Array of carousel instances. */; Carousel.getInstances = function getInstances() { return carousels; }; return Carousel; }(); var instances$g = []; var Selector$i = { DATA_MOUNT: '[data-mount="m365-carousel"]', CAROUSEL_ITEM: '.carousel-item', CAROUSEL_INDICATORS: '.carousel-indicators', LAZY_LOAD_IMAGE: 'img.lazyload' }; var EventName$h = { ON_REMOVE: 'onRemove', ON_UPDATE: 'onUpdate', RESIZE: 'resize' }; var ClassName$a = { PRODUCT_CARD: 'carousel-product-card', VARIABLE_HEIGHT: 'carousel-variable-height', CAROUSEL_CONTENT_CARDS: 'carousel-content-cards', CAROUSEL_HIGHLIGHT: 'carousel-highlight', CAROUSEL_HIGHLIGHT_BACKPLATE: 'carousel-highlight-backplate', IMAGE_LOADED: 'lazyloaded', ACTIVE: 'active', GET_HEIGHT: 'get-height' }; /** * Adds/removes the indicator dots based on slide items */ function _setupIndicatorDots() { this.carouselItemNumbers = this.el.querySelectorAll(Selector$i.CAROUSEL_ITEM); this.indicators = this.el.querySelector(Selector$i.CAROUSEL_INDICATORS); if (this.indicators) { var indicatorsToAdd = this.carouselItemNumbers.length - this.indicators.children.length; if (indicatorsToAdd > 0) { for (var i = 0; i < indicatorsToAdd; i++) { var list = document.createElement('li'); this.indicators.append(list); } } else if (indicatorsToAdd < 0) { for (var _i = 0; _i > indicatorsToAdd; _i--) { this.indicators.lastChild.remove(); } } } } /** * Adjust the position of the indicators based on the height of the carousel */ function _adjustIndicatorsPosition() { var maxInlineIndicatorsCount = 5; var minHeightForPadding = 64; var minHeightForBottomStyle = 56; var indicatorsExtraPadding = 8; var el = this.el; var indicators = el.querySelector(Selector$i.CAROUSEL_INDICATORS); if (indicators) { if (indicators.length < maxInlineIndicatorsCount) return; var _indicators$getBoundi = indicators.getBoundingClientRect(), height = _indicators$getBoundi.height; if (height > minHeightForPadding) { el.style.paddingBottom = height + indicatorsExtraPadding * 2 + "px"; } else { el.style.paddingBottom = ''; } if (height > minHeightForBottomStyle) { indicators.parentElement.style.bottom = -height - indicatorsExtraPadding + "px"; } else { indicators.parentElement.style.bottom = ''; } } } /** * Removes the height of the slides * @param {HTMLDivElement[]} slides - The Carousel slides */ function _removeSlideHeights(slides) { slides.forEach(function (slide) { slide.style.height = ''; }); } /** * Sets the height of the slides to the tallest slide * @param {HTMLDivElement[]} slides - The Carousel slides */ function _setSlideHeights(slides) { var maxHeight = slides[0].clientHeight; slides.forEach(function (slide) { // Enforce consistent height (flexbox messes with animation) if (!slide.classList.contains(ClassName$a.ACTIVE)) { slide.classList.add(ClassName$a.GET_HEIGHT); } if (slide.clientHeight > maxHeight) { maxHeight = slide.clientHeight; } slide.classList.remove(ClassName$a.GET_HEIGHT); }); slides.forEach(function (slide) { slide.style.height = maxHeight + "px"; }); } /** * Recalculates the height of the slides with lazy load images * @param {HTMLDivElement[]} slides - The Carousel slides */ function _recalculateSlidesWithLazyLoadImagesHeight(slides) { slides.forEach(function (slide) { var lazyLoadImages = slide.querySelectorAll(Selector$i.LAZY_LOAD_IMAGE) || []; lazyLoadImages.forEach(function (img) { var mutationObserver = new MutationObserver(function (mutations, observer) { for (var _iterator = _createForOfIteratorHelperLoose$6(mutations), _step; !(_step = _iterator()).done;) { var mutation = _step.value; if (mutation.target.classList.contains(ClassName$a.IMAGE_LOADED)) { _removeSlideHeights(slides); _setSlideHeights(slides); observer.disconnect(); } } }); mutationObserver.observe(img, { attributes: true, attributeFilter: ['class'] }); }); }); } /** * Class representing Carousel Extension */ var CarouselExtension = /*#__PURE__*/function () { function CarouselExtension(opts) { this.el = opts.el; this.el.carouselProp = new Carousel(opts); this.events = []; if (this.el.classList.contains(ClassName$a.PRODUCT_CARD) || this.el.classList.contains(ClassName$a.VARIABLE_HEIGHT)) { this.events.push({ el: window, type: EventName$h.RESIZE, handler: debounce(400, _setupIndicatorDots.bind(this)) }); } _setupIndicatorDots.call(this); if (this.el.classList.contains(ClassName$a.CAROUSEL_CONTENT_CARDS) || this.el.classList.contains(ClassName$a.CAROUSEL_HIGHLIGHT) || this.el.classList.contains(ClassName$a.CAROUSEL_HIGHLIGHT_BACKPLATE)) { this.events.push({ el: window, type: EventName$h.RESIZE, handler: throttle(400, _adjustIndicatorsPosition.bind(this)) }); _adjustIndicatorsPosition.call(this); } _recalculateSlidesWithLazyLoadImagesHeight(Array.from(this.carouselItemNumbers)); Util$1.addEvents(this.events); instances$g.push(this); } /** * Update instance. */ var _proto = CarouselExtension.prototype; _proto.update = function update() { // Create and dispatch custom event this[EventName$h.ON_UPDATE] = new CustomEvent(EventName$h.ON_UPDATE, { bubbles: true }); this.el.dispatchEvent(this[EventName$h.ON_UPDATE]); } /** * Remove the instance */; _proto.remove = function remove() { var index = instances$g.indexOf(this); instances$g.splice(index, 1); // Create and dispatch custom event this[EventName$h.ON_REMOVE] = new CustomEvent(EventName$h.ON_REMOVE, { bubbles: true }); this.el.dispatchEvent(this[EventName$h.ON_REMOVE]); } /** * Get carousel extension instances. * @returns {Object[]} An array of carousel extension instances */; CarouselExtension.getInstances = function getInstances() { return instances$g; }; return CarouselExtension; }(); var instances$f = []; var Selector$h = { DATA_MOUNT: '[data-mount="multi-collapse-controls"]', DATA_ACTION_COLLAPSE: '[data-action="collapse"]', DATA_ACTION_EXPAND: '[data-action="expand"]' }; function _getTarget(el) { var selector = Util$1.getSelectorFromElement(el); return [].slice.call(document.querySelectorAll(selector)); } function _syncDisabledStyle() { var openCount = 0; this.collapseList.forEach(function (collapse) { if (!collapse.isCollapsed) { openCount++; } }); if (openCount === this.collapseListCount) { _toggleButton(this.collapse, true); _toggleButton(this.expand, false); } else if (openCount === 0) { _toggleButton(this.expand, true); _toggleButton(this.collapse, false); } else { _toggleButton(this.expand, true); _toggleButton(this.collapse, true); } } function _toggleButton(elem, enabled) { if (enabled) { elem.setAttribute('aria-pressed', false); elem.setAttribute('aria-disabled', false); elem.classList.remove('inactive'); } else { elem.setAttribute('aria-pressed', true); elem.setAttribute('aria-disabled', true); elem.classList.add('inactive'); } } var MultiCollapseControls = /*#__PURE__*/function () { /** * Create the MultiCollapseControls * @param {Object} opts - The MultiCollapseControls options * @param {Node} opts.el - The MultiCollapseControls DOM node. * @param {MultiCollapse[]} [opts.collapses] - The list of MultiCollapse instances. * */ function MultiCollapseControls(opts) { var _this = this; this.el = opts.el; this.accordion = _getTarget(this.el)[0]; this.collapse = this.el.querySelector(Selector$h.DATA_ACTION_COLLAPSE); this.expand = this.el.querySelector(Selector$h.DATA_ACTION_EXPAND); this.collapseBtnList = this.accordion.querySelectorAll(Selector$p.DATA_MOUNT); this.collapseList = opts.collapses || []; // Auto initialization OR manual initialization without collapses option if (!this.collapseList.length) { var collapseTriggers = this.collapseBtnList; // Find MultiCollapse instances and push MultiCollapses with matching triggers into MultiCollapse array var collapseInstances = MultiCollapse.getInstances(); collapseTriggers.forEach(function (el) { _this.collapseList.push(collapseInstances.find(function (collapse) { return collapse.triggerElement === el; })); }); // If no MultiCollapses are found, do not initialize MultiCollapseControls if (!this.collapseList.length) { throw new Error('MultiCollapses must be auto-initialized or passed in as an option.'); } } this.collapseListCount = this.collapseList.length; this.openCount = 0; this.events = [{ el: this.collapse, type: 'click', handler: this.collapseAll.bind(this) }, { el: this.expand, type: 'click', handler: this.expandAll.bind(this) }]; this.collapseList.forEach(function (collapse) { collapse.el.forEach(function (item) { // Add shown/hidden handlers to each MultiCollapse _this.events.push({ el: item, type: EventName$p.SHOWN, handler: _syncDisabledStyle.bind(_this) }, { el: item, type: EventName$p.HIDDEN, handler: _syncDisabledStyle.bind(_this) }); }); }); Util$1.addEvents(this.events); _syncDisabledStyle.call(this); instances$f.push(this); } /** * Collapse all the elements */ var _proto = MultiCollapseControls.prototype; _proto.collapseAll = function collapseAll() { this.collapseList.forEach(function (element) { element.el.forEach(function (item) { element.hide(item); }); }); this.openCount = 0; _syncDisabledStyle.call(this); } /** * Update instance (added for API consistency) */; _proto.update = function update() { // Create and dispatch custom event this[EventName$p.ON_UPDATE] = new CustomEvent(EventName$p.ON_UPDATE, { bubbles: true }); this.el.dispatchEvent(this[EventName$p.ON_UPDATE]); } /** * Expand all the elements */; _proto.expandAll = function expandAll() { var _this2 = this; this.collapseListCount = 0; this.collapseList.forEach(function (element) { element.el.forEach(function (item) { element.show(item); }); _this2.collapseListCount++; }); this.openCount = this.collapseListCount; _syncDisabledStyle.call(this); } /** * Remove the event listeners and the instance */; _proto.remove = function remove() { Util$1.removeEvents(this.events); // Remove this collapse reference from array of instances var index = instances$f.indexOf(this); instances$f.splice(index, 1); // Create and dispatch custom event this[EventName$p.ON_REMOVE] = new CustomEvent(EventName$p.ON_REMOVE, { bubbles: true }); this.el.dispatchEvent(this[EventName$p.ON_REMOVE]); } /** * Get instances. * @returns {MultiCollapseControls[]} An array of instances */; MultiCollapseControls.getInstances = function getInstances() { return instances$f; }; return MultiCollapseControls; }(); /** @typedef {import('../../js/component-base').EventBinding} EventBinding */ /** @typedef {import('../../js/component-base').InitOpts} InitOpts */ /** * FeatureBase instances. * @type {FeatureBase[]} */ var instances$e = []; /** * CSS selector. * @enum {string} */ var Selector$g = { DATA_MOUNT: '[data-mount="m365-feature"]', ROW: '.row' }; /** * AssetOrder values. * @enum {string} */ var AssetOrder = { ASSET_BEFORE_COPY: 'assetBeforeCopy', COPY_BEFORE_ASSET: 'copyBeforeAsset' }; /** * Event name. * @enum {string} */ var EventName$g = { RESIZE: 'resize', ON_REMOVE: 'onRemove', ON_UPDATE: 'onUpdate' }; /** * Set the order for content and image elements * @param {Node} firstElement content element when it's not image first, image element when it's image first * @param {Node} secondElement image element when it's not image first, content element when it's image first */ function _swapEle(firstElement, secondElement) { if (secondElement.parentNode.children[0] === firstElement) { secondElement.parentNode.insertBefore(secondElement, firstElement); } } /** * Set elements order by the configuration */ function _setItemsOrder() { // when it's image first and it's COPY_BEFORE_ASSET if (this.feature.dataset.imageFirst === 'true' && this.feature.dataset.mobileOrder === AssetOrder.COPY_BEFORE_ASSET) { if (window.innerWidth < this.assetOrderBreakpoint) { // put the content element before the asset element for mobile viewport _swapEle(this.imageEle, this.contentEle); } else { // set the order back _swapEle(this.contentEle, this.imageEle); } } // when it's not image first and it's ASSET_BEFORE_COPY else if (this.feature.dataset.imageFirst !== 'true' && this.feature.dataset.mobileOrder === AssetOrder.ASSET_BEFORE_COPY) { if (window.innerWidth < this.assetOrderBreakpoint) { // put the asset element before the content element for mobile viewport _swapEle(this.contentEle, this.imageEle); } else { // set the order back _swapEle(this.imageEle, this.contentEle); } } } var FeatureBase = /*#__PURE__*/function (_ComponentBase) { _inheritsLoose(FeatureBase, _ComponentBase); function FeatureBase(opts) { var _this; _this = _ComponentBase.call(this, opts) || this; _this.feature = opts.el; if (_this.feature.dataset.imageFirst === 'true') { _this.contentEle = _this.feature.querySelector(Selector$g.ROW).children[1]; _this.imageEle = _this.feature.querySelector(Selector$g.ROW).children[0]; } else { _this.contentEle = _this.feature.querySelector(Selector$g.ROW).children[0]; _this.imageEle = _this.feature.querySelector(Selector$g.ROW).children[1]; } // Set the viewport breakpoint for the mobile asset order, defaulting to MD. switch (_this.feature.dataset.viewportTarget) { case 'XS': _this.assetOrderBreakpoint = ViewPort.XS; break; case 'SM': _this.assetOrderBreakpoint = ViewPort.SM; break; case 'MD': _this.assetOrderBreakpoint = ViewPort.MD; break; case 'LG': _this.assetOrderBreakpoint = ViewPort.LG; break; case 'XL': _this.assetOrderBreakpoint = ViewPort.XL; break; default: _this.assetOrderBreakpoint = ViewPort.MD; break; } // set the elements order after page loaded _setItemsOrder.call(_assertThisInitialized$1(_this)); _this.events = []; // set the elements order when resizing the page _this.events.push({ el: window, type: EventName$g.RESIZE, handler: debounce(20, _setItemsOrder.bind(_assertThisInitialized$1(_this))) }); Util$1.addEvents(_this.events); instances$e.push(_assertThisInitialized$1(_this)); return _this; } /** * Update instance. */ var _proto = FeatureBase.prototype; _proto.update = function update(opts) { if (opts === void 0) { opts = {}; } _ComponentBase.prototype.update.call(this, opts); // Create and dispatch custom event this[EventName$g.ON_UPDATE] = new CustomEvent(EventName$g.ON_UPDATE, { bubbles: true }); this.feature.dispatchEvent(this[EventName$g.ON_UPDATE]); } /** * Remove the instance */; _proto.remove = function remove() { _ComponentBase.prototype.remove.call(this); var index = instances$e.indexOf(this); instances$e.splice(index, 1); // Create and dispatch custom event this[EventName$g.ON_REMOVE] = new CustomEvent(EventName$g.ON_REMOVE, { bubbles: true }); this.feature.dispatchEvent(this[EventName$g.ON_REMOVE]); } /** * Get feature-base instances. * @returns {Object[]} An array of feature-base instances */; FeatureBase.getInstances = function getInstances() { return instances$e; }; return FeatureBase; }(ComponentBase); var $$3 = _export; var call = functionCall; var uncurryThis$3 = functionUncurryThis; var requireObjectCoercible = requireObjectCoercible$d; var isCallable = isCallable$u; var isNullOrUndefined$1 = isNullOrUndefined$b; var isRegExp = isRegexp; var toString = toString$j; var getMethod = getMethod$7; var getRegExpFlags = regexpGetFlags; var getSubstitution = getSubstitution$2; var wellKnownSymbol = wellKnownSymbol$t; var REPLACE = wellKnownSymbol('replace'); var $TypeError = TypeError; var indexOf = uncurryThis$3(''.indexOf); uncurryThis$3(''.replace); var stringSlice$1 = uncurryThis$3(''.slice); var max = Math.max; var stringIndexOf = function (string, searchValue, fromIndex) { if (fromIndex > string.length) return -1; if (searchValue === '') return fromIndex; return indexOf(string, searchValue, fromIndex); }; // `String.prototype.replaceAll` method // https://tc39.es/ecma262/#sec-string.prototype.replaceall $$3({ target: 'String', proto: true }, { replaceAll: function replaceAll(searchValue, replaceValue) { var O = requireObjectCoercible(this); var IS_REG_EXP, flags, replacer, string, searchString, functionalReplace, searchLength, advanceBy, replacement; var position = 0; var endOfLastMatch = 0; var result = ''; if (!isNullOrUndefined$1(searchValue)) { IS_REG_EXP = isRegExp(searchValue); if (IS_REG_EXP) { flags = toString(requireObjectCoercible(getRegExpFlags(searchValue))); if (!~indexOf(flags, 'g')) throw $TypeError('`.replaceAll` does not allow non-global regexes'); } replacer = getMethod(searchValue, REPLACE); if (replacer) { return call(replacer, searchValue, O, replaceValue); } } string = toString(O); searchString = toString(searchValue); functionalReplace = isCallable(replaceValue); if (!functionalReplace) replaceValue = toString(replaceValue); searchLength = searchString.length; advanceBy = max(1, searchLength); position = stringIndexOf(string, searchString, 0); while (position !== -1) { replacement = functionalReplace ? toString(replaceValue(searchString, position, string)) : getSubstitution(searchString, string, position, [], undefined, replaceValue); result += stringSlice$1(string, endOfLastMatch, position) + replacement; endOfLastMatch = position + searchLength; position = stringIndexOf(string, searchString, position + advanceBy); } if (endOfLastMatch < string.length) { result += stringSlice$1(string, endOfLastMatch); } return result; } }); var $$2 = _export; var $findIndex = arrayIteration.findIndex; var addToUnscopables = addToUnscopables$4; var FIND_INDEX = 'findIndex'; var SKIPS_HOLES = true; // Shouldn't skip holes if (FIND_INDEX in []) Array(1)[FIND_INDEX](function () { SKIPS_HOLES = false; }); // `Array.prototype.findIndex` method // https://tc39.es/ecma262/#sec-array.prototype.findindex $$2({ target: 'Array', proto: true, forced: SKIPS_HOLES }, { findIndex: function findIndex(callbackfn /* , that = undefined */) { return $findIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables addToUnscopables(FIND_INDEX); /** @typedef {import('../../js/component-base').EventBinding} EventBinding */ /** @typedef {import('../../js/component-base').InitOpts} InitOpts */ /** * Progress component instances. * @type {ProgressExtension[]} */ var instances$d = []; /** * Event name. * @enum {string} */ var EventName$f = { CLICK: 'click', ON_PROGRESS_CHANGE: 'onProgressChange' }; /** * CSS selector. * @enum {string} */ var Selector$f = { BAR: '.progress-bar', DATA_MOUNT: '[data-mount="progress-extension"]' }; /** * Handles click events on the example target. * * @param {ClickEvent} event click event. */ function _handleExampleTargetClick(event) { event.target.dispatchEvent(new CustomEvent(EventName$f.ON_PROGRESS_CHANGE, { detail: Math.round(Math.random() * 100) })); } /** * Handles onProgressChange events from the target. * * @param {HTMLElement} el Progress element. * @param {HTMLElement} bar Bar element. * @param {CustomEvent} event onProgressChange event. */ function _handleProgressChange(el, bar, event) { _setProgress(el, bar, event.detail); } /** * Sets the visible progress displayed by the bar. * * @param {HTMLElement} el Progress element. * @param {HTMLElement} bar Bar element. * @param {number} percent Progress percent. */ function _setProgress(el, bar, percent) { el.ariaValueNow = percent; bar.style = "width: " + percent + "%"; } /** Progress component extension. */ var ProgressExtension = /*#__PURE__*/function (_ComponentBase) { _inheritsLoose(ProgressExtension, _ComponentBase); /** * Progress bar element. * @type {HTMLElement} */ /** * Initializes a new instance of the Progress component extension. * @param {InitOpts} opts Initialization options. */ function ProgressExtension(opts) { var _this; var bar = opts.el.querySelector(Selector$f.BAR); var events; if (opts.el.dataset.target) { var targetElem = document.getElementById(opts.el.dataset.target); if (targetElem) { events = [{ el: targetElem, handler: _handleProgressChange.bind(null, opts.el, bar), type: EventName$f.ON_PROGRESS_CHANGE }]; if (targetElem.dataset.example === '') { events.push({ el: targetElem, handler: _handleExampleTargetClick, type: EventName$f.CLICK }); } } } _this = _ComponentBase.call(this, opts, events) || this; _this.bar = void 0; _this.bar = bar; return _this; } /** * Sets the visible progress displayed by the bar. * * @param {number} percent */ var _proto = ProgressExtension.prototype; _proto.setProgress = function setProgress(percent) { _setProgress(this.el, this.bar, percent); } /** * Gets Progress component extension instances. * @returns {ProgressExtension[]} */; ProgressExtension.getInstances = function getInstances() { return instances$d; }; return ProgressExtension; }(ComponentBase); /** @typedef {import('../../js/component-base').EventBinding} EventBinding */ /** @typedef {import('../../js/component-base').InitOpts} InitOpts */ /** * Custom delete polyfill for URLSearchParams.delete to delete key/value pair (currently not supported by all major browsers) * @param {string} paramKey * @param {string} paramValue * @returns {void} * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams/delete} */ URLSearchParams.prototype.deleteKeyValue = function (paramKey, paramValue) { var _this = this; var values = this.getAll(paramKey); var filteredValues = values.filter(function (value) { return value !== paramValue; }); this["delete"](paramKey); if (filteredValues.length) { filteredValues.forEach(function (value) { _this.append(paramKey, value); }); } }; /** * Wizard component instances. * @type {SolutionWizard[]} */ var instances$c = []; /** * CSS class. * @enum {string} */ var ClassName$9 = { DISPLAY_NONE: 'd-none' }; /** * Event name. * @enum {string} */ var EVENTNAME = { CHANGE: 'change', CLICK: 'click', KEYDOWN: 'keydown', ON_WIZARD_TAB_CHANGE: 'onWizardTabChange', ON_REMOVE: 'onRemove', RESULTS_SHOWN: 'resultsShown' }; /** * CSS selectors. * @enum {string} */ var SELECTORS = { WIZARD_CONTAINER: '.oc-solution-wizard-container', WIZARD_CONTAINER_TABPANEL: '.oc-solution-wizard-container[role="tabpanel"]', SOLUTION_WIZARD_M365_TAB: '.solution-wizard-tab-content [data-mount="m365-tab"]', solutionWizardTabGroupSelector: '.solution-wizard-tab-content .tab-group', solutionWizardWrapperSelector: '.oc-solution-wizard-wrapper', solutionWizardQuestionnaireSelector: '.oc-solution-wizard-questionnaire', solutionWizardResultsSelector: '.oc-solution-wizard-results', solutionWizardQuestionSelector: '.oc-solution-wizard-question', solutionWizardAnswerSelector: '.oc-solution-wizard-answer', solutionWizardAnswerInputSelector: '.oc-solution-wizard-answer input', prevButtonSelector: '.oc-solution-wizard-prev-btn', nextButtonSelector: '.oc-solution-wizard-next-btn', nextButtonWrapperSelector: '.oc-solution-wizard-next-btn-wrapper', startOverButtonSelector: '.oc-solution-wizard-start-over-btn', startOverButtonWrapperSelector: '.oc-solution-wizard-start-over-btn-wrapper', nextSectionButtonSelector: '.oc-solution-wizard-next-section-btn', shareLinkSelector: '.oc-solution-wizard-share-link', resultsRecommendationSelector: '.oc-solution-wizard-results-recommendation', recommendationIntroSelector: '.oc-solution-wizard-recommendation-intro', recommendationInsertPointSelector: '#oc-solution-wizard-recommendation-insert-point', progressBarSelector: '[data-mount="progress-extension"]', progressQuestionNumberSelector: '.progress-question-number', introPageSelector: '.oc-solution-wizard-intro-page', introStartButtonSelector: '.oc-solution-wizard-intro-page .btn' }; /** * SW Constants. * @enum {string} */ var SOLUTION_WIZARD_CONSTANTS = { expirationIncrement: 864000000, nonlinearProgressIncrement: 10, solutionWizardResult: 'solutionwizardresult', windowsHMCWizardId: 'windows-help-me-choose' }; /** * Handles click events on the example target. * * @param {ClickEvent} event click event. */ function _handleWizardTabChange(event) { if (event.type === EVENTNAME.CLICK || event.type === EVENTNAME.KEYDOWN && (event.key === Util$1.keys.SPACE || event.key === Util$1.keys.ENTER)) { event.currentTarget.dispatchEvent(new CustomEvent(EVENTNAME.ON_WIZARD_TAB_CHANGE, { detail: event.currentTarget.id })); } } /** * Handle click event on links that point to tabs containing Solution Wizard. Trigger click event on the related tab * so wizard content is displayed without spacing issues. * * @param {ClickEvent} event click event. */ function _handleLinkToTabClick(event) { var _event$currentTarget$, _event$currentTarget$2; event.preventDefault(); var relatedTabPanelId = (_event$currentTarget$ = event.currentTarget.dataset.target) == null ? void 0 : _event$currentTarget$.replace('#', ''); var relatedTab = (_event$currentTarget$2 = event.currentTarget.solutionWizardTabGroup) == null ? void 0 : _event$currentTarget$2.querySelector("[aria-controls=\"" + relatedTabPanelId + "\"]"); relatedTab == null ? void 0 : relatedTab.click(); } /** SolutionWizard component script. */ var SolutionWizard = /*#__PURE__*/function (_ComponentBase) { _inheritsLoose(SolutionWizard, _ComponentBase); /** * SW Active Wizard this.ELEMENTS. * @enum {string} */ /** * SW Active Wizard State. * @enum {string} */ /** * Solution Wizard query parameter keys */ /** * Initializes a new instance of the solution wizard component extension. * @param {InitOpts} opts Initialization options. */ function SolutionWizard(opts) { var _this2; // inititalize m365 tab extension var tabs = document.querySelectorAll(SELECTORS.SOLUTION_WIZARD_M365_TAB); var panels = document.querySelectorAll(SELECTORS.WIZARD_CONTAINER_TABPANEL); var solutionWizardTabGroup = document.querySelector(SELECTORS.solutionWizardTabGroupSelector); var linksToTabs = []; var matchingTab; var matchedWrapper; // Register tab change events before calling super, if tabs matching this wizard exist. var events = []; if (tabs != null && tabs.length) { for (var _iterator = _createForOfIteratorHelperLoose$6(tabs.entries()), _step; !(_step = _iterator()).done;) { var _step$value = _step.value, index = _step$value[0], tab = _step$value[1]; var targetId = tab == null ? void 0 : tab.id.slice(0, -4); matchedWrapper = opts.el.querySelector("[data-wizard-id=\"" + targetId + "\"]"); // if tab matches a wizard or first home tab, register tab change events if (matchedWrapper || index === 0) { matchingTab = tab; events.push({ el: tab, handler: _handleWizardTabChange, type: EVENTNAME.CLICK }, { el: tab, handler: _handleWizardTabChange, type: EVENTNAME.KEYDOWN }); } var tabTarget = "#" + tab.getAttribute('aria-controls'); var linksToCurTab = document.querySelectorAll("[data-target=\"" + tabTarget + "\"]:not(" + SELECTORS.nextSectionButtonSelector + ")"); linksToTabs.push.apply(linksToTabs, linksToCurTab); } linksToTabs.forEach(function (link) { link.solutionWizardTabGroup = solutionWizardTabGroup; events.push({ el: link, handler: _handleLinkToTabClick, type: EVENTNAME.CLICK }); }); } _this2 = _ComponentBase.call(this, opts, events) || this; // Add event listener methods after calling super _this2.ELEMENTS = { solutionWizardContainer: undefined, solutionWizardWrapper: undefined, questionnaire: undefined, resultsSection: undefined, allResults: undefined, activeResult: undefined, allQuestions: undefined, currentQuestion: undefined, prevButton: undefined, nextButton: undefined, startOverButton: undefined, nextSectionButton: undefined, shareLink: undefined, allAnswerInputs: undefined, introPage: undefined, introStartButton: undefined, resultsRecommendation: undefined }; _this2.states = { wizardId: '', score: 0, history: [], currentQuestionIndex: 0, isShowingIntroPage: false, isShowingResults: false, isAccumulatedScore: false, isAccumulatedRecommendation: false, isRecommendationLayout2Up: false, isLinearQuestionFlow: false, enableRevisitRedirect: false, nonlinearProgressIncrement: SOLUTION_WIZARD_CONSTANTS.nonlinearProgressIncrement, resultsConfig: [], areEventListenersAdded: false }; _this2.queryParamKeys = { solutionWizardResult: 'solutionwizardresult' }; if (matchingTab && panels != null && panels.length) { matchingTab.addEventListener(EVENTNAME.ON_WIZARD_TAB_CHANGE, function (event) { return _this2.handleWizardTabChange(opts.el, tabs, panels, event); }); } _this2.tabs = tabs; _this2.panels = panels; _this2.events = events; // Initialize the solution wizard component if (document.readyState === 'interactive') { _this2.ELEMENTS.solutionWizardContainer = opts.el; // Re-use wrapper element found from tab matching, or find first instance in the case of tabless variant if (typeof matchedWrapper === 'undefined' || !matchedWrapper) { _this2.ELEMENTS.solutionWizardWrapper = _this2.ELEMENTS.solutionWizardContainer.querySelector(SELECTORS.solutionWizardWrapperSelector); } else { _this2.ELEMENTS.solutionWizardWrapper = matchedWrapper; } _this2.initWrapper(_this2.ELEMENTS.solutionWizardWrapper); } instances$c.push(_assertThisInitialized$1(_this2)); return _this2; } /** * Handles onWizardTabChange events from the target. * * @param {HTMLElement} el solution wizard element. * @param {HTMLElement[]} tabs Bar element. * @param {HTMLElement[]} panels Panel element. * @param {CustomEvent} event onWizardChangeEvent event. */ var _proto = SolutionWizard.prototype; _proto.handleWizardTabChange = function handleWizardTabChange(el, tabs, panels, event) { var _event$detail; // Handle resetting state to this tab's wizard var targetId = (_event$detail = event.detail) == null ? void 0 : _event$detail.slice(0, -4); var solutionWizardWrappers = this.ELEMENTS.solutionWizardContainer.querySelectorAll(SELECTORS.solutionWizardWrapperSelector); if (solutionWizardWrappers != null && solutionWizardWrappers.length) { var solutionWizardWrapper = Array.from(solutionWizardWrappers).find(function (wrapper) { return wrapper.dataset.wizardId === targetId; }); this.initWrapper(solutionWizardWrapper); } // show/hide Tab panels this._setPanels(panels, event.detail); } /** * Sets the visible panels displayed. shared utility for tab extension and wizard navigation. * * @param {HTMLElement} el wizard element. * @param {HTMLElement} tab[] tab this.ELEMENTS. * @param {HTMLElement} panel[] panel this.ELEMENTS. */; _proto._setPanels = function _setPanels(panels, targetId, isTablessVariant) { // Tabs variants remove '-tab' suffix from targetId var _targetId = isTablessVariant ? targetId : targetId.slice(0, -4); // hide all panels for (var _iterator2 = _createForOfIteratorHelperLoose$6(panels), _step2; !(_step2 = _iterator2()).done;) { var panel = _step2.value; var _panel = document.getElementById(panel.id); _panel.setAttribute('hidden', true); _panel.classList.remove('active'); _panel.classList.remove('show'); // add select panels if (panel.id === _targetId) { _panel.removeAttribute('hidden'); _panel.classList.add('active'); _panel.classList.add('show'); } } }; _proto.initWrapper = function initWrapper(wrapperElement) { var _this$ELEMENTS$startO, _this3 = this, _this$ELEMENTS$nextBu, _this$ELEMENTS$prevBu; if (!wrapperElement) { return; } // Set elements values for wrapper. this.ELEMENTS.solutionWizardWrapper = wrapperElement; this.ELEMENTS.questionnaire = wrapperElement.querySelector(SELECTORS.solutionWizardQuestionnaireSelector); this.ELEMENTS.resultsSection = wrapperElement.querySelector(SELECTORS.solutionWizardResultsSelector); this.ELEMENTS.resultsRecommendation = wrapperElement.querySelector(SELECTORS.resultsRecommendationSelector); this.ELEMENTS.allQuestions = wrapperElement.querySelectorAll(SELECTORS.solutionWizardQuestionSelector); this.ELEMENTS.introPage = wrapperElement.querySelector(SELECTORS.introPageSelector); this.ELEMENTS.introStartButton = wrapperElement.querySelector(SELECTORS.introStartButtonSelector); this.ELEMENTS.prevButtons = wrapperElement.querySelectorAll(SELECTORS.prevButtonSelector); this.ELEMENTS.nextButtons = wrapperElement.querySelectorAll(SELECTORS.nextButtonSelector); this.ELEMENTS.startOverButtons = wrapperElement.querySelectorAll(SELECTORS.startOverButtonSelector); this.ELEMENTS.nextSectionButton = wrapperElement.querySelector(SELECTORS.nextSectionButtonSelector); this.ELEMENTS.shareLink = wrapperElement.querySelector(SELECTORS.shareLinkSelector); this.ELEMENTS.allAnswerInputs = wrapperElement.querySelectorAll(SELECTORS.solutionWizardAnswerInputSelector); this.states.currentQuestionIndex = 0; this.ELEMENTS.currentQuestion = this.ELEMENTS.allQuestions[0]; if (this.ELEMENTS.solutionWizardWrapper) { // Set states and results values for wrapper. this.states.wizardId = this.ELEMENTS.solutionWizardWrapper.dataset.wizardId; this.states.isAccumulatedScore = this.ELEMENTS.solutionWizardWrapper.dataset.isAccumulatedScore === 'true'; this.states.isAccumulatedRecommendation = this.ELEMENTS.solutionWizardWrapper.dataset.isAccumulatedRecommendation === 'true'; this.states.isRecommendationLayout2Up = this.ELEMENTS.solutionWizardWrapper.dataset.isRecommendationLayoutTwoUp === 'true'; this.states.isLinearQuestionFlow = this.ELEMENTS.solutionWizardWrapper.dataset.isLinearQuestionFlow === 'true'; this.states.enableRevisitRedirect = this.ELEMENTS.solutionWizardWrapper.dataset.enableRevisitRedirect === 'true'; this.states.nonlinearProgressIncrement = this.ELEMENTS.solutionWizardWrapper.dataset.nonlinearProgressIncrement || SOLUTION_WIZARD_CONSTANTS.nonlinearProgressIncrement; var encodedResultsJson = this.ELEMENTS.solutionWizardWrapper.dataset.resultsJson; var resultsJson = window.decodeURIComponent(encodedResultsJson.replace(/\+/g, '%20')); this.states.resultsConfig = JSON.parse(resultsJson); } // Set home button hash to wizard id for navigation on each startOverButtons (_this$ELEMENTS$startO = this.ELEMENTS.startOverButtons) == null ? void 0 : _this$ELEMENTS$startO.forEach(function (startOverButton) { if (startOverButton.href) { startOverButton.href = "#" + _this3.states.wizardId; } }); // Set next button hash to wizard id for navigation on each nextButtons (_this$ELEMENTS$nextBu = this.ELEMENTS.nextButtons) == null ? void 0 : _this$ELEMENTS$nextBu.forEach(function (nextButton) { if (nextButton.href) { nextButton.href = "#" + _this3.states.wizardId; } }); // Set prev button hash to wizard id for navigation on each prevButtons (_this$ELEMENTS$prevBu = this.ELEMENTS.prevButtons) == null ? void 0 : _this$ELEMENTS$prevBu.forEach(function (prevButton) { if (prevButton.href) { prevButton.href = "#" + _this3.states.wizardId; } }); if (this.tabs.length && this.panels.length && this.ELEMENTS.nextSectionButton) { this.hideLastTabNextSectionButton(); } if (this.ELEMENTS.introPage) { this.setHiddenElem(true, this.ELEMENTS.introPage); } // Binding events if (!this.states.areEventListenersAdded) { this.addSolutionWizardEventListeners(); } if (this.ELEMENTS.currentQuestion) { this.setDisabledElem(false, this.ELEMENTS.currentQuestion.querySelector(SELECTORS.nextButtonSelector)); } // Initialize settings this.loadState(); } /** * Hides the Next section button in the last tabpanel, as there is no next tab to go to. */; _proto.hideLastTabNextSectionButton = function hideLastTabNextSectionButton() { var lastTabpanel = this.panels[this.panels.length - 1]; var nextSectionButton = lastTabpanel.querySelector(SELECTORS.nextSectionButtonSelector); if (nextSectionButton) { nextSectionButton.classList.add(ClassName$9.DISPLAY_NONE); } } /** * Adds event listeners for solution wizard. */; _proto.addSolutionWizardEventListeners = function addSolutionWizardEventListeners() { var _this$ELEMENTS$prevBu2, _this4 = this, _this$ELEMENTS$nextBu2, _this$ELEMENTS$startO2, _this$ELEMENTS$allAns, _this$ELEMENTS$nextSe, _this$ELEMENTS$introS; (_this$ELEMENTS$prevBu2 = this.ELEMENTS.prevButtons) == null ? void 0 : _this$ELEMENTS$prevBu2.forEach(function (prevButton) { prevButton.addEventListener(EVENTNAME.CLICK, function (event) { return _this4.handlePrevButtonClick(event); }); if (prevButton instanceof HTMLAnchorElement) { _this4.addSpacebarEventListener(prevButton, function (event) { return _this4.handlePrevButtonClick(event); }); } }); (_this$ELEMENTS$nextBu2 = this.ELEMENTS.nextButtons) == null ? void 0 : _this$ELEMENTS$nextBu2.forEach(function (nextButton) { nextButton.addEventListener(EVENTNAME.CLICK, function (event) { return _this4.handleNextButtonClick(event); }); if (nextButton instanceof HTMLAnchorElement) { _this4.addSpacebarEventListener(nextButton, function (event) { return _this4.handleNextButtonClick(event); }); } }); (_this$ELEMENTS$startO2 = this.ELEMENTS.startOverButtons) == null ? void 0 : _this$ELEMENTS$startO2.forEach(function (startOverButton) { startOverButton.addEventListener(EVENTNAME.CLICK, function (event) { return _this4.handleStartOverButtonClick(event); }); if (startOverButton instanceof HTMLAnchorElement) { _this4.addSpacebarEventListener(startOverButton, function (event) { return _this4.handleStartOverButtonClick(event); }); } }); (_this$ELEMENTS$allAns = this.ELEMENTS.allAnswerInputs) == null ? void 0 : _this$ELEMENTS$allAns.forEach(function (inputElem) { inputElem.addEventListener(EVENTNAME.CHANGE, function (event) { return _this4.handleAnswerInputChange(event); }); }); (_this$ELEMENTS$nextSe = this.ELEMENTS.nextSectionButton) == null ? void 0 : _this$ELEMENTS$nextSe.addEventListener(EVENTNAME.CLICK, function (event) { return _this4.handleNextSectionButtonClick(event); }); if (this.ELEMENTS.nextSectionButton instanceof HTMLAnchorElement) { this.addSpacebarEventListener(this.ELEMENTS.nextSectionButton, function (event) { return _this4.handleNextSectionButtonClick(event); }); } (_this$ELEMENTS$introS = this.ELEMENTS.introStartButton) == null ? void 0 : _this$ELEMENTS$introS.addEventListener(EVENTNAME.CLICK, function (event) { return _this4.handleIntroStartButtonClick(event); }); if (this.ELEMENTS.introStartButton instanceof HTMLAnchorElement) { this.addSpacebarEventListener(this.ELEMENTS.introStartButton, function (event) { return _this4.handleIntroStartButtonClick(event); }); } this.states.areEventListenersAdded = true; }; _proto.addSpacebarEventListener = function addSpacebarEventListener(elem, callback) { elem.addEventListener(EVENTNAME.KEYDOWN, function (event) { if (event.key === Util$1.keys.SPACE) { callback(event); } }); } /** * Sets the href of the Share link to a mailto link with the subject and body from the data-attributes, for sharing the results via email. * @param {string} resultsUrl */; _proto.setShareLinkHref = function setShareLinkHref(resultsUrl) { if (!this.ELEMENTS.shareLink) { return; } var _this$ELEMENTS$shareL = this.ELEMENTS.shareLink.dataset, emailSubject = _this$ELEMENTS$shareL.emailSubject, emailBody = _this$ELEMENTS$shareL.emailBody; if (!(emailSubject && emailBody)) { return; } var emailSubjectEncoded = encodeURIComponent(emailSubject); var emailBodyEncoded = encodeURIComponent(emailBody.replaceAll('\n', '\n\n').replace('[[results-url]]', resultsUrl)); this.ELEMENTS.shareLink.href = "mailto:?subject=" + emailSubjectEncoded + "&body=" + emailBodyEncoded; }; _proto.initTabs = function initTabs() { var _this$tabs; if ((_this$tabs = this.tabs) != null && _this$tabs.length) { var _this$tabs$, _window$location$hash; var currentTabId = (_this$tabs$ = this.tabs[0]) == null ? void 0 : _this$tabs$.id; if ((_window$location$hash = window.location.hash) != null && _window$location$hash.length) { var hashTabId = window.location.hash.slice(1) + "-tab"; if (Array.from(this.tabs).some(function (tab) { return tab.id === hashTabId; })) { currentTabId = hashTabId; } } this._setPanels(this.panels, currentTabId); } else { var _this$panels$; // set Panels for no tab variant this._setPanels(this.panels, (_this$panels$ = this.panels[0]) == null ? void 0 : _this$panels$.id, true); } }; _proto.loadState = function loadState() { var savedState = null; var savedStateString = null; this.initTabs(); this.loadResults(); if (this.states.wizardId) { var storageKey = this.states.wizardId; if (window.localStorage) { var storageState = window.localStorage.getItem(storageKey); if (storageState) { savedStateString = storageState; } } } if (savedStateString) { var decodedState = window.atob(savedStateString); var stateToValidate = JSON.parse(decodedState); if (stateToValidate.expires && stateToValidate.expires > Date.now()) { savedState = stateToValidate; } } if (savedState === null) { if (!this.states.isShowingResults) { this.traverseHistory(-1); } } else { var lastStepIndex = savedState.history.length - 1; this.states.history = savedState.history; if (!this.states.isShowingResults) { this.traverseHistory(lastStepIndex); } } } /** * Load results data from local storage or query param * and show/hide results and questionnaire */; _proto.loadResults = function loadResults() { // TO DO: Remove feature flag once query param feature passes tests in PROD if (typeof window.isFeatureEnabled === 'function' && window.isFeatureEnabled('ocSolutionWizardQuery')) { // Process results from query param var matchingResult = this.findMatchingResultQuery(); if (matchingResult && matchingResult.split(':').length > 1) { var resultValue = window.atob(matchingResult.split(':')[1]); this.setShowingResults(true, resultValue); return; } } // Process results from local storage var savedResults = this.getResultsFromLocalStorage(); if (!this.isNullOrWhiteSpace(savedResults) && this.states.enableRevisitRedirect) { this.setShowingResults(true, savedResults); } else { this.setShowingResults(false); } } /** * Get results from local storage and decode it * @returns {string | null} savedResults */; _proto.getResultsFromLocalStorage = function getResultsFromLocalStorage() { var savedResults = null; if (this.states.wizardId) { var storageKey = SOLUTION_WIZARD_CONSTANTS.solutionWizardResult + "-" + this.states.wizardId; if (window.localStorage) { var storageState = window.localStorage.getItem(storageKey); if (storageState) { savedResults = window.atob(storageState); } } } return savedResults; } /** * Set isShowingResults state and show/hide results and questionnaire * @param {boolean} isShowingResults * @param {string | undefined} results */; _proto.setShowingResults = function setShowingResults(isShowingResults, results) { if (isShowingResults) { this.processResultsString(results); // Active result found and shown if (this.ELEMENTS.activeResult) { this.states.isShowingResults = true; this.setHiddenElem(true, this.ELEMENTS.questionnaire); this.setHiddenElem(false, this.ELEMENTS.resultsSection); this[EVENTNAME.RESULTS_SHOWN] = new CustomEvent(EVENTNAME.RESULTS_SHOWN, { bubbles: true }); this.el.dispatchEvent(this[EVENTNAME.RESULTS_SHOWN]); if (this.states.isAccumulatedRecommendation) { this.insertAccumulatedRecommendation(); } this.setShareLinkHref(this.getShareResultsUrl(results)); } } // Show questionnaire if active result not found if (!isShowingResults || !this.ELEMENTS.activeResult) { this.states.isShowingResults = false; this.setHiddenElem(false, this.ELEMENTS.questionnaire); this.setHiddenElem(true, this.ELEMENTS.resultsSection); } } /** * Process results string to find active result id * and accumulated recommendation results * @param {string} resultsString */; _proto.processResultsString = function processResultsString(resultsString) { if (this.isNullOrWhiteSpace(resultsString)) { return; } if (this.states.wizardId === SOLUTION_WIZARD_CONSTANTS.windowsHMCWizardId) { this.setActiveResult(resultsString); return; } var resultArr = resultsString.split('-'); this.setActiveResult(resultArr[0]); // Set accumulatedResults from the second half of split string if (this.states.isAccumulatedRecommendation && resultArr.length > 1) { this.setAccumulatedRecommendation(resultArr.slice(1)); } } /** * Set active result element based on result id and hide all other results * @param {string} resultId */; _proto.setActiveResult = function setActiveResult(resultId) { var _this5 = this; if (!this.ELEMENTS.resultsSection) { return; } this.ELEMENTS.activeResult = undefined; var allResults = this.ELEMENTS.resultsSection.querySelectorAll('.oc-solution-wizard-result'); allResults.forEach(function (result) { if (result && result.dataset.resultId === resultId) { _this5.ELEMENTS.activeResult = result; _this5.setHiddenElem(false, result); } else { _this5.setHiddenElem(true, result); } }); } /** * Set accumulated recommendation results show/hide * @param {string[]} accumulatedResults e.g: ["1", "0", "1", "0"] * @returns */; _proto.setAccumulatedRecommendation = function setAccumulatedRecommendation(accumulatedResults) { var _this6 = this; if (!this.ELEMENTS.resultsSection) { return; } // Create nodes for 2 up layout var row = document.createElement('div'); row.classList.add('row', 'row-cols-1', 'row-cols-md-2'); var col1 = document.createElement('div'); col1.classList.add('col'); var col2 = document.createElement('div'); col2.classList.add('col'); row.append(col1, col2); if (this.states.isRecommendationLayout2Up && this.ELEMENTS.resultsRecommendation) { this.ELEMENTS.resultsRecommendation.append(row); } // Show/hide recommendations based on accumulated results var activeRecommendationCount = 0; accumulatedResults.forEach(function (result, index) { var recommendation = _this6.ELEMENTS.resultsSection.querySelector(".oc-solution-wizard-recommendation[data-recommendation-index=\"" + index + "\"]"); if (result === '1') { _this6.setHiddenElem(false, recommendation); activeRecommendationCount++; if (_this6.states.isRecommendationLayout2Up) { if (activeRecommendationCount % 2 === 0) { col2.append(recommendation); } else { col1.append(recommendation); } } } else { _this6.setHiddenElem(true, recommendation); } }); // Show recommendation intro if there is at least one active recommendation var recommendationIntro = this.ELEMENTS.resultsSection.querySelector(SELECTORS.recommendationIntroSelector); if (activeRecommendationCount > 0) { this.setHiddenElem(false, recommendationIntro); } else { this.setHiddenElem(true, recommendationIntro); } }; _proto.traverseHistory = function traverseHistory(stepIndex) { if (this.states.isShowingResults) { this.traverseResultsHistory(stepIndex); // Clear saved results and show questionnaire this.saveResultsToLocalStorage(); this.setShowingResults(false); this.traverseNonResultsHistory(stepIndex); } else { this.traverseNonResultsHistory(stepIndex); } }; _proto.traverseResultsHistory = function traverseResultsHistory(stepIndex) { var stepsBack = this.states.history.length - stepIndex; if (stepIndex < 0) { this.states.history = []; } else if (stepsBack > 1) { this.states.history = this.states.history.slice(0, stepIndex + 1); } this.saveState(); }; _proto.traverseNonResultsHistory = function traverseNonResultsHistory(stepIndex) { this.setHiddenElem(false, this.ELEMENTS.solutionWizardContainer.querySelector(SELECTORS.nextButtonWrapperSelector)); if (stepIndex < 0) { this.states.history = []; this.resetQuestion(this.ELEMENTS.currentQuestion); this.states.score = 0; this.setCurrentQuestion(0); if (this.ELEMENTS.introPage) { this.setHiddenElem(false, this.ELEMENTS.introPage); this.setHiddenElem(true, this.ELEMENTS.questionnaire); } } else { var targetStep = this.states.history[stepIndex]; this.states.history = this.states.history.slice(0, stepIndex); this.resetQuestion(this.ELEMENTS.currentQuestion); this.states.score = targetStep.score; this.setCurrentQuestion(targetStep.questionIndex); this.syncAnswers(targetStep); } if (this.states.history.length) { var _this$ELEMENTS$curren, _this$ELEMENTS$curren2; this.setDisabledElem(false, (_this$ELEMENTS$curren = this.ELEMENTS.currentQuestion) == null ? void 0 : _this$ELEMENTS$curren.querySelector(SELECTORS.prevButtonSelector)); this.setHiddenElem(false, (_this$ELEMENTS$curren2 = this.ELEMENTS.currentQuestion) == null ? void 0 : _this$ELEMENTS$curren2.querySelector(SELECTORS.startOverButtonWrapperSelector)); } else { var _this$ELEMENTS$curren3, _this$ELEMENTS$curren4, _this$ELEMENTS$curren5, _this$ELEMENTS$curren6; this.setDisabledElem(true, (_this$ELEMENTS$curren3 = this.ELEMENTS.currentQuestion) == null ? void 0 : _this$ELEMENTS$curren3.querySelector(SELECTORS.prevButtonSelector)); this.setHiddenElem(true, (_this$ELEMENTS$curren4 = this.ELEMENTS.currentQuestion) == null ? void 0 : _this$ELEMENTS$curren4.querySelector(SELECTORS.startOverButtonWrapperSelector)); var isAnswered = Array.from((_this$ELEMENTS$curren5 = this.ELEMENTS.currentQuestion) == null ? void 0 : _this$ELEMENTS$curren5.querySelectorAll(SELECTORS.solutionWizardAnswerInputSelector)).some(function (answerInput) { return answerInput.checked; }); this.setDisabledElem(!isAnswered, (_this$ELEMENTS$curren6 = this.ELEMENTS.currentQuestion) == null ? void 0 : _this$ELEMENTS$curren6.querySelector(SELECTORS.nextButtonSelector)); if (stepIndex > 0) { var _this$ELEMENTS$curren7, _this$ELEMENTS$curren8; this.setHiddenElem(false, (_this$ELEMENTS$curren7 = this.ELEMENTS.currentQuestion) == null ? void 0 : _this$ELEMENTS$curren7.querySelector(SELECTORS.startOverButtonWrapperSelector)); this.setDisabledElem(false, (_this$ELEMENTS$curren8 = this.ELEMENTS.currentQuestion) == null ? void 0 : _this$ELEMENTS$curren8.querySelector(SELECTORS.startOverButtonSelector)); } } var nextHistory = this.getHistoryState(); if ((nextHistory == null ? void 0 : nextHistory.length) < 1) { var _this$ELEMENTS$curren9; var nextButton = (_this$ELEMENTS$curren9 = this.ELEMENTS.currentQuestion) == null ? void 0 : _this$ELEMENTS$curren9.querySelector(SELECTORS.nextButtonSelector); this.setDisabledElem(true, nextButton); } this.saveState(); } /** * Find matching result query param for current wizard * @returns {string | undefined} matchingResult */; _proto.findMatchingResultQuery = function findMatchingResultQuery() { var _this7 = this; var queryParams = new URLSearchParams(window.location.search); // Preserve other solutionwizardresult query params except for the current wizard result if found var currentSolutionWizardResultValues = queryParams.getAll(this.queryParamKeys.solutionWizardResult); var matchingResult = currentSolutionWizardResultValues.find(function (currentResultValue) { var currentResultId = currentResultValue.split(':')[0]; return _this7.states.wizardId.toLowerCase() === (currentResultId == null ? void 0 : currentResultId.toLowerCase()); }); return matchingResult; } /** * Get share link url by results value * @param {string} results results value * @returns results url */; _proto.getShareResultsUrl = function getShareResultsUrl(results) { var queryParams = new URLSearchParams(window.location.search); var matchingResult = this.findMatchingResultQuery(); // remove matched query param if (matchingResult) { queryParams.deleteKeyValue(this.queryParamKeys.solutionWizardResult, matchingResult); } var encodedResult = window.btoa(results); var resultsQuery = this.states.wizardId + ":" + encodedResult; queryParams.append(this.queryParamKeys.solutionWizardResult, resultsQuery); var queryParamString = '?' + queryParams.toString(); var baseUrl = window.location.origin + window.location.pathname; var newUrl = baseUrl + queryParamString + window.location.hash; return newUrl; } /** * Clear matched query param */; _proto.clearMatchedQueryParam = function clearMatchedQueryParam() { var queryParams = new URLSearchParams(window.location.search); var matchingResult = this.findMatchingResultQuery(); if (matchingResult) { queryParams.deleteKeyValue(this.queryParamKeys.solutionWizardResult, matchingResult); var queryParamString = queryParams && queryParams.size > 0 ? '?' + queryParams.toString() : ''; var baseUrl = window.location.origin + window.location.pathname; var newUrl = baseUrl + queryParamString + window.location.hash; window.history.pushState({}, '', newUrl); } } /** * Insert accumulated recommendation results to active result insert point */; _proto.insertAccumulatedRecommendation = function insertAccumulatedRecommendation() { if (!this.ELEMENTS.activeResult) { return; } var insertPointElem = this.ELEMENTS.activeResult.querySelector(SELECTORS.recommendationInsertPointSelector); if (!insertPointElem) { return; } if (this.ELEMENTS.resultsRecommendation) { insertPointElem.parentNode.replaceChild(this.ELEMENTS.resultsRecommendation, insertPointElem); } else { insertPointElem.remove(); } }; _proto.getEncodedState = function getEncodedState() { var nextHistory = this.getNextHistory(); var savedState = { expires: Date.now() + SOLUTION_WIZARD_CONSTANTS.expirationIncrement, history: this.states.isShowingResults || !nextHistory ? this.states.history : nextHistory }; var stringifiedState = JSON.stringify(savedState); return window.btoa(stringifiedState); }; _proto.saveState = function saveState() { var storageKey = this.states.wizardId; var encodedState; if (this.isNullOrWhiteSpace(storageKey)) { return; } if (this.states.history.length) { encodedState = this.getEncodedState(); } try { if (encodedState) { window.localStorage.setItem(storageKey, encodedState); } else { window.localStorage.removeItem(storageKey); } } catch (_unused) {} }; _proto.setCurrentQuestion = function setCurrentQuestion(questionIndex) { var _this8 = this, _answerInputs$; this.states.currentQuestionIndex = questionIndex; // for each question on page, call setHiddenElem(true, question) this.ELEMENTS.allQuestions.forEach(function (question) { _this8.setHiddenElem(true, question); }); this.ELEMENTS.currentQuestion = this.ELEMENTS.allQuestions[questionIndex]; this.setHiddenElem(false, this.ELEMENTS.currentQuestion); if (!this.states.isLinearQuestionFlow) { this.setProgressBar(); } var answerInputs = this.ELEMENTS.currentQuestion.querySelectorAll(SELECTORS.solutionWizardAnswerInputSelector); var isAnswered = Array.from(answerInputs).some(function (answerInput) { return answerInput.checked; }); this.setDisabledElem(!isAnswered, this.ELEMENTS.currentQuestion.querySelector(SELECTORS.nextButtonSelector)); (_answerInputs$ = answerInputs[0]) == null ? void 0 : _answerInputs$.focus(); }; _proto.resetQuestion = function resetQuestion(elem) { var answerInputs = elem == null ? void 0 : elem.querySelectorAll(SELECTORS.solutionWizardAnswerInputSelector); answerInputs.forEach(function (answerInput) { answerInput.checked = false; }); }; _proto.syncAnswers = function syncAnswers(historyStep) { var question = this.ELEMENTS.allQuestions[historyStep.questionIndex]; var answerInputs = question == null ? void 0 : question.querySelectorAll(SELECTORS.solutionWizardAnswerInputSelector); historyStep.answers.forEach(function (answerValue) { var usableIndex = Number(answerValue); var answerInput = answerInputs[usableIndex]; if (answerInput && !answerInput.checked) { answerInput.checked = true; } }); }; _proto.setProgressBar = function setProgressBar() { var progressBarElem = this.ELEMENTS.currentQuestion.querySelector(SELECTORS.progressBarSelector); if (progressBarElem) { var progress = (this.states.history.length + 1) * this.states.nonlinearProgressIncrement; var progressExtension = new ProgressExtension({ el: progressBarElem }); progressExtension.setProgress(progress); } var progressQuestionNumberElem = this.ELEMENTS.currentQuestion.querySelector(SELECTORS.progressQuestionNumberSelector); if (progressQuestionNumberElem) { var _progressQuestionNumb, _progressQuestionNumb2; progressQuestionNumberElem.textContent = this.states.history.length + 1; var questionString = (_progressQuestionNumb = progressQuestionNumberElem.previousElementSibling) == null ? void 0 : (_progressQuestionNumb2 = _progressQuestionNumb.textContent) == null ? void 0 : _progressQuestionNumb2.trim(); if (progressBarElem && questionString) { // set aria-valuetext to "Question N" progressBarElem.ariaValueText = questionString + " " + progressQuestionNumberElem.textContent; } } }; _proto.handleNextButtonClick = function handleNextButtonClick(event) { event.preventDefault(); var nextQuestionId = this.getNextQuestionId(); if (nextQuestionId === 'error') { return; } this.states.history = this.getNextHistory(); this.states.score = this.getNextStateScore(); this.saveState(); if (nextQuestionId === 'result') { this.generateResults(); return; } // If not getting result page, try to find next question // Special case handler for windowsHMC if (this.states.wizardId === SOLUTION_WIZARD_CONSTANTS.windowsHMCWizardId && nextQuestionId === 'windowsEdition') { var response = this.getResultsForWindowsHMC(true); if (response === 'windowsBusiness') { this.states.currentQuestionIndex = 5; } else { this.generateResults(); return; } } else { this.states.currentQuestionIndex = this.getNextQuestionIndex(nextQuestionId); } // Show next question this.resetQuestion(this.ELEMENTS.currentQuestion); this.setCurrentQuestion(this.states.currentQuestionIndex); this.saveState(); }; _proto.handlePrevButtonClick = function handlePrevButtonClick(event) { event.preventDefault(); if (this.states.history.length) { this.traverseHistory(this.states.history.length - 1); } else if (this.states.isShowingResults) { this.traverseHistory(-1); } }; _proto.handleStartOverButtonClick = function handleStartOverButtonClick(event) { event.preventDefault(); this.traverseHistory(-1); if (typeof window.isFeatureEnabled === 'function' && window.isFeatureEnabled('ocSolutionWizardQuery')) { this.clearMatchedQueryParam(); } } /** * Goes to the next section for Solution Wizard (next tab) * @param {Event} event Click/Keyboard event on the Next Section button */; _proto.handleNextSectionButtonClick = function handleNextSectionButtonClick(event) { event.preventDefault(); var parentTabpanel = event.target.closest(SELECTORS.WIZARD_CONTAINER_TABPANEL); if (parentTabpanel) { var relatedTab = document.querySelector("#" + parentTabpanel.id + "-tab"); if (relatedTab) { var nextTab = relatedTab.nextElementSibling; if (nextTab) { nextTab.click(); } } } } /** * Handle intro page start button click, to go to the first question of questionnaire * @param {Event} event Click/Keyboard event on the intro start button */; _proto.handleIntroStartButtonClick = function handleIntroStartButtonClick(event) { event.preventDefault(); this.setCurrentQuestion(0); this.setHiddenElem(true, this.ELEMENTS.introPage); this.setHiddenElem(false, this.ELEMENTS.questionnaire); }; _proto.handleAnswerInputChange = function handleAnswerInputChange() { var _this$ELEMENTS$curren10, _this$ELEMENTS, _this$ELEMENTS$curren11, _this$ELEMENTS2, _this$ELEMENTS2$curre; var nextButton = (_this$ELEMENTS$curren10 = this.ELEMENTS.currentQuestion) == null ? void 0 : _this$ELEMENTS$curren10.querySelector(SELECTORS.nextButtonSelector); var answerInputs = (_this$ELEMENTS = this.ELEMENTS) == null ? void 0 : (_this$ELEMENTS$curren11 = _this$ELEMENTS.currentQuestion) == null ? void 0 : _this$ELEMENTS$curren11.querySelectorAll(SELECTORS.solutionWizardAnswerInputSelector); // if current question has property isMultiSelect, disable next button if no answer is selected if ((_this$ELEMENTS2 = this.ELEMENTS) != null && (_this$ELEMENTS2$curre = _this$ELEMENTS2.currentQuestion) != null && _this$ELEMENTS2$curre.dataset.isMultiselect) { var isAnswered = Array.from(answerInputs).some(function (answerInput) { return answerInput.checked; }); this.setDisabledElem(!isAnswered, nextButton); } else { this.setDisabledElem(false, nextButton); } } // Get next history based on current answers selection ; _proto.getNextHistory = function getNextHistory() { var historyState = this.getHistoryState(); var nextStep = { answers: historyState, questionIndex: this.states.currentQuestionIndex, score: this.states.score }; var index = this.states.history.findIndex(function (h) { return h.questionIndex === nextStep.questionIndex; }); if (index > -1) { this.states.history[index] = nextStep; return this.states.history; } return this.states.history.concat([nextStep]); }; _proto.getHistoryState = function getHistoryState() { var _this$ELEMENTS3, _this$ELEMENTS3$curre; var historyState = []; var answerInputs = (_this$ELEMENTS3 = this.ELEMENTS) == null ? void 0 : (_this$ELEMENTS3$curre = _this$ELEMENTS3.currentQuestion) == null ? void 0 : _this$ELEMENTS3$curre.querySelectorAll(SELECTORS.solutionWizardAnswerInputSelector); answerInputs.forEach(function (answerInput, answerIndex) { if (answerInput.checked) { historyState.push(answerIndex); } }); return historyState; }; _proto.getNextQuestionId = function getNextQuestionId() { var _this$ELEMENTS4, _this$ELEMENTS4$curre; var historyState = this.getHistoryState(); if (historyState.length === 0 || this.isNullOrWhiteSpace(this.states.wizardId)) { return 'error'; } var answers = (_this$ELEMENTS4 = this.ELEMENTS) == null ? void 0 : (_this$ELEMENTS4$curre = _this$ELEMENTS4.currentQuestion) == null ? void 0 : _this$ELEMENTS4$curre.querySelectorAll(SELECTORS.solutionWizardAnswerSelector); var selectedAnswer = answers[historyState[0]]; return selectedAnswer == null ? void 0 : selectedAnswer.dataset.nextQuestionId; }; _proto.getNextQuestionIndex = function getNextQuestionIndex(nextQuestionId) { var nextQuestionIndex = this.states.currentQuestionIndex; if (nextQuestionId) { for (var i = 0; i < this.ELEMENTS.allQuestions.length; i++) { var question = this.ELEMENTS.allQuestions[i]; if (question && question.dataset.questionId === nextQuestionId) { nextQuestionIndex = i; break; } } } else { nextQuestionIndex = this.states.currentQuestionIndex + 1; } return nextQuestionIndex < this.ELEMENTS.allQuestions.length ? nextQuestionIndex : this.ELEMENTS.allQuestions.length - 1; }; _proto.getNextStateScore = function getNextStateScore() { var _this9 = this; var nextStateScore = 0; if (!this.isNullOrWhiteSpace(this.states.wizardId)) { var _this$ELEMENTS5, _this$ELEMENTS5$curre; var answers = (_this$ELEMENTS5 = this.ELEMENTS) == null ? void 0 : (_this$ELEMENTS5$curre = _this$ELEMENTS5.currentQuestion) == null ? void 0 : _this$ELEMENTS5$curre.querySelectorAll(SELECTORS.solutionWizardAnswerSelector); var historyState = this.getHistoryState(); historyState.forEach(function (answerIndex) { var selectedAnswer = answers[answerIndex]; if (selectedAnswer != null && selectedAnswer.dataset.score) { var score = Number(selectedAnswer.dataset.score); if (!isNaN(score)) { if (_this9.states.isAccumulatedScore) { nextStateScore += score; } else { nextStateScore = score; } } } }); } return nextStateScore; }; _proto.setDisabledElem = function setDisabledElem(disabled, elem) { if (elem) { if (elem instanceof HTMLButtonElement && elem.disabled !== disabled) { elem.disabled = disabled; } else if (elem instanceof HTMLAnchorElement && elem.ariaDisabled !== String(disabled)) { elem.ariaDisabled = String(disabled); elem.classList.toggle('disabled', disabled); elem.tabIndex = disabled ? -1 : 0; } } }; _proto.setHiddenElem = function setHiddenElem(hidden, elem) { if (elem && elem.hidden !== hidden) { elem.hidden = hidden; // if active class exists on element, and hidden is true, remove active class if (elem != null && elem.classList.contains('show') && hidden) { elem.classList.remove('show'); return true; } // if active class does not exist on element, and hidden is false, add active class if (!(elem != null && elem.classList.contains('show')) && !hidden) { elem.classList.add('show'); return true; } return true; } return false; } // helper null check function ; _proto.isNullOrWhiteSpace = function isNullOrWhiteSpace(str) { return !str || typeof str !== 'string' || str.match(/^ *$/) !== null; } // Generate results and post processing to set result query string ; _proto.generateResults = function generateResults() { var results = null; if (this.states.wizardId === SOLUTION_WIZARD_CONSTANTS.windowsHMCWizardId) { results = this.getResultsForWindowsHMC(false); } else { results = this.getResultsForGeneric(); } if (!this.isNullOrWhiteSpace(results)) { this.saveResultsToLocalStorage(results); if (this.states.enableRevisitRedirect) { window.location.reload(); } else { this.setShowingResults(true, results); } } } // Save result string to local storage ; _proto.saveResultsToLocalStorage = function saveResultsToLocalStorage(results) { if (this.isNullOrWhiteSpace(this.states.wizardId)) { return; } if (window.localStorage) { var storageKey = SOLUTION_WIZARD_CONSTANTS.solutionWizardResult + "-" + this.states.wizardId; if (results) { var encodedResult = window.btoa(results); window.localStorage.setItem(storageKey, encodedResult); } else { window.localStorage.removeItem(storageKey); } } } // Get results response for generic cases ; _proto.getResultsForGeneric = function getResultsForGeneric() { var mainResultId = null; if (this.states.wizardId === 'isv-turboflow') { mainResultId = this.states.resultsConfig.length ? this.states.resultsConfig[0].resultId : 'resultIsvTurboflow'; } else { for (var _iterator3 = _createForOfIteratorHelperLoose$6(this.states.resultsConfig), _step3; !(_step3 = _iterator3()).done;) { var curConfig = _step3.value; if (!curConfig) { continue; } // Process logics matching and set mainResultId once matched found var matched = this.runLogicsMapping(curConfig.logics); if (matched) { mainResultId = curConfig.resultId; break; } } } if (!mainResultId) { return null; } // Get secondary results and encode full result string var secondaryResults = this.getSecondaryResults(); var resultString = this.isNullOrWhiteSpace(secondaryResults) ? mainResultId : mainResultId + "-" + secondaryResults; return resultString; } // Get results response for windowsHMC ; _proto.getResultsForWindowsHMC = function getResultsForWindowsHMC(editionOnly) { var windowsEdition; var windowsConfig; var windowsPricing; // Process logics matching and set mainResultId once matched found for (var _iterator4 = _createForOfIteratorHelperLoose$6(this.states.resultsConfig), _step4; !(_step4 = _iterator4()).done;) { var curConfig = _step4.value; if (!curConfig) { continue; } var matched = this.runLogicsMapping(curConfig.logics); if (matched) { var curResultId = curConfig.resultId; if (curResultId.includes('windows')) { if (!windowsEdition) { windowsEdition = curResultId; // eslint-disable-next-line max-depth if (editionOnly) { return windowsEdition; } } continue; } else if (curResultId.includes('config-')) { curResultId = curResultId.split('-')[1]; if (!windowsConfig) { windowsConfig = curResultId; } continue; } else if (curResultId.includes('pricing-')) { curResultId = curResultId.split('-')[1]; if (!windowsPricing) { windowsPricing = curResultId; } continue; } } } return this.setResultsString(windowsEdition, windowsConfig, windowsPricing); }; _proto.setResultsString = function setResultsString(windowsEdition, windowsConfig, windowsPricing) { // Set result string and fallback values. var _windowsEdition = windowsEdition ? windowsEdition : 'windowsBusiness'; var _windowsConfig = windowsConfig ? windowsConfig : 'cpu2ram4'; var _windowsPricing = windowsPricing ? windowsPricing : 'standard'; var resultString = _windowsEdition + "-" + _windowsConfig + "-" + _windowsPricing; return resultString; } // Run logics mapping to find the result matching the logics ; _proto.runLogicsMapping = function runLogicsMapping(logics) { var matchLogics = false; for (var _iterator5 = _createForOfIteratorHelperLoose$6(logics), _step5; !(_step5 = _iterator5()).done;) { var curLogic = _step5.value; var curMatch = false; var logicField = curLogic.field; var logicCondition = curLogic.condition; if (logicField === 'score') { curMatch = this.runScoreLogic(curLogic); } else if (logicField.includes('question-')) { curMatch = this.runQuestionAnswerLogic(curLogic); } if (logicCondition) { // Use condition check by its natural order to simplify the process switch (logicCondition) { case 'and': case '&&': matchLogics = matchLogics && curMatch; break; case 'or': case '||': matchLogics = matchLogics || curMatch; break; default: matchLogics = curMatch; break; } } else { matchLogics = curMatch; } } return matchLogics; } // Run a single logic in the type of score checking ; _proto.runScoreLogic = function runScoreLogic(logic) { var score = this.states.isAccumulatedScore ? this.getTotalScore() : this.states.score; if (score === null) { return false; } var logicValue = parseInt(logic.value, 10); switch (logic.operator) { case '==': return score === logicValue; case '!=': return score !== logicValue; case '>': return score > logicValue; case '>=': return score >= logicValue; case '<': return score < logicValue; case '<=': return score <= logicValue; default: return false; } } // Process scores calculation for totalScore ; _proto.getTotalScore = function getTotalScore() { var totalScore = 0; for (var _iterator6 = _createForOfIteratorHelperLoose$6(this.states.history), _step6; !(_step6 = _iterator6()).done;) { var step = _step6.value; totalScore += step.score || 0; } return totalScore; } // Run a single logic in the type of question and answer checking ; _proto.runQuestionAnswerLogic = function runQuestionAnswerLogic(logic) { if (!logic.value || !logic.field || logic.field.split('-').length < 2) { return false; } var logicQuestionIndex = logic.field.split('-')[1]; var questionIndex = parseInt(logicQuestionIndex, 10); var matchedStep = this.states.history.find(function (h) { return h.questionIndex === questionIndex; }); var answers = ((matchedStep == null ? void 0 : matchedStep.answers) || []).map(function (answer) { return String(answer); }); switch (logic.operator) { case '==': return answers.join(',') === logic.value; case '!=': return answers.join(',') !== logic.value; case 'contain': case 'contains': return answers.includes(logic.value); case 'not contain': case 'not contains': return !answers.includes(logic.value); default: return false; } } // Get secondary results to append to results response ; _proto.getSecondaryResults = function getSecondaryResults() { var _this10 = this; if (!this.states.isAccumulatedRecommendation) { return null; } var results = Array.from({ length: this.ELEMENTS.allQuestions.length }); this.ELEMENTS.allQuestions.forEach(function (question, index) { var enabledScoreString = question.dataset ? question.dataset.recommendationEnabledScore : null; var enabledScore = parseInt(enabledScoreString, 10); var step = _this10.states.history.find(function (h) { return h.questionIndex === index; }); var score = (step == null ? void 0 : step.score) || 0; if (!isNaN(enabledScore) && score < enabledScore) { results[index] = 1; } else { results[index] = 0; } }); return results.join('-'); } /** * Remove the instance */; _proto.remove = function remove() { _ComponentBase.prototype.remove.call(this); Util$1.removeEvents(this.events); var index = instances$c.indexOf(this); instances$c.splice(index, 1); this[EVENTNAME.ON_REMOVE] = new CustomEvent(EVENTNAME.ON_REMOVE, { bubbles: true, cancelable: true }); this.el.dispatchEvent(this[EVENTNAME.ON_REMOVE]); } /** * Gets Wizard component extension instances. * @returns {SolutionWizard[]} */; SolutionWizard.getInstances = function getInstances() { return instances$c; }; return SolutionWizard; }(ComponentBase); var uncurryThis$2 = functionUncurryThis; var defineBuiltIns$1 = defineBuiltIns$4; var getWeakData = internalMetadata.exports.getWeakData; var anInstance = anInstance$6; var anObject = anObject$l; var isNullOrUndefined = isNullOrUndefined$b; var isObject$1 = isObject$o; var iterate = iterate$5; var ArrayIterationModule = arrayIteration; var hasOwn = hasOwnProperty_1; var InternalStateModule = internalState; var setInternalState = InternalStateModule.set; var internalStateGetterFor = InternalStateModule.getterFor; var find = ArrayIterationModule.find; var findIndex = ArrayIterationModule.findIndex; var splice = uncurryThis$2([].splice); var id = 0; // fallback for uncaught frozen keys var uncaughtFrozenStore = function (store) { return store.frozen || (store.frozen = new UncaughtFrozenStore()); }; var UncaughtFrozenStore = function () { this.entries = []; }; var findUncaughtFrozen = function (store, key) { return find(store.entries, function (it) { return it[0] === key; }); }; UncaughtFrozenStore.prototype = { get: function (key) { var entry = findUncaughtFrozen(this, key); if (entry) return entry[1]; }, has: function (key) { return !!findUncaughtFrozen(this, key); }, set: function (key, value) { var entry = findUncaughtFrozen(this, key); if (entry) entry[1] = value; else this.entries.push([key, value]); }, 'delete': function (key) { var index = findIndex(this.entries, function (it) { return it[0] === key; }); if (~index) splice(this.entries, index, 1); return !!~index; } }; var collectionWeak$1 = { getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) { var Constructor = wrapper(function (that, iterable) { anInstance(that, Prototype); setInternalState(that, { type: CONSTRUCTOR_NAME, id: id++, frozen: undefined }); if (!isNullOrUndefined(iterable)) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP }); }); var Prototype = Constructor.prototype; var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME); var define = function (that, key, value) { var state = getInternalState(that); var data = getWeakData(anObject(key), true); if (data === true) uncaughtFrozenStore(state).set(key, value); else data[state.id] = value; return that; }; defineBuiltIns$1(Prototype, { // `{ WeakMap, WeakSet }.prototype.delete(key)` methods // https://tc39.es/ecma262/#sec-weakmap.prototype.delete // https://tc39.es/ecma262/#sec-weakset.prototype.delete 'delete': function (key) { var state = getInternalState(this); if (!isObject$1(key)) return false; var data = getWeakData(key); if (data === true) return uncaughtFrozenStore(state)['delete'](key); return data && hasOwn(data, state.id) && delete data[state.id]; }, // `{ WeakMap, WeakSet }.prototype.has(key)` methods // https://tc39.es/ecma262/#sec-weakmap.prototype.has // https://tc39.es/ecma262/#sec-weakset.prototype.has has: function has(key) { var state = getInternalState(this); if (!isObject$1(key)) return false; var data = getWeakData(key); if (data === true) return uncaughtFrozenStore(state).has(key); return data && hasOwn(data, state.id); } }); defineBuiltIns$1(Prototype, IS_MAP ? { // `WeakMap.prototype.get(key)` method // https://tc39.es/ecma262/#sec-weakmap.prototype.get get: function get(key) { var state = getInternalState(this); if (isObject$1(key)) { var data = getWeakData(key); if (data === true) return uncaughtFrozenStore(state).get(key); return data ? data[state.id] : undefined; } }, // `WeakMap.prototype.set(key, value)` method // https://tc39.es/ecma262/#sec-weakmap.prototype.set set: function set(key, value) { return define(this, key, value); } } : { // `WeakSet.prototype.add(value)` method // https://tc39.es/ecma262/#sec-weakset.prototype.add add: function add(value) { return define(this, value, true); } }); return Constructor; } }; var global$1 = global$B; var uncurryThis$1 = functionUncurryThis; var defineBuiltIns = defineBuiltIns$4; var InternalMetadataModule = internalMetadata.exports; var collection = collection$2; var collectionWeak = collectionWeak$1; var isObject = isObject$o; var isExtensible = objectIsExtensible; var enforceInternalState = internalState.enforce; var NATIVE_WEAK_MAP = weakMapBasicDetection; var IS_IE11 = !global$1.ActiveXObject && 'ActiveXObject' in global$1; var InternalWeakMap; var wrapper = function (init) { return function WeakMap() { return init(this, arguments.length ? arguments[0] : undefined); }; }; // `WeakMap` constructor // https://tc39.es/ecma262/#sec-weakmap-constructor var $WeakMap = collection('WeakMap', wrapper, collectionWeak); // IE11 WeakMap frozen keys fix // We can't use feature detection because it crash some old IE builds // https://github.com/zloirock/core-js/issues/485 if (NATIVE_WEAK_MAP && IS_IE11) { InternalWeakMap = collectionWeak.getConstructor(wrapper, 'WeakMap', true); InternalMetadataModule.enable(); var WeakMapPrototype = $WeakMap.prototype; var nativeDelete = uncurryThis$1(WeakMapPrototype['delete']); var nativeHas = uncurryThis$1(WeakMapPrototype.has); var nativeGet = uncurryThis$1(WeakMapPrototype.get); var nativeSet = uncurryThis$1(WeakMapPrototype.set); defineBuiltIns(WeakMapPrototype, { 'delete': function (key) { if (isObject(key) && !isExtensible(key)) { var state = enforceInternalState(this); if (!state.frozen) state.frozen = new InternalWeakMap(); return nativeDelete(this, key) || state.frozen['delete'](key); } return nativeDelete(this, key); }, has: function has(key) { if (isObject(key) && !isExtensible(key)) { var state = enforceInternalState(this); if (!state.frozen) state.frozen = new InternalWeakMap(); return nativeHas(this, key) || state.frozen.has(key); } return nativeHas(this, key); }, get: function get(key) { if (isObject(key) && !isExtensible(key)) { var state = enforceInternalState(this); if (!state.frozen) state.frozen = new InternalWeakMap(); return nativeHas(this, key) ? nativeGet(this, key) : state.frozen.get(key); } return nativeGet(this, key); }, set: function set(key, value) { if (isObject(key) && !isExtensible(key)) { var state = enforceInternalState(this); if (!state.frozen) state.frozen = new InternalWeakMap(); nativeHas(this, key) ? nativeSet(this, key, value) : state.frozen.set(key, value); } else nativeSet(this, key, value); return this; } }); } var EventName$e = { CLICK: 'click', HIDE: 'onHide', HIDDEN: 'onHidden', SHOW: 'onShow', SHOWN: 'onShown', ON_REMOVE: 'onRemove', ON_UPDATE: 'onUpdate', FOCUSIN: 'focusin', RESIZE: 'resize', CLICK_DISMISS: 'click.dismiss', KEYDOWN: 'keydown' }; /** SNAP-CAROUSEL START */ var instances$b = []; /** * HTML Attributes. * @enum {string} */ var Attributes$3 = { DISABLED: 'disabled', TABINDEX: 'tabindex' }; /** * CSS Classes. * @enum {string} */ var ClassName$8 = { CAROUSEL_CONTROLS: 'carousel-controls', CAROUSEL_WINDOW: 'snap-carousel-window', CAROUSEL_ITEM: 'snap-carousel-item', CONTAINER: 'container', FLEX_BASIS: 'flex-basis', PADDING_INLINE_END: 'padding-inline-end', SCROLL_PADDING_INLINE_START: 'scroll-padding-inline-start' }; /** * JS event name. * @enum {string} */ var EventName$d = { CLICK_DATA_API: 'click', ON_CLICK: 'onClick', ON_INIT: 'onInit', ON_REMOVE: 'onRemove', ON_SCROLL: 'onScroll', ON_UPDATE: 'onUpdate', RESIZE_DATA_API: 'resize', SCROLL_DATA_API: 'scroll' }; /** * CSS selector. * @enum {string} */ var Selector$e = { CAROUSEL_ITEMS: "." + ClassName$8.CAROUSEL_ITEM, CAROUSEL_WINDOW: "." + ClassName$8.CAROUSEL_WINDOW, CONTAINER: "." + ClassName$8.CONTAINER, DATA_MOUNT: '[data-mount="scroll-snap-carousel"]', MODAL_TRIGGER_BUTTON: "button[data-target], a[data-target]", SNAP_ALIGN_START: '.snap-align-start', SPACER_DIV: ".spacer-div" }; /** * String constants. * @enum {string} */ var Strings = { EMPTY: "", SCREEN_READER_SLIDE_TITLE_TOKEN: "%{slideTitle}", SCREEN_READER_START_TOKEN: "%{start}", SCREEN_READER_TOTAL_TOKEN: "%{total}", SPACE: " " }; var DELAY_MS$1 = 100; var SnapCarousel = /*#__PURE__*/function () { /** * Carousel's Window Element. * @type {HTMLDivElement} */ /** * Root element. * @type {HTMLDivElement} */ /** * Event bindings. * @type {{ el: Element, handler: (...args: unknown[]) => unknown, type: string}[]} */ /** * Amount to scroll the Carousel Window Element when prev and next button activated * @type {int} */ /** * Initializes a new instance of the Snap Carousel component. * @param {{ el: HTMLDivElement }} opts Initialization options. */ function SnapCarousel(opts) { var _this = this, _window$mwf, _window$mwf$Modal; this.carouselWindow = void 0; this.el = void 0; this.events = []; this.scrollAmount = void 0; this.el = opts.el; this.carouselWindow = this.el.querySelector(Selector$e.CAROUSEL_WINDOW); this.carouselItems = this.carouselWindow.querySelectorAll(Selector$e.CAROUSEL_ITEMS); this.disabledQuery = this.el.dataset.disableVp ? window.matchMedia("(min-width: " + ViewPort[this.el.dataset.disableVp.toUpperCase()] + "px)") : null; this.hasContainer = this.carouselWindow.querySelector(Selector$e.CONTAINER) !== null; this.isRTL = document.dir === 'rtl'; this.isSnapAlignStart = this.carouselWindow.querySelector(Selector$e.SNAP_ALIGN_START) !== null; this.modalTriggerElems = this.el.querySelectorAll(Selector$e.MODAL_TRIGGER_BUTTON); this.spacerDiv = this.carouselWindow.querySelector(Selector$e.SPACER_DIV); this.subContainer = null; opts.nextOnClick = this.scrollToNextPage.bind(this); opts.prevOnClick = this.scrollToPrevPage.bind(this); this.controls = opts.controls || new CarouselControls(opts); this.controls.prevBtn.setAttribute(Attributes$3.DISABLED, Strings.EMPTY); if (this.hasContainer) { this.subContainer = this.carouselWindow.querySelector(Selector$e.CONTAINER); this.setSpacerDiv(); if (this.isSnapAlignStart) { this.setCarouselWindowScrollPadding(); } } this.calculateScrollAmount(); this.events.push({ el: document.defaultView, handler: throttle(DELAY_MS$1, this.handleResize.bind(this)), type: EventName$d.RESIZE_DATA_API }, { el: this.carouselWindow, handler: throttle(DELAY_MS$1, this.handleScroll.bind(this)), type: EventName$d.SCROLL_DATA_API }); this.modalTriggerElems.forEach(function (modalTriggerElem) { _this.events.push({ el: modalTriggerElem, type: EventName$d.CLICK_DATA_API, handler: _this.onModalTriggerClick.bind(_this) }); }); var modals = (_window$mwf = window.mwf) == null ? void 0 : (_window$mwf$Modal = _window$mwf.Modal) == null ? void 0 : _window$mwf$Modal.getInstances(); if (modals) { modals.forEach(function (modal) { if (modal.el.contains(_this.el)) { _this.events.push({ el: modal.el, type: EventName$e.SHOWN, handler: _this.handleModalShown.bind(_this) }); } }); } Util$1.addEvents(this.events); instances$b.push(this); } /** * Determines if carousel items are fixed width * @returns {boolean} `true` if first carousel item contains a `col-` class, `false` otherwise. */ var _proto = SnapCarousel.prototype; _proto.areItemsFixedWidth = function areItemsFixedWidth() { var item = this.carouselItems[0]; for (var _iterator = _createForOfIteratorHelperLoose$6(item.classList), _step; !(_step = _iterator()).done;) { var cls = _step.value; if (cls.includes('col-')) { return true; } } return false; } /** * Gets carousel item width. * @returns {number} The width of the first carousel item. */; _proto.getItemWidth = function getItemWidth() { var item = this.carouselItems[0]; return item.clientWidth; } /** * Calculates how much scrolling the prev and next buttons should scroll the carousel window. */; _proto.calculateScrollAmount = function calculateScrollAmount() { if (this.hasContainer) { this.scrollAmount = this.subContainer.clientWidth; } else { this.scrollAmount = this.carouselWindow.clientWidth; } if (this.areItemsFixedWidth() && this.getItemWidth() > this.scrollAmount / 2) { this.scrollAmount = this.getItemWidth(); } } /* * Calculates the margin-start and padding-start of the carousel window */; _proto.calculateOffset = function calculateOffset() { var padding = parseInt(window.getComputedStyle(this.subContainer, null).getPropertyValue(ClassName$8.PADDING_INLINE_END), 10) * 2; var margin = window.innerWidth > 1600 ? window.innerWidth - this.subContainer.clientWidth : 0; return (padding + margin) / 2; // margin and padding is for both left + right side of container. We only need to accomodate for one side. } /** * Handle Snap Carousel setup when Modal component is shown */; _proto.handleModalShown = function handleModalShown() { this.setSpacerDiv(); this.calculateScrollAmount(); if (window.location.hash) { var slideToScrollTo = this.el.querySelector(window.location.hash); if (slideToScrollTo) { slideToScrollTo.setAttribute(Attributes$3.TABINDEX, '-1'); slideToScrollTo.scrollIntoView({ block: 'nearest', inline: 'center' }); slideToScrollTo.focus({ preventScroll: true }); window.history.replaceState(null, null, Strings.SPACE); } } } /** * Handle resizing for Scroll Snap Carousel * Sets the size of the Spacer Div (if it exists), and re-calculates the scroll-amount for carousel controls */; _proto.handleResize = function handleResize() { if (this.hasContainer) { this.setSpacerDiv(); if (this.isSnapAlignStart) { this.setCarouselWindowScrollPadding(); } } this.calculateScrollAmount(); } /** * Handle scrolling inside the Scroll Snap Carousel Window * Sets arrow state */; _proto.handleScroll = function handleScroll() { var carouselWindow = this.carouselWindow, controls = this.controls, carouselItems = this.carouselItems; var scrollLeftVal = carouselWindow.scrollLeft; if (Math.abs(scrollLeftVal) <= 1) { controls.prevBtn.setAttribute(Attributes$3.DISABLED, Strings.EMPTY); controls.nextBtn.removeAttribute(Attributes$3.DISABLED); } else if (this.inCarouselWindow(carouselItems[carouselItems.length - 1], carouselWindow)) { controls.prevBtn.removeAttribute(Attributes$3.DISABLED); controls.nextBtn.setAttribute(Attributes$3.DISABLED, Strings.EMPTY); } else { controls.nextBtn.removeAttribute(Attributes$3.DISABLED); controls.prevBtn.removeAttribute(Attributes$3.DISABLED); } } /** * Helper function to check if single slide element is within slide window. * @param {HTMLElement} slide - Single slide element. * @param {HTMLElement} carouselWindow - Carousel window. * @return {boolean} Returns true if the slide element is visible within the slide window. */; _proto.inCarouselWindow = function inCarouselWindow(slide, carouselWindow) { var slideBounds = slide.getBoundingClientRect(); var carouselWindowBounds = carouselWindow.getBoundingClientRect(); return Math.ceil(slideBounds.left) >= Math.ceil(carouselWindowBounds.left) && Math.ceil(slideBounds.right) <= Math.ceil(carouselWindowBounds.right); } /** * Specialized event handler for Cards with Modal Triggers */; _proto.onModalTriggerClick = function onModalTriggerClick(event) { var clickedModalTrigger = event.target; // Set data-scroll-to-target on modal to keep track of element to scroll to when modal opens if (clickedModalTrigger.dataset.scrollToTarget) { window.history.replaceState(null, null, clickedModalTrigger.dataset.scrollToTarget); } } /* * Scroll the carousel window to the next page. */; _proto.scrollToNextPage = function scrollToNextPage() { var scrollAmountForLangDir = this.isRTL ? -this.scrollAmount : this.scrollAmount; this.carouselWindow.scrollBy(scrollAmountForLangDir, 0); } /* * Scroll the carousel window to the previous page. */; _proto.scrollToPrevPage = function scrollToPrevPage() { var scrollAmountForLangDir = this.isRTL ? -this.scrollAmount : this.scrollAmount; this.carouselWindow.scrollBy(-scrollAmountForLangDir, 0); } /* * Set Carousel Window's scroll-padding-inline-start to the calculated offset. */; _proto.setCarouselWindowScrollPadding = function setCarouselWindowScrollPadding() { this.carouselWindow.style.setProperty(ClassName$8.SCROLL_PADDING_INLINE_START, this.calculateOffset().toString() + 'px'); } /** * Update the spacer-div's width. */; _proto.setSpacerDiv = function setSpacerDiv() { if (this.spacerDiv) { var _this$disabledQuery; this.spacerDiv.style.setProperty(ClassName$8.FLEX_BASIS, (_this$disabledQuery = this.disabledQuery) != null && _this$disabledQuery.matches ? Strings.EMPTY : this.calculateOffset().toString() + 'px', 'important'); } } /** * Update the instance. * Not currently used, but required by API standards. */; _proto.update = function update() { this.el.dispatchEvent(this[EventName$d.ON_UPDATE]); } /** * Remove the instance */; _proto.remove = function remove() { this.controls.remove(); Util$1.removeEvents(this.events); var index = instances$b.indexOf(this); instances$b.splice(index, 1); this[EventName$d.ON_REMOVE] = new CustomEvent(EventName$d.ON_REMOVE, { bubbles: true }); this.el.dispatchEvent(this[EventName$d.ON_REMOVE]); } /** * Get Snap Carousel instances. * @returns {SnapCarousel[]} An array of Snap Carousel instances */; SnapCarousel.getInstances = function getInstances() { return instances$b; }; return SnapCarousel; }(); /** SNAP-CAROUSEL END */ var $$1 = _export; var $every = arrayIteration.every; var arrayMethodIsStrict = arrayMethodIsStrict$8; var STRICT_METHOD = arrayMethodIsStrict('every'); // `Array.prototype.every` method // https://tc39.es/ecma262/#sec-array.prototype.every $$1({ target: 'Array', proto: true, forced: !STRICT_METHOD }, { every: function every(callbackfn /* , thisArg */) { return $every(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); var $ = _export; var uncurryThis = functionUncurryThis; var toIntegerOrInfinity = toIntegerOrInfinity$8; var thisNumberValue = thisNumberValue$2; var $repeat = stringRepeat; var fails = fails$J; var $RangeError = RangeError; var $String = String; var floor = Math.floor; var repeat = uncurryThis($repeat); var stringSlice = uncurryThis(''.slice); var nativeToFixed = uncurryThis(1.0.toFixed); var pow = function (x, n, acc) { return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc); }; var log = function (x) { var n = 0; var x2 = x; while (x2 >= 4096) { n += 12; x2 /= 4096; } while (x2 >= 2) { n += 1; x2 /= 2; } return n; }; var multiply = function (data, n, c) { var index = -1; var c2 = c; while (++index < 6) { c2 += n * data[index]; data[index] = c2 % 1e7; c2 = floor(c2 / 1e7); } }; var divide = function (data, n) { var index = 6; var c = 0; while (--index >= 0) { c += data[index]; data[index] = floor(c / n); c = (c % n) * 1e7; } }; var dataToString = function (data) { var index = 6; var s = ''; while (--index >= 0) { if (s !== '' || index === 0 || data[index] !== 0) { var t = $String(data[index]); s = s === '' ? t : s + repeat('0', 7 - t.length) + t; } } return s; }; var FORCED = fails(function () { return nativeToFixed(0.00008, 3) !== '0.000' || nativeToFixed(0.9, 0) !== '1' || nativeToFixed(1.255, 2) !== '1.25' || nativeToFixed(1000000000000000128.0, 0) !== '1000000000000000128'; }) || !fails(function () { // V8 ~ Android 4.3- nativeToFixed({}); }); // `Number.prototype.toFixed` method // https://tc39.es/ecma262/#sec-number.prototype.tofixed $({ target: 'Number', proto: true, forced: FORCED }, { toFixed: function toFixed(fractionDigits) { var number = thisNumberValue(this); var fractDigits = toIntegerOrInfinity(fractionDigits); var data = [0, 0, 0, 0, 0, 0]; var sign = ''; var result = '0'; var e, z, j, k; // TODO: ES2018 increased the maximum number of fraction digits to 100, need to improve the implementation if (fractDigits < 0 || fractDigits > 20) throw $RangeError('Incorrect fraction digits'); // eslint-disable-next-line no-self-compare -- NaN check if (number != number) return 'NaN'; if (number <= -1e21 || number >= 1e21) return $String(number); if (number < 0) { sign = '-'; number = -number; } if (number > 1e-21) { e = log(number * pow(2, 69, 1)) - 69; z = e < 0 ? number * pow(2, -e, 1) : number / pow(2, e, 1); z *= 0x10000000000000; e = 52 - e; if (e > 0) { multiply(data, 0, z); j = fractDigits; while (j >= 7) { multiply(data, 1e7, 0); j -= 7; } multiply(data, pow(10, j, 1), 0); j = e - 1; while (j >= 23) { divide(data, 1 << 23); j -= 23; } divide(data, 1 << j); multiply(data, 1, 1); divide(data, 2); result = dataToString(data); } else { multiply(data, 0, z); multiply(data, 1 << -e, 0); result = dataToString(data) + repeat('0', fractDigits); } } if (fractDigits > 0) { k = result.length; result = sign + (k <= fractDigits ? '0.' + repeat('0', fractDigits - k) + result : stringSlice(result, 0, k - fractDigits) + '.' + stringSlice(result, k - fractDigits)); } else { result = sign + result; } return result; } }); var instances$a = []; var activeTabIndex = 0; /** * CSS selector. * @enum {string} */ var Selector$d = { DATA_MOUNT: '[data-mount="sku-configurator"]', FILTER: '.ocsc-filter', FILTER_GROUP: '.ocsc-filter-group', INPUT: 'input', MODULE: '.sku-configurator', OPTION: '.ocsc-desktop .ocsc-option', PRICE: '.oc-list-price', REL_PRICE: '.ocsc-rel-price', PRICING: '.ocsc-pricing', LINK_GROUP: '.link-group', TITLE: '.ocsc-product-title', FEATURES: '.ocsc-features', SKU: '.ocsc-sku', STICKY_CONTAINER: '#ocsc-sticky-container', MOBILE_STICKY: '#ocsc-mobile-sticky', SKU_MOBILE_PRICING: '.ocsc-mobile .ocsc-pricing', SKU_MOBILE_LINK_GROUP: '.ocsc-mobile .link-group', SKU_MOBILE_TITLE: '.ocsc-mobile .ocsc-product-title', SKU_MOBILE_FEATURES: '.ocsc-mobile .ocsc-features', TABLET_STICKY: '#ocsc-tablet-sticky', HIDE_STICKY_BTN: '.ocsc-hide-sticky' }; /** * JS event name. * @enum {string} */ var EventName$c = { ON_REMOVE: 'onRemove', ON_UPDATE: 'onUpdate', ON_BLUR: 'blur', ON_CHANGE: 'change', ON_FOCUS: 'focus', ON_CLICK: 'click' }; /** * CSS class. * @enum {string} */ var ClassName$7 = { ACTIVE: 'active', DISABLED: 'disabled', FOCUSED: 'focused', DISPLAY_NONE: 'd-none' }; /** * CSS attribute * @enum {string} */ var AttributeName$2 = { DISABLED: 'disabled', HIDDEN: 'hidden', ID: 'id' }; /** * Sets element attribute * @this {SkuConfigurator} Parent component. * @param {HTMLElement} el - element. * @param {string} attr - attribute name. * @param {string} val - attribute value. */ function _setBooleanAttribute(el, attr, val) { if (val) { el.setAttribute(attr, ''); } else { el.removeAttribute(attr); } } /** * Sets element class * @this {SkuConfigurator} Parent component. * @param {HTMLElement} el - element. * @param {string} className - class name. * @param {boolean} isPresent - flag for adding/removing class */ function _setConditionalClass(el, className, isPresent) { if (isPresent) { el.classList.add(className); } else { el.classList.remove(className); } } /** * Remove child nodes from element * @param {HTMLElement} el - element. */ function _removeChildNodes(el) { while (el.firstChild) { el.firstChild.remove(); } } /** * Sku configurator component Sku */ var Sku = /*#__PURE__*/function () { /** * Initializes a new instance of Sku object */ function Sku(opts) { var _this = this; this.el = opts; this._features = []; this.el.querySelectorAll(Selector$d.OPTION).forEach(function (item) { _this._features.push(item.textContent); }); this._isSelected = this.el.getAttribute(AttributeName$2.HIDDEN) === null; this.priceWithCurrency = this.el.querySelector(Selector$d.PRICE).textContent; this._tabIndex = parseInt(this.el.dataset.tabIndex, 10); } /** * Gets Sku price */ var _proto = Sku.prototype; /** * Tests if Sku has filter values * @param {array} filterValues - values to check. * @param {tabIndex} tabIndex - tab component index where tested Sku is located */ _proto.test = function test(filterValues, tabIndex) { var _this2 = this; return filterValues.every(function (filter, filterIndex) { return !filter || _this2._features[filterIndex] === filter; }) && this._tabIndex === tabIndex; }; _createClass$3(Sku, [{ key: "price", get: function get() { // get rendered price and removed the currency symbol in order to support ESI return parseInt(this.priceWithCurrency.replace(/[^\d,.-]+/g, ''), 10); } /** * Gets Sku selection */ }, { key: "isSelected", get: function get() { return this._isSelected; } /** * Sets Sku selection * @param {boolean} selected */, set: function set(selected) { _setBooleanAttribute(this.el, AttributeName$2.HIDDEN, !selected); this._isSelected = selected; } }]); return Sku; }(); /** * Sku configurator component Filter */ var Filter = /*#__PURE__*/function () { /** * Initializes a new instance of Filter object */ function Filter(opts) { this.el = opts; this.input = this.el.querySelector(Selector$d.INPUT); this.relPrice = this.el.querySelector(Selector$d.REL_PRICE); this.input.addEventListener(EventName$c.ON_BLUR, this.setInputFocusChanged.bind(this)); this.input.addEventListener(EventName$c.ON_FOCUS, this.setInputFocusChanged.bind(this)); } /** * Sets/removes focused class (border) * @param {HTMLElement} el - element to set */ var _proto2 = Filter.prototype; _proto2.setInputFocusChanged = function setInputFocusChanged(e) { var el = e.currentTarget; if (el === document.activeElement) { this.el.classList.add(ClassName$7.FOCUSED); } else { this.el.classList.remove(ClassName$7.FOCUSED); } } /** * Format price difference using a template * @param {string} diffPrice - price to format */; _proto2.getFormattedDiffPrice = function getFormattedDiffPrice(diffPrice) { if (this.relPrice) { var template = this.relPrice.dataset.template; var diff = diffPrice < 0 ? '-' : '+'; var amount = Math.abs(diffPrice).toFixed(2); return Util$1.interpolateString(template, { diff: diff, amount: amount }); } return ''; } /** * Hides/shows the relatedPrice (option difference) element * @param {string} relPrice - relative price */; _proto2.setRelatedPrice = function setRelatedPrice(relatedPrice) { if (this.relPrice) { var hasRelPrice = relatedPrice !== undefined; if (hasRelPrice) { this.relPrice.removeAttribute(AttributeName$2.HIDDEN); this.relPrice.textContent = relatedPrice; } else { this.relPrice.setAttribute(AttributeName$2.HIDDEN, ''); } } }; return Filter; }(); /** * Sku configurator component Filter Group */ var FilterGroup = /*#__PURE__*/function () { /** * Initializes a new instance of Filter Group object */ function FilterGroup(opts) { var _this3 = this; var el = opts.el, index = opts.index, getNextSku = opts.getNextSku, handleFilterChange = opts.handleFilterChange; this.el = el; this._index = index; this._getNextSku = getNextSku; this.handleFilterChange = handleFilterChange; this._filterGroupValue = null; this.shouldHideDisabledFilters = false; var didFilterHideCheck = false; this.handleChange = this.handleChange.bind(this); this.el.addEventListener(EventName$c.ON_CHANGE, this.handleChange.bind(this)); this.filters = []; this.el.querySelectorAll(Selector$d.FILTER).forEach(function (filterEl) { var filter = new Filter(filterEl); // fix for 240547, filter markup changed if (filterEl.tagName === 'DIV') { filterEl.addEventListener(EventName$c.ON_CLICK, _this3.handleChange.bind(_this3)); } if (filter.input.checked) { _this3._filterGroupValue = filter.input.value; } else if (!didFilterHideCheck) { _this3.shouldHideDisabledFilters = filterEl.parentElement.getAttribute(AttributeName$2.HIDDEN) !== null; didFilterHideCheck = true; } _this3.filters.push(filter); }); } /** * Filter change event * @param {Event} e - event */ var _proto3 = FilterGroup.prototype; _proto3.handleChange = function handleChange(e) { var _e$target$querySelect; this._filterGroupValue = e.target.value || ((_e$target$querySelect = e.target.querySelector('input')) == null ? void 0 : _e$target$querySelect.value); this.handleFilterChange(this._index, this._filterGroupValue); } /** * Get a new valid filter that is associated with a SKU * @param {Array} filterValues - filter values to check * @param {string} tabIndex - Tab component that has the Skus to be checked */; _proto3.getValidFilter = function getValidFilter(filterValues, tabIndex) { var _this4 = this; var validFilterIndexes = []; var selectedFilterIndex; this.filters.forEach(function (filter, filterIndex) { var mappedFilterValues = []; for (var i = 0; i < filterValues.length; i++) { var mappedFilterValue = i === _this4._index ? filter.input.value : filterValues[i]; mappedFilterValues.push(mappedFilterValue); } if (_this4._getNextSku(mappedFilterValues, tabIndex) !== null) { validFilterIndexes.push(filterIndex); } if (filter.input.checked) { selectedFilterIndex = filterIndex; } }); if (validFilterIndexes.indexOf(selectedFilterIndex) === -1) { // First, attempt to find a lower valid index. for (var i = selectedFilterIndex - 1; i >= 0; i--) { if (validFilterIndexes.indexOf(i) !== -1) { return this.filters[i].input.value; } } // If that fails, find a higher valid index. for (var _i = selectedFilterIndex + 1; _i < this.filters.length; _i++) { if (validFilterIndexes.indexOf(_i) !== -1) { return this.filters[_i].input.value; } } return ''; } return this._filterGroupValue; } /** * Update filters (visibility and price difference) * @param {Array} filterValues - filter values to update * @param {string} tabIndex - tab control index that has the Skus * @param {object} selectedSku - Sku currently displayed */; _proto3.updateUi = function updateUi(filterValues, tabIndex, selectedSku) { var _this5 = this; this.filters.forEach(function (filter) { var isChecked = filter.input.value === filterValues[_this5._index]; var isValid = false; filter.input.checked = isChecked; if (isChecked) { isValid = true; _this5._filterGroupValue = filter.input.value; if (_this5._index === 0) { // set related price filter.setRelatedPrice(selectedSku.priceWithCurrency); } else { filter.setRelatedPrice(); } } else { var skuFilterValues = []; for (var i = 0; i < filterValues.length; i++) { var skuFilterValue = i === _this5._index ? filter.input.value : filterValues[i]; skuFilterValues.push(skuFilterValue); } var nextSku = _this5._getNextSku(skuFilterValues, tabIndex, _this5._index + 1); isValid = nextSku !== null; if (isValid) { if (_this5._index === 0) { // set related price filter.setRelatedPrice(nextSku.priceWithCurrency); } else { // set related price filter.setRelatedPrice(filter.getFormattedDiffPrice(nextSku.price - selectedSku.price)); } } else { // set related price filter.setRelatedPrice(); } } // set attribute and class _setBooleanAttribute(filter.input, AttributeName$2.DISABLED, !isValid); _setBooleanAttribute(filter.el.parentElement, AttributeName$2.HIDDEN, !isValid && _this5.shouldHideDisabledFilters); _setConditionalClass(filter.el, ClassName$7.ACTIVE, filter.input.checked); _setConditionalClass(filter.el, ClassName$7.DISABLED, !isValid); }); }; return FilterGroup; }(); /** * Sku configurator component Filter Group */ var SkuConfigurator = /*#__PURE__*/function () { /** * Initializes a new instance of Filter Group object */ function SkuConfigurator(opts) { var _this6 = this; this.el = opts.el; this._selectedSku = null; this.handleFilterChange = this.handleFilterChange.bind(this); this.getNextSku = this.getNextSku.bind(this); this._filterGroups = []; this._filterValues = []; this.el.querySelectorAll(Selector$d.FILTER_GROUP).forEach(function (item, index) { var filterGroup = new FilterGroup({ el: item, index: index, getNextSku: _this6.getNextSku, handleFilterChange: _this6.handleFilterChange }); _this6._filterGroups.push(filterGroup); _this6._filterValues.push(filterGroup._filterGroupValue); }); this.skus = []; this.el.querySelectorAll(Selector$d.SKU).forEach(function (item) { var sku = new Sku(item); if (sku.isSelected) { _this6._selectedSku = sku; } _this6.skus.push(sku); }); this.isMobileSticyDisplayed = true; this.isTabletStickyDisplayed = true; this.mobileSticky = this.el.querySelector(Selector$d.MOBILE_STICKY); this.tabletSticky = this.el.querySelector(Selector$d.TABLET_STICKY); this.stickyContainer = this.el.querySelector(Selector$d.STICKY_CONTAINER); this.hideStickyBtn = this.stickyContainer.querySelector(Selector$d.HIDE_STICKY_BTN); if (this.hideStickyBtn !== null) { this.hideStickyBtn.addEventListener(EventName$c.ON_CLICK, this.hideSticky.bind(this)); } this.updateFilterUi(); this[EventName$c.ON_REMOVE] = new CustomEvent(EventName$c.ON_REMOVE, { bubbles: true, cancelable: true }); this[EventName$c.ON_UPDATE] = new CustomEvent(EventName$c.ON_UPDATE, { bubbles: true, cancelable: true }); this.events = []; Util$1.addEvents(this.events); instances$a.push(this); } /** * Handles sticky hide */ var _proto4 = SkuConfigurator.prototype; _proto4.hideSticky = function hideSticky() { this.stickyContainer.classList.add(ClassName$7.DISPLAY_NONE); } /** * Handles filter change * @param {integer} filterGroupIndex - index of the filter group where change occurs * @param {string} newValue - new filter value */; _proto4.handleFilterChange = function handleFilterChange(filterGroupIndex, newValue) { this._filterValues[filterGroupIndex] = newValue; this.updateSelectedSku(); } /** * Update filters */; _proto4.updateFilterUi = function updateFilterUi() { var _this7 = this; this._filterGroups.forEach(function (filterGroup) { filterGroup.updateUi(_this7._filterValues, activeTabIndex, _this7._selectedSku); }); } /** * Gets next Sku * @param {Array} filterValues - filter values * @param {integer} tabIndex - tab component index where Skus are located * @param {integer} changeIndex - iteration value used for checking for new Sku if there is no Sku found for the filter values */; _proto4.getNextSku = function getNextSku(filterValues, tabIndex, changeIndex) { for (var i = 0; i < this.skus.length; i++) { var sku = this.skus[i]; if (sku.test(filterValues, tabIndex)) { return sku; } } if (changeIndex !== undefined && changeIndex < filterValues.length) { var skuFilterValues = []; for (var j = 0; j < filterValues.length; j++) { var skuFiltterValue = null; if (j === changeIndex) { skuFiltterValue = this._filterGroups[j].getValidFilter(filterValues.slice(0, j + 1), tabIndex); } else { skuFiltterValue = filterValues[j]; } skuFilterValues.push(skuFiltterValue); } return this.getNextSku(skuFilterValues, tabIndex, changeIndex + 1); } return null; } /** * Update UI with selected Sku */; _proto4.updateSelectedSku = function updateSelectedSku() { var nextSku = this.getNextSku(this._filterValues, activeTabIndex, 0); if (nextSku) { this._filterValues = nextSku._features.slice(0, this._filterValues.length); this._selectedSku.isSelected = false; this._selectedSku = nextSku; this._selectedSku.isSelected = true; this.updateFilterUi(); this.updateSticky(nextSku); } } /** * Update sticky with sku values * @param {Object} sku - sku with elements to update sticky */; _proto4.updateSticky = function updateSticky(sku) { var skuEl = sku.el; var mobileSkuPricing = skuEl.querySelector(Selector$d.SKU_MOBILE_PRICING); var mobileSkuLinkgroup = skuEl.querySelector(Selector$d.SKU_MOBILE_LINK_GROUP); var mobileSkuTitle = skuEl.querySelector(Selector$d.SKU_MOBILE_TITLE); var mobileSkuFeatures = skuEl.querySelector(Selector$d.SKU_MOBILE_FEATURES); // get productId and skuId from element id that is a combination of productId-skuId var productId = skuEl.dataset.id ? skuEl.dataset.id.split('-')[0] : null; var skuId = skuEl.dataset.id && skuEl.dataset.id.split('-').length > 1 ? skuEl.dataset.id.split('-')[1] : null; // mobile sticky if (this.isMobileSticyDisplayed && this.mobileSticky !== null) { var mobileStickyPricing = this.mobileSticky.querySelector(Selector$d.PRICING); var mobileStickyLinkGroup = this.mobileSticky.querySelector(Selector$d.LINK_GROUP); if (mobileStickyPricing !== null && mobileSkuPricing !== null) { _removeChildNodes(mobileStickyPricing); mobileStickyPricing.append(mobileSkuPricing.firstElementChild.cloneNode(true)); } if (mobileStickyLinkGroup !== null && mobileSkuLinkgroup !== null) { _removeChildNodes(mobileStickyLinkGroup); mobileStickyLinkGroup.append(mobileSkuLinkgroup.cloneNode(true)); } // update sticky productId and skuId with selected product, needed for market selector update if (productId) { this.mobileSticky.dataset.productId = productId; } if (skuId) { this.mobileSticky.dataset.skuId = skuId; } } // tablet sticky if (this.isTabletStickyDisplayed && this.tabletSticky !== null) { var tabletStickyPricing = this.tabletSticky.querySelector(Selector$d.PRICING); var tabletStickyLinkGroup = this.tabletSticky.querySelector(Selector$d.LINK_GROUP); var tabletStickyTitle = this.tabletSticky.querySelector(Selector$d.TITLE); var tabletStickyFeatures = this.tabletSticky.querySelector(Selector$d.FEATURES); if (tabletStickyPricing !== null && mobileSkuPricing !== null) { _removeChildNodes(tabletStickyPricing); tabletStickyPricing.append(mobileSkuPricing.firstElementChild.cloneNode(true)); } if (tabletStickyLinkGroup !== null && mobileSkuLinkgroup !== null) { _removeChildNodes(tabletStickyLinkGroup); tabletStickyLinkGroup.append(mobileSkuLinkgroup.cloneNode(true)); } if (tabletStickyTitle !== null && mobileSkuTitle !== null) { _removeChildNodes(tabletStickyTitle); tabletStickyTitle.append(mobileSkuTitle.cloneNode(true)); } if (tabletStickyFeatures !== null && mobileSkuFeatures !== null) { _removeChildNodes(tabletStickyFeatures); tabletStickyFeatures.append(mobileSkuFeatures.cloneNode(true)); } // update sticky productId and skuId with selected product, needed for market selector update if (productId) { this.tabletSticky.dataset.productId = productId; } if (skuId) { this.tabletSticky.dataset.skuId = skuId; } } } /** * Update instance. */; _proto4.update = function update() { this.el.dispatchEvent(this[EventName$c.ON_UPDATE]); } /** * Remove the instance */; _proto4.remove = function remove() { Util$1.removeEvents(this.events); this.el.dispatchEvent(this[EventName$c.ON_REMOVE]); var index = instances$a.indexOf(this); instances$a.splice(index, 1); } /** * Get alert instances. * @returns {Object[]} An array of alert instances */; SkuConfigurator.getInstances = function getInstances() { return instances$a; }; return SkuConfigurator; }(); var Selector$c = { DATA_MOUNT: "[data-mount='proactive-chat']", CLOSE_BUTTON: '.proactive-chat__header .btn', CANCEL_LINK: '.proactive-chat__body .link-inline', OPEN_CHAT_BUTTON: '.proactive-chat__body .btn', HEADER_TITLE: '.proactive-chat__header__title', BLOCK_FEATURE_TITLE: '.proactive-chat__body .block-feature__title' }; var Attributes$2 = { POPUP_DELAY: 'data-popup-delay' }; var EventName$b = { ON_REMOVE: 'onRemove', CLICK: 'click', KEYDOWN: 'keydown' }; /** * ProactiveChat instances */ var instances$9 = []; /** * Filters through all the AIChatDrawer instances and returns the one that matches the one on the page * @returns {AIChatDrawer} - The AIChatDrawer instance that is closest to the ProactiveChat instance */ function _getAIChatDrawerInstance() { var _window$m, _window$m$AIChatDrawe; var aiChatDrawer = document.querySelector(Selector$A.DATA_MOUNT); // Filter through all the AIChatDrawer instances and return the one that matches var ocrAiChatDrawer = AIChatDrawer.getInstances().find(function (instance) { return instance.el === aiChatDrawer; }); if (ocrAiChatDrawer) return ocrAiChatDrawer; // If there is no reimagine AI Chat Drawer, check for an m365 one return (_window$m = window.m365) == null ? void 0 : (_window$m$AIChatDrawe = _window$m.AIChatDrawer) == null ? void 0 : _window$m$AIChatDrawe.getInstances().find(function (instance) { return instance.el === aiChatDrawer; }); } /** * Set the aria-controls attribute on the Proactive Chat's elements */ function _setAriaControls() { var aiChatDrawer = this.aiChatDrawer, openChatButton = this.openChatButton, cancelLink = this.cancelLink, closeButton = this.closeButton, el = this.el; // Set the aria-controls attribute openChatButton.setAttribute('aria-controls', aiChatDrawer.el.id); cancelLink.setAttribute('aria-controls', el.id); closeButton.setAttribute('aria-controls', el.id); } /** * Update the texts on the Proactive Chat in case they weren't initialized due to a CF error * Currently only supports Option 1 */ function _updateTexts() { var isOptionTwo = this.isOptionTwo, headerTitle = this.headerTitle, blockFeatureTitle = this.blockFeatureTitle, openChatButtonTextElement = this.openChatButtonTextElement, cancelLinkTextElement = this.cancelLinkTextElement, closeButton = this.closeButton, closeButtonAriaLabel = this.closeButtonAriaLabel; // Only option 1 is supported right now if (isOptionTwo) return; // Update the texts headerTitle.textContent = this.headerTitleText; blockFeatureTitle.textContent = this.blockFeatureTitleText; if (openChatButtonTextElement) openChatButtonTextElement.textContent = this.openChatButtonText; if (cancelLinkTextElement) cancelLinkTextElement.textContent = this.cancelLinkText; // Update aria-label closeButton.setAttribute('aria-label', closeButtonAriaLabel); } var ProactiveChat = /*#__PURE__*/function () { function ProactiveChat(opts) { var _this$cancelLink, _this$openChatButton, _this$blockFeatureTit, _this$cancelLinkTextE, _this$closeButton, _this$headerTitle, _this$openChatButtonT, _this = this; this.el = opts.el; // #region opts and properties this.aiChatDrawer = opts.aiChatDrawer || _getAIChatDrawerInstance.call(this); this.blockFeatureTitle = opts.blockFeatureTitle || this.el.querySelector(Selector$c.BLOCK_FEATURE_TITLE); this.cancelLink = opts.cancelLink || this.el.querySelector(Selector$c.CANCEL_LINK); this.cancelLinkTextElement = (_this$cancelLink = this.cancelLink) == null ? void 0 : _this$cancelLink.querySelector('.link__text'); this.closeButton = opts.closeButton || this.el.querySelector(Selector$c.CLOSE_BUTTON); this.headerTitle = opts.headerTitle || this.el.querySelector(Selector$c.HEADER_TITLE); this.isOptionTwo = this.el.classList.contains('proactive-chat--option-2'); this.popupDelay = this.el.getAttribute(Attributes$2.POPUP_DELAY) || 15000; this.openChatButton = opts.openChatButton || this.el.querySelector(Selector$c.OPEN_CHAT_BUTTON); this.openChatButtonTextElement = (_this$openChatButton = this.openChatButton) == null ? void 0 : _this$openChatButton.querySelector('.btn__text'); // #endregion // #region String Defaults // Get and set the texts this.blockFeatureTitleText = ((_this$blockFeatureTit = this.blockFeatureTitle) == null ? void 0 : _this$blockFeatureTit.textContent) || 'AI-powered assistant is available 24x7.'; this.cancelLinkText = ((_this$cancelLinkTextE = this.cancelLinkTextElement) == null ? void 0 : _this$cancelLinkTextE.textContent) || 'No thanks'; this.closeButtonAriaLabel = ((_this$closeButton = this.closeButton) == null ? void 0 : _this$closeButton.getAttribute('aria-label')) || 'Close this popup'; this.headerTitleText = ((_this$headerTitle = this.headerTitle) == null ? void 0 : _this$headerTitle.textContent) || 'Can we help you?'; this.openChatButtonText = ((_this$openChatButtonT = this.openChatButtonTextElement) == null ? void 0 : _this$openChatButtonT.textContent) || 'Chat now'; _updateTexts.call(this); // #endregion // Show the popup after the delay, but only if the drawer is not visually suppressed this.popupTimeout = setTimeout(function () { // If the Drawer is visually suppressed; the Proactive Chat should also remain invisible. We do not want to allow the Proactive Chat to change the drawer's state via user interaction with Proactive Chat var isDrawerSuppressed = _this.aiChatDrawer.getIsHidden(); if (isDrawerSuppressed) return; _this.showHidePopup(true); }, this.popupDelay); // Add event listeners this.events = [{ el: this.closeButton, type: EventName$b.CLICK, handler: function handler(e) { return _this.hidePopover(e); } }, { el: this.cancelLink, type: EventName$b.CLICK, handler: function handler(e) { return _this.hidePopover(e); } }, { el: this.cancelLink, type: EventName$b.KEYDOWN, handler: function handler(e) { return _this.hidePopover(e); } }, { el: this.openChatButton, type: EventName$b.CLICK, handler: function handler(e) { return _this.openChat(e); } }]; Util$1.addEvents(this.events); // Set the aria-controls attribute _setAriaControls.call(this); instances$9.push(this); } /** * Hides the popover and sets the cookie to never show the popup again * @param {Event} e */ var _proto = ProactiveChat.prototype; _proto.hidePopover = function hidePopover(e) { var aiChatDrawer = this.aiChatDrawer; // Check if the event type is keydown and the key is neither Spacebar nor Enter if (e.type === 'keydown' && e.key !== ' ' && e.key !== 'Enter') { return; } // Set the cookie to never show the popup again aiChatDrawer.updateAIChatDrawerCookie({ hideProactiveChat: true }); this.showHidePopup(false, e); } /** * Opens the chat and hides the popup */; _proto.openChat = function openChat(e) { var aiChatDrawer = this.aiChatDrawer; this.showHidePopup(false); aiChatDrawer.isInstantiatedByProactiveChat = true; aiChatDrawer.onAiChatButtonClick(e); } /** * Show or hides the popup based on the show parameter * and if the chat has been initialized * @param {boolean} show * @param {Event} e - The event object */; _proto.showHidePopup = function showHidePopup(show, e) { var el = this.el, aiChatDrawer = this.aiChatDrawer; e == null ? void 0 : e.preventDefault(); e == null ? void 0 : e.stopPropagation(); // Get the hideProactiveChat cookie var cookie = aiChatDrawer.getAIChatDrawerCookieObject(); var hideProactiveChat = cookie == null ? void 0 : cookie.hideProactiveChat; // Only show if the chat has not been initialized and if the hideProactiveChat cookie is false show = show && !aiChatDrawer.chatInitialized && !hideProactiveChat; // Show the popup and hide the chat button and vice-versa el.classList.toggle('d-none', !show); aiChatDrawer.showChatButton(!show); } /** * Remove the event handlers and the pagination instance */; _proto.remove = function remove() { // Remove event handlers, observers, etc. Util$1.removeEvents(this.events); clearTimeout(this.popupTimeout); // Remove this reference from the array of instances. var index = instances$9.indexOf(this); instances$9.splice(index, 1); // Create and dispatch custom event this[EventName$b.ON_REMOVE] = new CustomEvent(EventName$b.ON_REMOVE, { bubbles: true }); this.el.dispatchEvent(this[EventName$b.ON_REMOVE]); } /** * Update instance. Added for API consistency * @param opts - update options */; _proto.update = function update() {} /** * @returns {ProactiveChat[]} - All the ProactiveChat instances */; ProactiveChat.getInstances = function getInstances() { return instances$9; }; return ProactiveChat; }(); var Selector$b = { DATA_MOUNT: '[data-mount="m365-progress-stepper"]', NEXT_BTN: '.next-btn .btn', PREV_BTN: '.prev-btn .btn', STEPPER_ITEM: '.stepper-item', START_OVER: '.start-over', STEP_LABEL: '.step-label', ACTIVE_STEP_TITLE: '.active-step-title' }; var ClassName$6 = { ACTIVE: 'active', COMPLETED: 'completed', DISABLED: 'disabled' }; var EventName$a = { ON_REMOVE: 'onRemove', ON_UPDATE: 'onUpdate', ON_NEXT: 'onNext', ON_PREV: 'onPrev', ON_START_OVER: 'onStartOver', ON_KEYDONW: 'onKeyDown' }; var Direction$1 = { NEXT: 'next', PREVIOUS: 'prev', START_OVER: 'start_over' }; var Attributes$1 = { ARIA_CURRENT: 'aria-current', ARIA_DISABLED: 'aria-disabled', TAB_INDEX: 'tabindex' }; var instances$8 = []; /** * enable/disable buttons based on active step */ function _enableDisableButtons() { this.nextButton.classList.remove(ClassName$6.DISABLED); this.nextButton.removeAttribute(Attributes$1.ARIA_DISABLED); this.nextButton.removeAttribute(Attributes$1.TAB_INDEX); this.previousButton.classList.remove(ClassName$6.DISABLED); this.previousButton.removeAttribute(Attributes$1.ARIA_DISABLED); this.previousButton.removeAttribute(Attributes$1.TAB_INDEX); if (this.activeStep === 1) { this.previousButton.classList.add(ClassName$6.DISABLED); this.previousButton.setAttribute(Attributes$1.ARIA_DISABLED, 'true'); this.previousButton.setAttribute(Attributes$1.TAB_INDEX, '-1'); } else if (this.activeStep === this.stepperItems.length) { this.nextButton.classList.add(ClassName$6.DISABLED); this.nextButton.setAttribute(Attributes$1.ARIA_DISABLED, 'true'); this.nextButton.setAttribute(Attributes$1.TAB_INDEX, '-1'); } } /** * set active step */ function _setActiveStep(direction, event) { var _this = this; if (event) { event.preventDefault(); } if (direction === Direction$1.NEXT) { if (this.nextButton.classList.contains(ClassName$6.DISABLED)) { return; } this.activeStep += 1; _nextBtnClick.call(this); } else if (direction === Direction$1.PREVIOUS) { if (this.previousButton.classList.contains(ClassName$6.DISABLED)) { return; } this.activeStep -= 1; _prevBtnClick.call(this); } if (!this.stepperItems[this.activeStep - 1] && this.stepperItems[0]) { this.activeStep = 1; } var stepperItems = this.stepperItems; stepperItems.forEach(function (element, index) { element.classList.remove(ClassName$6.ACTIVE, ClassName$6.COMPLETED); element.removeAttribute(Attributes$1.ARIA_CURRENT); if (index + 1 < _this.activeStep) { element.classList.add(ClassName$6.COMPLETED); } else if (index + 1 === _this.activeStep) { element.classList.remove(ClassName$6.COMPLETED); element.classList.add(ClassName$6.ACTIVE); element.setAttribute(Attributes$1.ARIA_CURRENT, 'step'); _this.activeStepTitle.innerHTML = element.stepLabel.textContent; } }); _enableDisableButtons.call(this); } function _setUpActiveStepLabel() { this.stepperItems.forEach(function (stepper) { stepper.stepLabel = stepper.querySelector(Selector$b.STEP_LABEL); }); } /** * set to default step on start over */ function _onStartOver(event) { if (event) { event.preventDefault(); } if (this.stepperItems[0]) { this.activeStep = 1; } _setActiveStep.call(this); this[EventName$a.ON_START_OVER] = new CustomEvent(EventName$a.ON_START_OVER, { bubbles: true }); this.el.dispatchEvent(this[EventName$a.ON_START_OVER]); } /** * dispatch custom event on next button click */ function _nextBtnClick(event) { if (event) { event.preventDefault(); } this[EventName$a.ON_NEXT] = new CustomEvent(EventName$a.ON_NEXT, { bubbles: true }); this.el.dispatchEvent(this[EventName$a.ON_NEXT]); } /** * dispatch custom event on previous button click */ function _prevBtnClick(event) { if (event) { event.preventDefault(); } this[EventName$a.ON_PREV] = new CustomEvent(EventName$a.ON_PREV, { bubbles: true }); this.el.dispatchEvent(this[EventName$a.ON_PREV]); } function _onKeyDownEvent(direction, event) { if (event && event.type === 'keydown' && !(event.keyCode === 32 || event.keyCode === 13)) { return; } if (direction === Direction$1.START_OVER) { _onStartOver.call(this, event); return; } if (this.el.dataset.disableBtnClicks !== 'true' && direction) { _setActiveStep.call(this, direction, event); } this[EventName$a.ON_KEYDONW] = new CustomEvent(EventName$a.ON_KEYDONW, { bubbles: true, detail: { direction: direction } }); this.el.dispatchEvent(this[EventName$a.ON_KEYDONW]); } /** * Class representing Progress stepper */ var ProgressStepperExtension = /*#__PURE__*/function () { function ProgressStepperExtension(opts) { this.el = opts.el; this.activeStep = this.el.dataset.activeStep ? Number(this.el.dataset.activeStep) : 1; this.nextButton = this.el.querySelector(Selector$b.NEXT_BTN); this.previousButton = this.el.querySelector(Selector$b.PREV_BTN); this.stepperItems = this.el.querySelectorAll(Selector$b.STEPPER_ITEM); this.activeStepTitle = this.el.querySelector(Selector$b.ACTIVE_STEP_TITLE); this.startOver = this.el.querySelector(Selector$b.START_OVER); _setUpActiveStepLabel.call(this); _setActiveStep.call(this); this.events = []; if (this.el.dataset.disableBtnClicks !== 'true') { this.events.push({ el: this.nextButton, type: 'click', handler: _setActiveStep.bind(this, Direction$1.NEXT) }, { el: this.previousButton, type: 'click', handler: _setActiveStep.bind(this, Direction$1.PREVIOUS) }); } this.events.push({ el: this.nextButton, type: 'keydown', handler: _onKeyDownEvent.bind(this, Direction$1.NEXT) }, { el: this.previousButton, type: 'keydown', handler: _onKeyDownEvent.bind(this, Direction$1.PREVIOUS) }, { el: this.startOver, type: 'keydown', handler: _onKeyDownEvent.bind(this, Direction$1.START_OVER) }, { el: this.nextButton, type: 'click', handler: _nextBtnClick.bind(this) }, { el: this.previousButton, type: 'click', handler: _prevBtnClick.bind(this) }, { el: this.startOver, type: 'click', handler: _onStartOver.bind(this) }); Util$1.addEvents(this.events); instances$8.push(this); } /** * Update instance. */ var _proto = ProgressStepperExtension.prototype; _proto.update = function update() { // Create and dispatch custom event this.activeStep = this.el.dataset.activeStep ? Number(this.el.dataset.activeStep) : 1; _setActiveStep.call(this); this[EventName$a.ON_UPDATE] = new CustomEvent(EventName$a.ON_UPDATE, { bubbles: true }); this.el.dispatchEvent(this[EventName$a.ON_UPDATE]); } /** * Remove the instance */; _proto.remove = function remove() { Util$1.removeEvents(this.events); var index = instances$8.indexOf(this); instances$8.splice(index, 1); // Create and dispatch custom event this[EventName$a.ON_REMOVE] = new CustomEvent(EventName$a.ON_REMOVE, { bubbles: true }); this.el.dispatchEvent(this[EventName$a.ON_REMOVE]); } /** * Get progress stepper instances. * @returns {Object[]} An array of progress stepper instances */; ProgressStepperExtension.getInstances = function getInstances() { return instances$8; }; return ProgressStepperExtension; }(); var EventName$9 = { CHANGE: 'change', KEYUP: 'keyup', ON_REMOVE: 'onRemove', ON_UPDATE: 'onUpdate' }; var Selector$a = { DATA_MOUNT: '[data-mount="switch"]', SWITCH_INPUT: '.custom-switch-input' }; var instances$7 = []; var _init = /*#__PURE__*/_classPrivateFieldLooseKey("init"); var _handleKeyPress = /*#__PURE__*/_classPrivateFieldLooseKey("handleKeyPress"); var Switch$1 = /*#__PURE__*/function () { /** * Create a Switch instance * @param {Object} opts - the Switch options * @param {HTMLElement} opts.el - the Switch container element */ function Switch(_ref) { var el = _ref.el; Object.defineProperty(this, _handleKeyPress, { value: _handleKeyPress2 }); Object.defineProperty(this, _init, { value: _init2 }); this.el = el; this.switchEl = this.el ? this.el.querySelector(Selector$a.SWITCH_INPUT) : null; this.events = []; if (this.el && this.switchEl) { _classPrivateFieldLooseBase(this, _init)[_init](); } instances$7.push(this); } var _proto = Switch.prototype; /** * Update instance. Added for API consistency */ _proto.update = function update() { // Create and dispatch custom event this[EventName$9.ON_UPDATE] = new CustomEvent(EventName$9.ON_UPDATE, { bubbles: true }); if (this.el) this.el.dispatchEvent(this[EventName$9.ON_UPDATE]); } /** * Remove the instance */; _proto.remove = function remove() { Util$1.removeEvents(this.events); var index = instances$7.indexOf(this); instances$7.splice(index, 1); // Create and dispatch custom event this[EventName$9.ON_REMOVE] = new CustomEvent(EventName$9.ON_REMOVE, { bubbles: true }); if (this.el) this.el.dispatchEvent(this[EventName$9.ON_REMOVE]); } /** * Get Switch instances. * @returns {Object[]} An array of Switch instances */; Switch.getInstances = function getInstances() { return instances$7; }; return Switch; }(); function _init2() { var _this$events; var switchEventHandlers = [{ el: this.switchEl, type: EventName$9.KEYUP, handler: _classPrivateFieldLooseBase(this, _handleKeyPress)[_handleKeyPress].bind(this) }]; (_this$events = this.events).push.apply(_this$events, switchEventHandlers); Util$1.addEvents(switchEventHandlers); } function _handleKeyPress2(event) { if (event.keyCode === Util$1.keyCodes.ENTER) { var _this$switchEl; event.preventDefault(); (_this$switchEl = this.switchEl) == null ? void 0 : _this$switchEl.click(); } } var EventName$8 = { CLICK: 'click', ON_REMOVE: 'onRemove', ON_UPDATE: 'onUpdate' }; var Selector$9 = { DATA_MOUNT: '[data-mount="switch"]', SWITCH_INPUT: '.custom-switch-input', LABEL_ON: '.custom-switch-status-on', LABEL_OFF: '.custom-switch-status-off' }; var Attribute$2 = { ARIA_HIDDEN: 'aria-hidden' }; var instances$6 = []; function _toggleSwitch() { var isChecked = this.switchInput.checked; if (isChecked) { this.labelOn.setAttribute(Attribute$2.ARIA_HIDDEN, false); this.labelOff.setAttribute(Attribute$2.ARIA_HIDDEN, true); } else { this.labelOff.setAttribute(Attribute$2.ARIA_HIDDEN, false); this.labelOn.setAttribute(Attribute$2.ARIA_HIDDEN, true); } } var Switch = /*#__PURE__*/function () { /** * Create a Switch instance * @param {Object} opts - the Switch options * @param {HTMLElement} opts.el - the Switch container element */ function Switch(opts) { this.el = opts.el; this.defaultSwitch = new Switch$1(opts); this.switchInput = this.el.querySelector(Selector$9.SWITCH_INPUT); this.labelOn = this.el.querySelector(Selector$9.LABEL_ON); this.labelOff = this.el.querySelector(Selector$9.LABEL_OFF); // Setting aria-hidden attribute on page load this.labelOff.setAttribute(Attribute$2.ARIA_HIDDEN, false); this.labelOn.setAttribute(Attribute$2.ARIA_HIDDEN, true); this.events = []; this.events.push({ el: this.switchInput, type: EventName$8.CLICK, handler: _toggleSwitch.bind(this) }); Util$1.addEvents(this.events); instances$6.push(this); } /** * Update instance. Added for API consistency */ var _proto = Switch.prototype; _proto.update = function update() { // Create and dispatch custom event this[EventName$8.ON_UPDATE] = new CustomEvent(EventName$8.ON_UPDATE, { bubbles: true }); if (this.el) this.el.dispatchEvent(this[EventName$8.ON_UPDATE]); } /** * Remove the instance */; _proto.remove = function remove() { Util$1.removeEvents(this.events); var index = instances$6.indexOf(this); instances$6.splice(index, 1); // Create and dispatch custom event this[EventName$8.ON_REMOVE] = new CustomEvent(EventName$8.ON_REMOVE, { bubbles: true }); if (this.el) this.el.dispatchEvent(this[EventName$8.ON_REMOVE]); } /** * Get Switch instances. * @returns {Object[]} An array of Switch instances */; Switch.getInstances = function getInstances() { return instances$6; }; return Switch; }(); var tabSliders$1 = []; var EventName$7 = { CLICK_DATA_API: 'click', RESIZE_DATA_API: 'resize', FOCUS_DATA_API: 'focus', SCROLL_DATA_API: 'scroll', ON_SCROLL: 'onScroll', ON_REMOVE: 'onRemove', ON_UPDATE: 'onUpdate' }; var Direction = { LEFT: 'left', RIGHT: 'right' }; var ClassName$5 = { ACTIVE: 'active', ARROWS: 'tab-arrows', ARROW_PREV: 'arrow-prev', ARROW_NEXT: 'arrow-next', TAB_OVERFLOW: 'tab-overflow', TAB_WINDOW: 'tab-window', TAB_GROUP: 'tab-group', JUSTIFY_CENTER: 'justify-content-center', MOBILE_ARROWS: 'mobile-arrows', IMAGE_TAB: 'tab-image', IMAGE_TAB_LABEL: 'tab-image-label' }; var Selector$8 = { ACTIVE: "." + ClassName$5.ACTIVE, ARROWS: "." + ClassName$5.ARROWS, ARROW_PREV: "." + ClassName$5.ARROW_PREV, ARROW_NEXT: "." + ClassName$5.ARROW_NEXT, TAB_OVERFLOW: "." + ClassName$5.TAB_OVERFLOW, TAB_WINDOW: "." + ClassName$5.TAB_WINDOW, TAB_GROUP: "." + ClassName$5.TAB_GROUP, DATA_MOUNT: '[data-mount="tab-slider"]', IMAGE_TAB: "." + ClassName$5.IMAGE_TAB, IMAGE_TAB_LABEL: "." + ClassName$5.IMAGE_TAB_LABEL }; var Attribute$1 = { DATA_DISABLE_SCROLL_INTO_VIEW: 'data-disable-scroll-into-view' }; var SCROLL_INTO_VIEW_OPTIONS = { inline: 'center', block: 'nearest', behavior: Util$1.prefersReducedMotion() ? 'auto' : 'smooth' }; var DELAY_MS = 100; /** * Private functions. */ /** * Helper function to check if single tab element is within tab window. * @param {HTMLElement} tab - Single tab element. * @param {HTMLElement} tabListWindow - Tab window. * @return {boolean} Returns true if the tab element is visible within the tab window. */ function _inTabWindow(tab, tabListWindow) { var tabBounds = tab.getBoundingClientRect(); var tabListWindowBounds = tabListWindow.getBoundingClientRect(); return Math.ceil(tabBounds.left) >= Math.ceil(tabListWindowBounds.left) && Math.ceil(tabBounds.right) < Math.ceil(tabListWindowBounds.right); } /** * Hide and/or show arrows dependent on visible tabs. * @this TabSlider */ function _showHideArrow() { var tabListWindow = this.el; var scrollLeftVal = this.scrollElement.scrollLeft; var arrowTarget1 = this.isRTL ? this.arrowNext : this.arrowPrev; var arrowTarget2 = this.isRTL ? this.arrowPrev : this.arrowNext; // for image tabs, match arrows height to image height var imageTab = tabListWindow.querySelector(Selector$8.IMAGE_TAB); // only need one; all are same height w/ flex styles if (imageTab) { imagesLoaded(tabListWindow, function () { var arrowTargetHeight = imageTab.offsetHeight - (imageTab.querySelector(Selector$8.IMAGE_TAB_LABEL).offsetHeight || 0); arrowTarget1.style.height = arrowTargetHeight + "px"; arrowTarget2.style.height = arrowTargetHeight + "px"; }); } if (_inTabWindow(this.tabListItems[0], tabListWindow) || !this.isRTL && scrollLeftVal === 0) { arrowTarget1.style.display = 'none'; arrowTarget2.style.display = 'block'; } else if (_inTabWindow(this.tabListItems[this.tabListItems.length - 1], tabListWindow)) { arrowTarget1.style.display = 'block'; arrowTarget2.style.display = 'none'; } else { this.arrowNext.style.display = 'block'; this.arrowPrev.style.display = 'block'; } } /** * Keep focus on clicked arrow when slider moves. * @this TabSlider */ function _onArrowFocus() { var arrowTarget1 = this.isRTL ? this.arrowNext : this.arrowPrev; var arrowTarget2 = this.isRTL ? this.arrowPrev : this.arrowNext; if (this.arrowDirection === Direction.LEFT) { if (arrowTarget1.style.display === 'block') { arrowTarget1.focus(); } else { arrowTarget2.focus(); } } else if (this.arrowDirection === Direction.RIGHT) { if (arrowTarget2.style.display === 'block') { arrowTarget2.focus(); } else { arrowTarget1.focus(); } } } /** * Event trigger on click to move the slide left or right depending on which arrow has been clicked. * @param {Event} event - DOM event. * @this TabSlider */ function _onArrowClick(event) { event.preventDefault(); this.isArrowClicked = true; _updateTabWindowWidth.call(this); // check for which arrow has been clicked if (event.target.matches(Selector$8.ARROW_NEXT)) { this.arrowDirection = this.isRTL ? Direction.LEFT : Direction.RIGHT; } else { this.arrowDirection = this.isRTL ? Direction.RIGHT : Direction.LEFT; } var slideToTarget = _getSlideToTarget.call(this); if (!slideToTarget) { return; } _setScrollLeft.call(this, slideToTarget); } /** * Set left position of tab window to left position of target element. * @param {HTMLElement} slideToTarget - Target element for position alignment. * @this TabSlider */ function _setScrollLeft(slideToTarget) { var arrowPadding = parseInt(getComputedStyle(this.arrowPrev).paddingLeft, 10) || parseInt(getComputedStyle(this.arrowNext).paddingLeft, 10); var scrollElementLeft = Math.floor(this.scrollElement.scrollLeft); var slideToTargetVal = Math.floor(_getBoundingRectValue.call(this, slideToTarget, 'left')); var scrollElementVal = Math.floor(_getBoundingRectValue.call(this, this.scrollElement, 'left')); var scrollAmount; if (this.isRTL) { if (this.arrowDirection === Direction.LEFT) { scrollAmount = scrollElementLeft + slideToTargetVal + scrollElementVal + arrowPadding; } else { scrollAmount = scrollElementLeft - slideToTargetVal - scrollElementVal + arrowPadding; } } else { scrollAmount = scrollElementLeft + slideToTargetVal - scrollElementVal - arrowPadding; } try { this.scrollElement.scrollTo({ left: scrollAmount, behavior: Util$1.prefersReducedMotion() ? 'auto' : 'smooth' }); } catch (_unused) { this.scrollElement.scrollLeft = scrollAmount; } } /** * Get tab element for scroll target positioning. * @return {Element|undefined} - element for which to set left position * @this TabSlider */ function _getSlideToTarget() { var tabTarget; var i; var widthRemaining; var tabBounds; var tabListWindowBounds = this.el.getBoundingClientRect(); if (this.arrowDirection === Direction.RIGHT) { i = this.tabListItems.length; /** * Start at right most tab and decrement until * the first tab not in the tab window is found * */ while (i--) { tabBounds = this.tabListItems[i].getBoundingClientRect(); // break if last tab is within tab window if (i === this.tabListItems.length - 1 && _inTabWindow(this.tabListItems[i], this.el)) { break; } // update to track the left most tab within the tab window if (_getBoundingRectValue.call(this, this.tabListItems[i], 'right') >= _getBoundingRectValue.call(this, this.el, 'right')) { tabTarget = this.tabListItems[i]; // update left most tab shown in tab window this.tabSlideTarget.el = tabTarget; this.tabSlideTarget.index = i; } else { break; } } } else { /** * Start at left most tab in tab window, decrement and find * out how many tabs can fit within the tab window. * */ i = this.tabSlideTarget.index; widthRemaining = tabListWindowBounds.width; if (i === -1) { return; } while (i-- && widthRemaining >= 0) { tabBounds = this.tabListItems[i].getBoundingClientRect(); // break if first tab is within tab window if (i === 0 && _inTabWindow(this.tabListItems[i], this.el)) { break; } widthRemaining -= tabBounds.width; // subtract tab width from tab window tabTarget = this.tabListItems[i]; // update left most tab shown in tab window this.tabSlideTarget.el = tabTarget; this.tabSlideTarget.index = i; // break if the tab before this tab element creates a negative value if (this.tabListItems[i - 1] && widthRemaining - this.tabListItems[i - 1].getBoundingClientRect().width < 0) { break; } } } return tabTarget; } /** * Window resize handler (also runs on instantiation). * Sets container width, shows/hides arrows depending on visible tabs, and resets * styles when slider is not needed. * @this TabSlider */ function _onWindowResize$1() { // width of tab container - left/right padding var tabContainerWidth = this.el.offsetWidth - parseInt(getComputedStyle(this.el).paddingLeft, 10) * 2; var arrowsStyleDisplay = getComputedStyle(this.arrows).display; // recalculate if tabs have changed widths from media queries, etc _updateTabWindowWidth.call(this); // don't do anything if container is large enough to hold tabs if (tabContainerWidth >= this.tabListWidth) { if (arrowsStyleDisplay === 'block' || this.tabWindow.style.width) { this.arrows.style.display = 'none'; this.tabWindow.style.width = ''; } // add justify center class if it existed if (this.tabContentCentered) { this.tabGroup.classList.add(ClassName$5.JUSTIFY_CENTER); } return; } // else: set container overflow for tabs this.tabWindow.style.width = this.tabListWidth + 'px'; // align tabs to the left when arrows appear if (this.tabContentCentered) { this.tabGroup.classList.remove(ClassName$5.JUSTIFY_CENTER); } // update tab list and last tab bounds this.tabListItems = this.el.querySelectorAll(Selector$x.ROLE_TAB); this.lastTabBounds = this.tabListItems[this.tabListItems.length - 1].getBoundingClientRect(); // show arrows when the right most tab is out of bounds of the container by 40px (arrow width) var lastTabBoundsRightVal = _getBoundingRectValue.call(this, this.tabListItems[this.tabListItems.length - 1], 'right'); var tabMountBoundsRightVal = _getBoundingRectValue.call(this, this.el, 'right'); if (arrowsStyleDisplay === 'none' && tabMountBoundsRightVal - this.arrowOffsetWidth <= lastTabBoundsRightVal - this.arrowOffsetWidth) { this.arrows.style.display = 'block'; } // hide arrows before shifting left position _showHideArrow.call(this); } /** * Focus event handler to capture selected tab and its index for positioning. * @param {Event} event - DOM focus event. * @this TabSlider */ function _onFocus(_ref) { var target = _ref.target; var focusedTab = target; if (focusedTab.matches(Selector$x.ROLE_TAB)) { focusedTab.scrollIntoView(SCROLL_INTO_VIEW_OPTIONS); // store left-most tab shown in tab window this.tabSlideTarget.el = focusedTab; this.tabSlideTarget.index = [].slice.call(this.tabListItems).indexOf(focusedTab); } } /** * Event handler to scroll tab into view (can be prevented with option). * @param {HTMLElement} tab - The selected tab element. * @param {boolean} scrollIntoView - Whether to scroll element into view. */ function _onShow(tab, scrollIntoView) { if (scrollIntoView) { tab.scrollIntoView(SCROLL_INTO_VIEW_OPTIONS); } } /** * Scroll callback to move slider if triggered by keyboard events: left/right, tab/shift+tab. * @this TabSlider */ function _onScroll() { _showHideArrow.call(this); // focus on the arrow only if an arrow was clicked (prevents keyboard presses from activating arrow focus) if (this.arrowDirection && (document.activeElement === this.arrowNext || document.activeElement === this.arrowPrev)) { _onArrowFocus.call(this); } // prevent scroll event from doing additional variable updates if (this.isArrowClicked) { this.isArrowClicked = false; return; } // store left-most tab shown in tab window for (var i = this.tabSlideTarget.index; i < this.tabListItems.length; i++) { if (this.tabListItems[i].getBoundingClientRect().left > 0) { this.tabSlideTarget.el = this.tabListItems[i]; this.tabSlideTarget.index = i; break; } } } /** * Accurately calculate all elements that make up the tab width. * @param {HTMLElement} tab - tab element * @return {number} tab width value */ function _getTabWidth(tab) { var _getComputedStyle = getComputedStyle(tab), marginLeft = _getComputedStyle.marginLeft, marginRight = _getComputedStyle.marginRight; marginLeft = Math.abs(parseInt(marginLeft, 10)) || 0; marginRight = Math.abs(parseInt(marginRight, 10)) || 0; return tab.offsetWidth + // includes borders marginLeft + marginRight; } /** * Update tab window width. * On page load, whitespace buffer is created to account for tab widths when letter-spacing increases, * but tab window should be readjusted to remove whitespace. * @this TabSlider */ function _updateTabWindowWidth() { var _this = this; this.tabListWidth = 0; this.tabListItems.forEach(function (tab) { _this.tabListWidth += _getTabWidth(tab); }); this.tabListWidth += 2 * 3; // account for outer VFIs // do not reset style on first load if (!this.isTabWindowWidthAdjusted && this.tabWindow.style.width) { this.tabWindow.style.width = this.tabListWidth + 'px'; this.isTabWindowWidthAdjusted = true; } } /** * Get left (LTR) or right (RTL) rectangle bounding value. * @param {HTMLElement} tab - tab element * @param {('left'|'right')} side - side on which to calculate position. * @return {number} - left or right bounding value of element. */ function _getBoundingRectValue(tab, side) { if (side === void 0) { side = 'left'; } var tabBounds = tab.getBoundingClientRect(); if (side === 'left') { if (this.isRTL) { var elementStyles = getComputedStyle(tab); var borderRight = parseInt(elementStyles.borderRightWidth, 10); var marginRight = parseInt(elementStyles.marginRight, 10); return Math.abs(tabBounds.right + borderRight + marginRight - window.innerWidth); } return tabBounds.left; } if (this.isRTL) { return Math.abs(tabBounds.left - window.innerWidth); } return tabBounds.right; } function _generateEvents$1() { var _this2 = this; var events = [{ el: this.arrowPrev, type: EventName$7.CLICK_DATA_API, handler: this.onPrevArrowClick }, { el: this.arrowNext, type: EventName$7.CLICK_DATA_API, handler: this.onNextArrowClick }, { el: window, type: EventName$7.RESIZE_DATA_API, handler: throttle(DELAY_MS, this.onWindowResize) }, { el: this.scrollElement, type: EventName$7.SCROLL_DATA_API, handler: throttle(DELAY_MS, this.onScrollEvent) }]; this.tabListItems.forEach(function (tab) { events.push({ el: tab, type: EventName$7.FOCUS_DATA_API, handler: _this2.onFocusEvent }, { el: tab, type: EventName$y.SHOW, handler: function handler(_event) { return _onShow(tab, _this2.scrollIntoView); } }); }); return events; } /** * Tab slider controls */ var TabSlider = /*#__PURE__*/function () { /** * Create a TabSlider instance * @param {Object} opts - The tab slider control options. * @param {HTMLElement} opts.el - The tab slider DOM node. * @param {Function} [opts.onPrevArrowClick] - Function to override the previous button click handler. * @param {Function} [opts.onNextArrowClick] - Function to override the next button click handler. * @param {Function} [opts.onWindowResize] - Function to override the resize handler. * @param {Function} [opts.onScrollEvent] - Function to override the scroll event handler. * @param {Function} [opts.onFocusEvent] - Function to override the focus event handler. * @param {boolean} [opts.scrollIntoView=true] - Whether to scroll the selected tab into view (if overflowing container). */ function TabSlider(_ref2) { var _this3 = this; var el = _ref2.el, _ref2$scrollIntoView = _ref2.scrollIntoView, scrollIntoView = _ref2$scrollIntoView === void 0 ? true : _ref2$scrollIntoView, onPrevArrowClick = _ref2.onPrevArrowClick, onNextArrowClick = _ref2.onNextArrowClick, onFocusEvent = _ref2.onFocusEvent, onScrollEvent = _ref2.onScrollEvent, onWindowResize = _ref2.onWindowResize; // select control nodes this.el = el; this.tabListItems = this.el.querySelectorAll(Selector$x.ROLE_TAB); this.scrollElement = this.el.querySelector(Selector$8.TAB_OVERFLOW); this.tabWindow = this.el.querySelector(Selector$8.TAB_WINDOW); this.tabGroup = this.el.querySelector(Selector$8.TAB_GROUP); this.tabContentCentered = this.tabGroup.classList.contains(ClassName$5.JUSTIFY_CENTER); this.arrows = this.el.querySelector(Selector$8.ARROWS); this.arrowPrev = this.el.querySelector(Selector$8.ARROW_PREV); this.arrowNext = this.el.querySelector(Selector$8.ARROW_NEXT); this.arrowOffsetWidth = parseInt(this.arrowNext.dataset.width, 10) || 40; // event controls this.onPrevArrowClick = onPrevArrowClick || _onArrowClick.bind(this); this.onNextArrowClick = onNextArrowClick || _onArrowClick.bind(this); this.onFocusEvent = onFocusEvent || _onFocus.bind(this); this.onScrollEvent = onScrollEvent || _onScroll.bind(this); this.onWindowResize = onWindowResize || _onWindowResize$1.bind(this); // internal variables this.isRTL = document.dir === 'rtl'; this.isTabWindowWidthAdjusted = false; this.isArrowClicked = false; this.arrowDirection = Direction.LEFT; this.tabListWidth = 0; this.tabListWidthBuffer = 0; // a11y fix to increase tab list window width to allow for increased letter spacing this.lastTabBounds = this.tabListItems[this.tabListItems.length - 1].getBoundingClientRect(); // keep track of tab that is on the far left of the tab window this.tabSlideTarget = { el: this.isRTL ? this.tabListItems[this.tabListItems.length - 1] : this.tabListItems[0], index: this.isRTL ? this.tabListItems.length - 1 : 0 }; this.scrollIntoView = scrollIntoView !== false && !this.el.hasAttribute(Attribute$1.DATA_DISABLE_SCROLL_INTO_VIEW); // get width of all tabs; include borders and margins this.tabListItems.forEach(function (tab) { _this3.tabListWidth += _getTabWidth(tab); }); // create a buffer of the tab window width on page load this.tabListWidth *= 1.5; // add class name to arrows for mobile only if (Util$1.detectMobile(true)) { this.arrows.classList.add(ClassName$5.MOBILE_ARROWS); } this.events = _generateEvents$1.call(this); Util$1.addEvents(this.events); tabSliders$1.push(this); this.observer = new IntersectionObserver(function (entries) { if (entries[0].isIntersecting) { _this3.onWindowResize(); } }); this.observer.observe(this.el); } /** * Remove event handlers. * @this TabSlider */ var _proto = TabSlider.prototype; _proto.remove = function remove() { Util$1.removeEvents(this.events); // Disconnect intersection observer this.observer.disconnect(); // remove this reference from array of instances var index = tabSliders$1.indexOf(this); tabSliders$1.splice(index, 1); // Create and dispatch custom event this[EventName$7.ON_REMOVE] = new CustomEvent(EventName$7.ON_REMOVE, { bubbles: true }); this.el.dispatchEvent(this[EventName$7.ON_REMOVE]); } /** * Update Tab Slider * @param {Object} [opts] - Tab Slider options. * @param {Function} [opts.onPrevArrowClick] - Function to override the previous button click handler. * @param {Function} [opts.onNextArrowClick] - Function to override the next button click handler. * @param {Function} [opts.onWindowResize] - Function to override the resize handler. * @param {Function} [opts.onScrollEvent] - Function to override the scroll event handler. * @param {Function} [opts.onFocusEvent] - Function to override the focus event handler. * @param {boolean} [opts.scrollIntoView] - Whether to scroll the selected tab into view (if overflowing container). */; _proto.update = function update(opts) { if (opts === void 0) { opts = {}; } // Remove event handlers Util$1.removeEvents(this.events); // Update opts if (opts.onPrevArrowClick) { this.onPrevArrowClick = opts.onPrevArrowClick; } if (opts.onNextArrowClick) { this.onNextArrowClick = opts.onNextArrowClick; } if (opts.onWindowResize) { this.onWindowResize = opts.onWindowResize; } if (opts.onScrollEvent) { this.onScrollEvent = opts.onScrollEvent; } if (opts.onFocusEvent) { this.onFocusEvent = opts.onFocusEvent; } if (typeof opts.scrollIntoView === 'boolean') { this.scrollIntoView = opts.scrollIntoView; } // Rebuild events array this.events = _generateEvents$1.call(this); // Add event handlers Util$1.addEvents(this.events); // Create and dispatch custom event this[EventName$7.ON_UPDATE] = new CustomEvent(EventName$7.ON_UPDATE, { bubbles: true }); this.el.dispatchEvent(this[EventName$7.ON_UPDATE]); } /** * Go to next tabs * @this TabSlider */; _proto.onClickNextArrow = function onClickNextArrow() { // Create and dispatch custom event this[EventName$7.ON_SCROLL] = new CustomEvent(EventName$7.ON_SCROLL, { bubbles: true, cancelable: true }); this.el.dispatchEvent(this[EventName$7.ON_SCROLL]); if (this[EventName$7.ON_SCROLL].defaultPrevented) { return; } this.arrowNext.click(); } /** * Go to previous tabs * @this TabSlider */; _proto.onClickPrevArrow = function onClickPrevArrow() { // Create and dispatch custom event this[EventName$7.ON_SCROLL] = new CustomEvent(EventName$7.ON_SCROLL, { bubbles: true, cancelable: true }); this.el.dispatchEvent(this[EventName$7.ON_SCROLL]); if (this[EventName$7.ON_SCROLL].defaultPrevented) { return; } this.arrowPrev.click(); } /** * Get instances. * @returns {Object} A object instance */; TabSlider.getInstances = function getInstances() { return tabSliders$1; }; return TabSlider; }(); var tabSliders = []; var ClassName$4 = { TAB_STYLE_LINK: 'tab-style-link' }; var Selector$7 = Object.assign({}, Selector$8, { DATA_MOUNT: '[data-mount="m365-horizontal-nav-tab-slider"]', ROLE_TAB_OR_TAB_STYLE_LINK: "[role=\"tab\"], ." + ClassName$4.TAB_STYLE_LINK }); var EventName$6 = { ON_REMOVE: 'onRemove' }; /** * M365 Tab slider controls for horizontal nav */ var HorizontalNavTabSliderExtension = /*#__PURE__*/function (_TabSlider) { _inheritsLoose(HorizontalNavTabSliderExtension, _TabSlider); /** * Create a TabSlider instance * @param {Object} opts - TabSlider options. * @param {HTMLElement} opts.el - TabSlider element. * @param {boolean} [opts.scrollIntoView=false] - Whether to scroll the selected tab into view (does not apply to horizontal nav). */ function HorizontalNavTabSliderExtension(_ref) { var _this; var el = _ref.el, _ref$scrollIntoView = _ref.scrollIntoView, scrollIntoView = _ref$scrollIntoView === void 0 ? false : _ref$scrollIntoView; // Change [role="tab"] selector to [role="tab"] or .tab-style-link for horizontal nav before calling super Selector$x.ROLE_TAB = Selector$7.ROLE_TAB_OR_TAB_STYLE_LINK; _this = _TabSlider.call(this, { el: el, scrollIntoView: scrollIntoView }) || this; tabSliders.push(_assertThisInitialized$1(_this)); return _this; } /** * Remove the instance */ var _proto = HorizontalNavTabSliderExtension.prototype; _proto.remove = function remove() { var index = tabSliders.indexOf(this); tabSliders.splice(index, 1); // Create and dispatch custom event this[EventName$6.ON_REMOVE] = new CustomEvent(EventName$6.ON_REMOVE, { bubbles: true }); this.el.dispatchEvent(this[EventName$6.ON_REMOVE]); } /** * Get instances. * @returns {Tab[]} Array of tab instances. */; HorizontalNavTabSliderExtension.getInstances = function getInstances() { return tabSliders; }; return HorizontalNavTabSliderExtension; }(TabSlider); /** @typedef {import('../../js/component-base').EventBinding} EventBinding */ /** @typedef {import('../../js/component-base').InitOpts} InitOpts */ /** * HTML attribute name. * @enum {string} */ var AttributeName$1 = { DATA_PARENT: 'data-parent', DISABLED: 'disabled', TAB_INDEX: 'tabindex' }; /** * CSS selector. * @enum {string} */ var Selector$6 = { DATA_MOUNT: '[data-mount="accordion-stepper"]', DATA_MOUNT_CAROUSEL: '[data-mount="m365-carousel"]', DATA_SLIDE_PREV: '[data-slide="prev"]', DATA_SLIDE_NEXT: '[data-slide="next"]', ACCORDION_BODY: '.accordion-body', COLLAPSE: '.collapse', COLLAPSE_ACTIVE: '.collapse.show' }; /** * Event name. * @enum {string} */ var EventName$5 = { CLICK: 'click', RESIZE: 'resize', BLUR: 'blur', ON_UPDATE: 'onUpdate', ON_REMOVE: 'onRemove' }; /** * Class name. * @enum {string} */ var ClassName$3 = { COLLAPSING: 'collapsing', STEPPER_CYCLE: 'stepper-cycle', NO_TRANSITION: 'no-transition' }; /** * Accordion Stepper Extension instances. * @type {AccordionStepperExtension[]} */ var instances$5 = []; /** * A wrapper function for CarouselControls's goToSlide() that removes the transition animation. * Changes the Carousel's slide to the given index immediately. * @param {number} slideIndex The index of the slide to change to. */ function _slideWithoutTransition(slideIndex) { this.slides.forEach(function (slide) { return slide.classList.add(ClassName$3.NO_TRANSITION); }); this.goToSlide(slideIndex); this.slides.forEach(function (slide) { return slide.classList.remove(ClassName$3.NO_TRANSITION); }); } /** * Handles click events for carousel buttons that are at the edge, with no more steps in the clicked direction. * @param {HTMLElement} el Accordion stepper element. * @param {Object[]} accordionChildren All children of this accordion, containing the Collapse and its child Carousel. * @param {boolean} changeLeft Whether the step is being changed in the left direction or not. */ function _handleEdgeClick(el, accordionChildren, changeLeft) { var child = accordionChildren.find(function (child) { return child.collapse.el === el.querySelector(Selector$6.COLLAPSE_ACTIVE); }); var childIndex = accordionChildren.indexOf(child); var controls = child.carousel.controls; // Return early if the click was not an edge click. if (changeLeft && !controls.prevBtn.classList.contains(ClassName$3.STEPPER_CYCLE) || !changeLeft && !controls.nextBtn.classList.contains(ClassName$3.STEPPER_CYCLE)) { _handleEdgeButtons(accordionChildren, child); return; } // Get the accordion child to switch to, or return if neither is valid. var newChild; if (changeLeft && controls.currentSlideIndex === 0) { newChild = accordionChildren[childIndex - 1]; } else if (!changeLeft && controls.currentSlideIndex === controls.slides.length - 1) { newChild = accordionChildren[childIndex + 1]; } else { return; } // Display the new child at the correct step, without a carousel slide animation. _slideWithoutTransition.bind(newChild.carousel.controls)(changeLeft ? newChild.carousel.controls.slides.length - 1 : 0); var collapseElem = newChild.collapse.el; var newButton = collapseElem.parentElement.querySelector("[data-target=\"#" + collapseElem.id + "\"]"); newButton.focus(); newChild.collapse.show(); } /** * Enables the given carousel edge button, unless it already is. * @param {HTMLElement} btn The carousel button to be enabled. */ function _enableEdgeButton(btn) { if (!btn.disabled && btn.classList.contains(ClassName$3.STEPPER_CYCLE)) { return; } btn.removeAttribute(AttributeName$1.DISABLED); btn.removeAttribute(AttributeName$1.TAB_INDEX); setTimeout(btn.classList.add.bind(btn.classList, ClassName$3.STEPPER_CYCLE)); // Add cycle class only after current event cycle. } /** * Disables the given carousel edge button, unless it already is. * @param {HTMLElement} btn The carousel button to be disabled. */ function _disableEdgeButton(btn) { if (btn.disabled) { return; } btn.setAttribute(AttributeName$1.DISABLED, ''); btn.setAttribute(AttributeName$1.TAB_INDEX, '-1'); } /** * Sets the carousel buttons for the given accordion child to have the correct classes and attributes, * based on if they are the first/last step of their carousel or the whole stepper. * @param {Object[]} accordionChildren All children of this accordion, containing the Collapse and its child Carousel. * @param {Object} currentChild The given child of the accordion. */ function _handleEdgeButtons(accordionChildren, currentChild) { var childIndex = Array.from(accordionChildren).indexOf(currentChild); var controls = currentChild.carousel.controls; // Remove stepper-cycle class from buttons that are no longer edge buttons. if (controls.currentSlideIndex !== 0) { controls.prevBtn.classList.remove(ClassName$3.STEPPER_CYCLE); } if (controls.currentSlideIndex !== controls.slides.length - 1) { controls.nextBtn.classList.remove(ClassName$3.STEPPER_CYCLE); } // Handle prev button for first step of carousel. if (controls.currentSlideIndex === 0) { var prevBtn = controls.prevBtn; if (childIndex === 0) { _disableEdgeButton(prevBtn); } else { _enableEdgeButton(prevBtn); } } // Handle next button for last step of carousel. if (controls.currentSlideIndex === controls.slides.length - 1) { var nextBtn = controls.nextBtn; if (childIndex === accordionChildren.length - 1) { _disableEdgeButton(nextBtn); } else { _enableEdgeButton(nextBtn); } } } /** * Handles changes to carousel button "disabled" attribute by calling _handleEdgeButtons() on the active accordion child. * @param {HTMLElement} el Accordion stepper element. * @param {Object[]} accordionChildren All children of this accordion, containing the Collapse and its child Carousel. * @param {MutationRecord[]} entries An array of "disabled" attribute changes from the buttonObserver. */ function _handleButtonChange(el, accordionChildren, entries) { var _loop = function _loop() { var entry = _step.value; var currentCarousel = entry.target.closest(Selector$6.DATA_MOUNT_CAROUSEL); var currentChild = accordionChildren.find(function (child) { return child.carousel.el === currentCarousel; }); _handleEdgeButtons(accordionChildren, currentChild); }; for (var _iterator = _createForOfIteratorHelperLoose$6(entries), _step; !(_step = _iterator()).done;) { _loop(); } } /** * Prevents hide functionality on the last active accordion child so one is always visible. * @param {HTMLElement[]} collapseElems Collapse component elements. * @param {CustomEvent} event Hide custom event. */ function _handleCollapseHide(collapseElems, event) { var activeCollapses = 0; for (var i = 0; i < collapseElems.length && activeCollapses < 2; i++) { if (collapseElems[i].matches(Selector$n.ACTIVES)) { activeCollapses++; } } if (activeCollapses < 2) { event.preventDefault(); } } /** * Focuses the element if it has been made focusable again. * @this {HTMLElement} The element to be focused. */ function _focusIfReenabled() { // Only apply focus if the carousel button is no longer disabled. if (!this.disabled) { this.focus(); } } /** * Refocuses the blurred carousel button if it is reenabled by next event cycle. * @param {FocusEvent} event The blur event object. */ function _handleButtonBlur(event) { // Only pass to focusIfReenabled if the carousel button lost focus when disabled. if (event.target.disabled && event.relatedTarget === null) { setTimeout(_focusIfReenabled.bind(event.target)); } } /** * Generates all events for the Accordion Stepper Extension. * @param {HTMLElement} el Accordion stepper element. * @param {Object[]} accordionChildren All children of this accordion, containing the Collapse and its child Carousel. * @returns {EventBinding[]} An array of event listeners to attach. */ function _generateEvents(el, accordionChildren) { var collapseElements = accordionChildren.map(function (child) { return child.collapse.el; }); var events = []; // Add all collapse handlers. for (var _iterator2 = _createForOfIteratorHelperLoose$6(accordionChildren), _step2; !(_step2 = _iterator2()).done;) { var child = _step2.value; events.push({ el: child.collapse.triggerElement, type: EventName$5.CLICK, handler: _slideWithoutTransition.bind(child.carousel.controls, 0) }, { el: child.collapse.el, type: EventName$n.HIDE, handler: _handleCollapseHide.bind(null, collapseElements) }); } // Add all carousel prev button handlers. for (var _iterator3 = _createForOfIteratorHelperLoose$6(el.querySelectorAll(Selector$6.DATA_SLIDE_PREV)), _step3; !(_step3 = _iterator3()).done;) { var btn = _step3.value; events.push({ el: btn, type: EventName$5.CLICK, handler: _handleEdgeClick.bind(null, el, accordionChildren, true) }, { el: btn, type: EventName$5.BLUR, handler: _handleButtonBlur }); } // Add all carousel next button handlers. for (var _iterator4 = _createForOfIteratorHelperLoose$6(el.querySelectorAll(Selector$6.DATA_SLIDE_NEXT)), _step4; !(_step4 = _iterator4()).done;) { var _btn = _step4.value; events.push({ el: _btn, type: EventName$5.CLICK, handler: _handleEdgeClick.bind(null, el, accordionChildren, false) }, { el: _btn, type: EventName$5.BLUR, handler: _handleButtonBlur }); } return events; } /** * Initializes the given Collapse, attaching buttonObserver and returning its accordion child object. * @param {HTMLElement} el Accordion stepper element. * @param {Collapse} collapse The given Collapse object to initialize. * @param {Carousel[]} carousels All instances of Carousels. * @param {MutationObserver} buttonObserver The MutationObserver to attach to the carousel buttons. * @returns {Object} The accordion child object for the Collapse and its Carousel. */ function _initializeCollapse(el, collapse, carousels, buttonObserver) { // Get data-parent id from collapse. var parentId = collapse.el.getAttribute(AttributeName$1.DATA_PARENT); // If the parent is this accordion, add the collapse and its carousel to array. if (parentId === "#" + el.id) { var carousel = carousels.find(function (item) { return item.el === collapse.el.querySelector(Selector$6.DATA_MOUNT_CAROUSEL); }); // Attach buttonObservers to carousel buttons. buttonObserver.observe(carousel.controls.prevBtn, { attributes: true, attributeFilter: [AttributeName$1.DISABLED] }); buttonObserver.observe(carousel.controls.nextBtn, { attributes: true, attributeFilter: [AttributeName$1.DISABLED] }); return { collapse: collapse, carousel: carousel }; } } /** Accordion stepper component. */ var AccordionStepperExtension = /*#__PURE__*/function (_ComponentBase) { _inheritsLoose(AccordionStepperExtension, _ComponentBase); /** * Accordion stepper element. * @type {HTMLElement} */ /** * All children of this accordion, containing the Collapse and its child Carousel. * @type {Object[]} */ /** * Mutation observer for the carousel buttons to track enable/disable. * @type {MutationObserver} */ /** * Initializes a new instance of the Stepper component. * @param {InitOpts} opts Initialization options. */ function AccordionStepperExtension(opts) { var _this; var el = opts.el; // Get and initialize children of this accordion. var accordionChildren = []; var buttonObserver = new MutationObserver(_handleButtonChange.bind(null, el, accordionChildren)); var carousels = Carousel.getInstances(); if (window.mwf) { // Should only skip in tests. window.mwf.Collapse.getInstances().forEach(function (collapse) { return accordionChildren.push(_initializeCollapse(el, collapse, carousels, buttonObserver)); }); // Filter out undefined accordionChildren from other step containers. accordionChildren.splice.apply(accordionChildren, [0, accordionChildren.length].concat(accordionChildren.filter(function (ac) { return ac !== undefined; }))); } // Generate events. var events = _generateEvents(el, accordionChildren); _this = _ComponentBase.call(this, opts, events) || this; // Assign all properties. _this.el = void 0; _this.accordionChildren = void 0; _this.buttonObserver = void 0; _this.el = el; _this.accordionChildren = accordionChildren; _this.buttonObserver = buttonObserver; return _this; } /** * Updates the options of the Stepper instance with those in opts. * @param {InitOpts} opts - Stepper options. * @this {AccordionStepperExtension} The Stepper being updated. */ var _proto = AccordionStepperExtension.prototype; _proto.update = function update(opts) { if (opts === void 0) { opts = {}; } if (opts.el) { this.el = opts.el; } // Create and dispatch custom event this[EventName$5.ON_UPDATE] = new CustomEvent(EventName$5.ON_UPDATE, { bubbles: true }); this.el.dispatchEvent(this[EventName$5.ON_UPDATE]); } /** * Removes all event listeners and references to the Stepper instance. * @this {AccordionStepperExtension} The Stepper being removed. */; _proto.remove = function remove() { Util$1.removeEvents(this.events); this.buttonObserver.disconnect(); // Remove this reference from array of instances. var index = instances$5.indexOf(this); instances$5.splice(index, 1); // Create and dispatch custom event. this[EventName$5.ON_REMOVE] = new CustomEvent(EventName$5.ON_REMOVE, { bubbles: true }); this.el.dispatchEvent(this[EventName$5.ON_REMOVE]); } /** * Gets Stepper component extension instances. * @returns {AccordionStepperExtension[]} */; AccordionStepperExtension.getInstances = function getInstances() { return instances$5; }; return AccordionStepperExtension; }(ComponentBase); /** @typedef {import('../../js/component-base').EventBinding} EventBinding */ /** @typedef {import('../../js/component-base').InitOpts} InitOpts */ /** * CSS class name. * @enum {string} */ var ClassName$2 = { DISPLAY_NONE: 'd-none', EXPANDED: 'expanded', GLYPH_PREPEND_ADD: 'glyph-prepend-add', GLYPH_PREPEND_CANCEL: 'glyph-prepend-cancel', SHOW: 'show' }; /** * Event name. * @enum {string} */ var EventName$4 = { BLUR: 'blur', CLICK: 'click', FOCUS: 'focus', MOUSE_ENTER: 'mouseenter', MOUSE_LEAVE: 'mouseleave' }; /** * CSS selector. * @enum {string} */ var Selector$5 = { DATA_MOUNT: '[data-mount="expandable-card"]', FADE: '.fade', FOCUS_OR_HOVER: ':focus, :hover' }; /** * Gets the collapse instance corresponding to the provided element. * * @param {HTMLElement} collapseElem Collapse element. * @returns Collapse instance. */ function _getCollapseInstance(collapseElem) { var collapseInstances = window.mwf.Collapse.getInstances(); for (var _iterator = _createForOfIteratorHelperLoose$6(collapseInstances), _step; !(_step = _iterator()).done;) { var element = _step.value; var collapseInstance = element; if (collapseInstance.el === collapseElem) { return collapseInstance; } } return null; } /** * Handles click events on the card. * * @param {HTMLElement} cardElem Card element. * @param {HTMLButtonElement} collapseButton Collapse button. */ function _handleCardClick(cardElem, collapseButton) { if (!cardElem.classList.contains(ClassName$2.EXPANDED)) { collapseButton.click(); if (!collapseButton.classList.contains(ClassName$2.DISPLAY_NONE)) { collapseButton.focus({ preventScroll: true }); } } } /** * Handles hover state changes on the card. * * @param {HTMLElement} cardElem Card element. * @param {HTMLElement} collapseElem Collapse element. */ function _handleCardHover(cardElem, collapseElem) { if (cardElem.classList.contains(ClassName$2.EXPANDED) !== cardElem.matches(Selector$5.FOCUS_OR_HOVER)) { _getCollapseInstance(collapseElem).toggle(); } } /** * * @param {HTMLElement} cardElem Card element. * @param {HTMLButtonElement} collapseButton Collapse button. * @param {NodeListOf} fadeElems Fading elements. * @param {boolean} isExpanded If the collapse is expanded. * @param {CustomEvent} event Collapse event. */ function _handleCollapseToggle(cardElem, collapseButton, fadeElems, isExpanded, event) { if (!event.defaultPrevented) { cardElem.classList.toggle(ClassName$2.EXPANDED, isExpanded); collapseButton.classList.toggle(ClassName$2.GLYPH_PREPEND_ADD, !isExpanded); collapseButton.classList.toggle(ClassName$2.GLYPH_PREPEND_CANCEL, isExpanded); fadeElems.forEach(function (fadeElem) { return fadeElem.classList.toggle(ClassName$2.SHOW, !isExpanded); }); if (isExpanded && cardElem.tabIndex !== 0 && cardElem.dataset.scrollOnExpand !== undefined) { var cardElemRect = cardElem.getBoundingClientRect(); if (cardElemRect.bottom > cardElemRect.height) { cardElem.scrollIntoView(false); } } } } /** * Expandable Card instances. * @type {ExpandableCard[]} */ var instances$4 = []; /** Expandable Card component extension. */ var ExpandableCard = /*#__PURE__*/function (_ComponentBase) { _inheritsLoose(ExpandableCard, _ComponentBase); /** * Initializes a new instance of the Expandable Card component. * @param {InitOpts} opts Initialization options. */ function ExpandableCard(opts) { var collapseButton = opts.el.querySelector(Selector$n.DATA_MOUNT); var fadeElems = opts.el.querySelectorAll(Selector$5.FADE); var collapse = document.querySelector(collapseButton.dataset.target); var events = [{ el: collapse, handler: _handleCollapseToggle.bind(null, opts.el, collapseButton, fadeElems, false), type: EventName$n.HIDE }, { el: collapse, handler: _handleCollapseToggle.bind(null, opts.el, collapseButton, fadeElems, true), type: EventName$n.SHOW }]; if (collapseButton.classList.contains(ClassName$2.DISPLAY_NONE)) { events.push({ el: opts.el, handler: _handleCardHover.bind(null, opts.el, collapse), type: EventName$4.MOUSE_ENTER }, { el: opts.el, handler: _handleCardHover.bind(null, opts.el, collapse), type: EventName$4.MOUSE_LEAVE }, { el: opts.el, handler: _handleCardHover.bind(null, opts.el, collapse), type: EventName$4.FOCUS }, { el: opts.el, handler: _handleCardHover.bind(null, opts.el, collapse), type: EventName$4.BLUR }, { el: collapse, handler: _handleCardHover.bind(null, opts.el, collapse), type: EventName$n.HIDDEN }, { el: collapse, handler: _handleCardHover.bind(null, opts.el, collapse), type: EventName$n.SHOWN }); } else { events.push({ el: opts.el, handler: _handleCardClick.bind(null, opts.el, collapseButton), type: EventName$4.CLICK }); } return _ComponentBase.call(this, opts, events) || this; } /** * Gets Expandable Card component extension instances. * @returns {ExpandableCard[]} */ ExpandableCard.getInstances = function getInstances() { return instances$4; }; return ExpandableCard; }(ComponentBase); var _EventName$ON_COMPLET, _EventName$ON_FAIL, _EventName$ON_SUCCESS; /** @typedef {import('../../js/component-base').EventBinding} EventBinding */ /** @typedef {import('../../js/component-base').InitOpts} InitOpts */ /** * Pricing Container component instances. * @type {PricingContainer[]} */ var instances$3 = []; /** * JS event name. * @enum {string} */ var EventName$3 = { ON_COMPLETE: 'onComplete', ON_FAIL: 'onFail', ON_SUCCESS: 'onSuccess' }; /** * CSS selector. * @enum {string} */ var Selector$4 = { AVAILABLE_CLASSES: '[data-available-classes]', DATA_MOUNT: '[data-mount="pricing-container"]', DISCOUNTED_ATTRS: '[data-discounted-attrs]', DISCOUNTED_CLASSES: '[data-discounted-classes]', DISCOUNTED_TEXT_TEMPLATE: '[data-discounted-text-template]', DISCOUNT_PRICE: '.oc-discount-price', LIST_PRICE: '.oc-list-price', MSRP_PRICE: '.oc-msrp-price', PRODUCT_PRICE_OVERRIDE: '[data-product-price-override]', TITLE: '.oc-product-title,.oc-title', UNAVAILABLE_CLASSES: '[data-unavailable-classes]', UNDISCOUNTED_ATTRS: '[data-undiscounted-attrs]', UNDISCOUNTED_CLASSES: '[data-undiscounted-classes]', OC_PRODUCT_PURCHASE_MAIN: '[data-oc-product*=main]', OC_PRODUCT_PURCHASE: '[data-oc-product*=purchase]:not([data-oc-product*=main]', SKU_LIST_TABLE: '.oc-sku-list-table-component', SKU_CARD_W365: '.oc-sku-card-w365', MARKET_SELECTOR: '.market-selector', W365_COMPONENT_MODAL: '.oc-modal', W365_COMPONENT_MODAL_PRICE: '.oc-modal-price', W365_COMPONENT_HYBRID_PRICE: '.oc-hybrid-price', W365_COMPONENT_NON_HYBRID_PRICE: '.oc-non-hybrid-price', W365_COMPONENT_PRICE_DIFFERENCE: '.oc-price-difference', W365_COMPONENT_CURRENCY: '.oc-currency-code' }; /** * Attributes * @enum {string} */ var Attribute = { DATA_OC_PRODUCT: 'data-oc-product' }; /** * Handles a Market Selector being refreshed. * @param {HTMLElement} pricingContainerElem Pricing Container element. * @param {CustomEvent} e Refresh event. */ function handleMarketSelectorRefreshed(_x, _x2) { return _handleMarketSelectorRefreshed.apply(this, arguments); } /** * Update price * @param {JSON Object} product JSON product object * @param {HTMLElement} productElem Pricing Container element. */ function _handleMarketSelectorRefreshed() { _handleMarketSelectorRefreshed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(pricingContainerElem, e) { var _pricingContainerElem, ajaxEndpoint, productId, skuRequest, productRequestString, productResponseMock, isProductAvailable, currencyCode, serviceRequestStringList; return _regeneratorRuntime().wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: if (!((e == null ? void 0 : e.detail.refresh) === true)) { _context2.next = 19; break; } _context2.prev = 1; _pricingContainerElem = pricingContainerElem.dataset, ajaxEndpoint = _pricingContainerElem.ajaxEndpoint, productId = _pricingContainerElem.productId, skuRequest = _pricingContainerElem.skuRequest, productRequestString = _pricingContainerElem.productRequest, productResponseMock = _pricingContainerElem.productResponseMock; if (!productRequestString) { _context2.next = 11; break; } isProductAvailable = false; // for W365 components data attribute productRequest (data-product-request) has multiple request strings separated by '|'. // this is done in order to support W365 scenario when more than 24 products (Big Cat limitation) are present in a component. // make multiple Ajax calls if needed serviceRequestStringList = productRequestString.split('|'); _context2.next = 8; return Promise.all(serviceRequestStringList.map( /*#__PURE__*/function () { var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(serviceRequestString) { var responseJson, requestData, localeAttributes, requestString; return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: if (!ajaxEndpoint) { _context.next = 11; break; } requestData = serviceRequestString.split('&').filter(function (elem) { return elem !== ''; }); localeAttributes = requestData[1].split('-'); localeAttributes[1] = new window.URLSearchParams(window.location.search).get('market'); requestData[1] = localeAttributes.join('-'); requestString = requestData.join('&'); _context.next = 8; return window.fetch(ajaxEndpoint + "?" + requestString, { headers: { 'Content-Type': 'application/json' }, method: 'GET' }).then(function (response) { return response.json(); }); case 8: responseJson = _context.sent; _context.next = 12; break; case 11: responseJson = JSON.parse(window.decodeURIComponent(productResponseMock)); case 12: responseJson.forEach(function (product) { var productIdUpperCase = product.productId.toUpperCase(); // Get response query / PUID from fetched product response JSON var responseQuery = product.puid.toLowerCase(); if (productId === productIdUpperCase) { // Best case scenario, match the pricing element with product response by PUID if (skuRequest) { if (skuRequest === responseQuery) { _updatePrice(product, pricingContainerElem); } // When the data-sku-request is not present on the pricing element // In this case, pricing element will be updated by matching with product id from product response data. // TODO: remove this condition once all pricing components are verified using data-sku-request / PUID. } else { _updatePrice(product, pricingContainerElem); } } else { // Find all the product pricing elements that matches productId from response // Since tokens do not have the data-sku-request attribute, cannot query pricing elements by "data-sku-request" yet // i.e., data-sku-request = encodedQuery/PUID is not configured for pricing tokens yet pricingContainerElem.querySelectorAll("[data-product-id=\"" + productIdUpperCase + "\"]") // TODO: use data-sku-request instead after pricing-tokens are updated in AEM .forEach(function (productElement) { // For current product/pricing element/token, // In order of priority, first look for "data-sku-request" attribute since it is a unique identifier // 1. If the current pricing element's PUID matches with the PUID from product pricing response data // There is a bug with this scenario when the pricing component is authored with alternate products // it fails to match due to the response query is missing the alternate product config from PUID // Remarks - to be fixed from data connector to match response PUID with pricing element's PUID if (productElement.hasAttribute('data-sku-request')) { var encodedQuery = productElement.getAttribute('data-sku-request').toLowerCase(); if (encodedQuery === responseQuery) { // Update pricing element, this is the best case scenario as the PUID is always unique // Updates the correct response data into respective pricing element/token _updatePrice(product, productElement); } } // 2. Next, try to match with the SKU id from the response data with pricing element's sku id from "data-sku-id" attribute // Note: matching by sku id works in most cases except few edge cases // If multiple pricing components are authored with same product but one of them does not have sku // If mutliple same products with alternate configurations with same product id but different sku id // If the product pricing response data is either unavailable or disabled-market or not success // This would either cause the pricing element to render unavailable message, incorrectly update or not update at all // Remarks - this scenario is to be removed once all the pricing elements have "data-sku-request" attribute available // This condition is only evaluated if there is sku id available from response data i.e., it is success response else if (product.sku && productElement.hasAttribute('data-sku-id')) { var productSkuId = productElement.getAttribute('data-sku-id').toUpperCase(); var responseSkuId = product.sku.id.toUpperCase(); // check for product sku, for product not available sku is null if (productSkuId === responseSkuId) { // productId and skuId _updatePrice(product, productElement); } // _updateResponseCode(productElement, product.responseCode); is already handled in _updatePrice // _updateAvailability(productElement, false); is already being handled in _updatePrice } // 3. As a last resort, worst case scenario, rely on the "data-product-id" that matched with product id from response data // This is almost certain to cause issues by rendering incorrect sku id within the current pricing element // for e.g., if the page has multiple pricing elements authored with same product id but different/unique sku ids // Remarks - this else scenario is to be removed once all the pricing elements have "data-sku-request" attribute available else { // Note - this else scenario is error prone here // The product id from response data has matched here but sku id or puid does not match // There is no way to know whether the response data was intended for this pricing element or not // If there is no sku, thus product not available, update availability _updatePrice(product, productElement); } }); } if (product.sku) { isProductAvailable = true; currencyCode = product.sku.currencyCode; _updateW365ModalPrice(product, Selector$4.SKU_LIST_TABLE); _updateW365ModalPrice(product, Selector$4.SKU_CARD_W365); } }); case 13: case "end": return _context.stop(); } } }, _callee); })); return function (_x3) { return _ref.apply(this, arguments); }; }())); case 8: _updateSkuListTable(isProductAvailable); if (isProductAvailable) { _updateW365ModalPriceDifference(Selector$4.SKU_LIST_TABLE); _updateW365ModalPriceDifference(Selector$4.SKU_CARD_W365); if (currencyCode) { _updateW365ModalCurrency(Selector$4.SKU_LIST_TABLE, currencyCode); _updateW365ModalCurrency(Selector$4.SKU_CARD_W365, currencyCode); } } pricingContainerElem.dispatchEvent(PricingContainer[EventName$3.ON_SUCCESS]); case 11: _context2.next = 16; break; case 13: _context2.prev = 13; _context2.t0 = _context2["catch"](1); pricingContainerElem.dispatchEvent(PricingContainer[EventName$3.ON_FAIL]); case 16: _context2.prev = 16; pricingContainerElem.dispatchEvent(PricingContainer[EventName$3.ON_COMPLETE]); return _context2.finish(16); case 19: case "end": return _context2.stop(); } } }, _callee2, null, [[1, 13, 16, 19]]); })); return _handleMarketSelectorRefreshed.apply(this, arguments); } function _updatePrice(product, productElem) { var isAvailable = Boolean(product.sku); var availableClassesElems = productElem.querySelectorAll(Selector$4.AVAILABLE_CLASSES); var discountedAttrElems = productElem.querySelectorAll(Selector$4.DISCOUNTED_ATTRS); var discountedClassElems = productElem.querySelectorAll(Selector$4.DISCOUNTED_CLASSES); var discountedTextTemplateElems = productElem.querySelectorAll(Selector$4.DISCOUNTED_TEXT_TEMPLATE); var discountPrice = isAvailable ? product.sku.displayDiscountPrice : ''; var discountPriceElem = productElem.querySelector(Selector$4.DISCOUNT_PRICE); var listPrice = isAvailable ? product.sku.displayListPrice : ''; var listPriceElem = productElem.querySelector(Selector$4.LIST_PRICE); var msrpPrice = isAvailable ? product.sku.displayMSRPPrice : ''; var msrpPriceElem = productElem.querySelector(Selector$4.MSRP_PRICE); var unavailableClassesElems = productElem.querySelectorAll(Selector$4.UNAVAILABLE_CLASSES); var undiscountedAttrElems = productElem.querySelectorAll(Selector$4.UNDISCOUNTED_ATTRS); var undiscountedClassesElems = productElem.querySelectorAll(Selector$4.UNDISCOUNTED_CLASSES); var productPriceOverrideElem = productElem.querySelector(Selector$4.PRODUCT_PRICE_OVERRIDE); var ocProductMainElem = productElem.querySelector(Selector$4.OC_PRODUCT_PURCHASE_MAIN); var ocProductPurchaseElems = productElem.querySelectorAll(Selector$4.OC_PRODUCT_PURCHASE); var productPriceOverride = productPriceOverrideElem && productPriceOverrideElem.getAttribute('data-product-price-override') === 'true'; var isDiscounted = listPrice !== msrpPrice; var discountAttrElems = isDiscounted ? discountedAttrElems : undiscountedAttrElems; var titleElem = productElem.querySelector(Selector$4.TITLE); if (ocProductMainElem) { var ocProductList = ocProductMainElem.getAttribute(Attribute.DATA_OC_PRODUCT).split(' '); if (ocProductList.length > 2) { ocProductList[2] = product.responseCode; ocProductMainElem.dataset.ocProduct = ocProductList.join(' '); } } ocProductPurchaseElems.forEach(function (elem) { var ocProductList = elem.getAttribute(Attribute.DATA_OC_PRODUCT).split(' '); ocProductList[1] = product.responseCode; elem.dataset.ocProduct = ocProductList.join(' '); }); availableClassesElems.forEach(function (elem) { var availableClasses = elem.dataset.availableClasses.split(' '); availableClasses.forEach(function (className) { return elem.classList.toggle(className, isAvailable); }); }); discountedClassElems.forEach(function (elem) { var discountedClasses = elem.dataset.discountedClasses.split(' '); discountedClasses.forEach(function (className) { return elem.classList.toggle(className, isDiscounted); }); }); unavailableClassesElems.forEach(function (elem) { var unavailableClasses = elem.dataset.unavailableClasses.split(' '); unavailableClasses.forEach(function (className) { return elem.classList.toggle(className, !isAvailable); }); }); undiscountedClassesElems.forEach(function (elem) { var undiscountedClasses = elem.dataset.undiscountedClasses.split(' '); undiscountedClasses.forEach(function (className) { return elem.classList.toggle(className, !isDiscounted); }); }); discountAttrElems.forEach(function (elem) { var attrsString = isDiscounted ? elem.dataset.discountedAttrs : elem.dataset.undiscountedAttrs; var attrs = attrsString.split(' ').map(function (attr) { return attr.split(':'); }); attrs.forEach(function (attr) { elem.setAttribute(attr[0], attr[1]); }); }); if (isAvailable && titleElem) { var title = product.sku && product.sku.title ? product.sku.title : product.title; // set product title data attribute for buybox title if (titleElem.classList.contains('oc-buybox-title')) { titleElem.dataset.productTitle = title; } while (titleElem.firstElementChild) { titleElem = titleElem.firstElementChild; } titleElem.textContent = title; } if (!productPriceOverride) { if (discountPriceElem) { discountPriceElem.textContent = discountPrice; } if (listPriceElem) { listPriceElem.textContent = listPrice; } if (msrpPriceElem) { msrpPriceElem.textContent = msrpPrice; } if (isDiscounted) { discountedTextTemplateElems.forEach(function (elem) { elem.textContent = Util$1.interpolateString(elem.dataset.discountedTextTemplate, { listPrice: listPrice, msrpPrice: msrpPrice }); }); } } } /** * Update w365 modal price * @param {JSON Object} product JSON product object * @param {String} componentSelector component selector */ function _updateW365ModalPrice(product, componentSelector) { // W365 modal has price difference between non-hybrid and hybrid products along with currency code // update those pricing elements with data from JSON object var modalPricingElements = document.querySelectorAll(componentSelector + ' ' + Selector$4.W365_COMPONENT_MODAL + ' ' + Selector$4.W365_COMPONENT_MODAL_PRICE + "[data-product-id='" + product.productId + "'][data-sku-id='" + product.sku.id + "']"); modalPricingElements.forEach(function (modalPricingElement) { if (product.sku.listPrice) { modalPricingElement.textContent = product.sku.listPrice; } }); } /** * Update w365 component modal currency code * @param {String} componentSelector component selector * @param {String} currencyCode currency code */ function _updateW365ModalCurrency(componentSelector, currencyCode) { // update currency code var currencyElements = document.querySelectorAll(componentSelector + ' ' + Selector$4.W365_COMPONENT_MODAL + ' ' + Selector$4.W365_COMPONENT_CURRENCY); currencyElements.forEach(function (currencyElement) { currencyElement.textContent = currencyCode; }); } /** * Update w365 component modal price difference between non-hybrid and hybrid products * @param {String} w365Selector component selector */ function _updateW365ModalPriceDifference(w365Selector) { var w365Components = document.querySelectorAll(w365Selector); if (!w365Components || w365Components && w365Components.length < 1) { return; } w365Components.forEach(function (w365Component) { w365Component.querySelectorAll(Selector$4.W365_COMPONENT_MODAL).forEach(function (modal) { var hybridPriceElement = modal.querySelector(Selector$4.W365_COMPONENT_HYBRID_PRICE); var nonHybridPriceElement = modal.querySelector(Selector$4.W365_COMPONENT_NON_HYBRID_PRICE); var priceDifferenceElement = modal.querySelector(Selector$4.W365_COMPONENT_PRICE_DIFFERENCE); if (hybridPriceElement && nonHybridPriceElement && priceDifferenceElement) { var hybridPrice = parseFloat(hybridPriceElement.textContent); var nonHybridPrice = parseFloat(nonHybridPriceElement.textContent); if (!isNaN(hybridPrice) && !isNaN(nonHybridPrice)) { // price difference with two decimals var priceDifference = (nonHybridPrice - hybridPrice).toFixed(2); priceDifferenceElement.textContent = priceDifference; } } }); }); } /** * Update sku list table * @param {Boolean} isAvailable available flag */ function _updateSkuListTable(isAvailable) { // sku list table has multiple products with different skus. // when products are not available the whole table is hidden and a message is displayed // available/unavailable classes data attributes are set at the table level var skuListTable = document.querySelector(Selector$4.SKU_LIST_TABLE); if (skuListTable) { _updateAvailability(skuListTable, isAvailable); } } /** * Update availability * @param {HTMLElement} containerElement Pricing Container element. * @param {Boolean} isAvailable available flag */ function _updateAvailability(containerElement, isAvailable) { var availableClassesElems = containerElement.querySelectorAll(Selector$4.AVAILABLE_CLASSES); var unavailableClassesElems = containerElement.querySelectorAll(Selector$4.UNAVAILABLE_CLASSES); availableClassesElems.forEach(function (elem) { var availableClasses = elem.dataset.availableClasses.split(' '); availableClasses.forEach(function (className) { return elem.classList.toggle(className, isAvailable); }); }); unavailableClassesElems.forEach(function (elem) { var unavailableClasses = elem.dataset.unavailableClasses.split(' '); unavailableClasses.forEach(function (className) { return elem.classList.toggle(className, !isAvailable); }); }); } /** Pricing Container component. */ _EventName$ON_COMPLET = EventName$3.ON_COMPLETE; _EventName$ON_FAIL = EventName$3.ON_FAIL; _EventName$ON_SUCCESS = EventName$3.ON_SUCCESS; var PricingContainer = /*#__PURE__*/function (_ComponentBase) { _inheritsLoose(PricingContainer, _ComponentBase); /** onComplete event. */ /** onFail event. */ /** onSuccess event. */ /** * Initializes a new instance of the Pricing Container component. * @param {InitOpts} opts Initialization options. */ function PricingContainer(opts) { var _this; /** @type {EventBinding[]} */ var events = [{ el: document.body, handler: handleMarketSelectorRefreshed.bind(null, opts.el), type: EventName$z.ON_REFRESHED }]; _this = _ComponentBase.call(this, opts, events) || this; // remove the market query parameter in URL when there is no market selector if (!document.querySelector(Selector$4.MARKET_SELECTOR)) { var url = new window.URL(window.location.href); url.searchParams["delete"]('market'); window.history.replaceState({}, ' ', url); } return _this; } /** * Gets Pricing Container component instances. * @returns {PricingContainer[]} */ PricingContainer.getInstances = function getInstances() { return instances$3; }; return PricingContainer; }(ComponentBase); PricingContainer[_EventName$ON_COMPLET] = new CustomEvent(EventName$3.ON_COMPLETE, { bubbles: true, cancelable: true }); PricingContainer[_EventName$ON_FAIL] = new CustomEvent(EventName$3.ON_FAIL, { bubbles: true, cancelable: true }); PricingContainer[_EventName$ON_SUCCESS] = new CustomEvent(EventName$3.ON_SUCCESS, { bubbles: true, cancelable: true }); /** @typedef {import('../../js/component-base').EventBinding} EventBinding */ /** @typedef {import('../../js/component-base').InitOpts} InitOpts */ /** * HTML attribute name. * @enum {string} */ var AttributeName = { DATA_STEP_COUNT: 'data-step-count' }; /** * CSS selector. * @enum {string} */ var Selector$3 = { DATA_MOUNT: '[data-mount="carousel-stepper"]', STEPPER: '.stepper', COLLAPSE: '.collapse', CAROUSEL_ITEM: '.carousel-item', CAROUSEL_ITEM_ACTIVE: '.carousel-item.active', STEP_COUNT: '.step-count' }; /** * Event name. * @enum {string} */ var EventName$2 = { ON_UPDATE: 'onUpdate', ON_REMOVE: 'onRemove' }; /** * Class name. * @enum {string} */ var ClassName$1 = { SLIDING_IN: 'sliding-in', SHOW: 'show' }; /** * Stepper Carousel Controls instances. * @type {StepCarouselControls[]} */ var instances$2 = []; /** * Updates the text of the current step display in the carousel controls. * Uses the template given in data-step-count to position the current step and number of steps. * @param {HTMLElement} el Carousel root element. */ function _setStepText(el) { var stepText = el.querySelector(Selector$3.STEP_COUNT); var steps = el.querySelectorAll(Selector$3.CAROUSEL_ITEM); var activeStep = el.querySelector(Selector$3.CAROUSEL_ITEM_ACTIVE); var currentStep = Array.from(steps).indexOf(activeStep) + 1; var totalSteps = steps.length; var stepObject = { currentStep: currentStep, totalSteps: totalSteps }; var newText = Util$1.interpolateString(stepText.getAttribute(AttributeName.DATA_STEP_COUNT), stepObject); stepText.textContent = newText; } /** * Handles changes to a slide's classes to see if a slide has finished changing. * This is represented by the "sliding-in" class being removed. * @param {MutationRecord[]} entries An array of class changes from the slideChangeObserver. */ function _handleClassChange(entries) { for (var _iterator = _createForOfIteratorHelperLoose$6(entries), _step; !(_step = _iterator()).done;) { var entry = _step.value; if (!entry.oldValue.includes(ClassName$1.SLIDING_IN) || entry.target.classList.contains(ClassName$1.SLIDING_IN)) { continue; } var el = entry.target.closest(Selector$3.DATA_MOUNT); _setStepText(el); } } /** * Handles resizing of the Carousel by adjusting the size of the outer Stepper element as well. * @param {ResizeObserverEntry[]} entries An array of size changes from the resizeObserver. */ function _handleResize(entries) { for (var _iterator2 = _createForOfIteratorHelperLoose$6(entries), _step2; !(_step2 = _iterator2()).done;) { var entry = _step2.value; if (!entry.target.parentElement.classList.contains(ClassName$1.SHOW)) { continue; } var parentCollapse = entry.target.closest(Selector$3.COLLAPSE); var _parentCollapse$getBo = parentCollapse.getBoundingClientRect(), height = _parentCollapse$getBo.height; var stepper = entry.target.closest(Selector$3.STEPPER); var parentCollapsePosition = getComputedStyle(parentCollapse).position; stepper.style.height = 'auto'; // Set height to auto so we can get its original height. if (parentCollapsePosition === 'absolute') { stepper.style.height = stepper.clientHeight + height + "px"; // Add the carousel's height to the original height. } } } /** Step Carousel Controls component. */ var StepCarouselControls = /*#__PURE__*/function (_ComponentBase) { _inheritsLoose(StepCarouselControls, _ComponentBase); /** * Carousel root element. * @type {HTMLElement} */ /** * Mutation observer for the carousel slides to track slide changes. * @type {MutationObserver} */ /** * Resize observer for the carousel to adjust Stepper height. * @type {ResizeObserver} */ /** * Initializes a new instance of the Stepper component. * @param {InitOpts} opts Initialization options. */ function StepCarouselControls(opts) { var _this; var el = opts.el; // Attach slideChangeObserver to all Carousel slides. var slideChangeObserver = new MutationObserver(_handleClassChange); for (var _iterator3 = _createForOfIteratorHelperLoose$6(el.querySelectorAll(Selector$3.CAROUSEL_ITEM)), _step3; !(_step3 = _iterator3()).done;) { var slide = _step3.value; slideChangeObserver.observe(slide, { attributes: true, attributeFilter: ['class'], attributeOldValue: true }); } _this = _ComponentBase.call(this, opts, []) || this; _this.el = void 0; _this.slideChangeObserver = void 0; _this.resizeObserver = void 0; _this.el = el; _this.slideChangeObserver = slideChangeObserver; // Create and attach observers. Should only skip in tests. if (window.ResizeObserver) { var resizeObserver = new ResizeObserver(_handleResize); resizeObserver.observe(el); _this.resizeObserver = resizeObserver; } return _this; } /** * Updates the options of the Stepper instance with those in opts. * @param {InitOpts} opts - Stepper options. * @this {StepCarouselControls} The Stepper being updated. */ var _proto = StepCarouselControls.prototype; _proto.update = function update(opts) { if (opts === void 0) { opts = {}; } if (opts.el) { this.el = opts.el; } // Create and dispatch custom event this[EventName$2.ON_UPDATE] = new CustomEvent(EventName$2.ON_UPDATE, { bubbles: true }); this.el.dispatchEvent(this[EventName$2.ON_UPDATE]); } /** * Removes all event listeners and references to the Stepper instance. * @this {AccordionStepperExtension} The Stepper being removed. */; _proto.remove = function remove() { Util$1.removeEvents(this.events); this.slideChangeObserver.disconnect(); if (this.resizeObserver) { this.resizeObserver.disconnect(); } // Remove this reference from array of instances. var index = instances$2.indexOf(this); instances$2.splice(index, 1); // Create and dispatch custom event. this[EventName$2.ON_REMOVE] = new CustomEvent(EventName$2.ON_REMOVE, { bubbles: true }); this.el.dispatchEvent(this[EventName$2.ON_REMOVE]); } /** * Gets Stepper component extension instances. * @returns {AccordionStepperExtension[]} */; StepCarouselControls.getInstances = function getInstances() { return instances$2; }; return StepCarouselControls; }(ComponentBase); /** @typedef {import('../../js/component-base').EventBinding} EventBinding */ /** @typedef {import('../../js/component-base').InitOpts} InitOpts */ /** * Table Extension component instances. * @type {TableExtension[]} */ var instances$1 = []; /** * CSS class name. * @enum {string} */ var ClassName = { GRID: 'table-grid', GRID_ROW_BG: 'material-surface', GROUP_HEADER: 'group-header', HIDDEN_VISIBILITY: 'invisible' }; /** * CSS selector. * @enum {string} */ var Selector$2 = { CONTROL_ROW: '.control-row', DATA_CELL: 'td', DATA_MOUNT: '[data-mount="table-extension"]' }; /** * Handles expand/collapse toggle for control rows. * @param {boolean} isExpanded If the row is expanded. * @param {HTMLTableRowElement} groupHeader The row element. * @param {NodeListOf} dataCells Row data cells. * @param {boolean} isGrid If the table is a grid. */ function _handleControlToggle(isExpanded, row, dataCells, isGrid) { if (row.classList.contains(ClassName.GROUP_HEADER)) { dataCells.forEach(function (dataCell) { return dataCell.classList.toggle(ClassName.HIDDEN_VISIBILITY, isExpanded); }); } if (isGrid) { row.classList.toggle(ClassName.GRID_ROW_BG, !isExpanded); } } /** Table Extension component. */ var TableExtension = /*#__PURE__*/function (_ComponentBase) { _inheritsLoose(TableExtension, _ComponentBase); /** * Initializes a new instance of the Table Extension component. * @param {InitOpts} opts Initialization options. */ function TableExtension(opts) { var isGrid = opts.el.classList.contains(ClassName.GRID); /** @type {EventBinding[]} */ var events; opts.el.querySelectorAll(Selector$2.CONTROL_ROW).forEach(function (controlRow) { var _controlRow$nextEleme; if ((_controlRow$nextEleme = controlRow.nextElementSibling) != null && _controlRow$nextEleme.classList.contains(ClassName$h.COLLAPSE)) { var dataCells = controlRow.querySelectorAll(Selector$2.DATA_CELL); if (!events) { events = []; } events.push({ el: controlRow.nextElementSibling, handler: _handleControlToggle.bind(null, false, controlRow, dataCells, isGrid), type: EventName$p.HIDDEN }, { el: controlRow.nextElementSibling, handler: _handleControlToggle.bind(null, true, controlRow, dataCells, isGrid), type: EventName$p.SHOWN }); } }); return _ComponentBase.call(this, opts, events) || this; } /** * Gets Table Extension component instances. * @returns {TableExtension[]} */ TableExtension.getInstances = function getInstances() { return instances$1; }; return TableExtension; }(ComponentBase); var instances = []; var Selector$1 = { DATA_MOUNT: '[data-mount="contact-sales"]', CONTACT_SALES_WIDGET: '.contact-sales-widget', GLYPH_BUTTON: '.contact-sales-widget button.btn-glyph-only', CLOSE_BUTTON: '[data-mount="contact-sales"] [data-mount="multi-collapse"]', CONTACT_SALES_GLYPH: '.contact-sales-glyph', CONTACT_SALES_LINK_ITEM: '.contact-sales-link-item' }; var EventName$1 = { ON_REMOVE: 'onRemove', CLICK: 'click', KEYDOWN: 'keydown' }; /** * Handle onclick of glyph button element to set focus on sibling link list */ function _onClick(glyphButton) { var complete = function complete() { var siblingLink = glyphButton.parentElement.parentElement.querySelector('a'); if (siblingLink) { siblingLink.focus(); } }; glyphButton.addEventListener(Util$1.TRANSITION_END, complete.bind(this), { once: true }); Util$1.emulateTransitionEnd(glyphButton, 0); } /** * Handler for keydown event * @param {Event} event - the event captured by the listener * @this ContactSales */ function _onKeyDown(event) { var keycode = Util$1.getKeyCode(event); var _document = document, activeElement = _document.activeElement; if (activeElement.tagName === 'A' && // Handle ESC Key down of link element to set focus on sibling glyph button list keycode === Util$1.keyCodes.ESC && this.closeButton) { this.closeButton.click(); var complete = function complete() { var siblingGlyphButton = activeElement.closest(Selector$1.CONTACT_SALES_WIDGET).querySelector(Selector$1.GLYPH_BUTTON); if (siblingGlyphButton) { siblingGlyphButton.focus(); } }; activeElement.addEventListener(Util$1.TRANSITION_END, complete.bind(this), { once: true }); Util$1.emulateTransitionEnd(activeElement, 0); } } /** * Add Aria Controls For Aria Expanded Element and Add the necessary ids */ function _addAriaControlsForAriaExpandedElement() { var liElements = this.el.querySelectorAll('li'); var ariaControls = ''; liElements.forEach(function (ele, index) { var icon = ele.querySelector(Selector$1.CONTACT_SALES_GLYPH); if (icon) { var id = "contact-sales-widget-" + index + "-icon"; icon.setAttribute('id', id); ariaControls = ariaControls.concat(' ', id); } var link = ele.querySelector(Selector$1.CONTACT_SALES_LINK_ITEM); if (link) { var _id = "contact-sales-widget-" + index + "-link"; link.setAttribute('id', _id); ariaControls = ariaControls.concat(' ', _id); } }); var ariaExpandedElements = this.el.querySelectorAll('[aria-expanded]'); ariaExpandedElements.forEach(function (ele) { return ele.setAttribute('aria-controls', ariaControls.trim()); }); } /** * Class representing Contact Sales */ var ContactSales = /*#__PURE__*/function () { function ContactSales(opts) { var _this = this; this.el = opts.el; this.events = []; this.closeButton = this.el.querySelector(Selector$1.CLOSE_BUTTON); this.glyphButtons = this.el.querySelectorAll(Selector$1.GLYPH_BUTTON); this.glyphButtons.forEach(function (glyphButton) { _this.events.push({ el: glyphButton, type: EventName$1.CLICK, handler: _onClick.bind(_this, glyphButton) }); }); this.events.push({ el: this.el, type: EventName$1.KEYDOWN, handler: _onKeyDown.bind(this) }); Util$1.addEvents(this.events); instances.push(this); _addAriaControlsForAriaExpandedElement.call(this); } /** * Remove the instance */ var _proto = ContactSales.prototype; _proto.remove = function remove() { Util$1.removeEvents(this.events); this[EventName$1.ON_REMOVE] = new CustomEvent(EventName$1.ON_REMOVE, { bubbles: true }); this.el.dispatchEvent(this[EventName$1.ON_REMOVE]); var index = instances.indexOf(this); instances.splice(index, 1); } /** * Get contact sales instances. * @returns {Object[]} An array of instances */; ContactSales.getInstances = function getInstances() { return instances; }; return ContactSales; }(); var M365_EXT_INITIALIZED = 'm365ExtInitialized'; function initializeComponents() { Util$1.initializeComponent(Selector$B.DATA_MOUNT, function (el) { return new AccordionExtension({ el: el }); }); Util$1.initializeComponent(Selector$A.DATA_MOUNT, function (el) { return new AIChatDrawer({ el: el }); }); Util$1.initializeComponent(Selector$c.DATA_MOUNT, function (el) { return new ProactiveChat({ el: el }); }); Util$1.initializeComponent(Selector$z.DATA_MOUNT, function (el) { return new MarketSelector({ el: el }); }); Util$1.initializeComponent(Selector$4.DATA_MOUNT, function (el) { return new PricingContainer({ el: el }); }); Util$1.initializeComponent(Selector$y.DATA_MOUNT, function (el) { return new VideoExtension({ el: el }); }); Util$1.initializeComponent(Selector$v.DATA_MOUNT, function (el) { return new TabFeature({ el: el }); }); Util$1.initializeComponent(Selector$t.DATA_MOUNT, function (el) { return new NavBarExtension({ el: el }); }); Util$1.initializeComponent(Selector$r.DATA_MOUNT, function (el) { return new Filters({ el: el }); }); Util$1.initializeComponent(Selector$g.DATA_MOUNT, function (el) { return new FeatureBase({ el: el }); }); Util$1.initializeComponent(Selector$s.DATA_MOUNT, function (el) { return new DropdownExtension({ el: el }); }); Util$1.initializeComponent(Selector$q.DATA_MOUNT, function (el) { return new NavExtension({ el: el }); }); Util$1.initializeComponent(Selector$p.DATA_MOUNT, function (el) { return new MultiCollapse({ el: el }); }); Util$1.initializeComponent(Selector$o.DATA_MOUNT, function (el) { return new MobileDisplay({ el: el }); }); Util$1.initializeComponent(Selector$w.DATA_MOUNT, function (el) { return new TabExtension({ el: el }); }); Util$1.initializeComponent(Selector$m.DATA_MOUNT, function (el) { return new MultiFeatureVerticalTab({ el: el }); }); Util$1.initializeComponent(Selector$f.DATA_MOUNT, function (el) { return new ProgressExtension({ el: el }); }); Util$1.initializeComponent(SELECTORS.WIZARD_CONTAINER, function (el) { return new SolutionWizard({ el: el }); }); Util$1.initializeComponent(Selector$f.DATA_MOUNT, function (el) { return new ProgressExtension({ el: el }); }); Util$1.initializeComponent(Selector$e.DATA_MOUNT, function (el) { return new SnapCarousel({ el: el }); }); Util$1.initializeComponent(Selector$k.DATA_MOUNT, function (el) { return new ValidationExtension({ el: el }); }); Util$1.initializeComponent(Selector$i.DATA_MOUNT, function (el) { return new CarouselExtension({ el: el }); }); Util$1.initializeComponent(Selector$2.DATA_MOUNT, function (el) { return new TableExtension({ el: el }); }); Util$1.initializeComponent(Selector$h.DATA_MOUNT, function (el) { return new MultiCollapseControls({ el: el }); }); Util$1.initializeComponent(Selector$3.DATA_MOUNT, function (el) { return new StepCarouselControls({ el: el }); }); Util$1.initializeComponent(Selector$6.DATA_MOUNT, function (el) { return new AccordionStepperExtension({ el: el }); }); Util$1.initializeComponent(Selector$d.DATA_MOUNT, function (el) { return new SkuConfigurator({ el: el }); }); Util$1.initializeComponent(Selector$5.DATA_MOUNT, function (el) { return new ExpandableCard({ el: el }); }); Util$1.initializeComponent(Selector$b.DATA_MOUNT, function (el) { return new ProgressStepperExtension({ el: el }); }); Util$1.initializeComponent(Selector$1.DATA_MOUNT, function (el) { return new ContactSales({ el: el }); }); Util$1.initializeComponent(Selector$9.DATA_MOUNT, function (el) { return new Switch({ el: el }); }); Util$1.initializeComponent(Selector$7.DATA_MOUNT, function (el) { return new HorizontalNavTabSliderExtension({ el: el }); }); } var backToTopInstances = []; var Selector = { DATA_MOUNT: '[data-mount="fixed-back-to-top"]' }; var EventName = { SCROLL: 'scroll', ON_REMOVE: 'onRemove', ON_RESIZE: 'resize', ON_UPDATE: 'onUpdate' }; var Attributes = { TABINDEX: 'tabindex' }; var DISPLAY_BUTTON_THRESHOLD = 0.7; // percentage of the page where button will display var initialPageLoad = true; /** * Switch the back to top element between static and sticky */ function _scrollListener() { var _this = this; // use offset margin and subtract the top position of the sentinel var offsetWithSentinel = this.stickyElement.sentinel.offsetTop - this.offsetMarginTop; var scrollY = window.scrollY || window.pageYOffset; if (scrollY > offsetWithSentinel) { this.stickyElement.setObserverStatus(true); this.el.style.opacity = 1; } else { var timeout = initialPageLoad ? 0 : 175; // prevent button flashing on page load this.el.style.opacity = 0; setTimeout(function () { _this.el.classList.remove(ClassName$n.STUCK); _this.stickyElement.enableObserver = false; }, timeout); initialPageLoad = false; } } /** * Update sticky offset margin top value when browser height changes * and remove/create new sticky element */ function _onWindowResize() { // extra conditional check to prevent code from constantly running on resize if (this.offsetMarginTop !== window.mwf.Util.getDocumentHeight() * DISPLAY_BUTTON_THRESHOLD) { this.offsetMarginTop = window.mwf.Util.getDocumentHeight() * DISPLAY_BUTTON_THRESHOLD; this.stickyElement.remove(); this.stickyElement = new FixedSticky({ el: this.el, direction: Direction$4.BOTTOM }); } } /** * Class representing Back to Top. */ var FixedBackToTop = /*#__PURE__*/function () { /** * Create the Back to Top. * @param {Object} opts - The Back to Top options. * @param {Node} opts.el - The Back to Top DOM node. * @param {number} [opts.offsetMarginTop] - Offset in pixels from top of page where Back to Top should begin to be sticky. * @param {Function} [opts.onScroll] - Function to override the scroll event handler. * @param {Function} [opts.onWindowResize] - Function to override the window resize event handler. */ function FixedBackToTop(opts) { this.el = opts.el; this.offsetMarginTop = opts.offsetMarginTop || window.mwf.Util.getDocumentHeight() * DISPLAY_BUTTON_THRESHOLD; this.onScroll = opts.onScroll || _scrollListener.bind(this); this.onWindowResize = opts.onWindowResize || _onWindowResize.bind(this); this.setTabindex(); // Create custom events backToTopInstances.push(this); this.stickyElement = new FixedSticky({ el: this.el, direction: Direction$4.BOTTOM }); // Do the initial firing of the listener to set the state this.onScroll(); // attach event listeners this.events = { scrollEvent: { el: document, type: EventName.SCROLL, handler: throttle(200, this.onScroll), options: { passive: true } }, resizeEvent: { el: window, type: EventName.ON_RESIZE, handler: throttle(200, this.onWindowResize) } }; window.mwf.Util.addEvents(Object.values(this.events)); } /** * Check if the element needs a tabindex and set it */ var _proto = FixedBackToTop.prototype; _proto.setTabindex = function setTabindex() { var link = this.el.querySelector('a'); var href = link.getAttribute('href'); var targetElement = document.querySelector(href); var isElementFound = document.querySelector(href) !== null; if (isElementFound && // Only do something if the element is not tabbable !window.mwf.Util.isElementTabbable(targetElement)) { var tabindex = targetElement.getAttribute(Attributes.TABINDEX); // If we don't have a tabindex if (tabindex === null) { // Set the tabindex of the element to -1 targetElement.setAttribute(Attributes.TABINDEX, '-1'); } } } /** * Update the Back to Top. * @param {Object} [opts] - The Back to Top options. * @param {number} [opts.offsetMarginTop] - Offset in pixels from top of page where Back to Top should begin to be sticky. * @param {Function} [opts.onScroll] - Function to override the scroll event handler. * @param {Function} [opts.onWindowResize] - Function to override the window resize event handler. */; _proto.update = function update(opts) { if (opts === void 0) { opts = {}; } if (opts.offsetMarginTop) { this.offsetMarginTop = opts.offsetMarginTop; } if (opts.onScroll) { window.mwf.Util.removeEvents([this.events.scrollEvent]); this.onScroll = opts.onScroll; window.mwf.Util.addEvents([this.events.scrollEvent]); } if (opts.onWindowResize) { window.mwf.Util.removeEvents([this.events.resizeEvent]); this.onWindowResize = opts.onWindowResize; window.mwf.Util.addEvents([this.events.resizeEvent]); } // Do the initial firing of the listener to set the state this.onScroll(); // Create and dispatch custom event this[EventName.ON_UPDATE] = new CustomEvent(EventName.ON_UPDATE, { bubbles: true }); this.el.dispatchEvent(this[EventName.ON_UPDATE]); } /** * Remove the event listener from the back to top element */; _proto.remove = function remove() { window.mwf.Util.removeEvents(Object.values(this.events)); this.stickyElement.remove(); // remove this back to top reference from array of instances var index = backToTopInstances.indexOf(this); backToTopInstances.splice(index, 1); // Create and dispatch custom event this[EventName.ON_REMOVE] = new CustomEvent(EventName.ON_REMOVE, { bubbles: true }); this.el.dispatchEvent(this[EventName.ON_REMOVE]); } /** * Get back to top instances. * @returns {Object[]} Array of back to top instances */; FixedBackToTop.getInstances = function getInstances() { return backToTopInstances; }; return FixedBackToTop; }(); document.addEventListener('DOMContentLoaded', function () { initializeComponents(); document.dispatchEvent(new CustomEvent(M365_EXT_INITIALIZED)); }); var PLUGIN_INITIALIZED = 'mwfFixedStickyInitialized'; document.addEventListener('mwfInitialized', function () { window.mwf.Util.initializeComponent(Selector.DATA_MOUNT, function (el) { return new FixedBackToTop({ el: el }); }); window.mwf.Util.initializeComponent(Selector$u.DATA_MOUNT, function (el) { return new FixedSticky({ el: el }); }); document.dispatchEvent(new CustomEvent(PLUGIN_INITIALIZED)); }); exports.AIChatDrawer = AIChatDrawer; exports.AccordionExtension = AccordionExtension; exports.CarouselExtension = CarouselExtension; exports.DropdownExtension = DropdownExtension; exports.FeatureBase = FeatureBase; exports.Filters = Filters; exports.FixedBackToTop = FixedBackToTop; exports.FixedSticky = FixedSticky; exports.HorizontalNavTabSliderExtension = HorizontalNavTabSliderExtension; exports.MarketSelector = MarketSelector; exports.MobileDisplay = MobileDisplay; exports.MultiCollapse = MultiCollapse; exports.MultiCollapseControls = MultiCollapseControls; exports.MultiFeatureVerticalTab = MultiFeatureVerticalTab; exports.NavBarExtension = NavBarExtension; exports.NavExtension = NavExtension; exports.ProactiveChat = ProactiveChat; exports.ProgressStepperExtension = ProgressStepperExtension; exports.ScrollSnapCarousel = SnapCarousel; exports.SkuConfigurator = SkuConfigurator; exports.SolutionWizard = SolutionWizard; exports.SwitchExtension = Switch; exports.TabExtension = TabExtension; exports.TabFeature = TabFeature; exports.ValidationExtension = ValidationExtension; exports.VideoExtension = VideoExtension; Object.defineProperty(exports, '__esModule', { value: true }); })); if (window.m365) { document.dispatchEvent(new CustomEvent('m365Initialized')); if (console && console.log && m365.version) { console.log('M365 v' + m365.version); } }