@seedprotocol/arweave 0.7.11 → 0.7.12-next.1426.g717a66b
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/README.md +1 -1
- package/dist/{ArweaveClient-k0MOFK7O.js → ArweaveClient-CToEhk_B.js} +562 -556
- package/dist/ArweaveClient-CToEhk_B.js.map +1 -0
- package/dist/constants.d.ts +8 -9
- package/dist/constants.d.ts.map +1 -1
- package/dist/gateway/publicUrl.d.ts +5 -3
- package/dist/gateway/publicUrl.d.ts.map +1 -1
- package/dist/gateway/resolveSeedGatewayEndpoints.d.ts +6 -1
- package/dist/gateway/resolveSeedGatewayEndpoints.d.ts.map +1 -1
- package/dist/gateway/transactionStatus.d.ts +1 -11
- package/dist/gateway/transactionStatus.d.ts.map +1 -1
- package/dist/htmlLinks.d.ts +61 -0
- package/dist/htmlLinks.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +230 -92
- package/dist/index.js.map +1 -1
- package/dist/mediaRef.d.ts +5 -0
- package/dist/mediaRef.d.ts.map +1 -1
- package/dist/node.js +2 -2
- package/dist/node.js.map +1 -1
- package/dist/resolveSeedRssImageRelationRef.d.ts.map +1 -1
- package/dist/types/gateway.d.ts +1 -1
- package/package.json +3 -2
- package/dist/ArweaveClient-k0MOFK7O.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, G as s, H as c, I as l, J as
|
|
1
|
+
import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, G as s, H as c, I as l, J as u, K as ee, L as te, M as ne, N as re, O as ie, P as d, Q as f, R as p, S as ae, T as oe, U as se, V as ce, W as le, X as ue, Y as de, Z as fe, _ as pe, a as me, at as m, b as he, c as ge, d as _e, et as ve, f as h, g as ye, h as g, i as be, it as xe, j as Se, k as Ce, l as we, m as Te, n as Ee, nt as _, o as v, p as y, q as b, r as x, rt as S, s as C, t as w, tt as T, u as E, v as D, w as De, x as Oe, y as ke, z as Ae } from "./ArweaveClient-CToEhk_B.js";
|
|
2
|
+
import { parseFragment as je } from "parse5";
|
|
2
3
|
//#region src/easAttestationUrl.ts
|
|
3
|
-
var
|
|
4
|
-
function
|
|
4
|
+
var Me = /(^|\.)easscan\.(org|xyz)$/i;
|
|
5
|
+
function O(e) {
|
|
5
6
|
let t = e.trim();
|
|
6
7
|
if (!t) return !1;
|
|
7
8
|
try {
|
|
8
9
|
let e = new URL(t);
|
|
9
|
-
return
|
|
10
|
+
return Me.test(e.hostname) ? /\/attestation\/view\//i.test(e.pathname) : !1;
|
|
10
11
|
} catch {
|
|
11
12
|
return !1;
|
|
12
13
|
}
|
|
13
14
|
}
|
|
14
15
|
//#endregion
|
|
15
16
|
//#region src/relationSeedRef.ts
|
|
16
|
-
function
|
|
17
|
+
function Ne(e) {
|
|
17
18
|
let t = {
|
|
18
19
|
localId: void 0,
|
|
19
20
|
uid: void 0
|
|
20
21
|
};
|
|
21
22
|
return e && (e.length === 10 && (t.localId = e), e.startsWith("0x") && e.length === 66 && (t.uid = e)), t;
|
|
22
23
|
}
|
|
23
|
-
function
|
|
24
|
+
function k(e) {
|
|
24
25
|
if (e != null) {
|
|
25
26
|
if (typeof e == "string") {
|
|
26
27
|
let t = e.trim();
|
|
@@ -33,35 +34,35 @@ function R(e) {
|
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
|
-
var
|
|
37
|
-
function
|
|
38
|
-
let t =
|
|
37
|
+
var Pe = /^[a-zA-Z0-9_-]{10,21}$/;
|
|
38
|
+
function A(e) {
|
|
39
|
+
let t = Ne(e);
|
|
39
40
|
return t.localId || t.uid ? {
|
|
40
41
|
seedLocalId: t.localId,
|
|
41
42
|
seedUid: t.uid
|
|
42
|
-
} :
|
|
43
|
+
} : Pe.test(e) && !e.startsWith("0x") ? { seedLocalId: e } : {};
|
|
43
44
|
}
|
|
44
45
|
//#endregion
|
|
45
46
|
//#region src/mediaRef.ts
|
|
46
|
-
var
|
|
47
|
-
function
|
|
47
|
+
var Fe = /^[a-zA-Z0-9_-]{43}$/;
|
|
48
|
+
function Ie(e) {
|
|
48
49
|
return e == null ? "" : typeof e == "string" ? e.trim() : String(e).trim();
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
+
function j(e, t) {
|
|
51
52
|
let n = e[t];
|
|
52
53
|
return n == null ? "" : typeof n == "string" ? n.trim() : typeof n == "number" || typeof n == "boolean" ? String(n) : "";
|
|
53
54
|
}
|
|
54
|
-
function
|
|
55
|
+
function Le(e) {
|
|
55
56
|
let t = e.trim();
|
|
56
57
|
if (!t) return t;
|
|
57
58
|
try {
|
|
58
|
-
let e =
|
|
59
|
+
let e = k(JSON.parse(t));
|
|
59
60
|
if (e) return e;
|
|
60
61
|
} catch {}
|
|
61
62
|
return t;
|
|
62
63
|
}
|
|
63
|
-
function
|
|
64
|
-
let n =
|
|
64
|
+
function M(e, t) {
|
|
65
|
+
let n = Ie(e);
|
|
65
66
|
if (!n) return { kind: "empty" };
|
|
66
67
|
let r = t?.treatAs;
|
|
67
68
|
if (r === "url") return {
|
|
@@ -79,14 +80,14 @@ function V(e, t) {
|
|
|
79
80
|
kind: "unknown",
|
|
80
81
|
raw: n
|
|
81
82
|
};
|
|
82
|
-
if (n.startsWith("http://") || n.startsWith("https://") || n.startsWith("blob:") || n.startsWith("data:")) return
|
|
83
|
+
if (n.startsWith("http://") || n.startsWith("https://") || n.startsWith("blob:") || n.startsWith("data:")) return O(n) ? {
|
|
83
84
|
kind: "nonMediaUrl",
|
|
84
85
|
href: n
|
|
85
86
|
} : {
|
|
86
87
|
kind: "url",
|
|
87
88
|
href: n
|
|
88
89
|
};
|
|
89
|
-
let i =
|
|
90
|
+
let i = Le(n), a = A(i);
|
|
90
91
|
return a.seedUid ? {
|
|
91
92
|
kind: "seedUid",
|
|
92
93
|
uid: a.seedUid
|
|
@@ -96,7 +97,7 @@ function V(e, t) {
|
|
|
96
97
|
} : i.startsWith("0x") && i.length === 66 ? {
|
|
97
98
|
kind: "seedUid",
|
|
98
99
|
uid: i
|
|
99
|
-
} :
|
|
100
|
+
} : Fe.test(i) && !i.startsWith("0x") ? {
|
|
100
101
|
kind: "arweaveTxId",
|
|
101
102
|
txId: i
|
|
102
103
|
} : {
|
|
@@ -104,25 +105,25 @@ function V(e, t) {
|
|
|
104
105
|
raw: n
|
|
105
106
|
};
|
|
106
107
|
}
|
|
107
|
-
function
|
|
108
|
-
let n =
|
|
108
|
+
function N(e, t) {
|
|
109
|
+
let n = j(e, t);
|
|
109
110
|
if (n) return n;
|
|
110
111
|
let r = t.replace(/[A-Z]/g, (e) => `_${e.toLowerCase()}`);
|
|
111
112
|
if (r !== t) {
|
|
112
|
-
let t =
|
|
113
|
+
let t = j(e, r);
|
|
113
114
|
if (t) return t;
|
|
114
115
|
}
|
|
115
116
|
let i = t.split("_");
|
|
116
117
|
if (i.length > 1) {
|
|
117
|
-
let t =
|
|
118
|
+
let t = j(e, i[0] + i.slice(1).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(""));
|
|
118
119
|
if (t) return t;
|
|
119
120
|
}
|
|
120
121
|
return "";
|
|
121
122
|
}
|
|
122
|
-
function
|
|
123
|
+
function Re(e, t) {
|
|
123
124
|
let n = {};
|
|
124
125
|
for (let [r, i] of Object.entries(t)) {
|
|
125
|
-
let t =
|
|
126
|
+
let t = N(e, r);
|
|
126
127
|
if (!t) {
|
|
127
128
|
n[r] = void 0;
|
|
128
129
|
continue;
|
|
@@ -141,7 +142,7 @@ function Oe(e, t) {
|
|
|
141
142
|
};
|
|
142
143
|
continue;
|
|
143
144
|
}
|
|
144
|
-
let a =
|
|
145
|
+
let a = M(t, { treatAs: i.treatAs });
|
|
145
146
|
n[r] = {
|
|
146
147
|
role: i.role,
|
|
147
148
|
raw: t,
|
|
@@ -150,12 +151,31 @@ function Oe(e, t) {
|
|
|
150
151
|
}
|
|
151
152
|
return n;
|
|
152
153
|
}
|
|
153
|
-
function
|
|
154
|
-
return `${
|
|
154
|
+
function ze(e) {
|
|
155
|
+
return `${(h()[0] ?? p.getBaseUrl()).replace(/\/+$/, "")}/raw/${e}`;
|
|
156
|
+
}
|
|
157
|
+
//#endregion
|
|
158
|
+
//#region src/gateway/publicUrl.ts
|
|
159
|
+
function Be(e) {
|
|
160
|
+
try {
|
|
161
|
+
let t = new URL(e).hostname.toLowerCase();
|
|
162
|
+
return t === "localhost" || t.endsWith(".localhost") || t === "[::1]" || /^127\./.test(t);
|
|
163
|
+
} catch {
|
|
164
|
+
return !0;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
function P() {
|
|
168
|
+
let e = g()?.publicArweaveBaseUrl;
|
|
169
|
+
if (e) return e;
|
|
170
|
+
let t = p.getBaseUrl();
|
|
171
|
+
return Be(t) ? `https://${m() || "arweave.net"}` : t;
|
|
172
|
+
}
|
|
173
|
+
function F(e) {
|
|
174
|
+
return `${P()}/raw/${e}`;
|
|
155
175
|
}
|
|
156
176
|
//#endregion
|
|
157
177
|
//#region src/resolveSeedRssImageRelationRef.ts
|
|
158
|
-
var
|
|
178
|
+
var I = [
|
|
159
179
|
"featureImage",
|
|
160
180
|
"feature_image",
|
|
161
181
|
"image",
|
|
@@ -166,49 +186,49 @@ var U = [
|
|
|
166
186
|
"thumbnail_image",
|
|
167
187
|
"thumbnailImage"
|
|
168
188
|
];
|
|
169
|
-
function
|
|
189
|
+
function L(e) {
|
|
170
190
|
return e == null ? "" : typeof e == "string" ? e.trim() : typeof e == "number" || typeof e == "boolean" ? String(e) : "";
|
|
171
191
|
}
|
|
172
|
-
function
|
|
192
|
+
function R(e, ...t) {
|
|
173
193
|
for (let n of t) {
|
|
174
|
-
let t =
|
|
194
|
+
let t = L(e[n]);
|
|
175
195
|
if (t) return t;
|
|
176
196
|
}
|
|
177
197
|
let n = t.map((e) => e.split(":").pop().toLowerCase());
|
|
178
198
|
for (let [t, r] of Object.entries(e)) {
|
|
179
199
|
let e = (t.includes(":") ? t.split(":").pop() : t).toLowerCase();
|
|
180
200
|
if (n.some((t) => e === t.toLowerCase())) {
|
|
181
|
-
let e =
|
|
201
|
+
let e = L(r);
|
|
182
202
|
if (e) return e;
|
|
183
203
|
}
|
|
184
204
|
}
|
|
185
205
|
return "";
|
|
186
206
|
}
|
|
187
|
-
function
|
|
207
|
+
function z(e) {
|
|
188
208
|
let t = e.trim();
|
|
189
209
|
if (t && !t.startsWith("0x")) try {
|
|
190
|
-
return
|
|
210
|
+
return F(t);
|
|
191
211
|
} catch {
|
|
192
212
|
return;
|
|
193
213
|
}
|
|
194
214
|
}
|
|
195
|
-
function
|
|
215
|
+
function Ve(e) {
|
|
196
216
|
let t = e.storageTransactionId?.trim();
|
|
197
217
|
if (t) {
|
|
198
|
-
let e =
|
|
218
|
+
let e = z(t);
|
|
199
219
|
if (e) return e;
|
|
200
220
|
}
|
|
201
221
|
let n = e.arweaveUrl?.trim();
|
|
202
|
-
if (n && !
|
|
222
|
+
if (n && !O(n)) return n;
|
|
203
223
|
}
|
|
204
|
-
function
|
|
224
|
+
function He(e) {
|
|
205
225
|
let t = e.trim();
|
|
206
|
-
if (!t ||
|
|
207
|
-
let n =
|
|
226
|
+
if (!t || O(t)) return;
|
|
227
|
+
let n = M(t);
|
|
208
228
|
switch (n.kind) {
|
|
209
229
|
case "url": return { mediaUrl: n.href };
|
|
210
230
|
case "arweaveTxId": {
|
|
211
|
-
let e =
|
|
231
|
+
let e = z(n.txId);
|
|
212
232
|
return {
|
|
213
233
|
storageTransactionId: n.txId,
|
|
214
234
|
...e ? { mediaUrl: e } : {}
|
|
@@ -216,7 +236,7 @@ function je(e) {
|
|
|
216
236
|
}
|
|
217
237
|
case "seedUid": return { seedUid: n.uid };
|
|
218
238
|
default: {
|
|
219
|
-
let e =
|
|
239
|
+
let e = z(t);
|
|
220
240
|
return e ? {
|
|
221
241
|
storageTransactionId: t,
|
|
222
242
|
mediaUrl: e
|
|
@@ -224,46 +244,46 @@ function je(e) {
|
|
|
224
244
|
}
|
|
225
245
|
}
|
|
226
246
|
}
|
|
227
|
-
function
|
|
228
|
-
let t =
|
|
247
|
+
function Ue(e) {
|
|
248
|
+
let t = R(e, "storageTransactionId", "storage_transaction_id"), n = R(e, "arweaveUrl", "arweave_url"), r = R(e, "seedUid", "SeedUid", "seed_uid"), i = R(e, "link", "Link"), a = Ve({
|
|
229
249
|
storageTransactionId: t,
|
|
230
250
|
arweaveUrl: n
|
|
231
|
-
}) ?? (i && !
|
|
251
|
+
}) ?? (i && !O(i) ? i : void 0);
|
|
232
252
|
if (t || n || r || a) return {
|
|
233
253
|
...t ? { storageTransactionId: t } : {},
|
|
234
|
-
...n && !
|
|
254
|
+
...n && !O(n) ? { arweaveUrl: n } : {},
|
|
235
255
|
...r ? { seedUid: r } : {},
|
|
236
256
|
...a ? { mediaUrl: a } : {}
|
|
237
257
|
};
|
|
238
258
|
}
|
|
239
|
-
function
|
|
259
|
+
function B(e) {
|
|
240
260
|
if (e != null) {
|
|
241
|
-
if (typeof e == "string") return
|
|
261
|
+
if (typeof e == "string") return He(e);
|
|
242
262
|
if (Array.isArray(e)) for (let t of e) {
|
|
243
|
-
let e =
|
|
263
|
+
let e = B(t);
|
|
244
264
|
if (e?.mediaUrl || e?.storageTransactionId || e?.seedUid) return e;
|
|
245
265
|
}
|
|
246
|
-
else if (typeof e == "object") return
|
|
266
|
+
else if (typeof e == "object") return Ue(e);
|
|
247
267
|
}
|
|
248
268
|
}
|
|
249
|
-
function
|
|
269
|
+
function We(e, t = I) {
|
|
250
270
|
for (let n of t) {
|
|
251
271
|
if (!(n in e)) continue;
|
|
252
|
-
let t =
|
|
272
|
+
let t = B(e[n]);
|
|
253
273
|
if (t) return t;
|
|
254
274
|
}
|
|
255
275
|
}
|
|
256
276
|
//#endregion
|
|
257
277
|
//#region src/ArweaveClient/transactionTagsByIds.ts
|
|
258
|
-
var
|
|
259
|
-
async function
|
|
278
|
+
var Ge = 100, V = "\n query GetTransactionsTagsByIds($ids: [ID!], $first: Int) {\n transactions(ids: $ids, first: $first) {\n edges {\n node {\n id\n tags {\n name\n value\n }\n }\n }\n }\n }\n";
|
|
279
|
+
async function Ke(e, t) {
|
|
260
280
|
let n = /* @__PURE__ */ new Map(), r = Array.from(new Set(e.filter((e) => typeof e == "string" && e.trim())));
|
|
261
281
|
if (r.length === 0) return n;
|
|
262
|
-
let i = t?.client ??
|
|
282
|
+
let i = t?.client ?? p.getArweaveClient(), a = Math.max(1, Math.min(t?.batchSize ?? 100, 100));
|
|
263
283
|
for (let e = 0; e < r.length; e += a) {
|
|
264
284
|
let o = r.slice(e, e + a);
|
|
265
285
|
try {
|
|
266
|
-
let e = await i.request(
|
|
286
|
+
let e = await i.request(V, {
|
|
267
287
|
ids: o,
|
|
268
288
|
first: o.length
|
|
269
289
|
});
|
|
@@ -282,15 +302,15 @@ async function Fe(e, t) {
|
|
|
282
302
|
}
|
|
283
303
|
//#endregion
|
|
284
304
|
//#region src/ArweaveClient/uploadApiVerification.ts
|
|
285
|
-
function
|
|
305
|
+
function H(e) {
|
|
286
306
|
return e.trim().replace(/\/+$/, "");
|
|
287
307
|
}
|
|
288
|
-
function
|
|
289
|
-
return `${
|
|
308
|
+
function U(e, t) {
|
|
309
|
+
return `${H(e)}/api/upload/arweave/data/${encodeURIComponent(t)}`;
|
|
290
310
|
}
|
|
291
|
-
var
|
|
292
|
-
async function
|
|
293
|
-
let r =
|
|
311
|
+
var qe = 45e3;
|
|
312
|
+
async function Je(e, t, n) {
|
|
313
|
+
let r = U(e, t), i = n?.timeoutMs ?? qe, a = new AbortController(), o = setTimeout(() => a.abort(), i);
|
|
294
314
|
try {
|
|
295
315
|
let e = await fetch(r, { signal: a.signal });
|
|
296
316
|
return clearTimeout(o), e.status === 404 ? {
|
|
@@ -315,16 +335,16 @@ async function Le(e, t, n) {
|
|
|
315
335
|
}
|
|
316
336
|
//#endregion
|
|
317
337
|
//#region src/ArweaveClient/arweaveL1UploadApi.ts
|
|
318
|
-
var
|
|
319
|
-
function
|
|
320
|
-
return `${
|
|
338
|
+
var Ye = "\n query ArweaveGatewayTransaction($id: String!) {\n transaction(id: $id) {\n id\n bundledIn {\n id\n }\n block {\n height\n timestamp\n }\n }\n }\n";
|
|
339
|
+
function W(e, t) {
|
|
340
|
+
return `${H(e)}/api/upload/arweave/status/${encodeURIComponent(t)}`;
|
|
321
341
|
}
|
|
322
|
-
function
|
|
342
|
+
function Xe(e) {
|
|
323
343
|
let t = e.l1;
|
|
324
344
|
return t ? t.meetsMinConfirmations === !0 || t.confirmed === !0 : !1;
|
|
325
345
|
}
|
|
326
|
-
async function
|
|
327
|
-
let n =
|
|
346
|
+
async function Ze(e, t) {
|
|
347
|
+
let n = W(e, t);
|
|
328
348
|
try {
|
|
329
349
|
let e = await fetch(n);
|
|
330
350
|
if (!e.ok) return null;
|
|
@@ -334,7 +354,7 @@ async function Be(e, t) {
|
|
|
334
354
|
return null;
|
|
335
355
|
}
|
|
336
356
|
}
|
|
337
|
-
async function
|
|
357
|
+
async function G(e, t, n) {
|
|
338
358
|
let r = e.trim();
|
|
339
359
|
if (!r) return null;
|
|
340
360
|
try {
|
|
@@ -342,7 +362,7 @@ async function Q(e, t, n) {
|
|
|
342
362
|
method: "POST",
|
|
343
363
|
headers: { "Content-Type": "application/json" },
|
|
344
364
|
body: JSON.stringify({
|
|
345
|
-
query:
|
|
365
|
+
query: Ye,
|
|
346
366
|
variables: { id: t }
|
|
347
367
|
}),
|
|
348
368
|
signal: n?.signal
|
|
@@ -366,34 +386,26 @@ async function Q(e, t, n) {
|
|
|
366
386
|
return null;
|
|
367
387
|
}
|
|
368
388
|
}
|
|
369
|
-
async function
|
|
370
|
-
let r =
|
|
389
|
+
async function Qe(e, t, n) {
|
|
390
|
+
let r = _(), i = e?.trim(), o = "https", s = null;
|
|
371
391
|
if (i) try {
|
|
372
392
|
let e = new URL(i);
|
|
373
|
-
|
|
393
|
+
o = e.protocol === "http:" ? "http" : "https", s = e.hostname || null;
|
|
374
394
|
} catch {
|
|
375
|
-
|
|
395
|
+
s = null;
|
|
376
396
|
}
|
|
377
|
-
let
|
|
378
|
-
for (let e of
|
|
379
|
-
let r = `${
|
|
380
|
-
if (!await
|
|
381
|
-
let i = await
|
|
397
|
+
let c = s && s.length > 0 ? T(s) : [...r], l = n?.signal;
|
|
398
|
+
for (let e of c) {
|
|
399
|
+
let r = `${o}://${e}`;
|
|
400
|
+
if (!await a(r, l ?? void 0)) continue;
|
|
401
|
+
let i = await G(`${o}://${e}/graphql`, t, n);
|
|
382
402
|
if (i !== null) return i;
|
|
383
403
|
}
|
|
384
404
|
return null;
|
|
385
405
|
}
|
|
386
406
|
//#endregion
|
|
387
|
-
//#region src/gateway/publicUrl.ts
|
|
388
|
-
function $() {
|
|
389
|
-
return D()?.publicArweaveBaseUrl ?? u.getBaseUrl();
|
|
390
|
-
}
|
|
391
|
-
function He(e) {
|
|
392
|
-
return `${$()}/raw/${e}`;
|
|
393
|
-
}
|
|
394
|
-
//#endregion
|
|
395
407
|
//#region src/gateway/seedGatewayConfig.ts
|
|
396
|
-
function
|
|
408
|
+
function $e(e) {
|
|
397
409
|
let t = e.gateway ?? {};
|
|
398
410
|
return {
|
|
399
411
|
transport: t.transport,
|
|
@@ -409,7 +421,7 @@ function Ue(e) {
|
|
|
409
421
|
}
|
|
410
422
|
};
|
|
411
423
|
}
|
|
412
|
-
function
|
|
424
|
+
function et(e) {
|
|
413
425
|
return {
|
|
414
426
|
transport: e.gatewayTransport,
|
|
415
427
|
arweaveDomain: e.arweaveDomain,
|
|
@@ -423,6 +435,132 @@ function We(e) {
|
|
|
423
435
|
};
|
|
424
436
|
}
|
|
425
437
|
//#endregion
|
|
426
|
-
|
|
438
|
+
//#region src/htmlLinks.ts
|
|
439
|
+
var K = "[A-Za-z0-9_-]{43}", q = RegExp(`^ar://(${K})([/?#].*)?$`), tt = RegExp(`/raw/(${K})(/.*)?$`), nt = RegExp(`^/(${K})(/.*)?$`), J = (e) => {
|
|
440
|
+
try {
|
|
441
|
+
return new URL(e).host.toLowerCase();
|
|
442
|
+
} catch {
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
function rt(e, t) {
|
|
447
|
+
let n = e.toLowerCase();
|
|
448
|
+
if (S(n.replace(/:\d+$/, ""))) return !0;
|
|
449
|
+
for (let e of [...t.map(J), ...u]) if (e && (n === e || n.endsWith(`.${e}`))) return !0;
|
|
450
|
+
return !1;
|
|
451
|
+
}
|
|
452
|
+
function Y(e, t) {
|
|
453
|
+
let n = e.trim(), r = q.exec(n);
|
|
454
|
+
if (r) return {
|
|
455
|
+
transactionId: r[1],
|
|
456
|
+
form: "raw",
|
|
457
|
+
rest: r[2] ?? ""
|
|
458
|
+
};
|
|
459
|
+
if (!/^https?:\/\//i.test(n)) return;
|
|
460
|
+
let i;
|
|
461
|
+
try {
|
|
462
|
+
i = new URL(n);
|
|
463
|
+
} catch {
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
466
|
+
let a = i.search + i.hash, o = tt.exec(i.pathname);
|
|
467
|
+
if (o) return {
|
|
468
|
+
transactionId: o[1],
|
|
469
|
+
form: "raw",
|
|
470
|
+
rest: (o[2] ?? "") + a
|
|
471
|
+
};
|
|
472
|
+
let s = nt.exec(i.pathname);
|
|
473
|
+
if (s && rt(i.host, t?.baseUrls ?? h())) return {
|
|
474
|
+
transactionId: s[1],
|
|
475
|
+
form: "bare",
|
|
476
|
+
rest: (s[2] ?? "") + a
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
function X(e, t) {
|
|
480
|
+
return `${t.replace(/\/+$/, "")}${e.form === "raw" ? "/raw/" : "/"}${e.transactionId}${e.rest}`;
|
|
481
|
+
}
|
|
482
|
+
function it(e, t) {
|
|
483
|
+
let n = t?.baseUrls ?? h(), r = Y(e, { baseUrls: n });
|
|
484
|
+
if (!r) return;
|
|
485
|
+
let i = n[n.findIndex((t) => e.startsWith(`${t.replace(/\/+$/, "")}/`)) + 1];
|
|
486
|
+
return i ? X(r, i) : void 0;
|
|
487
|
+
}
|
|
488
|
+
function at(e) {
|
|
489
|
+
return e.replace(/&/g, "&").replace(/"/g, """);
|
|
490
|
+
}
|
|
491
|
+
function Z(e, t) {
|
|
492
|
+
let n = je(e, { sourceCodeLocationInfo: !0 }), r = [], i = (e) => {
|
|
493
|
+
if (e.nodeName === "#text" || e.nodeName === "#comment") return;
|
|
494
|
+
let n = e;
|
|
495
|
+
if (n.attrs?.length) for (let e of n.attrs) {
|
|
496
|
+
if (e.prefix) continue;
|
|
497
|
+
let i = t(n, e.name, e.value), a = n.sourceCodeLocation?.attrs?.[e.name];
|
|
498
|
+
i !== void 0 && a && r.push({
|
|
499
|
+
start: a.startOffset,
|
|
500
|
+
end: a.endOffset,
|
|
501
|
+
text: `${e.name}="${at(i)}"`
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
let a = n;
|
|
505
|
+
if (a.childNodes) for (let e of a.childNodes) i(e);
|
|
506
|
+
let o = n.content;
|
|
507
|
+
if (o?.childNodes) for (let e of o.childNodes) i(e);
|
|
508
|
+
};
|
|
509
|
+
for (let e of n.childNodes) i(e);
|
|
510
|
+
let a = e;
|
|
511
|
+
for (let e of r.sort((e, t) => t.start - e.start)) a = a.slice(0, e.start) + e.text + a.slice(e.end);
|
|
512
|
+
return a;
|
|
513
|
+
}
|
|
514
|
+
var ot = /* @__PURE__ */ new Set([
|
|
515
|
+
"src",
|
|
516
|
+
"href",
|
|
517
|
+
"poster"
|
|
518
|
+
]);
|
|
519
|
+
function st(e, t) {
|
|
520
|
+
let n = !1, r = e.split(",").map((e) => {
|
|
521
|
+
let r = /^(\s*)(\S+)(.*)$/s.exec(e);
|
|
522
|
+
if (!r) return e;
|
|
523
|
+
let i = t(r[2]);
|
|
524
|
+
return i === void 0 ? e : (n = !0, `${r[1]}${i}${r[3]}`);
|
|
525
|
+
});
|
|
526
|
+
return n ? r.join(",") : void 0;
|
|
527
|
+
}
|
|
528
|
+
function Q(e, t, n) {
|
|
529
|
+
if (e === "srcset") return st(t, n);
|
|
530
|
+
if (!ot.has(e)) return;
|
|
531
|
+
let r = n(t.trim());
|
|
532
|
+
return r === void 0 || r === t ? void 0 : r;
|
|
533
|
+
}
|
|
534
|
+
function $(e, t) {
|
|
535
|
+
if (e.includes("ar://") || e.includes("/raw/")) return !0;
|
|
536
|
+
let n = e.toLowerCase();
|
|
537
|
+
if (n.includes("arweave.net") || n.includes("ar-io.net")) return !0;
|
|
538
|
+
for (let e of [...t.map(J), ...u]) if (e && n.includes(e)) return !0;
|
|
539
|
+
return !1;
|
|
540
|
+
}
|
|
541
|
+
function ct(e, t) {
|
|
542
|
+
let n = t?.baseUrls ?? h(), r = n[0];
|
|
543
|
+
if (!r || !e || !$(e, n)) return e;
|
|
544
|
+
let i = (e) => {
|
|
545
|
+
let t = Y(e, { baseUrls: n });
|
|
546
|
+
if (!t) return;
|
|
547
|
+
let i = X(t, r);
|
|
548
|
+
return i === e ? void 0 : i;
|
|
549
|
+
};
|
|
550
|
+
return Z(e, (e, t, n) => Q(t, n, i));
|
|
551
|
+
}
|
|
552
|
+
function lt(e, { to: t = "gateway", publicBaseUrl: n, baseUrls: r }) {
|
|
553
|
+
let i = [n, ...r ?? h()];
|
|
554
|
+
if (!e || !$(e, i)) return e;
|
|
555
|
+
let a = (e) => {
|
|
556
|
+
let r = Y(e, { baseUrls: i });
|
|
557
|
+
if (!r) return;
|
|
558
|
+
let a = t === "ar" ? `ar://${r.transactionId}${r.rest}` : X(r, n);
|
|
559
|
+
return a === e ? void 0 : a;
|
|
560
|
+
};
|
|
561
|
+
return Z(e, (e, t, n) => Q(t, n, a));
|
|
562
|
+
}
|
|
563
|
+
//#endregion
|
|
564
|
+
export { b as ARWEAVE_HOST_ENV_KEYS, p as ArweaveClient, p as BaseArweaveClient, u as DEFAULT_ARWEAVE_GATEWAYS, de as DEFAULT_ARWEAVE_GRAPHQL_URL, ue as DEFAULT_ARWEAVE_HOST, ge as DEFAULT_ARWEAVE_RAW_READ_TIMEOUT_MS, fe as DEFAULT_GATEWAY_SIDECAR_HOST, f as DEFAULT_GATEWAY_SIDECAR_PORT, e as DEFAULT_SEED_FEED_HYPER_KEY, ve as DEFAULT_SEED_GATEWAY_HYPER_KEY, Ee as DEFAULT_TRANSACTION_STATUS_TIMEOUT_MS, x as DEFAULT_TRANSACTION_STATUS_TOTAL_TIMEOUT_MS, w as DefaultArweaveClient, Ae as DuplicateArweaveModuleError, v as GET_ARWEAVE_TRANSACTIONS, V as GET_TRANSACTIONS_TAGS_BY_IDS, C as GET_TRANSACTION_TAGS, be as MIN_TRANSACTION_STATUS_ATTEMPT_MS, I as SEED_RSS_IMAGE_RELATION_FIELD_KEYS, Ge as TRANSACTION_TAGS_BATCH_SIZE, n as assertSingleArweaveModule, Ce as beginGatewayHostHalfOpenProbe, X as buildArweaveTransactionLink, M as classifyMediaRef, t as configureGatewayCircuitBreaker, we as ensureArweaveReadGatewayForFallback, ae as ensureReadGatewaySelected, E as fetchArweaveRawFromBaseUrl, _e as fetchArweaveRawTextAcrossGateways, me as fetchTransactionStatusAcrossGateways, h as getArweaveReadBaseUrls, T as getArweaveReadGatewayHostsForPrimary, Ze as getArweaveUploadStatus, ze as getArweaveUrlForTransaction, _ as getDefaultArweaveReadGatewayHostsOrdered, N as getFeedItemStringField, Se as getGatewayHostCircuitState, r as getLastHealthyReadGatewayHost, Te as getPreferredArweaveReadBaseUrls, P as getPublicArweaveBaseUrl, F as getPublicArweaveRawUrl, D as getReadGatewayHostsForConfig, y as getResolvedArweaveReadBaseUrls, g as getResolvedSeedGatewayEndpoints, c as getResponseMediaType, Ke as getTransactionTagsByIds, U as getUploadApiArweaveDataUrl, W as getUploadApiArweaveStatusUrl, Je as getUploadPipelineTransactionStatus, se as hasArweaveContentReadTransform, De as invalidateReadGatewayCache, ke as invalidateSidecarProbeCache, Xe as isArweaveL1AnchoringComplete, O as isEasAttestationExplorerUrl, ne as isGatewayHostCircuitOpen, S as isKnownArweaveGatewayHostname, oe as isReadGatewayKnownHealthy, re as listOpenGatewayCircuitHosts, Q as mapUrlAttribute, xe as mergePrimaryHostWithDefaults, it as nextArweaveGatewayUrl, Re as normalizeFeedItemFields, d as normalizeGatewayHostKey, k as normalizeRelationPropertyValue, H as normalizeUploadApiBaseUrl, Y as parseArweaveTransactionLink, a as probeGateway, lt as publishedArweaveLinksInHtml, G as queryArweaveGatewayTransaction, Qe as queryArweaveGatewayTransactionWithFallback, le as readArweaveContentResponse, o as recordGatewayHostFailure, l as recordGatewayHostSuccess, ct as rehostArweaveLinksInHtml, ce as resetArweaveClientOwnerForTests, i as resetArweaveReadGatewayForTests, te as resetGatewayCircuitBreakerForTests, m as resolveArweaveHostFromEnv, he as resolveProxyBaseUrl, Oe as resolveSeedGatewayEndpoints, A as resolveSeedIdsFromRefString, We as resolveSeedRssImageRelationFromItem, B as resolveSeedRssImageRelationRef, Z as rewriteHtmlAttributes, et as seedGatewayConfigFromClientContext, $e as seedGatewayConfigFromSeedConfig, ie as selectFirstHealthyReadGateway, s as setArweaveContentReadTransform, ye as setPreferredArweaveReadBaseUrls, pe as setResolvedSeedGatewayEndpoints, ee as transformArweaveContent };
|
|
427
565
|
|
|
428
566
|
//# sourceMappingURL=index.js.map
|