next-image-transformer 0.0.11 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/createImageTransformRouteHandler.d.ts +13 -3
- package/dist/index.js +279 -257
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -1302,10 +1302,10 @@ const ss = {
|
|
|
1302
1302
|
inst: e
|
|
1303
1303
|
}), i;
|
|
1304
1304
|
};
|
|
1305
|
-
}),
|
|
1305
|
+
}), ne = /* @__PURE__ */ k("$ZodStringFormat", (e, r) => {
|
|
1306
1306
|
bt.init(e, r), $t.init(e, r);
|
|
1307
1307
|
}), ls = /* @__PURE__ */ k("$ZodGUID", (e, r) => {
|
|
1308
|
-
r.pattern ?? (r.pattern = gc),
|
|
1308
|
+
r.pattern ?? (r.pattern = gc), ne.init(e, r);
|
|
1309
1309
|
}), us = /* @__PURE__ */ k("$ZodUUID", (e, r) => {
|
|
1310
1310
|
if (r.version) {
|
|
1311
1311
|
const o = {
|
|
@@ -1323,11 +1323,11 @@ const ss = {
|
|
|
1323
1323
|
r.pattern ?? (r.pattern = Ve(o));
|
|
1324
1324
|
} else
|
|
1325
1325
|
r.pattern ?? (r.pattern = Ve());
|
|
1326
|
-
|
|
1326
|
+
ne.init(e, r);
|
|
1327
1327
|
}), ds = /* @__PURE__ */ k("$ZodEmail", (e, r) => {
|
|
1328
|
-
r.pattern ?? (r.pattern = pc),
|
|
1328
|
+
r.pattern ?? (r.pattern = pc), ne.init(e, r);
|
|
1329
1329
|
}), fs = /* @__PURE__ */ k("$ZodURL", (e, r) => {
|
|
1330
|
-
|
|
1330
|
+
ne.init(e, r), e._zod.check = (i) => {
|
|
1331
1331
|
try {
|
|
1332
1332
|
const o = i.value.trim(), t = new URL(o);
|
|
1333
1333
|
r.hostname && (r.hostname.lastIndex = 0, r.hostname.test(t.hostname) || i.issues.push({
|
|
@@ -1359,31 +1359,31 @@ const ss = {
|
|
|
1359
1359
|
}
|
|
1360
1360
|
};
|
|
1361
1361
|
}), ms = /* @__PURE__ */ k("$ZodEmoji", (e, r) => {
|
|
1362
|
-
r.pattern ?? (r.pattern = bc()),
|
|
1362
|
+
r.pattern ?? (r.pattern = bc()), ne.init(e, r);
|
|
1363
1363
|
}), hs = /* @__PURE__ */ k("$ZodNanoID", (e, r) => {
|
|
1364
|
-
r.pattern ?? (r.pattern = mc),
|
|
1364
|
+
r.pattern ?? (r.pattern = mc), ne.init(e, r);
|
|
1365
1365
|
}), gs = /* @__PURE__ */ k("$ZodCUID", (e, r) => {
|
|
1366
|
-
r.pattern ?? (r.pattern = sc),
|
|
1366
|
+
r.pattern ?? (r.pattern = sc), ne.init(e, r);
|
|
1367
1367
|
}), ps = /* @__PURE__ */ k("$ZodCUID2", (e, r) => {
|
|
1368
|
-
r.pattern ?? (r.pattern = lc),
|
|
1368
|
+
r.pattern ?? (r.pattern = lc), ne.init(e, r);
|
|
1369
1369
|
}), vs = /* @__PURE__ */ k("$ZodULID", (e, r) => {
|
|
1370
|
-
r.pattern ?? (r.pattern = uc),
|
|
1370
|
+
r.pattern ?? (r.pattern = uc), ne.init(e, r);
|
|
1371
1371
|
}), bs = /* @__PURE__ */ k("$ZodXID", (e, r) => {
|
|
1372
|
-
r.pattern ?? (r.pattern = dc),
|
|
1372
|
+
r.pattern ?? (r.pattern = dc), ne.init(e, r);
|
|
1373
1373
|
}), $s = /* @__PURE__ */ k("$ZodKSUID", (e, r) => {
|
|
1374
|
-
r.pattern ?? (r.pattern = fc),
|
|
1374
|
+
r.pattern ?? (r.pattern = fc), ne.init(e, r);
|
|
1375
1375
|
}), ys = /* @__PURE__ */ k("$ZodISODateTime", (e, r) => {
|
|
1376
|
-
r.pattern ?? (r.pattern = Nc(r)),
|
|
1376
|
+
r.pattern ?? (r.pattern = Nc(r)), ne.init(e, r);
|
|
1377
1377
|
}), _s = /* @__PURE__ */ k("$ZodISODate", (e, r) => {
|
|
1378
|
-
r.pattern ?? (r.pattern = jc),
|
|
1378
|
+
r.pattern ?? (r.pattern = jc), ne.init(e, r);
|
|
1379
1379
|
}), ws = /* @__PURE__ */ k("$ZodISOTime", (e, r) => {
|
|
1380
|
-
r.pattern ?? (r.pattern = Uc(r)),
|
|
1380
|
+
r.pattern ?? (r.pattern = Uc(r)), ne.init(e, r);
|
|
1381
1381
|
}), ks = /* @__PURE__ */ k("$ZodISODuration", (e, r) => {
|
|
1382
|
-
r.pattern ?? (r.pattern = hc),
|
|
1382
|
+
r.pattern ?? (r.pattern = hc), ne.init(e, r);
|
|
1383
1383
|
}), Is = /* @__PURE__ */ k("$ZodIPv4", (e, r) => {
|
|
1384
|
-
r.pattern ?? (r.pattern = $c),
|
|
1384
|
+
r.pattern ?? (r.pattern = $c), ne.init(e, r), e._zod.bag.format = "ipv4";
|
|
1385
1385
|
}), Ss = /* @__PURE__ */ k("$ZodIPv6", (e, r) => {
|
|
1386
|
-
r.pattern ?? (r.pattern = yc),
|
|
1386
|
+
r.pattern ?? (r.pattern = yc), ne.init(e, r), e._zod.bag.format = "ipv6", e._zod.check = (i) => {
|
|
1387
1387
|
try {
|
|
1388
1388
|
new URL(`http://[${i.value}]`);
|
|
1389
1389
|
} catch {
|
|
@@ -1397,11 +1397,11 @@ const ss = {
|
|
|
1397
1397
|
}
|
|
1398
1398
|
};
|
|
1399
1399
|
}), xs = /* @__PURE__ */ k("$ZodMAC", (e, r) => {
|
|
1400
|
-
r.pattern ?? (r.pattern = _c(r.delimiter)),
|
|
1400
|
+
r.pattern ?? (r.pattern = _c(r.delimiter)), ne.init(e, r), e._zod.bag.format = "mac";
|
|
1401
1401
|
}), Es = /* @__PURE__ */ k("$ZodCIDRv4", (e, r) => {
|
|
1402
|
-
r.pattern ?? (r.pattern = wc),
|
|
1402
|
+
r.pattern ?? (r.pattern = wc), ne.init(e, r);
|
|
1403
1403
|
}), zs = /* @__PURE__ */ k("$ZodCIDRv6", (e, r) => {
|
|
1404
|
-
r.pattern ?? (r.pattern = kc),
|
|
1404
|
+
r.pattern ?? (r.pattern = kc), ne.init(e, r), e._zod.check = (i) => {
|
|
1405
1405
|
const o = i.value.split("/");
|
|
1406
1406
|
try {
|
|
1407
1407
|
if (o.length !== 2)
|
|
@@ -1438,7 +1438,7 @@ function Qn(e) {
|
|
|
1438
1438
|
}
|
|
1439
1439
|
}
|
|
1440
1440
|
const js = /* @__PURE__ */ k("$ZodBase64", (e, r) => {
|
|
1441
|
-
r.pattern ?? (r.pattern = Ic),
|
|
1441
|
+
r.pattern ?? (r.pattern = Ic), ne.init(e, r), e._zod.bag.contentEncoding = "base64", e._zod.check = (i) => {
|
|
1442
1442
|
Qn(i.value) || i.issues.push({
|
|
1443
1443
|
code: "invalid_format",
|
|
1444
1444
|
format: "base64",
|
|
@@ -1455,7 +1455,7 @@ function Ps(e) {
|
|
|
1455
1455
|
return Qn(i);
|
|
1456
1456
|
}
|
|
1457
1457
|
const Us = /* @__PURE__ */ k("$ZodBase64URL", (e, r) => {
|
|
1458
|
-
r.pattern ?? (r.pattern = Vn),
|
|
1458
|
+
r.pattern ?? (r.pattern = Vn), ne.init(e, r), e._zod.bag.contentEncoding = "base64url", e._zod.check = (i) => {
|
|
1459
1459
|
Ps(i.value) || i.issues.push({
|
|
1460
1460
|
code: "invalid_format",
|
|
1461
1461
|
format: "base64url",
|
|
@@ -1465,7 +1465,7 @@ const Us = /* @__PURE__ */ k("$ZodBase64URL", (e, r) => {
|
|
|
1465
1465
|
});
|
|
1466
1466
|
};
|
|
1467
1467
|
}), Ns = /* @__PURE__ */ k("$ZodE164", (e, r) => {
|
|
1468
|
-
r.pattern ?? (r.pattern = Ec),
|
|
1468
|
+
r.pattern ?? (r.pattern = Ec), ne.init(e, r);
|
|
1469
1469
|
});
|
|
1470
1470
|
function Os(e, r = null) {
|
|
1471
1471
|
try {
|
|
@@ -1482,7 +1482,7 @@ function Os(e, r = null) {
|
|
|
1482
1482
|
}
|
|
1483
1483
|
}
|
|
1484
1484
|
const Ds = /* @__PURE__ */ k("$ZodJWT", (e, r) => {
|
|
1485
|
-
|
|
1485
|
+
ne.init(e, r), e._zod.check = (i) => {
|
|
1486
1486
|
Os(i.value, r.alg) || i.issues.push({
|
|
1487
1487
|
code: "invalid_format",
|
|
1488
1488
|
format: "jwt",
|
|
@@ -1492,7 +1492,7 @@ const Ds = /* @__PURE__ */ k("$ZodJWT", (e, r) => {
|
|
|
1492
1492
|
});
|
|
1493
1493
|
};
|
|
1494
1494
|
}), Ts = /* @__PURE__ */ k("$ZodCustomStringFormat", (e, r) => {
|
|
1495
|
-
|
|
1495
|
+
ne.init(e, r), e._zod.check = (i) => {
|
|
1496
1496
|
r.fn(i.value) || i.issues.push({
|
|
1497
1497
|
code: "invalid_format",
|
|
1498
1498
|
format: r.format,
|
|
@@ -1735,57 +1735,57 @@ const Xs = /* @__PURE__ */ k("$ZodObject", (e, r) => {
|
|
|
1735
1735
|
}), Ks = /* @__PURE__ */ k("$ZodObjectJIT", (e, r) => {
|
|
1736
1736
|
Xs.init(e, r);
|
|
1737
1737
|
const i = e._zod.parse, o = dt(() => Ws(r)), t = (u) => {
|
|
1738
|
-
const I = new cs(["shape", "payload", "ctx"]), b = o.value, $ = (
|
|
1739
|
-
const
|
|
1740
|
-
return `shape[${
|
|
1738
|
+
const I = new cs(["shape", "payload", "ctx"]), b = o.value, $ = (J) => {
|
|
1739
|
+
const H = jn(J);
|
|
1740
|
+
return `shape[${H}]._zod.run({ value: input[${H}], issues: [] }, ctx)`;
|
|
1741
1741
|
};
|
|
1742
1742
|
I.write("const input = payload.value;");
|
|
1743
1743
|
const E = /* @__PURE__ */ Object.create(null);
|
|
1744
1744
|
let P = 0;
|
|
1745
|
-
for (const
|
|
1746
|
-
E[
|
|
1745
|
+
for (const J of b.keys)
|
|
1746
|
+
E[J] = `key_${P++}`;
|
|
1747
1747
|
I.write("const newResult = {};");
|
|
1748
|
-
for (const
|
|
1749
|
-
const
|
|
1750
|
-
I.write(`const ${
|
|
1751
|
-
if (${
|
|
1752
|
-
if (${
|
|
1753
|
-
payload.issues = payload.issues.concat(${
|
|
1748
|
+
for (const J of b.keys) {
|
|
1749
|
+
const H = E[J], Y = jn(J), ue = u[J]?._zod?.optout === "optional";
|
|
1750
|
+
I.write(`const ${H} = ${$(J)};`), ue ? I.write(`
|
|
1751
|
+
if (${H}.issues.length) {
|
|
1752
|
+
if (${Y} in input) {
|
|
1753
|
+
payload.issues = payload.issues.concat(${H}.issues.map(iss => ({
|
|
1754
1754
|
...iss,
|
|
1755
|
-
path: iss.path ? [${
|
|
1755
|
+
path: iss.path ? [${Y}, ...iss.path] : [${Y}]
|
|
1756
1756
|
})));
|
|
1757
1757
|
}
|
|
1758
1758
|
}
|
|
1759
1759
|
|
|
1760
|
-
if (${
|
|
1761
|
-
if (${
|
|
1762
|
-
newResult[${
|
|
1760
|
+
if (${H}.value === undefined) {
|
|
1761
|
+
if (${Y} in input) {
|
|
1762
|
+
newResult[${Y}] = undefined;
|
|
1763
1763
|
}
|
|
1764
1764
|
} else {
|
|
1765
|
-
newResult[${
|
|
1765
|
+
newResult[${Y}] = ${H}.value;
|
|
1766
1766
|
}
|
|
1767
1767
|
|
|
1768
1768
|
`) : I.write(`
|
|
1769
|
-
if (${
|
|
1770
|
-
payload.issues = payload.issues.concat(${
|
|
1769
|
+
if (${H}.issues.length) {
|
|
1770
|
+
payload.issues = payload.issues.concat(${H}.issues.map(iss => ({
|
|
1771
1771
|
...iss,
|
|
1772
|
-
path: iss.path ? [${
|
|
1772
|
+
path: iss.path ? [${Y}, ...iss.path] : [${Y}]
|
|
1773
1773
|
})));
|
|
1774
1774
|
}
|
|
1775
1775
|
|
|
1776
|
-
if (${
|
|
1777
|
-
if (${
|
|
1778
|
-
newResult[${
|
|
1776
|
+
if (${H}.value === undefined) {
|
|
1777
|
+
if (${Y} in input) {
|
|
1778
|
+
newResult[${Y}] = undefined;
|
|
1779
1779
|
}
|
|
1780
1780
|
} else {
|
|
1781
|
-
newResult[${
|
|
1781
|
+
newResult[${Y}] = ${H}.value;
|
|
1782
1782
|
}
|
|
1783
1783
|
|
|
1784
1784
|
`);
|
|
1785
1785
|
}
|
|
1786
1786
|
I.write("payload.value = newResult;"), I.write("return payload;");
|
|
1787
|
-
const
|
|
1788
|
-
return (
|
|
1787
|
+
const ee = I.compile();
|
|
1788
|
+
return (J, H) => ee(u, J, H);
|
|
1789
1789
|
};
|
|
1790
1790
|
let n;
|
|
1791
1791
|
const a = Ge, c = !Ct.jitless, f = c && Fa.value, m = r.catchall;
|
|
@@ -7799,7 +7799,7 @@ function Ke(e) {
|
|
|
7799
7799
|
external: e?.external ?? void 0
|
|
7800
7800
|
};
|
|
7801
7801
|
}
|
|
7802
|
-
function
|
|
7802
|
+
function re(e, r, i = { path: [], schemaPath: [] }) {
|
|
7803
7803
|
var o;
|
|
7804
7804
|
const t = e._zod.def, n = r.seen.get(e);
|
|
7805
7805
|
if (n)
|
|
@@ -7824,7 +7824,7 @@ function te(e, r, i = { path: [], schemaPath: [] }) {
|
|
|
7824
7824
|
I(e, r, u, m);
|
|
7825
7825
|
}
|
|
7826
7826
|
const p = e._zod.parent;
|
|
7827
|
-
p && (a.ref || (a.ref = p),
|
|
7827
|
+
p && (a.ref || (a.ref = p), re(p, r, m), r.seen.get(p).isParent = !0);
|
|
7828
7828
|
}
|
|
7829
7829
|
const d = r.metadataRegistry.get(e);
|
|
7830
7830
|
return d && Object.assign(a.schema, d), r.io === "input" && le(e) && (delete a.schema.examples, delete a.schema.default), r.io === "input" && a.schema._prefault && ((o = a.schema).default ?? (o.default = a.schema._prefault)), delete a.schema._prefault, r.seen.get(e).schema;
|
|
@@ -8011,10 +8011,10 @@ function le(e, r) {
|
|
|
8011
8011
|
}
|
|
8012
8012
|
const gu = (e, r = {}) => (i) => {
|
|
8013
8013
|
const o = Ke({ ...i, processors: r });
|
|
8014
|
-
return
|
|
8014
|
+
return re(e, o), He(o, e), Ye(o, e);
|
|
8015
8015
|
}, at = (e, r, i = {}) => (o) => {
|
|
8016
8016
|
const { libraryOptions: t, target: n } = o ?? {}, a = Ke({ ...t ?? {}, target: n, io: r, processors: i });
|
|
8017
|
-
return
|
|
8017
|
+
return re(e, a), He(a, e), Ye(a, e);
|
|
8018
8018
|
}, ep = {
|
|
8019
8019
|
guid: "uuid",
|
|
8020
8020
|
url: "uri",
|
|
@@ -8115,13 +8115,13 @@ const gu = (e, r = {}) => (i) => {
|
|
|
8115
8115
|
throw new Error("Set cannot be represented in JSON Schema");
|
|
8116
8116
|
}, Zu = (e, r, i, o) => {
|
|
8117
8117
|
const t = i, n = e._zod.def, { minimum: a, maximum: c } = e._zod.bag;
|
|
8118
|
-
typeof a == "number" && (t.minItems = a), typeof c == "number" && (t.maxItems = c), t.type = "array", t.items =
|
|
8118
|
+
typeof a == "number" && (t.minItems = a), typeof c == "number" && (t.maxItems = c), t.type = "array", t.items = re(n.element, r, { ...o, path: [...o.path, "items"] });
|
|
8119
8119
|
}, Cu = (e, r, i, o) => {
|
|
8120
8120
|
const t = i, n = e._zod.def;
|
|
8121
8121
|
t.type = "object", t.properties = {};
|
|
8122
8122
|
const a = n.shape;
|
|
8123
8123
|
for (const f in a)
|
|
8124
|
-
t.properties[f] =
|
|
8124
|
+
t.properties[f] = re(a[f], r, {
|
|
8125
8125
|
...o,
|
|
8126
8126
|
path: [...o.path, "properties", f]
|
|
8127
8127
|
});
|
|
@@ -8129,21 +8129,21 @@ const gu = (e, r = {}) => (i) => {
|
|
|
8129
8129
|
const m = n.shape[f]._zod;
|
|
8130
8130
|
return r.io === "input" ? m.optin === void 0 : m.optout === void 0;
|
|
8131
8131
|
}));
|
|
8132
|
-
d.size > 0 && (t.required = Array.from(d)), n.catchall?._zod.def.type === "never" ? t.additionalProperties = !1 : n.catchall ? n.catchall && (t.additionalProperties =
|
|
8132
|
+
d.size > 0 && (t.required = Array.from(d)), n.catchall?._zod.def.type === "never" ? t.additionalProperties = !1 : n.catchall ? n.catchall && (t.additionalProperties = re(n.catchall, r, {
|
|
8133
8133
|
...o,
|
|
8134
8134
|
path: [...o.path, "additionalProperties"]
|
|
8135
8135
|
})) : r.io === "output" && (t.additionalProperties = !1);
|
|
8136
8136
|
}, Ni = (e, r, i, o) => {
|
|
8137
|
-
const t = e._zod.def, n = t.inclusive === !1, a = t.options.map((c, d) =>
|
|
8137
|
+
const t = e._zod.def, n = t.inclusive === !1, a = t.options.map((c, d) => re(c, r, {
|
|
8138
8138
|
...o,
|
|
8139
8139
|
path: [...o.path, n ? "oneOf" : "anyOf", d]
|
|
8140
8140
|
}));
|
|
8141
8141
|
n ? i.oneOf = a : i.anyOf = a;
|
|
8142
8142
|
}, Fu = (e, r, i, o) => {
|
|
8143
|
-
const t = e._zod.def, n =
|
|
8143
|
+
const t = e._zod.def, n = re(t.left, r, {
|
|
8144
8144
|
...o,
|
|
8145
8145
|
path: [...o.path, "allOf", 0]
|
|
8146
|
-
}), a =
|
|
8146
|
+
}), a = re(t.right, r, {
|
|
8147
8147
|
...o,
|
|
8148
8148
|
path: [...o.path, "allOf", 1]
|
|
8149
8149
|
}), c = (f) => "allOf" in f && Object.keys(f).length === 1, d = [
|
|
@@ -8154,10 +8154,10 @@ const gu = (e, r = {}) => (i) => {
|
|
|
8154
8154
|
}, Mu = (e, r, i, o) => {
|
|
8155
8155
|
const t = i, n = e._zod.def;
|
|
8156
8156
|
t.type = "array";
|
|
8157
|
-
const a = r.target === "draft-2020-12" ? "prefixItems" : "items", c = r.target === "draft-2020-12" || r.target === "openapi-3.0" ? "items" : "additionalItems", d = n.items.map((u, I) =>
|
|
8157
|
+
const a = r.target === "draft-2020-12" ? "prefixItems" : "items", c = r.target === "draft-2020-12" || r.target === "openapi-3.0" ? "items" : "additionalItems", d = n.items.map((u, I) => re(u, r, {
|
|
8158
8158
|
...o,
|
|
8159
8159
|
path: [...o.path, a, I]
|
|
8160
|
-
})), f = n.rest ?
|
|
8160
|
+
})), f = n.rest ? re(n.rest, r, {
|
|
8161
8161
|
...o,
|
|
8162
8162
|
path: [...o.path, c, ...r.target === "openapi-3.0" ? [n.items.length] : []]
|
|
8163
8163
|
}) : null;
|
|
@@ -8171,7 +8171,7 @@ const gu = (e, r = {}) => (i) => {
|
|
|
8171
8171
|
t.type = "object";
|
|
8172
8172
|
const a = n.keyType, d = a._zod.bag?.patterns;
|
|
8173
8173
|
if (n.mode === "loose" && d && d.size > 0) {
|
|
8174
|
-
const m =
|
|
8174
|
+
const m = re(n.valueType, r, {
|
|
8175
8175
|
...o,
|
|
8176
8176
|
path: [...o.path, "patternProperties", "*"]
|
|
8177
8177
|
});
|
|
@@ -8179,10 +8179,10 @@ const gu = (e, r = {}) => (i) => {
|
|
|
8179
8179
|
for (const p of d)
|
|
8180
8180
|
t.patternProperties[p.source] = m;
|
|
8181
8181
|
} else
|
|
8182
|
-
(r.target === "draft-07" || r.target === "draft-2020-12") && (t.propertyNames =
|
|
8182
|
+
(r.target === "draft-07" || r.target === "draft-2020-12") && (t.propertyNames = re(n.keyType, r, {
|
|
8183
8183
|
...o,
|
|
8184
8184
|
path: [...o.path, "propertyNames"]
|
|
8185
|
-
})), t.additionalProperties =
|
|
8185
|
+
})), t.additionalProperties = re(n.valueType, r, {
|
|
8186
8186
|
...o,
|
|
8187
8187
|
path: [...o.path, "additionalProperties"]
|
|
8188
8188
|
});
|
|
@@ -8192,26 +8192,26 @@ const gu = (e, r = {}) => (i) => {
|
|
|
8192
8192
|
m.length > 0 && (t.required = m);
|
|
8193
8193
|
}
|
|
8194
8194
|
}, Bu = (e, r, i, o) => {
|
|
8195
|
-
const t = e._zod.def, n =
|
|
8195
|
+
const t = e._zod.def, n = re(t.innerType, r, o), a = r.seen.get(e);
|
|
8196
8196
|
r.target === "openapi-3.0" ? (a.ref = t.innerType, i.nullable = !0) : i.anyOf = [n, { type: "null" }];
|
|
8197
8197
|
}, Ju = (e, r, i, o) => {
|
|
8198
8198
|
const t = e._zod.def;
|
|
8199
|
-
|
|
8199
|
+
re(t.innerType, r, o);
|
|
8200
8200
|
const n = r.seen.get(e);
|
|
8201
8201
|
n.ref = t.innerType;
|
|
8202
8202
|
}, Gu = (e, r, i, o) => {
|
|
8203
8203
|
const t = e._zod.def;
|
|
8204
|
-
|
|
8204
|
+
re(t.innerType, r, o);
|
|
8205
8205
|
const n = r.seen.get(e);
|
|
8206
8206
|
n.ref = t.innerType, i.default = JSON.parse(JSON.stringify(t.defaultValue));
|
|
8207
8207
|
}, Wu = (e, r, i, o) => {
|
|
8208
8208
|
const t = e._zod.def;
|
|
8209
|
-
|
|
8209
|
+
re(t.innerType, r, o);
|
|
8210
8210
|
const n = r.seen.get(e);
|
|
8211
8211
|
n.ref = t.innerType, r.io === "input" && (i._prefault = JSON.parse(JSON.stringify(t.defaultValue)));
|
|
8212
8212
|
}, Vu = (e, r, i, o) => {
|
|
8213
8213
|
const t = e._zod.def;
|
|
8214
|
-
|
|
8214
|
+
re(t.innerType, r, o);
|
|
8215
8215
|
const n = r.seen.get(e);
|
|
8216
8216
|
n.ref = t.innerType;
|
|
8217
8217
|
let a;
|
|
@@ -8223,27 +8223,27 @@ const gu = (e, r = {}) => (i) => {
|
|
|
8223
8223
|
i.default = a;
|
|
8224
8224
|
}, Xu = (e, r, i, o) => {
|
|
8225
8225
|
const t = e._zod.def, n = r.io === "input" ? t.in._zod.def.type === "transform" ? t.out : t.in : t.out;
|
|
8226
|
-
|
|
8226
|
+
re(n, r, o);
|
|
8227
8227
|
const a = r.seen.get(e);
|
|
8228
8228
|
a.ref = n;
|
|
8229
8229
|
}, Ku = (e, r, i, o) => {
|
|
8230
8230
|
const t = e._zod.def;
|
|
8231
|
-
|
|
8231
|
+
re(t.innerType, r, o);
|
|
8232
8232
|
const n = r.seen.get(e);
|
|
8233
8233
|
n.ref = t.innerType, i.readOnly = !0;
|
|
8234
8234
|
}, Hu = (e, r, i, o) => {
|
|
8235
8235
|
const t = e._zod.def;
|
|
8236
|
-
|
|
8236
|
+
re(t.innerType, r, o);
|
|
8237
8237
|
const n = r.seen.get(e);
|
|
8238
8238
|
n.ref = t.innerType;
|
|
8239
8239
|
}, Oi = (e, r, i, o) => {
|
|
8240
8240
|
const t = e._zod.def;
|
|
8241
|
-
|
|
8241
|
+
re(t.innerType, r, o);
|
|
8242
8242
|
const n = r.seen.get(e);
|
|
8243
8243
|
n.ref = t.innerType;
|
|
8244
8244
|
}, Yu = (e, r, i, o) => {
|
|
8245
8245
|
const t = e._zod.innerType;
|
|
8246
|
-
|
|
8246
|
+
re(t, r, o);
|
|
8247
8247
|
const n = r.seen.get(e);
|
|
8248
8248
|
n.ref = t;
|
|
8249
8249
|
}, On = {
|
|
@@ -8292,7 +8292,7 @@ function Qu(e, r) {
|
|
|
8292
8292
|
const o = e, t = Ke({ ...r, processors: On }), n = {};
|
|
8293
8293
|
for (const d of o._idmap.entries()) {
|
|
8294
8294
|
const [f, m] = d;
|
|
8295
|
-
|
|
8295
|
+
re(m, t);
|
|
8296
8296
|
}
|
|
8297
8297
|
const a = {}, c = {
|
|
8298
8298
|
registry: o,
|
|
@@ -8313,7 +8313,7 @@ function Qu(e, r) {
|
|
|
8313
8313
|
return { schemas: a };
|
|
8314
8314
|
}
|
|
8315
8315
|
const i = Ke({ ...r, processors: On });
|
|
8316
|
-
return
|
|
8316
|
+
return re(e, i), He(i, e), Ye(i, e);
|
|
8317
8317
|
}
|
|
8318
8318
|
class tp {
|
|
8319
8319
|
/** @deprecated Access via ctx instead */
|
|
@@ -8363,7 +8363,7 @@ class tp {
|
|
|
8363
8363
|
* This must be called before emit().
|
|
8364
8364
|
*/
|
|
8365
8365
|
process(r, i = { path: [], schemaPath: [] }) {
|
|
8366
|
-
return
|
|
8366
|
+
return re(r, this.ctx, i);
|
|
8367
8367
|
}
|
|
8368
8368
|
/**
|
|
8369
8369
|
* Emit the final JSON Schema after processing.
|
|
@@ -8463,7 +8463,7 @@ const rp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
8463
8463
|
$ZodRegistry: zl,
|
|
8464
8464
|
$ZodSet: rl,
|
|
8465
8465
|
$ZodString: $t,
|
|
8466
|
-
$ZodStringFormat:
|
|
8466
|
+
$ZodStringFormat: ne,
|
|
8467
8467
|
$ZodSuccess: fl,
|
|
8468
8468
|
$ZodSymbol: Ls,
|
|
8469
8469
|
$ZodTemplateLiteral: vl,
|
|
@@ -8638,7 +8638,7 @@ const rp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
8638
8638
|
parse: Pn,
|
|
8639
8639
|
parseAsync: Un,
|
|
8640
8640
|
prettifyError: oc,
|
|
8641
|
-
process:
|
|
8641
|
+
process: re,
|
|
8642
8642
|
regexes: Kn,
|
|
8643
8643
|
registry: ai,
|
|
8644
8644
|
safeDecode: $m,
|
|
@@ -8684,25 +8684,25 @@ const rp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
8684
8684
|
trim: lr,
|
|
8685
8685
|
uppercase: nr
|
|
8686
8686
|
}, Symbol.toStringTag, { value: "Module" })), Di = /* @__PURE__ */ k("ZodISODateTime", (e, r) => {
|
|
8687
|
-
ys.init(e, r),
|
|
8687
|
+
ys.init(e, r), ie.init(e, r);
|
|
8688
8688
|
});
|
|
8689
8689
|
function ed(e) {
|
|
8690
8690
|
return /* @__PURE__ */ Ol(Di, e);
|
|
8691
8691
|
}
|
|
8692
8692
|
const Ti = /* @__PURE__ */ k("ZodISODate", (e, r) => {
|
|
8693
|
-
_s.init(e, r),
|
|
8693
|
+
_s.init(e, r), ie.init(e, r);
|
|
8694
8694
|
});
|
|
8695
8695
|
function td(e) {
|
|
8696
8696
|
return /* @__PURE__ */ Dl(Ti, e);
|
|
8697
8697
|
}
|
|
8698
8698
|
const Ri = /* @__PURE__ */ k("ZodISOTime", (e, r) => {
|
|
8699
|
-
ws.init(e, r),
|
|
8699
|
+
ws.init(e, r), ie.init(e, r);
|
|
8700
8700
|
});
|
|
8701
8701
|
function rd(e) {
|
|
8702
8702
|
return /* @__PURE__ */ Tl(Ri, e);
|
|
8703
8703
|
}
|
|
8704
8704
|
const Ai = /* @__PURE__ */ k("ZodISODuration", (e, r) => {
|
|
8705
|
-
ks.init(e, r),
|
|
8705
|
+
ks.init(e, r), ie.init(e, r);
|
|
8706
8706
|
});
|
|
8707
8707
|
function nd(e) {
|
|
8708
8708
|
return /* @__PURE__ */ Rl(Ai, e);
|
|
@@ -8783,22 +8783,22 @@ const id = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
8783
8783
|
function Jt(e) {
|
|
8784
8784
|
return /* @__PURE__ */ jl(It, e);
|
|
8785
8785
|
}
|
|
8786
|
-
const
|
|
8787
|
-
|
|
8786
|
+
const ie = /* @__PURE__ */ k("ZodStringFormat", (e, r) => {
|
|
8787
|
+
ne.init(e, r), mr.init(e, r);
|
|
8788
8788
|
}), hr = /* @__PURE__ */ k("ZodEmail", (e, r) => {
|
|
8789
|
-
ds.init(e, r),
|
|
8789
|
+
ds.init(e, r), ie.init(e, r);
|
|
8790
8790
|
});
|
|
8791
8791
|
function bd(e) {
|
|
8792
8792
|
return /* @__PURE__ */ ci(hr, e);
|
|
8793
8793
|
}
|
|
8794
8794
|
const ct = /* @__PURE__ */ k("ZodGUID", (e, r) => {
|
|
8795
|
-
ls.init(e, r),
|
|
8795
|
+
ls.init(e, r), ie.init(e, r);
|
|
8796
8796
|
});
|
|
8797
8797
|
function $d(e) {
|
|
8798
8798
|
return /* @__PURE__ */ Bt(ct, e);
|
|
8799
8799
|
}
|
|
8800
8800
|
const Se = /* @__PURE__ */ k("ZodUUID", (e, r) => {
|
|
8801
|
-
us.init(e, r),
|
|
8801
|
+
us.init(e, r), ie.init(e, r);
|
|
8802
8802
|
});
|
|
8803
8803
|
function yd(e) {
|
|
8804
8804
|
return /* @__PURE__ */ si(Se, e);
|
|
@@ -8813,7 +8813,7 @@ function kd(e) {
|
|
|
8813
8813
|
return /* @__PURE__ */ di(Se, e);
|
|
8814
8814
|
}
|
|
8815
8815
|
const St = /* @__PURE__ */ k("ZodURL", (e, r) => {
|
|
8816
|
-
fs.init(e, r),
|
|
8816
|
+
fs.init(e, r), ie.init(e, r);
|
|
8817
8817
|
});
|
|
8818
8818
|
function Id(e) {
|
|
8819
8819
|
return /* @__PURE__ */ er(St, e);
|
|
@@ -8826,103 +8826,103 @@ function Sd(e) {
|
|
|
8826
8826
|
});
|
|
8827
8827
|
}
|
|
8828
8828
|
const gr = /* @__PURE__ */ k("ZodEmoji", (e, r) => {
|
|
8829
|
-
ms.init(e, r),
|
|
8829
|
+
ms.init(e, r), ie.init(e, r);
|
|
8830
8830
|
});
|
|
8831
8831
|
function xd(e) {
|
|
8832
8832
|
return /* @__PURE__ */ fi(gr, e);
|
|
8833
8833
|
}
|
|
8834
8834
|
const pr = /* @__PURE__ */ k("ZodNanoID", (e, r) => {
|
|
8835
|
-
hs.init(e, r),
|
|
8835
|
+
hs.init(e, r), ie.init(e, r);
|
|
8836
8836
|
});
|
|
8837
8837
|
function Ed(e) {
|
|
8838
8838
|
return /* @__PURE__ */ mi(pr, e);
|
|
8839
8839
|
}
|
|
8840
8840
|
const vr = /* @__PURE__ */ k("ZodCUID", (e, r) => {
|
|
8841
|
-
gs.init(e, r),
|
|
8841
|
+
gs.init(e, r), ie.init(e, r);
|
|
8842
8842
|
});
|
|
8843
8843
|
function zd(e) {
|
|
8844
8844
|
return /* @__PURE__ */ hi(vr, e);
|
|
8845
8845
|
}
|
|
8846
8846
|
const br = /* @__PURE__ */ k("ZodCUID2", (e, r) => {
|
|
8847
|
-
ps.init(e, r),
|
|
8847
|
+
ps.init(e, r), ie.init(e, r);
|
|
8848
8848
|
});
|
|
8849
8849
|
function jd(e) {
|
|
8850
8850
|
return /* @__PURE__ */ gi(br, e);
|
|
8851
8851
|
}
|
|
8852
8852
|
const $r = /* @__PURE__ */ k("ZodULID", (e, r) => {
|
|
8853
|
-
vs.init(e, r),
|
|
8853
|
+
vs.init(e, r), ie.init(e, r);
|
|
8854
8854
|
});
|
|
8855
8855
|
function Pd(e) {
|
|
8856
8856
|
return /* @__PURE__ */ pi($r, e);
|
|
8857
8857
|
}
|
|
8858
8858
|
const yr = /* @__PURE__ */ k("ZodXID", (e, r) => {
|
|
8859
|
-
bs.init(e, r),
|
|
8859
|
+
bs.init(e, r), ie.init(e, r);
|
|
8860
8860
|
});
|
|
8861
8861
|
function Ud(e) {
|
|
8862
8862
|
return /* @__PURE__ */ vi(yr, e);
|
|
8863
8863
|
}
|
|
8864
8864
|
const _r = /* @__PURE__ */ k("ZodKSUID", (e, r) => {
|
|
8865
|
-
$s.init(e, r),
|
|
8865
|
+
$s.init(e, r), ie.init(e, r);
|
|
8866
8866
|
});
|
|
8867
8867
|
function Nd(e) {
|
|
8868
8868
|
return /* @__PURE__ */ bi(_r, e);
|
|
8869
8869
|
}
|
|
8870
8870
|
const wr = /* @__PURE__ */ k("ZodIPv4", (e, r) => {
|
|
8871
|
-
Is.init(e, r),
|
|
8871
|
+
Is.init(e, r), ie.init(e, r);
|
|
8872
8872
|
});
|
|
8873
8873
|
function Od(e) {
|
|
8874
8874
|
return /* @__PURE__ */ $i(wr, e);
|
|
8875
8875
|
}
|
|
8876
8876
|
const Li = /* @__PURE__ */ k("ZodMAC", (e, r) => {
|
|
8877
|
-
xs.init(e, r),
|
|
8877
|
+
xs.init(e, r), ie.init(e, r);
|
|
8878
8878
|
});
|
|
8879
8879
|
function Dd(e) {
|
|
8880
8880
|
return /* @__PURE__ */ Ul(Li, e);
|
|
8881
8881
|
}
|
|
8882
8882
|
const kr = /* @__PURE__ */ k("ZodIPv6", (e, r) => {
|
|
8883
|
-
Ss.init(e, r),
|
|
8883
|
+
Ss.init(e, r), ie.init(e, r);
|
|
8884
8884
|
});
|
|
8885
8885
|
function Td(e) {
|
|
8886
8886
|
return /* @__PURE__ */ yi(kr, e);
|
|
8887
8887
|
}
|
|
8888
8888
|
const Ir = /* @__PURE__ */ k("ZodCIDRv4", (e, r) => {
|
|
8889
|
-
Es.init(e, r),
|
|
8889
|
+
Es.init(e, r), ie.init(e, r);
|
|
8890
8890
|
});
|
|
8891
8891
|
function Rd(e) {
|
|
8892
8892
|
return /* @__PURE__ */ _i(Ir, e);
|
|
8893
8893
|
}
|
|
8894
8894
|
const Sr = /* @__PURE__ */ k("ZodCIDRv6", (e, r) => {
|
|
8895
|
-
zs.init(e, r),
|
|
8895
|
+
zs.init(e, r), ie.init(e, r);
|
|
8896
8896
|
});
|
|
8897
8897
|
function Ad(e) {
|
|
8898
8898
|
return /* @__PURE__ */ wi(Sr, e);
|
|
8899
8899
|
}
|
|
8900
8900
|
const xr = /* @__PURE__ */ k("ZodBase64", (e, r) => {
|
|
8901
|
-
js.init(e, r),
|
|
8901
|
+
js.init(e, r), ie.init(e, r);
|
|
8902
8902
|
});
|
|
8903
8903
|
function Ld(e) {
|
|
8904
8904
|
return /* @__PURE__ */ ki(xr, e);
|
|
8905
8905
|
}
|
|
8906
8906
|
const Er = /* @__PURE__ */ k("ZodBase64URL", (e, r) => {
|
|
8907
|
-
Us.init(e, r),
|
|
8907
|
+
Us.init(e, r), ie.init(e, r);
|
|
8908
8908
|
});
|
|
8909
8909
|
function Zd(e) {
|
|
8910
8910
|
return /* @__PURE__ */ Ii(Er, e);
|
|
8911
8911
|
}
|
|
8912
8912
|
const zr = /* @__PURE__ */ k("ZodE164", (e, r) => {
|
|
8913
|
-
Ns.init(e, r),
|
|
8913
|
+
Ns.init(e, r), ie.init(e, r);
|
|
8914
8914
|
});
|
|
8915
8915
|
function Cd(e) {
|
|
8916
8916
|
return /* @__PURE__ */ Si(zr, e);
|
|
8917
8917
|
}
|
|
8918
8918
|
const jr = /* @__PURE__ */ k("ZodJWT", (e, r) => {
|
|
8919
|
-
Ds.init(e, r),
|
|
8919
|
+
Ds.init(e, r), ie.init(e, r);
|
|
8920
8920
|
});
|
|
8921
8921
|
function Fd(e) {
|
|
8922
8922
|
return /* @__PURE__ */ xi(jr, e);
|
|
8923
8923
|
}
|
|
8924
8924
|
const tt = /* @__PURE__ */ k("ZodCustomStringFormat", (e, r) => {
|
|
8925
|
-
Ts.init(e, r),
|
|
8925
|
+
Ts.init(e, r), ie.init(e, r);
|
|
8926
8926
|
});
|
|
8927
8927
|
function Md(e, r, i = {}) {
|
|
8928
8928
|
return /* @__PURE__ */ kt(tt, e, r, i);
|
|
@@ -9535,7 +9535,7 @@ const ap = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
9535
9535
|
ZodRecord: Nt,
|
|
9536
9536
|
ZodSet: io,
|
|
9537
9537
|
ZodString: It,
|
|
9538
|
-
ZodStringFormat:
|
|
9538
|
+
ZodStringFormat: ie,
|
|
9539
9539
|
ZodSuccess: vo,
|
|
9540
9540
|
ZodSymbol: Fi,
|
|
9541
9541
|
ZodTemplateLiteral: ko,
|
|
@@ -10042,7 +10042,7 @@ const ae = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
10042
10042
|
ZodRecord: Nt,
|
|
10043
10043
|
ZodSet: io,
|
|
10044
10044
|
ZodString: It,
|
|
10045
|
-
ZodStringFormat:
|
|
10045
|
+
ZodStringFormat: ie,
|
|
10046
10046
|
ZodSuccess: vo,
|
|
10047
10047
|
ZodSymbol: Fi,
|
|
10048
10048
|
ZodTemplateLiteral: ko,
|
|
@@ -10415,8 +10415,8 @@ function Po() {
|
|
|
10415
10415
|
const p = "getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true";
|
|
10416
10416
|
let u = "";
|
|
10417
10417
|
const I = () => u || new Promise((w) => {
|
|
10418
|
-
e.exec(p, (D,
|
|
10419
|
-
u = D ? " " :
|
|
10418
|
+
e.exec(p, (D, G) => {
|
|
10419
|
+
u = D ? " " : G, w(u);
|
|
10420
10420
|
});
|
|
10421
10421
|
}), b = () => {
|
|
10422
10422
|
if (!u)
|
|
@@ -10426,13 +10426,13 @@ function Po() {
|
|
|
10426
10426
|
u = " ";
|
|
10427
10427
|
}
|
|
10428
10428
|
return u;
|
|
10429
|
-
}, $ = "glibc", E = /LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i, P = "musl",
|
|
10429
|
+
}, $ = "glibc", E = /LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i, P = "musl", ee = (w) => w.includes("libc.musl-") || w.includes("ld-musl-"), J = () => {
|
|
10430
10430
|
const w = i();
|
|
10431
|
-
return w.header && w.header.glibcVersionRuntime ? $ : Array.isArray(w.sharedObjects) && w.sharedObjects.some(
|
|
10431
|
+
return w.header && w.header.glibcVersionRuntime ? $ : Array.isArray(w.sharedObjects) && w.sharedObjects.some(ee) ? P : null;
|
|
10432
|
+
}, H = (w) => {
|
|
10433
|
+
const [D, G] = w.split(/[\r\n]+/);
|
|
10434
|
+
return D && D.includes($) ? $ : G && G.includes(P) ? P : null;
|
|
10432
10435
|
}, Y = (w) => {
|
|
10433
|
-
const [D, J] = w.split(/[\r\n]+/);
|
|
10434
|
-
return D && D.includes($) ? $ : J && J.includes(P) ? P : null;
|
|
10435
|
-
}, ie = (w) => {
|
|
10436
10436
|
if (w) {
|
|
10437
10437
|
if (w.includes("/ld-musl-"))
|
|
10438
10438
|
return P;
|
|
@@ -10466,7 +10466,7 @@ function Po() {
|
|
|
10466
10466
|
d = null;
|
|
10467
10467
|
try {
|
|
10468
10468
|
const w = await n(t), D = c(w);
|
|
10469
|
-
d =
|
|
10469
|
+
d = Y(D);
|
|
10470
10470
|
} catch {
|
|
10471
10471
|
}
|
|
10472
10472
|
return d;
|
|
@@ -10476,25 +10476,25 @@ function Po() {
|
|
|
10476
10476
|
d = null;
|
|
10477
10477
|
try {
|
|
10478
10478
|
const w = a(t), D = c(w);
|
|
10479
|
-
d =
|
|
10479
|
+
d = Y(D);
|
|
10480
10480
|
} catch {
|
|
10481
10481
|
}
|
|
10482
10482
|
return d;
|
|
10483
|
-
},
|
|
10483
|
+
}, te = async () => {
|
|
10484
10484
|
let w = null;
|
|
10485
|
-
if (r() && (w = await _(), !w && (w = await ue(), w || (w =
|
|
10485
|
+
if (r() && (w = await _(), !w && (w = await ue(), w || (w = J()), !w))) {
|
|
10486
10486
|
const D = await I();
|
|
10487
|
-
w =
|
|
10487
|
+
w = H(D);
|
|
10488
10488
|
}
|
|
10489
10489
|
return w;
|
|
10490
10490
|
}, ve = () => {
|
|
10491
10491
|
let w = null;
|
|
10492
|
-
if (r() && (w = T(), !w && (w = he(), w || (w =
|
|
10492
|
+
if (r() && (w = T(), !w && (w = he(), w || (w = J()), !w))) {
|
|
10493
10493
|
const D = b();
|
|
10494
|
-
w =
|
|
10494
|
+
w = H(D);
|
|
10495
10495
|
}
|
|
10496
10496
|
return w;
|
|
10497
|
-
}, Pe = async () => r() && await
|
|
10497
|
+
}, Pe = async () => r() && await te() !== $, O = () => r() && ve() !== $, U = async () => {
|
|
10498
10498
|
if (m !== void 0)
|
|
10499
10499
|
return m;
|
|
10500
10500
|
m = null;
|
|
@@ -10518,13 +10518,13 @@ function Po() {
|
|
|
10518
10518
|
const w = i();
|
|
10519
10519
|
return w.header && w.header.glibcVersionRuntime ? w.header.glibcVersionRuntime : null;
|
|
10520
10520
|
}, M = (w) => w.trim().split(/\s+/)[1], A = (w) => {
|
|
10521
|
-
const [D,
|
|
10522
|
-
return D && D.includes($) ? M(D) :
|
|
10521
|
+
const [D, G, Q] = w.split(/[\r\n]+/);
|
|
10522
|
+
return D && D.includes($) ? M(D) : G && Q && G.includes(P) ? M(Q) : null;
|
|
10523
10523
|
};
|
|
10524
10524
|
return Xr = {
|
|
10525
10525
|
GLIBC: $,
|
|
10526
10526
|
MUSL: P,
|
|
10527
|
-
family:
|
|
10527
|
+
family: te,
|
|
10528
10528
|
familySync: ve,
|
|
10529
10529
|
isNonGlibcLinux: Pe,
|
|
10530
10530
|
isNonGlibcLinuxSync: O,
|
|
@@ -10592,12 +10592,12 @@ function Fr() {
|
|
|
10592
10592
|
["\\d", t],
|
|
10593
10593
|
[u, o]
|
|
10594
10594
|
], b = (E) => {
|
|
10595
|
-
for (const [P,
|
|
10596
|
-
E = E.split(`${P}*`).join(`${P}{0,${
|
|
10595
|
+
for (const [P, ee] of I)
|
|
10596
|
+
E = E.split(`${P}*`).join(`${P}{0,${ee}}`).split(`${P}+`).join(`${P}{1,${ee}}`);
|
|
10597
10597
|
return E;
|
|
10598
|
-
}, $ = (E, P,
|
|
10599
|
-
const
|
|
10600
|
-
n(E,
|
|
10598
|
+
}, $ = (E, P, ee) => {
|
|
10599
|
+
const J = b(P), H = p++;
|
|
10600
|
+
n(E, H, P), m[E] = H, d[H] = P, f[H] = J, a[H] = new RegExp(P, ee ? "g" : void 0), c[H] = new RegExp(J, ee ? "g" : void 0);
|
|
10601
10601
|
};
|
|
10602
10602
|
$("NUMERICIDENTIFIER", "0|[1-9]\\d*"), $("NUMERICIDENTIFIERLOOSE", "\\d+"), $("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${u}*`), $("MAINVERSION", `(${d[m.NUMERICIDENTIFIER]})\\.(${d[m.NUMERICIDENTIFIER]})\\.(${d[m.NUMERICIDENTIFIER]})`), $("MAINVERSIONLOOSE", `(${d[m.NUMERICIDENTIFIERLOOSE]})\\.(${d[m.NUMERICIDENTIFIERLOOSE]})\\.(${d[m.NUMERICIDENTIFIERLOOSE]})`), $("PRERELEASEIDENTIFIER", `(?:${d[m.NONNUMERICIDENTIFIER]}|${d[m.NUMERICIDENTIFIER]})`), $("PRERELEASEIDENTIFIERLOOSE", `(?:${d[m.NONNUMERICIDENTIFIER]}|${d[m.NUMERICIDENTIFIERLOOSE]})`), $("PRERELEASE", `(?:-(${d[m.PRERELEASEIDENTIFIER]}(?:\\.${d[m.PRERELEASEIDENTIFIER]})*))`), $("PRERELEASELOOSE", `(?:-?(${d[m.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${d[m.PRERELEASEIDENTIFIERLOOSE]})*))`), $("BUILDIDENTIFIER", `${u}+`), $("BUILD", `(?:\\+(${d[m.BUILDIDENTIFIER]}(?:\\.${d[m.BUILDIDENTIFIER]})*))`), $("FULLPLAIN", `v?${d[m.MAINVERSION]}${d[m.PRERELEASE]}?${d[m.BUILD]}?`), $("FULL", `^${d[m.FULLPLAIN]}$`), $("LOOSEPLAIN", `[v=\\s]*${d[m.MAINVERSIONLOOSE]}${d[m.PRERELEASELOOSE]}?${d[m.BUILD]}?`), $("LOOSE", `^${d[m.LOOSEPLAIN]}$`), $("GTLT", "((?:<|>)?=?)"), $("XRANGEIDENTIFIERLOOSE", `${d[m.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`), $("XRANGEIDENTIFIER", `${d[m.NUMERICIDENTIFIER]}|x|X|\\*`), $("XRANGEPLAIN", `[v=\\s]*(${d[m.XRANGEIDENTIFIER]})(?:\\.(${d[m.XRANGEIDENTIFIER]})(?:\\.(${d[m.XRANGEIDENTIFIER]})(?:${d[m.PRERELEASE]})?${d[m.BUILD]}?)?)?`), $("XRANGEPLAINLOOSE", `[v=\\s]*(${d[m.XRANGEIDENTIFIERLOOSE]})(?:\\.(${d[m.XRANGEIDENTIFIERLOOSE]})(?:\\.(${d[m.XRANGEIDENTIFIERLOOSE]})(?:${d[m.PRERELEASELOOSE]})?${d[m.BUILD]}?)?)?`), $("XRANGE", `^${d[m.GTLT]}\\s*${d[m.XRANGEPLAIN]}$`), $("XRANGELOOSE", `^${d[m.GTLT]}\\s*${d[m.XRANGEPLAINLOOSE]}$`), $("COERCEPLAIN", `(^|[^\\d])(\\d{1,${i}})(?:\\.(\\d{1,${i}}))?(?:\\.(\\d{1,${i}}))?`), $("COERCE", `${d[m.COERCEPLAIN]}(?:$|[^\\d])`), $("COERCEFULL", d[m.COERCEPLAIN] + `(?:${d[m.PRERELEASE]})?(?:${d[m.BUILD]})?(?:$|[^\\d])`), $("COERCERTL", d[m.COERCE], !0), $("COERCERTLFULL", d[m.COERCEFULL], !0), $("LONETILDE", "(?:~>?)"), $("TILDETRIM", `(\\s*)${d[m.LONETILDE]}\\s+`, !0), r.tildeTrimReplace = "$1~", $("TILDE", `^${d[m.LONETILDE]}${d[m.XRANGEPLAIN]}$`), $("TILDELOOSE", `^${d[m.LONETILDE]}${d[m.XRANGEPLAINLOOSE]}$`), $("LONECARET", "(?:\\^)"), $("CARETTRIM", `(\\s*)${d[m.LONECARET]}\\s+`, !0), r.caretTrimReplace = "$1^", $("CARET", `^${d[m.LONECARET]}${d[m.XRANGEPLAIN]}$`), $("CARETLOOSE", `^${d[m.LONECARET]}${d[m.XRANGEPLAINLOOSE]}$`), $("COMPARATORLOOSE", `^${d[m.GTLT]}\\s*(${d[m.LOOSEPLAIN]})$|^$`), $("COMPARATOR", `^${d[m.GTLT]}\\s*(${d[m.FULLPLAIN]})$|^$`), $("COMPARATORTRIM", `(\\s*)${d[m.GTLT]}\\s*(${d[m.LOOSEPLAIN]}|${d[m.XRANGEPLAIN]})`, !0), r.comparatorTrimReplace = "$1$2$3", $("HYPHENRANGE", `^\\s*(${d[m.XRANGEPLAIN]})\\s+-\\s+(${d[m.XRANGEPLAIN]})\\s*$`), $("HYPHENRANGELOOSE", `^\\s*(${d[m.XRANGEPLAINLOOSE]})\\s+-\\s+(${d[m.XRANGEPLAINLOOSE]})\\s*$`), $("STAR", "(<|>)?=?\\s*\\*"), $("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$"), $("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
10603
10603
|
})(Zt, Zt.exports)), Zt.exports;
|
|
@@ -11035,7 +11035,7 @@ function Rf() {
|
|
|
11035
11035
|
return M;
|
|
11036
11036
|
const A = this.options.loose, s = A ? d[f.HYPHENRANGELOOSE] : d[f.HYPHENRANGE];
|
|
11037
11037
|
U = U.replace(s, ve(this.options.includePrerelease)), a("hyphen replace", U), U = U.replace(d[f.COMPARATORTRIM], m), a("comparator trim", U), U = U.replace(d[f.TILDETRIM], p), a("tilde trim", U), U = U.replace(d[f.CARETTRIM], u), a("caret trim", U);
|
|
11038
|
-
let R = U.split(" ").map((Q) =>
|
|
11038
|
+
let R = U.split(" ").map((Q) => ee(Q, this.options)).join(" ").split(/\s+/).map((Q) => te(Q, this.options));
|
|
11039
11039
|
A && (R = R.filter((Q) => (a("loose invalid filter", Q, this.options), !!Q.match(d[f.COMPARATORLOOSE])))), a("range list", R);
|
|
11040
11040
|
const w = /* @__PURE__ */ new Map(), D = R.map((Q) => new n(Q, this.options));
|
|
11041
11041
|
for (const Q of D) {
|
|
@@ -11044,8 +11044,8 @@ function Rf() {
|
|
|
11044
11044
|
w.set(Q.value, Q);
|
|
11045
11045
|
}
|
|
11046
11046
|
w.size > 1 && w.has("") && w.delete("");
|
|
11047
|
-
const
|
|
11048
|
-
return o.set(C,
|
|
11047
|
+
const G = [...w.values()];
|
|
11048
|
+
return o.set(C, G), G;
|
|
11049
11049
|
}
|
|
11050
11050
|
intersects(U, F) {
|
|
11051
11051
|
if (!(U instanceof r))
|
|
@@ -11082,12 +11082,12 @@ function Rf() {
|
|
|
11082
11082
|
for (; F && C.length; )
|
|
11083
11083
|
F = C.every((A) => M.intersects(A, U)), M = C.pop();
|
|
11084
11084
|
return F;
|
|
11085
|
-
},
|
|
11085
|
+
}, ee = (O, U) => (O = O.replace(d[f.BUILD], ""), a("comp", O, U), O = me(O, U), a("caret", O), O = H(O, U), a("tildes", O), O = he(O, U), a("xrange", O), O = T(O, U), a("stars", O), O), J = (O) => !O || O.toLowerCase() === "x" || O === "*", H = (O, U) => O.trim().split(/\s+/).map((F) => Y(F, U)).join(" "), Y = (O, U) => {
|
|
11086
11086
|
const F = U.loose ? d[f.TILDELOOSE] : d[f.TILDE];
|
|
11087
11087
|
return O.replace(F, (C, M, A, s, R) => {
|
|
11088
11088
|
a("tilde", O, C, M, A, s, R);
|
|
11089
11089
|
let w;
|
|
11090
|
-
return
|
|
11090
|
+
return J(M) ? w = "" : J(A) ? w = `>=${M}.0.0 <${+M + 1}.0.0-0` : J(s) ? w = `>=${M}.${A}.0 <${M}.${+A + 1}.0-0` : R ? (a("replaceTilde pr", R), w = `>=${M}.${A}.${s}-${R} <${M}.${+A + 1}.0-0`) : w = `>=${M}.${A}.${s} <${M}.${+A + 1}.0-0`, a("tilde return", w), w;
|
|
11091
11091
|
});
|
|
11092
11092
|
}, me = (O, U) => O.trim().split(/\s+/).map((F) => ue(F, U)).join(" "), ue = (O, U) => {
|
|
11093
11093
|
a("caret", O, U);
|
|
@@ -11095,17 +11095,17 @@ function Rf() {
|
|
|
11095
11095
|
return O.replace(F, (M, A, s, R, w) => {
|
|
11096
11096
|
a("caret", O, M, A, s, R, w);
|
|
11097
11097
|
let D;
|
|
11098
|
-
return
|
|
11098
|
+
return J(A) ? D = "" : J(s) ? D = `>=${A}.0.0${C} <${+A + 1}.0.0-0` : J(R) ? A === "0" ? D = `>=${A}.${s}.0${C} <${A}.${+s + 1}.0-0` : D = `>=${A}.${s}.0${C} <${+A + 1}.0.0-0` : w ? (a("replaceCaret pr", w), A === "0" ? s === "0" ? D = `>=${A}.${s}.${R}-${w} <${A}.${s}.${+R + 1}-0` : D = `>=${A}.${s}.${R}-${w} <${A}.${+s + 1}.0-0` : D = `>=${A}.${s}.${R}-${w} <${+A + 1}.0.0-0`) : (a("no pr"), A === "0" ? s === "0" ? D = `>=${A}.${s}.${R}${C} <${A}.${s}.${+R + 1}-0` : D = `>=${A}.${s}.${R}${C} <${A}.${+s + 1}.0-0` : D = `>=${A}.${s}.${R} <${+A + 1}.0.0-0`), a("caret return", D), D;
|
|
11099
11099
|
});
|
|
11100
11100
|
}, he = (O, U) => (a("replaceXRanges", O, U), O.split(/\s+/).map((F) => _(F, U)).join(" ")), _ = (O, U) => {
|
|
11101
11101
|
O = O.trim();
|
|
11102
11102
|
const F = U.loose ? d[f.XRANGELOOSE] : d[f.XRANGE];
|
|
11103
11103
|
return O.replace(F, (C, M, A, s, R, w) => {
|
|
11104
11104
|
a("xRange", O, C, M, A, s, R, w);
|
|
11105
|
-
const D =
|
|
11106
|
-
return M === "=" && we && (M = ""), w = U.includePrerelease ? "-0" : "", D ? M === ">" || M === "<" ? C = "<0.0.0-0" : C = "*" : M && we ? (
|
|
11105
|
+
const D = J(A), G = D || J(s), Q = G || J(R), we = Q;
|
|
11106
|
+
return M === "=" && we && (M = ""), w = U.includePrerelease ? "-0" : "", D ? M === ">" || M === "<" ? C = "<0.0.0-0" : C = "*" : M && we ? (G && (s = 0), R = 0, M === ">" ? (M = ">=", G ? (A = +A + 1, s = 0, R = 0) : (s = +s + 1, R = 0)) : M === "<=" && (M = "<", G ? A = +A + 1 : s = +s + 1), M === "<" && (w = "-0"), C = `${M + A}.${s}.${R}${w}`) : G ? C = `>=${A}.0.0${w} <${+A + 1}.0.0-0` : Q && (C = `>=${A}.${s}.0${w} <${A}.${+s + 1}.0-0`), a("xRange return", C), C;
|
|
11107
11107
|
});
|
|
11108
|
-
}, T = (O, U) => (a("replaceStars", O, U), O.trim().replace(d[f.STAR], "")),
|
|
11108
|
+
}, T = (O, U) => (a("replaceStars", O, U), O.trim().replace(d[f.STAR], "")), te = (O, U) => (a("replaceGTE0", O, U), O.trim().replace(d[U.includePrerelease ? f.GTE0PRE : f.GTE0], "")), ve = (O) => (U, F, C, M, A, s, R, w, D, G, Q, we) => (J(C) ? F = "" : J(M) ? F = `>=${C}.0.0${O ? "-0" : ""}` : J(A) ? F = `>=${C}.${M}.0${O ? "-0" : ""}` : s ? F = `>=${F}` : F = `>=${F}${O ? "-0" : ""}`, J(D) ? w = "" : J(G) ? w = `<${+D + 1}.0.0-0` : J(Q) ? w = `<${D}.${+G + 1}.0-0` : we ? w = `<=${D}.${G}.${Q}-${we}` : O ? w = `<${D}.${G}.${+Q + 1}-0` : w = `<=${w}`, `${F} ${w}`.trim()), Pe = (O, U, F) => {
|
|
11109
11109
|
for (let C = 0; C < O.length; C++)
|
|
11110
11110
|
if (!O[C].test(U))
|
|
11111
11111
|
return !1;
|
|
@@ -11166,7 +11166,7 @@ function Lf() {
|
|
|
11166
11166
|
}, I = (O) => {
|
|
11167
11167
|
O instanceof Error ? console.error(`sharp: Installation error: ${O.message}`) : console.log(`sharp: ${O}`);
|
|
11168
11168
|
}, b = () => n.isNonGlibcLinuxSync() ? n.familySync() : "", $ = () => `${process.platform}${b()}-${process.arch}`, E = () => {
|
|
11169
|
-
if (
|
|
11169
|
+
if (Y())
|
|
11170
11170
|
return "wasm32";
|
|
11171
11171
|
const { npm_config_arch: O, npm_config_platform: U, npm_config_libc: F } = process.env, C = typeof F == "string" ? F : b();
|
|
11172
11172
|
return `${U || process.platform}${C}-${O || process.arch}`;
|
|
@@ -11180,13 +11180,13 @@ function Lf() {
|
|
|
11180
11180
|
}
|
|
11181
11181
|
}
|
|
11182
11182
|
return "";
|
|
11183
|
-
},
|
|
11183
|
+
}, ee = () => {
|
|
11184
11184
|
try {
|
|
11185
11185
|
return require("@img/sharp-libvips-dev/cplusplus");
|
|
11186
11186
|
} catch {
|
|
11187
11187
|
}
|
|
11188
11188
|
return "";
|
|
11189
|
-
},
|
|
11189
|
+
}, J = () => {
|
|
11190
11190
|
try {
|
|
11191
11191
|
return Ze(`@img/sharp-libvips-dev-${E()}/lib`);
|
|
11192
11192
|
} catch {
|
|
@@ -11196,10 +11196,10 @@ function Lf() {
|
|
|
11196
11196
|
}
|
|
11197
11197
|
}
|
|
11198
11198
|
return "";
|
|
11199
|
-
},
|
|
11199
|
+
}, H = () => {
|
|
11200
11200
|
if (process.release?.name === "node" && process.versions && !t(process.versions.node, c.node))
|
|
11201
11201
|
return { found: process.versions.node, expected: c.node };
|
|
11202
|
-
},
|
|
11202
|
+
}, Y = () => {
|
|
11203
11203
|
const { CC: O } = process.env;
|
|
11204
11204
|
return !!O?.endsWith("/emcc");
|
|
11205
11205
|
}, me = () => process.platform === "darwin" && process.arch === "x64" ? (e("sysctl sysctl.proc_translated", u).stdout || "").trim() === "sysctl.proc_translated: 1" : !1, ue = (O) => r("sha512").update(O).digest("hex"), he = () => {
|
|
@@ -11211,16 +11211,16 @@ function Lf() {
|
|
|
11211
11211
|
} catch {
|
|
11212
11212
|
}
|
|
11213
11213
|
return "";
|
|
11214
|
-
}, _ = () => e(`node-gyp rebuild --directory=src ${
|
|
11214
|
+
}, _ = () => e(`node-gyp rebuild --directory=src ${Y() ? "--nodedir=emscripten" : ""}`, {
|
|
11215
11215
|
...u,
|
|
11216
11216
|
stdio: "inherit"
|
|
11217
11217
|
}).status, T = () => process.platform !== "win32" ? (e("pkg-config --modversion vips-cpp", {
|
|
11218
11218
|
...u,
|
|
11219
11219
|
env: {
|
|
11220
11220
|
...process.env,
|
|
11221
|
-
PKG_CONFIG_PATH:
|
|
11221
|
+
PKG_CONFIG_PATH: te()
|
|
11222
11222
|
}
|
|
11223
|
-
}).stdout || "").trim() : "",
|
|
11223
|
+
}).stdout || "").trim() : "", te = () => process.platform !== "win32" ? [
|
|
11224
11224
|
(e(
|
|
11225
11225
|
'which brew >/dev/null 2>&1 && brew environment --plain | grep PKG_CONFIG_LIBDIR | cut -d" " -f2',
|
|
11226
11226
|
u
|
|
@@ -11236,15 +11236,15 @@ function Lf() {
|
|
|
11236
11236
|
prebuiltPlatforms: p,
|
|
11237
11237
|
buildPlatformArch: E,
|
|
11238
11238
|
buildSharpLibvipsIncludeDir: P,
|
|
11239
|
-
buildSharpLibvipsCPlusPlusDir:
|
|
11240
|
-
buildSharpLibvipsLibDir:
|
|
11241
|
-
isUnsupportedNodeRuntime:
|
|
11239
|
+
buildSharpLibvipsCPlusPlusDir: ee,
|
|
11240
|
+
buildSharpLibvipsLibDir: J,
|
|
11241
|
+
isUnsupportedNodeRuntime: H,
|
|
11242
11242
|
runtimePlatformArch: $,
|
|
11243
11243
|
log: I,
|
|
11244
11244
|
yarnLocator: he,
|
|
11245
11245
|
spawnRebuild: _,
|
|
11246
11246
|
globalLibvipsVersion: T,
|
|
11247
|
-
pkgConfigPath:
|
|
11247
|
+
pkgConfigPath: te,
|
|
11248
11248
|
useGlobalLibvips: (O) => {
|
|
11249
11249
|
if (process.env.SHARP_IGNORE_GLOBAL_LIBVIPS)
|
|
11250
11250
|
return ve(!1, "SHARP_IGNORE_GLOBAL_LIBVIPS", O);
|
|
@@ -11296,14 +11296,14 @@ function Mr() {
|
|
|
11296
11296
|
` Requires ${P}`
|
|
11297
11297
|
);
|
|
11298
11298
|
} else if (t.includes(a)) {
|
|
11299
|
-
const [E, P] = a.split("-"),
|
|
11299
|
+
const [E, P] = a.split("-"), ee = E.endsWith("musl") ? " --libc=musl" : "";
|
|
11300
11300
|
b.push(
|
|
11301
11301
|
"- Ensure optional dependencies can be installed:",
|
|
11302
11302
|
" npm install --include=optional sharp",
|
|
11303
11303
|
"- Ensure your package manager supports multi-platform installation:",
|
|
11304
11304
|
" See https://sharp.pixelplumbing.com/install#cross-platform",
|
|
11305
11305
|
"- Add platform-specific dependencies:",
|
|
11306
|
-
` npm install --os=${E.replace("musl", "")}${
|
|
11306
|
+
` npm install --os=${E.replace("musl", "")}${ee} --cpu=${P} sharp`
|
|
11307
11307
|
);
|
|
11308
11308
|
} else
|
|
11309
11309
|
b.push(
|
|
@@ -11314,11 +11314,11 @@ function Mr() {
|
|
|
11314
11314
|
);
|
|
11315
11315
|
if (p && /(symbol not found|CXXABI_)/i.test($))
|
|
11316
11316
|
try {
|
|
11317
|
-
const { config: E } = Ze(`@img/sharp-libvips-${a}/package`), P = `${e()} ${r()}`,
|
|
11317
|
+
const { config: E } = Ze(`@img/sharp-libvips-${a}/package`), P = `${e()} ${r()}`, ee = `${E.musl ? "musl" : "glibc"} ${E.musl || E.glibc}`;
|
|
11318
11318
|
b.push(
|
|
11319
11319
|
"- Update your OS:",
|
|
11320
11320
|
` Found ${P}`,
|
|
11321
|
-
` Requires ${
|
|
11321
|
+
` Requires ${ee}`
|
|
11322
11322
|
);
|
|
11323
11323
|
} catch {
|
|
11324
11324
|
}
|
|
@@ -12257,9 +12257,9 @@ function Wp() {
|
|
|
12257
12257
|
return this.options.flop = e.bool(_) ? _ : !0, this;
|
|
12258
12258
|
}
|
|
12259
12259
|
function a(_, T) {
|
|
12260
|
-
const
|
|
12261
|
-
if (
|
|
12262
|
-
this.options.affineMatrix =
|
|
12260
|
+
const te = [].concat(..._);
|
|
12261
|
+
if (te.length === 4 && te.every(e.number))
|
|
12262
|
+
this.options.affineMatrix = te;
|
|
12263
12263
|
else
|
|
12264
12264
|
throw e.invalidParameterError("matrix", "1x4 or 2x2 array", _);
|
|
12265
12265
|
if (e.defined(T))
|
|
@@ -12293,7 +12293,7 @@ function Wp() {
|
|
|
12293
12293
|
throw e.invalidParameterError("options", "object", T);
|
|
12294
12294
|
return this;
|
|
12295
12295
|
}
|
|
12296
|
-
function c(_, T,
|
|
12296
|
+
function c(_, T, te) {
|
|
12297
12297
|
if (!e.defined(_))
|
|
12298
12298
|
this.options.sharpenSigma = -1;
|
|
12299
12299
|
else if (e.bool(_))
|
|
@@ -12304,11 +12304,11 @@ function Wp() {
|
|
|
12304
12304
|
this.options.sharpenM1 = T;
|
|
12305
12305
|
else
|
|
12306
12306
|
throw e.invalidParameterError("flat", "number between 0 and 10000", T);
|
|
12307
|
-
if (e.defined(
|
|
12308
|
-
if (e.number(
|
|
12309
|
-
this.options.sharpenM2 =
|
|
12307
|
+
if (e.defined(te))
|
|
12308
|
+
if (e.number(te) && e.inRange(te, 0, 1e4))
|
|
12309
|
+
this.options.sharpenM2 = te;
|
|
12310
12310
|
else
|
|
12311
|
-
throw e.invalidParameterError("jagged", "number between 0 and 10000",
|
|
12311
|
+
throw e.invalidParameterError("jagged", "number between 0 and 10000", te);
|
|
12312
12312
|
} else if (e.plainObject(_)) {
|
|
12313
12313
|
if (e.number(_.sigma) && e.inRange(_.sigma, 1e-6, 10))
|
|
12314
12314
|
this.options.sharpenSigma = _.sigma;
|
|
@@ -12451,7 +12451,7 @@ function Wp() {
|
|
|
12451
12451
|
function P(_) {
|
|
12452
12452
|
return this.normalise(_);
|
|
12453
12453
|
}
|
|
12454
|
-
function
|
|
12454
|
+
function ee(_) {
|
|
12455
12455
|
if (e.plainObject(_)) {
|
|
12456
12456
|
if (e.integer(_.width) && _.width > 0)
|
|
12457
12457
|
this.options.claheWidth = _.width;
|
|
@@ -12470,12 +12470,12 @@ function Wp() {
|
|
|
12470
12470
|
throw e.invalidParameterError("options", "plain object", _);
|
|
12471
12471
|
return this;
|
|
12472
12472
|
}
|
|
12473
|
-
function
|
|
12473
|
+
function J(_) {
|
|
12474
12474
|
if (!e.object(_) || !Array.isArray(_.kernel) || !e.integer(_.width) || !e.integer(_.height) || !e.inRange(_.width, 3, 1001) || !e.inRange(_.height, 3, 1001) || _.height * _.width !== _.kernel.length)
|
|
12475
12475
|
throw new Error("Invalid convolution kernel");
|
|
12476
|
-
return e.integer(_.scale) || (_.scale = _.kernel.reduce((T,
|
|
12476
|
+
return e.integer(_.scale) || (_.scale = _.kernel.reduce((T, te) => T + te, 0)), _.scale < 1 && (_.scale = 1), e.integer(_.offset) || (_.offset = 0), this.options.convKernel = _, this;
|
|
12477
12477
|
}
|
|
12478
|
-
function
|
|
12478
|
+
function H(_, T) {
|
|
12479
12479
|
if (!e.defined(_))
|
|
12480
12480
|
this.options.threshold = 128;
|
|
12481
12481
|
else if (e.bool(_))
|
|
@@ -12486,8 +12486,8 @@ function Wp() {
|
|
|
12486
12486
|
throw e.invalidParameterError("threshold", "integer between 0 and 255", _);
|
|
12487
12487
|
return !e.object(T) || T.greyscale === !0 || T.grayscale === !0 ? this.options.thresholdGrayscale = !0 : this.options.thresholdGrayscale = !1, this;
|
|
12488
12488
|
}
|
|
12489
|
-
function
|
|
12490
|
-
if (this.options.boolean = this._createInputDescriptor(_,
|
|
12489
|
+
function Y(_, T, te) {
|
|
12490
|
+
if (this.options.boolean = this._createInputDescriptor(_, te), e.string(T) && e.inArray(T, ["and", "or", "eor"]))
|
|
12491
12491
|
this.options.booleanOp = T;
|
|
12492
12492
|
else
|
|
12493
12493
|
throw e.invalidParameterError("operator", "one of: and, or, eor", T);
|
|
@@ -12567,10 +12567,10 @@ function Wp() {
|
|
|
12567
12567
|
negate: $,
|
|
12568
12568
|
normalise: E,
|
|
12569
12569
|
normalize: P,
|
|
12570
|
-
clahe:
|
|
12571
|
-
convolve:
|
|
12572
|
-
threshold:
|
|
12573
|
-
boolean:
|
|
12570
|
+
clahe: ee,
|
|
12571
|
+
convolve: J,
|
|
12572
|
+
threshold: H,
|
|
12573
|
+
boolean: Y,
|
|
12574
12574
|
linear: me,
|
|
12575
12575
|
recomb: ue,
|
|
12576
12576
|
modulate: he
|
|
@@ -12856,11 +12856,11 @@ function Vp() {
|
|
|
12856
12856
|
apple: { channels: 3, labels: ["r16", "g16", "b16"] },
|
|
12857
12857
|
gray: { channels: 1, labels: ["gray"] }
|
|
12858
12858
|
}, E = $, P = (6 / 29) ** 3;
|
|
12859
|
-
function
|
|
12859
|
+
function ee(l) {
|
|
12860
12860
|
const h = l > 31308e-7 ? 1.055 * l ** 0.4166666666666667 - 0.055 : l * 12.92;
|
|
12861
12861
|
return Math.min(Math.max(0, h), 1);
|
|
12862
12862
|
}
|
|
12863
|
-
function
|
|
12863
|
+
function J(l) {
|
|
12864
12864
|
return l > 0.04045 ? ((l + 0.055) / 1.055) ** 2.4 : l / 12.92;
|
|
12865
12865
|
}
|
|
12866
12866
|
for (const l of Object.keys($)) {
|
|
@@ -12932,13 +12932,13 @@ function Vp() {
|
|
|
12932
12932
|
const y = $.rgb.hsl(l)[0], x = 1 / 255 * Math.min(h, Math.min(g, v));
|
|
12933
12933
|
return v = 1 - 1 / 255 * Math.max(h, Math.max(g, v)), [y, x * 100, v * 100];
|
|
12934
12934
|
}, $.rgb.oklab = function(l) {
|
|
12935
|
-
const h =
|
|
12935
|
+
const h = J(l[0] / 255), g = J(l[1] / 255), v = J(l[2] / 255), y = Math.cbrt(0.4122214708 * h + 0.5363325363 * g + 0.0514459929 * v), x = Math.cbrt(0.2119034982 * h + 0.6806995451 * g + 0.1073969566 * v), S = Math.cbrt(0.0883024619 * h + 0.2817188376 * g + 0.6299787005 * v), z = 0.2104542553 * y + 0.793617785 * x - 0.0040720468 * S, L = 1.9779984951 * y - 2.428592205 * x + 0.4505937099 * S, X = 0.0259040371 * y + 0.7827717662 * x - 0.808675766 * S;
|
|
12936
12936
|
return [z * 100, L * 100, X * 100];
|
|
12937
12937
|
}, $.rgb.cmyk = function(l) {
|
|
12938
12938
|
const h = l[0] / 255, g = l[1] / 255, v = l[2] / 255, y = Math.min(1 - h, 1 - g, 1 - v), x = (1 - h - y) / (1 - y) || 0, S = (1 - g - y) / (1 - y) || 0, z = (1 - v - y) / (1 - y) || 0;
|
|
12939
12939
|
return [x * 100, S * 100, z * 100, y * 100];
|
|
12940
12940
|
};
|
|
12941
|
-
function
|
|
12941
|
+
function H(l, h) {
|
|
12942
12942
|
return (l[0] - h[0]) ** 2 + (l[1] - h[1]) ** 2 + (l[2] - h[2]) ** 2;
|
|
12943
12943
|
}
|
|
12944
12944
|
$.rgb.keyword = function(l) {
|
|
@@ -12947,14 +12947,14 @@ function Vp() {
|
|
|
12947
12947
|
return h;
|
|
12948
12948
|
let g = Number.POSITIVE_INFINITY, v;
|
|
12949
12949
|
for (const y of Object.keys(d)) {
|
|
12950
|
-
const x = d[y], S =
|
|
12950
|
+
const x = d[y], S = H(l, x);
|
|
12951
12951
|
S < g && (g = S, v = y);
|
|
12952
12952
|
}
|
|
12953
12953
|
return v;
|
|
12954
12954
|
}, $.keyword.rgb = function(l) {
|
|
12955
12955
|
return d[l];
|
|
12956
12956
|
}, $.rgb.xyz = function(l) {
|
|
12957
|
-
const h =
|
|
12957
|
+
const h = J(l[0] / 255), g = J(l[1] / 255), v = J(l[2] / 255), y = h * 0.4124564 + g * 0.3575761 + v * 0.1804375, x = h * 0.2126729 + g * 0.7151522 + v * 0.072175, S = h * 0.0193339 + g * 0.119192 + v * 0.9503041;
|
|
12958
12958
|
return [y * 100, x * 100, S * 100];
|
|
12959
12959
|
}, $.rgb.lab = function(l) {
|
|
12960
12960
|
const h = $.rgb.xyz(l);
|
|
@@ -13047,7 +13047,7 @@ function Vp() {
|
|
|
13047
13047
|
}, $.xyz.rgb = function(l) {
|
|
13048
13048
|
const h = l[0] / 100, g = l[1] / 100, v = l[2] / 100;
|
|
13049
13049
|
let y, x, S;
|
|
13050
|
-
return y = h * 3.2404542 + g * -1.5371385 + v * -0.4985314, x = h * -0.969266 + g * 1.8760108 + v * 0.041556, S = h * 0.0556434 + g * -0.2040259 + v * 1.0572252, y =
|
|
13050
|
+
return y = h * 3.2404542 + g * -1.5371385 + v * -0.4985314, x = h * -0.969266 + g * 1.8760108 + v * 0.041556, S = h * 0.0556434 + g * -0.2040259 + v * 1.0572252, y = ee(y), x = ee(x), S = ee(S), [y * 255, x * 255, S * 255];
|
|
13051
13051
|
}, $.xyz.lab = function(l) {
|
|
13052
13052
|
let h = l[0], g = l[1], v = l[2];
|
|
13053
13053
|
h /= 95.047, g /= 100, v /= 108.883, h = h > P ? h ** (1 / 3) : 7.787 * h + 16 / 116, g = g > P ? g ** (1 / 3) : 7.787 * g + 16 / 116, v = v > P ? v ** (1 / 3) : 7.787 * v + 16 / 116;
|
|
@@ -13062,7 +13062,7 @@ function Vp() {
|
|
|
13062
13062
|
const h = l[0] / 100, g = l[1] / 100, v = l[2] / 100, y = (0.999999998 * h + 0.396337792 * g + 0.215803758 * v) ** 3, x = (1.000000008 * h - 0.105561342 * g - 0.063854175 * v) ** 3, S = (1.000000055 * h - 0.089484182 * g - 1.291485538 * v) ** 3, z = 1.227013851 * y - 0.55779998 * x + 0.281256149 * S, L = -0.040580178 * y + 1.11225687 * x - 0.071676679 * S, X = -0.076381285 * y - 0.421481978 * x + 1.58616322 * S;
|
|
13063
13063
|
return [z * 100, L * 100, X * 100];
|
|
13064
13064
|
}, $.oklab.rgb = function(l) {
|
|
13065
|
-
const h = l[0] / 100, g = l[1] / 100, v = l[2] / 100, y = (h + 0.3963377774 * g + 0.2158037573 * v) ** 3, x = (h - 0.1055613458 * g - 0.0638541728 * v) ** 3, S = (h - 0.0894841775 * g - 1.291485548 * v) ** 3, z =
|
|
13065
|
+
const h = l[0] / 100, g = l[1] / 100, v = l[2] / 100, y = (h + 0.3963377774 * g + 0.2158037573 * v) ** 3, x = (h - 0.1055613458 * g - 0.0638541728 * v) ** 3, S = (h - 0.0894841775 * g - 1.291485548 * v) ** 3, z = ee(4.0767416621 * y - 3.3077115913 * x + 0.2309699292 * S), L = ee(-1.2684380046 * y + 2.6097574011 * x - 0.3413193965 * S), X = ee(-0.0041960863 * y - 0.7034186147 * x + 1.707614701 * S);
|
|
13066
13066
|
return [z * 255, L * 255, X * 255];
|
|
13067
13067
|
}, $.oklch.oklab = function(l) {
|
|
13068
13068
|
return $.lch.lab(l);
|
|
@@ -13203,7 +13203,7 @@ function Vp() {
|
|
|
13203
13203
|
}, $.rgb.gray = function(l) {
|
|
13204
13204
|
return [(l[0] + l[1] + l[2]) / 3 / 255 * 100];
|
|
13205
13205
|
};
|
|
13206
|
-
function
|
|
13206
|
+
function Y() {
|
|
13207
13207
|
const l = {}, h = Object.keys(E);
|
|
13208
13208
|
for (let { length: g } = h, v = 0; v < g; v++)
|
|
13209
13209
|
l[h[v]] = {
|
|
@@ -13215,7 +13215,7 @@ function Vp() {
|
|
|
13215
13215
|
return l;
|
|
13216
13216
|
}
|
|
13217
13217
|
function me(l) {
|
|
13218
|
-
const h =
|
|
13218
|
+
const h = Y(), g = [l];
|
|
13219
13219
|
for (h[l].distance = 0; g.length > 0; ) {
|
|
13220
13220
|
const v = g.pop(), y = Object.keys(E[v]);
|
|
13221
13221
|
for (let { length: x } = y, S = 0; S < x; S++) {
|
|
@@ -13245,7 +13245,7 @@ function Vp() {
|
|
|
13245
13245
|
}
|
|
13246
13246
|
return g;
|
|
13247
13247
|
}
|
|
13248
|
-
var T = _,
|
|
13248
|
+
var T = _, te = {}, ve = Object.keys(E);
|
|
13249
13249
|
function Pe(l) {
|
|
13250
13250
|
const h = function(...g) {
|
|
13251
13251
|
const v = g[0];
|
|
@@ -13268,14 +13268,14 @@ function Vp() {
|
|
|
13268
13268
|
return "conversion" in l && (h.conversion = l.conversion), h;
|
|
13269
13269
|
}
|
|
13270
13270
|
for (const l of ve) {
|
|
13271
|
-
|
|
13271
|
+
te[l] = {}, Object.defineProperty(te[l], "channels", { value: E[l].channels }), Object.defineProperty(te[l], "labels", { value: E[l].labels });
|
|
13272
13272
|
const h = T(l), g = Object.keys(h);
|
|
13273
13273
|
for (const v of g) {
|
|
13274
13274
|
const y = h[v];
|
|
13275
|
-
|
|
13275
|
+
te[l][v] = O(y), te[l][v].raw = Pe(y);
|
|
13276
13276
|
}
|
|
13277
13277
|
}
|
|
13278
|
-
var U =
|
|
13278
|
+
var U = te, F = [
|
|
13279
13279
|
// To be honest, I don't really feel like keyword belongs in color convert, but eh.
|
|
13280
13280
|
"keyword",
|
|
13281
13281
|
// Gray conflicts with some method names, and has its own method defined.
|
|
@@ -13496,7 +13496,7 @@ function Vp() {
|
|
|
13496
13496
|
continue;
|
|
13497
13497
|
const { channels: h } = U[l];
|
|
13498
13498
|
A.prototype[l] = function(...g) {
|
|
13499
|
-
return this.model === l ? new A(this) : g.length > 0 ? new A(g, l) : new A([...
|
|
13499
|
+
return this.model === l ? new A(this) : g.length > 0 ? new A(g, l) : new A([...G(U[this.model][l].raw(this.color)), this.valpha], l);
|
|
13500
13500
|
}, A[l] = function(...g) {
|
|
13501
13501
|
let v = g[0];
|
|
13502
13502
|
return typeof v == "number" && (v = Q(g, h)), new A(v, l);
|
|
@@ -13524,7 +13524,7 @@ function Vp() {
|
|
|
13524
13524
|
return Math.max(0, Math.min(l, h));
|
|
13525
13525
|
};
|
|
13526
13526
|
}
|
|
13527
|
-
function
|
|
13527
|
+
function G(l) {
|
|
13528
13528
|
return Array.isArray(l) ? l : [l];
|
|
13529
13529
|
}
|
|
13530
13530
|
function Q(l, h) {
|
|
@@ -13710,11 +13710,11 @@ function Yp() {
|
|
|
13710
13710
|
if (r.object(s))
|
|
13711
13711
|
for (const [R, w] of Object.entries(s))
|
|
13712
13712
|
if (r.object(w))
|
|
13713
|
-
for (const [D,
|
|
13714
|
-
if (r.string(
|
|
13715
|
-
this.options.withExif[`exif-${R.toLowerCase()}-${D}`] =
|
|
13713
|
+
for (const [D, G] of Object.entries(w))
|
|
13714
|
+
if (r.string(G))
|
|
13715
|
+
this.options.withExif[`exif-${R.toLowerCase()}-${D}`] = G;
|
|
13716
13716
|
else
|
|
13717
|
-
throw r.invalidParameterError(`${R}.${D}`, "string",
|
|
13717
|
+
throw r.invalidParameterError(`${R}.${D}`, "string", G);
|
|
13718
13718
|
else
|
|
13719
13719
|
throw r.invalidParameterError(R, "object", w);
|
|
13720
13720
|
else
|
|
@@ -13768,13 +13768,13 @@ function Yp() {
|
|
|
13768
13768
|
}
|
|
13769
13769
|
return this;
|
|
13770
13770
|
}
|
|
13771
|
-
function
|
|
13771
|
+
function ee(s, R) {
|
|
13772
13772
|
const w = o.get((r.object(s) && r.string(s.id) ? s.id : s).toLowerCase());
|
|
13773
13773
|
if (!w)
|
|
13774
13774
|
throw r.invalidParameterError("format", `one of: ${[...o.keys()].join(", ")}`, s);
|
|
13775
13775
|
return this[w](R);
|
|
13776
13776
|
}
|
|
13777
|
-
function
|
|
13777
|
+
function J(s) {
|
|
13778
13778
|
if (r.object(s)) {
|
|
13779
13779
|
if (r.defined(s.quality))
|
|
13780
13780
|
if (r.integer(s.quality) && r.inRange(s.quality, 1, 100))
|
|
@@ -13796,16 +13796,16 @@ function Yp() {
|
|
|
13796
13796
|
r.defined(w) && this._setBooleanOption("jpegTrellisQuantisation", w), r.defined(s.overshootDeringing) && this._setBooleanOption("jpegOvershootDeringing", s.overshootDeringing);
|
|
13797
13797
|
const D = r.bool(s.optimizeScans) ? s.optimizeScans : s.optimiseScans;
|
|
13798
13798
|
r.defined(D) && (this._setBooleanOption("jpegOptimiseScans", D), D && (this.options.jpegProgressive = !0));
|
|
13799
|
-
const
|
|
13800
|
-
if (r.defined(
|
|
13801
|
-
if (r.integer(
|
|
13802
|
-
this.options.jpegQuantisationTable =
|
|
13799
|
+
const G = r.number(s.quantizationTable) ? s.quantizationTable : s.quantisationTable;
|
|
13800
|
+
if (r.defined(G))
|
|
13801
|
+
if (r.integer(G) && r.inRange(G, 0, 8))
|
|
13802
|
+
this.options.jpegQuantisationTable = G;
|
|
13803
13803
|
else
|
|
13804
|
-
throw r.invalidParameterError("quantisationTable", "integer between 0 and 8",
|
|
13804
|
+
throw r.invalidParameterError("quantisationTable", "integer between 0 and 8", G);
|
|
13805
13805
|
}
|
|
13806
13806
|
return this._updateFormatOut("jpeg", s);
|
|
13807
13807
|
}
|
|
13808
|
-
function
|
|
13808
|
+
function H(s) {
|
|
13809
13809
|
if (r.object(s)) {
|
|
13810
13810
|
if (r.defined(s.progressive) && this._setBooleanOption("pngProgressive", s.progressive), r.defined(s.compressionLevel))
|
|
13811
13811
|
if (r.integer(s.compressionLevel) && r.inRange(s.compressionLevel, 0, 9))
|
|
@@ -13839,7 +13839,7 @@ function Yp() {
|
|
|
13839
13839
|
}
|
|
13840
13840
|
return this._updateFormatOut("png", s);
|
|
13841
13841
|
}
|
|
13842
|
-
function
|
|
13842
|
+
function Y(s) {
|
|
13843
13843
|
if (r.object(s)) {
|
|
13844
13844
|
if (r.defined(s.quality))
|
|
13845
13845
|
if (r.integer(s.quality) && r.inRange(s.quality, 1, 100))
|
|
@@ -14001,7 +14001,7 @@ function Yp() {
|
|
|
14001
14001
|
function T(s) {
|
|
14002
14002
|
return this.heif({ ...s, compression: "av1" });
|
|
14003
14003
|
}
|
|
14004
|
-
function
|
|
14004
|
+
function te(s) {
|
|
14005
14005
|
if (r.object(s)) {
|
|
14006
14006
|
if (r.string(s.compression) && r.inArray(s.compression, ["av1", "hevc"]))
|
|
14007
14007
|
this.options.heifCompression = s.compression;
|
|
@@ -14164,26 +14164,26 @@ function Yp() {
|
|
|
14164
14164
|
}
|
|
14165
14165
|
function A(s, R) {
|
|
14166
14166
|
return typeof s == "function" ? (this._isStreamInput() ? this.on("finish", () => {
|
|
14167
|
-
this._flattenBufferIn(), i.pipeline(this.options, (w, D,
|
|
14168
|
-
w ? s(r.nativeError(w, R)) : s(null, D,
|
|
14167
|
+
this._flattenBufferIn(), i.pipeline(this.options, (w, D, G) => {
|
|
14168
|
+
w ? s(r.nativeError(w, R)) : s(null, D, G);
|
|
14169
14169
|
});
|
|
14170
|
-
}) : i.pipeline(this.options, (w, D,
|
|
14171
|
-
w ? s(r.nativeError(w, R)) : s(null, D,
|
|
14170
|
+
}) : i.pipeline(this.options, (w, D, G) => {
|
|
14171
|
+
w ? s(r.nativeError(w, R)) : s(null, D, G);
|
|
14172
14172
|
}), this) : this.options.streamOut ? (this._isStreamInput() ? (this.once("finish", () => {
|
|
14173
|
-
this._flattenBufferIn(), i.pipeline(this.options, (w, D,
|
|
14174
|
-
w ? this.emit("error", r.nativeError(w, R)) : (this.emit("info",
|
|
14173
|
+
this._flattenBufferIn(), i.pipeline(this.options, (w, D, G) => {
|
|
14174
|
+
w ? this.emit("error", r.nativeError(w, R)) : (this.emit("info", G), this.push(D)), this.push(null), this.on("end", () => this.emit("close"));
|
|
14175
14175
|
});
|
|
14176
|
-
}), this.streamInFinished && this.emit("finish")) : i.pipeline(this.options, (w, D,
|
|
14177
|
-
w ? this.emit("error", r.nativeError(w, R)) : (this.emit("info",
|
|
14176
|
+
}), this.streamInFinished && this.emit("finish")) : i.pipeline(this.options, (w, D, G) => {
|
|
14177
|
+
w ? this.emit("error", r.nativeError(w, R)) : (this.emit("info", G), this.push(D)), this.push(null), this.on("end", () => this.emit("close"));
|
|
14178
14178
|
}), this) : this._isStreamInput() ? new Promise((w, D) => {
|
|
14179
14179
|
this.once("finish", () => {
|
|
14180
|
-
this._flattenBufferIn(), i.pipeline(this.options, (
|
|
14181
|
-
|
|
14180
|
+
this._flattenBufferIn(), i.pipeline(this.options, (G, Q, we) => {
|
|
14181
|
+
G ? D(r.nativeError(G, R)) : this.options.resolveWithObject ? w({ data: Q, info: we }) : w(Q);
|
|
14182
14182
|
});
|
|
14183
14183
|
});
|
|
14184
14184
|
}) : new Promise((w, D) => {
|
|
14185
|
-
i.pipeline(this.options, (
|
|
14186
|
-
|
|
14185
|
+
i.pipeline(this.options, (G, Q, we) => {
|
|
14186
|
+
G ? D(r.nativeError(G, R)) : this.options.resolveWithObject ? w({ data: Q, info: we }) : w(Q);
|
|
14187
14187
|
});
|
|
14188
14188
|
});
|
|
14189
14189
|
}
|
|
@@ -14201,14 +14201,14 @@ function Yp() {
|
|
|
14201
14201
|
withXmp: $,
|
|
14202
14202
|
keepMetadata: E,
|
|
14203
14203
|
withMetadata: P,
|
|
14204
|
-
toFormat:
|
|
14205
|
-
jpeg:
|
|
14204
|
+
toFormat: ee,
|
|
14205
|
+
jpeg: J,
|
|
14206
14206
|
jp2: ue,
|
|
14207
|
-
png:
|
|
14208
|
-
webp:
|
|
14207
|
+
png: H,
|
|
14208
|
+
webp: Y,
|
|
14209
14209
|
tiff: _,
|
|
14210
14210
|
avif: T,
|
|
14211
|
-
heif:
|
|
14211
|
+
heif: te,
|
|
14212
14212
|
jxl: ve,
|
|
14213
14213
|
gif: me,
|
|
14214
14214
|
raw: Pe,
|
|
@@ -14357,63 +14357,85 @@ async function iv({
|
|
|
14357
14357
|
const gv = ({
|
|
14358
14358
|
apiRouteUrl: e,
|
|
14359
14359
|
cacheDir: r = ot.join(process.cwd(), ".transform-cache"),
|
|
14360
|
-
cacheControl: i = "public, max-age=31536000, immutable"
|
|
14360
|
+
cacheControl: i = "public, max-age=31536000, immutable",
|
|
14361
|
+
allowedHosts: o
|
|
14361
14362
|
}) => {
|
|
14362
|
-
const
|
|
14363
|
-
|
|
14364
|
-
const
|
|
14365
|
-
|
|
14363
|
+
const t = yp({ apiRouteUrl: e }), n = (a) => {
|
|
14364
|
+
if (!o) return !0;
|
|
14365
|
+
const c = a.hostname.toLowerCase(), d = a.host.toLowerCase();
|
|
14366
|
+
return o.some((f) => {
|
|
14367
|
+
if (f instanceof RegExp)
|
|
14368
|
+
return f.test(c) || f.test(d);
|
|
14369
|
+
const m = f.toLowerCase();
|
|
14370
|
+
return m.includes(":") ? d === m : c === m;
|
|
14371
|
+
});
|
|
14372
|
+
};
|
|
14373
|
+
return async function(c) {
|
|
14374
|
+
const { data: d, error: f } = t.safeDecode(c.url);
|
|
14375
|
+
if (f)
|
|
14366
14376
|
return new Response("Bad Request", { status: 400 });
|
|
14367
|
-
const
|
|
14377
|
+
const m = t.encode(
|
|
14368
14378
|
// encode() accepts the decoded transform config shape; we only call this
|
|
14369
14379
|
// after decoding has succeeded.
|
|
14370
|
-
|
|
14371
|
-
),
|
|
14372
|
-
if (
|
|
14373
|
-
return new Response(
|
|
14380
|
+
d
|
|
14381
|
+
), p = d.q ?? 100, u = _p({ canonicalUrl: m }), I = await wp({ cacheKey: u, cacheDir: r });
|
|
14382
|
+
if (I)
|
|
14383
|
+
return new Response(I.body, {
|
|
14374
14384
|
headers: {
|
|
14375
|
-
"Content-Type":
|
|
14385
|
+
"Content-Type": I.contentType,
|
|
14376
14386
|
"Cache-Control": i
|
|
14377
14387
|
}
|
|
14378
14388
|
});
|
|
14379
|
-
|
|
14380
|
-
|
|
14389
|
+
let b;
|
|
14390
|
+
try {
|
|
14391
|
+
b = new URL(d.source);
|
|
14392
|
+
} catch {
|
|
14393
|
+
return new Response("Bad Request", { status: 400 });
|
|
14394
|
+
}
|
|
14395
|
+
if (b.protocol !== "http:" && b.protocol !== "https:")
|
|
14396
|
+
return new Response("Bad Request", { status: 400 });
|
|
14397
|
+
if (b.username || b.password)
|
|
14398
|
+
return new Response("Bad Request", { status: 400 });
|
|
14399
|
+
if (!n(b))
|
|
14400
|
+
return new Response("Forbidden", { status: 403 });
|
|
14401
|
+
const $ = await fetch(b);
|
|
14402
|
+
if (!$.ok)
|
|
14381
14403
|
return new Response("Upstream fetch failed", { status: 502 });
|
|
14382
|
-
const
|
|
14383
|
-
|
|
14404
|
+
const E = rv(Buffer.from(await $.arrayBuffer())), ee = await nv(
|
|
14405
|
+
E,
|
|
14384
14406
|
/**
|
|
14385
14407
|
* auto-orient: read's the image's EXIF data and rotates it to the correct
|
|
14386
14408
|
* orientation.
|
|
14387
14409
|
*/
|
|
14388
|
-
(
|
|
14410
|
+
(Y) => Y.rotate(),
|
|
14389
14411
|
/**
|
|
14390
14412
|
* Resize
|
|
14391
14413
|
*/
|
|
14392
|
-
(
|
|
14393
|
-
width:
|
|
14394
|
-
height:
|
|
14414
|
+
(Y) => d.w || d.h ? Y.resize({
|
|
14415
|
+
width: d.w,
|
|
14416
|
+
height: d.h,
|
|
14395
14417
|
fit: "inside",
|
|
14396
14418
|
withoutEnlargement: !0
|
|
14397
|
-
}) :
|
|
14419
|
+
}) : Y,
|
|
14398
14420
|
/**
|
|
14399
14421
|
* Change format
|
|
14400
14422
|
*/
|
|
14401
|
-
(
|
|
14402
|
-
switch (
|
|
14423
|
+
(Y) => {
|
|
14424
|
+
switch (d.fmt) {
|
|
14403
14425
|
case "preserve":
|
|
14404
|
-
return
|
|
14426
|
+
return Y;
|
|
14405
14427
|
case "avif":
|
|
14406
|
-
return
|
|
14428
|
+
return Y.avif({ quality: p });
|
|
14407
14429
|
case "webp":
|
|
14408
|
-
return
|
|
14430
|
+
return Y.webp({ quality: p });
|
|
14409
14431
|
default:
|
|
14410
|
-
throw new Error(`Unreachable case: ${
|
|
14432
|
+
throw new Error(`Unreachable case: ${d.fmt}`);
|
|
14411
14433
|
}
|
|
14412
14434
|
}
|
|
14413
|
-
).toBuffer(),
|
|
14414
|
-
switch (
|
|
14435
|
+
).toBuffer(), J = new Uint8Array(ee), H = (() => {
|
|
14436
|
+
switch (d.fmt) {
|
|
14415
14437
|
case "preserve":
|
|
14416
|
-
return
|
|
14438
|
+
return $.headers.get("content-type") ?? "application/octet-stream";
|
|
14417
14439
|
case "avif":
|
|
14418
14440
|
return "image/avif";
|
|
14419
14441
|
case "webp":
|
|
@@ -14421,13 +14443,13 @@ const gv = ({
|
|
|
14421
14443
|
}
|
|
14422
14444
|
})();
|
|
14423
14445
|
return await iv({
|
|
14424
|
-
cacheKey:
|
|
14425
|
-
body:
|
|
14426
|
-
meta: { contentType:
|
|
14446
|
+
cacheKey: u,
|
|
14447
|
+
body: ee,
|
|
14448
|
+
meta: { contentType: H },
|
|
14427
14449
|
cacheDir: r
|
|
14428
|
-
}), new Response(
|
|
14450
|
+
}), new Response(J, {
|
|
14429
14451
|
headers: {
|
|
14430
|
-
"Content-Type":
|
|
14452
|
+
"Content-Type": H,
|
|
14431
14453
|
"Cache-Control": i
|
|
14432
14454
|
}
|
|
14433
14455
|
});
|