universal-parcel-scraper 0.975.2-main.5283 → 0.976.0-main.5284

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 CHANGED
@@ -13,7 +13,7 @@ The engine behind [Peek](https://peektracker.com) ([GitHub](https://github.com/p
13
13
  [![License: Apache-2.0](https://img.shields.io/badge/core-Apache--2.0-blue.svg)](LICENSE)
14
14
 
15
15
  <!-- GENERATED:summary -->
16
- **3,500+ carriers** through **730 dedicated adapters** and **5 universal fallbacks**
16
+ **3,500+ carriers** through **731 dedicated adapters** and **5 universal fallbacks**
17
17
 
18
18
  <sub>1339 catalog entries · 156 countries represented</sub>
19
19
  <!-- /GENERATED:summary -->
@@ -163,7 +163,7 @@ the command line's `track --source ParcelsApp` does the same.
163
163
  <!-- GENERATED:stages -->
164
164
  <img src="docs/assets/stages.svg" alt="DHL: Die Sendung wurde in das Zustellfahrzeug geladen.; Mondial Relay: En cours de livraison; Correios Brazil: Objeto saiu para entrega ao destinatário; Correos Express: EN REPARTO; Yamato Transport: 配達中; La Poste / Colissimo: DISTOU. All are filed under out_for_delivery." width="760">
165
165
 
166
- The carrier folders record 19,038 such statuses, each filed under one stage.
166
+ The carrier folders record 19,042 such statuses, each filed under one stage.
167
167
  <!-- /GENERATED:stages -->
168
168
 
169
169
  Wording nobody recorded yet goes through a classifier that reads seven European languages.
package/data/catalog.json CHANGED
@@ -6932,7 +6932,8 @@
6932
6932
  "timezone": "Asia/Manila",
6933
6933
  "tracking": {
6934
6934
  "mode": "automatic",
6935
- "adapter": "universal"
6935
+ "adapter": "airspeed",
6936
+ "localClocks": true
6936
6937
  },
6937
6938
  "canaryUrl": "https://airspeed.ph/track-cargo/",
6938
6939
  "trackingUrlTemplate": "https://logistics.airspeed.com.ph/track/TrackingSearch.aspx?waybill={trackingNumber}",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "catalog": 1339,
3
- "activeAdapters": 730,
3
+ "activeAdapters": 731,
4
4
  "countries": 156,
5
5
  "referenceCarriers": 100,
6
6
  "comparison": {
@@ -5828,7 +5828,8 @@ var lt = {
5828
5828
  timezone: "Asia/Manila",
5829
5829
  tracking: {
5830
5830
  mode: "automatic",
5831
- adapter: "universal"
5831
+ adapter: "airspeed",
5832
+ localClocks: !0
5832
5833
  },
5833
5834
  canaryUrl: "https://airspeed.ph/track-cargo/",
5834
5835
  trackingUrlTemplate: "https://logistics.airspeed.com.ph/track/TrackingSearch.aspx?waybill={trackingNumber}",
@@ -46133,35 +46134,40 @@ function cd(e) {
46133
46134
  function ld(e) {
46134
46135
  return typeof e == "string" && e.length <= 64 && /^ZPY[A-Z]{2}\d{10}YQ$/.test(i(e));
46135
46136
  }
46136
- // core/detection/freightwaysGlobal.ts
46137
+ // core/detection/airspeed.ts
46137
46138
  function ud(e) {
46139
+ return typeof e == "string" && e.length <= 64 && /^(?!0{9}$)\d{9}$/.test(i(e));
46140
+ }
46141
+ // core/detection/freightwaysGlobal.ts
46142
+ function dd(e) {
46138
46143
  return typeof e == "string" && e.length <= 64 && /^(?:NZC\d{9}|GSS\d{6,20}|\d{1,12}NZC\d{9})$/.test(i(e));
46139
46144
  }
46140
46145
  // core/detection/fxdcPost.ts
46141
- function dd(e) {
46146
+ function fd(e) {
46142
46147
  return typeof e == "string" && e.length <= 64 && /^(?!0{8}$)\d{8}$/.test(i(e));
46143
46148
  }
46144
46149
  // core/detection/frontierCa.ts
46145
- function fd(e) {
46150
+ function pd(e) {
46146
46151
  return typeof e == "string" && e.length <= 64 && /^[1-9]\d{7}$/.test(i(e));
46147
46152
  }
46148
46153
  // core/detection/expedico.ts
46149
- function pd(e) {
46154
+ function md(e) {
46150
46155
  return typeof e == "string" && e.length <= 64 && /^(?:\d{13}|\d{16}F\d{4})$/.test(i(e));
46151
46156
  }
46152
46157
  // core/detection/fanCourier.ts
46153
- function md(e) {
46158
+ function hd(e) {
46154
46159
  return typeof e == "string" && /^\d{13}$/.test(i(e));
46155
46160
  }
46156
46161
  // core/catalog/handoff.ts
46157
- var hd = {
46158
- "freightways-global": ud,
46159
- "fxdc-post": dd,
46160
- "frontier-ca": fd,
46162
+ var gd = {
46163
+ airspeed: ud,
46164
+ "freightways-global": dd,
46165
+ "fxdc-post": fd,
46166
+ "frontier-ca": pd,
46161
46167
  topdelivery: ad,
46162
46168
  kargoturk: od,
46163
- expedico: pd,
46164
- "fan-courier": md,
46169
+ expedico: md,
46170
+ "fan-courier": hd,
46165
46171
  "profit-fields": sd,
46166
46172
  "lm-parcel": cd,
46167
46173
  znlogic: ld,
@@ -46177,7 +46183,7 @@ var hd = {
46177
46183
  "acs-courier": Hu,
46178
46184
  "correos-chile": Gu,
46179
46185
  "qatar-post": x
46180
- }, gd = {
46186
+ }, _d = {
46181
46187
  CH: null,
46182
46188
  ES: null,
46183
46189
  FI: "postnord",
@@ -46187,21 +46193,21 @@ var hd = {
46187
46193
  PL: null,
46188
46194
  SK: "slovak-parcel-service",
46189
46195
  UA: "meest"
46190
- }, _d = {
46196
+ }, vd = {
46191
46197
  "morning-global": /^BR\d{9}MG$/,
46192
46198
  "m-one": /^[A-Z]{2}\d{9}RS$/
46193
46199
  };
46194
- function vd(e, t) {
46195
- return !Ot.has(e) || Ct(e) === "universal" || hd[e]?.(t) === !1 || Dt(e, t).length > 0 ? !1 : Et(e, t).length === 0 || S(t).candidates.includes(e);
46200
+ function yd(e, t) {
46201
+ return !Ot.has(e) || Ct(e) === "universal" || gd[e]?.(t) === !1 || Dt(e, t).length > 0 ? !1 : Et(e, t).length === 0 || S(t).candidates.includes(e);
46196
46202
  }
46197
- function yd(e, t, n, r) {
46203
+ function bd(e, t, n, r) {
46198
46204
  if (n.delivery_tracking_number != null && (typeof n.delivery_tracking_number != "string" || !/^[A-Z0-9]{4,40}$/.test(n.delivery_tracking_number))) return null;
46199
46205
  let i = Ru([n.last_status_text, ...(n.events ?? []).map((e) => e.description)], e);
46200
46206
  if (!n.delivery_carrier && i.length > 1) return null;
46201
46207
  let a = n.delivery_carrier ?? i[0], o = "partner", s = n.delivery_tracking_number || t, c = typeof n.destination_country == "string" ? n.destination_country : typeof n.destination_country_name == "string" ? n.destination_country_name : void 0;
46202
- if (!a && x(s) && !_d[e]?.test(s) && (e !== "chronopost" || Wu(s))) {
46208
+ if (!a && x(s) && !vd[e]?.test(s) && (e !== "chronopost" || Wu(s))) {
46203
46209
  let t = r?.trim().toUpperCase(), n = c === void 0 && t && /^[A-Z]{2}$/.test(t) && t !== s.slice(-2) ? t : void 0, i = wc(c ?? n);
46204
- a = e === "dhl" && /^C[A-Z]\d{9}DE$/.test(s) && i && Object.hasOwn(gd, i) ? gd[i] ?? void 0 : Iu(c ?? n), (a === "japan-post" || a === "chunghwa-post") && s.startsWith("U") && (a = void 0), a === "royal-mail" && s.startsWith("E") && (a = "parcelforce"), a && (o = "destination");
46210
+ a = e === "dhl" && /^C[A-Z]\d{9}DE$/.test(s) && i && Object.hasOwn(_d, i) ? _d[i] ?? void 0 : Iu(c ?? n), (a === "japan-post" || a === "chunghwa-post") && s.startsWith("U") && (a = void 0), a === "royal-mail" && s.startsWith("E") && (a = "parcelforce"), a && (o = "destination");
46205
46211
  }
46206
46212
  if (!a && n.delivery_tracking_number) {
46207
46213
  let e = S(s);
@@ -46211,14 +46217,14 @@ function yd(e, t, n, r) {
46211
46217
  let n = S(t), r = wc(c), i = n.confidence === "high" && n.carrier !== e && !x(t) ? n.carrier : null, s = r ? i ? [i].filter((e) => y[e]?.countries?.includes(r)) : n.candidates.includes(e) ? n.candidates.filter((t) => t !== e && y[t]?.countries?.[0] === r) : [] : [];
46212
46218
  s.length === 1 && (a = s[0], o = "reference");
46213
46219
  }
46214
- return !a || a === e || !/^[A-Z0-9]{4,40}$/.test(s) || !vd(a, s) ? null : {
46220
+ return !a || a === e || !/^[A-Z0-9]{4,40}$/.test(s) || !yd(a, s) ? null : {
46215
46221
  carrier: a,
46216
46222
  number: s,
46217
46223
  basis: o
46218
46224
  };
46219
46225
  }
46220
46226
  // core/time/result.ts
46221
- var bd = [
46227
+ var xd = [
46222
46228
  "yyyy-MM-dd HH:mm:ss",
46223
46229
  "yyyy-MM-dd HH:mm",
46224
46230
  "dd.MM.yyyy HH:mm:ss",
@@ -46229,15 +46235,15 @@ var bd = [
46229
46235
  "dd.MM.yyyy",
46230
46236
  "dd/MM/yyyy"
46231
46237
  ];
46232
- function xd(e, t = "UTC") {
46238
+ function Sd(e, t = "UTC") {
46233
46239
  if (typeof e != "string" || !e.trim()) return null;
46234
46240
  let n = e.trim(), r = Y.fromISO(n, { setZone: !0 });
46235
46241
  if (r.isValid) return /(?:Z|[+-]\d{2}:?\d{2})$/i.test(n) || (r = X(Y.fromISO(n, { zone: t }))), r.toUTC().toISO({ suppressMilliseconds: !0 }) ?? null;
46236
- for (let e of bd) if (r = X(Y.fromFormat(n, e, { zone: t })), r.isValid) return r.toUTC().toISO({ suppressMilliseconds: !0 }) ?? null;
46242
+ for (let e of xd) if (r = X(Y.fromFormat(n, e, { zone: t })), r.isValid) return r.toUTC().toISO({ suppressMilliseconds: !0 }) ?? null;
46237
46243
  return null;
46238
46244
  }
46239
46245
  // core/result/due.ts
46240
- function Sd(e, t) {
46246
+ function Cd(e, t) {
46241
46247
  let n = e.events ?? [], r = n.filter((e) => !t(e)), i = typeof e.last_update == "string" && t({ time: e.last_update });
46242
46248
  if (r.length === n.length && !i) return e;
46243
46249
  if (!r.length) return null;
@@ -46255,7 +46261,7 @@ function Sd(e, t) {
46255
46261
  return delete a.current_stage, delete a.current_stage_source, delete a.provider_code, a;
46256
46262
  }
46257
46263
  // core/result/partial.ts
46258
- var Cd = {
46264
+ var wd = {
46259
46265
  pending: 0,
46260
46266
  registered: 1,
46261
46267
  accepted: 2,
@@ -46266,8 +46272,8 @@ var Cd = {
46266
46272
  ready_for_pickup: 4,
46267
46273
  delivered: 5,
46268
46274
  returned: 5
46269
- }, wd = /* @__PURE__ */ new Set(["delivered", "returned"]), Td = 6e4, Ed = 36e5;
46270
- function Dd(e) {
46275
+ }, Td = /* @__PURE__ */ new Set(["delivered", "returned"]), Ed = 6e4, Dd = 36e5;
46276
+ function Od(e) {
46271
46277
  if (typeof e != "string") return null;
46272
46278
  let t = uc(e);
46273
46279
  if (t) return {
@@ -46275,52 +46281,52 @@ function Dd(e) {
46275
46281
  latest: t.timestamp
46276
46282
  };
46277
46283
  if (cc.test(e.trim()) || !/^\s*(?:\d{4}-\d{2}-\d{2}|\d{2}[./]\d{2}[./]\d{4})/.test(e)) return null;
46278
- let n = Date.parse(xd(e, "UTC") ?? "");
46284
+ let n = Date.parse(Sd(e, "UTC") ?? "");
46279
46285
  return Number.isFinite(n) ? {
46280
- earliest: n - 14 * Ed,
46281
- latest: n + (/\d:\d\d/.test(e) ? 12 : 36) * Ed
46286
+ earliest: n - 14 * Dd,
46287
+ latest: n + (/\d:\d\d/.test(e) ? 12 : 36) * Dd
46282
46288
  } : null;
46283
46289
  }
46284
- function Od(e) {
46290
+ function kd(e) {
46285
46291
  let t = [
46286
46292
  e.last_update,
46287
46293
  e.last_update_local,
46288
46294
  ...e.events.flatMap((e) => [e.time, e.local_time])
46289
- ].map(Dd).filter((e) => e !== null);
46295
+ ].map(Od).filter((e) => e !== null);
46290
46296
  return t.length ? {
46291
46297
  earliest: Math.max(...t.map((e) => e.earliest)),
46292
46298
  latest: Math.max(...t.map((e) => e.latest))
46293
46299
  } : null;
46294
46300
  }
46295
- var kd = (e) => Dd(e.time) ?? Dd(e.local_time);
46296
- function Ad(e) {
46301
+ var Ad = (e) => Od(e.time) ?? Od(e.local_time);
46302
+ function jd(e) {
46297
46303
  return new Set(e.events.map((e, t) => {
46298
46304
  let n = [e.time, e.local_time].find((e) => typeof e == "string" && /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}/.test(e));
46299
46305
  return n ? `${n.slice(0, 16).replace(" ", "T")}|${e.stage}` : t;
46300
46306
  })).size;
46301
46307
  }
46302
- function jd(e, t, n) {
46308
+ function Md(e, t, n) {
46303
46309
  let r = e.events.findIndex((e) => e.stage === n);
46304
46310
  if (r < 0) return !1;
46305
- let i = Cd[n] ?? 0;
46306
- if (e.events.slice(0, r).some((e) => (Cd[e.stage] ?? i) >= i)) return !1;
46307
- let a = e.events[r], o = t.events.find((e) => e.stage === n), s = o ? kd(o) : Od(t), c = kd(a);
46308
- return !(s && c && c.latest + Td < s.earliest);
46311
+ let i = wd[n] ?? 0;
46312
+ if (e.events.slice(0, r).some((e) => (wd[e.stage] ?? i) >= i)) return !1;
46313
+ let a = e.events[r], o = t.events.find((e) => e.stage === n), s = o ? Ad(o) : kd(t), c = Ad(a);
46314
+ return !(s && c && c.latest + Ed < s.earliest);
46309
46315
  }
46310
- function Md(e, t) {
46316
+ function Nd(e, t) {
46311
46317
  let n = ku(e);
46312
46318
  return t.some((t) => t === e || n !== void 0 && ku(t) === n);
46313
46319
  }
46314
- function Nd(e, t, n) {
46315
- if (Ad(e) <= Ad(t) || n && typeof e.discovered_carrier == "string" && !Md(e.discovered_carrier, n)) return !1;
46316
- let r = Od(t), i = Od(e);
46317
- if (r && i && i.latest + Td < r.earliest) return !1;
46320
+ function Pd(e, t, n) {
46321
+ if (jd(e) <= jd(t) || n && typeof e.discovered_carrier == "string" && !Nd(e.discovered_carrier, n)) return !1;
46322
+ let r = kd(t), i = kd(e);
46323
+ if (r && i && i.latest + Ed < r.earliest) return !1;
46318
46324
  let a = t.current_stage, o = e.current_stage;
46319
46325
  if (a === void 0 || o === a && o !== "exception") return !0;
46320
- let s = Cd[a], c = Cd[o];
46321
- return wd.has(a) ? s !== void 0 && c !== void 0 && c < s && jd(e, t, a) : s !== void 0 && c !== void 0 && s !== c ? c > s : o === a ? !!(r && i && i.earliest + Td >= r.latest) : !!(r && i && i.earliest > r.latest + Td);
46326
+ let s = wd[a], c = wd[o];
46327
+ return Td.has(a) ? s !== void 0 && c !== void 0 && c < s && Md(e, t, a) : s !== void 0 && c !== void 0 && s !== c ? c > s : o === a ? !!(r && i && i.earliest + Ed >= r.latest) : !!(r && i && i.earliest > r.latest + Ed);
46322
46328
  }
46323
- var Pd = [
46329
+ var Fd = [
46324
46330
  ["expected_delivery", "expected_delivery_from"],
46325
46331
  ["delivery_carrier", "delivery_tracking_number"],
46326
46332
  ["destination_country", "destination_country_name"],
@@ -46333,68 +46339,68 @@ var Pd = [
46333
46339
  ["dimensions_text"],
46334
46340
  ["service_name"],
46335
46341
  ["import_charges"]
46336
- ], Fd = [
46342
+ ], Id = [
46337
46343
  "status",
46338
46344
  "current_stage",
46339
46345
  "current_stage_source",
46340
46346
  "last_status_text",
46341
46347
  "provider_code"
46342
46348
  ];
46343
- function Id(e, t, n) {
46349
+ function Ld(e, t, n) {
46344
46350
  let r = { ...e }, i = t.current_stage;
46345
- if (wd.has(n.current_stage ?? "") && t.current_stage !== n.current_stage) {
46346
- for (let e of Fd) n[e] === void 0 ? delete r[e] : Object.assign(r, { [e]: n[e] });
46351
+ if (Td.has(n.current_stage ?? "") && t.current_stage !== n.current_stage) {
46352
+ for (let e of Id) n[e] === void 0 ? delete r[e] : Object.assign(r, { [e]: n[e] });
46347
46353
  i = n.current_stage;
46348
46354
  }
46349
- wd.has(i ?? "") && (r.expected_delivery != null && (r.expected_delivery = null), delete r.expected_delivery_from);
46350
- for (let e of Pd) if (!(e[0] === "expected_delivery" && wd.has(i ?? "")) && !(e[0] === "pickup_point" && Gc({
46355
+ Td.has(i ?? "") && (r.expected_delivery != null && (r.expected_delivery = null), delete r.expected_delivery_from);
46356
+ for (let e of Fd) if (!(e[0] === "expected_delivery" && Td.has(i ?? "")) && !(e[0] === "pickup_point" && Gc({
46351
46357
  ...t,
46352
46358
  current_stage: i
46353
46359
  })) && e.every((e) => t[e] == null) && e.some((e) => n[e] != null)) for (let t of e) n[t] != null && Object.assign(r, { [t]: n[t] });
46354
46360
  return r;
46355
46361
  }
46356
- function Ld(e) {
46362
+ function Rd(e) {
46357
46363
  return e.summary_only === !0 || e.history_truncated === !0;
46358
46364
  }
46359
- function Rd(e, t, n, r) {
46360
- let i = Vd(r, n.written_ahead ?? []);
46365
+ function zd(e, t, n, r) {
46366
+ let i = Hd(r, n.written_ahead ?? []);
46361
46367
  if (!i) return null;
46362
46368
  let a = Du(n), o = Du(i);
46363
- return Nd(o, a, x(t) ? null : [
46369
+ return Pd(o, a, x(t) ? null : [
46364
46370
  e,
46365
46371
  a.delivery_carrier,
46366
- yd(e, t, a)?.carrier
46367
- ].filter((e) => typeof e == "string")) ? Id(i, o, a) : null;
46372
+ bd(e, t, a)?.carrier
46373
+ ].filter((e) => typeof e == "string")) ? Ld(i, o, a) : null;
46368
46374
  }
46369
- function zd(e) {
46375
+ function Bd(e) {
46370
46376
  let t = typeof e == "string" ? /^\s*(\d{4}-\d{2}-\d{2})[T ](\d{2}:\d{2})(?::(\d{2}))?/.exec(e) : null;
46371
46377
  return t ? {
46372
46378
  minute: `${t[1]}T${t[2]}`,
46373
46379
  ...t[3] ? { seconds: t[3] } : {}
46374
46380
  } : null;
46375
46381
  }
46376
- function Bd(e, t) {
46382
+ function Vd(e, t) {
46377
46383
  let n = uc(t), r = uc(e.time);
46378
- if (n && r && Math.abs(n.timestamp - r.timestamp) < Td) return !0;
46379
- let i = zd(t);
46380
- return i !== null && [e.time, e.local_time].map(zd).some((e) => e?.minute === i.minute && (!e.seconds || !i.seconds || e.seconds === i.seconds));
46384
+ if (n && r && Math.abs(n.timestamp - r.timestamp) < Ed) return !0;
46385
+ let i = Bd(t);
46386
+ return i !== null && [e.time, e.local_time].map(Bd).some((e) => e?.minute === i.minute && (!e.seconds || !i.seconds || e.seconds === i.seconds));
46381
46387
  }
46382
- function Vd(e, t) {
46383
- return t.length ? Sd(e, (e) => t.some((t) => Bd(e, t))) : e;
46388
+ function Hd(e, t) {
46389
+ return t.length ? Cd(e, (e) => t.some((t) => Vd(e, t))) : e;
46384
46390
  }
46385
46391
  // core/errors/hint.ts
46386
- function Hd(e) {
46392
+ function Ud(e) {
46387
46393
  return ae(e) ?? (e instanceof TypeError || e instanceof RangeError || e instanceof SyntaxError ? "schema" : "transport");
46388
46394
  }
46389
- function Ud(e) {
46390
- let t = Hd(e), n = oe(e);
46395
+ function Wd(e) {
46396
+ let t = Ud(e), n = oe(e);
46391
46397
  return {
46392
46398
  kind: t,
46393
46399
  ...n === void 0 ? {} : { retryAfterMs: n }
46394
46400
  };
46395
46401
  }
46396
46402
  // generated/recognition.ts
46397
- var Wd = {
46403
+ var Gd = {
46398
46404
  "17feia": 991,
46399
46405
  "2go": 799,
46400
46406
  "4-72": 896,
@@ -46905,18 +46911,18 @@ var Wd = {
46905
46911
  znlogic: 3,
46906
46912
  "zr-express": 801,
46907
46913
  "zto-international": 998
46908
- }, Gd = 5;
46909
- function Kd(e) {
46914
+ }, Kd = 5;
46915
+ function qd(e) {
46910
46916
  let t = i(e);
46911
46917
  if (/^[A-Z0-9]{4,40}$/.test(t)) return t.match(/[A-Z]+|[0-9]+/g).map((e) => `${/^[0-9]/.test(e) ? "D" : "A"}${e.length}`).join("");
46912
46918
  }
46913
- var qd = /^\^(?:\\d|\[0-9\])\{\d+\}\$$/;
46914
- function Jd(e, t, n) {
46919
+ var Jd = /^\^(?:\\d|\[0-9\])\{\d+\}\$$/;
46920
+ function Yd(e, t, n) {
46915
46921
  let r = y[e]?.detectionRules.find((e) => En(e, t, n) && (!e.checksum || Cn[e.checksum](t)));
46916
- if (r?.checksum !== void 0) return r.preferred && qd.test(r.pattern) ? "backs" : "passes";
46922
+ if (r?.checksum !== void 0) return r.preferred && Jd.test(r.pattern) ? "backs" : "passes";
46917
46923
  }
46918
- var Yd = Object.fromEntries(Object.entries(y).map(([e, t]) => [e, t.tracking.browserRecognitionRank])), Xd = new Map(Object.entries(y).flatMap(([e, { tracking: t }]) => t.recognitionPattern === void 0 ? [] : [[e, new RegExp(t.recognitionPattern)]]));
46919
- function Zd(e, t = {}) {
46924
+ var Xd = Object.fromEntries(Object.entries(y).map(([e, t]) => [e, t.tracking.browserRecognitionRank])), Zd = new Map(Object.entries(y).flatMap(([e, { tracking: t }]) => t.recognitionPattern === void 0 ? [] : [[e, new RegExp(t.recognitionPattern)]]));
46925
+ function Qd(e, t = {}) {
46920
46926
  if (cr(e, t.countryHint)) return [];
46921
46927
  let n = S(e), r = n.carrier === "intl-post";
46922
46928
  if (n.confidence !== "low" && !r) return [];
@@ -46926,14 +46932,14 @@ function Zd(e, t = {}) {
46926
46932
  carrier: e,
46927
46933
  preferred: n.preferred === !0
46928
46934
  }] : [];
46929
- }) : [], c = r ? s.map(({ carrier: e }) => e) : n.candidates, l = r ? s.filter((e) => e.preferred).map(({ carrier: e }) => e) : n.preferred, u = t.phase === "browser" ? Yd : Wd, d = new Set(l.filter((e) => u[e] === void 0).map((e) => ku(e)).filter(Boolean)), f = t.countryHint?.trim().toUpperCase(), p = (e) => {
46935
+ }) : [], c = r ? s.map(({ carrier: e }) => e) : n.candidates, l = r ? s.filter((e) => e.preferred).map(({ carrier: e }) => e) : n.preferred, u = t.phase === "browser" ? Xd : Gd, d = new Set(l.filter((e) => u[e] === void 0).map((e) => ku(e)).filter(Boolean)), f = t.countryHint?.trim().toUpperCase(), p = (e) => {
46930
46936
  if (!f || !/^[A-Z]{2}$/.test(f)) return 0;
46931
46937
  let t = y[e]?.countries ?? [];
46932
46938
  return t[0] === f ? 2 : +!!t.includes(f);
46933
46939
  }, m = (e) => {
46934
46940
  let n = t.priorities?.[e];
46935
46941
  return typeof n == "number" && Number.isFinite(n) && n >= 0 ? n : 0;
46936
- }, ee = (e) => t.phase === "browser" ? !0 : y[e]?.tracking?.recognitionServedCountriesOnly && p(e) === 0 ? !1 : Xd.get(e)?.test(a) ?? !0, h = c.filter((e) => u[e] !== void 0 && Ot.has(e) && Ct(e) !== "universal" && ee(e) && !d.has(ku(e)) && !t.skip?.(e)), g = new Map(h.map((e) => [e, Jd(e, a, o)])), _ = (e) => g.get(e) === "backs" ? h.filter((t) => t !== e && g.get(t)) : [], te = (e) => [
46942
+ }, ee = (e) => t.phase === "browser" ? !0 : y[e]?.tracking?.recognitionServedCountriesOnly && p(e) === 0 ? !1 : Zd.get(e)?.test(a) ?? !0, h = c.filter((e) => u[e] !== void 0 && Ot.has(e) && Ct(e) !== "universal" && ee(e) && !d.has(ku(e)) && !t.skip?.(e)), g = new Map(h.map((e) => [e, Yd(e, a, o)])), _ = (e) => g.get(e) === "backs" ? h.filter((t) => t !== e && g.get(t)) : [], te = (e) => [
46937
46943
  +(e === t.hint),
46938
46944
  +!!l.includes(e),
46939
46945
  p(e),
@@ -46962,8 +46968,8 @@ function Zd(e, t = {}) {
46962
46968
  }).filter((e) => t.phase !== "browser" || !e.needsInput);
46963
46969
  }
46964
46970
  // core/recognition/index.ts
46965
- var Qd = 5184e6, $d = 432e5;
46966
- async function ef(e, t, n, r) {
46971
+ var $d = 5184e6, ef = 432e5;
46972
+ async function tf(e, t, n, r) {
46967
46973
  let i = e.map((e) => ({
46968
46974
  ...e,
46969
46975
  status: "failed",
@@ -46996,24 +47002,24 @@ async function ef(e, t, n, r) {
46996
47002
  }
46997
47003
  return r?.throwIfAborted(), i.map((e) => ({ ...e }));
46998
47004
  }
46999
- function tf(e, t) {
47005
+ function nf(e, t) {
47000
47006
  let n = Date.parse(e.lastActivityAt ?? "");
47001
47007
  if (Number.isFinite(n)) return t.getTime() - n;
47002
47008
  let r = fc(e.lastActivityLocal, "UTC")?.timestamp;
47003
- return r === void 0 ? null : t.getTime() - r - $d;
47009
+ return r === void 0 ? null : t.getTime() - r - ef;
47004
47010
  }
47005
- var nf = {
47011
+ var rf = {
47006
47012
  home: 2,
47007
47013
  served: 1
47008
47014
  };
47009
- function rf(e) {
47010
- return e.countryMatch ? nf[e.countryMatch] : 0;
47015
+ function af(e) {
47016
+ return e.countryMatch ? rf[e.countryMatch] : 0;
47011
47017
  }
47012
- function af(e, t = /* @__PURE__ */ new Date()) {
47018
+ function of(e, t = /* @__PURE__ */ new Date()) {
47013
47019
  let n = e.filter((e) => e.status === "known").map((e) => ({
47014
47020
  outcome: e,
47015
- quiet: tf(e, t)
47016
- })), r = n.filter(({ quiet: e }) => e !== null && e < Qd), i = (r.length ? r : n.filter(({ quiet: e }) => e === null)).map(({ outcome: e }) => e);
47021
+ quiet: nf(e, t)
47022
+ })), r = n.filter(({ quiet: e }) => e !== null && e < $d), i = (r.length ? r : n.filter(({ quiet: e }) => e === null)).map(({ outcome: e }) => e);
47017
47023
  if (i.length === 0) return { choices: [] };
47018
47024
  if (i.length === 1) return {
47019
47025
  carrier: i[0].carrier,
@@ -47030,7 +47036,7 @@ function af(e, t = /* @__PURE__ */ new Date()) {
47030
47036
  choices: []
47031
47037
  };
47032
47038
  if (new Set(i.map((e) => ku(e.carrier) ?? e.carrier)).size === 1) {
47033
- let [e] = [...i].sort((e, t) => Number(!t.needsInput) - Number(!e.needsInput) || rf(t) - rf(e) || (Wd[t.carrier] ?? 0) - (Wd[e.carrier] ?? 0));
47039
+ let [e] = [...i].sort((e, t) => Number(!t.needsInput) - Number(!e.needsInput) || af(t) - af(e) || (Gd[t.carrier] ?? 0) - (Gd[e.carrier] ?? 0));
47034
47040
  return {
47035
47041
  carrier: e.carrier,
47036
47042
  choices: []
@@ -47039,7 +47045,7 @@ function af(e, t = /* @__PURE__ */ new Date()) {
47039
47045
  return { choices: i.map((e) => e.carrier) };
47040
47046
  }
47041
47047
  // core/catalog/urls.ts
47042
- var of = "trackandtrace.planzergroup.com", sf = /^\/shared\/sendungen\/([^/]+)\/?$/, cf = /^[A-Za-z0-9_-]{32,256}$/, lf = "customeriberia.dachser.com", uf = "/customerarea/utilidades/seguimiento-publico/detalle", df = /^\/[a-z]{2}(?:-[A-Z]{2})?\/([A-Z0-9]{4,40})(?:\/locker-to-locker-recipient)?\/?$/i, ff = /^[A-Za-z0-9_-]{4,256}$/, pf = /[\x00-\x1f\x7f]/, mf = /* @__PURE__ */ new Set([
47048
+ var sf = "trackandtrace.planzergroup.com", cf = /^\/shared\/sendungen\/([^/]+)\/?$/, lf = /^[A-Za-z0-9_-]{32,256}$/, uf = "customeriberia.dachser.com", df = "/customerarea/utilidades/seguimiento-publico/detalle", ff = /^\/[a-z]{2}(?:-[A-Z]{2})?\/([A-Z0-9]{4,40})(?:\/locker-to-locker-recipient)?\/?$/i, pf = /^[A-Za-z0-9_-]{4,256}$/, mf = /[\x00-\x1f\x7f]/, hf = /* @__PURE__ */ new Set([
47043
47049
  "hash",
47044
47050
  "cliente",
47045
47051
  "numeroUnico",
@@ -47054,7 +47060,7 @@ var of = "trackandtrace.planzergroup.com", sf = /^\/shared\/sendungen\/([^/]+)\/
47054
47060
  "origen",
47055
47061
  "usuario"
47056
47062
  ]);
47057
- function hf(e, t) {
47063
+ function gf(e, t) {
47058
47064
  let n;
47059
47065
  try {
47060
47066
  n = new URL(e.trim());
@@ -47062,21 +47068,21 @@ function hf(e, t) {
47062
47068
  throw TypeError("Paste the complete Instabox notification URL");
47063
47069
  }
47064
47070
  if (e.length > 4096 || n.protocol !== "https:" || n.hostname !== "track.instabox.com" || n.username || n.password || n.port && n.port !== "443" || n.hash) throw TypeError("Instabox notification links must use https://track.instabox.com");
47065
- let r = df.exec(n.pathname);
47071
+ let r = ff.exec(n.pathname);
47066
47072
  if (!r || r[1].toUpperCase() !== i(t)) throw TypeError("The Instabox URL must name this complete parcel identifier");
47067
47073
  let a = [...n.searchParams].filter(([e]) => e === "authCode" || e === "c");
47068
47074
  if (a.length !== 1 || !/^[A-Za-z0-9_-]{16,160}$/.test(a[0][1])) throw TypeError("The Instabox notification URL must include its verification code");
47069
47075
  for (let [e, t] of n.searchParams) if (!["authCode", "c"].includes(e) && (!/^utm_(?:source|medium|campaign|content|term)$/.test(e) || t.length > 256)) throw TypeError("The Instabox URL contains an unsupported parameter");
47070
47076
  return n.pathname = n.pathname.replace(r[1], i(t)), n.search = new URLSearchParams([a[0]]).toString(), n.toString();
47071
47077
  }
47072
- var gf = {
47078
+ var _f = {
47073
47079
  "nz-couriers": "nzcouriers.co.nz",
47074
47080
  "post-haste": "posthaste.co.nz",
47075
47081
  "castle-parcels": "castleparcels.co.nz",
47076
47082
  "now-couriers": "nowcouriers.co.nz"
47077
- }, _f = /^\/[a-z]+\/servlet\/ITNG_TAndTServlet\/?$/i, vf = /^CU\.\.([A-Z0-9]{4,40})\.([A-Z0-9])\.([A-Z0-9]{3,16})\.(\d{1,3})$/i, yf = /^[A-Z0-9]{3,16}$/i;
47078
- function bf(e, t, n) {
47079
- let r = gf[n];
47083
+ }, vf = /^\/[a-z]+\/servlet\/ITNG_TAndTServlet\/?$/i, yf = /^CU\.\.([A-Z0-9]{4,40})\.([A-Z0-9])\.([A-Z0-9]{3,16})\.(\d{1,3})$/i, bf = /^[A-Z0-9]{3,16}$/i;
47084
+ function xf(e, t, n) {
47085
+ let r = _f[n];
47080
47086
  if (!r) throw TypeError("This carrier takes no Freightways tracking link");
47081
47087
  let a;
47082
47088
  try {
@@ -47087,7 +47093,7 @@ function bf(e, t, n) {
47087
47093
  let o = a.hostname.toLowerCase();
47088
47094
  if (e.length > 4096 || !["https:", "http:"].includes(a.protocol) || a.username || a.password || a.port && !["80", "443"].includes(a.port) || o !== r && !o.endsWith(`.${r}`)) throw TypeError(`The tracking link must be on ${r}`);
47089
47095
  let s = o === `receiver.${r}` && /^\/?$/.test(a.pathname);
47090
- if (!s && !_f.test(a.pathname)) throw TypeError("Paste the receiver link from the shipping email");
47096
+ if (!s && !vf.test(a.pathname)) throw TypeError("Paste the receiver link from the shipping email");
47091
47097
  let c = (...e) => {
47092
47098
  let t = new Set([...a.searchParams].filter(([t]) => e.includes(t.toLowerCase())).map(([, e]) => e.trim()));
47093
47099
  if (t.size > 1) throw TypeError("The tracking link names two consignments");
@@ -47096,7 +47102,7 @@ function bf(e, t, n) {
47096
47102
  if (!/^[A-Z0-9]{4,40}$/.test(l)) throw TypeError("The tracking link belongs to a different tracking number");
47097
47103
  let u = s ? c("consignmentid") : void 0;
47098
47104
  if (u) {
47099
- let e = vf.exec(u);
47105
+ let e = yf.exec(u);
47100
47106
  if (!e) throw TypeError("The tracking link must name the sender’s account");
47101
47107
  if (i(e[1]) !== l) throw TypeError("The tracking link belongs to a different tracking number");
47102
47108
  let t = e[3].toUpperCase();
@@ -47107,7 +47113,7 @@ function bf(e, t, n) {
47107
47113
  };
47108
47114
  }
47109
47115
  let d = c("customer_number", "customer_id"), f = c("consignment_id", "consignment_id_ref");
47110
- if (!d || !f || !yf.test(d)) throw TypeError("The tracking link must name the sender’s account");
47116
+ if (!d || !f || !bf.test(d)) throw TypeError("The tracking link must name the sender’s account");
47111
47117
  if (i(f) !== l) throw TypeError("The tracking link belongs to a different tracking number");
47112
47118
  return {
47113
47119
  url: `https://receiver.${r}/?request_id=3&customer_number=${d.toUpperCase()}&consignment_id=${l}`,
@@ -47115,10 +47121,10 @@ function bf(e, t, n) {
47115
47121
  consignment: l
47116
47122
  };
47117
47123
  }
47118
- function xf(e, t, n) {
47119
- return bf(e, t, n).url;
47124
+ function Sf(e, t, n) {
47125
+ return xf(e, t, n).url;
47120
47126
  }
47121
- function Sf(e, t) {
47127
+ function Cf(e, t) {
47122
47128
  let n = e.trim();
47123
47129
  if (n.length < 1 || n.length > 4096) throw TypeError("Paste the complete Planzer tracking URL");
47124
47130
  let r;
@@ -47127,21 +47133,21 @@ function Sf(e, t) {
47127
47133
  } catch (e) {
47128
47134
  throw TypeError("Paste a valid Planzer tracking URL", { cause: e });
47129
47135
  }
47130
- if (r.protocol !== "https:" || r.hostname.toLowerCase() !== of || r.username || r.password || r.port && r.port !== "443" || r.hash) throw TypeError(`Planzer shared links must use https://${of}`);
47136
+ if (r.protocol !== "https:" || r.hostname.toLowerCase() !== sf || r.username || r.password || r.port && r.port !== "443" || r.hash) throw TypeError(`Planzer shared links must use https://${sf}`);
47131
47137
  let a;
47132
47138
  try {
47133
47139
  a = decodeURIComponent(r.pathname);
47134
47140
  } catch (e) {
47135
47141
  throw TypeError("Paste a valid Planzer tracking URL", { cause: e });
47136
47142
  }
47137
- let o = sf.exec(a);
47143
+ let o = cf.exec(a);
47138
47144
  if (!o) throw TypeError("Paste a Planzer shared shipment URL");
47139
47145
  if (i(o[1]) !== i(t)) throw TypeError("The Planzer URL belongs to a different tracking number");
47140
47146
  let s = r.searchParams.getAll("accessKey");
47141
- if (s.length !== 1 || !cf.test(s[0])) throw TypeError("The Planzer URL must include its accessKey");
47147
+ if (s.length !== 1 || !lf.test(s[0])) throw TypeError("The Planzer URL must include its accessKey");
47142
47148
  return r.toString();
47143
47149
  }
47144
- function Cf(e, t) {
47150
+ function wf(e, t) {
47145
47151
  let n = e.trim();
47146
47152
  if (n.length < 1 || n.length > 4096) throw TypeError("Paste the complete Dachser tracking URL");
47147
47153
  let r;
@@ -47150,51 +47156,51 @@ function Cf(e, t) {
47150
47156
  } catch (e) {
47151
47157
  throw TypeError("Paste a valid Dachser tracking URL", { cause: e });
47152
47158
  }
47153
- if (r.protocol !== "https:" || r.hostname.toLowerCase() !== lf || r.username || r.password || r.port && r.port !== "443" || r.hash) throw TypeError(`Dachser links must use https://${lf}`);
47159
+ if (r.protocol !== "https:" || r.hostname.toLowerCase() !== uf || r.username || r.password || r.port && r.port !== "443" || r.hash) throw TypeError(`Dachser links must use https://${uf}`);
47154
47160
  let a;
47155
47161
  try {
47156
47162
  a = decodeURIComponent(r.pathname);
47157
47163
  } catch (e) {
47158
47164
  throw TypeError("Paste a valid Dachser tracking URL", { cause: e });
47159
47165
  }
47160
- if (a !== uf && a !== `${uf}/`) throw TypeError("Paste a Dachser public shipment detail URL");
47166
+ if (a !== df && a !== `${df}/`) throw TypeError("Paste a Dachser public shipment detail URL");
47161
47167
  let o = /* @__PURE__ */ new Map();
47162
47168
  for (let [e, t] of r.searchParams) {
47163
- if (!mf.has(e)) throw TypeError("The Dachser URL contains an unsupported parameter");
47169
+ if (!hf.has(e)) throw TypeError("The Dachser URL contains an unsupported parameter");
47164
47170
  if (o.has(e)) throw TypeError("The Dachser URL contains a duplicate parameter");
47165
- if (!t || t.length > 256 || pf.test(t)) throw TypeError("The Dachser URL contains an invalid parameter");
47171
+ if (!t || t.length > 256 || mf.test(t)) throw TypeError("The Dachser URL contains an invalid parameter");
47166
47172
  o.set(e, t);
47167
47173
  }
47168
47174
  let s = o.get("numeroUnico");
47169
47175
  if (!s) throw TypeError("The Dachser URL must include its shipment number");
47170
47176
  if (i(s) !== i(t)) throw TypeError("The Dachser URL belongs to a different tracking number");
47171
- let c = o.get("hash"), l = o.get("clave"), u = o.get("fecha"), d = !!(c && ff.test(c)), f = !!(l && u && ff.test(l) && /^\d{8}$/.test(u));
47177
+ let c = o.get("hash"), l = o.get("clave"), u = o.get("fecha"), d = !!(c && pf.test(c)), f = !!(l && u && pf.test(l) && /^\d{8}$/.test(u));
47172
47178
  if (!d && !f) throw TypeError("The Dachser URL must include its access parameters");
47173
- return r.protocol = "https:", r.hostname = lf, r.port = "", r.toString();
47179
+ return r.protocol = "https:", r.hostname = uf, r.port = "", r.toString();
47174
47180
  }
47175
47181
  // core/catalog/postcode.ts
47176
- var wf = /^(?=.{3,12}$)(?=.*\d)[A-Z0-9]+(?:[ -][A-Z0-9]+)*$/;
47177
- function Tf(e) {
47182
+ var Tf = /^(?=.{3,12}$)(?=.*\d)[A-Z0-9]+(?:[ -][A-Z0-9]+)*$/;
47183
+ function Ef(e) {
47178
47184
  return e.trim().toUpperCase().replace(/\s+/g, " ");
47179
47185
  }
47180
- function Ef(e) {
47186
+ function Df(e) {
47181
47187
  let t = e.toUpperCase().replace(/\s+/g, "");
47182
47188
  if (/^(?:0[1-9]|[1-8]\d|9[0-5]|97|98)\d{3}$/.test(t)) return t;
47183
47189
  let n = /^(?:(BE?|LU?)-?)?([1-9]\d{3})$/.exec(t);
47184
47190
  return n ? `${n[1]?.charAt(0) ?? ""}${n[2]}` : null;
47185
47191
  }
47186
47192
  // core/catalog/inputs.ts
47187
- function Df(e, t) {
47193
+ function Of(e, t) {
47188
47194
  return e === "mondial-relay" && /^(?:\d{10}|\d{12}|\d{14}|\d{26})$/.test(t);
47189
47195
  }
47190
- function Of(e, t, n, r) {
47196
+ function kf(e, t, n, r) {
47191
47197
  let i = {
47192
47198
  trackingUrl: n.trim() || null,
47193
47199
  postcode: r.trim() || null
47194
47200
  };
47195
47201
  if (e === "mondial-relay" && /^\d{26}$/.test(t) && !ot(t)) throw TypeError("Invalid Mondial Relay barcode");
47196
47202
  let a = new Map(Et(e, t).map((e) => [e.field, e]));
47197
- Df(e, t) && i.postcode && a.set("postcode", {
47203
+ Of(e, t) && i.postcode && a.set("postcode", {
47198
47204
  field: "postcode",
47199
47205
  validator: "internationalPostcode"
47200
47206
  });
@@ -47207,16 +47213,16 @@ function Of(e, t, n, r) {
47207
47213
  }
47208
47214
  switch (r.validator) {
47209
47215
  case "planzerSharedUrl":
47210
- i[n] = Sf(a, t);
47216
+ i[n] = Cf(a, t);
47211
47217
  break;
47212
47218
  case "dachserCapabilityUrl":
47213
- i[n] = Cf(a, t);
47219
+ i[n] = wf(a, t);
47214
47220
  break;
47215
47221
  case "instaboxCapabilityUrl":
47216
- i[n] = hf(a, t);
47222
+ i[n] = gf(a, t);
47217
47223
  break;
47218
47224
  case "freightwaysCapabilityUrl":
47219
- i[n] = xf(a, t, e);
47225
+ i[n] = Sf(a, t, e);
47220
47226
  break;
47221
47227
  case "swissPostcode":
47222
47228
  if (!/^\d{4}$/.test(a)) throw TypeError(`${b(e).displayName} requires the four-digit delivery postcode`);
@@ -47229,8 +47235,8 @@ function Of(e, t, n, r) {
47229
47235
  if (!/^\d{4,5}$/.test(a)) throw TypeError(`${b(e).displayName} requires a four- or five-digit delivery postcode`);
47230
47236
  break;
47231
47237
  case "internationalPostcode":
47232
- if (!wf.test(Tf(a))) throw TypeError(`${b(e).displayName} requires a valid delivery postcode`);
47233
- i[n] = Tf(a);
47238
+ if (!Tf.test(Ef(a))) throw TypeError(`${b(e).displayName} requires a valid delivery postcode`);
47239
+ i[n] = Ef(a);
47234
47240
  break;
47235
47241
  case "paackPostcode": {
47236
47242
  let e = a.toLocaleUpperCase("en-US");
@@ -47239,7 +47245,7 @@ function Of(e, t, n, r) {
47239
47245
  break;
47240
47246
  }
47241
47247
  case "colisPrivePostcode": {
47242
- let t = Ef(a);
47248
+ let t = Df(a);
47243
47249
  if (!t) throw TypeError(`${b(e).displayName} requires a French, Belgian or Luxembourg delivery postcode`);
47244
47250
  i[n] = t;
47245
47251
  break;
@@ -47249,12 +47255,12 @@ function Of(e, t, n, r) {
47249
47255
  }
47250
47256
  return i;
47251
47257
  }
47252
- function kf(e) {
47253
- let t = Tf(e);
47254
- if (!wf.test(t)) throw TypeError("A valid delivery postcode is required");
47258
+ function Af(e) {
47259
+ let t = Ef(e);
47260
+ if (!Tf.test(t)) throw TypeError("A valid delivery postcode is required");
47255
47261
  return t;
47256
47262
  }
47257
- var Af = { carriers: [
47263
+ var jf = { carriers: [
47258
47264
  {
47259
47265
  carrier: "dhl",
47260
47266
  direct: "Yes",
@@ -51277,91 +51283,91 @@ var Af = { carriers: [
51277
51283
  }
51278
51284
  }]
51279
51285
  }
51280
- ] }, jf = [
51286
+ ] }, Mf = [
51281
51287
  "Ship24",
51282
51288
  "ParcelsApp",
51283
51289
  "17TRACK",
51284
51290
  "Postal Ninja",
51285
51291
  "UPU"
51286
- ], Mf = /* @__PURE__ */ new Set([
51292
+ ], Nf = /* @__PURE__ */ new Set([
51287
51293
  "no_history",
51288
51294
  "summary_only",
51289
51295
  "undated",
51290
51296
  "sign_in",
51291
51297
  "postcode_prompt"
51292
- ]), Nf = Af.carriers, Pf = new Map(Nf.map((e) => [e.carrier, e]));
51293
- function Ff(e) {
51298
+ ]), Pf = jf.carriers, Ff = new Map(Pf.map((e) => [e.carrier, e]));
51299
+ function If(e) {
51294
51300
  return typeof e == "number" || e === "history" || typeof e == "object" && !!e;
51295
51301
  }
51296
- function If(e, t) {
51302
+ function Lf(e, t) {
51297
51303
  let n = t.filter((t) => t.results[e] !== void 0);
51298
51304
  if (n.some((t) => t.results[e] === "subscriber_only")) return "excluded";
51299
- let r = n.some((t) => !t.stale && (Mf.has(t.results[e]) || t.results[e] === "wrong_carrier") && Object.entries(t.results).some(([t, n]) => t !== e && t !== "UPU" && Ff(n)));
51300
- return n.some((t) => Ff(t.results[e])) ? n.some((t) => typeof t.results[e] == "object") || r ? "partial" : "full" : n.some((t) => ["wrong_carrier", "refused"].includes(t.results[e])) ? "excluded" : n.some((t) => !t.stale && Mf.has(t.results[e])) ? "empty" : "unknown";
51305
+ let r = n.some((t) => !t.stale && (Nf.has(t.results[e]) || t.results[e] === "wrong_carrier") && Object.entries(t.results).some(([t, n]) => t !== e && t !== "UPU" && If(n)));
51306
+ return n.some((t) => If(t.results[e])) ? n.some((t) => typeof t.results[e] == "object") || r ? "partial" : "full" : n.some((t) => ["wrong_carrier", "refused"].includes(t.results[e])) ? "excluded" : n.some((t) => !t.stale && Nf.has(t.results[e])) ? "empty" : "unknown";
51301
51307
  }
51302
- function Lf(e) {
51303
- let t = e ? Pf.get(e) : void 0;
51304
- return t ? Object.fromEntries(jf.map((e) => [e, If(e, t.references)])) : null;
51308
+ function Rf(e) {
51309
+ let t = e ? Ff.get(e) : void 0;
51310
+ return t ? Object.fromEntries(Mf.map((e) => [e, Lf(e, t.references)])) : null;
51305
51311
  }
51306
51312
  // providers/plan.ts
51307
- var Rf = [
51313
+ var zf = [
51308
51314
  "ParcelsApp",
51309
51315
  "Ship24",
51310
51316
  "17TRACK",
51311
51317
  "Track718",
51312
51318
  "UPU"
51313
- ], zf = /* @__PURE__ */ new Set([
51319
+ ], Bf = /* @__PURE__ */ new Set([
51314
51320
  "17TRACK",
51315
51321
  "Postal Ninja",
51316
51322
  "Track718",
51317
51323
  "Track123"
51318
51324
  ]);
51319
- function Bf(e) {
51325
+ function Vf(e) {
51320
51326
  return e === "ParcelsApp" ? 45e3 : e === "UPU" ? 8e3 : 3e4;
51321
51327
  }
51322
- function Vf(e) {
51328
+ function Hf(e) {
51323
51329
  return e && /^\d{10}$/.test(i(e)) ? "Ship24" : e && /^[CL][A-Z]\d{9}CN$/.test(i(e)) && x(e) ? "17TRACK" : void 0;
51324
51330
  }
51325
- var Hf = {
51331
+ var Uf = {
51326
51332
  full: 0,
51327
51333
  partial: 1,
51328
51334
  unknown: 2,
51329
51335
  empty: 3,
51330
51336
  excluded: 4
51331
51337
  };
51332
- function Uf(e, t) {
51333
- let n = Hf[e?.[t] ?? "unknown"];
51334
- return t === "UPU" ? Hf.unknown : t === "Postal Ninja" ? Math.max(n, Hf.empty) : n;
51338
+ function Wf(e, t) {
51339
+ let n = Uf[e?.[t] ?? "unknown"];
51340
+ return t === "UPU" ? Uf.unknown : t === "Postal Ninja" ? Math.max(n, Uf.empty) : n;
51335
51341
  }
51336
- var Wf = (e) => e === "UPU" ? 2 : +(e === "Postal Ninja");
51337
- function Gf(e, t) {
51342
+ var Gf = (e) => e === "UPU" ? 2 : +(e === "Postal Ninja");
51343
+ function Kf(e, t) {
51338
51344
  let n = (e) => e !== "UPU" && t?.[e] === "excluded";
51339
- return (e.some((e) => e !== "UPU" && !n(e)) ? e.filter((e) => !n(e)) : [...e]).sort((n, r) => Wf(n) - Wf(r) || Uf(t, n) - Uf(t, r) || Number(zf.has(n)) - Number(zf.has(r)) || e.indexOf(n) - e.indexOf(r));
51345
+ return (e.some((e) => e !== "UPU" && !n(e)) ? e.filter((e) => !n(e)) : [...e]).sort((n, r) => Gf(n) - Gf(r) || Wf(t, n) - Wf(t, r) || Number(Bf.has(n)) - Number(Bf.has(r)) || e.indexOf(n) - e.indexOf(r));
51340
51346
  }
51341
- var Kf = new Set(ut.filter((e) => e !== "unknown"));
51342
- function qf(e = {}) {
51343
- let { trackingNumber: t, enablePostalNinja: n = !1 } = e, r = e.carriers ?? [], a = r.find((e) => Lf(e)) ?? null, o = Lf(a), s = r.some((e) => e && Kf.has(e)), c = n && (!s || ["full", "partial"].includes(o?.["Postal Ninja"] ?? "unknown")) ? [
51347
+ var qf = new Set(ut.filter((e) => e !== "unknown"));
51348
+ function Jf(e = {}) {
51349
+ let { trackingNumber: t, enablePostalNinja: n = !1 } = e, r = e.carriers ?? [], a = r.find((e) => Rf(e)) ?? null, o = Rf(a), s = r.some((e) => e && qf.has(e)), c = n && (!s || ["full", "partial"].includes(o?.["Postal Ninja"] ?? "unknown")) ? [
51344
51350
  "ParcelsApp",
51345
51351
  "Ship24",
51346
51352
  "17TRACK",
51347
51353
  "Postal Ninja",
51348
51354
  "UPU"
51349
- ] : [...Rf], l = r.find((e) => e && Kf.has(e)) === "juxi-express" || !s && !!t && /^JXC[A-Z]{2}\d{10}YQ$/.test(i(t)), u = c.filter((e) => (e !== "Track718" || l) && (e !== "UPU" || t === void 0 || x(t)));
51355
+ ] : [...zf], l = r.find((e) => e && qf.has(e)) === "juxi-express" || !s && !!t && /^JXC[A-Z]{2}\d{10}YQ$/.test(i(t)), u = c.filter((e) => (e !== "Track718" || l) && (e !== "UPU" || t === void 0 || x(t)));
51350
51356
  l && !u.includes("Track718") && u.push("Track718");
51351
- let d = Gf(u, o);
51357
+ let d = Kf(u, o);
51352
51358
  e.enableTrack123 && r[0] === "fedex" && t && /^(?:\d{12}|\d{15}|\d{20})$/.test(i(t)) && d.unshift("Track123");
51353
- let f = d.find((e) => e === Vf(t));
51359
+ let f = d.find((e) => e === Hf(t));
51354
51360
  return {
51355
51361
  sources: f ? [f, ...d.filter((e) => e !== f)] : d,
51356
51362
  carrier: a,
51357
51363
  tier: (e) => o?.[e] ?? "unknown",
51358
- rank: (e) => Uf(o, e)
51364
+ rank: (e) => Wf(o, e)
51359
51365
  };
51360
51366
  }
51361
- function Jf(e = !1, t) {
51362
- return qf({
51367
+ function Yf(e = !1, t) {
51368
+ return Jf({
51363
51369
  trackingNumber: t,
51364
51370
  enablePostalNinja: e
51365
51371
  }).sources;
51366
51372
  }
51367
- export { pt as AMAZON_NUMBER_PATTERN, Ot as AUTOMATIC_CARRIER_IDS, zf as BROWSER_SOURCES, te as BudgetExceededError, Lt as CARRIERS, lt as CARRIER_CATALOG, y as CARRIER_DEFINITIONS, ut as CARRIER_IDS, kt as CARRIER_NAMES, c as CarrierError, f as ChallengeError, cc as EXPLICIT_OFFSET_PATTERN, u as IndeterminateError, h as InputRequiredError, g as InvalidInputError, Gd as MAX_RECOGNITIONS, m as MaintenanceError, d as NoHistoryError, l as NotFoundError, Kc as RECIPIENT_ACTIONS, p as RateLimitedError, zt as SELECTABLE_CARRIERS, ft as STAGES, ee as SchemaError, In as TRACKING_CANDIDATE_PATTERNS, At as TRACKING_LINK_RULES, _ as TransportError, Rf as UNIVERSAL_SOURCES, re as UpstreamHttpError, ie as UpstreamNetworkError, Et as activeRequirements, vt as amazonMarketplace, yt as amazonOrdersUrl, bt as amazonShippingOrigin, xt as amazonShippingUrl, Vc as calendarDay, Fc as canadaProvinceTimeZone, Ct as carrierAdapter, b as carrierDefinition, ae as carrierErrorKind, Rt as carrierInfo, jt as carrierLinkRules, Ut as carrierRequirements, St as carrierTimezone, An as checksumRejections, wu as classifyStage, du as classifyWording, wc as countryCode, jc as countryKeepsOffset, Tc as countryTimeZone, yd as deliveryHandoff, jn as detectCarrier, S as detectCarrierMatch, zc as epochMillisTime, Bc as epochSecondsTime, ce as errorTypeOf, pl as eventPoint, uc as explicitOffsetTime, Ud as failureHint, Hd as failureKind, Rd as fillPartialAnswer, X as firstOccurrence, o as formatTrackingNumber, vd as hasDirectHandoffAdapter, Tu as inferStage, mt as isAmazonTrackingNumber, Ld as isPartialAnswer, cr as isPhoneNumber, fr as isPlaceholderNumber, a as isPlanzerSharedTrackingNumber, Yt as isValidCorreosSpainCheckLetter, Le as isValidDhlExpressWaybill, Qt as isValidDpdParcelNumber, ln as isValidGlsParcelNumber, un as isValidHermesParcelNumber, ot as isValidMondialRelayBarcode, Je as isValidPocztaPolskaBarcode, x as isValidS10TrackingNumber, Ye as isValidSscc, Be as isValidTntConsignmentNumber, Sn as isValidUspsPackageBarcode, fc as isoTime, Gn as keywordNumberInText, lu as languageStageStatus, Kt as localizedCarrierUrl, Mt as matchesDomain, mc as mislabeledLocalTime, hc as mislabeledWallTime, Of as normalizeCarrierInputs, gl as normalizeCarrierResult, kf as normalizeDeliveryPostcode, i as normalizeTrackingNumber, Gf as orderUniversalSources, or as parseTrackingInput, Dc as postalOfficeZone, Vf as priorityUniversalSource, Yc as recipientAction, Zd as recognitionCandidates, Kd as recognitionNumberShape, ef as recognizeAll, Ln as recognizedNumberInText, Rc as regionHasTown, Dt as requiredRequirements, Wt as requirementSatisfied, ht as requiresAmazonAccount, Du as resolveResult, Cu as resultHasUpdate, xu as resultStage, oe as retryAfterMsOf, vc as settleGuessedClocks, af as settleRecognition, gc as sharedClockZone, Eu as stageSource, gn as supportsSwissPostHandoff, Oc as timeZoneCountry, Ic as townKey, cu as trackingLanguageStage, Pt as trackingLink, Nt as trackingNumberForLink, Gt as tracksAutomatically, qf as universalPlan, Bf as universalSourceBudget, Jf as universalSources, Ac as usStateTimeZone, Nc as usZipState, xn as uspsPackageIdentifier, Nn as validTrackingNumber, Cf as validateDachserTrackingUrl, xf as validateFreightwaysTrackingUrl, hf as validateInstaboxTrackingUrl, Sf as validatePlanzerSharedUrl, Vd as withoutWrittenAhead, fu as wordingStage, se as writtenAheadClocks, dc as zonedTime };
51373
+ export { pt as AMAZON_NUMBER_PATTERN, Ot as AUTOMATIC_CARRIER_IDS, Bf as BROWSER_SOURCES, te as BudgetExceededError, Lt as CARRIERS, lt as CARRIER_CATALOG, y as CARRIER_DEFINITIONS, ut as CARRIER_IDS, kt as CARRIER_NAMES, c as CarrierError, f as ChallengeError, cc as EXPLICIT_OFFSET_PATTERN, u as IndeterminateError, h as InputRequiredError, g as InvalidInputError, Kd as MAX_RECOGNITIONS, m as MaintenanceError, d as NoHistoryError, l as NotFoundError, Kc as RECIPIENT_ACTIONS, p as RateLimitedError, zt as SELECTABLE_CARRIERS, ft as STAGES, ee as SchemaError, In as TRACKING_CANDIDATE_PATTERNS, At as TRACKING_LINK_RULES, _ as TransportError, zf as UNIVERSAL_SOURCES, re as UpstreamHttpError, ie as UpstreamNetworkError, Et as activeRequirements, vt as amazonMarketplace, yt as amazonOrdersUrl, bt as amazonShippingOrigin, xt as amazonShippingUrl, Vc as calendarDay, Fc as canadaProvinceTimeZone, Ct as carrierAdapter, b as carrierDefinition, ae as carrierErrorKind, Rt as carrierInfo, jt as carrierLinkRules, Ut as carrierRequirements, St as carrierTimezone, An as checksumRejections, wu as classifyStage, du as classifyWording, wc as countryCode, jc as countryKeepsOffset, Tc as countryTimeZone, bd as deliveryHandoff, jn as detectCarrier, S as detectCarrierMatch, zc as epochMillisTime, Bc as epochSecondsTime, ce as errorTypeOf, pl as eventPoint, uc as explicitOffsetTime, Wd as failureHint, Ud as failureKind, zd as fillPartialAnswer, X as firstOccurrence, o as formatTrackingNumber, yd as hasDirectHandoffAdapter, Tu as inferStage, mt as isAmazonTrackingNumber, Rd as isPartialAnswer, cr as isPhoneNumber, fr as isPlaceholderNumber, a as isPlanzerSharedTrackingNumber, Yt as isValidCorreosSpainCheckLetter, Le as isValidDhlExpressWaybill, Qt as isValidDpdParcelNumber, ln as isValidGlsParcelNumber, un as isValidHermesParcelNumber, ot as isValidMondialRelayBarcode, Je as isValidPocztaPolskaBarcode, x as isValidS10TrackingNumber, Ye as isValidSscc, Be as isValidTntConsignmentNumber, Sn as isValidUspsPackageBarcode, fc as isoTime, Gn as keywordNumberInText, lu as languageStageStatus, Kt as localizedCarrierUrl, Mt as matchesDomain, mc as mislabeledLocalTime, hc as mislabeledWallTime, kf as normalizeCarrierInputs, gl as normalizeCarrierResult, Af as normalizeDeliveryPostcode, i as normalizeTrackingNumber, Kf as orderUniversalSources, or as parseTrackingInput, Dc as postalOfficeZone, Hf as priorityUniversalSource, Yc as recipientAction, Qd as recognitionCandidates, qd as recognitionNumberShape, tf as recognizeAll, Ln as recognizedNumberInText, Rc as regionHasTown, Dt as requiredRequirements, Wt as requirementSatisfied, ht as requiresAmazonAccount, Du as resolveResult, Cu as resultHasUpdate, xu as resultStage, oe as retryAfterMsOf, vc as settleGuessedClocks, of as settleRecognition, gc as sharedClockZone, Eu as stageSource, gn as supportsSwissPostHandoff, Oc as timeZoneCountry, Ic as townKey, cu as trackingLanguageStage, Pt as trackingLink, Nt as trackingNumberForLink, Gt as tracksAutomatically, Jf as universalPlan, Vf as universalSourceBudget, Yf as universalSources, Ac as usStateTimeZone, Nc as usZipState, xn as uspsPackageIdentifier, Nn as validTrackingNumber, wf as validateDachserTrackingUrl, Sf as validateFreightwaysTrackingUrl, gf as validateInstaboxTrackingUrl, Cf as validatePlanzerSharedUrl, Hd as withoutWrittenAhead, fu as wordingStage, se as writtenAheadClocks, dc as zonedTime };
@@ -0,0 +1,13 @@
1
+ import type { AdapterFactory, TrackingContext } from '../../core/adapter/index.js';
2
+ import type { CarrierResult } from '../../core/result/index.js';
3
+ import { type StepRecorder } from '../../core/telemetry/index.js';
4
+ export declare class AirspeedTracker {
5
+ private readonly options;
6
+ constructor(options?: {
7
+ fetcher?: typeof fetch;
8
+ userAgent?: string;
9
+ recorder?: StepRecorder;
10
+ });
11
+ fetch(raw: string, context?: TrackingContext): Promise<CarrierResult>;
12
+ }
13
+ export declare const adapter: AdapterFactory;
@@ -0,0 +1,44 @@
1
+ import { ChallengeError, SchemaError, TransportError } from '../../core/errors/index.js';
2
+ import { runSteps } from '../../core/runner/index.js';
3
+ import { firstAttemptMs, networkRetryStep } from '../../core/runner/networkRetry.js';
4
+ import { NOOP_RECORDER } from '../../core/telemetry/index.js';
5
+ import { decodeText, fetchBounded } from '../../core/transport/boundedFetch.js';
6
+ import { userAgentOf } from '../../core/transport/userAgent.js';
7
+ import { airspeedUrl, normalizeAirspeedNumber, parseAirspeed, PROVIDER } from './parser.js';
8
+ export class AirspeedTracker {
9
+ options;
10
+ constructor(options = {}) {
11
+ this.options = options;
12
+ }
13
+ async fetch(raw, context = {}) {
14
+ context.signal?.throwIfAborted();
15
+ const number = normalizeAirspeedNumber(raw), url = airspeedUrl(number);
16
+ const read = async (signal, timeoutMs) => {
17
+ const { response, bytes } = await fetchBounded(url, { signal,
18
+ headers: { Accept: 'text/html', 'User-Agent': userAgentOf(this.options.userAgent) },
19
+ }, { provider: PROVIDER, fetcher: this.options.fetcher, timeoutMs: Math.max(1, Math.floor(timeoutMs)), maxBytes: 1024 * 1024,
20
+ redirect: 'manual', allowHttpStatuses: [301, 302, 303, 307, 308, 401, 403, 404, 410] });
21
+ signal.throwIfAborted();
22
+ if (response.status === 403)
23
+ throw new ChallengeError(PROVIDER, 'Airspeed refused cargo tracking');
24
+ if (response.status !== 200)
25
+ throw new TransportError(PROVIDER, 'Airspeed cargo tracking is unavailable', { status: response.status });
26
+ if (response.url && response.url !== url)
27
+ throw new SchemaError(PROVIDER, 'Airspeed returned another tracking route');
28
+ const html = decodeText(bytes).replace(/^\uFEFF/, '');
29
+ if (response.headers.get('cf-mitigated') === 'challenge' || /_cf_chl_opt|cf-turnstile|hcaptcha|grecaptcha|<title>\s*(?:Just a moment|Access Denied|Attention Required)|verify (?:that )?you are human|checking your browser/i.test(html.slice(0, 64_000))) {
30
+ throw new ChallengeError(PROVIDER, 'Airspeed returned browser verification');
31
+ }
32
+ return parseAirspeed(html, number);
33
+ };
34
+ return runSteps({ carrier: 'airspeed', budgetMs: context.budgetMs ?? 15_000, signal: context.signal,
35
+ recorder: this.options.recorder ?? NOOP_RECORDER }, [
36
+ { id: 'direct', run: ({ signal, remainingMs }) => read(signal, firstAttemptMs(remainingMs)) },
37
+ networkRetryStep(({ signal, remainingMs }) => read(signal, remainingMs)),
38
+ ]);
39
+ }
40
+ }
41
+ export const adapter = environment => {
42
+ const tracker = new AirspeedTracker({ fetcher: environment.fetcher, userAgent: environment.userAgent, recorder: environment.recorder });
43
+ return { id: 'airspeed', recordsSteps: true, steps: ['direct', 'retry'], track: (input, context) => tracker.fetch(input.number, context) };
44
+ };
@@ -21,18 +21,36 @@
21
21
  "timezone": "Asia/Manila",
22
22
  "tracking": {
23
23
  "mode": "automatic",
24
- "adapter": "universal",
25
- "steps": []
24
+ "adapter": "airspeed",
25
+ "steps": [
26
+ "direct",
27
+ "retry"
28
+ ],
29
+ "localClocks": true
26
30
  },
27
- "capabilities": [],
31
+ "capabilities": [
32
+ "history"
33
+ ],
28
34
  "portal": {
29
35
  "url": "https://logistics.airspeed.com.ph/track/TrackingSearch.aspx?waybill={trackingNumber}",
30
36
  "searchUrl": "https://airspeed.ph/track-cargo/",
31
37
  "canaryUrl": "https://airspeed.ph/track-cargo/",
32
- "shows": [],
33
- "scraped": [],
34
- "discarded": [],
35
- "unavailable": []
38
+ "shows": [
39
+ "status",
40
+ "history"
41
+ ],
42
+ "scraped": [
43
+ "status",
44
+ "history"
45
+ ],
46
+ "discarded": [
47
+ "references",
48
+ "destination_details",
49
+ "location_remarks"
50
+ ],
51
+ "unavailable": [
52
+ "eta"
53
+ ]
36
54
  },
37
55
  "links": [
38
56
  {
@@ -0,0 +1,5 @@
1
+ import type { CarrierResult } from '../../core/result/index.js';
2
+ export declare const PROVIDER = "Airspeed";
3
+ export declare function normalizeAirspeedNumber(raw: string): string;
4
+ export declare function airspeedUrl(raw: string): string;
5
+ export declare function parseAirspeed(html: string, raw: string): CarrierResult;
@@ -0,0 +1,92 @@
1
+ import { load } from 'cheerio';
2
+ import { isAirspeedReference } from '../../core/detection/airspeed.js';
3
+ import { normalizeTrackingNumber } from '../../core/detection/normalize.js';
4
+ import { InvalidInputError, NoHistoryError, SchemaError } from '../../core/errors/index.js';
5
+ import { languageStageStatus } from '../../core/status/index.js';
6
+ import { calendarDay } from '../../core/time/index.js';
7
+ import { clean } from '../../core/transport/text.js';
8
+ import { airspeedStage, isAirspeedAdministrative } from './status.js';
9
+ export const PROVIDER = 'Airspeed';
10
+ export function normalizeAirspeedNumber(raw) {
11
+ const number = typeof raw === 'string' && raw.length <= 64 ? normalizeTrackingNumber(raw) : '';
12
+ if (!/^[A-Z0-9]{5,40}$/.test(number))
13
+ throw new InvalidInputError(PROVIDER, 'Airspeed needs a cargo waybill');
14
+ if (!isAirspeedReference(number))
15
+ throw new NoHistoryError(PROVIDER, 'The verified cargo route supports nine-digit waybills', { reason: 'unsupported_reference' });
16
+ return number;
17
+ }
18
+ export function airspeedUrl(raw) {
19
+ return `https://logistics.airspeed.com.ph/track/TrackingSearch.aspx?${new URLSearchParams({ waybill: normalizeAirspeedNumber(raw) })}`;
20
+ }
21
+ function clock(value) {
22
+ const match = /^(0?[1-9]|1[0-2])\/(0?[1-9]|[12]\d|3[01])\/(\d{4}) (0?[1-9]|1[0-2]):([0-5]\d):([0-5]\d) (AM|PM)$/i.exec(value);
23
+ const day = match ? calendarDay(Number(match[3]), Number(match[1]), Number(match[2])) : null;
24
+ if (!match || !day)
25
+ throw new SchemaError(PROVIDER, 'Airspeed returned an invalid local scan clock');
26
+ const hour = Number(match[4]) % 12 + (match[7].toUpperCase() === 'PM' ? 12 : 0);
27
+ return `${day}T${String(hour).padStart(2, '0')}:${match[5]}:${match[6]}`;
28
+ }
29
+ function wording(value) {
30
+ const text = clean(value, 1001);
31
+ if (!text || text.length > 300 || /[<>@]|https?:|\d{7,}|\b(?:signed by|recipient|consignee|receiver|signature|phone)\b/i.test(text)) {
32
+ throw new SchemaError(PROVIDER, 'Airspeed returned an invalid logistics status');
33
+ }
34
+ return text;
35
+ }
36
+ const LABELS = ['TRACKING NUMBER:', 'BOOKING DATE:', 'REFERENCE ID:', 'DESTINATION:', 'CURRENT SCANNING DATE/TIME:', 'CURRENT STATUS:'];
37
+ export function parseAirspeed(html, raw) {
38
+ const number = normalizeAirspeedNumber(raw), $ = load(html);
39
+ $('script,style,template').remove();
40
+ const label = $('td').filter((_, el) => clean($(el).text()) === LABELS[0]);
41
+ if (label.length !== 1)
42
+ throw new SchemaError(PROVIDER, 'Airspeed returned no unique shipment summary');
43
+ const rows = label.closest('table').children('tbody').children('tr');
44
+ if (rows.length !== LABELS.length)
45
+ throw new SchemaError(PROVIDER, 'Airspeed changed its shipment summary');
46
+ const fields = new Map();
47
+ for (const row of rows.toArray()) {
48
+ const cells = $(row).children('td'), key = clean(cells.first().text());
49
+ if (cells.length !== 2 || !LABELS.includes(key) || fields.has(key))
50
+ throw new SchemaError(PROVIDER, 'Airspeed returned ambiguous shipment facts');
51
+ fields.set(key, cells.eq(1));
52
+ }
53
+ const fact = (key) => clean(fields.get(key).text(), 1000);
54
+ const bound = fact('TRACKING NUMBER:'), tables = $('#GridViewWaybillHistory');
55
+ if (tables.length > 1)
56
+ throw new SchemaError(PROVIDER, 'Airspeed returned several histories');
57
+ if (!bound && !tables.length && ['REFERENCE ID:', 'DESTINATION:', 'CURRENT SCANNING DATE/TIME:', 'CURRENT STATUS:'].every(key => !fact(key))) {
58
+ // This empty view also invents a booking date from the server clock. It proves no booking or definite absence.
59
+ throw new NoHistoryError(PROVIDER, 'The cargo tracker returned no retained shipment', { reason: 'expired_or_unknown' });
60
+ }
61
+ if (bound !== number)
62
+ throw new SchemaError(PROVIDER, 'Airspeed returned another whole waybill');
63
+ if (!tables.length)
64
+ throw new NoHistoryError(PROVIDER, 'Airspeed knows the waybill but returned no history', { reason: 'parcel_found' });
65
+ const scans = tables.children('tbody').children('tr'), header = scans.first().children('th').toArray().map(el => clean($(el).text()));
66
+ if (header.join('|') !== 'DATE/TIME|STATUS|LOCATION/REMARKS' || scans.length > 501)
67
+ throw new SchemaError(PROVIDER, 'Airspeed changed its history columns or exceeded the row limit');
68
+ const events = [];
69
+ for (const row of scans.slice(1).toArray()) {
70
+ const cells = $(row).children('td');
71
+ if (cells.length !== 3)
72
+ throw new SchemaError(PROVIDER, 'Airspeed changed a history row');
73
+ const local_time = clock(clean(cells.eq(0).text(), 80)), description = wording(cells.eq(1).text());
74
+ const stage = airspeedStage(null, description);
75
+ // LOCATION/REMARKS mixes places with receiver/POD details; it is not a location field.
76
+ events.push({ local_time, description, ...(stage ? { stage, stage_source: 'carrier_map' } : {}) });
77
+ }
78
+ if (!events.length)
79
+ throw new NoHistoryError(PROVIDER, 'Airspeed returned no dated history', { reason: 'parcel_found' });
80
+ const current = wording(fact('CURRENT STATUS:')), updated = clock(fact('CURRENT SCANNING DATE/TIME:'));
81
+ const matches = (event) => event.local_time === updated && event.description === current;
82
+ if (matches(events.at(-1)))
83
+ events.reverse();
84
+ else if (!matches(events[0]))
85
+ throw new SchemaError(PROVIDER, 'Airspeed summary and history disagree');
86
+ const seen = new Set(), distinct = events.filter(event => { const key = JSON.stringify(event); if (seen.has(key))
87
+ return false; seen.add(key); return true; });
88
+ const stage = airspeedStage(null, current) ?? (isAirspeedAdministrative(current) ? distinct.find(event => event.stage)?.stage : undefined);
89
+ return { status: stage ? languageStageStatus(stage) : 'unknown', ...(stage ? { current_stage: stage, current_stage_source: 'carrier_map' } : {}),
90
+ last_status_text: current, last_update: null, last_update_local: updated, expected_delivery: null,
91
+ ...(distinct.length > 100 ? { history_truncated: true } : {}), events: distinct.slice(0, 100) };
92
+ }
@@ -0,0 +1,5 @@
1
+ import type { Stage } from '../../core/status/index.js';
2
+ import { type CarrierStatusMap } from '../../core/status/statusMap.js';
3
+ export declare function airspeedStage(_code: string | null, wording: string): Stage | undefined;
4
+ export declare function isAirspeedAdministrative(wording: string): boolean;
5
+ export declare const statusMap: CarrierStatusMap;
@@ -0,0 +1,11 @@
1
+ import { normalizeStatusWording } from '../../core/status/statusMap.js';
2
+ const WORDS = new Map([
3
+ ['for pick-up', 'registered'], ['picked', 'accepted'],
4
+ ['received at aic whse', 'accepted'], ['delivered', 'delivered'],
5
+ ]);
6
+ export function airspeedStage(_code, wording) {
7
+ return WORDS.get(normalizeStatusWording(wording));
8
+ }
9
+ export function isAirspeedAdministrative(wording) { return normalizeStatusWording(wording) === 'manifested'; }
10
+ export const statusMap = { stage: airspeedStage, gaps: [],
11
+ gapNote: (_code, wording) => isAirspeedAdministrative(wording) ? 'Manifest preparation records no movement and keeps the preceding custody stage.' : undefined };
@@ -1,4 +1,29 @@
1
1
  {
2
2
  "carrier": "airspeed",
3
- "entries": []
3
+ "entries": [
4
+ {
5
+ "wording": "For Pick-Up",
6
+ "stage": "registered",
7
+ "language": "en",
8
+ "confirmedBy": "portal"
9
+ },
10
+ {
11
+ "wording": "Picked",
12
+ "stage": "accepted",
13
+ "language": "en",
14
+ "confirmedBy": "portal"
15
+ },
16
+ {
17
+ "wording": "Received at AIC WHSE",
18
+ "stage": "accepted",
19
+ "language": "en",
20
+ "confirmedBy": "portal"
21
+ },
22
+ {
23
+ "wording": "Delivered",
24
+ "stage": "delivered",
25
+ "language": "en",
26
+ "confirmedBy": "portal"
27
+ }
28
+ ]
4
29
  }
@@ -19,6 +19,7 @@ import { isKargoturkReference } from '../detection/kargoturk.js';
19
19
  import { isProfitFieldsReference } from '../detection/profitFields.js';
20
20
  import { isLmParcelReference } from '../detection/lmParcel.js';
21
21
  import { isZnlogicReference } from '../detection/znlogic.js';
22
+ import { isAirspeedReference } from '../detection/airspeed.js';
22
23
  import { isFreightwaysGlobalReference } from '../detection/freightwaysGlobal.js';
23
24
  import { isFxdcPostReference } from '../detection/fxdcPost.js';
24
25
  import { isFrontierCaReference } from '../detection/frontierCa.js';
@@ -28,7 +29,7 @@ import { countryCode } from '../time/index.js';
28
29
  // Adapters that refuse every other reference before a request: asking them
29
30
  // about a partner's number only fails, however often the hand-off is retried.
30
31
  const REFERENCES_LOOKED_UP = {
31
- 'freightways-global': isFreightwaysGlobalReference, 'fxdc-post': isFxdcPostReference, 'frontier-ca': isFrontierCaReference,
32
+ airspeed: isAirspeedReference, 'freightways-global': isFreightwaysGlobalReference, 'fxdc-post': isFxdcPostReference, 'frontier-ca': isFrontierCaReference,
32
33
  topdelivery: isTopdeliveryReference, kargoturk: isKargoturkReference, expedico: isExpedicoReference, 'fan-courier': isFanCourierReference,
33
34
  'profit-fields': isProfitFieldsReference, 'lm-parcel': isLmParcelReference, znlogic: isZnlogicReference,
34
35
  'fez-delivery': isFezDeliveryReference,
@@ -735,6 +735,7 @@ import { statusMap as kargoturk } from '../../carriers/kargoturk/status.js';
735
735
  import { statusMap as profitFields } from '../../carriers/profit-fields/status.js';
736
736
  import { statusMap as lmParcel } from '../../carriers/lm-parcel/status.js';
737
737
  import { statusMap as znlogic } from '../../carriers/znlogic/status.js';
738
+ import { statusMap as airspeed } from '../../carriers/airspeed/status.js';
738
739
  import { statusMap as freightwaysGlobal } from '../../carriers/freightways-global/status.js';
739
740
  import { statusMap as fxdcPost } from '../../carriers/fxdc-post/status.js';
740
741
  import { statusMap as frontierCa } from '../../carriers/frontier-ca/status.js';
@@ -744,7 +745,7 @@ import { normalizeStatusWording } from '../status/statusMap.js';
744
745
  import { CARRIER_DEFINITIONS } from './definitions.js';
745
746
  /** By adapter: a carrier served by another's adapter, as Delivengo by La Poste's, reads that map. */
746
747
  export const STATUS_MAPS = {
747
- topdelivery, kargoturk, expedico, 'profit-fields': profitFields, 'lm-parcel': lmParcel, znlogic, 'freightways-global': freightwaysGlobal, 'fxdc-post': fxdcPost, 'frontier-ca': frontierCa,
748
+ airspeed, topdelivery, kargoturk, expedico, 'profit-fields': profitFields, 'lm-parcel': lmParcel, znlogic, 'freightways-global': freightwaysGlobal, 'fxdc-post': fxdcPost, 'frontier-ca': frontierCa,
748
749
  'fez-delivery': fezDelivery,
749
750
  'junfeng-international': junfengInternational,
750
751
  'shipglobal-us': shipglobalUs,
@@ -0,0 +1,2 @@
1
+ /** Guest-route eligibility, without claiming ownership of the shared numeric shape. */
2
+ export declare function isAirspeedReference(raw: string): boolean;
@@ -0,0 +1,5 @@
1
+ import { normalizeTrackingNumber } from './normalize.js';
2
+ /** Guest-route eligibility, without claiming ownership of the shared numeric shape. */
3
+ export function isAirspeedReference(raw) {
4
+ return typeof raw === 'string' && raw.length <= 64 && /^(?!0{9}$)\d{9}$/.test(normalizeTrackingNumber(raw));
5
+ }
@@ -6932,7 +6932,8 @@
6932
6932
  "timezone": "Asia/Manila",
6933
6933
  "tracking": {
6934
6934
  "mode": "automatic",
6935
- "adapter": "universal"
6935
+ "adapter": "airspeed",
6936
+ "localClocks": true
6936
6937
  },
6937
6938
  "canaryUrl": "https://airspeed.ph/track-cargo/",
6938
6939
  "trackingUrlTemplate": "https://logistics.airspeed.com.ph/track/TrackingSearch.aspx?waybill={trackingNumber}",
@@ -6933,7 +6933,8 @@ export const CARRIER_CATALOG = {
6933
6933
  "timezone": "Asia/Manila",
6934
6934
  "tracking": {
6935
6935
  "mode": "automatic",
6936
- "adapter": "universal"
6936
+ "adapter": "airspeed",
6937
+ "localClocks": true
6937
6938
  },
6938
6939
  "canaryUrl": "https://airspeed.ph/track-cargo/",
6939
6940
  "trackingUrlTemplate": "https://logistics.airspeed.com.ph/track/TrackingSearch.aspx?waybill={trackingNumber}",
@@ -14,6 +14,7 @@ import { adapter as aciExpressKr } from '../carriers/aci-express-kr/adapter.js';
14
14
  import { adapter as acsCourier } from '../carriers/acs-courier/adapter.js';
15
15
  import { adapter as aexParaguay } from '../carriers/aex-paraguay/adapter.js';
16
16
  import { adapter as airpakExpress } from '../carriers/airpak-express/adapter.js';
17
+ import { adapter as airspeed } from '../carriers/airspeed/adapter.js';
17
18
  import { adapter as aitWorldwide } from '../carriers/ait-worldwide/adapter.js';
18
19
  import { adapter as ajex } from '../carriers/ajex/adapter.js';
19
20
  import { adapter as algeriePoste } from '../carriers/algerie-poste/adapter.js';
@@ -746,6 +747,7 @@ export const REGISTRY = {
746
747
  "acs-courier": acsCourier,
747
748
  "aex-paraguay": aexParaguay,
748
749
  "airpak-express": airpakExpress,
750
+ "airspeed": airspeed,
749
751
  "ait-worldwide": aitWorldwide,
750
752
  "ajex": ajex,
751
753
  "algerie-poste": algeriePoste,
@@ -1501,7 +1503,7 @@ export const REGISTRY = {
1501
1503
  "airmee": "universal",
1502
1504
  "airpak-express": "airpak-express",
1503
1505
  "airroad": "universal",
1504
- "airspeed": "universal",
1506
+ "airspeed": "airspeed",
1505
1507
  "airwings-india": "universal",
1506
1508
  "ait-home-delivery": "universal",
1507
1509
  "ait-worldwide": "ait-worldwide",
@@ -2,7 +2,7 @@
2
2
  "openapi": "3.1.0",
3
3
  "info": {
4
4
  "title": "Universal Parcel Scraper",
5
- "version": "0.975.2-main.5283"
5
+ "version": "0.976.0-main.5284"
6
6
  },
7
7
  "paths": {
8
8
  "/health": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "universal-parcel-scraper",
3
- "version": "0.975.2-main.5283",
3
+ "version": "0.976.0-main.5284",
4
4
  "description": "Self-hosted parcel tracking: carrier detection, dedicated scrapers and optional universal providers.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",