1const k = "%[a-f0-9]{2}", b = new RegExp("(" + k + ")|([^%]+?)", "gi"), j = new RegExp("(" + k + ")+", "gi"); 2function y(r, o) { 3 try { 4 return [decodeURIComponent(r.join(""))]; 5 } catch (e) { 6 } 7 if (r.length === 1) return r; 8 o = o || 1; 9 const a = r.slice(0, o), i = r.slice(o); 10 return Array.prototype.concat.call([], y(a), y(i)); 11} 12function E(r) { 13 try { 14 return decodeURIComponent(r); 15 } catch (e) { 16 let o = r.match(b) || []; 17 for (let a = 1; a < o.length; a++) o = (r = y(o, a).join("")).match(b) || []; 18 return r; 19 } 20} 21function I(r) { 22 if (typeof r != "string") throw new TypeError("Expected `encodedURI` to be of type `string`, got `" + typeof r + "`"); 23 try { 24 return decodeURIComponent(r); 25 } catch (e) { 26 return (function(o) { 27 const a = { "%FE%FF": "\uFFFD\uFFFD", "%FF%FE": "\uFFFD\uFFFD" }; 28 let i = j.exec(o); 29 for (; i; ) { 30 try { 31 a[i[0]] = decodeURIComponent(i[0]); 32 } catch (e2) { 33 const c = E(i[0]); 34 c !== i[0] && (a[i[0]] = c); 35 } 36 i = j.exec(o); 37 } 38 a["%C2"] = "\uFFFD"; 39 const s = Object.keys(a); 40 for (const c of s) o = o.replace(new RegExp(c, "g"), a[c]); 41 return o; 42 })(r); 43 } 44} 45function $(r, o) { 46 const a = {}; 47 if (Array.isArray(o)) for (const i of o) { 48 const s = Object.getOwnPropertyDescriptor(r, i); 49 (s == null ? void 0 : s.enumerable) && Object.defineProperty(a, i, s); 50 } 51 else for (const i of Reflect.ownKeys(r)) { 52 const s = Object.getOwnPropertyDescriptor(r, i); 53 s.enumerable && o(i, r[i], r) && Object.defineProperty(a, i, s); 54 } 55 return a; 56} 57function N(r, o) { 58 if (typeof r != "string" || typeof o != "string") throw new TypeError("Expected the arguments to be of type `string`"); 59 if (r === "" || o === "") return []; 60 const a = r.indexOf(o); 61 return a === -1 ? [] : [r.slice(0, a), r.slice(a + o.length)]; 62} 63const m = Symbol("encodeFragmentIdentifier"); 64function w(r) { 65 if (typeof r != "string" || r.length !== 1) throw new TypeError("arrayFormatSeparator must be single character string"); 66} 67function u(r, o) { 68 return o.encode ? o.strict ? encodeURIComponent(r).replaceAll(/[!'()*]/g, (a) => "%".concat(a.charCodeAt(0).toString(16).toUpperCase())) : encodeURIComponent(r) : r; 69} 70function f(r, o) { 71 return o.decode ? I(r) : r; 72} 73function O(r) { 74 return Array.isArray(r) ? r.sort() : typeof r == "object" ? O(Object.keys(r)).sort((o, a) => Number(o) - Number(a)).map((o) => r[o]) : r; 75} 76function v(r) { 77 const o = r.indexOf("#"); 78 return o !== -1 && (r = r.slice(0, o)), r; 79} 80function F(r, o, a) { 81 return a === "string" && typeof r == "string" ? r : typeof a == "function" && typeof r == "string" ? a(r) : a === "boolean" && r === null || (a !== "boolean" || r === null || r.toLowerCase() !== "true" && r.toLowerCase() !== "false" ? a !== "boolean" || r === null || r.toLowerCase() !== "1" && r.toLowerCase() !== "0" ? a === "string[]" && o.arrayFormat !== "none" && typeof r == "string" ? [r] : a !== "number[]" || o.arrayFormat === "none" || Number.isNaN(Number(r)) || typeof r != "string" || r.trim() === "" ? a !== "number" || Number.isNaN(Number(r)) || typeof r != "string" || r.trim() === "" ? !o.parseBooleans || r === null || r.toLowerCase() !== "true" && r.toLowerCase() !== "false" ? o.parseNumbers && !Number.isNaN(Number(r)) && typeof r == "string" && r.trim() !== "" ? Number(r) : r : r.toLowerCase() === "true" : Number(r) : [Number(r)] : r.toLowerCase() === "1" : r.toLowerCase() === "true"); 82} 83function d(r) { 84 const o = (r = v(r)).indexOf("?"); 85 return o === -1 ? "" : r.slice(o + 1); 86} 87function g(r, o) { 88 w((o = { decode: true, sort: true, arrayFormat: "none", arrayFormatSeparator: ",", parseNumbers: false, parseBooleans: false, types: /* @__PURE__ */ Object.create(null), ...o }).arrayFormatSeparator); 89 const a = (function(s) {
90 let c; 91 switch (s.arrayFormat) { 92 case "index": 93 return (t, e, n) => { 94 c = /\[(\d*)]$/.exec(t), t = t.replace(/\[\d*]$/, ""), c ? (n[t] === void 0 && (n[t] = {}), n[t][c[1]] = e) : n[t] = e; 95 }; 96 case "bracket": 97 return (t, e, n) => { 98 c = /(\[])$/.exec(t), t = t.replace(/\[]$/, ""), c ? n[t] !== void 0 ? n[t] = [...n[t], e] : n[t] = [e] : n[t] = e; 99 }; 100 case "colon-list-separator": 101 return (t, e, n) => { 102 c = /(:list)$/.exec(t), t = t.replace(/:list$/, ""), c ? n[t] !== void 0 ? n[t] = [...n[t], e] : n[t] = [e] : n[t] = e; 103 }; 104 case "comma": 105 case "separator": 106 return (t, e, n) => { 107 const l = typeof e == "string" && e.includes(s.arrayFormatSeparator) ? e.split(s.arrayFormatSeparator).map((p) => f(p, s)) : e === null ? e : f(e, s); 108 n[t] = l; 109 }; 110 case "bracket-separator": 111 return (t, e, n) => { 112 const l = /(\[])$/.test(t); 113 if (t = t.replace(/\[]$/, ""), !l) return void (n[t] = e && f(e, s)); 114 const p = e === null ? [] : f(e, s).split(s.arrayFormatSeparator); 115 n[t] !== void 0 ? n[t] = [...n[t], ...p] : n[t] = p; 116 }; 117 default: 118 return (t, e, n) => { 119 n[t] !== void 0 ? n[t] = [...[n[t]].flat(), e] : n[t] = e; 120 }; 121 } 122 })(o), i = /* @__PURE__ */ Object.create(null); 123 if (typeof r != "string" || !(r = r.trim().replace(/^[?#&]/, ""))) return i; 124 for (const s of r.split("&")) { 125 if (s === "") continue; 126 const c = o.decode ? s.replaceAll("+", " ") : s; 127 let [t, e] = N(c, "="); 128 t === void 0 && (t = c), e = e === void 0 ? null : ["comma", "separator", "bracket-separator"].includes(o.arrayFormat) ? e : f(e, o), a(f(t, o), e, i); 129 } 130 for (const [s, c] of Object.entries(i)) if (typeof c == "object" && c !== null && o.types[s] !== "string") for (const [t, e] of Object.entries(c)) { 131 const n = o.types[s], l = typeof n == "function" ? n : n ? n.replace("[]", "") : void 0; 132 c[t] = F(e, o, l); 133 } 134 else typeof c == "object" && c !== null && o.types[s] === "string" ? i[s] = Object.values(c).join(o.arrayFormatSeparator) : i[s] = F(c, o, o.types[s]); 135 return o.sort === false ? i : (o.sort === true ? Object.keys(i).sort() : Object.keys(i).sort(o.sort)).reduce((s, c) => { 136 const t = i[c]; 137 return s[c] = t && typeof t == "object" && !Array.isArray(t) ? O(t) : t, s; 138 }, /* @__PURE__ */ Object.create(null)); 139} 140function S(r, o) { 141 if (!r) return ""; 142 w((o = { encode: true, strict: true, arrayFormat: "none", arrayFormatSeparator: ",", ...o }).arrayFormatSeparator); 143 const a = (t) => o.skipNull && r[t] == null || o.skipEmptyString && r[t] === "", i = (function(t) { 144 switch (t.arrayFormat) { 145 case "index": 146 return (e) => (n, l) => { 147 const p = n.length; 148 return l === void 0 || t.skipNull && l === null || t.skipEmptyString && l === "" ? n : l === null ? [...n, [u(e, t), "[", p, "]"].join("")] : [...n, [u(e, t), "[", u(p, t), "]=", u(l, t)].join("")]; 149 }; 150 case "bracket": 151 return (e) => (n, l) => l === void 0 || t.skipNull && l === null || t.skipEmptyString && l === "" ? n : l === null ? [...n, [u(e, t), "[]"].join("")] : [...n, [u(e, t), "[]=", u(l, t)].join("")]; 152 case "colon-list-separator": 153 return (e) => (n, l) => l === void 0 || t.skipNull && l === null || t.skipEmptyString && l === "" ? n : l === null ? [...n, [u(e, t), ":list="].join("")] : [...n, [u(e, t), ":list=", u(l, t)].join("")]; 154 case "comma": 155 case "separator": 156 case "bracket-separator": { 157 const e = t.arrayFormat === "bracket-separator" ? "[]=" : "="; 158 return (n) => (l, p) => p === void 0 || t.skipNull && p === null || t.skipEmptyString && p === "" ? l : (p = p === null ? "" : p, l.length === 0 ? [[u(n, t), e, u(p, t)].join("")] : [[l, u(p, t)].join(t.arrayFormatSeparator)]); 159 } 160 default: 161 return (e) => (n, l) => l === void 0 || t.skipNull && l === null || t.skipEmptyString && l === "" ? n : l === null ? [...n, u(e, t)] : [...n, [u(e, t), "=", u(l, t)].join("")]; 162 } 163 })(o), s = {}; 164 for (const [t, e] of Object.entries(r)) a(t) || (s[t] = e); 165 const c = Object.keys(s); 166 return o.sort !== false && c.sort(o.sort), c.map((t) => { 167 let e = r[t]; 168 if (o.replacer && (e = o.replacer(t, e), e === void 0) || e === void 0) return ""; 169 if (e === null) return u(t, o); 170 if (Array.isArray(e)) { 171 if (e.length === 0 && o.arrayFormat === "bracket-separator") return u(t, o) + "[]"; 172 let n = e; 173 return o.replacer && (n = e.map((l, p) => o.replacer("".concat(t, "[").concat(p, "]"), l)).filter((l) => l !== void 0)), n.reduce(i(t), []).join("&"); 174 } 175 return u(t, o) + "=" + u(e, o); 176 }).filter((t) => t.length > 0).join("&"); 177} 178function x(r, o) { 179 var _a, _b; 180 o = { decode: true, ...o }; 181 let [a, i] = N(r, "#"); 182 return a === void 0 && (a = r), { url: (_b = (_a = a == null ? void 0 : a.split("?")) == null ? void 0 : _a[0]) != null ? _b : "", query: g(d(r), o), ...o && o.parseFragmentIdentifier && i ? { fragmentIdentifier: f(i, o) } : {} }; 183} 184function C(r, o) { 185 o = { encode: true, strict: true, [m]: true, ...o }; 186 const a = v(r.url).split("?")[0] || ""; 187 let i = S({ ...g(d(r.url), { sort: false, ...o }), ...r.query }, o); 188 i && (i = "?".concat(i)); 189 let s = (function(c) { 190 let t = ""; 191 const e = c.indexOf("#"); 192 return e !== -1 && (t = c.slice(e)), t; 193 })(r.url); 194 if (typeof r.fragmentIdentifier == "string") { 195 const c = new URL(a); 196 c.hash = r.fragmentIdentifier, s = o[m] ? c.hash : "#".concat(r.fragmentIdentifier); 197 }
198 return "".concat(a).concat(i).concat(s); 199} 200function h(r, o, a) { 201 a = { parseFragmentIdentifier: true, [m]: false, ...a }; 202 const { url: i, query: s, fragmentIdentifier: c } = x(r, a); 203 return C({ url: i, query: $(s, o), fragmentIdentifier: c }, a); 204} 205const A = Object.freeze(Object.defineProperty({ __proto__: null, exclude: function(r, o, a) { 206 return h(r, Array.isArray(o) ? (i) => !o.includes(i) : (i, s) => !o(i, s), a); 207}, extract: d, parse: g, parseUrl: x, pick: h, stringify: S, stringifyUrl: C }, Symbol.toStringTag, { value: "Module" })); 208export { 209 A as q 210};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.