storybook
Version:
Storybook framework-agnostic API
1,813 lines (1,800 loc) • 231 kB
JavaScript
"use strict";
var Sa = Object.create;
var Pt = Object.defineProperty;
var Pa = Object.getOwnPropertyDescriptor;
var xa = Object.getOwnPropertyNames;
var wa = Object.getPrototypeOf, Oa = Object.prototype.hasOwnProperty;
var n = (e, r) => Pt(e, "name", { value: r, configurable: !0 });
var He = (e, r) => () => (r || e((r = { exports: {} }).exports, r), r.exports), Ca = (e, r) => {
for (var t in r)
Pt(e, t, { get: r[t], enumerable: !0 });
}, Dr = (e, r, t, o) => {
if (r && typeof r == "object" || typeof r == "function")
for (let a of xa(r))
!Oa.call(e, a) && a !== t && Pt(e, a, { get: () => r[a], enumerable: !(o = Pa(r, a)) || o.enumerable });
return e;
};
var xt = (e, r, t) => (t = e != null ? Sa(wa(e)) : {}, Dr(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
r || !e || !e.__esModule ? Pt(t, "default", { value: e, enumerable: !0 }) : t,
e
)), Aa = (e) => Dr(Pt({}, "__esModule", { value: !0 }), e);
// ../node_modules/map-or-similar/src/similar.js
var on = He((Fi, an) => {
function lt() {
return this.list = [], this.lastItem = void 0, this.size = 0, this;
}
n(lt, "Similar");
lt.prototype.get = function(e) {
var r;
if (this.lastItem && this.isEqual(this.lastItem.key, e))
return this.lastItem.val;
if (r = this.indexOf(e), r >= 0)
return this.lastItem = this.list[r], this.list[r].val;
};
lt.prototype.set = function(e, r) {
var t;
return this.lastItem && this.isEqual(this.lastItem.key, e) ? (this.lastItem.val = r, this) : (t = this.indexOf(e), t >= 0 ? (this.lastItem =
this.list[t], this.list[t].val = r, this) : (this.lastItem = { key: e, val: r }, this.list.push(this.lastItem), this.size++, this));
};
lt.prototype.delete = function(e) {
var r;
if (this.lastItem && this.isEqual(this.lastItem.key, e) && (this.lastItem = void 0), r = this.indexOf(e), r >= 0)
return this.size--, this.list.splice(r, 1)[0];
};
lt.prototype.has = function(e) {
var r;
return this.lastItem && this.isEqual(this.lastItem.key, e) ? !0 : (r = this.indexOf(e), r >= 0 ? (this.lastItem = this.list[r], !0) : !1);
};
lt.prototype.forEach = function(e, r) {
var t;
for (t = 0; t < this.size; t++)
e.call(r || this, this.list[t].val, this.list[t].key, this);
};
lt.prototype.indexOf = function(e) {
var r;
for (r = 0; r < this.size; r++)
if (this.isEqual(this.list[r].key, e))
return r;
return -1;
};
lt.prototype.isEqual = function(e, r) {
return e === r || e !== e && r !== r;
};
an.exports = lt;
});
// ../node_modules/map-or-similar/src/map-or-similar.js
var un = He((Li, ln) => {
ln.exports = function(e) {
if (typeof Map != "function" || e) {
var r = on();
return new r();
} else
return /* @__PURE__ */ new Map();
};
});
// ../node_modules/memoizerific/src/memoizerific.js
var fn = He((Mi, cn) => {
var sn = un();
cn.exports = function(e) {
var r = new sn(process.env.FORCE_SIMILAR_INSTEAD_OF_MAP === "true"), t = [];
return function(o) {
var a = /* @__PURE__ */ n(function() {
var i = r, l, b, g = arguments.length - 1, R = Array(g + 1), w = !0, x;
if ((a.numArgs || a.numArgs === 0) && a.numArgs !== g + 1)
throw new Error("Memoizerific functions should always be called with the same number of arguments");
for (x = 0; x < g; x++) {
if (R[x] = {
cacheItem: i,
arg: arguments[x]
}, i.has(arguments[x])) {
i = i.get(arguments[x]);
continue;
}
w = !1, l = new sn(process.env.FORCE_SIMILAR_INSTEAD_OF_MAP === "true"), i.set(arguments[x], l), i = l;
}
return w && (i.has(arguments[g]) ? b = i.get(arguments[g]) : w = !1), w || (b = o.apply(null, arguments), i.set(arguments[g], b)), e >
0 && (R[g] = {
cacheItem: i,
arg: arguments[g]
}, w ? ja(t, R) : t.push(R), t.length > e && Da(t.shift())), a.wasMemoized = w, a.numArgs = g + 1, b;
}, "memoizerific");
return a.limit = e, a.wasMemoized = !1, a.cache = r, a.lru = t, a;
};
};
function ja(e, r) {
var t = e.length, o = r.length, a, i, l;
for (i = 0; i < t; i++) {
for (a = !0, l = 0; l < o; l++)
if (!Na(e[i][l].arg, r[l].arg)) {
a = !1;
break;
}
if (a)
break;
}
e.push(e.splice(i, 1)[0]);
}
n(ja, "moveToMostRecentLru");
function Da(e) {
var r = e.length, t = e[r - 1], o, a;
for (t.cacheItem.delete(t.arg), a = r - 2; a >= 0 && (t = e[a], o = t.cacheItem.get(t.arg), !o || !o.size); a--)
t.cacheItem.delete(t.arg);
}
n(Da, "removeCachedResult");
function Na(e, r) {
return e === r || e !== e && r !== r;
}
n(Na, "isEqual");
});
// ../node_modules/picoquery/lib/string-util.js
var ir = He((or) => {
"use strict";
Object.defineProperty(or, "__esModule", { value: !0 });
or.encodeString = Fa;
var Xe = Array.from({ length: 256 }, (e, r) => "%" + ((r < 16 ? "0" : "") + r.toString(16)).toUpperCase()), _a = new Int8Array([
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
1,
1,
1,
1,
0,
0,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
1,
0
]);
function Fa(e) {
let r = e.length;
if (r === 0)
return "";
let t = "", o = 0, a = 0;
e: for (; a < r; a++) {
let i = e.charCodeAt(a);
for (; i < 128; ) {
if (_a[i] !== 1 && (o < a && (t += e.slice(o, a)), o = a + 1, t += Xe[i]), ++a === r)
break e;
i = e.charCodeAt(a);
}
if (o < a && (t += e.slice(o, a)), i < 2048) {
o = a + 1, t += Xe[192 | i >> 6] + Xe[128 | i & 63];
continue;
}
if (i < 55296 || i >= 57344) {
o = a + 1, t += Xe[224 | i >> 12] + Xe[128 | i >> 6 & 63] + Xe[128 | i & 63];
continue;
}
if (++a, a >= r)
throw new Error("URI malformed");
let l = e.charCodeAt(a) & 1023;
o = a + 1, i = 65536 + ((i & 1023) << 10 | l), t += Xe[240 | i >> 18] + Xe[128 | i >> 12 & 63] + Xe[128 | i >> 6 & 63] + Xe[128 | i & 63];
}
return o === 0 ? e : o < r ? t + e.slice(o) : t;
}
n(Fa, "encodeString");
});
// ../node_modules/picoquery/lib/shared.js
var Bt = He((Ge) => {
"use strict";
Object.defineProperty(Ge, "__esModule", { value: !0 });
Ge.defaultOptions = Ge.defaultShouldSerializeObject = Ge.defaultValueSerializer = void 0;
var lr = ir(), Ua = /* @__PURE__ */ n((e) => {
switch (typeof e) {
case "string":
return (0, lr.encodeString)(e);
case "bigint":
case "boolean":
return "" + e;
case "number":
if (Number.isFinite(e))
return e < 1e21 ? "" + e : (0, lr.encodeString)("" + e);
break;
}
return e instanceof Date ? (0, lr.encodeString)(e.toISOString()) : "";
}, "defaultValueSerializer");
Ge.defaultValueSerializer = Ua;
var La = /* @__PURE__ */ n((e) => e instanceof Date, "defaultShouldSerializeObject");
Ge.defaultShouldSerializeObject = La;
var dn = /* @__PURE__ */ n((e) => e, "identityFunc");
Ge.defaultOptions = {
nesting: !0,
nestingSyntax: "dot",
arrayRepeat: !1,
arrayRepeatSyntax: "repeat",
delimiter: 38,
valueDeserializer: dn,
valueSerializer: Ge.defaultValueSerializer,
keyDeserializer: dn,
shouldSerializeObject: Ge.defaultShouldSerializeObject
};
});
// ../node_modules/picoquery/lib/object-util.js
var ur = He((kt) => {
"use strict";
Object.defineProperty(kt, "__esModule", { value: !0 });
kt.getDeepObject = Ia;
kt.stringifyObject = hn;
var dt = Bt(), Ma = ir();
function Ta(e) {
return e === "__proto__" || e === "constructor" || e === "prototype";
}
n(Ta, "isPrototypeKey");
function Ia(e, r, t, o, a) {
if (Ta(r))
return e;
let i = e[r];
return typeof i == "object" && i !== null ? i : !o && (a || typeof t == "number" || typeof t == "string" && t * 0 === 0 && t.indexOf(".") ===
-1) ? e[r] = [] : e[r] = {};
}
n(Ia, "getDeepObject");
var Ba = 20, ka = "[]", za = "[", Ha = "]", Wa = ".";
function hn(e, r, t = 0, o, a) {
let { nestingSyntax: i = dt.defaultOptions.nestingSyntax, arrayRepeat: l = dt.defaultOptions.arrayRepeat, arrayRepeatSyntax: b = dt.defaultOptions.
arrayRepeatSyntax, nesting: g = dt.defaultOptions.nesting, delimiter: R = dt.defaultOptions.delimiter, valueSerializer: w = dt.defaultOptions.
valueSerializer, shouldSerializeObject: x = dt.defaultOptions.shouldSerializeObject } = r, M = typeof R == "number" ? String.fromCharCode(
R) : R, _ = a === !0 && l, N = i === "dot" || i === "js" && !a;
if (t > Ba)
return "";
let L = "", A = !0, Q = !1;
for (let Z in e) {
let V = e[Z], m;
o ? (m = o, _ ? b === "bracket" && (m += ka) : N ? (m += Wa, m += Z) : (m += za, m += Z, m += Ha)) : m = Z, A || (L += M), typeof V ==
"object" && V !== null && !x(V) ? (Q = V.pop !== void 0, (g || l && Q) && (L += hn(V, r, t + 1, m, Q))) : (L += (0, Ma.encodeString)(m),
L += "=", L += w(V, Z)), A && (A = !1);
}
return L;
}
n(hn, "stringifyObject");
});
// ../node_modules/fast-decode-uri-component/index.js
var yn = He((Ki, gn) => {
"use strict";
var mn = 12, Ka = 0, sr = [
// The first part of the table maps bytes to character to a transition.
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
4,
4,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
5,
6,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
8,
7,
7,
10,
9,
9,
9,
11,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
// The second part of the table maps a state to a new state when adding a
// transition.
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
12,
0,
0,
0,
0,
24,
36,
48,
60,
72,
84,
96,
0,
12,
12,
12,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
24,
0,
0,
0,
0,
0,
0,
0,
0,
0,
24,
24,
24,
0,
0,
0,
0,
0,
0,
0,
0,
0,
24,
24,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
48,
48,
48,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
48,
48,
0,
0,
0,
0,
0,
0,
0,
0,
0,
48,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
// The third part maps the current transition to a mask that needs to apply
// to the byte.
127,
63,
63,
63,
0,
31,
15,
15,
15,
7,
7,
7
];
function qa(e) {
var r = e.indexOf("%");
if (r === -1) return e;
for (var t = e.length, o = "", a = 0, i = 0, l = r, b = mn; r > -1 && r < t; ) {
var g = pn(e[r + 1], 4), R = pn(e[r + 2], 0), w = g | R, x = sr[w];
if (b = sr[256 + b + x], i = i << 6 | w & sr[364 + x], b === mn)
o += e.slice(a, l), o += i <= 65535 ? String.fromCharCode(i) : String.fromCharCode(
55232 + (i >> 10),
56320 + (i & 1023)
), i = 0, a = r + 3, r = l = e.indexOf("%", a);
else {
if (b === Ka)
return null;
if (r += 3, r < t && e.charCodeAt(r) === 37) continue;
return null;
}
}
return o + e.slice(a);
}
n(qa, "decodeURIComponent");
var $a = {
0: 0,
1: 1,
2: 2,
3: 3,
4: 4,
5: 5,
6: 6,
7: 7,
8: 8,
9: 9,
a: 10,
A: 10,
b: 11,
B: 11,
c: 12,
C: 12,
d: 13,
D: 13,
e: 14,
E: 14,
f: 15,
F: 15
};
function pn(e, r) {
var t = $a[e];
return t === void 0 ? 255 : t << r;
}
n(pn, "hexCodeToInt");
gn.exports = qa;
});
// ../node_modules/picoquery/lib/parse.js
var Rn = He((nt) => {
"use strict";
var Va = nt && nt.__importDefault || function(e) {
return e && e.__esModule ? e : { default: e };
};
Object.defineProperty(nt, "__esModule", { value: !0 });
nt.numberValueDeserializer = nt.numberKeyDeserializer = void 0;
nt.parse = Qa;
var zt = ur(), ht = Bt(), bn = Va(yn()), Ja = /* @__PURE__ */ n((e) => {
let r = Number(e);
return Number.isNaN(r) ? e : r;
}, "numberKeyDeserializer");
nt.numberKeyDeserializer = Ja;
var Ya = /* @__PURE__ */ n((e) => {
let r = Number(e);
return Number.isNaN(r) ? e : r;
}, "numberValueDeserializer");
nt.numberValueDeserializer = Ya;
var vn = /\+/g, En = /* @__PURE__ */ n(function() {
}, "Empty");
En.prototype = /* @__PURE__ */ Object.create(null);
function Ht(e, r, t, o, a) {
let i = e.substring(r, t);
return o && (i = i.replace(vn, " ")), a && (i = (0, bn.default)(i) || i), i;
}
n(Ht, "computeKeySlice");
function Qa(e, r) {
let { valueDeserializer: t = ht.defaultOptions.valueDeserializer, keyDeserializer: o = ht.defaultOptions.keyDeserializer, arrayRepeatSyntax: a = ht.
defaultOptions.arrayRepeatSyntax, nesting: i = ht.defaultOptions.nesting, arrayRepeat: l = ht.defaultOptions.arrayRepeat, nestingSyntax: b = ht.
defaultOptions.nestingSyntax, delimiter: g = ht.defaultOptions.delimiter } = r ?? {}, R = typeof g == "string" ? g.charCodeAt(0) : g, w = b ===
"js", x = new En();
if (typeof e != "string")
return x;
let M = e.length, _ = "", N = -1, L = -1, A = -1, Q = x, Z, V = "", m = "", ee = !1, de = !1, ae = !1, Se = !1, Pe = !1, xe = !1, Ae = !1,
oe = 0, Ue = -1, Ee = -1, we = -1;
for (let ce = 0; ce < M + 1; ce++) {
if (oe = ce !== M ? e.charCodeAt(ce) : R, oe === R) {
if (Ae = L > N, Ae || (L = ce), A !== L - 1 && (m = Ht(e, A + 1, Ue > -1 ? Ue : L, ae, ee), V = o(m), Z !== void 0 && (Q = (0, zt.getDeepObject)(
Q, Z, V, w && Pe, w && xe))), Ae || V !== "") {
Ae && (_ = e.slice(L + 1, ce), Se && (_ = _.replace(vn, " ")), de && (_ = (0, bn.default)(_) || _));
let Fe = t(_, V);
if (l) {
let Ce = Q[V];
Ce === void 0 ? Ue > -1 ? Q[V] = [Fe] : Q[V] = Fe : Ce.pop ? Ce.push(Fe) : Q[V] = [Ce, Fe];
} else
Q[V] = Fe;
}
_ = "", N = ce, L = ce, ee = !1, de = !1, ae = !1, Se = !1, Pe = !1, xe = !1, Ue = -1, A = ce, Q = x, Z = void 0, V = "";
} else oe === 93 ? (l && a === "bracket" && we === 91 && (Ue = Ee), i && (b === "index" || w) && L <= N && (A !== Ee && (m = Ht(e, A +
1, ce, ae, ee), V = o(m), Z !== void 0 && (Q = (0, zt.getDeepObject)(Q, Z, V, void 0, w)), Z = V, ae = !1, ee = !1), A = ce, xe = !0, Pe =
!1)) : oe === 46 ? i && (b === "dot" || w) && L <= N && (A !== Ee && (m = Ht(e, A + 1, ce, ae, ee), V = o(m), Z !== void 0 && (Q = (0, zt.
getDeepObject)(Q, Z, V, w)), Z = V, ae = !1, ee = !1), Pe = !0, xe = !1, A = ce) : oe === 91 ? i && (b === "index" || w) && L <= N && (A !==
Ee && (m = Ht(e, A + 1, ce, ae, ee), V = o(m), w && Z !== void 0 && (Q = (0, zt.getDeepObject)(Q, Z, V, w)), Z = V, ae = !1, ee = !1, Pe =
!1, xe = !0), A = ce) : oe === 61 ? L <= N ? L = ce : de = !0 : oe === 43 ? L > N ? Se = !0 : ae = !0 : oe === 37 && (L > N ? de = !0 :
ee = !0);
Ee = ce, we = oe;
}
return x;
}
n(Qa, "parse");
});
// ../node_modules/picoquery/lib/stringify.js
var Sn = He((cr) => {
"use strict";
Object.defineProperty(cr, "__esModule", { value: !0 });
cr.stringify = Ga;
var Xa = ur();
function Ga(e, r) {
if (e === null || typeof e != "object")
return "";
let t = r ?? {};
return (0, Xa.stringifyObject)(e, t);
}
n(Ga, "stringify");
});
// ../node_modules/picoquery/lib/main.js
var Pn = He((Je) => {
"use strict";
var Za = Je && Je.__createBinding || (Object.create ? function(e, r, t, o) {
o === void 0 && (o = t);
var a = Object.getOwnPropertyDescriptor(r, t);
(!a || ("get" in a ? !r.__esModule : a.writable || a.configurable)) && (a = { enumerable: !0, get: /* @__PURE__ */ n(function() {
return r[t];
}, "get") }), Object.defineProperty(e, o, a);
} : function(e, r, t, o) {
o === void 0 && (o = t), e[o] = r[t];
}), eo = Je && Je.__exportStar || function(e, r) {
for (var t in e) t !== "default" && !Object.prototype.hasOwnProperty.call(r, t) && Za(r, e, t);
};
Object.defineProperty(Je, "__esModule", { value: !0 });
Je.stringify = Je.parse = void 0;
var to = Rn();
Object.defineProperty(Je, "parse", { enumerable: !0, get: /* @__PURE__ */ n(function() {
return to.parse;
}, "get") });
var ro = Sn();
Object.defineProperty(Je, "stringify", { enumerable: !0, get: /* @__PURE__ */ n(function() {
return ro.stringify;
}, "get") });
eo(Bt(), Je);
});
// ../node_modules/ts-dedent/dist/index.js
var wn = He((Ct) => {
"use strict";
Object.defineProperty(Ct, "__esModule", { value: !0 });
Ct.dedent = void 0;
function xn(e) {
for (var r = [], t = 1; t < arguments.length; t++)
r[t - 1] = arguments[t];
var o = Array.from(typeof e == "string" ? [e] : e);
o[o.length - 1] = o[o.length - 1].replace(/\r?\n([\t ]*)$/, "");
var a = o.reduce(function(b, g) {
var R = g.match(/\n([\t ]+|(?!\s).)/g);
return R ? b.concat(R.map(function(w) {
var x, M;
return (M = (x = w.match(/[\t ]/g)) === null || x === void 0 ? void 0 : x.length) !== null && M !== void 0 ? M : 0;
})) : b;
}, []);
if (a.length) {
var i = new RegExp(`
[ ]{` + Math.min.apply(Math, a) + "}", "g");
o = o.map(function(b) {
return b.replace(i, `
`);
});
}
o[0] = o[0].replace(/^\r?\n/, "");
var l = o[0];
return r.forEach(function(b, g) {
var R = l.match(/(?:^|\n)( *)$/), w = R ? R[1] : "", x = b;
typeof b == "string" && b.includes(`
`) && (x = String(b).split(`
`).map(function(M, _) {
return _ === 0 ? M : "" + w + M;
}).join(`
`)), l += x + o[g + 1];
}), l;
}
n(xn, "dedent");
Ct.dedent = xn;
Ct.default = xn;
});
// ../node_modules/@remix-run/router/dist/router.cjs.js
var Tt = He((fe) => {
"use strict";
Object.defineProperty(fe, "__esModule", { value: !0 });
function me() {
return me = Object.assign ? Object.assign.bind() : function(e) {
for (var r = 1; r < arguments.length; r++) {
var t = arguments[r];
for (var o in t)
Object.prototype.hasOwnProperty.call(t, o) && (e[o] = t[o]);
}
return e;
}, me.apply(this, arguments);
}
n(me, "_extends");
var Te = /* @__PURE__ */ function(e) {
return e.Pop = "POP", e.Push = "PUSH", e.Replace = "REPLACE", e;
}({}), Nn = "popstate";
function co(e) {
e === void 0 && (e = {});
let {
initialEntries: r = ["/"],
initialIndex: t,
v5Compat: o = !1
} = e, a;
a = r.map((_, N) => w(_, typeof _ == "string" ? null : _.state, N === 0 ? "default" : void 0));
let i = g(t ?? a.length - 1), l = Te.Pop, b = null;
function g(_) {
return Math.min(Math.max(_, 0), a.length - 1);
}
n(g, "clampIndex");
function R() {
return a[i];
}
n(R, "getCurrentLocation");
function w(_, N, L) {
N === void 0 && (N = null);
let A = at(a ? R().pathname : "/", _, N, L);
return Ze(A.pathname.charAt(0) === "/", "relative pathnames are not supported in memory history: " + JSON.stringify(_)), A;
}
n(w, "createMemoryLocation");
function x(_) {
return typeof _ == "string" ? _ : et(_);
}
return n(x, "createHref"), {
get index() {
return i;
},
get action() {
return l;
},
get location() {
return R();
},
createHref: x,
createURL(_) {
return new URL(x(_), "http://localhost");
},
encodeLocation(_) {
let N = typeof _ == "string" ? Ye(_) : _;
return {
pathname: N.pathname || "",
search: N.search || "",
hash: N.hash || ""
};
},
push(_, N) {
l = Te.Push;
let L = w(_, N);
i += 1, a.splice(i, a.length, L), o && b && b({
action: l,
location: L,
delta: 1
});
},
replace(_, N) {
l = Te.Replace;
let L = w(_, N);
a[i] = L, o && b && b({
action: l,
location: L,
delta: 0
});
},
go(_) {
l = Te.Pop;
let N = g(i + _), L = a[N];
i = N, b && b({
action: l,
location: L,
delta: _
});
},
listen(_) {
return b = _, () => {
b = null;
};
}
};
}
n(co, "createMemoryHistory");
function fo(e) {
e === void 0 && (e = {});
function r(o, a) {
let {
pathname: i,
search: l,
hash: b
} = o.location;
return at(
"",
{
pathname: i,
search: l,
hash: b
},
// state defaults to `null` because `window.history.state` does
a.state && a.state.usr || null,
a.state && a.state.key || "default"
);
}
n(r, "createBrowserLocation");
function t(o, a) {
return typeof a == "string" ? a : et(a);
}
return n(t, "createBrowserHref"), Kn(r, t, null, e);
}
n(fo, "createBrowserHistory");
function ho(e) {
e === void 0 && (e = {});
function r(a, i) {
let {
pathname: l = "/",
search: b = "",
hash: g = ""
} = Ye(a.location.hash.substr(1));
return !l.startsWith("/") && !l.startsWith(".") && (l = "/" + l), at(
"",
{
pathname: l,
search: b,
hash: g
},
// state defaults to `null` because `window.history.state` does
i.state && i.state.usr || null,
i.state && i.state.key || "default"
);
}
n(r, "createHashLocation");
function t(a, i) {
let l = a.document.querySelector("base"), b = "";
if (l && l.getAttribute("href")) {
let g = a.location.href, R = g.indexOf("#");
b = R === -1 ? g : g.slice(0, R);
}
return b + "#" + (typeof i == "string" ? i : et(i));
}
n(t, "createHashHref");
function o(a, i) {
Ze(a.pathname.charAt(0) === "/", "relative pathnames are not supported in hash history.push(" + JSON.stringify(i) + ")");
}
return n(o, "validateHashLocation"), Kn(r, t, o, e);
}
n(ho, "createHashHistory");
function be(e, r) {
if (e === !1 || e === null || typeof e > "u")
throw new Error(r);
}
n(be, "invariant");
function Ze(e, r) {
if (!e) {
typeof console < "u" && console.warn(r);
try {
throw new Error(r);
} catch {
}
}
}
n(Ze, "warning");
function mo() {
return Math.random().toString(36).substr(2, 8);
}
n(mo, "createKey");
function _n(e, r) {
return {
usr: e.state,
key: e.key,
idx: r
};
}
n(_n, "getHistoryState");
function at(e, r, t, o) {
return t === void 0 && (t = null), me({
pathname: typeof e == "string" ? e : e.pathname,
search: "",
hash: ""
}, typeof r == "string" ? Ye(r) : r, {
state: t,
// TODO: This could be cleaned up. push/replace should probably just take
// full Locations now and avoid the need to run through this flow at all
// But that's a pretty big refactor to the current test suite so going to
// keep as is for the time being and just let any incoming keys take precedence
key: r && r.key || o || mo()
});
}
n(at, "createLocation");
function et(e) {
let {
pathname: r = "/",
search: t = "",
hash: o = ""
} = e;
return t && t !== "?" && (r += t.charAt(0) === "?" ? t : "?" + t), o && o !== "#" && (r += o.charAt(0) === "#" ? o : "#" + o), r;
}
n(et, "createPath");
function Ye(e) {
let r = {};
if (e) {
let t = e.indexOf("#");
t >= 0 && (r.hash = e.substr(t), e = e.substr(0, t));
let o = e.indexOf("?");
o >= 0 && (r.search = e.substr(o), e = e.substr(0, o)), e && (r.pathname = e);
}
return r;
}
n(Ye, "parsePath");
function Kn(e, r, t, o) {
o === void 0 && (o = {});
let {
window: a = document.defaultView,
v5Compat: i = !1
} = o, l = a.history, b = Te.Pop, g = null, R = w();
R == null && (R = 0, l.replaceState(me({}, l.state, {
idx: R
}), ""));
function w() {
return (l.state || {
idx: null
}).idx;
}
n(w, "getIndex");
function x() {
b = Te.Pop;
let A = w(), Q = A == null ? null : A - R;
R = A, g && g({
action: b,
location: L.location,
delta: Q
});
}
n(x, "handlePop");
function M(A, Q) {
b = Te.Push;
let Z = at(L.location, A, Q);
t && t(Z, A), R = w() + 1;
let V = _n(Z, R), m = L.createHref(Z);
try {
l.pushState(V, "", m);
} catch (ee) {
if (ee instanceof DOMException && ee.name === "DataCloneError")
throw ee;
a.location.assign(m);
}
i && g && g({
action: b,
location: L.location,
delta: 1
});
}
n(M, "push");
function _(A, Q) {
b = Te.Replace;
let Z = at(L.location, A, Q);
t && t(Z, A), R = w();
let V = _n(Z, R), m = L.createHref(Z);
l.replaceState(V, "", m), i && g && g({
action: b,
location: L.location,
delta: 0
});
}
n(_, "replace");
function N(A) {
let Q = a.location.origin !== "null" ? a.location.origin : a.location.href, Z = typeof A == "string" ? A : et(A);
return be(Q, "No window.location.(origin|href) available to create URL for href: " + Z), new URL(Z, Q);
}
n(N, "createURL");
let L = {
get action() {
return b;
},
get location() {
return e(a, l);
},
listen(A) {
if (g)
throw new Error("A history only accepts one active listener");
return a.addEventListener(Nn, x), g = A, () => {
a.removeEventListener(Nn, x), g = null;
};
},
createHref(A) {
return r(a, A);
},
createURL: N,
encodeLocation(A) {
let Q = N(A);
return {
pathname: Q.pathname,
search: Q.search,
hash: Q.hash
};
},
push: M,
replace: _,
go(A) {
return l.go(A);
}
};
return L;
}
n(Kn, "getUrlBasedHistory");
var _e = /* @__PURE__ */ function(e) {
return e.data = "data", e.deferred = "deferred", e.redirect = "redirect", e.error = "error", e;
}({}), po = /* @__PURE__ */ new Set(["lazy", "caseSensitive", "path", "id", "index", "children"]);
function go(e) {
return e.index === !0;
}
n(go, "isIndexRoute");
function _t(e, r, t, o) {
return t === void 0 && (t = []), o === void 0 && (o = {}), e.map((a, i) => {
let l = [...t, i], b = typeof a.id == "string" ? a.id : l.join("-");
if (be(a.index !== !0 || !a.children, "Cannot specify children on an index route"), be(!o[b], 'Found a route id collision on id "' + b +
`". Route id's must be globally unique within Data Router usages`), go(a)) {
let g = me({}, a, r(a), {
id: b
});
return o[b] = g, g;
} else {
let g = me({}, a, r(a), {
id: b,
children: void 0
});
return o[b] = g, a.children && (g.children = _t(a.children, r, l, o)), g;
}
});
}
n(_t, "convertRoutesToDataRoutes");
function ut(e, r, t) {
t === void 0 && (t = "/");
let o = typeof r == "string" ? Ye(r) : r, a = Mt(o.pathname || "/", t);
if (a == null)
return null;
let i = qn(e);
yo(i);
let l = null;
for (let b = 0; l == null && b < i.length; ++b)
l = Oo(
i[b],
// Incoming pathnames are generally encoded from either window.location
// or from router.navigate, but we want to match against the unencoded
// paths in the route definitions. Memory router locations won't be
// encoded here but there also shouldn't be anything to decode so this
// should be a safe operation. This avoids needing matchRoutes to be
// history-aware.
jo(a)
);
return l;
}
n(ut, "matchRoutes");
function qn(e, r, t, o) {
r === void 0 && (r = []), t === void 0 && (t = []), o === void 0 && (o = "");
let a = /* @__PURE__ */ n((i, l, b) => {
let g = {
relativePath: b === void 0 ? i.path || "" : b,
caseSensitive: i.caseSensitive === !0,
childrenIndex: l,
route: i
};
g.relativePath.startsWith("/") && (be(g.relativePath.startsWith(o), 'Absolute route path "' + g.relativePath + '" nested under path ' +
('"' + o + '" is not valid. An absolute child route path ') + "must start with the combined path of all its parent routes."), g.relativePath =
g.relativePath.slice(o.length));
let R = Et([o, g.relativePath]), w = t.concat(g);
i.children && i.children.length > 0 && (be(
// Our types know better, but runtime JS may not!
// @ts-expect-error
i.index !== !0,
"Index routes must not have child routes. Please remove " + ('all child routes from route path "' + R + '".')
), qn(i.children, r, w, R)), !(i.path == null && !i.index) && r.push({
path: R,
score: xo(R, i.index),
routesMeta: w
});
}, "flattenRoute");
return e.forEach((i, l) => {
var b;
if (i.path === "" || !((b = i.path) != null && b.includes("?")))
a(i, l);
else
for (let g of $n(i.path))
a(i, l, g);
}), r;
}
n(qn, "flattenRoutes");
function $n(e) {
let r = e.split("/");
if (r.length === 0) return [];
let [t, ...o] = r, a = t.endsWith("?"), i = t.replace(/\?$/, "");
if (o.length === 0)
return a ? [i, ""] : [i];
let l = $n(o.join("/")), b = [];
return b.push(...l.map((g) => g === "" ? i : [i, g].join("/"))), a && b.push(...l), b.map((g) => e.startsWith("/") && g === "" ? "/" : g);
}
n($n, "explodeOptionalSegments");
function yo(e) {
e.sort((r, t) => r.score !== t.score ? t.score - r.score : wo(r.routesMeta.map((o) => o.childrenIndex), t.routesMeta.map((o) => o.childrenIndex)));
}
n(yo, "rankRouteBranches");
var bo = /^:\w+$/, vo = 3, Eo = 2, Ro = 1, So = 10, Po = -2, Fn = /* @__PURE__ */ n((e) => e === "*", "isSplat");
function xo(e, r) {
let t = e.split("/"), o = t.length;
return t.some(Fn) && (o += Po), r && (o += Eo), t.filter((a) => !Fn(a)).reduce((a, i) => a + (bo.test(i) ? vo : i === "" ? Ro : So), o);
}
n(xo, "computeScore");
function wo(e, r) {
return e.length === r.length && e.slice(0, -1).every((o, a) => o === r[a]) ? (
// If two routes are siblings, we should try to match the earlier sibling
// first. This allows people to have fine-grained control over the matching
// behavior by simply putting routes with identical paths in the order they
// want them tried.
e[e.length - 1] - r[r.length - 1]
) : (
// Otherwise, it doesn't really make sense to rank non-siblings by index,
// so they sort equally.
0
);
}
n(wo, "compareIndexes");
function Oo(e, r) {
let {
routesMeta: t
} = e, o = {}, a = "/", i = [];
for (let l = 0; l < t.length; ++l) {
let b = t[l], g = l === t.length - 1, R = a === "/" ? r : r.slice(a.length) || "/", w = Vn({
path: b.relativePath,
caseSensitive: b.caseSensitive,
end: g
}, R);
if (!w) return null;
Object.assign(o, w.params);
let x = b.route;
i.push({
// TODO: Can this as be avoided?
params: o,
pathname: Et([a, w.pathname]),
pathnameBase: Qn(Et([a, w.pathnameBase])),
route: x
}), w.pathnameBase !== "/" && (a = Et([a, w.pathnameBase]));
}
return i;
}
n(Oo, "matchRouteBranch");
function Co(e, r) {
r === void 0 && (r = {});
let t = e;
t.endsWith("*") && t !== "*" && !t.endsWith("/*") && (Ze(!1, 'Route path "' + t + '" will be treated as if it were ' + ('"' + t.replace(
/\*$/, "/*") + '" because the `*` character must ') + "always follow a `/` in the pattern. To get rid of this warning, " + ('please chan\
ge the route path to "' + t.replace(/\*$/, "/*") + '".')), t = t.replace(/\*$/, "/*"));
let o = t.startsWith("/") ? "/" : "", a = /* @__PURE__ */ n((l) => l == null ? "" : typeof l == "string" ? l : String(l), "stringify"), i = t.
split(/\/+/).map((l, b, g) => {
if (b === g.length - 1 && l === "*")
return a(r["*"]);
let w = l.match(/^:(\w+)(\??)$/);
if (w) {
let [, x, M] = w, _ = r[x];
return be(M === "?" || _ != null, 'Missing ":' + x + '" param'), a(_);
}
return l.replace(/\?$/g, "");
}).filter((l) => !!l);
return o + i.join("/");
}
n(Co, "generatePath");
function Vn(e, r) {
typeof e == "string" && (e = {
path: e,
caseSensitive: !1,
end: !0
});
let [t, o] = Ao(e.path, e.caseSensitive, e.end), a = r.match(t);
if (!a) return null;
let i = a[0], l = i.replace(/(.)\/+$/, "$1"), b = a.slice(1);
return {
params: o.reduce((R, w, x) => {
if (w === "*") {
let M = b[x] || "";
l = i.slice(0, i.length - M.length).replace(/(.)\/+$/, "$1");
}
return R[w] = Do(b[x] || "", w), R;
}, {}),
pathname: i,
pathnameBase: l,
pattern: e
};
}
n(Vn, "matchPath");
function Ao(e, r, t) {
r === void 0 && (r = !1), t === void 0 && (t = !0), Ze(e === "*" || !e.endsWith("*") || e.endsWith("/*"), 'Route path "' + e + '" will b\
e treated as if it were ' + ('"' + e.replace(/\*$/, "/*") + '" because the `*` character must ') + "always follow a `/` in the pattern. To g\
et rid of this warning, " + ('please change the route path to "' + e.replace(/\*$/, "/*") + '".'));
let o = [], a = "^" + e.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^$?{}|()[\]]/g, "\\$&").replace(/\/:(\w+)/g, (l, b) => (o.
push(b), "/([^\\/]+)"));
return e.endsWith("*") ? (o.push("*"), a += e === "*" || e === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$") : t ? a += "\\/*$" : e !== "" && e !==
"/" && (a += "(?:(?=\\/|$))"), [new RegExp(a, r ? void 0 : "i"), o];
}
n(Ao, "compilePath");
function jo(e) {
try {
return decodeURI(e);
} catch (r) {
return Ze(!1, 'The URL path "' + e + '" could not be decoded because it is is a malformed URL segment. This is probably due to a bad p\
ercent ' + ("encoding (" + r + ").")), e;
}
}
n(jo, "safelyDecodeURI");
function Do(e, r) {
try {
return decodeURIComponent(e);
} catch (t) {
return Ze(!1, 'The value for the URL param "' + r + '" will not be decoded because' + (' the string "' + e + '" is a malformed URL seg\
ment. This is probably') + (" due to a bad percent encoding (" + t + ").")), e;
}
}
n(Do, "safelyDecodeURIComponent");
function Mt(e, r) {
if (r === "/") return e;
if (!e.toLowerCase().startsWith(r.toLowerCase()))
return null;
let t = r.endsWith("/") ? r.length - 1 : r.length, o = e.charAt(t);
return o && o !== "/" ? null : e.slice(t) || "/";
}
n(Mt, "stripBasename");
function Jn(e, r) {
r === void 0 && (r = "/");
let {
pathname: t,
search: o = "",
hash: a = ""
} = typeof e == "string" ? Ye(e) : e;
return {
pathname: t ? t.startsWith("/") ? t : No(t, r) : r,
search: Fo(o),
hash: Uo(a)
};
}
n(Jn, "resolvePath");
function No(e, r) {
let t = r.replace(/\/+$/, "").split("/");
return e.split("/").forEach((a) => {
a === ".." ? t.length > 1 && t.pop() : a !== "." && t.push(a);
}), t.length > 1 ? t.join("/") : "/";
}
n(No, "resolvePathname");
function gr(e, r, t, o) {
return "Cannot include a '" + e + "' character in a manually specified " + ("`to." + r + "` field [" + JSON.stringify(o) + "]. Please s\
eparate it out to the ") + ("`to." + t + "` field. Alternatively you may provide the full path as ") + 'a string in <Link to="..."> and the \
router will parse it for you.';
}
n(gr, "getInvalidPathError");
function Er(e) {
return e.filter((r, t) => t === 0 || r.route.path && r.route.path.length > 0);
}
n(Er, "getPathContributingMatches");
function Yn(e, r, t, o) {
o === void 0 && (o = !1);
let a;
typeof e == "string" ? a = Ye(e) : (a = me({}, e), be(!a.pathname || !a.pathname.includes("?"), gr("?", "pathname", "search", a)), be(!a.
pathname || !a.pathname.includes("#"), gr("#", "pathname", "hash", a)), be(!a.search || !a.search.includes("#"), gr("#", "search", "hash",
a)));
let i = e === "" || a.pathname === "", l = i ? "/" : a.pathname, b;
if (o || l == null)
b = t;
else {
let x = r.length - 1;
if (l.startsWith("..")) {
let M = l.split("/");
for (; M[0] === ".."; )
M.shift(), x -= 1;
a.pathname = M.join("/");
}
b = x >= 0 ? r[x] : "/";
}
let g = Jn(a, b), R = l && l !== "/" && l.endsWith("/"), w = (i || l === ".") && t.endsWith("/");
return !g.pathname.endsWith("/") && (R || w) && (g.pathname += "/"), g;
}
n(Yn, "resolveTo");
function _o(e) {
return e === "" || e.pathname === "" ? "/" : typeof e == "string" ? Ye(e).pathname : e.pathname;
}
n(_o, "getToPathname");
var Et = /* @__PURE__ */ n((e) => e.join("/").replace(/\/\/+/g, "/"), "joinPaths"), Qn = /* @__PURE__ */ n((e) => e.replace(/\/+$/, "").replace(
/^\/*/, "/"), "normalizePathname"), Fo = /* @__PURE__ */ n((e) => !e || e === "?" ? "" : e.startsWith("?") ? e : "?" + e, "normalizeSearch"),
Uo = /* @__PURE__ */ n((e) => !e || e === "#" ? "" : e.startsWith("#") ? e : "#" + e, "normalizeHash"), Lo = /* @__PURE__ */ n(function(r, t) {
t === void 0 && (t = {});
let o = typeof t == "number" ? {
status: t
} : t, a = new Headers(o.headers);
return a.has("Content-Type") || a.set("Content-Type", "application/json; charset=utf-8"), new Response(JSON.stringify(r), me({}, o, {
headers: a
}));
}, "json"), Ft = class extends Error {
static {
n(this, "AbortedDeferredError");
}
}, Vt = class {
static {
n(this, "DeferredData");
}
constructor(r, t) {
this.pendingKeysSet = /* @__PURE__ */ new Set(), this.subscribers = /* @__PURE__ */ new Set(), this.deferredKeys = [], be(r && typeof r ==
"object" && !Array.isArray(r), "defer() only accepts plain objects");
let o;
this.abortPromise = new Promise((i, l) => o = l), this.controller = new AbortController();
let a = /* @__PURE__ */ n(() => o(new Ft("Deferred data aborted")), "onAbort");
this.unlistenAbortSignal = () => this.controller.signal.removeEventListener("abort", a), this.controller.signal.addEventListener("abor\
t", a), this.data = Object.entries(r).reduce((i, l) => {
let [b, g] = l;
return Object.assign(i, {
[b]: this.trackPromise(b, g)
});
}, {}), this.done && this.unlistenAbortSignal(), this.init = t;
}
trackPromise(r, t) {
if (!(t instanceof Promise))
return t;
this.deferredKeys.push(r), this.pendingKeysSet.add(r);
let o = Promise.race([t, this.abortPromise]).then((a) => this.onSettle(o, r, void 0, a), (a) => this.onSettle(o, r, a));
return o.catch(() => {
}), Object.defineProperty(o, "_tracked", {
get: /* @__PURE__ */ n(() => !0, "get")
}), o;
}
onSettle(r, t, o, a) {
if (this.controller.signal.aborted && o instanceof Ft)
return this.unlistenAbortSignal(), Object.defineProperty(r, "_error", {
get: /* @__PURE__ */ n(() => o, "get")
}), Promise.reject(o);
if (this.pendingKeysSet.delete(t), this.done && this.unlistenAbortSignal(), o === void 0 && a === void 0) {
let i = new Error('Deferred data for key "' + t + '" resolved/rejected with `undefined`, you must resolve/reject with a value or `nu\
ll`.');
return Object.defineProperty(r, "_error", {
get: /* @__PURE__ */ n(() => i, "get")
}), this.emit(!1, t), Promise.reject(i);
}
return a === void 0 ? (Object.defineProperty(r, "_error", {
get: /* @__PURE__ */ n(() => o, "get")
}), this.emit(!1, t), Promise.reject(o)) : (Object.defineProperty(r, "_data", {
get: /* @__PURE__ */ n(() => a, "get")
}), this.emit(!1, t), a);
}
emit(r, t) {
this.subscribers.forEach((o) => o(r, t));
}
subscribe(r) {
return this.subscribers.add(r), () => this.subscribers.delete(r);
}
cancel() {
this.controller.abort(), this.pendingKeysSet.forEach((r, t) => this.pendingKeysSet.delete(t)), this.emit(!0);
}
async resolveData(r) {
let t = !1;
if (!this.done) {
let o = /* @__PURE__ */ n(() => this.cancel(), "onAbort");
r.addEventListener("abort", o), t = await new Promise((a) => {
this.subscribe((i) => {
r.removeEventListener("abort", o), (i || this.done) && a(i);
});
});
}
return t;
}
get done() {
return this.pendingKeysSet.size === 0;
}
get unwrappedData() {
return be(this.data !== null && this.done, "Can only unwrap data on initialized and settled deferreds"), Object.entries(this.data).reduce(
(r, t) => {
let [o, a] = t;
return Object.assign(r, {
[o]: To(a)
});
}, {});
}
get pendingKeys() {
return Array.from(this.pendingKeysSet);
}
};
function Mo(e) {
return e instanceof Promise && e._tracked === !0;
}
n(Mo, "isTrackedPromise");
function To(e) {
if (!Mo(e))
return e;
if (e._error)
throw e._error;
return e._data;
}
n(To, "unwrapTrackedPromise");
var Io = /* @__PURE__ */ n(function(r, t) {
t === void 0 && (t = {});
let o = typeof t == "number" ? {
status: t
} : t;
return new Vt(r, o);
}, "defer"), Xn = /* @__PURE__ */ n(function(r, t) {
t === void 0 && (t = 302);
let o = t;
typeof o == "number" ? o = {
status: o
} : typeof o.status > "u" && (o.status = 302);
let a = new Headers(o.headers);
return a.set("Location", r), new Response(null, me({}, o, {
headers: a
}));
}, "redirect"), Bo = /* @__PURE__ */ n((e, r) => {
let t = Xn(e, r);
return t.headers.set("X-Remix-Reload-Document", "true"), t;
}, "redirectDocument"), Ut = class {
static {
n(this, "ErrorResponse");
}
constructor(r, t, o, a) {
a === void 0 && (a = !1), this.status = r, this.statusText = t || "", this.internal = a, o instanceof Error ? (this.data = o.toString(),
this.error = o) : this.data = o;
}
};
function Rr(e) {
return e != null && typeof e.status == "number" && typeof e.statusText == "string" && typeof e.internal == "boolean" && "data" in e;
}
n(Rr, "isRouteErrorResponse");
var Gn = ["post", "put", "patch", "delete"], ko = new Set(Gn), zo = ["get", ...Gn], Ho = new Set(zo), Wo = /* @__PURE__ */ new Set([301, 302,
303, 307, 308]), Ko = /* @__PURE__ */ new Set([307, 308]), $t = {
state: "idle",
location: void 0,
formMethod: void 0,
formAction: void 0,
formEncType: void 0,
formData: void 0,
json: void 0,
text: void 0
}, Zn = {
state: "idle",
data: void 0,
formMethod: void 0,
formAction: void 0,
formEncType: void 0,
formData: void 0,
json: void 0,
text: void 0
}, bt = {
state: "unblocked",
proceed: void 0,
reset: void 0,
location: void 0
}, ea = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i, ta = /* @__PURE__ */ n((e) => ({
hasErrorBoundary: !!e.hasErrorBoundary
}), "defaultMapRouteProperties");
function qo(e) {
let r = e.window ? e.window : typeof window < "u" ? window : void 0, t = typeof r < "u" && typeof r.document < "u" && typeof r.document.
createElement < "u", o = !t;
be(e.routes.length > 0, "You must provide a non-empty routes array to createRouter");
let a;
if (e.mapRouteProperties)
a = e.mapRouteProperties;
else if (e.detectErrorBoundary) {
let d = e.detectErrorBoundary;
a = /* @__PURE__ */ n((h) => ({
hasErrorBoundary: d(h)
}), "mapRouteProperties");
} else
a = ta;
let i = {}, l = _t(e.routes, a, void 0, i), b, g = e.basename || "/", R = me({
v7_normalizeFormMethod: !1,
v7_prependBasename: !1
}, e.future), w = null, x = /* @__PURE__ */ new Set(), M = null, _ = null, N = null, L = e.hydrationData != null, A = ut(l, e.history.location,
g), Q = null;
if (A == null) {
let d = Ie(404, {
pathname: e.history.location.pathname
}), {
matches: h,
route: S
} = Jt(l);
A = h, Q = {
[S.id]: d
};
}
let Z = (
// All initialMatches need to be loaded before we're ready. If we have lazy
// functions around still then we'll need to run them in initialize()
!A.some((d) => d.route.lazy) && // And we have to either have no loaders or have been provided hydrationData
(!A.some((d) => d.route.loader) || e.hydrationData != null)
), V, m = {
historyAction: e.history.action,
location: e.history.location,
matches: A,
initialized: Z,
navigation: $t,
// Don't restore on initial updateState() if we were SSR'd
restoreScrollPosition: e.hydrationData != null ? !1 : null,
preventScrollReset: !1,
revalidation: "idle",
loaderData: e.hydrationData && e.hydrationData.loaderData || {},
actionData: e.hydrationData && e.hydrationData.actionData || null,
errors: e.hydrationData && e.hydrationData.errors || Q,
fetchers: /* @__PURE__ */ new Map(),
blockers: /* @__PURE__ */ new Map()
}, ee = Te.Pop, de = !1, ae, Se = !1, Pe = !1, xe = [], Ae = [], oe = /* @__PURE__ */ new Map(), Ue = 0, Ee = -1, we = /* @__PURE__ */ new Map(),
ce = /* @__PURE__ */ new Set(), Fe = /* @__PURE__ */ new Map(), Ce = /* @__PURE__ */ new Map(), ve = /* @__PURE__ */ new Map(), Ke = !1;
function qe() {
return w = e.history.listen((d) => {
let {
action: h,
location: S,
delta: T
} = d;
if (Ke) {
Ke = !1;
return;
}
Ze(ve.size === 0 || T != null, "You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run\
/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`win\
dow.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually ch\
anges the URL.");
let te = E({
currentLocation: m.location,
nextLocation: S,
historyAction: h
});
if (te && T != null) {
Ke = !0, e.history.go(T * -1), Qe(te, {
state: "blocked",
location: S,
proceed() {
Qe(te, {
state: "proceeding",
proceed: void 0,
reset: void 0,
location: S
}), e.history.go(T);
},