/** * @license * Cesium - https://github.com/CesiumGS/cesium * Version 1.96 * * Copyright 2011-2022 Cesium Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Columbus View (Pat. Pend.) * * Portions licensed separately. * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details. */ var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __commonJS = (cb, mod2) => function __require() { return mod2 || (0, cb[__getOwnPropNames(cb)[0]])((mod2 = { exports: {} }).exports, mod2), mod2.exports; }; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __copyProps( isNodeMode || !mod2 || !mod2.__esModule ? __defProp(target, "default", { value: mod2, enumerable: true }) : target, mod2 )); var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2); // node_modules/mersenne-twister/src/mersenne-twister.js var require_mersenne_twister = __commonJS({ "node_modules/mersenne-twister/src/mersenne-twister.js"(exports2, module2) { var MersenneTwister = function(seed) { if (seed == void 0) { seed = new Date().getTime(); } this.N = 624; this.M = 397; this.MATRIX_A = 2567483615; this.UPPER_MASK = 2147483648; this.LOWER_MASK = 2147483647; this.mt = new Array(this.N); this.mti = this.N + 1; if (seed.constructor == Array) { this.init_by_array(seed, seed.length); } else { this.init_seed(seed); } }; MersenneTwister.prototype.init_seed = function(s) { this.mt[0] = s >>> 0; for (this.mti = 1; this.mti < this.N; this.mti++) { var s = this.mt[this.mti - 1] ^ this.mt[this.mti - 1] >>> 30; this.mt[this.mti] = (((s & 4294901760) >>> 16) * 1812433253 << 16) + (s & 65535) * 1812433253 + this.mti; this.mt[this.mti] >>>= 0; } }; MersenneTwister.prototype.init_by_array = function(init_key, key_length) { var i, j, k; this.init_seed(19650218); i = 1; j = 0; k = this.N > key_length ? this.N : key_length; for (; k; k--) { var s = this.mt[i - 1] ^ this.mt[i - 1] >>> 30; this.mt[i] = (this.mt[i] ^ (((s & 4294901760) >>> 16) * 1664525 << 16) + (s & 65535) * 1664525) + init_key[j] + j; this.mt[i] >>>= 0; i++; j++; if (i >= this.N) { this.mt[0] = this.mt[this.N - 1]; i = 1; } if (j >= key_length) j = 0; } for (k = this.N - 1; k; k--) { var s = this.mt[i - 1] ^ this.mt[i - 1] >>> 30; this.mt[i] = (this.mt[i] ^ (((s & 4294901760) >>> 16) * 1566083941 << 16) + (s & 65535) * 1566083941) - i; this.mt[i] >>>= 0; i++; if (i >= this.N) { this.mt[0] = this.mt[this.N - 1]; i = 1; } } this.mt[0] = 2147483648; }; MersenneTwister.prototype.random_int = function() { var y; var mag01 = new Array(0, this.MATRIX_A); if (this.mti >= this.N) { var kk; if (this.mti == this.N + 1) this.init_seed(5489); for (kk = 0; kk < this.N - this.M; kk++) { y = this.mt[kk] & this.UPPER_MASK | this.mt[kk + 1] & this.LOWER_MASK; this.mt[kk] = this.mt[kk + this.M] ^ y >>> 1 ^ mag01[y & 1]; } for (; kk < this.N - 1; kk++) { y = this.mt[kk] & this.UPPER_MASK | this.mt[kk + 1] & this.LOWER_MASK; this.mt[kk] = this.mt[kk + (this.M - this.N)] ^ y >>> 1 ^ mag01[y & 1]; } y = this.mt[this.N - 1] & this.UPPER_MASK | this.mt[0] & this.LOWER_MASK; this.mt[this.N - 1] = this.mt[this.M - 1] ^ y >>> 1 ^ mag01[y & 1]; this.mti = 0; } y = this.mt[this.mti++]; y ^= y >>> 11; y ^= y << 7 & 2636928640; y ^= y << 15 & 4022730752; y ^= y >>> 18; return y >>> 0; }; MersenneTwister.prototype.random_int31 = function() { return this.random_int() >>> 1; }; MersenneTwister.prototype.random_incl = function() { return this.random_int() * (1 / 4294967295); }; MersenneTwister.prototype.random = function() { return this.random_int() * (1 / 4294967296); }; MersenneTwister.prototype.random_excl = function() { return (this.random_int() + 0.5) * (1 / 4294967296); }; MersenneTwister.prototype.random_long = function() { var a3 = this.random_int() >>> 5, b = this.random_int() >>> 6; return (a3 * 67108864 + b) * (1 / 9007199254740992); }; module2.exports = MersenneTwister; } }); // node_modules/urijs/src/punycode.js var require_punycode = __commonJS({ "node_modules/urijs/src/punycode.js"(exports2, module2) { /*! https://mths.be/punycode v1.4.0 by @mathias */ (function(root) { var freeExports = typeof exports2 == "object" && exports2 && !exports2.nodeType && exports2; var freeModule = typeof module2 == "object" && module2 && !module2.nodeType && module2; var freeGlobal = typeof global == "object" && global; if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal) { root = freeGlobal; } var punycode, maxInt = 2147483647, base = 36, tMin = 1, tMax = 26, skew = 38, damp = 700, initialBias = 72, initialN = 128, delimiter = "-", regexPunycode = /^xn--/, regexNonASCII = /[^\x20-\x7E]/, regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, errors = { "overflow": "Overflow: input needs wider integers to process", "not-basic": "Illegal input >= 0x80 (not a basic code point)", "invalid-input": "Invalid input" }, baseMinusTMin = base - tMin, floor = Math.floor, stringFromCharCode = String.fromCharCode, key; function error(type) { throw new RangeError(errors[type]); } function map(array, fn) { var length3 = array.length; var result = []; while (length3--) { result[length3] = fn(array[length3]); } return result; } function mapDomain(string, fn) { var parts = string.split("@"); var result = ""; if (parts.length > 1) { result = parts[0] + "@"; string = parts[1]; } string = string.replace(regexSeparators, "."); var labels = string.split("."); var encoded = map(labels, fn).join("."); return result + encoded; } function ucs2decode(string) { var output = [], counter = 0, length3 = string.length, value, extra; while (counter < length3) { value = string.charCodeAt(counter++); if (value >= 55296 && value <= 56319 && counter < length3) { extra = string.charCodeAt(counter++); if ((extra & 64512) == 56320) { output.push(((value & 1023) << 10) + (extra & 1023) + 65536); } else { output.push(value); counter--; } } else { output.push(value); } } return output; } function ucs2encode(array) { return map(array, function(value) { var output = ""; if (value > 65535) { value -= 65536; output += stringFromCharCode(value >>> 10 & 1023 | 55296); value = 56320 | value & 1023; } output += stringFromCharCode(value); return output; }).join(""); } function basicToDigit(codePoint) { if (codePoint - 48 < 10) { return codePoint - 22; } if (codePoint - 65 < 26) { return codePoint - 65; } if (codePoint - 97 < 26) { return codePoint - 97; } return base; } function digitToBasic(digit, flag) { return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); } function adapt(delta, numPoints, firstTime) { var k = 0; delta = firstTime ? floor(delta / damp) : delta >> 1; delta += floor(delta / numPoints); for (; delta > baseMinusTMin * tMax >> 1; k += base) { delta = floor(delta / baseMinusTMin); } return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); } function decode(input) { var output = [], inputLength = input.length, out, i = 0, n = initialN, bias = initialBias, basic, j, index, oldi, w, k, digit, t, baseMinusT; basic = input.lastIndexOf(delimiter); if (basic < 0) { basic = 0; } for (j = 0; j < basic; ++j) { if (input.charCodeAt(j) >= 128) { error("not-basic"); } output.push(input.charCodeAt(j)); } for (index = basic > 0 ? basic + 1 : 0; index < inputLength; ) { for (oldi = i, w = 1, k = base; ; k += base) { if (index >= inputLength) { error("invalid-input"); } digit = basicToDigit(input.charCodeAt(index++)); if (digit >= base || digit > floor((maxInt - i) / w)) { error("overflow"); } i += digit * w; t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias; if (digit < t) { break; } baseMinusT = base - t; if (w > floor(maxInt / baseMinusT)) { error("overflow"); } w *= baseMinusT; } out = output.length + 1; bias = adapt(i - oldi, out, oldi == 0); if (floor(i / out) > maxInt - n) { error("overflow"); } n += floor(i / out); i %= out; output.splice(i++, 0, n); } return ucs2encode(output); } function encode(input) { var n, delta, handledCPCount, basicLength, bias, j, m, q, k, t, currentValue, output = [], inputLength, handledCPCountPlusOne, baseMinusT, qMinusT; input = ucs2decode(input); inputLength = input.length; n = initialN; delta = 0; bias = initialBias; for (j = 0; j < inputLength; ++j) { currentValue = input[j]; if (currentValue < 128) { output.push(stringFromCharCode(currentValue)); } } handledCPCount = basicLength = output.length; if (basicLength) { output.push(delimiter); } while (handledCPCount < inputLength) { for (m = maxInt, j = 0; j < inputLength; ++j) { currentValue = input[j]; if (currentValue >= n && currentValue < m) { m = currentValue; } } handledCPCountPlusOne = handledCPCount + 1; if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { error("overflow"); } delta += (m - n) * handledCPCountPlusOne; n = m; for (j = 0; j < inputLength; ++j) { currentValue = input[j]; if (currentValue < n && ++delta > maxInt) { error("overflow"); } if (currentValue == n) { for (q = delta, k = base; ; k += base) { t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias; if (q < t) { break; } qMinusT = q - t; baseMinusT = base - t; output.push( stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) ); q = floor(qMinusT / baseMinusT); } output.push(stringFromCharCode(digitToBasic(q, 0))); bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); delta = 0; ++handledCPCount; } } ++delta; ++n; } return output.join(""); } function toUnicode(input) { return mapDomain(input, function(string) { return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string; }); } function toASCII(input) { return mapDomain(input, function(string) { return regexNonASCII.test(string) ? "xn--" + encode(string) : string; }); } punycode = { "version": "1.3.2", "ucs2": { "decode": ucs2decode, "encode": ucs2encode }, "decode": decode, "encode": encode, "toASCII": toASCII, "toUnicode": toUnicode }; if (typeof define == "function" && typeof define.amd == "object" && define.amd) { define("punycode", function() { return punycode; }); } else if (freeExports && freeModule) { if (module2.exports == freeExports) { freeModule.exports = punycode; } else { for (key in punycode) { punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); } } } else { root.punycode = punycode; } })(exports2); } }); // node_modules/urijs/src/IPv6.js var require_IPv6 = __commonJS({ "node_modules/urijs/src/IPv6.js"(exports2, module2) { /*! * URI.js - Mutating URLs * IPv6 Support * * Version: 1.19.11 * * Author: Rodney Rehm * Web: http://medialize.github.io/URI.js/ * * Licensed under * MIT License http://www.opensource.org/licenses/mit-license * */ (function(root, factory) { "use strict"; if (typeof module2 === "object" && module2.exports) { module2.exports = factory(); } else if (typeof define === "function" && define.amd) { define(factory); } else { root.IPv6 = factory(root); } })(exports2, function(root) { "use strict"; var _IPv6 = root && root.IPv6; function bestPresentation(address) { var _address = address.toLowerCase(); var segments = _address.split(":"); var length3 = segments.length; var total = 8; if (segments[0] === "" && segments[1] === "" && segments[2] === "") { segments.shift(); segments.shift(); } else if (segments[0] === "" && segments[1] === "") { segments.shift(); } else if (segments[length3 - 1] === "" && segments[length3 - 2] === "") { segments.pop(); } length3 = segments.length; if (segments[length3 - 1].indexOf(".") !== -1) { total = 7; } var pos; for (pos = 0; pos < length3; pos++) { if (segments[pos] === "") { break; } } if (pos < total) { segments.splice(pos, 1, "0000"); while (segments.length < total) { segments.splice(pos, 0, "0000"); } } var _segments; for (var i = 0; i < total; i++) { _segments = segments[i].split(""); for (var j = 0; j < 3; j++) { if (_segments[0] === "0" && _segments.length > 1) { _segments.splice(0, 1); } else { break; } } segments[i] = _segments.join(""); } var best = -1; var _best = 0; var _current = 0; var current = -1; var inzeroes = false; for (i = 0; i < total; i++) { if (inzeroes) { if (segments[i] === "0") { _current += 1; } else { inzeroes = false; if (_current > _best) { best = current; _best = _current; } } } else { if (segments[i] === "0") { inzeroes = true; current = i; _current = 1; } } } if (_current > _best) { best = current; _best = _current; } if (_best > 1) { segments.splice(best, _best, ""); } length3 = segments.length; var result = ""; if (segments[0] === "") { result = ":"; } for (i = 0; i < length3; i++) { result += segments[i]; if (i === length3 - 1) { break; } result += ":"; } if (segments[length3 - 1] === "") { result += ":"; } return result; } function noConflict() { if (root.IPv6 === this) { root.IPv6 = _IPv6; } return this; } return { best: bestPresentation, noConflict }; }); } }); // node_modules/urijs/src/SecondLevelDomains.js var require_SecondLevelDomains = __commonJS({ "node_modules/urijs/src/SecondLevelDomains.js"(exports2, module2) { /*! * URI.js - Mutating URLs * Second Level Domain (SLD) Support * * Version: 1.19.11 * * Author: Rodney Rehm * Web: http://medialize.github.io/URI.js/ * * Licensed under * MIT License http://www.opensource.org/licenses/mit-license * */ (function(root, factory) { "use strict"; if (typeof module2 === "object" && module2.exports) { module2.exports = factory(); } else if (typeof define === "function" && define.amd) { define(factory); } else { root.SecondLevelDomains = factory(root); } })(exports2, function(root) { "use strict"; var _SecondLevelDomains = root && root.SecondLevelDomains; var SLD = { list: { "ac": " com gov mil net org ", "ae": " ac co gov mil name net org pro sch ", "af": " com edu gov net org ", "al": " com edu gov mil net org ", "ao": " co ed gv it og pb ", "ar": " com edu gob gov int mil net org tur ", "at": " ac co gv or ", "au": " asn com csiro edu gov id net org ", "ba": " co com edu gov mil net org rs unbi unmo unsa untz unze ", "bb": " biz co com edu gov info net org store tv ", "bh": " biz cc com edu gov info net org ", "bn": " com edu gov net org ", "bo": " com edu gob gov int mil net org tv ", "br": " adm adv agr am arq art ato b bio blog bmd cim cng cnt com coop ecn edu eng esp etc eti far flog fm fnd fot fst g12 ggf gov imb ind inf jor jus lel mat med mil mus net nom not ntr odo org ppg pro psc psi qsl rec slg srv tmp trd tur tv vet vlog wiki zlg ", "bs": " com edu gov net org ", "bz": " du et om ov rg ", "ca": " ab bc mb nb nf nl ns nt nu on pe qc sk yk ", "ck": " biz co edu gen gov info net org ", "cn": " ac ah bj com cq edu fj gd gov gs gx gz ha hb he hi hl hn jl js jx ln mil net nm nx org qh sc sd sh sn sx tj tw xj xz yn zj ", "co": " com edu gov mil net nom org ", "cr": " ac c co ed fi go or sa ", "cy": " ac biz com ekloges gov ltd name net org parliament press pro tm ", "do": " art com edu gob gov mil net org sld web ", "dz": " art asso com edu gov net org pol ", "ec": " com edu fin gov info med mil net org pro ", "eg": " com edu eun gov mil name net org sci ", "er": " com edu gov ind mil net org rochest w ", "es": " com edu gob nom org ", "et": " biz com edu gov info name net org ", "fj": " ac biz com info mil name net org pro ", "fk": " ac co gov net nom org ", "fr": " asso com f gouv nom prd presse tm ", "gg": " co net org ", "gh": " com edu gov mil org ", "gn": " ac com gov net org ", "gr": " com edu gov mil net org ", "gt": " com edu gob ind mil net org ", "gu": " com edu gov net org ", "hk": " com edu gov idv net org ", "hu": " 2000 agrar bolt casino city co erotica erotika film forum games hotel info ingatlan jogasz konyvelo lakas media news org priv reklam sex shop sport suli szex tm tozsde utazas video ", "id": " ac co go mil net or sch web ", "il": " ac co gov idf k12 muni net org ", "in": " ac co edu ernet firm gen gov i ind mil net nic org res ", "iq": " com edu gov i mil net org ", "ir": " ac co dnssec gov i id net org sch ", "it": " edu gov ", "je": " co net org ", "jo": " com edu gov mil name net org sch ", "jp": " ac ad co ed go gr lg ne or ", "ke": " ac co go info me mobi ne or sc ", "kh": " com edu gov mil net org per ", "ki": " biz com de edu gov info mob net org tel ", "km": " asso com coop edu gouv k medecin mil nom notaires pharmaciens presse tm veterinaire ", "kn": " edu gov net org ", "kr": " ac busan chungbuk chungnam co daegu daejeon es gangwon go gwangju gyeongbuk gyeonggi gyeongnam hs incheon jeju jeonbuk jeonnam k kg mil ms ne or pe re sc seoul ulsan ", "kw": " com edu gov net org ", "ky": " com edu gov net org ", "kz": " com edu gov mil net org ", "lb": " com edu gov net org ", "lk": " assn com edu gov grp hotel int ltd net ngo org sch soc web ", "lr": " com edu gov net org ", "lv": " asn com conf edu gov id mil net org ", "ly": " com edu gov id med net org plc sch ", "ma": " ac co gov m net org press ", "mc": " asso tm ", "me": " ac co edu gov its net org priv ", "mg": " com edu gov mil nom org prd tm ", "mk": " com edu gov inf name net org pro ", "ml": " com edu gov net org presse ", "mn": " edu gov org ", "mo": " com edu gov net org ", "mt": " com edu gov net org ", "mv": " aero biz com coop edu gov info int mil museum name net org pro ", "mw": " ac co com coop edu gov int museum net org ", "mx": " com edu gob net org ", "my": " com edu gov mil name net org sch ", "nf": " arts com firm info net other per rec store web ", "ng": " biz com edu gov mil mobi name net org sch ", "ni": " ac co com edu gob mil net nom org ", "np": " com edu gov mil net org ", "nr": " biz com edu gov info net org ", "om": " ac biz co com edu gov med mil museum net org pro sch ", "pe": " com edu gob mil net nom org sld ", "ph": " com edu gov i mil net ngo org ", "pk": " biz com edu fam gob gok gon gop gos gov net org web ", "pl": " art bialystok biz com edu gda gdansk gorzow gov info katowice krakow lodz lublin mil net ngo olsztyn org poznan pwr radom slupsk szczecin torun warszawa waw wroc wroclaw zgora ", "pr": " ac biz com edu est gov info isla name net org pro prof ", "ps": " com edu gov net org plo sec ", "pw": " belau co ed go ne or ", "ro": " arts com firm info nom nt org rec store tm www ", "rs": " ac co edu gov in org ", "sb": " com edu gov net org ", "sc": " com edu gov net org ", "sh": " co com edu gov net nom org ", "sl": " com edu gov net org ", "st": " co com consulado edu embaixada gov mil net org principe saotome store ", "sv": " com edu gob org red ", "sz": " ac co org ", "tr": " av bbs bel biz com dr edu gen gov info k12 name net org pol tel tsk tv web ", "tt": " aero biz cat co com coop edu gov info int jobs mil mobi museum name net org pro tel travel ", "tw": " club com ebiz edu game gov idv mil net org ", "mu": " ac co com gov net or org ", "mz": " ac co edu gov org ", "na": " co com ", "nz": " ac co cri geek gen govt health iwi maori mil net org parliament school ", "pa": " abo ac com edu gob ing med net nom org sld ", "pt": " com edu gov int net nome org publ ", "py": " com edu gov mil net org ", "qa": " com edu gov mil net org ", "re": " asso com nom ", "ru": " ac adygeya altai amur arkhangelsk astrakhan bashkiria belgorod bir bryansk buryatia cbg chel chelyabinsk chita chukotka chuvashia com dagestan e-burg edu gov grozny int irkutsk ivanovo izhevsk jar joshkar-ola kalmykia kaluga kamchatka karelia kazan kchr kemerovo khabarovsk khakassia khv kirov koenig komi kostroma kranoyarsk kuban kurgan kursk lipetsk magadan mari mari-el marine mil mordovia mosreg msk murmansk nalchik net nnov nov novosibirsk nsk omsk orenburg org oryol penza perm pp pskov ptz rnd ryazan sakhalin samara saratov simbirsk smolensk spb stavropol stv surgut tambov tatarstan tom tomsk tsaritsyn tsk tula tuva tver tyumen udm udmurtia ulan-ude vladikavkaz vladimir vladivostok volgograd vologda voronezh vrn vyatka yakutia yamal yekaterinburg yuzhno-sakhalinsk ", "rw": " ac co com edu gouv gov int mil net ", "sa": " com edu gov med net org pub sch ", "sd": " com edu gov info med net org tv ", "se": " a ac b bd c d e f g h i k l m n o org p parti pp press r s t tm u w x y z ", "sg": " com edu gov idn net org per ", "sn": " art com edu gouv org perso univ ", "sy": " com edu gov mil net news org ", "th": " ac co go in mi net or ", "tj": " ac biz co com edu go gov info int mil name net nic org test web ", "tn": " agrinet com defense edunet ens fin gov ind info intl mincom nat net org perso rnrt rns rnu tourism ", "tz": " ac co go ne or ", "ua": " biz cherkassy chernigov chernovtsy ck cn co com crimea cv dn dnepropetrovsk donetsk dp edu gov if in ivano-frankivsk kh kharkov kherson khmelnitskiy kiev kirovograd km kr ks kv lg lugansk lutsk lviv me mk net nikolaev od odessa org pl poltava pp rovno rv sebastopol sumy te ternopil uzhgorod vinnica vn zaporizhzhe zhitomir zp zt ", "ug": " ac co go ne or org sc ", "uk": " ac bl british-library co cym gov govt icnet jet lea ltd me mil mod national-library-scotland nel net nhs nic nls org orgn parliament plc police sch scot soc ", "us": " dni fed isa kids nsn ", "uy": " com edu gub mil net org ", "ve": " co com edu gob info mil net org web ", "vi": " co com k12 net org ", "vn": " ac biz com edu gov health info int name net org pro ", "ye": " co com gov ltd me net org plc ", "yu": " ac co edu gov org ", "za": " ac agric alt bourse city co cybernet db edu gov grondar iaccess imt inca landesign law mil net ngo nis nom olivetti org pix school tm web ", "zm": " ac co com edu gov net org sch ", "com": "ar br cn de eu gb gr hu jpn kr no qc ru sa se uk us uy za ", "net": "gb jp se uk ", "org": "ae", "de": "com " }, has: function(domain) { var tldOffset = domain.lastIndexOf("."); if (tldOffset <= 0 || tldOffset >= domain.length - 1) { return false; } var sldOffset = domain.lastIndexOf(".", tldOffset - 1); if (sldOffset <= 0 || sldOffset >= tldOffset - 1) { return false; } var sldList = SLD.list[domain.slice(tldOffset + 1)]; if (!sldList) { return false; } return sldList.indexOf(" " + domain.slice(sldOffset + 1, tldOffset) + " ") >= 0; }, is: function(domain) { var tldOffset = domain.lastIndexOf("."); if (tldOffset <= 0 || tldOffset >= domain.length - 1) { return false; } var sldOffset = domain.lastIndexOf(".", tldOffset - 1); if (sldOffset >= 0) { return false; } var sldList = SLD.list[domain.slice(tldOffset + 1)]; if (!sldList) { return false; } return sldList.indexOf(" " + domain.slice(0, tldOffset) + " ") >= 0; }, get: function(domain) { var tldOffset = domain.lastIndexOf("."); if (tldOffset <= 0 || tldOffset >= domain.length - 1) { return null; } var sldOffset = domain.lastIndexOf(".", tldOffset - 1); if (sldOffset <= 0 || sldOffset >= tldOffset - 1) { return null; } var sldList = SLD.list[domain.slice(tldOffset + 1)]; if (!sldList) { return null; } if (sldList.indexOf(" " + domain.slice(sldOffset + 1, tldOffset) + " ") < 0) { return null; } return domain.slice(sldOffset + 1); }, noConflict: function() { if (root.SecondLevelDomains === this) { root.SecondLevelDomains = _SecondLevelDomains; } return this; } }; return SLD; }); } }); // node_modules/urijs/src/URI.js var require_URI = __commonJS({ "node_modules/urijs/src/URI.js"(exports2, module2) { /*! * URI.js - Mutating URLs * * Version: 1.19.11 * * Author: Rodney Rehm * Web: http://medialize.github.io/URI.js/ * * Licensed under * MIT License http://www.opensource.org/licenses/mit-license * */ (function(root, factory) { "use strict"; if (typeof module2 === "object" && module2.exports) { module2.exports = factory(require_punycode(), require_IPv6(), require_SecondLevelDomains()); } else if (typeof define === "function" && define.amd) { define(["./punycode", "./IPv6", "./SecondLevelDomains"], factory); } else { root.URI = factory(root.punycode, root.IPv6, root.SecondLevelDomains, root); } })(exports2, function(punycode, IPv6, SLD, root) { "use strict"; var _URI = root && root.URI; function URI(url2, base) { var _urlSupplied = arguments.length >= 1; var _baseSupplied = arguments.length >= 2; if (!(this instanceof URI)) { if (_urlSupplied) { if (_baseSupplied) { return new URI(url2, base); } return new URI(url2); } return new URI(); } if (url2 === void 0) { if (_urlSupplied) { throw new TypeError("undefined is not a valid argument for URI"); } if (typeof location !== "undefined") { url2 = location.href + ""; } else { url2 = ""; } } if (url2 === null) { if (_urlSupplied) { throw new TypeError("null is not a valid argument for URI"); } } this.href(url2); if (base !== void 0) { return this.absoluteTo(base); } return this; } function isInteger(value) { return /^[0-9]+$/.test(value); } URI.version = "1.19.11"; var p = URI.prototype; var hasOwn = Object.prototype.hasOwnProperty; function escapeRegEx(string) { return string.replace(/([.*+?^=!:${}()|[\]\/\\])/g, "\\$1"); } function getType(value) { if (value === void 0) { return "Undefined"; } return String(Object.prototype.toString.call(value)).slice(8, -1); } function isArray(obj) { return getType(obj) === "Array"; } function filterArrayValues(data, value) { var lookup = {}; var i, length3; if (getType(value) === "RegExp") { lookup = null; } else if (isArray(value)) { for (i = 0, length3 = value.length; i < length3; i++) { lookup[value[i]] = true; } } else { lookup[value] = true; } for (i = 0, length3 = data.length; i < length3; i++) { var _match = lookup && lookup[data[i]] !== void 0 || !lookup && value.test(data[i]); if (_match) { data.splice(i, 1); length3--; i--; } } return data; } function arrayContains(list, value) { var i, length3; if (isArray(value)) { for (i = 0, length3 = value.length; i < length3; i++) { if (!arrayContains(list, value[i])) { return false; } } return true; } var _type = getType(value); for (i = 0, length3 = list.length; i < length3; i++) { if (_type === "RegExp") { if (typeof list[i] === "string" && list[i].match(value)) { return true; } } else if (list[i] === value) { return true; } } return false; } function arraysEqual(one, two) { if (!isArray(one) || !isArray(two)) { return false; } if (one.length !== two.length) { return false; } one.sort(); two.sort(); for (var i = 0, l = one.length; i < l; i++) { if (one[i] !== two[i]) { return false; } } return true; } function trimSlashes(text) { var trim_expression = /^\/+|\/+$/g; return text.replace(trim_expression, ""); } URI._parts = function() { return { protocol: null, username: null, password: null, hostname: null, urn: null, port: null, path: null, query: null, fragment: null, preventInvalidHostname: URI.preventInvalidHostname, duplicateQueryParameters: URI.duplicateQueryParameters, escapeQuerySpace: URI.escapeQuerySpace }; }; URI.preventInvalidHostname = false; URI.duplicateQueryParameters = false; URI.escapeQuerySpace = true; URI.protocol_expression = /^[a-z][a-z0-9.+-]*$/i; URI.idn_expression = /[^a-z0-9\._-]/i; URI.punycode_expression = /(xn--)/i; URI.ip4_expression = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/; URI.ip6_expression = /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/; URI.find_uri_expression = /\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/ig; URI.findUri = { start: /\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi, end: /[\s\r\n]|$/, trim: /[`!()\[\]{};:'".,<>?«»“”„‘’]+$/, parens: /(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g }; URI.leading_whitespace_expression = /^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/; URI.ascii_tab_whitespace = /[\u0009\u000A\u000D]+/g; URI.defaultPorts = { http: "80", https: "443", ftp: "21", gopher: "70", ws: "80", wss: "443" }; URI.hostProtocols = [ "http", "https" ]; URI.invalid_hostname_characters = /[^a-zA-Z0-9\.\-:_]/; URI.domAttributes = { "a": "href", "blockquote": "cite", "link": "href", "base": "href", "script": "src", "form": "action", "img": "src", "area": "href", "iframe": "src", "embed": "src", "source": "src", "track": "src", "input": "src", "audio": "src", "video": "src" }; URI.getDomAttribute = function(node) { if (!node || !node.nodeName) { return void 0; } var nodeName = node.nodeName.toLowerCase(); if (nodeName === "input" && node.type !== "image") { return void 0; } return URI.domAttributes[nodeName]; }; function escapeForDumbFirefox36(value) { return escape(value); } function strictEncodeURIComponent(string) { return encodeURIComponent(string).replace(/[!'()*]/g, escapeForDumbFirefox36).replace(/\*/g, "%2A"); } URI.encode = strictEncodeURIComponent; URI.decode = decodeURIComponent; URI.iso8859 = function() { URI.encode = escape; URI.decode = unescape; }; URI.unicode = function() { URI.encode = strictEncodeURIComponent; URI.decode = decodeURIComponent; }; URI.characters = { pathname: { encode: { expression: /%(24|26|2B|2C|3B|3D|3A|40)/ig, map: { "%24": "$", "%26": "&", "%2B": "+", "%2C": ",", "%3B": ";", "%3D": "=", "%3A": ":", "%40": "@" } }, decode: { expression: /[\/\?#]/g, map: { "/": "%2F", "?": "%3F", "#": "%23" } } }, reserved: { encode: { expression: /%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/ig, map: { "%3A": ":", "%2F": "/", "%3F": "?", "%23": "#", "%5B": "[", "%5D": "]", "%40": "@", "%21": "!", "%24": "$", "%26": "&", "%27": "'", "%28": "(", "%29": ")", "%2A": "*", "%2B": "+", "%2C": ",", "%3B": ";", "%3D": "=" } } }, urnpath: { encode: { expression: /%(21|24|27|28|29|2A|2B|2C|3B|3D|40)/ig, map: { "%21": "!", "%24": "$", "%27": "'", "%28": "(", "%29": ")", "%2A": "*", "%2B": "+", "%2C": ",", "%3B": ";", "%3D": "=", "%40": "@" } }, decode: { expression: /[\/\?#:]/g, map: { "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" } } } }; URI.encodeQuery = function(string, escapeQuerySpace) { var escaped = URI.encode(string + ""); if (escapeQuerySpace === void 0) { escapeQuerySpace = URI.escapeQuerySpace; } return escapeQuerySpace ? escaped.replace(/%20/g, "+") : escaped; }; URI.decodeQuery = function(string, escapeQuerySpace) { string += ""; if (escapeQuerySpace === void 0) { escapeQuerySpace = URI.escapeQuerySpace; } try { return URI.decode(escapeQuerySpace ? string.replace(/\+/g, "%20") : string); } catch (e) { return string; } }; var _parts = { "encode": "encode", "decode": "decode" }; var _part; var generateAccessor = function(_group, _part2) { return function(string) { try { return URI[_part2](string + "").replace(URI.characters[_group][_part2].expression, function(c) { return URI.characters[_group][_part2].map[c]; }); } catch (e) { return string; } }; }; for (_part in _parts) { URI[_part + "PathSegment"] = generateAccessor("pathname", _parts[_part]); URI[_part + "UrnPathSegment"] = generateAccessor("urnpath", _parts[_part]); } var generateSegmentedPathFunction = function(_sep, _codingFuncName, _innerCodingFuncName) { return function(string) { var actualCodingFunc; if (!_innerCodingFuncName) { actualCodingFunc = URI[_codingFuncName]; } else { actualCodingFunc = function(string2) { return URI[_codingFuncName](URI[_innerCodingFuncName](string2)); }; } var segments = (string + "").split(_sep); for (var i = 0, length3 = segments.length; i < length3; i++) { segments[i] = actualCodingFunc(segments[i]); } return segments.join(_sep); }; }; URI.decodePath = generateSegmentedPathFunction("/", "decodePathSegment"); URI.decodeUrnPath = generateSegmentedPathFunction(":", "decodeUrnPathSegment"); URI.recodePath = generateSegmentedPathFunction("/", "encodePathSegment", "decode"); URI.recodeUrnPath = generateSegmentedPathFunction(":", "encodeUrnPathSegment", "decode"); URI.encodeReserved = generateAccessor("reserved", "encode"); URI.parse = function(string, parts) { var pos; if (!parts) { parts = { preventInvalidHostname: URI.preventInvalidHostname }; } string = string.replace(URI.leading_whitespace_expression, ""); string = string.replace(URI.ascii_tab_whitespace, ""); pos = string.indexOf("#"); if (pos > -1) { parts.fragment = string.substring(pos + 1) || null; string = string.substring(0, pos); } pos = string.indexOf("?"); if (pos > -1) { parts.query = string.substring(pos + 1) || null; string = string.substring(0, pos); } string = string.replace(/^(https?|ftp|wss?)?:+[/\\]*/i, "$1://"); string = string.replace(/^[/\\]{2,}/i, "//"); if (string.substring(0, 2) === "//") { parts.protocol = null; string = string.substring(2); string = URI.parseAuthority(string, parts); } else { pos = string.indexOf(":"); if (pos > -1) { parts.protocol = string.substring(0, pos) || null; if (parts.protocol && !parts.protocol.match(URI.protocol_expression)) { parts.protocol = void 0; } else if (string.substring(pos + 1, pos + 3).replace(/\\/g, "/") === "//") { string = string.substring(pos + 3); string = URI.parseAuthority(string, parts); } else { string = string.substring(pos + 1); parts.urn = true; } } } parts.path = string; return parts; }; URI.parseHost = function(string, parts) { if (!string) { string = ""; } string = string.replace(/\\/g, "/"); var pos = string.indexOf("/"); var bracketPos; var t; if (pos === -1) { pos = string.length; } if (string.charAt(0) === "[") { bracketPos = string.indexOf("]"); parts.hostname = string.substring(1, bracketPos) || null; parts.port = string.substring(bracketPos + 2, pos) || null; if (parts.port === "/") { parts.port = null; } } else { var firstColon = string.indexOf(":"); var firstSlash = string.indexOf("/"); var nextColon = string.indexOf(":", firstColon + 1); if (nextColon !== -1 && (firstSlash === -1 || nextColon < firstSlash)) { parts.hostname = string.substring(0, pos) || null; parts.port = null; } else { t = string.substring(0, pos).split(":"); parts.hostname = t[0] || null; parts.port = t[1] || null; } } if (parts.hostname && string.substring(pos).charAt(0) !== "/") { pos++; string = "/" + string; } if (parts.preventInvalidHostname) { URI.ensureValidHostname(parts.hostname, parts.protocol); } if (parts.port) { URI.ensureValidPort(parts.port); } return string.substring(pos) || "/"; }; URI.parseAuthority = function(string, parts) { string = URI.parseUserinfo(string, parts); return URI.parseHost(string, parts); }; URI.parseUserinfo = function(string, parts) { var _string = string; var firstBackSlash = string.indexOf("\\"); if (firstBackSlash !== -1) { string = string.replace(/\\/g, "/"); } var firstSlash = string.indexOf("/"); var pos = string.lastIndexOf("@", firstSlash > -1 ? firstSlash : string.length - 1); var t; if (pos > -1 && (firstSlash === -1 || pos < firstSlash)) { t = string.substring(0, pos).split(":"); parts.username = t[0] ? URI.decode(t[0]) : null; t.shift(); parts.password = t[0] ? URI.decode(t.join(":")) : null; string = _string.substring(pos + 1); } else { parts.username = null; parts.password = null; } return string; }; URI.parseQuery = function(string, escapeQuerySpace) { if (!string) { return {}; } string = string.replace(/&+/g, "&").replace(/^\?*&*|&+$/g, ""); if (!string) { return {}; } var items = {}; var splits = string.split("&"); var length3 = splits.length; var v7, name, value; for (var i = 0; i < length3; i++) { v7 = splits[i].split("="); name = URI.decodeQuery(v7.shift(), escapeQuerySpace); value = v7.length ? URI.decodeQuery(v7.join("="), escapeQuerySpace) : null; if (name === "__proto__") { continue; } else if (hasOwn.call(items, name)) { if (typeof items[name] === "string" || items[name] === null) { items[name] = [items[name]]; } items[name].push(value); } else { items[name] = value; } } return items; }; URI.build = function(parts) { var t = ""; var requireAbsolutePath = false; if (parts.protocol) { t += parts.protocol + ":"; } if (!parts.urn && (t || parts.hostname)) { t += "//"; requireAbsolutePath = true; } t += URI.buildAuthority(parts) || ""; if (typeof parts.path === "string") { if (parts.path.charAt(0) !== "/" && requireAbsolutePath) { t += "/"; } t += parts.path; } if (typeof parts.query === "string" && parts.query) { t += "?" + parts.query; } if (typeof parts.fragment === "string" && parts.fragment) { t += "#" + parts.fragment; } return t; }; URI.buildHost = function(parts) { var t = ""; if (!parts.hostname) { return ""; } else if (URI.ip6_expression.test(parts.hostname)) { t += "[" + parts.hostname + "]"; } else { t += parts.hostname; } if (parts.port) { t += ":" + parts.port; } return t; }; URI.buildAuthority = function(parts) { return URI.buildUserinfo(parts) + URI.buildHost(parts); }; URI.buildUserinfo = function(parts) { var t = ""; if (parts.username) { t += URI.encode(parts.username); } if (parts.password) { t += ":" + URI.encode(parts.password); } if (t) { t += "@"; } return t; }; URI.buildQuery = function(data, duplicateQueryParameters, escapeQuerySpace) { var t = ""; var unique, key, i, length3; for (key in data) { if (key === "__proto__") { continue; } else if (hasOwn.call(data, key)) { if (isArray(data[key])) { unique = {}; for (i = 0, length3 = data[key].length; i < length3; i++) { if (data[key][i] !== void 0 && unique[data[key][i] + ""] === void 0) { t += "&" + URI.buildQueryParameter(key, data[key][i], escapeQuerySpace); if (duplicateQueryParameters !== true) { unique[data[key][i] + ""] = true; } } } } else if (data[key] !== void 0) { t += "&" + URI.buildQueryParameter(key, data[key], escapeQuerySpace); } } } return t.substring(1); }; URI.buildQueryParameter = function(name, value, escapeQuerySpace) { return URI.encodeQuery(name, escapeQuerySpace) + (value !== null ? "=" + URI.encodeQuery(value, escapeQuerySpace) : ""); }; URI.addQuery = function(data, name, value) { if (typeof name === "object") { for (var key in name) { if (hasOwn.call(name, key)) { URI.addQuery(data, key, name[key]); } } } else if (typeof name === "string") { if (data[name] === void 0) { data[name] = value; return; } else if (typeof data[name] === "string") { data[name] = [data[name]]; } if (!isArray(value)) { value = [value]; } data[name] = (data[name] || []).concat(value); } else { throw new TypeError("URI.addQuery() accepts an object, string as the name parameter"); } }; URI.setQuery = function(data, name, value) { if (typeof name === "object") { for (var key in name) { if (hasOwn.call(name, key)) { URI.setQuery(data, key, name[key]); } } } else if (typeof name === "string") { data[name] = value === void 0 ? null : value; } else { throw new TypeError("URI.setQuery() accepts an object, string as the name parameter"); } }; URI.removeQuery = function(data, name, value) { var i, length3, key; if (isArray(name)) { for (i = 0, length3 = name.length; i < length3; i++) { data[name[i]] = void 0; } } else if (getType(name) === "RegExp") { for (key in data) { if (name.test(key)) { data[key] = void 0; } } } else if (typeof name === "object") { for (key in name) { if (hasOwn.call(name, key)) { URI.removeQuery(data, key, name[key]); } } } else if (typeof name === "string") { if (value !== void 0) { if (getType(value) === "RegExp") { if (!isArray(data[name]) && value.test(data[name])) { data[name] = void 0; } else { data[name] = filterArrayValues(data[name], value); } } else if (data[name] === String(value) && (!isArray(value) || value.length === 1)) { data[name] = void 0; } else if (isArray(data[name])) { data[name] = filterArrayValues(data[name], value); } } else { data[name] = void 0; } } else { throw new TypeError("URI.removeQuery() accepts an object, string, RegExp as the first parameter"); } }; URI.hasQuery = function(data, name, value, withinArray) { switch (getType(name)) { case "String": break; case "RegExp": for (var key in data) { if (hasOwn.call(data, key)) { if (name.test(key) && (value === void 0 || URI.hasQuery(data, key, value))) { return true; } } } return false; case "Object": for (var _key in name) { if (hasOwn.call(name, _key)) { if (!URI.hasQuery(data, _key, name[_key])) { return false; } } } return true; default: throw new TypeError("URI.hasQuery() accepts a string, regular expression or object as the name parameter"); } switch (getType(value)) { case "Undefined": return name in data; case "Boolean": var _booly = Boolean(isArray(data[name]) ? data[name].length : data[name]); return value === _booly; case "Function": return !!value(data[name], name, data); case "Array": if (!isArray(data[name])) { return false; } var op = withinArray ? arrayContains : arraysEqual; return op(data[name], value); case "RegExp": if (!isArray(data[name])) { return Boolean(data[name] && data[name].match(value)); } if (!withinArray) { return false; } return arrayContains(data[name], value); case "Number": value = String(value); case "String": if (!isArray(data[name])) { return data[name] === value; } if (!withinArray) { return false; } return arrayContains(data[name], value); default: throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter"); } }; URI.joinPaths = function() { var input = []; var segments = []; var nonEmptySegments = 0; for (var i = 0; i < arguments.length; i++) { var url2 = new URI(arguments[i]); input.push(url2); var _segments = url2.segment(); for (var s = 0; s < _segments.length; s++) { if (typeof _segments[s] === "string") { segments.push(_segments[s]); } if (_segments[s]) { nonEmptySegments++; } } } if (!segments.length || !nonEmptySegments) { return new URI(""); } var uri = new URI("").segment(segments); if (input[0].path() === "" || input[0].path().slice(0, 1) === "/") { uri.path("/" + uri.path()); } return uri.normalize(); }; URI.commonPath = function(one, two) { var length3 = Math.min(one.length, two.length); var pos; for (pos = 0; pos < length3; pos++) { if (one.charAt(pos) !== two.charAt(pos)) { pos--; break; } } if (pos < 1) { return one.charAt(0) === two.charAt(0) && one.charAt(0) === "/" ? "/" : ""; } if (one.charAt(pos) !== "/" || two.charAt(pos) !== "/") { pos = one.substring(0, pos).lastIndexOf("/"); } return one.substring(0, pos + 1); }; URI.withinString = function(string, callback, options) { options || (options = {}); var _start = options.start || URI.findUri.start; var _end = options.end || URI.findUri.end; var _trim = options.trim || URI.findUri.trim; var _parens = options.parens || URI.findUri.parens; var _attributeOpen = /[a-z0-9-]=["']?$/i; _start.lastIndex = 0; while (true) { var match = _start.exec(string); if (!match) { break; } var start = match.index; if (options.ignoreHtml) { var attributeOpen = string.slice(Math.max(start - 3, 0), start); if (attributeOpen && _attributeOpen.test(attributeOpen)) { continue; } } var end = start + string.slice(start).search(_end); var slice = string.slice(start, end); var parensEnd = -1; while (true) { var parensMatch = _parens.exec(slice); if (!parensMatch) { break; } var parensMatchEnd = parensMatch.index + parensMatch[0].length; parensEnd = Math.max(parensEnd, parensMatchEnd); } if (parensEnd > -1) { slice = slice.slice(0, parensEnd) + slice.slice(parensEnd).replace(_trim, ""); } else { slice = slice.replace(_trim, ""); } if (slice.length <= match[0].length) { continue; } if (options.ignore && options.ignore.test(slice)) { continue; } end = start + slice.length; var result = callback(slice, start, end, string); if (result === void 0) { _start.lastIndex = end; continue; } result = String(result); string = string.slice(0, start) + result + string.slice(end); _start.lastIndex = start + result.length; } _start.lastIndex = 0; return string; }; URI.ensureValidHostname = function(v7, protocol) { var hasHostname = !!v7; var hasProtocol = !!protocol; var rejectEmptyHostname = false; if (hasProtocol) { rejectEmptyHostname = arrayContains(URI.hostProtocols, protocol); } if (rejectEmptyHostname && !hasHostname) { throw new TypeError("Hostname cannot be empty, if protocol is " + protocol); } else if (v7 && v7.match(URI.invalid_hostname_characters)) { if (!punycode) { throw new TypeError('Hostname "' + v7 + '" contains characters other than [A-Z0-9.-:_] and Punycode.js is not available'); } if (punycode.toASCII(v7).match(URI.invalid_hostname_characters)) { throw new TypeError('Hostname "' + v7 + '" contains characters other than [A-Z0-9.-:_]'); } } }; URI.ensureValidPort = function(v7) { if (!v7) { return; } var port = Number(v7); if (isInteger(port) && port > 0 && port < 65536) { return; } throw new TypeError('Port "' + v7 + '" is not a valid port'); }; URI.noConflict = function(removeAll) { if (removeAll) { var unconflicted = { URI: this.noConflict() }; if (root.URITemplate && typeof root.URITemplate.noConflict === "function") { unconflicted.URITemplate = root.URITemplate.noConflict(); } if (root.IPv6 && typeof root.IPv6.noConflict === "function") { unconflicted.IPv6 = root.IPv6.noConflict(); } if (root.SecondLevelDomains && typeof root.SecondLevelDomains.noConflict === "function") { unconflicted.SecondLevelDomains = root.SecondLevelDomains.noConflict(); } return unconflicted; } else if (root.URI === this) { root.URI = _URI; } return this; }; p.build = function(deferBuild) { if (deferBuild === true) { this._deferred_build = true; } else if (deferBuild === void 0 || this._deferred_build) { this._string = URI.build(this._parts); this._deferred_build = false; } return this; }; p.clone = function() { return new URI(this); }; p.valueOf = p.toString = function() { return this.build(false)._string; }; function generateSimpleAccessor(_part2) { return function(v7, build) { if (v7 === void 0) { return this._parts[_part2] || ""; } else { this._parts[_part2] = v7 || null; this.build(!build); return this; } }; } function generatePrefixAccessor(_part2, _key) { return function(v7, build) { if (v7 === void 0) { return this._parts[_part2] || ""; } else { if (v7 !== null) { v7 = v7 + ""; if (v7.charAt(0) === _key) { v7 = v7.substring(1); } } this._parts[_part2] = v7; this.build(!build); return this; } }; } p.protocol = generateSimpleAccessor("protocol"); p.username = generateSimpleAccessor("username"); p.password = generateSimpleAccessor("password"); p.hostname = generateSimpleAccessor("hostname"); p.port = generateSimpleAccessor("port"); p.query = generatePrefixAccessor("query", "?"); p.fragment = generatePrefixAccessor("fragment", "#"); p.search = function(v7, build) { var t = this.query(v7, build); return typeof t === "string" && t.length ? "?" + t : t; }; p.hash = function(v7, build) { var t = this.fragment(v7, build); return typeof t === "string" && t.length ? "#" + t : t; }; p.pathname = function(v7, build) { if (v7 === void 0 || v7 === true) { var res = this._parts.path || (this._parts.hostname ? "/" : ""); return v7 ? (this._parts.urn ? URI.decodeUrnPath : URI.decodePath)(res) : res; } else { if (this._parts.urn) { this._parts.path = v7 ? URI.recodeUrnPath(v7) : ""; } else { this._parts.path = v7 ? URI.recodePath(v7) : "/"; } this.build(!build); return this; } }; p.path = p.pathname; p.href = function(href, build) { var key; if (href === void 0) { return this.toString(); } this._string = ""; this._parts = URI._parts(); var _URI2 = href instanceof URI; var _object = typeof href === "object" && (href.hostname || href.path || href.pathname); if (href.nodeName) { var attribute = URI.getDomAttribute(href); href = href[attribute] || ""; _object = false; } if (!_URI2 && _object && href.pathname !== void 0) { href = href.toString(); } if (typeof href === "string" || href instanceof String) { this._parts = URI.parse(String(href), this._parts); } else if (_URI2 || _object) { var src = _URI2 ? href._parts : href; for (key in src) { if (key === "query") { continue; } if (hasOwn.call(this._parts, key)) { this._parts[key] = src[key]; } } if (src.query) { this.query(src.query, false); } } else { throw new TypeError("invalid input"); } this.build(!build); return this; }; p.is = function(what) { var ip = false; var ip4 = false; var ip6 = false; var name = false; var sld = false; var idn = false; var punycode2 = false; var relative = !this._parts.urn; if (this._parts.hostname) { relative = false; ip4 = URI.ip4_expression.test(this._parts.hostname); ip6 = URI.ip6_expression.test(this._parts.hostname); ip = ip4 || ip6; name = !ip; sld = name && SLD && SLD.has(this._parts.hostname); idn = name && URI.idn_expression.test(this._parts.hostname); punycode2 = name && URI.punycode_expression.test(this._parts.hostname); } switch (what.toLowerCase()) { case "relative": return relative; case "absolute": return !relative; case "domain": case "name": return name; case "sld": return sld; case "ip": return ip; case "ip4": case "ipv4": case "inet4": return ip4; case "ip6": case "ipv6": case "inet6": return ip6; case "idn": return idn; case "url": return !this._parts.urn; case "urn": return !!this._parts.urn; case "punycode": return punycode2; } return null; }; var _protocol = p.protocol; var _port = p.port; var _hostname = p.hostname; p.protocol = function(v7, build) { if (v7) { v7 = v7.replace(/:(\/\/)?$/, ""); if (!v7.match(URI.protocol_expression)) { throw new TypeError('Protocol "' + v7 + `" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]`); } } return _protocol.call(this, v7, build); }; p.scheme = p.protocol; p.port = function(v7, build) { if (this._parts.urn) { return v7 === void 0 ? "" : this; } if (v7 !== void 0) { if (v7 === 0) { v7 = null; } if (v7) { v7 += ""; if (v7.charAt(0) === ":") { v7 = v7.substring(1); } URI.ensureValidPort(v7); } } return _port.call(this, v7, build); }; p.hostname = function(v7, build) { if (this._parts.urn) { return v7 === void 0 ? "" : this; } if (v7 !== void 0) { var x = { preventInvalidHostname: this._parts.preventInvalidHostname }; var res = URI.parseHost(v7, x); if (res !== "/") { throw new TypeError('Hostname "' + v7 + '" contains characters other than [A-Z0-9.-]'); } v7 = x.hostname; if (this._parts.preventInvalidHostname) { URI.ensureValidHostname(v7, this._parts.protocol); } } return _hostname.call(this, v7, build); }; p.origin = function(v7, build) { if (this._parts.urn) { return v7 === void 0 ? "" : this; } if (v7 === void 0) { var protocol = this.protocol(); var authority = this.authority(); if (!authority) { return ""; } return (protocol ? protocol + "://" : "") + this.authority(); } else { var origin = URI(v7); this.protocol(origin.protocol()).authority(origin.authority()).build(!build); return this; } }; p.host = function(v7, build) { if (this._parts.urn) { return v7 === void 0 ? "" : this; } if (v7 === void 0) { return this._parts.hostname ? URI.buildHost(this._parts) : ""; } else { var res = URI.parseHost(v7, this._parts); if (res !== "/") { throw new TypeError('Hostname "' + v7 + '" contains characters other than [A-Z0-9.-]'); } this.build(!build); return this; } }; p.authority = function(v7, build) { if (this._parts.urn) { return v7 === void 0 ? "" : this; } if (v7 === void 0) { return this._parts.hostname ? URI.buildAuthority(this._parts) : ""; } else { var res = URI.parseAuthority(v7, this._parts); if (res !== "/") { throw new TypeError('Hostname "' + v7 + '" contains characters other than [A-Z0-9.-]'); } this.build(!build); return this; } }; p.userinfo = function(v7, build) { if (this._parts.urn) { return v7 === void 0 ? "" : this; } if (v7 === void 0) { var t = URI.buildUserinfo(this._parts); return t ? t.substring(0, t.length - 1) : t; } else { if (v7[v7.length - 1] !== "@") { v7 += "@"; } URI.parseUserinfo(v7, this._parts); this.build(!build); return this; } }; p.resource = function(v7, build) { var parts; if (v7 === void 0) { return this.path() + this.search() + this.hash(); } parts = URI.parse(v7); this._parts.path = parts.path; this._parts.query = parts.query; this._parts.fragment = parts.fragment; this.build(!build); return this; }; p.subdomain = function(v7, build) { if (this._parts.urn) { return v7 === void 0 ? "" : this; } if (v7 === void 0) { if (!this._parts.hostname || this.is("IP")) { return ""; } var end = this._parts.hostname.length - this.domain().length - 1; return this._parts.hostname.substring(0, end) || ""; } else { var e = this._parts.hostname.length - this.domain().length; var sub = this._parts.hostname.substring(0, e); var replace = new RegExp("^" + escapeRegEx(sub)); if (v7 && v7.charAt(v7.length - 1) !== ".") { v7 += "."; } if (v7.indexOf(":") !== -1) { throw new TypeError("Domains cannot contain colons"); } if (v7) { URI.ensureValidHostname(v7, this._parts.protocol); } this._parts.hostname = this._parts.hostname.replace(replace, v7); this.build(!build); return this; } }; p.domain = function(v7, build) { if (this._parts.urn) { return v7 === void 0 ? "" : this; } if (typeof v7 === "boolean") { build = v7; v7 = void 0; } if (v7 === void 0) { if (!this._parts.hostname || this.is("IP")) { return ""; } var t = this._parts.hostname.match(/\./g); if (t && t.length < 2) { return this._parts.hostname; } var end = this._parts.hostname.length - this.tld(build).length - 1; end = this._parts.hostname.lastIndexOf(".", end - 1) + 1; return this._parts.hostname.substring(end) || ""; } else { if (!v7) { throw new TypeError("cannot set domain empty"); } if (v7.indexOf(":") !== -1) { throw new TypeError("Domains cannot contain colons"); } URI.ensureValidHostname(v7, this._parts.protocol); if (!this._parts.hostname || this.is("IP")) { this._parts.hostname = v7; } else { var replace = new RegExp(escapeRegEx(this.domain()) + "$"); this._parts.hostname = this._parts.hostname.replace(replace, v7); } this.build(!build); return this; } }; p.tld = function(v7, build) { if (this._parts.urn) { return v7 === void 0 ? "" : this; } if (typeof v7 === "boolean") { build = v7; v7 = void 0; } if (v7 === void 0) { if (!this._parts.hostname || this.is("IP")) { return ""; } var pos = this._parts.hostname.lastIndexOf("."); var tld = this._parts.hostname.substring(pos + 1); if (build !== true && SLD && SLD.list[tld.toLowerCase()]) { return SLD.get(this._parts.hostname) || tld; } return tld; } else { var replace; if (!v7) { throw new TypeError("cannot set TLD empty"); } else if (v7.match(/[^a-zA-Z0-9-]/)) { if (SLD && SLD.is(v7)) { replace = new RegExp(escapeRegEx(this.tld()) + "$"); this._parts.hostname = this._parts.hostname.replace(replace, v7); } else { throw new TypeError('TLD "' + v7 + '" contains characters other than [A-Z0-9]'); } } else if (!this._parts.hostname || this.is("IP")) { throw new ReferenceError("cannot set TLD on non-domain host"); } else { replace = new RegExp(escapeRegEx(this.tld()) + "$"); this._parts.hostname = this._parts.hostname.replace(replace, v7); } this.build(!build); return this; } }; p.directory = function(v7, build) { if (this._parts.urn) { return v7 === void 0 ? "" : this; } if (v7 === void 0 || v7 === true) { if (!this._parts.path && !this._parts.hostname) { return ""; } if (this._parts.path === "/") { return "/"; } var end = this._parts.path.length - this.filename().length - 1; var res = this._parts.path.substring(0, end) || (this._parts.hostname ? "/" : ""); return v7 ? URI.decodePath(res) : res; } else { var e = this._parts.path.length - this.filename().length; var directory = this._parts.path.substring(0, e); var replace = new RegExp("^" + escapeRegEx(directory)); if (!this.is("relative")) { if (!v7) { v7 = "/"; } if (v7.charAt(0) !== "/") { v7 = "/" + v7; } } if (v7 && v7.charAt(v7.length - 1) !== "/") { v7 += "/"; } v7 = URI.recodePath(v7); this._parts.path = this._parts.path.replace(replace, v7); this.build(!build); return this; } }; p.filename = function(v7, build) { if (this._parts.urn) { return v7 === void 0 ? "" : this; } if (typeof v7 !== "string") { if (!this._parts.path || this._parts.path === "/") { return ""; } var pos = this._parts.path.lastIndexOf("/"); var res = this._parts.path.substring(pos + 1); return v7 ? URI.decodePathSegment(res) : res; } else { var mutatedDirectory = false; if (v7.charAt(0) === "/") { v7 = v7.substring(1); } if (v7.match(/\.?\//)) { mutatedDirectory = true; } var replace = new RegExp(escapeRegEx(this.filename()) + "$"); v7 = URI.recodePath(v7); this._parts.path = this._parts.path.replace(replace, v7); if (mutatedDirectory) { this.normalizePath(build); } else { this.build(!build); } return this; } }; p.suffix = function(v7, build) { if (this._parts.urn) { return v7 === void 0 ? "" : this; } if (v7 === void 0 || v7 === true) { if (!this._parts.path || this._parts.path === "/") { return ""; } var filename = this.filename(); var pos = filename.lastIndexOf("."); var s, res; if (pos === -1) { return ""; } s = filename.substring(pos + 1); res = /^[a-z0-9%]+$/i.test(s) ? s : ""; return v7 ? URI.decodePathSegment(res) : res; } else { if (v7.charAt(0) === ".") { v7 = v7.substring(1); } var suffix = this.suffix(); var replace; if (!suffix) { if (!v7) { return this; } this._parts.path += "." + URI.recodePath(v7); } else if (!v7) { replace = new RegExp(escapeRegEx("." + suffix) + "$"); } else { replace = new RegExp(escapeRegEx(suffix) + "$"); } if (replace) { v7 = URI.recodePath(v7); this._parts.path = this._parts.path.replace(replace, v7); } this.build(!build); return this; } }; p.segment = function(segment, v7, build) { var separator = this._parts.urn ? ":" : "/"; var path = this.path(); var absolute = path.substring(0, 1) === "/"; var segments = path.split(separator); if (segment !== void 0 && typeof segment !== "number") { build = v7; v7 = segment; segment = void 0; } if (segment !== void 0 && typeof segment !== "number") { throw new Error('Bad segment "' + segment + '", must be 0-based integer'); } if (absolute) { segments.shift(); } if (segment < 0) { segment = Math.max(segments.length + segment, 0); } if (v7 === void 0) { return segment === void 0 ? segments : segments[segment]; } else if (segment === null || segments[segment] === void 0) { if (isArray(v7)) { segments = []; for (var i = 0, l = v7.length; i < l; i++) { if (!v7[i].length && (!segments.length || !segments[segments.length - 1].length)) { continue; } if (segments.length && !segments[segments.length - 1].length) { segments.pop(); } segments.push(trimSlashes(v7[i])); } } else if (v7 || typeof v7 === "string") { v7 = trimSlashes(v7); if (segments[segments.length - 1] === "") { segments[segments.length - 1] = v7; } else { segments.push(v7); } } } else { if (v7) { segments[segment] = trimSlashes(v7); } else { segments.splice(segment, 1); } } if (absolute) { segments.unshift(""); } return this.path(segments.join(separator), build); }; p.segmentCoded = function(segment, v7, build) { var segments, i, l; if (typeof segment !== "number") { build = v7; v7 = segment; segment = void 0; } if (v7 === void 0) { segments = this.segment(segment, v7, build); if (!isArray(segments)) { segments = segments !== void 0 ? URI.decode(segments) : void 0; } else { for (i = 0, l = segments.length; i < l; i++) { segments[i] = URI.decode(segments[i]); } } return segments; } if (!isArray(v7)) { v7 = typeof v7 === "string" || v7 instanceof String ? URI.encode(v7) : v7; } else { for (i = 0, l = v7.length; i < l; i++) { v7[i] = URI.encode(v7[i]); } } return this.segment(segment, v7, build); }; var q = p.query; p.query = function(v7, build) { if (v7 === true) { return URI.parseQuery(this._parts.query, this._parts.escapeQuerySpace); } else if (typeof v7 === "function") { var data = URI.parseQuery(this._parts.query, this._parts.escapeQuerySpace); var result = v7.call(this, data); this._parts.query = URI.buildQuery(result || data, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace); this.build(!build); return this; } else if (v7 !== void 0 && typeof v7 !== "string") { this._parts.query = URI.buildQuery(v7, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace); this.build(!build); return this; } else { return q.call(this, v7, build); } }; p.setQuery = function(name, value, build) { var data = URI.parseQuery(this._parts.query, this._parts.escapeQuerySpace); if (typeof name === "string" || name instanceof String) { data[name] = value !== void 0 ? value : null; } else if (typeof name === "object") { for (var key in name) { if (hasOwn.call(name, key)) { data[key] = name[key]; } } } else { throw new TypeError("URI.addQuery() accepts an object, string as the name parameter"); } this._parts.query = URI.buildQuery(data, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace); if (typeof name !== "string") { build = value; } this.build(!build); return this; }; p.addQuery = function(name, value, build) { var data = URI.parseQuery(this._parts.query, this._parts.escapeQuerySpace); URI.addQuery(data, name, value === void 0 ? null : value); this._parts.query = URI.buildQuery(data, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace); if (typeof name !== "string") { build = value; } this.build(!build); return this; }; p.removeQuery = function(name, value, build) { var data = URI.parseQuery(this._parts.query, this._parts.escapeQuerySpace); URI.removeQuery(data, name, value); this._parts.query = URI.buildQuery(data, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace); if (typeof name !== "string") { build = value; } this.build(!build); return this; }; p.hasQuery = function(name, value, withinArray) { var data = URI.parseQuery(this._parts.query, this._parts.escapeQuerySpace); return URI.hasQuery(data, name, value, withinArray); }; p.setSearch = p.setQuery; p.addSearch = p.addQuery; p.removeSearch = p.removeQuery; p.hasSearch = p.hasQuery; p.normalize = function() { if (this._parts.urn) { return this.normalizeProtocol(false).normalizePath(false).normalizeQuery(false).normalizeFragment(false).build(); } return this.normalizeProtocol(false).normalizeHostname(false).normalizePort(false).normalizePath(false).normalizeQuery(false).normalizeFragment(false).build(); }; p.normalizeProtocol = function(build) { if (typeof this._parts.protocol === "string") { this._parts.protocol = this._parts.protocol.toLowerCase(); this.build(!build); } return this; }; p.normalizeHostname = function(build) { if (this._parts.hostname) { if (this.is("IDN") && punycode) { this._parts.hostname = punycode.toASCII(this._parts.hostname); } else if (this.is("IPv6") && IPv6) { this._parts.hostname = IPv6.best(this._parts.hostname); } this._parts.hostname = this._parts.hostname.toLowerCase(); this.build(!build); } return this; }; p.normalizePort = function(build) { if (typeof this._parts.protocol === "string" && this._parts.port === URI.defaultPorts[this._parts.protocol]) { this._parts.port = null; this.build(!build); } return this; }; p.normalizePath = function(build) { var _path = this._parts.path; if (!_path) { return this; } if (this._parts.urn) { this._parts.path = URI.recodeUrnPath(this._parts.path); this.build(!build); return this; } if (this._parts.path === "/") { return this; } _path = URI.recodePath(_path); var _was_relative; var _leadingParents = ""; var _parent, _pos; if (_path.charAt(0) !== "/") { _was_relative = true; _path = "/" + _path; } if (_path.slice(-3) === "/.." || _path.slice(-2) === "/.") { _path += "/"; } _path = _path.replace(/(\/(\.\/)+)|(\/\.$)/g, "/").replace(/\/{2,}/g, "/"); if (_was_relative) { _leadingParents = _path.substring(1).match(/^(\.\.\/)+/) || ""; if (_leadingParents) { _leadingParents = _leadingParents[0]; } } while (true) { _parent = _path.search(/\/\.\.(\/|$)/); if (_parent === -1) { break; } else if (_parent === 0) { _path = _path.substring(3); continue; } _pos = _path.substring(0, _parent).lastIndexOf("/"); if (_pos === -1) { _pos = _parent; } _path = _path.substring(0, _pos) + _path.substring(_parent + 3); } if (_was_relative && this.is("relative")) { _path = _leadingParents + _path.substring(1); } this._parts.path = _path; this.build(!build); return this; }; p.normalizePathname = p.normalizePath; p.normalizeQuery = function(build) { if (typeof this._parts.query === "string") { if (!this._parts.query.length) { this._parts.query = null; } else { this.query(URI.parseQuery(this._parts.query, this._parts.escapeQuerySpace)); } this.build(!build); } return this; }; p.normalizeFragment = function(build) { if (!this._parts.fragment) { this._parts.fragment = null; this.build(!build); } return this; }; p.normalizeSearch = p.normalizeQuery; p.normalizeHash = p.normalizeFragment; p.iso8859 = function() { var e = URI.encode; var d = URI.decode; URI.encode = escape; URI.decode = decodeURIComponent; try { this.normalize(); } finally { URI.encode = e; URI.decode = d; } return this; }; p.unicode = function() { var e = URI.encode; var d = URI.decode; URI.encode = strictEncodeURIComponent; URI.decode = unescape; try { this.normalize(); } finally { URI.encode = e; URI.decode = d; } return this; }; p.readable = function() { var uri = this.clone(); uri.username("").password("").normalize(); var t = ""; if (uri._parts.protocol) { t += uri._parts.protocol + "://"; } if (uri._parts.hostname) { if (uri.is("punycode") && punycode) { t += punycode.toUnicode(uri._parts.hostname); if (uri._parts.port) { t += ":" + uri._parts.port; } } else { t += uri.host(); } } if (uri._parts.hostname && uri._parts.path && uri._parts.path.charAt(0) !== "/") { t += "/"; } t += uri.path(true); if (uri._parts.query) { var q3 = ""; for (var i = 0, qp = uri._parts.query.split("&"), l = qp.length; i < l; i++) { var kv = (qp[i] || "").split("="); q3 += "&" + URI.decodeQuery(kv[0], this._parts.escapeQuerySpace).replace(/&/g, "%26"); if (kv[1] !== void 0) { q3 += "=" + URI.decodeQuery(kv[1], this._parts.escapeQuerySpace).replace(/&/g, "%26"); } } t += "?" + q3.substring(1); } t += URI.decodeQuery(uri.hash(), true); return t; }; p.absoluteTo = function(base) { var resolved = this.clone(); var properties = ["protocol", "username", "password", "hostname", "port"]; var basedir, i, p2; if (this._parts.urn) { throw new Error("URNs do not have any generally defined hierarchical components"); } if (!(base instanceof URI)) { base = new URI(base); } if (resolved._parts.protocol) { return resolved; } else { resolved._parts.protocol = base._parts.protocol; } if (this._parts.hostname) { return resolved; } for (i = 0; p2 = properties[i]; i++) { resolved._parts[p2] = base._parts[p2]; } if (!resolved._parts.path) { resolved._parts.path = base._parts.path; if (!resolved._parts.query) { resolved._parts.query = base._parts.query; } } else { if (resolved._parts.path.substring(-2) === "..") { resolved._parts.path += "/"; } if (resolved.path().charAt(0) !== "/") { basedir = base.directory(); basedir = basedir ? basedir : base.path().indexOf("/") === 0 ? "/" : ""; resolved._parts.path = (basedir ? basedir + "/" : "") + resolved._parts.path; resolved.normalizePath(); } } resolved.build(); return resolved; }; p.relativeTo = function(base) { var relative = this.clone().normalize(); var relativeParts, baseParts, common, relativePath, basePath; if (relative._parts.urn) { throw new Error("URNs do not have any generally defined hierarchical components"); } base = new URI(base).normalize(); relativeParts = relative._parts; baseParts = base._parts; relativePath = relative.path(); basePath = base.path(); if (relativePath.charAt(0) !== "/") { throw new Error("URI is already relative"); } if (basePath.charAt(0) !== "/") { throw new Error("Cannot calculate a URI relative to another relative URI"); } if (relativeParts.protocol === baseParts.protocol) { relativeParts.protocol = null; } if (relativeParts.username !== baseParts.username || relativeParts.password !== baseParts.password) { return relative.build(); } if (relativeParts.protocol !== null || relativeParts.username !== null || relativeParts.password !== null) { return relative.build(); } if (relativeParts.hostname === baseParts.hostname && relativeParts.port === baseParts.port) { relativeParts.hostname = null; relativeParts.port = null; } else { return relative.build(); } if (relativePath === basePath) { relativeParts.path = ""; return relative.build(); } common = URI.commonPath(relativePath, basePath); if (!common) { return relative.build(); } var parents = baseParts.path.substring(common.length).replace(/[^\/]*$/, "").replace(/.*?\//g, "../"); relativeParts.path = parents + relativeParts.path.substring(common.length) || "./"; return relative.build(); }; p.equals = function(uri) { var one = this.clone(); var two = new URI(uri); var one_map = {}; var two_map = {}; var checked = {}; var one_query, two_query, key; one.normalize(); two.normalize(); if (one.toString() === two.toString()) { return true; } one_query = one.query(); two_query = two.query(); one.query(""); two.query(""); if (one.toString() !== two.toString()) { return false; } if (one_query.length !== two_query.length) { return false; } one_map = URI.parseQuery(one_query, this._parts.escapeQuerySpace); two_map = URI.parseQuery(two_query, this._parts.escapeQuerySpace); for (key in one_map) { if (hasOwn.call(one_map, key)) { if (!isArray(one_map[key])) { if (one_map[key] !== two_map[key]) { return false; } } else if (!arraysEqual(one_map[key], two_map[key])) { return false; } checked[key] = true; } } for (key in two_map) { if (hasOwn.call(two_map, key)) { if (!checked[key]) { return false; } } } return true; }; p.preventInvalidHostname = function(v7) { this._parts.preventInvalidHostname = !!v7; return this; }; p.duplicateQueryParameters = function(v7) { this._parts.duplicateQueryParameters = !!v7; return this; }; p.escapeQuerySpace = function(v7) { this._parts.escapeQuerySpace = !!v7; return this; }; return URI; }); } }); // node_modules/dompurify/dist/purify.cjs.js var require_purify_cjs = __commonJS({ "node_modules/dompurify/dist/purify.cjs.js"(exports2, module2) { "use strict"; /*! @license DOMPurify 2.3.10 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.3.10/LICENSE */ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { return typeof obj2; } : function(obj2) { return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; }, _typeof(obj); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) { o2.__proto__ = p2; return o2; }; return _setPrototypeOf(o, p); } 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 _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct2(Parent2, args2, Class2) { var a3 = [null]; a3.push.apply(a3, args2); var Constructor = Function.bind.apply(Parent2, a3); var instance = new Constructor(); if (Class2) _setPrototypeOf(instance, Class2.prototype); return instance; }; } return _construct.apply(null, arguments); } function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } 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 _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var hasOwnProperty = Object.hasOwnProperty; var setPrototypeOf = Object.setPrototypeOf; var isFrozen = Object.isFrozen; var getPrototypeOf = Object.getPrototypeOf; var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; var freeze = Object.freeze; var seal = Object.seal; var create = Object.create; var _ref = typeof Reflect !== "undefined" && Reflect; var apply = _ref.apply; var construct = _ref.construct; if (!apply) { apply = function apply2(fun, thisValue, args) { return fun.apply(thisValue, args); }; } if (!freeze) { freeze = function freeze2(x) { return x; }; } if (!seal) { seal = function seal2(x) { return x; }; } if (!construct) { construct = function construct2(Func, args) { return _construct(Func, _toConsumableArray(args)); }; } var arrayForEach = unapply(Array.prototype.forEach); var arrayPop = unapply(Array.prototype.pop); var arrayPush = unapply(Array.prototype.push); var stringToLowerCase = unapply(String.prototype.toLowerCase); var stringMatch = unapply(String.prototype.match); var stringReplace = unapply(String.prototype.replace); var stringIndexOf = unapply(String.prototype.indexOf); var stringTrim = unapply(String.prototype.trim); var regExpTest = unapply(RegExp.prototype.test); var typeErrorCreate = unconstruct(TypeError); function unapply(func) { return function(thisArg) { for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } return apply(func, thisArg, args); }; } function unconstruct(func) { return function() { for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } return construct(func, args); }; } function addToSet(set2, array, transformCaseFunc) { transformCaseFunc = transformCaseFunc ? transformCaseFunc : stringToLowerCase; if (setPrototypeOf) { setPrototypeOf(set2, null); } var l = array.length; while (l--) { var element = array[l]; if (typeof element === "string") { var lcElement = transformCaseFunc(element); if (lcElement !== element) { if (!isFrozen(array)) { array[l] = lcElement; } element = lcElement; } } set2[element] = true; } return set2; } function clone2(object) { var newObject = create(null); var property; for (property in object) { if (apply(hasOwnProperty, object, [property])) { newObject[property] = object[property]; } } return newObject; } function lookupGetter(object, prop) { while (object !== null) { var desc = getOwnPropertyDescriptor(object, prop); if (desc) { if (desc.get) { return unapply(desc.get); } if (typeof desc.value === "function") { return unapply(desc.value); } } object = getPrototypeOf(object); } function fallbackValue(element) { console.warn("fallback value for", element); return null; } return fallbackValue; } var html$1 = freeze(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]); var svg$1 = freeze(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]); var svgFilters = freeze(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]); var svgDisallowed = freeze(["animate", "color-profile", "cursor", "discard", "fedropshadow", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]); var mathMl$1 = freeze(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover"]); var mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]); var text = freeze(["#text"]); var html = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "xmlns", "slot"]); var svg = freeze(["accent-height", "accumulate", "additive", "alignment-baseline", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]); var mathMl = freeze(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]); var xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]); var MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); var ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm); var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); var ARIA_ATTR = seal(/^aria-[\-\w]+$/); var IS_ALLOWED_URI = seal( /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i ); var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i); var ATTR_WHITESPACE = seal( /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g ); var DOCTYPE_NAME = seal(/^html$/i); var getGlobal = function getGlobal2() { return typeof window === "undefined" ? null : window; }; var _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes, document2) { if (_typeof(trustedTypes) !== "object" || typeof trustedTypes.createPolicy !== "function") { return null; } var suffix = null; var ATTR_NAME = "data-tt-policy-suffix"; if (document2.currentScript && document2.currentScript.hasAttribute(ATTR_NAME)) { suffix = document2.currentScript.getAttribute(ATTR_NAME); } var policyName = "dompurify" + (suffix ? "#" + suffix : ""); try { return trustedTypes.createPolicy(policyName, { createHTML: function createHTML(html2) { return html2; }, createScriptURL: function createScriptURL(scriptUrl) { return scriptUrl; } }); } catch (_) { console.warn("TrustedTypes policy " + policyName + " could not be created."); return null; } }; function createDOMPurify() { var window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal(); var DOMPurify = function DOMPurify2(root) { return createDOMPurify(root); }; DOMPurify.version = "2.3.10"; DOMPurify.removed = []; if (!window2 || !window2.document || window2.document.nodeType !== 9) { DOMPurify.isSupported = false; return DOMPurify; } var originalDocument = window2.document; var document2 = window2.document; var DocumentFragment2 = window2.DocumentFragment, HTMLTemplateElement = window2.HTMLTemplateElement, Node6 = window2.Node, Element2 = window2.Element, NodeFilter = window2.NodeFilter, _window$NamedNodeMap = window2.NamedNodeMap, NamedNodeMap = _window$NamedNodeMap === void 0 ? window2.NamedNodeMap || window2.MozNamedAttrMap : _window$NamedNodeMap, HTMLFormElement = window2.HTMLFormElement, DOMParser2 = window2.DOMParser, trustedTypes = window2.trustedTypes; var ElementPrototype = Element2.prototype; var cloneNode = lookupGetter(ElementPrototype, "cloneNode"); var getNextSibling = lookupGetter(ElementPrototype, "nextSibling"); var getChildNodes = lookupGetter(ElementPrototype, "childNodes"); var getParentNode = lookupGetter(ElementPrototype, "parentNode"); if (typeof HTMLTemplateElement === "function") { var template = document2.createElement("template"); if (template.content && template.content.ownerDocument) { document2 = template.content.ownerDocument; } } var trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, originalDocument); var emptyHTML = trustedTypesPolicy ? trustedTypesPolicy.createHTML("") : ""; var _document = document2, implementation4 = _document.implementation, createNodeIterator = _document.createNodeIterator, createDocumentFragment = _document.createDocumentFragment, getElementsByTagName = _document.getElementsByTagName; var importNode = originalDocument.importNode; var documentMode = {}; try { documentMode = clone2(document2).documentMode ? document2.documentMode : {}; } catch (_) { } var hooks = {}; DOMPurify.isSupported = typeof getParentNode === "function" && implementation4 && typeof implementation4.createHTMLDocument !== "undefined" && documentMode !== 9; var MUSTACHE_EXPR$1 = MUSTACHE_EXPR, ERB_EXPR$1 = ERB_EXPR, DATA_ATTR$1 = DATA_ATTR, ARIA_ATTR$1 = ARIA_ATTR, IS_SCRIPT_OR_DATA$1 = IS_SCRIPT_OR_DATA, ATTR_WHITESPACE$1 = ATTR_WHITESPACE; var IS_ALLOWED_URI$1 = IS_ALLOWED_URI; var ALLOWED_TAGS = null; var DEFAULT_ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray(html$1), _toConsumableArray(svg$1), _toConsumableArray(svgFilters), _toConsumableArray(mathMl$1), _toConsumableArray(text))); var ALLOWED_ATTR = null; var DEFAULT_ALLOWED_ATTR = addToSet({}, [].concat(_toConsumableArray(html), _toConsumableArray(svg), _toConsumableArray(mathMl), _toConsumableArray(xml))); var CUSTOM_ELEMENT_HANDLING = Object.seal(Object.create(null, { tagNameCheck: { writable: true, configurable: false, enumerable: true, value: null }, attributeNameCheck: { writable: true, configurable: false, enumerable: true, value: null }, allowCustomizedBuiltInElements: { writable: true, configurable: false, enumerable: true, value: false } })); var FORBID_TAGS = null; var FORBID_ATTR = null; var ALLOW_ARIA_ATTR = true; var ALLOW_DATA_ATTR = true; var ALLOW_UNKNOWN_PROTOCOLS = false; var SAFE_FOR_TEMPLATES = false; var WHOLE_DOCUMENT = false; var SET_CONFIG = false; var FORCE_BODY = false; var RETURN_DOM = false; var RETURN_DOM_FRAGMENT = false; var RETURN_TRUSTED_TYPE = false; var SANITIZE_DOM = true; var KEEP_CONTENT = true; var IN_PLACE = false; var USE_PROFILES = {}; var FORBID_CONTENTS = null; var DEFAULT_FORBID_CONTENTS = addToSet({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]); var DATA_URI_TAGS = null; var DEFAULT_DATA_URI_TAGS = addToSet({}, ["audio", "video", "img", "source", "image", "track"]); var URI_SAFE_ATTRIBUTES = null; var DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]); var MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML"; var SVG_NAMESPACE = "http://www.w3.org/2000/svg"; var HTML_NAMESPACE = "http://www.w3.org/1999/xhtml"; var NAMESPACE = HTML_NAMESPACE; var IS_EMPTY_INPUT = false; var PARSER_MEDIA_TYPE; var SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"]; var DEFAULT_PARSER_MEDIA_TYPE = "text/html"; var transformCaseFunc; var CONFIG = null; var formElement = document2.createElement("form"); var isRegexOrFunction = function isRegexOrFunction2(testValue) { return testValue instanceof RegExp || testValue instanceof Function; }; var _parseConfig = function _parseConfig2(cfg) { if (CONFIG && CONFIG === cfg) { return; } if (!cfg || _typeof(cfg) !== "object") { cfg = {}; } cfg = clone2(cfg); PARSER_MEDIA_TYPE = SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE; transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? function(x) { return x; } : stringToLowerCase; ALLOWED_TAGS = "ALLOWED_TAGS" in cfg ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS; ALLOWED_ATTR = "ALLOWED_ATTR" in cfg ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR; URI_SAFE_ATTRIBUTES = "ADD_URI_SAFE_ATTR" in cfg ? addToSet( clone2(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc ) : DEFAULT_URI_SAFE_ATTRIBUTES; DATA_URI_TAGS = "ADD_DATA_URI_TAGS" in cfg ? addToSet( clone2(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc ) : DEFAULT_DATA_URI_TAGS; FORBID_CONTENTS = "FORBID_CONTENTS" in cfg ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS; FORBID_TAGS = "FORBID_TAGS" in cfg ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {}; FORBID_ATTR = "FORBID_ATTR" in cfg ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {}; USE_PROFILES = "USE_PROFILES" in cfg ? cfg.USE_PROFILES : false; ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; RETURN_DOM = cfg.RETURN_DOM || false; RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; FORCE_BODY = cfg.FORCE_BODY || false; SANITIZE_DOM = cfg.SANITIZE_DOM !== false; KEEP_CONTENT = cfg.KEEP_CONTENT !== false; IN_PLACE = cfg.IN_PLACE || false; IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI$1; NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE; if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) { CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck; } if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) { CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck; } if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === "boolean") { CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements; } if (SAFE_FOR_TEMPLATES) { ALLOW_DATA_ATTR = false; } if (RETURN_DOM_FRAGMENT) { RETURN_DOM = true; } if (USE_PROFILES) { ALLOWED_TAGS = addToSet({}, _toConsumableArray(text)); ALLOWED_ATTR = []; if (USE_PROFILES.html === true) { addToSet(ALLOWED_TAGS, html$1); addToSet(ALLOWED_ATTR, html); } if (USE_PROFILES.svg === true) { addToSet(ALLOWED_TAGS, svg$1); addToSet(ALLOWED_ATTR, svg); addToSet(ALLOWED_ATTR, xml); } if (USE_PROFILES.svgFilters === true) { addToSet(ALLOWED_TAGS, svgFilters); addToSet(ALLOWED_ATTR, svg); addToSet(ALLOWED_ATTR, xml); } if (USE_PROFILES.mathMl === true) { addToSet(ALLOWED_TAGS, mathMl$1); addToSet(ALLOWED_ATTR, mathMl); addToSet(ALLOWED_ATTR, xml); } } if (cfg.ADD_TAGS) { if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) { ALLOWED_TAGS = clone2(ALLOWED_TAGS); } addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc); } if (cfg.ADD_ATTR) { if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) { ALLOWED_ATTR = clone2(ALLOWED_ATTR); } addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc); } if (cfg.ADD_URI_SAFE_ATTR) { addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc); } if (cfg.FORBID_CONTENTS) { if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) { FORBID_CONTENTS = clone2(FORBID_CONTENTS); } addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc); } if (KEEP_CONTENT) { ALLOWED_TAGS["#text"] = true; } if (WHOLE_DOCUMENT) { addToSet(ALLOWED_TAGS, ["html", "head", "body"]); } if (ALLOWED_TAGS.table) { addToSet(ALLOWED_TAGS, ["tbody"]); delete FORBID_TAGS.tbody; } if (freeze) { freeze(cfg); } CONFIG = cfg; }; var MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]); var HTML_INTEGRATION_POINTS = addToSet({}, ["foreignobject", "desc", "title", "annotation-xml"]); var COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ["title", "style", "font", "a", "script"]); var ALL_SVG_TAGS = addToSet({}, svg$1); addToSet(ALL_SVG_TAGS, svgFilters); addToSet(ALL_SVG_TAGS, svgDisallowed); var ALL_MATHML_TAGS = addToSet({}, mathMl$1); addToSet(ALL_MATHML_TAGS, mathMlDisallowed); var _checkValidNamespace = function _checkValidNamespace2(element) { var parent = getParentNode(element); if (!parent || !parent.tagName) { parent = { namespaceURI: HTML_NAMESPACE, tagName: "template" }; } var tagName = stringToLowerCase(element.tagName); var parentTagName = stringToLowerCase(parent.tagName); if (element.namespaceURI === SVG_NAMESPACE) { if (parent.namespaceURI === HTML_NAMESPACE) { return tagName === "svg"; } if (parent.namespaceURI === MATHML_NAMESPACE) { return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]); } return Boolean(ALL_SVG_TAGS[tagName]); } if (element.namespaceURI === MATHML_NAMESPACE) { if (parent.namespaceURI === HTML_NAMESPACE) { return tagName === "math"; } if (parent.namespaceURI === SVG_NAMESPACE) { return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName]; } return Boolean(ALL_MATHML_TAGS[tagName]); } if (element.namespaceURI === HTML_NAMESPACE) { if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) { return false; } if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) { return false; } return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]); } return false; }; var _forceRemove = function _forceRemove2(node) { arrayPush(DOMPurify.removed, { element: node }); try { node.parentNode.removeChild(node); } catch (_) { try { node.outerHTML = emptyHTML; } catch (_2) { node.remove(); } } }; var _removeAttribute = function _removeAttribute2(name, node) { try { arrayPush(DOMPurify.removed, { attribute: node.getAttributeNode(name), from: node }); } catch (_) { arrayPush(DOMPurify.removed, { attribute: null, from: node }); } node.removeAttribute(name); if (name === "is" && !ALLOWED_ATTR[name]) { if (RETURN_DOM || RETURN_DOM_FRAGMENT) { try { _forceRemove(node); } catch (_) { } } else { try { node.setAttribute(name, ""); } catch (_) { } } } }; var _initDocument = function _initDocument2(dirty) { var doc; var leadingWhitespace; if (FORCE_BODY) { dirty = "" + dirty; } else { var matches = stringMatch(dirty, /^[\r\n\t ]+/); leadingWhitespace = matches && matches[0]; } if (PARSER_MEDIA_TYPE === "application/xhtml+xml") { dirty = '' + dirty + ""; } var dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty; if (NAMESPACE === HTML_NAMESPACE) { try { doc = new DOMParser2().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE); } catch (_) { } } if (!doc || !doc.documentElement) { doc = implementation4.createDocument(NAMESPACE, "template", null); try { doc.documentElement.innerHTML = IS_EMPTY_INPUT ? "" : dirtyPayload; } catch (_) { } } var body = doc.body || doc.documentElement; if (dirty && leadingWhitespace) { body.insertBefore(document2.createTextNode(leadingWhitespace), body.childNodes[0] || null); } if (NAMESPACE === HTML_NAMESPACE) { return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0]; } return WHOLE_DOCUMENT ? doc.documentElement : body; }; var _createIterator = function _createIterator2(root) { return createNodeIterator.call( root.ownerDocument || root, root, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null, false ); }; var _isClobbered = function _isClobbered2(elm) { return elm instanceof HTMLFormElement && (typeof elm.nodeName !== "string" || typeof elm.textContent !== "string" || typeof elm.removeChild !== "function" || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== "function" || typeof elm.setAttribute !== "function" || typeof elm.namespaceURI !== "string" || typeof elm.insertBefore !== "function"); }; var _isNode = function _isNode2(object) { return _typeof(Node6) === "object" ? object instanceof Node6 : object && _typeof(object) === "object" && typeof object.nodeType === "number" && typeof object.nodeName === "string"; }; var _executeHook = function _executeHook2(entryPoint, currentNode, data) { if (!hooks[entryPoint]) { return; } arrayForEach(hooks[entryPoint], function(hook) { hook.call(DOMPurify, currentNode, data, CONFIG); }); }; var _sanitizeElements = function _sanitizeElements2(currentNode) { var content; _executeHook("beforeSanitizeElements", currentNode, null); if (_isClobbered(currentNode)) { _forceRemove(currentNode); return true; } if (regExpTest(/[\u0080-\uFFFF]/, currentNode.nodeName)) { _forceRemove(currentNode); return true; } var tagName = transformCaseFunc(currentNode.nodeName); _executeHook("uponSanitizeElement", currentNode, { tagName, allowedTags: ALLOWED_TAGS }); if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && (!_isNode(currentNode.content) || !_isNode(currentNode.content.firstElementChild)) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) { _forceRemove(currentNode); return true; } if (tagName === "select" && regExpTest(/