@keploy/capture-sdk 3.2.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -27
- package/dist/body-jobs.d.ts +2 -2
- package/dist/body-redact.js +1 -1
- package/dist/body-redact.js.map +1 -1
- package/dist/body-redact.mjs +1 -1
- package/dist/body-redact.mjs.map +1 -1
- package/dist/body-worker-none.js +1 -1
- package/dist/body-worker-none.js.map +1 -1
- package/dist/body-worker-none.mjs +1 -1
- package/dist/body-worker-none.mjs.map +1 -1
- package/dist/body-worker-start.js +1 -1
- package/dist/body-worker-start.js.map +1 -1
- package/dist/body-worker-start.mjs +1 -1
- package/dist/body-worker-start.mjs.map +1 -1
- package/dist/body-worker-unbundled.mjs +1 -1
- package/dist/body-worker-unbundled.mjs.map +1 -1
- package/dist/identity.d.ts +4 -4
- package/dist/index.bundler.mjs +1 -1
- package/dist/index.bundler.mjs.map +1 -1
- package/dist/index.d.ts +4 -5
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/network.d.ts +9 -9
- package/dist/privacy.d.ts +20 -26
- package/dist/recorder.d.ts +29 -25
- package/dist/request-term.js +1 -1
- package/dist/request-term.js.map +1 -1
- package/dist/request-term.mjs +1 -1
- package/dist/request-term.mjs.map +1 -1
- package/dist/strict-attributes.js +1 -1
- package/dist/strict-attributes.js.map +1 -1
- package/dist/strict-attributes.mjs +1 -1
- package/dist/strict-attributes.mjs.map +1 -1
- package/dist/transport.d.ts +16 -16
- package/dist/types.d.ts +8 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -74,7 +74,7 @@ which moves both figures by a few bytes either way (MEASURED for
|
|
|
74
74
|
local names are shortened: that is what keeps an SDK that redacts what
|
|
75
75
|
it records, in the browser, within its budget: 40 KiB, and 41,316 B for
|
|
76
76
|
the CommonJS build, set on 2026-11-11 as 40 KiB plus the 356 B its
|
|
77
|
-
format cost then (as built now, the format costs
|
|
77
|
+
format cost then (as built now, the format costs 203 B). Body
|
|
78
78
|
redaction is not in it: it runs in
|
|
79
79
|
a Web Worker, `dist/body-worker.js` (9.3 kB gzipped), which your bundler
|
|
80
80
|
emits beside your app and the SDK starts when a capture that redacts
|
|
@@ -181,23 +181,23 @@ any other kind of Keploy credential here.
|
|
|
181
181
|
Those two are the only required fields. The others, with the value the
|
|
182
182
|
SDK uses when you leave them out:
|
|
183
183
|
|
|
184
|
-
| option | default | what it does
|
|
185
|
-
| --------------------- | ------------ |
|
|
186
|
-
| `privacyMode` | `"balanced"` | `"balanced"` masks every typed input value; `"strict"`, for public sites, records no page text -- it also masks every visible text node, blanks every attribute, `<meta>` content and comment that holds text, records no request or response body and replaces every query value in a URL; `"off"` masks only password and hidden fields — see [Privacy](#privacy)
|
|
187
|
-
| `sampleRate` | `1` | fraction of captures recorded, rolled when `init()` starts one: `0.1` records one in ten; the rest never start. A later `init()` returns the same capture, sampled out or not, and rolls again only after `stop()` or the session's end. Under `continuous`, each session after a recorded one is recorded too, with no new roll
|
|
188
|
-
| `networkCapture` | `true` | record `fetch` and `XMLHttpRequest` exchanges. `false` records the DOM only
|
|
189
|
-
| `maxSessionDuration` | `600000` | milliseconds after which a session ends on its own (10 minutes): recording stops, the queue is flushed, and a later `init()` starts a new session -- or, with `continuous`, the next one starts by itself
|
|
190
|
-
| `continuous` | `false` | keep capturing for the life of the page, one session at a time: a session that ends (at `maxSessionDuration`, or because the server completed or filled it) is followed by a new one at the visitor's next click, tap or key press, so an idle tab posts nothing. Has no effect with a `sessionIdGenerator`: that id is yours, and a second session under it would be refused — see [Single-page apps](#single-page-apps)
|
|
191
|
-
| `batchSize` | `50` | events per POST, as a ceiling: clamped to 5000, the most the ingest server accepts in one batch, and a batch is also cut at the server's 10 MiB body cap, so large events make more, smaller POSTs rather than one the server would refuse
|
|
192
|
-
| `batchInterval` | `5000` | milliseconds between flushes. Each flush sends ONE batch, so a backlog drains at a batch per interval (after an outage, the first upload accepted sends it all)
|
|
193
|
-
| `maxQueueSize` | `5000` | events held in memory while waiting to send; past this, or past 16 MiB of them, the oldest are dropped
|
|
194
|
-
| `maxBodySize` | `524288` | how much of a request or response body is recorded (512 KB), counted in UTF-16 code units — see [What a large body looks like](#what-a-large-body-looks-like)
|
|
195
|
-
| `maskSelectors` | — | CSS selectors whose matched elements have their text masked, including every text node below them. Input values are decided by `privacyMode` alone
|
|
196
|
-
| `unmaskSelectors` | — | CSS selectors whose text is left in the clear, overriding `maskSelectors` and `"strict"` for the subtree below them. It cannot unmask an input value
|
|
197
|
-
| `privacy` | — | a `Partial<PrivacyConfig>`: `maskSelectors`, `unmaskSelectors`, `blockSelectors`, `maskNetworkBodies`, `sensitiveHeaders`, `piiPatterns`, `secretRoutes`, `keepRoutes` — see [Privacy](#privacy)
|
|
198
|
-
| `sessionIdGenerator` | — | supply your own session id instead of the SDK's UUID v4, to correlate with your own systems. It must be a string of 1-200 characters of letters, digits, dot, dash and underscore with no empty dot-separated segment (`tenant-7.user_42.run-3`; encode a `user:42/session 1` first) — the SDK checks what the generator produces before sending and refuses to start on anything else, a throw included (`KUI_E_SESSION_ID_INVALID`). Two live sessions with one id are refused by the server (a terminal `409`)
|
|
199
|
-
| `honorPrivacySignals` | `true` | when the browser sends Do Not Track (`navigator.doNotTrack === "1"`) or Global Privacy Control (`navigator.globalPrivacyControl === true`), `init()` records, patches and sends nothing and reports `KUI_E_CAPTURE_DECLINED` to `onError` a task later, paced, for every declined `init()` but one made while 16 wait (see `onError` below), and by `console.info` once per page. `false` records regardless — only where the site has its own lawful basis and says so in its privacy policy
|
|
200
|
-
| `onError` | — | called once when a terminal condition ends the capture — see [When the server rejects a batch](#when-the-server-rejects-a-batch)
|
|
184
|
+
| option | default | what it does |
|
|
185
|
+
| --------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
186
|
+
| `privacyMode` | `"balanced"` | `"balanced"` masks every typed input value; `"strict"`, for public sites, records no page text -- it also masks every visible text node, blanks every attribute, `<meta>` content and comment that holds text, records no request or response body and replaces every query value in a URL; `"off"` masks only password and hidden fields — see [Privacy](#privacy) |
|
|
187
|
+
| `sampleRate` | `1` | fraction of captures recorded, rolled when `init()` starts one: `0.1` records one in ten; the rest never start. A later `init()` returns the same capture, sampled out or not, and rolls again only after `stop()` or the session's end. Under `continuous`, each session after a recorded one is recorded too, with no new roll |
|
|
188
|
+
| `networkCapture` | `true` | record `fetch` and `XMLHttpRequest` exchanges. `false` records the DOM only |
|
|
189
|
+
| `maxSessionDuration` | `600000` | milliseconds after which a session ends on its own (10 minutes): recording stops, the queue is flushed, and a later `init()` starts a new session -- or, with `continuous`, the next one starts by itself |
|
|
190
|
+
| `continuous` | `false` | keep capturing for the life of the page, one session at a time: a session that ends (at `maxSessionDuration`, or because the server completed or filled it) is followed by a new one at the visitor's next click, tap or key press, so an idle tab posts nothing. Up to 16 pre-interaction GET/HEAD 2xx–3xx boot reads (<= 65,536 characters each, within 5 s of `init()`) are retained and re-emitted asynchronously with `optional: true` when an unpaused next session opens, and cleared on `stop()` or terminal refusal. Has no effect with a `sessionIdGenerator`: that id is yours, and a second session under it would be refused — see [Single-page apps](#single-page-apps) |
|
|
191
|
+
| `batchSize` | `50` | events per POST, as a ceiling: clamped to 5000, the most the ingest server accepts in one batch, and a batch is also cut at the server's 10 MiB body cap, so large events make more, smaller POSTs rather than one the server would refuse |
|
|
192
|
+
| `batchInterval` | `5000` | milliseconds between flushes. Each flush sends ONE batch, so a backlog drains at a batch per interval (after an outage, the first upload accepted sends it all) |
|
|
193
|
+
| `maxQueueSize` | `5000` | events held in memory while waiting to send; past this, or past 16 MiB of them, the oldest are dropped |
|
|
194
|
+
| `maxBodySize` | `524288` | how much of a request or response body is recorded (512 KB), counted in UTF-16 code units — see [What a large body looks like](#what-a-large-body-looks-like) |
|
|
195
|
+
| `maskSelectors` | — | CSS selectors whose matched elements have their text masked, including every text node below them. Input values are decided by `privacyMode` alone |
|
|
196
|
+
| `unmaskSelectors` | — | CSS selectors whose text is left in the clear, overriding `maskSelectors` and `"strict"` for the subtree below them. It cannot unmask an input value |
|
|
197
|
+
| `privacy` | — | a `Partial<PrivacyConfig>`: `maskSelectors`, `unmaskSelectors`, `blockSelectors`, `maskNetworkBodies`, `sensitiveHeaders`, `piiPatterns`, `secretRoutes`, `keepRoutes` — see [Privacy](#privacy) |
|
|
198
|
+
| `sessionIdGenerator` | — | supply your own session id instead of the SDK's UUID v4, to correlate with your own systems. It must be a string of 1-200 characters of letters, digits, dot, dash and underscore with no empty dot-separated segment (`tenant-7.user_42.run-3`; encode a `user:42/session 1` first) — the SDK checks what the generator produces before sending and refuses to start on anything else, a throw included (`KUI_E_SESSION_ID_INVALID`). Two live sessions with one id are refused by the server (a terminal `409`) |
|
|
199
|
+
| `honorPrivacySignals` | `true` | when the browser sends Do Not Track (`navigator.doNotTrack === "1"`) or Global Privacy Control (`navigator.globalPrivacyControl === true`), `init()` records, patches and sends nothing and reports `KUI_E_CAPTURE_DECLINED` to `onError` a task later, paced, for every declined `init()` but one made while 16 wait (see `onError` below), and by `console.info` once per page. `false` records regardless — only where the site has its own lawful basis and says so in its privacy policy |
|
|
200
|
+
| `onError` | — | called once when a terminal condition ends the capture — see [When the server rejects a batch](#when-the-server-rejects-a-batch) |
|
|
201
201
|
|
|
202
202
|
After `init`, the static surface is:
|
|
203
203
|
|
|
@@ -423,7 +423,7 @@ has loaded. Once rrweb loads, held events are delivered in the same session
|
|
|
423
423
|
alongside the initial DOM snapshot. If rrweb (or under `strict`,
|
|
424
424
|
`strict-attributes`) cannot be loaded, or if `stop()` is called mid-import,
|
|
425
425
|
`fetch` and `XMLHttpRequest` are restored synchronously and all held events
|
|
426
|
-
and bodies are dropped unsent. Requests made
|
|
426
|
+
and bodies are dropped unsent. Requests made _before_ `init()` is called
|
|
427
427
|
are still outside the SDK's reach, so call `init()` as early in startup as
|
|
428
428
|
you can.
|
|
429
429
|
|
|
@@ -571,8 +571,14 @@ PATHS (`/search/<term>`, a `#/search/<q>` route, a `<link
|
|
|
571
571
|
rel="canonical">`; only query and fragment-pair values are replaced),
|
|
572
572
|
`id`s and `class`es, `data-testid` (kept as written because the replay
|
|
573
573
|
finds elements by it; an app that builds one from user data,
|
|
574
|
-
`row-${email}`, records it), a field's `name
|
|
575
|
-
|
|
574
|
+
`row-${email}`, records it), a field's `name` (still present in the
|
|
575
|
+
recorded DOM, though flow extraction withholds the `[name=…]` selector
|
|
576
|
+
rung), SVG geometry (a signature pad's strokes are its `d`) and text
|
|
577
|
+
under `unmaskSelectors`. In addition, `strict` stamps
|
|
578
|
+
`data-keploy-mask=""` on `<html>` and `<a>` in every serialized DOM
|
|
579
|
+
snapshot and mutation so the flow engine fails closed on all four
|
|
580
|
+
attribute selector rungs (`href`, `name`, `title`, `placeholder`) while
|
|
581
|
+
keeping `data-testid`, `aria-label`, stable `id`, and semantic classes. A comment
|
|
576
582
|
outside `<html>` that changes after the snapshot is recorded as rrweb
|
|
577
583
|
records it. And the replay's look pays for it: CSS keyed on a `data-*`
|
|
578
584
|
(`[data-theme=dark]`, Radix's `data-state=open`) or on a `title` no
|
|
@@ -592,9 +598,12 @@ recorded — a video, a chat widget, a wall of customer names — rrweb
|
|
|
592
598
|
records an empty box of the same size in their place.
|
|
593
599
|
|
|
594
600
|
`maskSelectors` masks the text of the elements it matches and of
|
|
595
|
-
everything below them
|
|
596
|
-
|
|
597
|
-
|
|
601
|
+
everything below them, and stamps `data-keploy-mask=""` onto those
|
|
602
|
+
elements in serialized DOM events so flow extraction also withholds
|
|
603
|
+
attribute selector rungs (`href`, `name`, `title`, `placeholder`);
|
|
604
|
+
`unmaskSelectors` is the text-only exception to both it
|
|
605
|
+
and `strict`, for the subtree below what it matches: nothing you can
|
|
606
|
+
name a selector for will un-mask an input value.
|
|
598
607
|
Each has a top-level spelling and a `privacy.` one, and the two lists
|
|
599
608
|
are merged rather than one taking precedence.
|
|
600
609
|
|
|
@@ -1796,7 +1805,7 @@ the SDK wraps none of them (see [Single-page apps](#single-page-apps)) and
|
|
|
1796
1805
|
says so once per capture, naming the method:
|
|
1797
1806
|
|
|
1798
1807
|
```
|
|
1799
|
-
[keploy] KUI_E_NAVIGATION_UNWRAPPED:
|
|
1808
|
+
[keploy] KUI_E_NAVIGATION_UNWRAPPED: could not wrap History/Navigation API; capture continues with basic route tracking. evidence={"method":"history.back"}
|
|
1800
1809
|
```
|
|
1801
1810
|
|
|
1802
1811
|
`KUI_E_EVENT_UNSERIALISABLE` (evidence `eventId`, `eventType`,
|
|
@@ -1839,7 +1848,7 @@ such request in a capture logs
|
|
|
1839
1848
|
entry of the same corpus, on one line of the same shape:
|
|
1840
1849
|
|
|
1841
1850
|
```
|
|
1842
|
-
[keploy] KUI_E_REQUEST_TERM_FAILED: recorded
|
|
1851
|
+
[keploy] KUI_E_REQUEST_TERM_FAILED: recorded request without term/body:* (failed); request unaffected, further failures silent. evidence={"method":"POST","reason":"RangeError: Maximum call stack size exceeded"}
|
|
1843
1852
|
```
|
|
1844
1853
|
|
|
1845
1854
|
A page that cannot run the SDK's body worker or load its body chunk (see
|
|
@@ -1857,7 +1866,7 @@ logs `KUI_E_BODY_WORKER_UNAVAILABLE` (evidence `part`: `worker` or
|
|
|
1857
1866
|
corpus, once per page for each part, at its first failure:
|
|
1858
1867
|
|
|
1859
1868
|
```
|
|
1860
|
-
[keploy] KUI_E_BODY_WORKER_UNAVAILABLE:
|
|
1869
|
+
[keploy] KUI_E_BODY_WORKER_UNAVAILABLE: body worker/chunk missing (evidence.part): >64 KiB cut or redacted bodies dropped (unproven); allow worker-src 'self' and serve dist/. evidence={"part":"worker","reason":"the worker's script did not load or run (refused by the page's CSP, a 404, or a script that does not parse)"}
|
|
1861
1870
|
```
|
|
1862
1871
|
|
|
1863
1872
|
### The last batch
|
package/dist/body-jobs.d.ts
CHANGED
|
@@ -159,7 +159,7 @@ export declare const streamRelay: () => BodyCode["relayBody"] | undefined;
|
|
|
159
159
|
*/
|
|
160
160
|
export declare class BodyJobs {
|
|
161
161
|
/** Jobs not yet recorded, in the order they were handed over. */
|
|
162
|
-
private
|
|
162
|
+
private bjHeld;
|
|
163
163
|
/**
|
|
164
164
|
* Redact `job`'s bodies, off the main thread, and call `record` with
|
|
165
165
|
* them. A null job has nothing to redact (bodies masked whole), and is
|
|
@@ -179,7 +179,7 @@ export declare class BodyJobs {
|
|
|
179
179
|
*/
|
|
180
180
|
answered(held: Held, out: BodyOut | null): void;
|
|
181
181
|
/** Record `held` with `out`, once. */
|
|
182
|
-
|
|
182
|
+
private bjAnswer;
|
|
183
183
|
/**
|
|
184
184
|
* With no worker: redact `held` here, in a task of its own once the relay
|
|
185
185
|
* is over, each body up to the budget (the founder's rule is per body: a
|
package/dist/body-redact.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e){return e.includes("%")?e.replace(X,e=>decodeURIComponent(e)):e}function t(t,n){return e(t).split("key"===n?/[[\]]+/:/[[\].]+/).map(e=>e.toLowerCase().replace(/[-_$+\s]/g,"")).filter(e=>""!==e)}function n(e,t){return!(ie.has(e)||"page"===t&&le.has(e))&&(ee.has(e)||te.has(e)||ne.has(e)||re.test(e))}function r(e,r){return function(e,t){return e.some(e=>n(e,t))||e.length>1&&n(e.join(""),t)}(t(e,r),r)}function i(e,t,n){let r=e.indexOf("#"),i=-1===r?e:e.slice(0,r),l=i.indexOf("?"),s=-1===l?i:i.slice(0,l),u=-1===l?null:i.slice(l+1),f=-1===r?null:e.slice(r+1),d=o(s,t)+(null===u?"":`?${a(u,t,n,s)}`)+(null===f?"":`#${c(f,t,n,s)}`);return d===e?e:d}function l(e,t=!1){if(t){let t=e.search(/\s/);return-1===t?e.length:t}let n=0,r=0,i=0;for(let t=0;t<e.length;t++){let l=e[t];if(/[\s,;"'<>\\`]/.test(l))return t;if("("===l)n++;else if("["===l)r++;else if("{"===l)i++;else{if(")"===l&&0===n--)return t;if("]"===l&&0===r--)return t;if("}"===l&&0===i--)return t}}return e.length}function s(t,n){let i=t;for(let t=0;t<4;t++){let t=e(i);if(t===i)break;i=t}for(let e of i.matchAll(/(?:^|[?&;#])([^?&;#=/\s]+)=/g))if(r(e[1],n))return!0;return!1}function a(t,n,o=0,c=""){let f=t.split(n.whole?/(&)/:se),d=f.filter((e,t)=>t%2==0),p={path:c,pairs:d,depth:o};return d.map(t=>{let c=t.indexOf("=");if(-1===c)return!0===n.bare?.(t)?"[REDACTED]":t;let f=t.slice(0,c),d=t.slice(c+1);if(""===d)return t;let h=function(e){let t=e.replace(/\+/g," ");if(!/%/.test(t))return t;if(/%(?![0-9A-Fa-f]{2})/.test(t))return e;try{return decodeURIComponent(t)}catch{return e}}(d),g=()=>`${f}=[REDACTED]`,x=n.before?.(f,d,p)??null;if(null!==x)return`${f}=${x}`;if(n.strict||(n.whole?function(e){let t=[],n=e.split(se);for(let e=0;e<n.length;e+=2){let r=n[e].indexOf("=");r>0&&t.push(n[e].slice(0,r))}return t}(t):[f]).some(e=>r(e,n.kind))||!0===n.value?.(f,d,h)){if(!0!==n.spaced)return g();let e=l(d,n.form),t=d.slice(e);return`${f}=${0!==e||n.form?"[REDACTED]":""}${n.tail?.(t)??t}`}if(o>=ae&&(oe.test(h)||ce.test(h)))return"page"===n.kind||s(h,n.kind)?g():t;let y=function(e,t,n){return/^[a-z][a-z0-9+.-]*:\/\//i.test(e)?u(e,t,n+1):e.startsWith("/")?i(e,t,n+1):ce.test(e)?/[?#]/.test(e)?i(e,t,n+1):a(e,t,n+1):null}(h,n,o);return null!==y&&y!==h?n.whole?g():!0!==n.raw?`${f}=${encodeURIComponent(y)}`:d===h?`${f}=${y}`:encodeURIComponent(h)===d?`${f}=${encodeURIComponent(y)}`:g():e(h)!==h&&s(h,n.kind)?g():t}).map((e,t)=>(0===t?"":f[2*t-1])+e).join("")}function o(e,t){let n=e.split("/"),i=n.map(e=>e.split(";")[0]);return n.map((n,s)=>{if(!0===t.segment?.(n))return"[REDACTED]";let a=n.indexOf(";"),o=i[s],c=!0===t.head?.(e,o,s,i)?"[REDACTED]":o;return-1===a?c:c+n.slice(a).replace(/;([^;=]+)=([^;]*)/g,(e,n,i)=>{let s=!0===t.spaced?l(i,t.form):i.length;return s>0&&r(n,t.kind)?`;${n}=[REDACTED]${i.slice(s)}`:e})}).join("/")}function c(e,t,n,r=""){let i=e.indexOf("?");if(-1!==i){let l=e.slice(0,i);return`${o(l,t)}?${a(e.slice(i+1),t,n,`${r}/${l}`)}`}let l=e.indexOf("=");if(-1!==l&&!e.slice(0,l).includes("/"))return a(e,t,n,r);let s=-1===l?null:/^([^&;]*)([&;])/.exec(e);return null!==s?`${o(s[1],t)}${s[2]}${a(e.slice(s[0].length),t,n,`${r}/${s[1]}`)}`:o(e,t)}function u(e,t,n){if(t.whole||!0===t.raw||!ue.test(e))return f(e,t,n);let r;try{r=new URL(e)}catch{return f(e,t,n)}let i=r.search.slice(1),l=r.hash.slice(1),s=o(r.pathname,t),u=r.search?a(i,t,n,r.pathname):"",d=r.hash?c(l,t,n,r.pathname):"";return s===r.pathname&&u===i&&d===l&&""===r.username&&""===r.password?e:`${r.protocol}//${r.host}`+s+(r.search?`?${u}`:"")+(r.hash?`#${d}`:"")}function f(e,t,n){let r=/^([a-z][a-z0-9+.-]*:)([/\\]*)([^/\\?#]*)/i.exec(e),[l,s,a,o]=r,c=""===a?-1:o.lastIndexOf("@"),u=s+a+o.slice(c+1)+i(e.slice(l.length),t,n);return u===e?e:u}function d(e,t){let n,r=e.length-e.trimStart().length,l=e.length-e.trimEnd().length,s=e.slice(r,e.length-l);return/^(?:javascript|vbscript|data|blob):/i.test(s)?e:(n=/^[a-z][a-z0-9+.-]*:/i.test(s)?u(s,t,0):i(s,t,0),n===s?e:e.slice(0,r)+n+e.slice(e.length-l))}function p(e,t,n,r){let i=t,l=0,s=0;for(;i<e.length;i++){let t=e[i];if(de.test(t)||r&&","===t&&(he.lastIndex=i+1,he.test(e)))break;if(n)if("("===t)l++;else if("["===t)s++;else if(")"===t||"]"===t){if(0===(")"===t?l:s))break;")"===t?l--:s--}}return function(e,t,n){let r=0,i=0;for(let l=t;l<n;l++){let t=e[l];"("===t?r++:")"===t?r--:"["===t?i++:"]"===t&&i--}for(;n>t;){let t=e[n-1];if(")"===t){if(r>=0)break;r++}else if("]"===t){if(i>=0)break;i++}else if(!pe.includes(t))break;n--}return n}(e,t,i)}function h(e){return t(e,"key").join("")}function g(e){let t=!1,n=!1,r=!1,i=!1;for(let[l,s]of e){if("granttype"===l&&ze.has(s.trim().toLowerCase())||"codeverifier"===l)return!0;Ae.has(l)&&(t=!0,s.length>=10&&(r=!0)),Oe.has(l)&&(n=!0),"state"===l&&x(s)&&(i=!0)}return t&&(n||i&&r)}function x(e){return e.length>=16&&/^[A-Za-z0-9_\-.~+/=]+$/.test(e)&&/[A-Za-z]/.test(e)&&(/\d/.test(e)||/[a-z]/.test(e)&&/[A-Z]/.test(e))&&!function(e){return!!we.test(e)&&(e.length<=16||ve.test(e)||/^[A-Za-z][a-z]+(?:[-_][A-Za-z][a-z]+)+$/.test(e))}(e)&&!function(e){return/^(?:[A-Z]+|[A-Z]?[a-z]+)\d*(?:[-_](?:(?:[A-Z]+|[A-Z]?[a-z]+)\d*|\d+))+$/.test(e)&&/(?:^|[-_])[A-Za-z]+(?:[-_]|$)/.test(e)}(e)}function y(e){return r(e,"key")}function k(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||46===e||95===e||37===e||43===e||45===e}function m(e){if(e.length<13||e.length>19)return!1;let t="4"===e[0]&&(13===e.length||16===e.length||19===e.length),n=/^(5[1-5]|2[2-7])/.test(e)&&16===e.length,r=/^3[47]/.test(e)&&15===e.length,i=/^6(?:011|5)/.test(e)&&16===e.length,l=/^(?:35|3[068])/.test(e)&&e.length>=14&&e.length<=19;return!!(t||n||r||i||l)&&function(e){let t=0,n=!1;for(let r=e.length-1;r>=0;r--){let i=e.charCodeAt(r)-48;if(i<0||i>9)return!1;n&&(i*=2,i>9&&(i-=9)),t+=i,n=!n}return t%10==0}(e)}function b(e,t,n){for(let r of e.matchAll(t))""!==r[0]&&n.push([r.index,r.index+r[0].length])}function w(e,t,n){b(e,Re,n),b(e,Ie,n),function(e,t){let n=0,r=e.indexOf("@");for(;-1!==r;){let i=Math.max(n,r-64),l=r;for(;l>i&&k(e.charCodeAt(l-1));)l--;if(l<r){Se.lastIndex=r+1;let i=Se.exec(e);if(i){n=r+1+i[0].length,t.push([l,n]),r=e.indexOf("@",n);continue}}r=e.indexOf("@",r+1)}}(e,n),b(e,Ce,n),b(e,je,n),b(e,De,n),function(e,t){for(let n of e.matchAll(/\b(?:\d[ -]?){12,18}\d\b/g))m(n[0].replace(/[^0-9]/g,""))&&t.push([n.index,n.index+n[0].length])}(e,n);for(let r of t)b(e,r,n)}function v(e,t){if(0===t.length)return e;t.sort((e,t)=>e[0]-t[0]||t[1]-e[1]);let n="",r=0,[i,l,s]=t[0];for(let a=1;a<=t.length;a++){let o=t[a];void 0!==o&&o[0]<l?(o[1]>l&&(l=o[1]),s=void 0):(n+=e.slice(r,i)+(s??xe),r=l,void 0!==o&&([i,l,s]=o))}return n+e.slice(r)}function z(e,t=Te){let n=e.replace(Me,e=>Le.test(Fe.exec(e)[0])?d(e,t):e),r=function(e,t){let n=[];for(let[r,i]of function(e,t=!1){let n=[];fe.lastIndex=0;for(let r=fe.exec(e);null!==r;r=fe.exec(e)){let i=r.index+(r.groups?.attr?.length??0);ge.lastIndex=i;let l=void 0!==r.groups?.attr&&ge.test(e);l&&(i=ge.lastIndex);let s=r.groups?.attr??"",a=p(e,i,!/["']$/.test(s)||/^url\(/i.test(s)||l,t);"{"===e[a]&&a>i&&"$"===e[a-1]&&a--,a>i&&n.push([i,a]),fe.lastIndex=Math.max(a,r.index+r[0].length,i+1)}return n}(e,!0===t.list)){let l=e.slice(r,i),s=d(l,t);s!==l&&n.push([r,i,s])}return n}(n,t);if(0===r.length)return A(n,t);let i="",l=0;for(let[e,t,s]of r)i+=n.slice(l,e)+s,l=t;return A(i+n.slice(l),t)}function A(e,t){return/:(?:\\\/|\\u002[fF])/.test(e)?e.replace(qe,e=>{let n="",r=[];for(let t=0;t<e.length;){r.push(t);let i=Je.exec(e.slice(t,t+6));n+=null===i?e[t]:"/",t+=null===i?1:i[0].length}r.push(e.length);let i=d(n,t);if(i===n)return e;let l=0;for(;l<i.length&&i[l]===n[l];)l++;let s=0;for(;s<i.length-l&&s<n.length-l&&i[i.length-1-s]===n[n.length-1-s];)s++;let a=/\\\/|\\u002[fF]/.exec(e)[0];return e.slice(0,r[l])+i.slice(l,i.length-s).replace(/\//g,a)+e.slice(r[n.length-s])}):e}function $(t){if(!/[%+]/.test(t))return!1;let n=j(t);if(n===t)return!1;if(e(n)!==n&&s(n,"param"))return!0;let r=z(n);if(r===n)return!1;let i=[];return T(n,i),v(n,i)!==r}function O(e,t){return"scalar"===t.kind?/^(?:true|false)$/.test(e.slice(t.start,t.end)):"array"===t.kind&&t.items.every(t=>O(e,t))}function Z(e,n,r,i,l,s){let a=e=>{s.push([n.start,n.end,e])};if("deep"===n.kind)return a(Ne);if("scalar"===n.kind&&e.startsWith("null",n.start)||O(e,n))return;let o=null!==r&&function(e){return t(e,"key").some(e=>Ze.has(e)||e.endsWith("otp"))}(r);if(null!==r&&y(r)&&(!o||!function(e){return"object"===e.kind||"array"===e.kind}(n))&&("string"===n.kind||!function(e){return t(e,"key").some(e=>_e.has(e))}(r)))return a(Ne);if("scalar"===n.kind){let t=e.slice(n.start,n.end),r=/^\d+$/.test(t)?t:function(e){if(!/^-?\d/.test(e))return null;let t=Number(e);return Number.isInteger(t)?String(t):null}(t);null!==r&&m(r)&&a(Ne);return}if("string"===n.kind){let e=S(n.value,i,l)??function(e,t){if(!e)return e;let n=[];return T(e,n,"string"),w(e,t,n),v(e,n)}(z(n.value),l);e!==n.value&&a(JSON.stringify(e));return}if("array"===n.kind){for(let t of n.items)Z(e,t,r,i+1,l,s);return}let c=n.entries.some(({key:e,value:t})=>Ke.has(e.toLowerCase())&&"string"===t.kind&&y(t.value)),u=n.entries.some(({key:e})=>ke.has(h(e))),f=g(n.entries.map(({key:e,value:t})=>[h(e),"string"===t.kind?t.value:""]));for(let{key:t,value:r}of n.entries)O(e,r)||(u&&ye.has(h(t))?s.push([r.start,r.end,Ne]):!(f&&$e.has(h(t))||o&&"code"===h(t))||"scalar"===r.kind&&e.startsWith("null",r.start)?c&&Ye.has(t.toLowerCase())?s.push([r.start,r.end,Ne]):Z(e,r,y(t)?t:null,i+1,l,s):s.push([r.start,r.end,Ne]))}function _(e,t,n){let r=[];return Z(e,function(e,t){let n=0,r=()=>{for(;n<e.length;){let t=e.charCodeAt(n);if(32!==t&&9!==t&&10!==t&&13!==t)break;n++}},i=()=>{n++;let t="",r=n;for(;'"'!==e[n];){if("\\"!==e[n]){n++;continue}t+=e.slice(r,n);let i=e[n+1];"u"===i?(t+=String.fromCharCode(parseInt(e.slice(n+2,n+6),16)),n+=6):(t+=Be[i],n+=2),r=n}return t+=e.slice(r,n),n++,t},l=t=>{r();let s=n;if(t>Ee)return(()=>{let t=0;do{let r=e[n];if('"'===r){for(n++;'"'!==e[n];)n+="\\"===e[n]?2:1;n++}else if("{"===r||"["===r)t++,n++;else if("}"===r||"]"===r)t--,n++;else{if(0===t&&(","===r||":"===r))break;n++}}while(t>0||n<e.length&&!/[\s,\]}]/.test(e[n]))})(),{kind:"deep",start:s,end:n};let a=e[n];if("{"===a){n++;let a=[];if(r(),"}"===e[n])n++;else for(;;){r();let s=i();if(r(),n++,a.push({key:s,value:l(t+1)}),r(),"}"===e[n++])break}return{kind:"object",start:s,end:n,entries:a}}if("["===a){n++;let i=[];if(r(),"]"===e[n])n++;else for(;i.push(l(t+1)),r(),"]"!==e[n++];);return{kind:"array",start:s,end:n,items:i}}if('"'===a){let e=i();return{kind:"string",start:s,end:n,value:e}}for(;n<e.length&&!/[\s,\]}]/.test(e[n]);)n++;return{kind:"scalar",start:s,end:n}};return l(t)}(e,t),null,t,n,r),function(e,t){if(0===t.length)return e;t.sort((e,t)=>e[0]-t[0]);let n="",r=0;for(let[i,l,s]of t)n+=e.slice(r,i)+s,r=l;return n+e.slice(r)}(e,r)}function S(e,t,n){if(!/^\s*[[{]/.test(e))return null;try{JSON.parse(e)}catch{return null}return _(e,t+1,n)}function I(e,t,n=[]){if(null==e||""===e)return e??null;if(function(e){return be.some(t=>t.test(e))}(e))return e;if((t??"").toLowerCase().includes("json")||/^\s*[[{]/.test(e)){try{JSON.parse(e)}catch{return me}return _(e,0,n)}let i=e.endsWith(Ge),l=i?e.slice(0,-Ge.length):e,s=z(l,We),a=function(e,t){if(lt.test(t))return function(e){return e.split("&").every(U)}(e);if(it.test(t))return!0;let n=e.endsWith(Ge),r=(n?e.slice(0,-Ge.length):e).split("&"),i=r.length-1;return r.some(e=>e.includes("="))&&r.every((e,t)=>n&&t===i||U(e))}(i?s+Ge:s,t??""),o=a||s===l?s:z(l,Ue),c=i?o+Ge:o,u=function(e,t,n){if(!lt.test(t))return null;let i=e.endsWith(Ge),l=i?e.slice(0,-Ge.length):e,s=st.exec(t),a=null!==s?s[1]??s[2]:/^--([^\r\n]{1,200})\r?\n/.exec(l)?.[1]??null;if(null===a)return null;let o="--"+a,c=l.startsWith(o)?0:l.indexOf("\n"+o);if(-1===c)return null;c>0&&(c+=1);let u=[];for(L(l,0,c,n,u);;){let e=c+o.length;if(l.startsWith("--",e)&&-1===l.indexOf("\n"+o,e)){L(l,e+2,l.length,n,u);break}let t=l.indexOf("\n",e);if(-1===t)break;let i=t+1,s=-1;for(;i<l.length;){let e=l.indexOf("\n",i);if(-1===e)break;if(e===i||e===i+1&&"\r"===l[i]){s=e+1;break}i=e+1}let a=-1===s?l.length:s;if(L(l,t+1,a,n,u),-1===s)break;let f=l.indexOf("\n"+o,s),d=-1===f?l.length:f;-1!==f&&d>s&&"\r"===l[d-1]&&d--;let p=l.slice(t+1,a),h=at.exec(p),g=null===h?"":h[1]??h[2],x=ot.test(p)||r(g,"param")?null:S(l.slice(s,d),0,n);if(ot.test(p)||r(g,"param")?u.push([s,d]):null!==x&&x!==l.slice(s,d)?u.push([s,d,x]):L(l,s,d,n,u),-1===f)break;c=f+1}return v(l,u)+(i?Ge:"")}(c,t??"",n);if(null!==u)return u;if(lt.test(t??"")&&!a)return ct;let f=function(e,t,n,i=!1){let l=e.endsWith(Ge),s=l?e.slice(0,-Ge.length):e,a=s.split("&");if(!n){let e=[];return T(s,e,i?"code":"text"),0===e.length?null:(w(s,t,e),v(s,e)+(l?Ge:""))}let o=[];w(s,t,o);let c,u=/[%+]/.test(s),f=D(u?s.length:0),d=rt.test(s),p=[],x=g(a.flatMap(e=>{let t=e.indexOf("=");return-1===t?[]:[[h(j(e.slice(0,t))),j(e.slice(t+1))]]})),y=[],k=0;for(let e of a){let n=e.indexOf("="),i=-1===n?k+e.length:k+n,l=k+e.length,a=f.length;u&&N(s,k,i,f),-1!==n&&u&&(E(f,"=",i,i+1),N(s,i+1,l,f)),-1!==n&&(r(e.slice(0,n),"param")||x&&$e.has(h(j(e.slice(0,n)))))||-1!==n&&$(s.slice(i+1,l))?o.push([i+1,l]):-1!==n&&null!==(c=P(s,i+1,l,t))?3===c.length?y.push(c):o.push(c):d&&(W(s,k,l,o),u&&p.push(a,f.length)),k+=e.length,k<s.length&&(u&&E(f,"&",k,k+1),k++)}if(u){let e=[],n=f.parts.join("");w(n,t,e);for(let t=0;t<p.length;t+=2)W(n,p[t],p[t+1],e);for(let[t,n]of e)o.push([f.start[t],f.end[n-1]])}let m=o.filter(([e,t])=>!function(e,t,n){let r=0,i=e.length-1;for(;r<=i;){let l=r+i>>1,[s,a]=e[l];if(t<s)i=l-1;else{if(!(t>=a))return n<=a;r=l+1}}return!1}(y,e,t));return v(s,[...m,...y])+(l?Ge:"")}(c,n,a,/(?:java|ecma)script/i.test(t??""));return null!==f?f:function(e,t=[]){if(!e)return e;let n=[];return w(e,t,n),v(e,n)}(c,n)}function C(e,t){return e.length>t?e.slice(0,t)+Ge:e}function j(e){if(!/[%+]/.test(e))return e;let t=D(e.length);return N(e,0,e.length,t),t.parts.join("")}function R(e,t){if(t+2>e.length)return-1;let n=parseInt(e[t],16),r=parseInt(e[t+1],16);return Number.isNaN(n)||Number.isNaN(r)?-1:16*n+r}function D(e){return{parts:[],start:new Int32Array(e),end:new Int32Array(e),length:0}}function E(e,t,n,r){e.parts.push(t);for(let i=0;i<t.length;i++)e.start[e.length]=n,e.end[e.length]=r,e.length++}function B(e,t,n,r){if(!(t>=n)){r.parts.push(e.slice(t,n));for(let e=t;e<n;e++)r.start[r.length]=e,r.end[r.length]=e+1,r.length++}}function N(e,t,n,r){let i={parts:r.parts.length,length:r.length},l=t,s=t;for(;s<n;){let a=e.charCodeAt(s);if(43!==a&&37!==a){s++;continue}if(B(e,l,s,r),43===a){E(r," ",s,s+1),l=++s;continue}let o=s+3<=n?R(e,s+1):-1,c=-1,u=128,f=191;o>=0&&o<128?c=0:o>=194&&o<=223?c=1:o>=224&&o<=239?(c=2,224===o&&(u=160),237===o&&(f=159)):o>=240&&o<=244&&(c=3,240===o&&(u=144),244===o&&(f=143));let d=c<=0?o:o&63>>c;for(let t=1;t<=c&&d>=0;t++){let r=s+3*t,i=r+3<=n&&"%"===e[r]?R(e,r+1):-1;d=i<(1===t?u:128)||i>(1===t?f:191)?-1:d<<6|63&i}if(c<0||d<0){r.parts.length=i.parts,r.length=i.length,B(e,t,n,r);return}let p=s+3*(c+1);E(r,String.fromCodePoint(d),s,p),l=s=p}B(e,l,n,r)}function T(e,t,n="text"){let i="code"===n?Ve:"string"===n?Xe:"header"===n?et:Qe,l="text"===n&&/<script/i.test(e)?function(e){let t=[],n=/<script\b/gi,r=/<\/script\s*>/gi;for(let i=n.exec(e);null!==i;i=n.exec(e)){let l=e.indexOf(">",i.index);if(-1===l)break;r.lastIndex=l+1;let s=r.exec(e),a=null===s?e.length:s.index;t.push([l+1,a]),n.lastIndex=a}return t}(e):[],s=0;i.lastIndex=0;for(let a=i.exec(e);null!==a;a=i.exec(e)){if(!r(a[2],"param"))continue;if(l.length>0&&(/^[ \t\r\f\v>]$/.test(a[1])||"#"===a[1]&&(!/[\w/%~-]/.test(e[a.index-1]??"")||e.startsWith("*/",a.index-2)||/(?:^|[^\w$/%~.-])(?:static|accessor)$/.test(e.slice(Math.max(0,a.index-9),a.index))))){for(;s<l.length&&l[s][1]<=a.index;)s++;if(s<l.length&&l[s][0]<=a.index)continue}let o=a.index+a[0].length;tt.lastIndex=o;let c=tt.exec(e);if(null===c)continue;"string"===n&&(nt.lastIndex=o,c=nt.exec(e)??c);let u=o+c[0].length;t.push([o,u]),i.lastIndex=u}}function U(e){let t=e.indexOf("="),n=(-1===t?e:e.slice(0,t)).trim();return He.test(n)&&(-1===t||!/\s/.test(e.slice(t+1)))}function W(e,t,n,r){let i=!1;for(let r=t;r<n&&!i;r++){let t=e.charCodeAt(r);i=63===t||59===t||38===t||10===t}if(!i)return;let l=[];T(e.slice(t,n),l);for(let[e,n]of l)r.push([t+e,t+n])}function P(e,t,n,r){let i=e.slice(t,n);if(!/^(?:%7B|%5B|[[{])/i.test(i))return null;if(/[%+]/.test(i)){let e=j(i),l=S(e,0,r);return null===l||l===e?null:[t,n]}let l=S(i,0,r);return null===l||l===i?null:[t,n,l]}function L(e,t,n,r,i){if(t>=n)return;let l=e.slice(t,n),s=[];w(l,r,s),T(l,s);for(let[e,n]of s)i.push([t+e,t+n])}function F(e,t,n){let r,{end:i,say:l,finished:s}=n,a=new TextDecoder,o={pull(o){r||(r=e.getReader(),n.touched=!0);let c=()=>r.read().then(e=>{if(e.done){n.reported||i(C(n.text+a.decode(),t)),s(),o.close(),o.byobRequest?.respond(0);return}let r=function(e){if("Uint8Array"===function(e){return V??=Reflect.get(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag)??{},"get"),"function"==typeof V?Reflect.apply(V,e,[]):void 0}(e))return e;throw new TypeError("a response body chunk is not a Uint8Array")}(e.value);if(!r.byteLength)return c();n.reported||(n.text+=a.decode(r,{stream:!0}),n.text.length>t&&(l(C(n.text,t)),n.text="",setTimeout(s,1e3))),o.enqueue(new Uint8Array(r))});return c().catch(e=>{throw i(function(e){return e+Ge}(n.text)),r.cancel(e).catch(()=>{}),e})},cancel:t=>(i(n.text),(r??e).cancel(t))},c=Object.getPrototypeOf(e).constructor,u=e=>new c({...o,type:e},{highWaterMark:0});try{return u(ft)}catch{return u()}}function M(e,t,n,r){return null===e||e.length<=r?I(e,t,n):function(e,t){return`[Body cut: ${e} of ${t} characters kept, unverified]\n`}(r,e.length)+(r>0?I(e.slice(0,r)+Ge,t,n)??"":"")}function q(e,t=1/0,n=t){return{requestBody:M(e.requestBody,e.requestType,e.patterns,t),responseBody:M(e.responseBody,e.responseType,e.patterns,n)}}var J,K=Object.defineProperty,Y=Object.getOwnPropertyDescriptor,G=Object.getOwnPropertyNames,H=Object.prototype.hasOwnProperty,Q={};((e,t)=>{for(var n in t)K(e,n,{get:t[n],enumerable:!0})})(Q,{redactBodies:()=>q,relayBody:()=>F,version:()=>ut});module.exports=(J=Q,((e,t,n,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let n of G(t))!H.call(e,n)&&void 0!==n&&K(e,n,{get:()=>t[n],enumerable:!(r=Y(t,n))||r.enumerable});return e})(K({},"__esModule",{value:!0}),J));var V,X=/%[0-7][\da-f]|%(?:c[2-9a-f]|d[\da-f])%[89ab][\da-f]|%e0%[ab][\da-f]%[89ab][\da-f]|%e[1-9a-ce-f](?:%[89ab][\da-f]){2}|%ed%[89][\da-f]%[89ab][\da-f]|%f0%[9ab][\da-f](?:%[89ab][\da-f]){2}|%f[1-3](?:%[89ab][\da-f]){3}|%f4%8[\da-f](?:%[89ab][\da-f]){2}/gi,ee=new Set(["password","passwd","pwd","secret","token","accesstoken","refreshtoken","idtoken","authorization","auth","apikey","clientsecret","privatekey","session","sessionid","cookie","ssn","socialsecuritynumber","creditcard","cardnumber","cvv","cvc","pin","passphrase","pass1","pass2","currentpass","rpkey","codeverifier","rawkey","apikeyauth","setcookie","proxyauthorization","samlresponse","confirmkey","tokenhash","clerkticket","nonce","hmac","loginhash","magiclink","phpsessid","oauthverifier","sig","sid","sessid","csrf","xsrf","bearer","authentication","credentials","pass","tokenid","authkey","secretkey","accesskey","clientkey","signingkey","sessionkey","subscriptionkey","functionskey","factorcode","jwtassertion","samlassertion","clientassertion","secretaccesskey","accesskeysecret"]),te=new Set(["invitecode","invitationcode","authcode","authorizationcode","verificationcode","verifycode","confirmationcode","confirmcode","resetcode","mfacode","smscode","otpcode","totpcode","twofactorcode","2facode","logincode","passcode","oobcode","linkcode"]),ne=new Set(["cardexpiry","cardexpiration","cardexpirydate","cardexpirationdate","cardexp","cardexpdate","cardexpmonth","cardexpyear","ccexp","ccexpiry","ccexpiration","ccexpdate","ccexpmonth","ccexpyear","creditcardexpiry","creditcardexpiration","expmonth","expyear","expirymonth","expiryyear","expirationmonth","expirationyear"]),re=/(?:password(?:\d|confirm|confirmation|new|old|repeat|again|verify|retype)?|passwd|secret|token|apikey|privatekey|passphrase|signature|sessionid|jwt|otp|credential|curl)$/,ie=new Set(["pagetoken","nextpagetoken","prevpagetoken","previouspagetoken","pagingtoken","paginationtoken","nexttoken","prevtoken","previoustoken","continuationtoken","nextcontinuationtoken","cursortoken","synctoken","nextsynctoken","startingtoken","starttoken","skiptoken","deltatoken","resumptiontoken","scrolltoken","aftertoken","beforetoken"]),le=new Set(["auth","session","cookie","pin","sig"]),se=/(&|;(?=[^;&=#]+=|end$))/,ae=1,oe=/^(?:[a-z][a-z0-9+.-]*:\/\/|\/)[^?#]*[?#]./i,ce=/[&;?#][^&;=?#]+=/,ue=/^(?:https?:|[a-z][a-z0-9+.-]*:[/\\]{2})/i,fe=/[a-z][a-z0-9+.-]{0,31}:[/\\]{2}|(?<attr>\bcontent\s*=\s*(?:["']\s*)?\d[\d.]*\s*[;,]\s*url\s*=\s*["']?|\b(?:href|src|action|formaction|poster|cite|data|background|longdesc|content|data-src|data-href|xlink:href)\s*=\s*["']?|(?<![\w:.-])[\w:.-]{1,40}\s*=\s*["'](?=\.{0,2}\/|[?#]|[a-z][a-z0-9+.-]{0,31}:\/|[a-z][a-z0-9-]{0,30}[+.][a-z0-9+.-]{0,30}:|localhost:\d{1,5}[/?#]|(?:mailto|tel|sms|urn|data|javascript|vbscript|blob|about|xmpp|sip|sips|magnet|intent|bitcoin|geo|market|news):)|\burl\(\s*["']?)(?=[^\s"'<>])/gi,de=/[\s"'<>\\^`{|}]/,pe=".,;:!?",he=/[a-z][a-z0-9+.-]{0,31}:\/\//iy,ge=/url\(\s*["']?/iy,xe="[REDACTED]",ye=new Set(["expiry","expirydate","expiration","expirationdate","expdate","exp"]),ke=new Set(["cardnumber","creditcard","creditcardnumber","ccnumber","cardnum","pan","cvv","cvc"]),me="[UNPARSEABLE_BODY_NOT_REDACTED]",be=[/^\[Blob: \d+ bytes, truncated\]$/,/^\[Blob: \d+ bytes\]$/,/^\[Binary: \d+ bytes\]$/,/^\[Response body too large: \d+ bytes\]$/,/^\[Response body not read by the page\]$/,/^\[ReadableStream\]$/,/^\[Unreadable body\]$/,/^\[(?:arraybuffer|blob|document|json|text|) response\]$/],we=/^[A-Za-z]+(?:[-_][A-Za-z]+)*$/,ve=/^[A-Za-z][a-z]+(?:[A-Z][a-z]+)+$/,ze=new Set(["authorization_code","urn:ietf:params:oauth:grant-type:device_code"]),Ae=new Set(["code","devicecode"]),$e=new Set([...Ae,"state"]),Oe=new Set(["redirecturi","clientid","verificationuri"]),Ze=new Set(["passcode"]),_e=new Set(["credentials","authentication","pass"]),Se=/[a-zA-Z0-9.-]{1,253}\.[a-zA-Z]{2,63}/y,Ie=/(?<![A-Za-z0-9])(?:kep_[A-Za-z0-9_-]{20,}|gh[pousr]_[A-Za-z0-9]{36,}|github_pat_[A-Za-z0-9_]{22,}|glpat-[A-Za-z0-9_-]{20,}|xox[abprse]-[A-Za-z0-9-]{10,}|[sr]k_(?:live|test)_[A-Za-z0-9]{16,}|sk-(?:proj|ant)-[A-Za-z0-9_-]{20,}|npm_[A-Za-z0-9]{36,}|whsec_[A-Za-z0-9+/=]{24,}|(?:AKIA|ASIA)[0-9A-Z]{16,}|AIza[0-9A-Za-z_-]{35,})/g,Ce=/\b\d{3}-\d{2}-\d{4}\b/g,je=/(?:\+\d{1,3}[ .-]?)?(?:\(\d{3}\)[ .-]?|\b\d{3}[ .-])\d{3}[ .-]\d{4}\b/g,Re=/(?<![A-Za-z0-9_-])eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g,De=/(?<![\d.])(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)(?![\d.])/g,Ee=64,Be={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},Ne=JSON.stringify(xe),Te={kind:"param",strict:!1,whole:!1,raw:!0},Ue={...Te,spaced:!0,tail:e=>z(e,Pe)},We={...Te,spaced:!0,form:!0},Pe={...Te,spaced:!0,list:!0},Le=/^(?=[^={}<>"'\\^`|]*(?:=|$))(?:(?:[a-z][a-z0-9+.-]*:\/|[a-z][a-z0-9-]*[+.][a-z0-9+.-]*:|localhost:\d{1,5}[/?#]|(?:mailto|tel|sms|urn|data|javascript|vbscript|blob|about|xmpp|sip|sips|magnet|intent|bitcoin|geo|market|news):|\.{0,2}\/)[^\s?#]*[?#]|(?:[\w.~%-][\w.~%/-]*)?[?#][^\s=&#]+=|\.{0,2}\/[^\s?#;=]*;)/i,Fe=/^\S*/,Me=/^[^\r\n]*/gm,qe=/[a-z][a-z0-9+.-]{0,31}:(?:\\\/|\\u002[fF]){2}(?:[^\s"'<>\\^`{|}()[\]/]|\/(?![dgimsuvy]*(?![\w$]))|\\\/|\\u002[fF])*/gi,Je=/^(?:\\\/|\\u002[fF])/,Ke=new Set(["key","name","header"]),Ye=new Set(["value","values","expected","actual"]),Ge="...[truncated]",He=/^[A-Za-z0-9_.~!*'()%+[\]-]*$/,Qe=/(^|[?&;\n>#]|(?<!\b(?:var|let|const)|[(){}])[ \t\r\f\v])([\w%-]*(?:\[[\w%-]*\][\w%-]*)*)=/g,Ve=/(^|[?&;\n]|(?<=[\w/%~-])(?<!\*\/|(?:^|[^\w$/%~.-])(?:static|accessor))#)([\w%-]*(?:\[[\w%-]*\][\w%-]*)*)=/g,Xe=/(^|[?&]|(?<=[\w/%~-])(?<!\*\/|(?:^|[^\w$/%~.-])(?:static|accessor))#)([\w%-]*(?:\[[\w%-]*\][\w%-]*)*)=/g,et=/(^|[?&;,\s]|(?<=[\w/%~-])#)([\w%-]*(?:\[[\w%-]*\][\w%-]*)*)=/g,tt=/(?:[^\s&"'`<>\\,;(){}[\]$]|\$(?!\{))+/y,nt=/[^&]+/y,rt=/[?;\n]|%(?:3[FfBb]|26|0[Aa])/,it=/^\s*(?:application\/x-www-form-urlencoded|multipart\/form-data)\s*(?:;|$)/i,lt=/^\s*multipart\/form-data\s*(?:;|$)/i,st=/;\s*boundary\s*=\s*(?:"([^"\r\n]{1,200})"|([^\s;"]{1,200}))/i,at=/^content-disposition\s*:[^\n]*?;\s*name\s*=\s*(?:"([^"\r\n]*)"|([^\s;]+))/im,ot=/^content-disposition\s*:[^\n]*?;\s*filename\*?\s*=/im,ct="[Unreadable body]",ut="3.2.0",ft="bytes";//# sourceMappingURL=body-redact.js.map
|
|
1
|
+
"use strict";function e(e){return e.includes("%")?e.replace(X,e=>decodeURIComponent(e)):e}function t(t,n){return e(t).split("key"===n?/[[\]]+/:/[[\].]+/).map(e=>e.toLowerCase().replace(/[-_$+\s]/g,"")).filter(e=>""!==e)}function n(e,t){return!(ie.has(e)||"page"===t&&le.has(e))&&(ee.has(e)||te.has(e)||ne.has(e)||re.test(e))}function r(e,r){return function(e,t){return e.some(e=>n(e,t))||e.length>1&&n(e.join(""),t)}(t(e,r),r)}function i(e,t,n){let r=e.indexOf("#"),i=-1===r?e:e.slice(0,r),l=i.indexOf("?"),s=-1===l?i:i.slice(0,l),u=-1===l?null:i.slice(l+1),f=-1===r?null:e.slice(r+1),d=o(s,t)+(null===u?"":`?${a(u,t,n,s)}`)+(null===f?"":`#${c(f,t,n,s)}`);return d===e?e:d}function l(e,t=!1){if(t){let t=e.search(/\s/);return-1===t?e.length:t}let n=0,r=0,i=0;for(let t=0;t<e.length;t++){let l=e[t];if(/[\s,;"'<>\\`]/.test(l))return t;if("("===l)n++;else if("["===l)r++;else if("{"===l)i++;else{if(")"===l&&0===n--)return t;if("]"===l&&0===r--)return t;if("}"===l&&0===i--)return t}}return e.length}function s(t,n){let i=t;for(let t=0;t<4;t++){let t=e(i);if(t===i)break;i=t}for(let e of i.matchAll(/(?:^|[?&;#])([^?&;#=/\s]+)=/g))if(r(e[1],n))return!0;return!1}function a(t,n,o=0,c=""){let f=t.split(n.whole?/(&)/:se),d=f.filter((e,t)=>t%2==0),p={path:c,pairs:d,depth:o};return d.map(t=>{let c=t.indexOf("=");if(-1===c)return!0===n.bare?.(t)?"[REDACTED]":t;let f=t.slice(0,c),d=t.slice(c+1);if(""===d)return t;let h=function(e){let t=e.replace(/\+/g," ");if(!/%/.test(t))return t;if(/%(?![0-9A-Fa-f]{2})/.test(t))return e;try{return decodeURIComponent(t)}catch{return e}}(d),g=()=>`${f}=[REDACTED]`,x=n.before?.(f,d,p)??null;if(null!==x)return`${f}=${x}`;if(n.strict||(n.whole?function(e){let t=[],n=e.split(se);for(let e=0;e<n.length;e+=2){let r=n[e].indexOf("=");r>0&&t.push(n[e].slice(0,r))}return t}(t):[f]).some(e=>r(e,n.kind))||!0===n.value?.(f,d,h)){if(!0!==n.spaced)return g();let e=l(d,n.form),t=d.slice(e);return`${f}=${0!==e||n.form?"[REDACTED]":""}${n.tail?.(t)??t}`}if(o>=ae&&(oe.test(h)||ce.test(h)))return"page"===n.kind||s(h,n.kind)?g():t;let y=function(e,t,n){return/^[a-z][a-z0-9+.-]*:\/\//i.test(e)?u(e,t,n+1):e.startsWith("/")?i(e,t,n+1):ce.test(e)?/[?#]/.test(e)?i(e,t,n+1):a(e,t,n+1):null}(h,n,o);return null!==y&&y!==h?n.whole?g():!0!==n.raw?`${f}=${encodeURIComponent(y)}`:d===h?`${f}=${y}`:encodeURIComponent(h)===d?`${f}=${encodeURIComponent(y)}`:g():e(h)!==h&&s(h,n.kind)?g():t}).map((e,t)=>(0===t?"":f[2*t-1])+e).join("")}function o(e,t){let n=e.split("/"),i=n.map(e=>e.split(";")[0]);return n.map((n,s)=>{if(!0===t.segment?.(n))return"[REDACTED]";let a=n.indexOf(";"),o=i[s],c=!0===t.head?.(e,o,s,i)?"[REDACTED]":o;return-1===a?c:c+n.slice(a).replace(/;([^;=]+)=([^;]*)/g,(e,n,i)=>{let s=!0===t.spaced?l(i,t.form):i.length;return s>0&&r(n,t.kind)?`;${n}=[REDACTED]${i.slice(s)}`:e})}).join("/")}function c(e,t,n,r=""){let i=e.indexOf("?");if(-1!==i){let l=e.slice(0,i);return`${o(l,t)}?${a(e.slice(i+1),t,n,`${r}/${l}`)}`}let l=e.indexOf("=");if(-1!==l&&!e.slice(0,l).includes("/"))return a(e,t,n,r);let s=-1===l?null:/^([^&;]*)([&;])/.exec(e);return null!==s?`${o(s[1],t)}${s[2]}${a(e.slice(s[0].length),t,n,`${r}/${s[1]}`)}`:o(e,t)}function u(e,t,n){if(t.whole||!0===t.raw||!ue.test(e))return f(e,t,n);let r;try{r=new URL(e)}catch{return f(e,t,n)}let i=r.search.slice(1),l=r.hash.slice(1),s=o(r.pathname,t),u=r.search?a(i,t,n,r.pathname):"",d=r.hash?c(l,t,n,r.pathname):"";return s===r.pathname&&u===i&&d===l&&""===r.username&&""===r.password?e:`${r.protocol}//${r.host}`+s+(r.search?`?${u}`:"")+(r.hash?`#${d}`:"")}function f(e,t,n){let r=/^([a-z][a-z0-9+.-]*:)([/\\]*)([^/\\?#]*)/i.exec(e),[l,s,a,o]=r,c=""===a?-1:o.lastIndexOf("@"),u=s+a+o.slice(c+1)+i(e.slice(l.length),t,n);return u===e?e:u}function d(e,t){let n,r=e.length-e.trimStart().length,l=e.length-e.trimEnd().length,s=e.slice(r,e.length-l);return/^(?:javascript|vbscript|data|blob):/i.test(s)?e:(n=/^[a-z][a-z0-9+.-]*:/i.test(s)?u(s,t,0):i(s,t,0),n===s?e:e.slice(0,r)+n+e.slice(e.length-l))}function p(e,t,n,r){let i=t,l=0,s=0;for(;i<e.length;i++){let t=e[i];if(de.test(t)||r&&","===t&&(he.lastIndex=i+1,he.test(e)))break;if(n)if("("===t)l++;else if("["===t)s++;else if(")"===t||"]"===t){if(0===(")"===t?l:s))break;")"===t?l--:s--}}return function(e,t,n){let r=0,i=0;for(let l=t;l<n;l++){let t=e[l];"("===t?r++:")"===t?r--:"["===t?i++:"]"===t&&i--}for(;n>t;){let t=e[n-1];if(")"===t){if(r>=0)break;r++}else if("]"===t){if(i>=0)break;i++}else if(!pe.includes(t))break;n--}return n}(e,t,i)}function h(e){return t(e,"key").join("")}function g(e){let t=!1,n=!1,r=!1,i=!1;for(let[l,s]of e){if("granttype"===l&&ze.has(s.trim().toLowerCase())||"codeverifier"===l)return!0;Ae.has(l)&&(t=!0,s.length>=10&&(r=!0)),Oe.has(l)&&(n=!0),"state"===l&&x(s)&&(i=!0)}return t&&(n||i&&r)}function x(e){return e.length>=16&&/^[A-Za-z0-9_\-.~+/=]+$/.test(e)&&/[A-Za-z]/.test(e)&&(/\d/.test(e)||/[a-z]/.test(e)&&/[A-Z]/.test(e))&&!function(e){return!!we.test(e)&&(e.length<=16||ve.test(e)||/^[A-Za-z][a-z]+(?:[-_][A-Za-z][a-z]+)+$/.test(e))}(e)&&!function(e){return/^(?:[A-Z]+|[A-Z]?[a-z]+)\d*(?:[-_](?:(?:[A-Z]+|[A-Z]?[a-z]+)\d*|\d+))+$/.test(e)&&/(?:^|[-_])[A-Za-z]+(?:[-_]|$)/.test(e)}(e)}function y(e){return r(e,"key")}function k(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||46===e||95===e||37===e||43===e||45===e}function m(e){if(e.length<13||e.length>19)return!1;let t="4"===e[0]&&(13===e.length||16===e.length||19===e.length),n=/^(5[1-5]|2[2-7])/.test(e)&&16===e.length,r=/^3[47]/.test(e)&&15===e.length,i=/^6(?:011|5)/.test(e)&&16===e.length,l=/^(?:35|3[068])/.test(e)&&e.length>=14&&e.length<=19;return!!(t||n||r||i||l)&&function(e){let t=0,n=!1;for(let r=e.length-1;r>=0;r--){let i=e.charCodeAt(r)-48;if(i<0||i>9)return!1;n&&(i*=2,i>9&&(i-=9)),t+=i,n=!n}return t%10==0}(e)}function b(e,t,n){for(let r of e.matchAll(t))""!==r[0]&&n.push([r.index,r.index+r[0].length])}function w(e,t,n){b(e,Re,n),b(e,Ie,n),function(e,t){let n=0,r=e.indexOf("@");for(;-1!==r;){let i=Math.max(n,r-64),l=r;for(;l>i&&k(e.charCodeAt(l-1));)l--;if(l<r){Se.lastIndex=r+1;let i=Se.exec(e);if(i){n=r+1+i[0].length,t.push([l,n]),r=e.indexOf("@",n);continue}}r=e.indexOf("@",r+1)}}(e,n),b(e,Ce,n),b(e,je,n),b(e,De,n),function(e,t){for(let n of e.matchAll(/\b(?:\d[ -]?){12,18}\d\b/g))m(n[0].replace(/[^0-9]/g,""))&&t.push([n.index,n.index+n[0].length])}(e,n);for(let r of t)b(e,r,n)}function v(e,t){if(0===t.length)return e;t.sort((e,t)=>e[0]-t[0]||t[1]-e[1]);let n="",r=0,[i,l,s]=t[0];for(let a=1;a<=t.length;a++){let o=t[a];void 0!==o&&o[0]<l?(o[1]>l&&(l=o[1]),s=void 0):(n+=e.slice(r,i)+(s??xe),r=l,void 0!==o&&([i,l,s]=o))}return n+e.slice(r)}function z(e,t=Te){let n=e.replace(Me,e=>Le.test(Fe.exec(e)[0])?d(e,t):e),r=function(e,t){let n=[];for(let[r,i]of function(e,t=!1){let n=[];fe.lastIndex=0;for(let r=fe.exec(e);null!==r;r=fe.exec(e)){let i=r.index+(r.groups?.attr?.length??0);ge.lastIndex=i;let l=void 0!==r.groups?.attr&&ge.test(e);l&&(i=ge.lastIndex);let s=r.groups?.attr??"",a=p(e,i,!/["']$/.test(s)||/^url\(/i.test(s)||l,t);"{"===e[a]&&a>i&&"$"===e[a-1]&&a--,a>i&&n.push([i,a]),fe.lastIndex=Math.max(a,r.index+r[0].length,i+1)}return n}(e,!0===t.list)){let l=e.slice(r,i),s=d(l,t);s!==l&&n.push([r,i,s])}return n}(n,t);if(0===r.length)return A(n,t);let i="",l=0;for(let[e,t,s]of r)i+=n.slice(l,e)+s,l=t;return A(i+n.slice(l),t)}function A(e,t){return/:(?:\\\/|\\u002[fF])/.test(e)?e.replace(qe,e=>{let n="",r=[];for(let t=0;t<e.length;){r.push(t);let i=Je.exec(e.slice(t,t+6));n+=null===i?e[t]:"/",t+=null===i?1:i[0].length}r.push(e.length);let i=d(n,t);if(i===n)return e;let l=0;for(;l<i.length&&i[l]===n[l];)l++;let s=0;for(;s<i.length-l&&s<n.length-l&&i[i.length-1-s]===n[n.length-1-s];)s++;let a=/\\\/|\\u002[fF]/.exec(e)[0];return e.slice(0,r[l])+i.slice(l,i.length-s).replace(/\//g,a)+e.slice(r[n.length-s])}):e}function $(t){if(!/[%+]/.test(t))return!1;let n=j(t);if(n===t)return!1;if(e(n)!==n&&s(n,"param"))return!0;let r=z(n);if(r===n)return!1;let i=[];return T(n,i),v(n,i)!==r}function O(e,t){return"scalar"===t.kind?/^(?:true|false)$/.test(e.slice(t.start,t.end)):"array"===t.kind&&t.items.every(t=>O(e,t))}function Z(e,n,r,i,l,s){let a=e=>{s.push([n.start,n.end,e])};if("deep"===n.kind)return a(Ne);if("scalar"===n.kind&&e.startsWith("null",n.start)||O(e,n))return;let o=null!==r&&function(e){return t(e,"key").some(e=>Ze.has(e)||e.endsWith("otp"))}(r);if(null!==r&&y(r)&&(!o||!function(e){return"object"===e.kind||"array"===e.kind}(n))&&("string"===n.kind||!function(e){return t(e,"key").some(e=>_e.has(e))}(r)))return a(Ne);if("scalar"===n.kind){let t=e.slice(n.start,n.end),r=/^\d+$/.test(t)?t:function(e){if(!/^-?\d/.test(e))return null;let t=Number(e);return Number.isInteger(t)?String(t):null}(t);null!==r&&m(r)&&a(Ne);return}if("string"===n.kind){let e=S(n.value,i,l)??function(e,t){if(!e)return e;let n=[];return T(e,n,"string"),w(e,t,n),v(e,n)}(z(n.value),l);e!==n.value&&a(JSON.stringify(e));return}if("array"===n.kind){for(let t of n.items)Z(e,t,r,i+1,l,s);return}let c=n.entries.some(({key:e,value:t})=>Ke.has(e.toLowerCase())&&"string"===t.kind&&y(t.value)),u=n.entries.some(({key:e})=>ke.has(h(e))),f=g(n.entries.map(({key:e,value:t})=>[h(e),"string"===t.kind?t.value:""]));for(let{key:t,value:r}of n.entries)O(e,r)||(u&&ye.has(h(t))?s.push([r.start,r.end,Ne]):!(f&&$e.has(h(t))||o&&"code"===h(t))||"scalar"===r.kind&&e.startsWith("null",r.start)?c&&Ye.has(t.toLowerCase())?s.push([r.start,r.end,Ne]):Z(e,r,y(t)?t:null,i+1,l,s):s.push([r.start,r.end,Ne]))}function _(e,t,n){let r=[];return Z(e,function(e,t){let n=0,r=()=>{for(;n<e.length;){let t=e.charCodeAt(n);if(32!==t&&9!==t&&10!==t&&13!==t)break;n++}},i=()=>{n++;let t="",r=n;for(;'"'!==e[n];){if("\\"!==e[n]){n++;continue}t+=e.slice(r,n);let i=e[n+1];"u"===i?(t+=String.fromCharCode(parseInt(e.slice(n+2,n+6),16)),n+=6):(t+=Be[i],n+=2),r=n}return t+=e.slice(r,n),n++,t},l=t=>{r();let s=n;if(t>Ee)return(()=>{let t=0;do{let r=e[n];if('"'===r){for(n++;'"'!==e[n];)n+="\\"===e[n]?2:1;n++}else if("{"===r||"["===r)t++,n++;else if("}"===r||"]"===r)t--,n++;else{if(0===t&&(","===r||":"===r))break;n++}}while(t>0||n<e.length&&!/[\s,\]}]/.test(e[n]))})(),{kind:"deep",start:s,end:n};let a=e[n];if("{"===a){n++;let a=[];if(r(),"}"===e[n])n++;else for(;;){r();let s=i();if(r(),n++,a.push({key:s,value:l(t+1)}),r(),"}"===e[n++])break}return{kind:"object",start:s,end:n,entries:a}}if("["===a){n++;let i=[];if(r(),"]"===e[n])n++;else for(;i.push(l(t+1)),r(),"]"!==e[n++];);return{kind:"array",start:s,end:n,items:i}}if('"'===a){let e=i();return{kind:"string",start:s,end:n,value:e}}for(;n<e.length&&!/[\s,\]}]/.test(e[n]);)n++;return{kind:"scalar",start:s,end:n}};return l(t)}(e,t),null,t,n,r),function(e,t){if(0===t.length)return e;t.sort((e,t)=>e[0]-t[0]);let n="",r=0;for(let[i,l,s]of t)n+=e.slice(r,i)+s,r=l;return n+e.slice(r)}(e,r)}function S(e,t,n){if(!/^\s*[[{]/.test(e))return null;try{JSON.parse(e)}catch{return null}return _(e,t+1,n)}function I(e,t,n=[]){if(null==e||""===e)return e??null;if(function(e){return be.some(t=>t.test(e))}(e))return e;if((t??"").toLowerCase().includes("json")||/^\s*[[{]/.test(e)){try{JSON.parse(e)}catch{return me}return _(e,0,n)}let i=e.endsWith(Ge),l=i?e.slice(0,-Ge.length):e,s=z(l,We),a=function(e,t){if(lt.test(t))return function(e){return e.split("&").every(U)}(e);if(it.test(t))return!0;let n=e.endsWith(Ge),r=(n?e.slice(0,-Ge.length):e).split("&"),i=r.length-1;return r.some(e=>e.includes("="))&&r.every((e,t)=>n&&t===i||U(e))}(i?s+Ge:s,t??""),o=a||s===l?s:z(l,Ue),c=i?o+Ge:o,u=function(e,t,n){if(!lt.test(t))return null;let i=e.endsWith(Ge),l=i?e.slice(0,-Ge.length):e,s=st.exec(t),a=null!==s?s[1]??s[2]:/^--([^\r\n]{1,200})\r?\n/.exec(l)?.[1]??null;if(null===a)return null;let o="--"+a,c=l.startsWith(o)?0:l.indexOf("\n"+o);if(-1===c)return null;c>0&&(c+=1);let u=[];for(L(l,0,c,n,u);;){let e=c+o.length;if(l.startsWith("--",e)&&-1===l.indexOf("\n"+o,e)){L(l,e+2,l.length,n,u);break}let t=l.indexOf("\n",e);if(-1===t)break;let i=t+1,s=-1;for(;i<l.length;){let e=l.indexOf("\n",i);if(-1===e)break;if(e===i||e===i+1&&"\r"===l[i]){s=e+1;break}i=e+1}let a=-1===s?l.length:s;if(L(l,t+1,a,n,u),-1===s)break;let f=l.indexOf("\n"+o,s),d=-1===f?l.length:f;-1!==f&&d>s&&"\r"===l[d-1]&&d--;let p=l.slice(t+1,a),h=at.exec(p),g=null===h?"":h[1]??h[2],x=ot.test(p)||r(g,"param")?null:S(l.slice(s,d),0,n);if(ot.test(p)||r(g,"param")?u.push([s,d]):null!==x&&x!==l.slice(s,d)?u.push([s,d,x]):L(l,s,d,n,u),-1===f)break;c=f+1}return v(l,u)+(i?Ge:"")}(c,t??"",n);if(null!==u)return u;if(lt.test(t??"")&&!a)return ct;let f=function(e,t,n,i=!1){let l=e.endsWith(Ge),s=l?e.slice(0,-Ge.length):e,a=s.split("&");if(!n){let e=[];return T(s,e,i?"code":"text"),0===e.length?null:(w(s,t,e),v(s,e)+(l?Ge:""))}let o=[];w(s,t,o);let c,u=/[%+]/.test(s),f=D(u?s.length:0),d=rt.test(s),p=[],x=g(a.flatMap(e=>{let t=e.indexOf("=");return-1===t?[]:[[h(j(e.slice(0,t))),j(e.slice(t+1))]]})),y=[],k=0;for(let e of a){let n=e.indexOf("="),i=-1===n?k+e.length:k+n,l=k+e.length,a=f.length;u&&N(s,k,i,f),-1!==n&&u&&(E(f,"=",i,i+1),N(s,i+1,l,f)),-1!==n&&(r(e.slice(0,n),"param")||x&&$e.has(h(j(e.slice(0,n)))))||-1!==n&&$(s.slice(i+1,l))?o.push([i+1,l]):-1!==n&&null!==(c=P(s,i+1,l,t))?3===c.length?y.push(c):o.push(c):d&&(W(s,k,l,o),u&&p.push(a,f.length)),k+=e.length,k<s.length&&(u&&E(f,"&",k,k+1),k++)}if(u){let e=[],n=f.parts.join("");w(n,t,e);for(let t=0;t<p.length;t+=2)W(n,p[t],p[t+1],e);for(let[t,n]of e)o.push([f.start[t],f.end[n-1]])}let m=o.filter(([e,t])=>!function(e,t,n){let r=0,i=e.length-1;for(;r<=i;){let l=r+i>>1,[s,a]=e[l];if(t<s)i=l-1;else{if(!(t>=a))return n<=a;r=l+1}}return!1}(y,e,t));return v(s,[...m,...y])+(l?Ge:"")}(c,n,a,/(?:java|ecma)script/i.test(t??""));return null!==f?f:function(e,t=[]){if(!e)return e;let n=[];return w(e,t,n),v(e,n)}(c,n)}function C(e,t){return e.length>t?e.slice(0,t)+Ge:e}function j(e){if(!/[%+]/.test(e))return e;let t=D(e.length);return N(e,0,e.length,t),t.parts.join("")}function R(e,t){if(t+2>e.length)return-1;let n=parseInt(e[t],16),r=parseInt(e[t+1],16);return Number.isNaN(n)||Number.isNaN(r)?-1:16*n+r}function D(e){return{parts:[],start:new Int32Array(e),end:new Int32Array(e),length:0}}function E(e,t,n,r){e.parts.push(t);for(let i=0;i<t.length;i++)e.start[e.length]=n,e.end[e.length]=r,e.length++}function B(e,t,n,r){if(!(t>=n)){r.parts.push(e.slice(t,n));for(let e=t;e<n;e++)r.start[r.length]=e,r.end[r.length]=e+1,r.length++}}function N(e,t,n,r){let i={parts:r.parts.length,length:r.length},l=t,s=t;for(;s<n;){let a=e.charCodeAt(s);if(43!==a&&37!==a){s++;continue}if(B(e,l,s,r),43===a){E(r," ",s,s+1),l=++s;continue}let o=s+3<=n?R(e,s+1):-1,c=-1,u=128,f=191;o>=0&&o<128?c=0:o>=194&&o<=223?c=1:o>=224&&o<=239?(c=2,224===o&&(u=160),237===o&&(f=159)):o>=240&&o<=244&&(c=3,240===o&&(u=144),244===o&&(f=143));let d=c<=0?o:o&63>>c;for(let t=1;t<=c&&d>=0;t++){let r=s+3*t,i=r+3<=n&&"%"===e[r]?R(e,r+1):-1;d=i<(1===t?u:128)||i>(1===t?f:191)?-1:d<<6|63&i}if(c<0||d<0){r.parts.length=i.parts,r.length=i.length,B(e,t,n,r);return}let p=s+3*(c+1);E(r,String.fromCodePoint(d),s,p),l=s=p}B(e,l,n,r)}function T(e,t,n="text"){let i="code"===n?Ve:"string"===n?Xe:"header"===n?et:Qe,l="text"===n&&/<script/i.test(e)?function(e){let t=[],n=/<script\b/gi,r=/<\/script\s*>/gi;for(let i=n.exec(e);null!==i;i=n.exec(e)){let l=e.indexOf(">",i.index);if(-1===l)break;r.lastIndex=l+1;let s=r.exec(e),a=null===s?e.length:s.index;t.push([l+1,a]),n.lastIndex=a}return t}(e):[],s=0;i.lastIndex=0;for(let a=i.exec(e);null!==a;a=i.exec(e)){if(!r(a[2],"param"))continue;if(l.length>0&&(/^[ \t\r\f\v>]$/.test(a[1])||"#"===a[1]&&(!/[\w/%~-]/.test(e[a.index-1]??"")||e.startsWith("*/",a.index-2)||/(?:^|[^\w$/%~.-])(?:static|accessor)$/.test(e.slice(Math.max(0,a.index-9),a.index))))){for(;s<l.length&&l[s][1]<=a.index;)s++;if(s<l.length&&l[s][0]<=a.index)continue}let o=a.index+a[0].length;tt.lastIndex=o;let c=tt.exec(e);if(null===c)continue;"string"===n&&(nt.lastIndex=o,c=nt.exec(e)??c);let u=o+c[0].length;t.push([o,u]),i.lastIndex=u}}function U(e){let t=e.indexOf("="),n=(-1===t?e:e.slice(0,t)).trim();return He.test(n)&&(-1===t||!/\s/.test(e.slice(t+1)))}function W(e,t,n,r){let i=!1;for(let r=t;r<n&&!i;r++){let t=e.charCodeAt(r);i=63===t||59===t||38===t||10===t}if(!i)return;let l=[];T(e.slice(t,n),l);for(let[e,n]of l)r.push([t+e,t+n])}function P(e,t,n,r){let i=e.slice(t,n);if(!/^(?:%7B|%5B|[[{])/i.test(i))return null;if(/[%+]/.test(i)){let e=j(i),l=S(e,0,r);return null===l||l===e?null:[t,n]}let l=S(i,0,r);return null===l||l===i?null:[t,n,l]}function L(e,t,n,r,i){if(t>=n)return;let l=e.slice(t,n),s=[];w(l,r,s),T(l,s);for(let[e,n]of s)i.push([t+e,t+n])}function F(e,t,n){let r,{end:i,say:l,finished:s}=n,a=new TextDecoder,o={pull(o){r||(r=e.getReader(),n.touched=!0);let c=()=>r.read().then(e=>{if(e.done){n.reported||i(C(n.text+a.decode(),t)),s(),o.close(),o.byobRequest?.respond(0);return}let r=function(e){if("Uint8Array"===function(e){return V??=Reflect.get(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag)??{},"get"),"function"==typeof V?Reflect.apply(V,e,[]):void 0}(e))return e;throw new TypeError("a response body chunk is not a Uint8Array")}(e.value);if(!r.byteLength)return c();n.reported||(n.text+=a.decode(r,{stream:!0}),n.text.length>t&&(l(C(n.text,t)),n.text="",setTimeout(s,1e3))),o.enqueue(new Uint8Array(r))});return c().catch(e=>{throw i(function(e){return e+Ge}(n.text)),r.cancel(e).catch(()=>{}),e})},cancel:t=>(i(n.text),(r??e).cancel(t))},c=Object.getPrototypeOf(e).constructor,u=e=>new c({...o,type:e},{highWaterMark:0});try{return u(ft)}catch{return u()}}function M(e,t,n,r){return null===e||e.length<=r?I(e,t,n):function(e,t){return`[Body cut: ${e} of ${t} characters kept, unverified]\n`}(r,e.length)+(r>0?I(e.slice(0,r)+Ge,t,n)??"":"")}function q(e,t=1/0,n=t){return{requestBody:M(e.requestBody,e.requestType,e.patterns,t),responseBody:M(e.responseBody,e.responseType,e.patterns,n)}}var J,K=Object.defineProperty,Y=Object.getOwnPropertyDescriptor,G=Object.getOwnPropertyNames,H=Object.prototype.hasOwnProperty,Q={};((e,t)=>{for(var n in t)K(e,n,{get:t[n],enumerable:!0})})(Q,{redactBodies:()=>q,relayBody:()=>F,version:()=>ut});module.exports=(J=Q,((e,t,n,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let n of G(t))!H.call(e,n)&&void 0!==n&&K(e,n,{get:()=>t[n],enumerable:!(r=Y(t,n))||r.enumerable});return e})(K({},"__esModule",{value:!0}),J));var V,X=/%[0-7][\da-f]|%(?:c[2-9a-f]|d[\da-f])%[89ab][\da-f]|%e0%[ab][\da-f]%[89ab][\da-f]|%e[1-9a-ce-f](?:%[89ab][\da-f]){2}|%ed%[89][\da-f]%[89ab][\da-f]|%f0%[9ab][\da-f](?:%[89ab][\da-f]){2}|%f[1-3](?:%[89ab][\da-f]){3}|%f4%8[\da-f](?:%[89ab][\da-f]){2}/gi,ee=new Set(["password","passwd","pwd","secret","token","accesstoken","refreshtoken","idtoken","authorization","auth","apikey","clientsecret","privatekey","session","sessionid","cookie","ssn","socialsecuritynumber","creditcard","cardnumber","cvv","cvc","pin","passphrase","pass1","pass2","currentpass","rpkey","codeverifier","rawkey","apikeyauth","setcookie","proxyauthorization","samlresponse","confirmkey","tokenhash","clerkticket","nonce","hmac","loginhash","magiclink","phpsessid","oauthverifier","sig","sid","sessid","csrf","xsrf","bearer","authentication","credentials","pass","tokenid","authkey","secretkey","accesskey","clientkey","signingkey","sessionkey","subscriptionkey","functionskey","factorcode","jwtassertion","samlassertion","clientassertion","secretaccesskey","accesskeysecret"]),te=new Set(["invitecode","invitationcode","authcode","authorizationcode","verificationcode","verifycode","confirmationcode","confirmcode","resetcode","mfacode","smscode","otpcode","totpcode","twofactorcode","2facode","logincode","passcode","oobcode","linkcode"]),ne=new Set(["cardexpiry","cardexpiration","cardexpirydate","cardexpirationdate","cardexp","cardexpdate","cardexpmonth","cardexpyear","ccexp","ccexpiry","ccexpiration","ccexpdate","ccexpmonth","ccexpyear","creditcardexpiry","creditcardexpiration","expmonth","expyear","expirymonth","expiryyear","expirationmonth","expirationyear"]),re=/(?:password(?:\d|confirm|confirmation|new|old|repeat|again|verify|retype)?|passwd|secret|token|apikey|privatekey|passphrase|signature|sessionid|jwt|otp|credential|curl)$/,ie=new Set(["pagetoken","nextpagetoken","prevpagetoken","previouspagetoken","pagingtoken","paginationtoken","nexttoken","prevtoken","previoustoken","continuationtoken","nextcontinuationtoken","cursortoken","synctoken","nextsynctoken","startingtoken","starttoken","skiptoken","deltatoken","resumptiontoken","scrolltoken","aftertoken","beforetoken"]),le=new Set(["auth","session","cookie","pin","sig"]),se=/(&|;(?=[^;&=#]+=|end$))/,ae=1,oe=/^(?:[a-z][a-z0-9+.-]*:\/\/|\/)[^?#]*[?#]./i,ce=/[&;?#][^&;=?#]+=/,ue=/^(?:https?:|[a-z][a-z0-9+.-]*:[/\\]{2})/i,fe=/[a-z][a-z0-9+.-]{0,31}:[/\\]{2}|(?<attr>\bcontent\s*=\s*(?:["']\s*)?\d[\d.]*\s*[;,]\s*url\s*=\s*["']?|\b(?:href|src|action|formaction|poster|cite|data|background|longdesc|content|data-src|data-href|xlink:href)\s*=\s*["']?|(?<![\w:.-])[\w:.-]{1,40}\s*=\s*["'](?=\.{0,2}\/|[?#]|[a-z][a-z0-9+.-]{0,31}:\/|[a-z][a-z0-9-]{0,30}[+.][a-z0-9+.-]{0,30}:|localhost:\d{1,5}[/?#]|(?:mailto|tel|sms|urn|data|javascript|vbscript|blob|about|xmpp|sip|sips|magnet|intent|bitcoin|geo|market|news):)|\burl\(\s*["']?)(?=[^\s"'<>])/gi,de=/[\s"'<>\\^`{|}]/,pe=".,;:!?",he=/[a-z][a-z0-9+.-]{0,31}:\/\//iy,ge=/url\(\s*["']?/iy,xe="[REDACTED]",ye=new Set(["expiry","expirydate","expiration","expirationdate","expdate","exp"]),ke=new Set(["cardnumber","creditcard","creditcardnumber","ccnumber","cardnum","pan","cvv","cvc"]),me="[UNPARSEABLE_BODY_NOT_REDACTED]",be=[/^\[Blob: \d+ bytes, truncated\]$/,/^\[Blob: \d+ bytes\]$/,/^\[Binary: \d+ bytes\]$/,/^\[Response body too large: \d+ bytes\]$/,/^\[Response body not read by the page\]$/,/^\[ReadableStream\]$/,/^\[Unreadable body\]$/,/^\[(?:arraybuffer|blob|document|json|text|) response\]$/],we=/^[A-Za-z]+(?:[-_][A-Za-z]+)*$/,ve=/^[A-Za-z][a-z]+(?:[A-Z][a-z]+)+$/,ze=new Set(["authorization_code","urn:ietf:params:oauth:grant-type:device_code"]),Ae=new Set(["code","devicecode"]),$e=new Set([...Ae,"state"]),Oe=new Set(["redirecturi","clientid","verificationuri"]),Ze=new Set(["passcode"]),_e=new Set(["credentials","authentication","pass"]),Se=/[a-zA-Z0-9.-]{1,253}\.[a-zA-Z]{2,63}/y,Ie=/(?<![A-Za-z0-9])(?:kep_[A-Za-z0-9_-]{20,}|gh[pousr]_[A-Za-z0-9]{36,}|github_pat_[A-Za-z0-9_]{22,}|glpat-[A-Za-z0-9_-]{20,}|xox[abprse]-[A-Za-z0-9-]{10,}|[sr]k_(?:live|test)_[A-Za-z0-9]{16,}|sk-(?:proj|ant)-[A-Za-z0-9_-]{20,}|npm_[A-Za-z0-9]{36,}|whsec_[A-Za-z0-9+/=]{24,}|(?:AKIA|ASIA)[0-9A-Z]{16,}|AIza[0-9A-Za-z_-]{35,})/g,Ce=/\b\d{3}-\d{2}-\d{4}\b/g,je=/(?:\+\d{1,3}[ .-]?)?(?:\(\d{3}\)[ .-]?|\b\d{3}[ .-])\d{3}[ .-]\d{4}\b/g,Re=/(?<![A-Za-z0-9_-])eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g,De=/(?<![\d.])(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)(?![\d.])/g,Ee=64,Be={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},Ne=JSON.stringify(xe),Te={kind:"param",strict:!1,whole:!1,raw:!0},Ue={...Te,spaced:!0,tail:e=>z(e,Pe)},We={...Te,spaced:!0,form:!0},Pe={...Te,spaced:!0,list:!0},Le=/^(?=[^={}<>"'\\^`|]*(?:=|$))(?:(?:[a-z][a-z0-9+.-]*:\/|[a-z][a-z0-9-]*[+.][a-z0-9+.-]*:|localhost:\d{1,5}[/?#]|(?:mailto|tel|sms|urn|data|javascript|vbscript|blob|about|xmpp|sip|sips|magnet|intent|bitcoin|geo|market|news):|\.{0,2}\/)[^\s?#]*[?#]|(?:[\w.~%-][\w.~%/-]*)?[?#][^\s=&#]+=|\.{0,2}\/[^\s?#;=]*;)/i,Fe=/^\S*/,Me=/^[^\r\n]*/gm,qe=/[a-z][a-z0-9+.-]{0,31}:(?:\\\/|\\u002[fF]){2}(?:[^\s"'<>\\^`{|}()[\]/]|\/(?![dgimsuvy]*(?![\w$]))|\\\/|\\u002[fF])*/gi,Je=/^(?:\\\/|\\u002[fF])/,Ke=new Set(["key","name","header"]),Ye=new Set(["value","values","expected","actual"]),Ge="...[truncated]",He=/^[A-Za-z0-9_.~!*'()%+[\]-]*$/,Qe=/(^|[?&;\n>#]|(?<!\b(?:var|let|const)|[(){}])[ \t\r\f\v])([\w%-]*(?:\[[\w%-]*\][\w%-]*)*)=/g,Ve=/(^|[?&;\n]|(?<=[\w/%~-])(?<!\*\/|(?:^|[^\w$/%~.-])(?:static|accessor))#)([\w%-]*(?:\[[\w%-]*\][\w%-]*)*)=/g,Xe=/(^|[?&]|(?<=[\w/%~-])(?<!\*\/|(?:^|[^\w$/%~.-])(?:static|accessor))#)([\w%-]*(?:\[[\w%-]*\][\w%-]*)*)=/g,et=/(^|[?&;,\s]|(?<=[\w/%~-])#)([\w%-]*(?:\[[\w%-]*\][\w%-]*)*)=/g,tt=/(?:[^\s&"'`<>\\,;(){}[\]$]|\$(?!\{))+/y,nt=/[^&]+/y,rt=/[?;\n]|%(?:3[FfBb]|26|0[Aa])/,it=/^\s*(?:application\/x-www-form-urlencoded|multipart\/form-data)\s*(?:;|$)/i,lt=/^\s*multipart\/form-data\s*(?:;|$)/i,st=/;\s*boundary\s*=\s*(?:"([^"\r\n]{1,200})"|([^\s;"]{1,200}))/i,at=/^content-disposition\s*:[^\n]*?;\s*name\s*=\s*(?:"([^"\r\n]*)"|([^\s;]+))/im,ot=/^content-disposition\s*:[^\n]*?;\s*filename\*?\s*=/im,ct="[Unreadable body]",ut="3.3.0",ft="bytes";//# sourceMappingURL=body-redact.js.map
|