@keploy/capture-sdk 3.1.0-rc.1 → 3.1.0-rc.2
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 +398 -58
- package/body-redact/package.json +6 -0
- package/body-worker-start/package.json +6 -0
- package/dist/body-jobs.d.ts +134 -0
- package/dist/body-redact.d.ts +23 -0
- package/dist/body-redact.js +1 -0
- package/dist/body-redact.js.map +1 -0
- package/dist/body-redact.mjs +1 -0
- package/dist/body-redact.mjs.map +1 -0
- package/dist/body-worker-none.d.ts +3 -0
- package/dist/body-worker-none.js +1 -0
- package/dist/body-worker-none.js.map +1 -0
- package/dist/body-worker-none.mjs +1 -0
- package/dist/body-worker-none.mjs.map +1 -0
- package/dist/body-worker-start.d.ts +3 -0
- package/dist/body-worker-start.js +1 -0
- package/dist/body-worker-start.js.map +1 -0
- package/dist/body-worker-start.mjs +1 -0
- package/dist/body-worker-start.mjs.map +1 -0
- package/dist/body-worker-unbundled.d.ts +1 -0
- package/dist/body-worker-unbundled.mjs +1 -0
- package/dist/body-worker-unbundled.mjs.map +1 -0
- package/dist/body-worker.d.ts +1 -0
- package/dist/body-worker.js +1 -0
- package/dist/body-worker.js.map +1 -0
- package/dist/errors.d.ts +38 -6
- package/dist/index.bundler.mjs +1 -0
- package/dist/index.bundler.mjs.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -11
- package/dist/index.mjs.map +1 -1
- package/dist/leave.d.ts +67 -0
- package/dist/module-of.d.ts +45 -0
- package/dist/network.d.ts +52 -37
- package/dist/privacy.d.ts +23 -2
- package/dist/recorder.d.ts +30 -6
- package/dist/request-term.d.ts +2 -0
- package/dist/request-term.js +1 -2
- package/dist/request-term.js.map +1 -1
- package/dist/request-term.mjs +1 -2
- package/dist/request-term.mjs.map +1 -1
- package/dist/strict-attributes.d.ts +9 -0
- package/dist/strict-attributes.js +1 -0
- package/dist/strict-attributes.js.map +1 -0
- package/dist/strict-attributes.mjs +1 -0
- package/dist/strict-attributes.mjs.map +1 -0
- package/dist/transport.d.ts +35 -3
- package/dist/types.d.ts +21 -5
- package/package.json +31 -4
- package/strict-attributes/package.json +6 -0
package/dist/errors.d.ts
CHANGED
|
@@ -70,8 +70,8 @@
|
|
|
70
70
|
*/
|
|
71
71
|
/** The four codes the server's status can produce. */
|
|
72
72
|
export type ServerAnsweredCode = "KUI_E_INGEST_KEY_REJECTED" | "KUI_E_INGEST_ENDPOINT_NOT_FOUND" | "KUI_E_SESSION_CONFLICT" | "KUI_E_INGEST_REJECTED";
|
|
73
|
-
/** The
|
|
74
|
-
export type CaptureErrorCode = ServerAnsweredCode | "KUI_E_SESSION_ID_INVALID" | "KUI_E_DOM_RECORDER_UNAVAILABLE" | "KUI_E_PRIVACY_ROUTE_INVALID" | "KUI_E_CAPTURE_DECLINED" | "KUI_E_PRIVACY_CONFLICT";
|
|
73
|
+
/** The ten codes the SDK raises. Everything else it retries or ignores. */
|
|
74
|
+
export type CaptureErrorCode = ServerAnsweredCode | "KUI_E_SESSION_ID_INVALID" | "KUI_E_DOM_RECORDER_UNAVAILABLE" | "KUI_E_STRICT_ATTRIBUTES_UNAVAILABLE" | "KUI_E_PRIVACY_ROUTE_INVALID" | "KUI_E_CAPTURE_DECLINED" | "KUI_E_PRIVACY_CONFLICT";
|
|
75
75
|
export interface CaptureRemedy {
|
|
76
76
|
/** null on every code: this build has no verb that mints a key, edits a config, rotates a session, shrinks a batch or installs a bundler. */
|
|
77
77
|
command: null;
|
|
@@ -107,9 +107,9 @@ export declare const SDK_ERRORS: Record<CaptureErrorCode, CaptureErrorEntry>;
|
|
|
107
107
|
* computing it threw, or body:* because its chunk did not load:
|
|
108
108
|
* network.ts termFor).
|
|
109
109
|
*/
|
|
110
|
-
export type CaptureWarningCode = "KUI_E_EVENT_UNSERIALISABLE" | "KUI_E_EVENT_OVERSIZED" | "KUI_E_EVENT_OVERSIZED_SCRUBBING" | "KUI_E_NAVIGATION_UNWRAPPED" | "KUI_E_REQUEST_TERM_FAILED";
|
|
110
|
+
export type CaptureWarningCode = "KUI_E_EVENT_UNSERIALISABLE" | "KUI_E_EVENT_OVERSIZED" | "KUI_E_EVENT_OVERSIZED_SCRUBBING" | "KUI_E_NAVIGATION_UNWRAPPED" | "KUI_E_REQUEST_TERM_FAILED" | "KUI_E_BODY_WORKER_UNAVAILABLE";
|
|
111
111
|
/**
|
|
112
|
-
* THE
|
|
112
|
+
* THE SIX WARNING ENTRIES, briefed and held to the corpus by
|
|
113
113
|
* errors-drift.test.ts like SDK_ERRORS. These never reach onError --
|
|
114
114
|
* that channel is terminal-only, and a dropped event ends nothing, nor
|
|
115
115
|
* does a page the SDK could not wrap (KUI_E_NAVIGATION_UNWRAPPED) or a
|
|
@@ -122,6 +122,8 @@ export type CaptureWarningCode = "KUI_E_EVENT_UNSERIALISABLE" | "KUI_E_EVENT_OVE
|
|
|
122
122
|
* could look up. Each is said once per capture: the four the transport
|
|
123
123
|
* writes once per Transport, KUI_E_REQUEST_TERM_FAILED once per
|
|
124
124
|
* NetworkInterceptor (network.ts); a later init() starts a new count.
|
|
125
|
+
* KUI_E_BODY_WORKER_UNAVAILABLE is said once per PAGE (body-jobs.ts): the
|
|
126
|
+
* worker and the body chunk load once per page, and so fail once.
|
|
125
127
|
*/
|
|
126
128
|
export declare const SDK_WARNINGS: Record<CaptureWarningCode, CaptureErrorEntry>;
|
|
127
129
|
/**
|
|
@@ -131,6 +133,12 @@ export declare const SDK_WARNINGS: Record<CaptureWarningCode, CaptureErrorEntry>
|
|
|
131
133
|
* in the JSON only, never in the prose before the marker.
|
|
132
134
|
*/
|
|
133
135
|
export declare function termWarningLine(method: string, reason: string): string;
|
|
136
|
+
/**
|
|
137
|
+
* The console line for a page whose body worker or body chunk could not
|
|
138
|
+
* load, of termWarningLine's shape: what failed (`part`) and what the
|
|
139
|
+
* browser said (`reason`), in the JSON only.
|
|
140
|
+
*/
|
|
141
|
+
export declare function bodyWorkerWarningLine(part: string, reason: string): string;
|
|
134
142
|
/** The evidence a warning line carries: exactly the corpus entry's `evidence` fields. */
|
|
135
143
|
export type CaptureWarningEvidence = {
|
|
136
144
|
code: "KUI_E_EVENT_UNSERIALISABLE";
|
|
@@ -155,6 +163,10 @@ export type CaptureWarningEvidence = {
|
|
|
155
163
|
code: "KUI_E_REQUEST_TERM_FAILED";
|
|
156
164
|
method: string;
|
|
157
165
|
reason: string;
|
|
166
|
+
} | {
|
|
167
|
+
code: "KUI_E_BODY_WORKER_UNAVAILABLE";
|
|
168
|
+
part: string;
|
|
169
|
+
reason: string;
|
|
158
170
|
};
|
|
159
171
|
/**
|
|
160
172
|
* The console line for a dropped event: the code first, as a token the
|
|
@@ -320,6 +332,25 @@ export declare class SessionIdRefusal extends CaptureError {
|
|
|
320
332
|
readonly evidence: SessionIdEvidence;
|
|
321
333
|
constructor(init: SessionIdRefusalInit);
|
|
322
334
|
}
|
|
335
|
+
/**
|
|
336
|
+
* The SDK refused a strict capture: KUI_E_STRICT_ATTRIBUTES_UNAVAILABLE,
|
|
337
|
+
* raised in a browser when strict's attribute allow-list, a chunk of its
|
|
338
|
+
* own (strict-attributes.ts), could not be loaded -- at init(), or, for a
|
|
339
|
+
* page started offline, once the network is back -- before anything is
|
|
340
|
+
* recorded or sent. Strict records no page text: without the list it
|
|
341
|
+
* cannot tell an attribute holding the page's structure from one holding
|
|
342
|
+
* the visitor's search, and blanking every one would leave a recording no
|
|
343
|
+
* selector or replay can use, so it records nothing. The evidence is
|
|
344
|
+
* DomRecorderRefusal's: the error the browser gave for the import.
|
|
345
|
+
*/
|
|
346
|
+
export declare class StrictAttributesRefusal extends CaptureError {
|
|
347
|
+
readonly code: "KUI_E_STRICT_ATTRIBUTES_UNAVAILABLE";
|
|
348
|
+
readonly status: null;
|
|
349
|
+
readonly evidence: DomRecorderEvidence;
|
|
350
|
+
constructor(init: {
|
|
351
|
+
reason: string;
|
|
352
|
+
});
|
|
353
|
+
}
|
|
323
354
|
/**
|
|
324
355
|
* The SDK refused the capture: KUI_E_DOM_RECORDER_UNAVAILABLE, raised in a
|
|
325
356
|
* browser when rrweb could not be imported -- at init(), or, for a page
|
|
@@ -389,13 +420,14 @@ export declare class PrivacyConflict extends CaptureError {
|
|
|
389
420
|
* Every CaptureError a handler can receive, as a union its `code`
|
|
390
421
|
* discriminates: after `if (err.code === "KUI_E_SESSION_ID_INVALID")`
|
|
391
422
|
* the evidence is SessionIdEvidence, after
|
|
392
|
-
* `"KUI_E_DOM_RECORDER_UNAVAILABLE"`
|
|
423
|
+
* `"KUI_E_DOM_RECORDER_UNAVAILABLE"` or
|
|
424
|
+
* `"KUI_E_STRICT_ATTRIBUTES_UNAVAILABLE"` DomRecorderEvidence, after
|
|
393
425
|
* `"KUI_E_PRIVACY_ROUTE_INVALID"` PrivacyRouteEvidence, after
|
|
394
426
|
* `"KUI_E_CAPTURE_DECLINED"` CaptureDeclinedEvidence, after
|
|
395
427
|
* `"KUI_E_PRIVACY_CONFLICT"` PrivacyConflictEvidence, and otherwise
|
|
396
428
|
* IngestEvidence.
|
|
397
429
|
*/
|
|
398
|
-
export type AnyCaptureError = IngestRejection | SessionIdRefusal | DomRecorderRefusal | PrivacyRouteRefusal | CaptureDeclined | PrivacyConflict;
|
|
430
|
+
export type AnyCaptureError = IngestRejection | SessionIdRefusal | DomRecorderRefusal | StrictAttributesRefusal | PrivacyRouteRefusal | CaptureDeclined | PrivacyConflict;
|
|
399
431
|
/**
|
|
400
432
|
* What a sessionIdGenerator produced, for the evidence: the type and
|
|
401
433
|
* the value, so a number 42 cannot be mistaken for the string "42"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=/%[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;function t(t){return t.includes("%")?t.replace(e,e=>decodeURIComponent(e)):t}var n=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"]),r=new Set(["invitecode","invitationcode","authcode","authorizationcode","verificationcode","verifycode","confirmationcode","confirmcode","resetcode","mfacode","smscode","otpcode","totpcode","twofactorcode","2facode","logincode","passcode","oobcode","linkcode"]),i=new Set(["cardexpiry","cardexpiration","cardexpirydate","cardexpirationdate","cardexp","cardexpdate","cardexpmonth","cardexpyear","ccexp","ccexpiry","ccexpiration","ccexpdate","ccexpmonth","ccexpyear","creditcardexpiry","creditcardexpiration","expmonth","expyear","expirymonth","expiryyear","expirationmonth","expirationyear"]),s=/(?:password(?:\d|confirm|confirmation|new|old|repeat|again|verify|retype)?|passwd|secret|token|apikey|privatekey|passphrase|signature|sessionid|jwt|otp|credential|curl)$/,o=new Set(["pagetoken","nextpagetoken","prevpagetoken","previouspagetoken","pagingtoken","paginationtoken","nexttoken","prevtoken","previoustoken","continuationtoken","nextcontinuationtoken","cursortoken","synctoken","nextsynctoken","startingtoken","starttoken","skiptoken","deltatoken","resumptiontoken","scrolltoken","aftertoken","beforetoken"]),a=new Set(["auth","session","cookie","pin","sig"]);function l(e,n){return t(e).split("key"===n?/[[\]]+/:/[[\].]+/).map(e=>e.toLowerCase().replace(/[-_$+\s]/g,"")).filter(e=>""!==e)}function u(e,t){return!(o.has(e)||"page"===t&&a.has(e))&&(n.has(e)||r.has(e)||i.has(e)||s.test(e))}function c(e,t){return d(l(e,t),t)}function d(e,t){return e.some(e=>u(e,t))||e.length>1&&u(e.join(""),t)}var h=/(&|;(?=[^;&=#]+=|end$))/;function f(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}}var p=/^(?:[a-z][a-z0-9+.-]*:\/\/|\/)[^?#]*[?#]./i,g=/[&;?#][^&;=?#]+=/;function y(e,t,n){let r=e.indexOf("#"),i=-1===r?e:e.slice(0,r),s=i.indexOf("?"),o=-1===s?i:i.slice(0,s),a=-1===s?null:i.slice(s+1),l=-1===r?null:e.slice(r+1),u=b(o,t)+(null===a?"":`?${w(a,t,n,o)}`)+(null===l?"":`#${k(l,t,n,o)}`);return u===e?e:u}function v(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 s=e[t];if(/[\s,;"'<>\\`]/.test(s))return t;if("("===s)n++;else if("["===s)r++;else if("{"===s)i++;else{if(")"===s&&0===n--)return t;if("]"===s&&0===r--)return t;if("}"===s&&0===i--)return t}}return e.length}function m(e,n){let r=e;for(let e=0;e<4;e++){let e=t(r);if(e===r)break;r=e}for(let e of r.matchAll(/(?:^|[?&;#])([^?&;#=/\s]+)=/g))if(c(e[1],n))return!0;return!1}function w(e,n,r=0,i=""){let s=e.split(n.whole?/(&)/:h),o=s.filter((e,t)=>t%2==0),a={path:i,pairs:o,depth:r};return o.map(e=>{let i=e.indexOf("=");if(-1===i)return!0===n.bare?.(e)?"[REDACTED]":e;let s=e.slice(0,i),o=e.slice(i+1);if(""===o)return e;let l=f(o),u=()=>`${s}=[REDACTED]`,d=n.before?.(s,o,a)??null;if(null!==d)return`${s}=${d}`;if(n.strict||(n.whole?function(e){let t=[],n=e.split(h);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}(e):[s]).some(e=>c(e,n.kind))||!0===n.value?.(s,o,l)){if(!0!==n.spaced)return u();let e=v(o,n.form),t=o.slice(e);return`${s}=${0!==e||n.form?"[REDACTED]":""}${n.tail?.(t)??t}`}if(r>=1&&(p.test(l)||g.test(l)))return"page"===n.kind||m(l,n.kind)?u():e;let b=function(e,t,n){return/^[a-z][a-z0-9+.-]*:\/\//i.test(e)?S(e,t,n+1):e.startsWith("/")?y(e,t,n+1):g.test(e)?/[?#]/.test(e)?y(e,t,n+1):w(e,t,n+1):null}(l,n,r);return null!==b&&b!==l?n.whole?u():!0!==n.raw?`${s}=${encodeURIComponent(b)}`:o===l?`${s}=${b}`:encodeURIComponent(l)===o?`${s}=${encodeURIComponent(b)}`:u():t(l)!==l&&m(l,n.kind)?u():e}).map((e,t)=>(0===t?"":s[2*t-1])+e).join("")}function b(e,t){let n=e.split("/"),r=n.map(e=>e.split(";")[0]);return n.map((n,i)=>{if(!0===t.segment?.(n))return"[REDACTED]";let s=n.indexOf(";"),o=r[i],a=!0===t.head?.(e,o,i,r)?"[REDACTED]":o;return-1===s?a:a+n.slice(s).replace(/;([^;=]+)=([^;]*)/g,(e,n,r)=>{let i=!0===t.spaced?v(r,t.form):r.length;return i>0&&c(n,t.kind)?`;${n}=[REDACTED]${r.slice(i)}`:e})}).join("/")}function k(e,t,n,r=""){let i=e.indexOf("?");if(-1!==i){let s=e.slice(0,i);return`${b(s,t)}?${w(e.slice(i+1),t,n,`${r}/${s}`)}`}let s=e.indexOf("=");if(-1!==s&&!e.slice(0,s).includes("/"))return w(e,t,n,r);let o=-1===s?null:/^([^&;]*)([&;])/.exec(e);return null!==o?`${b(o[1],t)}${o[2]}${w(e.slice(o[0].length),t,n,`${r}/${o[1]}`)}`:b(e,t)}function S(e,t,n){if(t.whole||!0===t.raw||!x.test(e))return E(e,t,n);let r;try{r=new URL(e)}catch{return E(e,t,n)}let i=r.search.slice(1),s=r.hash.slice(1),o=b(r.pathname,t),a=r.search?w(i,t,n,r.pathname):"",l=r.hash?k(s,t,n,r.pathname):"";return o===r.pathname&&a===i&&l===s&&""===r.username&&""===r.password?e:`${r.protocol}//${r.host}`+o+(r.search?`?${a}`:"")+(r.hash?`#${l}`:"")}var x=/^(?:https?:|[a-z][a-z0-9+.-]*:[/\\]{2})/i;function E(e,t,n){let r=/^([a-z][a-z0-9+.-]*:)([/\\]*)([^/\\?#]*)/i.exec(e),[i,s,o,a]=r,l=""===o?-1:a.lastIndexOf("@"),u=s+o+a.slice(l+1)+y(e.slice(i.length),t,n);return u===e?e:u}function I(e,t){let n,r=e.length-e.trimStart().length,i=e.length-e.trimEnd().length,s=e.slice(r,e.length-i);return/^(?:javascript|vbscript|data|blob):/i.test(s)?e:(n=/^[a-z][a-z0-9+.-]*:/i.test(s)?S(s,t,0):y(s,t,0),n===s?e:e.slice(0,r)+n+e.slice(e.length-i))}var A=/[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,T=/[\s"'<>\\^`{|}]/,R=/[a-z][a-z0-9+.-]{0,31}:\/\//iy;function _(e,t,n,r){let i=t,s=0,o=0;for(;i<e.length;i++){let t=e[i];if(T.test(t)||r&&","===t&&(R.lastIndex=i+1,R.test(e)))break;if(n)if("("===t)s++;else if("["===t)o++;else if(")"===t||"]"===t){if(0===(")"===t?s:o))break;")"===t?s--:o--}}return function(e,t,n){let r=0,i=0;for(let s=t;s<n;s++){let t=e[s];"("===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(!".,;:!?".includes(t))break;n--}return n}(e,t,i)}var C=/url\(\s*["']?/iy;function O(e){return{kind:"param",strict:e,whole:!0}}var $={left:"the page left or the capture stopped before redaction was ready","code-failed":"the redaction code could not load"},D="[REDACTED]",N=/^[A-Za-z]+(?:[-_][A-Za-z]+)*$/,z=/^[A-Za-z][a-z]+(?:[A-Z][a-z]+)+$/,L=new Set(["code","devicecode"]);function B(e){return c(e,"key")}new Set([...L,"state"]);var U=/[a-zA-Z0-9.-]{1,253}\.[a-zA-Z]{2,63}/y;function P(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||46===e||95===e||37===e||43===e||45===e}var q=/(?<![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,j=/\b\d{3}-\d{2}-\d{4}\b/g,M=/(?:\+\d{1,3}[ .-]?)?(?:\(\d{3}\)[ .-]?|\b\d{3}[ .-])\d{3}[ .-]\d{4}\b/g,K=/(?<![A-Za-z0-9_-])eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g,W=/(?<![\d.])(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)(?![\d.])/g;function F(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,s=/^(?:35|3[068])/.test(e)&&e.length>=14&&e.length<=19;return!!(t||n||r||i||s)&&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 H(e,t,n){for(let r of e.matchAll(t))""!==r[0]&&n.push([r.index,r.index+r[0].length])}function Z(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,s,o]=t[0];for(let a=1;a<=t.length;a++){let l=t[a];void 0!==l&&l[0]<s?(l[1]>s&&(s=l[1]),o=void 0):(n+=e.slice(r,i)+(o??D),r=s,void 0!==l&&([i,s,o]=l))}return n+e.slice(r)}function V(e,t=[]){if(!e)return e;let n=[];return function(e,t,n){H(e,K,n),H(e,q,n),function(e,t){let n=0,r=e.indexOf("@");for(;-1!==r;){let i=Math.max(n,r-64),s=r;for(;s>i&&P(e.charCodeAt(s-1));)s--;if(s<r){U.lastIndex=r+1;let i=U.exec(e);if(i){n=r+1+i[0].length,t.push([s,n]),r=e.indexOf("@",n);continue}}r=e.indexOf("@",r+1)}}(e,n),H(e,j,n),H(e,M,n),H(e,W,n),function(e,t){for(let n of e.matchAll(/\b(?:\d[ -]?){12,18}\d\b/g))F(n[0].replace(/[^0-9]/g,""))&&t.push([n.index,n.index+n[0].length])}(e,n);for(let r of t)H(e,r,n)}(e,t,n),Z(e,n)}function J(e){return e&&Z(e,G(e))}var X=/eyJ|kep_|gh[pousr]_|github_pat_|glpat-|xox[abprse]-|[sr]k_(?:live|test)_|sk-(?:proj|ant)-|npm_|whsec_|AKIA|ASIA|AIza/;function G(e){let t=[];return X.test(e)&&(H(e,K,t),H(e,q,t)),t}JSON.stringify(D);var Q={kind:"param",strict:!1,whole:!1,raw:!0},Y={...Q,spaced:!0,tail:e=>ie(e,ee)},ee={...Q,spaced:!0,list:!0},te=/^(?=[^={}<>"'\\^`|]*(?:=|$))(?:(?:[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,ne=/^\S*/,re=/^[^\r\n]*/gm;function ie(e,t=Q){let n=e.replace(re,e=>te.test(ne.exec(e)[0])?I(e,t):e),r=function(e,t){let n=[];for(let[r,i]of function(e,t=!1){let n=[];A.lastIndex=0;for(let r=A.exec(e);null!==r;r=A.exec(e)){let i=r.index+(r.groups?.attr?.length??0);C.lastIndex=i;let s=void 0!==r.groups?.attr&&C.test(e);s&&(i=C.lastIndex);let o=r.groups?.attr??"",a=_(e,i,!/["']$/.test(o)||/^url\(/i.test(o)||s,t);"{"===e[a]&&a>i&&"$"===e[a-1]&&a--,a>i&&n.push([i,a]),A.lastIndex=Math.max(a,r.index+r[0].length,i+1)}return n}(e,!0===t.list)){let s=e.slice(r,i),o=I(s,t);o!==s&&n.push([r,i,o])}return n}(n,t);if(0===r.length)return oe(n,t);let i="",s=0;for(let[e,t,o]of r)i+=n.slice(s,e)+o,s=t;return oe(i+n.slice(s),t)}var se=/[a-z][a-z0-9+.-]{0,31}:(?:\\\/|\\u002[fF]){2}(?:[^\s"'<>\\^`{|}()[\]/]|\/(?![dgimsuvy]*(?![\w$]))|\\\/|\\u002[fF])*/gi;function oe(e,t){return/:(?:\\\/|\\u002[fF])/.test(e)?e.replace(se,e=>{let n="",r=[];for(let t=0;t<e.length;){r.push(t);let i=ae.exec(e.slice(t,t+6));n+=null===i?e[t]:"/",t+=null===i?1:i[0].length}r.push(e.length);let i=I(n,t);if(i===n)return e;let s=0;for(;s<i.length&&i[s]===n[s];)s++;let o=0;for(;o<i.length-s&&o<n.length-s&&i[i.length-1-o]===n[n.length-1-o];)o++;let a=/\\\/|\\u002[fF]/.exec(e)[0];return e.slice(0,r[s])+i.slice(s,i.length-o).replace(/\//g,a)+e.slice(r[n.length-o])}):e}var ae=/^(?:\\\/|\\u002[fF])/;function le(e){let t=ie(e,Y),n=[];return function(e,t,n="text"){let r="code"===n?de:"string"===n?he:"header"===n?fe:ce,i="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 s=e.indexOf(">",i.index);if(-1===s)break;r.lastIndex=s+1;let o=r.exec(e),a=null===o?e.length:o.index;t.push([s+1,a]),n.lastIndex=a}return t}(e):[],s=0;r.lastIndex=0;for(let o=r.exec(e);null!==o;o=r.exec(e)){if(!c(o[2],"param"))continue;if(i.length>0&&(/^[ \t\r\f\v>]$/.test(o[1])||"#"===o[1]&&(!/[\w/%~-]/.test(e[o.index-1]??"")||e.startsWith("*/",o.index-2)||/(?:^|[^\w$/%~.-])(?:static|accessor)$/.test(e.slice(Math.max(0,o.index-9),o.index))))){for(;s<i.length&&i[s][1]<=o.index;)s++;if(s<i.length&&i[s][0]<=o.index)continue}let a=o.index+o[0].length;pe.lastIndex=a;let l=pe.exec(e);if(null===l)continue;"string"===n&&(ge.lastIndex=a,l=ge.exec(e)??l);let u=a+l[0].length;t.push([a,u]),r.lastIndex=u}}(t,n,"header"),Z(t,n)}var ue="...[truncated]",ce=/(^|[?&;\n>#]|(?<!\b(?:var|let|const)|[(){}])[ \t\r\f\v])([\w%-]*(?:\[[\w%-]*\][\w%-]*)*)=/g,de=/(^|[?&;\n]|(?<=[\w/%~-])(?<!\*\/|(?:^|[^\w$/%~.-])(?:static|accessor))#)([\w%-]*(?:\[[\w%-]*\][\w%-]*)*)=/g,he=/(^|[?&]|(?<=[\w/%~-])(?<!\*\/|(?:^|[^\w$/%~.-])(?:static|accessor))#)([\w%-]*(?:\[[\w%-]*\][\w%-]*)*)=/g,fe=/(^|[?&;,\s]|(?<=[\w/%~-])#)([\w%-]*(?:\[[\w%-]*\][\w%-]*)*)=/g,pe=/(?:[^\s&"'`<>\\,;(){}[\]$]|\$(?!\{))+/y,ge=/[^&]+/y,ye=O(!1),ve=O(!0),me={scanned:0};function we(e){return 47===e||38===e||59===e||63===e||35===e}function be(e,t){let n=e.length,r=0;for(;r<=n;){let i,s=r,o=0;for(;s<n&&61!==(o=e.charCodeAt(s))&&!we(o);)s++;me.scanned+=s-r+1,i=s<n&&61===o?s>r?t(r,s):s+1:s;let a=i;for(;i<n&&!we(e.charCodeAt(i));)i++;if(me.scanned+=i-a+1,i>=n)return;r=i+1}}function ke(e,t,n){let r=t;for(;r<e.length;r++){let t=e.charCodeAt(r);if(38===t||59===t||35===t||!n&&63===t)break}return me.scanned+=r-t+1,r}function Se(e){let t=[];return be(e,(n,r)=>{let i=ke(e,r+1,!0);return t.push([e.slice(n,r),e.slice(r+1,i)]),i}),t}function xe(e,t,n=!1){let r="",i=0;return be(e,(s,o)=>{let a=l(e.slice(s,o),"page"),u=o+1;if(!(d(a,"page")||n&&Ze(a,e.slice(u,u+256))))return u;let c=ke(e,u,t);return r+=e.slice(i,u)+"[REDACTED]",i=c,c}),r+e.slice(i)}function Ee(e,t){let n=e.indexOf("?");return-1===n?xe(e,!1):`${xe(e.slice(0,n),!1)}?${xe(e.slice(n+1),!0,t)}`}var Ie=/^!?\//;function Ae(e){return!(e.length<8)&&Number(/[a-z]/.test(e))+Number(/[A-Z]/.test(e))+Number(/\d/.test(e))>=2&&!/^[A-Z][a-z]+$/.test(e)&&!/^[A-Za-z][a-z]*(?:[-_](?:[A-Za-z][a-z]*|\d+))+$/.test(e)&&!/^[A-Za-z][a-z]{2,}(?:[A-Z][a-z]{2,})+$/.test(e)}function Te(e,n=!0){return(n?/^(?:\/|[a-z][a-z\d+.-]*:\/\/)/i:/^[a-z][a-z\d+.-]*:\/\//i).test(t(e))}function Re(e){return t(e).replace(/([a-z\d])([A-Z])/g,"$1 $2").split(/[\s\-_.]+/).filter(e=>""!==e).map(e=>e.toLowerCase())}var _e=new Set(["reset","resets","verify","unlock","activate","invite","forgot","forgotten","recover","recovery"]),Ce=new Set(["passwordreset","passwordresets","resetpassword","verifyemail","emailverification","magiclink","magiclogin","emaillogin","loginlink","lostpassword","setpassword","createpassword"]),Oe=new Set(["setpassword","createpassword","resetpassword","passwordreset","forgotpassword","forgottenpassword","lostpassword","verifyemail","emailverification"]),$e=new Set(["sent","done","success","complete","new","error","expired","failed","invalid"]),De=new Set(["confirm","confirmation","confirmations","invites","invitation","invitations","verification","verifications","activation","activations","password","passwords","signup","login"]),Ne=new Set(["email","account","registration","registrations","signup"]),ze=new Set(["accept","link","new","old","sign","up","email","account","registration","admin","change","php","asp","aspx","htm","html","jsp","cgi"]),Le=e=>e.some(e=>Ne.has(e))||e.join("").includes("signup");function Be(e,t){let n=Re(e),r=n.join("");if(Ce.has(r))return 2;De.has(r)&&(n=[r]);let i=0;for(let e of n)if(_e.has(e))i=2;else if(De.has(e))i||=1;else if(!ze.has(e))return 0;return 1===i&&(n.includes("accept")||n.includes("confirm")&&(Le(n)||Le(Re(t))))?2:i}function Ue(e){return/^(?:\d+|[\da-f]{24}|[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12})$/i.test(e)||/^(?:[0-7][\dA-HJKMNP-TV-Z]{25}|c[a-z\d]{24})$/.test(e)}function Pe(e){if(e.length%4==1||!/^[\w-]+$/.test(e))return!1;try{return/^[\x20-\x7e]+$/.test(atob(e.replace(/-/g,"+").replace(/_/g,"/")+"===".slice((e.length+3)%4)))}catch{return!1}}function qe(e){return e.length<=4||je(e)}function je(e){return Re(e).every(e=>e.startsWith("confirm")||"accept"===e||"edit"===e)}function Me(e,t){let n=e[t]??"";return Oe.has(Re(e[t-1]??"").join(""))&&!je(n)&&!$e.has(n.toLowerCase())&&!/\.[A-Za-z][A-Za-z\d]{0,4}$/.test(n)&&!(Ue(n)&&""!==(e[t+1]??""))}var Ke=new Set(["cb","auth","sso","signin","authorize","authorized","redirect"]);function We(e){return Re(e).some(e=>e.startsWith("invit"))}function Fe(e,t){return/^(?:rp|resetpass)$/.test(t)||e.some(e=>e.some(e=>0!==Be(e,"")))}function He(e){return e.find(([e])=>l(e,"page").includes("action"))?.[1]??""}function Ze(e,t){return e.some(e=>/^(?:key|t|hash|code)$/.test(e))&&!Te(t,!1)}function Ve(e){let t=Re(e);return t.length>0&&t.every(e=>"accept"===e||"join"===e)}var Je="a route is `/`-separated segments from the path's start, each a literal, `*` (any one segment) or `:name` (the value it names), with no `?` or `#`; a secret route names at least one `:name`, a keep route has at least one literal";function Xe(e,t=!1){if("string"!=typeof e||!/^\/[^?#]*$/.test(e))return null;let n=e.split("/").filter(e=>""!==e),r=e=>/^:\w+$/.test(e);return n.every(e=>"*"===e||r(e)||!/[:*]/.test(e))&&n.some(e=>t?"*"!==e&&!r(e):r(e))?n:null}var Ge={secret:[],keep:[]},Qe=new Set,Ye=0;function et(e,n){return"*"===e||":"===e[0]||t(n).toLowerCase()===t(e).toLowerCase()}function tt(e,t){let n=[];return e.every((e,r)=>{let i=t[r];return void 0!==i&&(":"===e[0]&&n.push([i,t[r-1]??"",r]),et(e,i))})?n:null}function nt(e,t){return Ge.keep.some(n=>t<n.length&&"*"!==n[t]&&":"!==n[t][0]&&n.slice(0,t+1).every((t,n)=>et(t,e[n])))}function rt(e){let t=!1,n=new Set;for(let r of Ge.keep){let i=tt(r,e);if(null!==i){0===i.length&&(t||=r.length===e.length&&!r.includes("*"));for(let[e]of i)n.add(e)}}let r=[];for(let t of Ge.secret)for(let[n,i,s]of tt(t,e)??[])!nt(e,s)&&it(n)&&r.push([n,i]);return{secret:r,kept:n,own:t}}function it(e){let n=e;for(let e=0;e<=st;e++){let e=t(n);if(e===n)return/[\p{L}\p{N}]/u.test(n);n=e}return!1}var st=16;function ot(e){let t=e.indexOf("#"),n=[e.slice(0,-1===t?e.length:t).replace(/^[a-z][a-z\d+.-]*:\/\/[^/?#]*/i,"")],r=-1===t?"":e.slice(t+1);return Ie.test(r)&&n.push(r.replace(/^!/,"")),n.map(e=>e.split(/[?#]/)[0].split("/").map(e=>e.split(";")[0]))}function at(e,n,r){let i=e.get(n);void 0===i&&e.set(n,i=new Set),i.add(function(e){return ft(t(e))}(r))}function lt(e,n,r,i,s,o){let a=ot(e);for(let e of a){let a=e.length,{secret:l,kept:u,own:c}=rt(e.filter(e=>""!==e));for(let[e,t]of l)r.add(e),at(i,e,t),0===n&&at(s,e,t);for(let n=0;n<a;n++){let s=Be(e[n],e[n-1]??"");if(0===s)continue;let l=We(e[n]),d=e[n+1];Me(e,n+1)&&!u.has(d)&&!c&&(r.add(d),Ae(t(d))||(i.has(d)||o.add(d),at(i,d,e[n])));let h="",f="",p=n+1;for(;p<a;p++){let t=e[p],n=e[p+1]??"";if(Ue(t)||(2===s||n.length>=16&&Ae(n))&&Pe(t)){f=t;continue}if(t.length>=(2===s?16:20)&&Ae(t)){h=t;break}if(l&&Ae(t)){f=t;continue}let r=Be(t,e[p-1]);if(r>s)s=r,f="";else{if(""!==f&&Ve(t)){h=f;break}if(!qe(t))break}}""===h&&2===s&&p===a&&(h=f),""!==h&&!u.has(h)&&!c&&r.add(h),n=""===h?p-1:p}}let u=Se(e).map(([e,t])=>[l(e,"page"),t]),c=e=>u.find(([t])=>t.includes(e))?.[1]??"",h=Fe(a,c("action")),f=""!==c("organization"),p=c("code"),g=c("state"),y=!Te(p)&&(p.length>=10&&Ae(g)&&!/^[A-Za-z][a-z]+(?:[A-Z][a-z]+)+$/.test(g)&&!Te(g)||p.length>=20&&Ae(p)&&a.some(e=>e.some(e=>/callback|oauth/i.test(e)||[...Re(e),Re(e).join("")].some(e=>Ke.has(e)))));for(let[e,a]of u){let l=y&&(e.includes("code")||e.includes("state"));if((l||d(e,"page")||h&&Ze(e,a)||f&&e.includes("invitation")||e.includes("ticket")&&/^(?:ST|PT|TGT)-/.test(a))&&!Te(a,l)){r.add(a);continue}let u=t(a);n<2&&(/[?#=]/.test(u)||Te(u))&<(u,n+1,r,i,s,o)}}function ut(e){try{return new URL(e).origin}catch{return""}}function ct(e){return ht(e)[0]}var dt=["",[],!1,null];function ht(e){if(dt[0]===e)return[dt[1],dt[2],dt[3]];let n=new Set,r=new Map,i=new Map,s=new Set,o=e.indexOf("#"),a=-1===o?e:e.slice(0,o),l=-1===o?"":e.slice(o+1),u=Ie.test(l),c=a.length+(u?l.length:0)>65536;if(c)for(let t of ot(e))for(let[e,s]of rt(t.filter(e=>""!==e)).secret)n.add(e),at(r,e,s),at(i,e,s);else lt(e,0,n,r,i,s);let d=c,h=ut(e),f=new Set,p=[],g=0,y=(e,t)=>null!==t&&!0===i.get(e)?.has(t)||(g<32?(g++,!0):(d=!0,!1));for(let e of[...i.keys(),...[...n].filter(e=>!i.has(e))]){let n=r.get(e),i=void 0===n?void 0:[...n].filter(t=>y(e,t));if(0===i?.length||void 0===i&&!y(e,null))break;if(void 0!==i){let n=t(e),r=n.length>=6&&!s.has(e),o=[];for(let t=e,n=0;n<Rt;n++)o.push(t=encodeURIComponent(t));for(let t of new Set([e,n,...o,encodeURIComponent(n),n.replace(/[\u0080-\uffff]/g,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,"0")}`)])){if(""===t)continue;let e=!h.includes(t),n=e&&Ae(t)&&!Te(t,!1);if(r&&n&&p.push({kind:0,value:t}),r&&e)p.push({kind:1,value:t});else for(let e of i)p.push({kind:2,value:t,before:e})}continue}f.add(e);for(let t=e.lastIndexOf("/"),n=0;t>0&&n<4;t=e.lastIndexOf("/",t-1),n++)f.add(e.slice(0,t));f.add(encodeURIComponent(e));for(let t of[e,e.replace(/\+/g," ")])try{let e=decodeURIComponent(t);f.add(e),f.add(encodeURIComponent(e));for(let t=e.lastIndexOf("/"),n=0;t>0&&n<4;t=e.lastIndexOf("/",t-1),n++)f.add(e.slice(0,t))}catch{}}for(let e of f)Ae(e)&&!Te(e,!1)&&!h.includes(e)&&p.push({kind:0,value:e});return p.sort((e,t)=>t.value.length-e.value.length),dt=[e,p,d,Vt(p)],[p,d,dt[3]]}function ft(e){if(!/[A-Z]/.test(e))return e;if(Nt.lowered+=e.length,!/[^\0-\x7f]/.test(e))return e.toLowerCase();let t=new Uint16Array(Math.min(e.length,pt)),n="";for(let r=0;r<e.length;r+=pt){let i=Math.min(pt,e.length-r);for(let n=0;n<i;n++){let i=e.charCodeAt(r+n);t[n]=i>=65&&i<=90?i+32:i}n+=String.fromCharCode(...t.subarray(0,i))}return n}var pt=8192;function gt(e,t){let n=new Int32Array(t.length);for(let e=1,r=0;e<t.length;e++){for(;r>0&&t.charCodeAt(e)!==t.charCodeAt(r);)r=n[r-1];t.charCodeAt(e)===t.charCodeAt(r)&&r++,n[e]=r}let r=[];for(let i=0,s=0;i<e.length;i++){for(;s>0&&e.charCodeAt(i)!==t.charCodeAt(s);)s=n[s-1];e.charCodeAt(i)===t.charCodeAt(s)&&s++,s===t.length&&(r.push(i-s+1),s=n[s-1])}return r}var yt=1/0,vt=0;function mt(e){let t=yt;yt=1/0;try{return e()}finally{yt=t}}function wt(e){if(vt+e>yt)throw new Gt(vt+e,yt)}function bt(e,t,n="[redacted]"){if(e.includes(t))return!0;if(!/[[\]]/.test(t))return!1;let r=t.split(n),i=r[0],s=i.lastIndexOf("[");s>=0&&n.startsWith(i.slice(s))&&(r[0]=i.slice(0,s));let o=r[r.length-1],a=o.indexOf("]");return a>=0&&n.endsWith(o.slice(0,a+1))&&(r[r.length-1]=o.slice(a+1)),r.every(t=>e.includes(t))}var kt=10;function St(e,t){let n=e=>e.length>kt&&/[[\]]/.test(e);if(e.plain.some(e=>n(e)&&bt(t,e,"[REDACTED]")))return!0;let r=ft(t);return[...e.bounded,...e.words.map(({value:e})=>e)].some(e=>n(e)&&bt(r,e))}function xt(e,t,n,r,i=!1){let s=[],o=0,a=kt-n.length;for(let l of gt(t,n))l<o||!r(l,l+n.length)||(s.push(l),o=l+n.length,i&&wt(e.length+s.length*a));if(0===s.length)return[e,()=>t];let l,u=(e,t)=>{let r=[],i=0;for(let t of s)r.push(e.slice(i,t)),i=t+n.length;return r.push(e.slice(i)),r.join(t)};return[u(e,"[REDACTED]"),()=>l??=u(t,"[redacted]")]}var Et=/[A-Za-z0-9]/,It=/(?:%(?:25)*[\da-f]{2}|(?:\\|%(?:25)*5c)(?:[nrtbf]|u[\da-f]{4}))$/i;function At(e,t,n){return(0===t||!Et.test(e[t-1])||It.test(e.slice(Math.max(0,t-16),t)))&&(n===e.length||!Et.test(e[n]))}var Tt=[["%25252f",3],["%252f",2],["%2f",1],["\\/",0],["/",0]],Rt=Math.max(...Tt.map(([,e])=>e)),_t=/[/\\?#\s"<>`{}|^[\]]/,Ct=/[!$&'()*+,;=:@]/,Ot=64;function $t(e,t,n){return Tt.find(([r,i])=>i<=n&&t>=r.length&&e.startsWith(r,t-r.length))}function Dt(e,t,n){if(";"===e[t])return!0;for(let r=1;r<=n;r++)if(e.startsWith(`%${"25".repeat(r-1)}3b`,t))return!0;return!1}var Nt={pieces:0,strings:0,scanned:0,lowered:0};function zt(e,n,r,i){if(r!==e.length&&/[a-z0-9_~-]/.test(e[r]))return!1;let s=$t(e,n,3);if(void 0===s)return!1;let[o,a]=s,l=function(e,t,n){let r=t;for(;;){let t=$t(e,r,n);if(void 0===t)return r;r-=t[0].length,Nt.scanned++}}(e,n-o.length,a);return(l===n-o.length||!function(e,t){return 0===t||_t.test(e[t-1])||Ct.test(e[t-1])||/(?::|%(?:25)*3a)$/.test(e.slice(Math.max(0,t-9),t))}(e,l))&&(!!i.befores.has("")||0!==i.longest&&function(e,n,r,i){let s=n;for(;s>0&&!_t.test(e[s-1])&&void 0===$t(e,s,r);)s--;Nt.scanned+=n-s;let o=n,a="",l=!1;for(let u=n;u>=s;u--){if(u<n&&Dt(e,u,r)&&(o=u,a="",l=!1),l||u!==s&&!Ct.test(e[u-1]))continue;let c=e.slice(u,o);for(let e=0;e<=r;e++)c=t(c);if(Nt.pieces++,a=ft(c)+a,o=u,a.length>i.longest)l=!0;else if(i.lengths.has(a.length)&&i.befores.has(a))return!0}return!1}(e,l,a,i))}function Lt(e,t){if(!Bt(e,t))return e;if(/^[ \t\n\r]*[{[]/.test(e)){let n=Mt(e,t);if(null!==n)return n}return Zt(e,t)}function Bt(e,t){return!!Ut(e,t)||e.includes("\\")&&Ut(Pt(e),t)}function Ut(e,t){if(t.plain.some(t=>e.includes(t)))return!0;if(0===t.bounded.length&&0===t.words.length)return!1;let n=ft(e);return t.bounded.some(e=>n.includes(e))||t.words.some(({value:e})=>n.includes(e))}function Pt(e){return e.replace(/\\+u([0-9a-fA-F]{4})/g,(e,t)=>String.fromCharCode(parseInt(t,16))).replace(/\\+\//g,"/")}var qt=/"(?:[^"\\]|\\[\s\S])*"|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|[{}]/g,jt=/[ \t\n\r]*:/y;function Mt(e,t){try{JSON.parse(e)}catch{return null}let n=function(e,t){let n=ft(e),r=e.includes("\\")?ft(Pt(e)):n,i=e=>n.includes(ft(e))||n.includes(ft(function(e){return JSON.stringify(e).slice(1,-1).replace(/[\u0080-\uffff]/g,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,"0")}`)}(e)))||r.includes(ft(e));return{...t,plain:t.plain.filter(i),bounded:t.bounded.filter(i),words:t.words.filter(({value:e})=>i(e))}}(e,t),r=[],i=[];for(let t of e.matchAll(qt)){let n=t[0];"{"===n?(i.push(r.length),r.push(new Set)):"}"===n?i.pop():'"'===n[0]&&i.length>0&&(jt.lastIndex=t.index+n.length,jt.test(e)&&r[i[i.length-1]].add(JSON.parse(n)))}let s=vt,o="",a=0,l=0,u=[];for(let t of e.matchAll(qt)){let i=t[0];if("{"===i){u.push(new Set(r[l++]));continue}if("}"===i){u.pop();continue}let c=i;if('"'===i[0]){let r,l=JSON.parse(i);vt=s+o.length+(t.index-a);try{r=Lt(l,n)}finally{vt=s}jt.lastIndex=t.index+i.length;let d=jt.test(e)?u[u.length-1]:void 0;if(void 0!==d&&r!==l){let e=r;for(let t=2;d.has(r);t++)r=`${e}#${t}`;d.add(r)}r!==l&&(c=JSON.stringify(r))}else mt(()=>Zt(i,n))!==i&&(c='"[REDACTED]"');c!==i&&(o+=e.slice(a,t.index)+c,a=t.index+i.length,wt(o.length))}return o+e.slice(a)}function Kt(e){let t="",n=[],r=0;for(let i of e.matchAll(/\\+u([0-9a-fA-F]{4})|\\+\//g))t+=e.slice(r,i.index),n.push(t.length,i.index+i[0].length),t+=void 0===i[1]?"/":String.fromCharCode(parseInt(i[1],16)),r=i.index+i[0].length;return{text:t+e.slice(r),escapes:n}}function Wt(e,t){let n=0,r=e.length/2;for(;n<r;){let i=n+r>>1;e[2*i]<t?n=i+1:r=i}if(0===n)return t;let i=2*(n-1);return e[i+1]+(t-e[i]-1)}function Ft(e,t,n=!1){let r=[],i=[],s=(e,t,s)=>{let o=new Int32Array(e.length),a=0,l=t>kt,u=-1,c=-1;for(let r of e)!n&&s(r)?o[a++]=r:l&&(r<c||(u>=0&&i.push(u,c),u=r),c=r+t);u>=0&&i.push(u,c),a>0&&r.push({at:o.subarray(0,a),length:t})};for(let n of t.plain)s(gt(e,n),n.length,()=>!0);let o=ft(e);for(let n of t.bounded)s(gt(o,n),n.length,t=>At(e,t,t+n.length));for(let e of t.words)s(gt(o,e.value),e.value.length,t=>zt(o,t,t+e.value.length,e));return{lists:r,slack:Ht(i)}}function Ht(e){if(0===e.length)return 0;let t=Array.from({length:e.length/2},(e,t)=>t).sort((t,n)=>e[2*t]-e[2*n]),n=0,r=e[2*t[0]],i=e[2*t[0]+1],s=()=>{i-r>kt&&(n+=i-r-kt)};for(let n of t){let t=e[2*n],o=e[2*n+1];t<i?o>i&&(i=o):(s(),r=t,i=o)}return s(),n}function Zt(e,t){e=function(e,t){let n=yt!==1/0&&vt+kt*e.length>yt,{text:r,escapes:i}=e.includes("\\")?Kt(e):{text:e,escapes:[]},s=Ft(r,t),{lists:o}=s;if(0===o.length)return e;let a=n&&!St(t,e),l=s.slack+(a&&i.length>0?Ft(e,t,!0).slack:0),u=new Int32Array(o.length),c=e=>o[e].at[u[e]],d=[],h=(e,t)=>{let n=d[e];d[e]=d[t],d[t]=n},f=e=>{for(;;){let t=2*e+1,n=e;if(t<d.length&&c(d[t])<c(d[n])&&(n=t),t+1<d.length&&c(d[t+1])<c(d[n])&&(n=t+1),n===e)return;h(e,n),e=n}};for(let e=0;e<o.length;e++)d.push(e);for(let e=(d.length>>1)-1;e>=0;e--)f(e);let p=[],g=0,y=!1,v=0;for(;d.length>0;){let t=d[0],n=c(t),r=Wt(i,n),s=Wt(i,n+o[t].length);if(u[t]=u[t]+1,u[t]>=o[t].at.length&&(d[0]=d[d.length-1],d.pop()),d.length>0&&f(0),!(s<=g)){if(y&&r<=g){g=s;continue}v+=r-g+kt,a&&wt(v-l),p.push(e.slice(g,r),"[REDACTED]"),g=s,y=!0}}return a&&wt(v+e.length-g-l),p.push(e.slice(g)),p.join("")}(e,t);for(let n of t.plain)e.includes(n)&&(e=e.split(n).join("[REDACTED]"));let n=ft(e),r=()=>n,i=[...t.bounded,...t.words.map(({value:e})=>e)],s=new Array(i.length);for(let e=i.length-1,t=!0;e>=0;e--){let r=i[e];t=t&&(r.length<=kt||!bt(n,r)),s[e]=t}let o=0;for(let n of t.bounded){if(r().includes(n)){let t=e;[e,r]=xt(e,r(),n,(e,n)=>At(t,e,n),s[o])}o++}for(let n of t.words){if(r().includes(n.value)){let t=r();[e,r]=xt(e,t,n.value,(e,r)=>zt(t,e,r,n),s[o])}o++}return e}function Vt(e){if(0===e.length)return null;let t=(e,t)=>t.length-e.length,n=[],r=[],i=new Map;for(let t of e){let e=ft(t.value);if(0===t.kind)n.push(t.value);else if(1===t.kind)r.push(e);else{let n=i.get(e);void 0===n&&i.set(e,n=new Set),n.add(t.before.length>Ot?"":t.before)}}n.sort(t),r.sort(t);let s=[...i].map(([e,t])=>{let n=new Set([...t].filter(e=>""!==e).map(e=>e.length));return{value:e,befores:t,lengths:n,longest:0===n.size?0:Math.max(...n)}}).sort((e,t)=>t.value.length-e.value.length);return{json:n.map(e=>JSON.stringify(e).slice(1,-1)),jsonLower:[...r,...s.flatMap(({value:e})=>Tt.map(([t])=>t+e))].map(e=>JSON.stringify(e).slice(1,-1)),plain:n,bounded:r,words:s}}var Jt=new Set(["type","rel","method","enctype","autocomplete","inputmode","enterkeyhint","dir","role","crossorigin","referrerpolicy","loading","decoding","fetchpriority","contenteditable","draggable","spellcheck","translate"]),Xt=class{constructor(e){this.page=e}styles=new Map;texts=new Map;gone(e){return void 0===this.page||!this.page.present(e)}get size(){let e=0;for(let t of this.styles.values())e+=t.size;return this.styles.size+this.texts.size+e}addText(e,t){this.dropText(e),this.texts.set(e,t),this.styles.get(t)?.add(e),this.page?.note(e)}dropText(e){let t=this.texts.get(e);void 0!==t&&this.styles.get(t)?.delete(e),this.texts.delete(e)&&this.page?.forget(e)}drop(e){let t=this.styles.get(e);if(void 0!==t)for(let e of t)this.texts.delete(e)&&this.page?.forget(e);this.styles.delete(e)&&this.page?.forget(e),this.dropText(e)}observe(e){if(!tn(e)||!tn(e.data))return;let t=e.data;if(2===e.type){for(let e of[...this.styles.keys(),...this.texts.keys()])this.page?.forget(e);return this.styles.clear(),this.texts.clear(),void this.walk(t.node,null)}if(3!==e.type||0!==t.source)return;let n=Array.isArray(t.removes)?t.removes:[];for(let e of n)tn(e)&&"number"==typeof e.id&&this.gone(e.id)&&this.drop(e.id);let r=Array.isArray(t.adds)?t.adds.filter(tn):[];for(let e of r)this.walk(e.node,null);for(let e of r){let t=e.node;tn(t)&&3===t.type&&"number"==typeof t.id&&("number"==typeof e.parentId&&this.styles.has(e.parentId)?this.addText(t.id,e.parentId):this.dropText(t.id))}n.length>0&&void 0!==this.page&&this.prune()}prune(){for(let e of this.styles.keys())this.gone(e)&&this.drop(e);for(let e of this.texts.keys())this.gone(e)&&this.dropText(e)}walk(e,t){let n=[[e,t]],r=new Set;for(;n.length>0;){let[e,t]=n.pop();if(r.has(e)||(r.add(e),!tn(e)||"number"!=typeof e.id))continue;let i=e.id,s=2===e.type&&"string"==typeof e.tagName&&"style"===e.tagName.toLowerCase();if(s&&!this.styles.has(i)&&(this.styles.set(i,new Set),this.page?.note(i)),3===e.type&&null!==t&&this.addText(i,t),Array.isArray(e.childNodes))for(let t of e.childNodes)n.push([t,s?i:null])}}recordsIn(e){let t=new Set;if(!tn(e)||!tn(e.data))return t;let n=e.data,r=[];if(2===e.type)r.push(n.node);else if(3===e.type&&0===n.source){if(Array.isArray(n.adds))for(let e of n.adds)tn(e)&&r.push(e.node);if(Array.isArray(n.texts))for(let e of n.texts)tn(e)&&"number"==typeof e.id&&this.texts.has(e.id)&&t.add(e)}for(;r.length>0;){let e=r.pop();tn(e)&&(3===e.type&&"number"==typeof e.id&&this.texts.has(e.id)&&t.add(e),Array.isArray(e.childNodes)&&r.push(...e.childNodes))}return t}},Gt=class extends Error{constructor(e,t){super(`the scrubbed event passed ${t} units (at least ${e})`),this.atLeast=e,this.cap=t,this.name="ScrubOverCap"}};function Qt(e,t){if(0===t.length)return 0;let n=new Int32Array(t.length);for(let e=1,r=0;e<t.length;e++){for(;r>0&&t.charCodeAt(e)!==t.charCodeAt(r);)r=n[r-1];t.charCodeAt(e)===t.charCodeAt(r)&&r++,n[e]=r}let r=0;for(let i=0,s=0;i<e.length;i++){for(;s>0&&e.charCodeAt(i)!==t.charCodeAt(s);)s=n[s-1];e.charCodeAt(i)===t.charCodeAt(s)&&s++,s===t.length&&(r++,s=n[s-1])}return r}function Yt(e,t,n){if(yt===1/0||vt+e.length<=yt||"body"===t||"text"===t&&/^[ \t\n\r]*[{[]/.test(e)||"css"===t&&e.includes("\\"))return;if(!e.includes("\\")&&function(e,t){let n=e=>e.length>kt;if(e.plain.some(e=>n(e)&&bt(t,e,"[REDACTED]"))||e.plain.some(e=>t.includes(e)))return!1;let r=[...e.bounded,...e.words.map(({value:e})=>e)],i=r.filter(n),s=r.filter(e=>/[^a-z0-9]/.test(e));if(0===i.length&&0===s.length)return!0;let o=ft(t);return!i.some(e=>bt(o,e))&&!s.some(e=>o.includes(e))}(n,e))return void wt(e.length);let r=function(e,t){if(St(t,e))return null;let n=e.includes("\\"),r=n?Kt(e).text:e,i=n?[r,e]:[r],s=r.length;for(let e of i){let n=ft(e);for(let n of t.plain)s-=Qt(e,n)*n.length;for(let e of t.bounded)s-=Qt(n,e)*e.length;for(let{value:e}of t.words)s-=Qt(n,e)*e.length}return s}(e,n);null!==r&&wt(r)}function en(e,t,n="custom",r,i){if("dom"===n&&r?.observe(e),null===t)return e;let s;try{s=JSON.stringify(e)}catch{return e}let o=s;if(void 0===o||!function(e,t){if(t.json.some(t=>e.includes(t)))return!0;let n=ft(e);if(t.jsonLower.some(e=>n.includes(e)))return!0;if(!e.includes("\\"))return!1;let r=Pt(e);if(t.plain.some(e=>r.includes(e)))return!0;let i=ft(r);return t.bounded.some(e=>i.includes(e))||t.words.some(({value:e})=>i.includes(e))}(o,t))return e;let a=JSON.parse(o);if("string"==typeof a)return Nt.strings++,g(0,()=>(Yt(a,"text",t),Lt(a,t)));let l="dom"===n&&void 0!==r?r.recordsIn(a):new Set,u="dom"===n&&tn(a)&&3===a.type&&tn(a.data)&&13===a.data.source,c=(e,t,r,i,s)=>"network"===n?!s||"method"!==t&&"type"!==t?!s||"requestBody"!==t&&"responseBody"!==t?"text":"body":"keep":"dom"!==n?"text":"tagName"===t||u&&"property"===t||i&&Jt.has(t)?"keep":r||i&&"style"===t||"_cssText"===t||"rule"===t||("replace"===t||"replaceSync"===t)&&8===e.source||u&&"value"===t||("textContent"===t||"value"===t)&&l.has(e)?"css":"text",d=new Map,h=![...t.plain,...t.bounded,...t.words.map(e=>e.value)].some(e=>e.includes("#")),f=0,p=e=>{if(f+=e.length,void 0!==i&&f>i)throw new Gt(f,i);return e};function g(e,t){yt=i??1/0,vt=e;try{return t()}finally{yt=1/0,vt=0}}let y=(e,n)=>{if("keep"===n)return e;if("text"===n&&h){let t=e.indexOf("#");if(t>0&&!/^[ \t\n\r]*[{[]/.test(e))return y(e.slice(0,t),n)+y(e.slice(t),n)}Yt(e,n,t);let r=function(e,t){let n=`${e}\0${t}`;if(n.length<=16383)return n;let r=2166136261;for(let e=0;e<t.length;e++)r^=t.charCodeAt(e),r=Math.imul(r,16777619);return`${e}\x01${t.length}\0${r>>>0}`}(n,e),i=d.get(r),s=i?.find(([t])=>t===e);if(void 0!==s)return s[1];Nt.strings++;let o="css"===n?function(e,t){if(!Bt(e,t))return e;for(let n of t.plain)e.includes(n)&&(e=e.split(n).join("[REDACTED]"));let n="",r=0;return function(e,t){let n=e.length,r={},i=(t,i)=>{let s=r[i]??=new Int32Array(n+2).fill(-2),o=[],a=t,l=-1;for(;!(a>=n);){if(-2!==s[a]){l=s[a];break}o.push(a),Nt.scanned++;let t=e[a];if(t===i){l=a+1;break}a+="\\"===t?2:1}for(let e of o)s[e]=l;return l},s=-1,o=t=>{for(s<t&&(s=t);s<n&&!")\"'".includes(e[s]);)Nt.scanned++,s++;return s},a=t=>{let r=t;for(;r<n&&/\s/.test(e[r]);)Nt.scanned++,r++;return r},l=0;for(;l<n;){Nt.scanned++;let r=e[l];if("/"===r&&"*"===e[l+1]){let r=e.indexOf("*/",l+2),i=r<0?n:r+2;Nt.scanned+=i-l,t(l,i),l=i;continue}if(("u"===r||"U"===r)&&"url("===e.slice(l,l+4).toLowerCase()){let n=a(l+4),r=e[n],s=-1;if('"'===r||"'"===r){let t=i(n+1,r);if(t>=0){let n=a(t);")"===e[n]&&(s=n+1)}}else{let t=o(l+4);")"===e[t]&&(s=t+1)}if(s>=0){t(l,s),l=s;continue}}if('"'===r||"'"===r){let e=i(l+1,r);if(e>=0){t(l,e),l=e;continue}}l++}}(e,(i,s)=>{let o=e.slice(i,s);n+=e.slice(r,i)+(o.startsWith("/*")?function(e,t){let n=e.length>=4&&e.endsWith("*/");return`/*${Zt(e.slice(2,n?-2:void 0),t)}${n?"*/":""}`}(o,t):Zt(o,t)),wt(n.length),r=s}),n+e.slice(r)}(e,t):"body"===n?function(e,t){return Bt(e,t)?Mt(e,t)??Zt(e,t):e}(e,t):Lt(e,t);return void 0!==i?i.push([e,o]):d.set(r,[[e,o]]),o},v=[{node:a,css:!1,attributes:!1,names:"custom"===n,root:!0}];for(;v.length>0;){let{node:e,css:r,attributes:i,names:s,root:o}=v.pop();if(Array.isArray(e))for(let t=0;t<e.length;t++){let i=e[t];"string"==typeof i?e[t]=p(g(f,()=>y(i,r?"css":"text"))):null!==i&&"object"==typeof i&&v.push({node:i,css:r,attributes:!1,names:"custom"===n,root:!1})}else if(tn(e))for(let a of Object.keys(e)){let l=e[a];if("dom"===n&&s&&!a.startsWith("rr_")&&"_cssText"!==a&&t.plain.some(e=>a.includes(e))){delete e[a];continue}let u=c(e,a,r,i,o);if("string"==typeof l)e[a]=p(g(f,()=>y(l,u)));else if(null!==l&&"object"==typeof l){let e="dom"===n&&"attributes"===a;v.push({node:l,css:"css"===u,attributes:e,names:"custom"===n||e||"dom"===n&&i&&"style"===a||"network"===n&&o&&("requestHeaders"===a||"responseHeaders"===a),root:!1})}if(!s||a.startsWith("rr_")||"_cssText"===a)continue;let d=a;for(let e of t.plain)d.includes(e)&&(d=d.split(e).join("[REDACTED]"));if(d===a)continue;let h=e[a];delete e[a];let m=d;for(let t=2;Object.prototype.hasOwnProperty.call(e,m);t++)m=`${d}#${t}`;e[m]=h}}return a}function tn(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function nn(e){if(e)for(let[t,n]of Object.entries(e))if("content-type"===t.toLowerCase())return n}var rn=[{name:"phone_us",pattern:/(?:\+\d{1,3}[ .-]?)?(?:\(\d{3}\)[ .-]?|\b\d{3}[ .-])\d{3}[ .-]\d{4}\b/g},{name:"ssn",pattern:/\b\d{3}-\d{2}-\d{4}\b/g},{name:"ipv4",pattern:/\b(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\b/g}],sn=["authorization","cookie","set-cookie","x-api-key","x-auth-token","proxy-authorization"];function on(e){return l(e,"page").join("")}var an=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,ln=/^eyJ[\w-]+\.[\w-]+\.[\w-]*$/,un=/(?:^|-)[A-Za-z]{3,}-(?:[A-Za-z0-9]+-)*[A-Za-z]{3,}(?:-|$)/;function cn(e){return!!ln.test(e)||!(e.length<32||an.test(e)||un.test(e))&&/^[A-Za-z0-9_\-.~+/=]+$/.test(e)&&/[0-9]/.test(e)&&/[A-Za-z]/.test(e)}var dn=/@|\d[\d .()-]{5,}\d|\d\.\d|eyJ/;function hn(e){return e.split("/").some(e=>{if(/callback|oauth/i.test(e))return!0;let t=Re(e);return[...t,t.join("")].some(e=>Ke.has(e))})}var fn=new Set(["code","state","accesstoken","idtoken","refreshtoken"]);function pn(e,t){let n=new Map;for(let t of e){let e=t.indexOf("=");if(-1===e)continue;let r=on(f(t.slice(0,e)));if(!fn.has(r))continue;let i=n.get(r),s=f(t.slice(e+1));void 0===i?n.set(r,[s]):i.push(s)}let r=e=>n.get(e)??[],i=new Set,s=r("code").filter(e=>""!==e&&!Te(e)),o=r("state").filter(e=>""!==e&&!function(e){return!!N.test(e)&&(e.length<=16||z.test(e)||/^[A-Za-z][a-z]+(?:[-_][A-Za-z][a-z]+)+$/.test(e))}(e)&&!Te(e));return s.length>0&&(t||o.length>0)&&(i.add("code"),i.add("state"),i.add("sessionstate")),(r("accesstoken").length>0||r("idtoken").length>0||r("refreshtoken").length>0)&&(i.add("state"),i.add("sessionstate")),i}var gn=[],yn=!1,vn=!1;function mn(e,t,n){let r=vn;vn=e;try{return zn(t,n)}finally{vn=r}}var wn,bn=/reset|verif|confirm|activat|invit|magic|log-?in|passw|unlock|forgot|recover|sign-?up/i,kn=new Set(["href","xlink:href","src","action","formaction","srcset","poster","cite","data","data-src","data-href","background","longdesc"]),Sn=new Set(["title","alt","placeholder","label","content","summary","abbr","aria-label","aria-description","aria-valuetext","aria-placeholder","aria-roledescription","aria-braillelabel","aria-brailleroledescription"]),xn=new Set(["input","textarea","select"]),En=/^(?:style|_csstext|srcset|data-srcset|imagesrcset|ping|srcdoc)$/,In=/^[^\s"'`<>{}]*$/;function An(e,n,r,i,s=!1){if(!("content"===e?wn?.(e,r,s,i):En.test(e)||wn?.(e,r,s)||kn.has(e)&&In.test(t(n))))return/[^*\s]/.test(n)?"":n}var Tn=/^(\s*[\d.]*\s*[;,]\s*(?:url\s*=\s*)?)(['"]?)(.*?)(\2\s*)$/is,Rn=/[?#;@]|eyJ/;function _n(e){return Rn.test(e)||yn&&bn.test(e)}var Cn=new WeakMap;function On(e){return(t,n,r)=>{let i=function(e){let t=Cn.get(e.pairs);return void 0===t&&(t={oauth:pn([...e.pairs],hn(e.path))},Cn.set(e.pairs,t)),t}(r);if(i.oauth.has(on(f(t)))||Ze(l(t,"page"),n)&&(i.linkPage??=function(e,t){let n=t.map(e=>{let t=e.indexOf("=");return-1===t?[e,""]:[e.slice(0,t),e.slice(t+1)]});return Fe([e.split("/").map(e=>e.split(";")[0])],He(n))}(r.path,[...r.pairs])))return"[REDACTED]";let s=e?0:function(e){let t=0,n=null;for(let r of gn)if(!(r.length<=t||"/"!==e.charAt(r.length))){if(e.startsWith(r)){t=r.length;continue}null===n&&(n=ft(e)),n.startsWith(r)&&(t=r.length)}return t}(n);if(s>0){let e=f(n.slice(s));if(!dn.test(e)||V(e)===e)return`[REDACTED]${n.slice(s)}`}return null}}function $n(e){let n,r=null;return{kind:"page",strict:e,whole:!1,before:On(e),value:(e,n,r)=>{let i=l(e,"key");return!(!/[[\]]/.test(t(e))&&/ids?$/.test(i[0]??""))&&(function(e){return!!cn(e)||!/^(?:https?:|\/)[^\s"<>\\^`{|}[\]]*$/i.test(e)&&function(e){return e.split(/[^A-Za-z0-9_\-.~+/=]+/)}(e).some(cn)}(r)||cn(n))||dn.test(r)&&V(r)!==r},bare:e=>cn(e)||cn(f(e)),segment:e=>ln.test(e),head:(e,i,s,o)=>!!yn&&(o!==n&&(n=o,r=bn.test(e)?function(e){let t=new Set,n=e.startsWith("/")?e:`/${e}`;for(let e of ct(`https://link.invalid${n}`))t.add(e.value);return t}(e):null),null!==r&&r.has(i)&&(function(e){let n=t(e);return!!an.test(n)||n.split(/[-_.~]+/).some(Ae)}(i)||vn&&Me(o,s)))}}var Dn=$n(!1),Nn=$n(!0);function zn(e,t){return _n(e)?I(e,t?Nn:Dn):e}var Ln=/(?:[A-Za-z0-9_-]|[\u0080-\uffff]|\\(?:[0-9A-Fa-f]{1,6}[ \t\n]?|[^\n0-9A-Fa-f]))+/y;function Bn(e,t){return Ln.lastIndex=t,Ln.test(e)?Ln.lastIndex:t}function Un(e){return e.replace(/\\(?:([0-9A-Fa-f]{1,6})[ \t\n]?|([\s\S]))/g,(e,t,n)=>{if(void 0===t)return"\n"===n?"":n??"";let r=parseInt(t,16);return 0===r||r>1114111||r>=55296&&r<=57343?"\ufffd":String.fromCodePoint(r)})}function Pn(e,t){if(!/url\(|["'\\]/i.test(e)||!_n(e)&&!e.includes("\\"))return e;let n=e.length,r=/[\t\n\f\r ]/,i="",s=0,o=(n,r,o)=>{let a=e.slice(n,r),l=a.includes("\\")?Un(a):a,u=zn(l,t);u!==l&&(i+=e.slice(s,n)+(l===a?u:function(e,t){return e.replace(t?/[\\"'\n]/g:/[\\"'()\s]/g,e=>/\s/.test(e)?`\\${e.charCodeAt(0).toString(16)} `:`\\${e}`)}(u,o)),s=r)},a=0;for(;a<n;){let t=e[a];if("/"===t&&"*"===e[a+1]){let t=e.indexOf("*/",a+2);a=-1===t?n:t+2}else if(e.startsWith("\x3c!--",a))a+=4;else if('"'===t||"'"===t){let r=a+1;for(;r<n&&e[r]!==t&&"\n"!==e[r];)r+="\\"===e[r]?2:1;r=Math.min(r,n),o(a+1,r,!0),a=r+1}else{let t=Bn(e,a);if(t===a){a++;continue}if("("!==e[t]||"url"!==Un(e.slice(a,t)).toLowerCase()){a=t;continue}let i=t+1;for(;i<n&&r.test(e[i]);)i++;if('"'===e[i]||"'"===e[i]){a=i;continue}let s=i;for(;s<n&&")"!==e[s];)s+="\\"===e[s]?2:1;s=Math.min(s,n);let l=s;for(;l>i&&r.test(e[l-1]);)l--;o(i,l,!1),a=s+1}}return 0===s?e:i+e.slice(s)}var qn={Tab:"\t",NewLine:"\n",excl:"!",quot:'"',QUOT:'"',num:"#",dollar:"$",percnt:"%",amp:"&",AMP:"&",apos:"'",lpar:"(",rpar:")",ast:"*",midast:"*",plus:"+",comma:",",period:".",sol:"/",colon:":",semi:";",lt:"<",LT:"<",equals:"=",gt:">",GT:">",quest:"?",commat:"@",lsqb:"[",lbrack:"[",bsol:"\\",rsqb:"]",rbrack:"]",Hat:"^",lowbar:"_",UnderBar:"_",grave:"`",DiacriticalGrave:"`",lcub:"{",lbrace:"{",verbar:"|",vert:"|",VerticalLine:"|",rcub:"}",rbrace:"}",nbsp:"\xa0",NonBreakingSpace:"\xa0"};function jn(e,t){let n=e.replace(/&/g,"&");return'"'===t?n.replace(/"/g,"""):"'"===t?n.replace(/'/g,"'"):n.replace(/[\s"'`>]/g,e=>`&#${e.charCodeAt(0)};`)}var Mn=new Set(["script","style","textarea","title","xmp","iframe","noembed","noframes"]),Kn=/(^|[\s/"'])(href|xlink:href|src|action|formaction|poster|cite|data|background|longdesc|data-src|data-href|srcset|imagesrcset|data-srcset|ping|content|style|srcdoc)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+))/gi;function Wn(e,t,n=[],r="",i=!1){let s=[gn,yn];gn=n,yn=!0;try{Fn(e,t,r,i)}finally{[gn,yn]=s}}function Fn(e,t,n="",r=!1){for(let i of Object.keys(e)){let s=e[i],o=i.toLowerCase();if(t&&("checked"===o||"selected"===o)){delete e[i];continue}if("string"!=typeof s){"style"===o&&tn(s)&&Hn(s,t);continue}let a=(t?An(o,s,n,e,r):void 0)??Zn(o,Jn(o,s,t,n),n);a!==s&&(e[i]=a)}}function Hn(e,t){let n=e=>Zn("style",Pn(e,t),"");for(let t of Object.keys(e)){let r=e[t];if("string"==typeof r){let i=n(r);i!==r&&(e[t]=i)}else if(Array.isArray(r)&&"string"==typeof r[0]){let i=n(r[0]);i!==r[0]&&(e[t]=[i,...r.slice(1)])}}}function Zn(e,t,n){return e.startsWith("rr_")?t:function(e,t){return"value"===e?""!==t&&!xn.has(t):Sn.has(e)||e.startsWith("data-")&&!kn.has(e)&&"data-srcset"!==e}(e,n)&&dn.test(t)?V(t):J(t)}function Vn(e){return J(e)}function Jn(e,t,n,r){let i=t;return"srcset"===e||"data-srcset"===e||"imagesrcset"===e?i=function(e,t){if(!_n(e))return e;let n=e.split(",").map(e=>{let n=/^(\s*)(\S+)([\s\S]*)$/.exec(e);return null===n?e:n[1]+zn(n[2],t)+n[3]}).join(",");return n===e?e:n}(t,n):"style"===e||"_csstext"===e?i=Pn(t,n):"ping"===e?i=t.replace(/\S+/g,e=>zn(e,n)):"srcdoc"===e?i=function(e,t){if(!t&&!_n(e)&&!/url\(/i.test(e))return e;let n=e.length,r=/[\t\n\f\r ]/,i=[],s=new Set,o=(n,r,s,o,a="")=>{let l=function(e){return e.includes("&")?e.replace(/&(?:#(\d+);?|#[xX]([0-9A-Fa-f]+);?|([A-Za-z][A-Za-z0-9]*);|(amp|AMP|lt|LT|gt|GT|quot|QUOT)(?![A-Za-z0-9=]))/g,(e,t,n,r,i)=>{if(void 0!==t||void 0!==n){let e=void 0!==t?Number(t):parseInt(n,16);return 0===e||e>1114111||e>=55296&&e<=57343?"\ufffd":String.fromCodePoint(e)}return qn[r??i??""]??e}):e}(e.slice(r,s)),u=(t?An(n,l,a):void 0)??Jn(n,l,t,"");u!==l&&i.push([r,s,jn(u,o)])},a=(t,i,a="")=>{let l=t;for(;;){for(;l<n&&(r.test(e[l])||"/"===e[l]);)l++;if(l>=n||">"===e[l])return l;let t=l;for(l++;l<n&&!r.test(e[l])&&!"/>=".includes(e[l]);)l++;let u=e.slice(t,l).toLowerCase(),c=l;for(;c<n&&r.test(e[c]);)c++;if("="!==e[c]){l=c;continue}for(c++;c<n&&r.test(e[c]);)c++;let d='"'===e[c]||"'"===e[c]?e[c]:"",h=""===d?c:c+1,f=h;if(""!==d)f=e.indexOf(d,h),-1===f&&(f=n),l=Math.min(f+1,n);else{for(;f<n&&!r.test(e[f])&&">"!==e[f];)f++;l=f}i&&(s.add(`${h}:${f}`),o(u,h,f,d,a))}},l=(n,r)=>{let s=e.slice(n,r);t&&/\S/.test(s)&&i.push([n,r,s.replace(/\S/g,"*")])},u=0,c=e.indexOf("<");for(;-1!==c&&c<n;){let s,o=!0;if(e.startsWith("\x3c!--",c))if(e.startsWith(">",c+4))s=c+5;else if(e.startsWith("->",c+4))s=c+6;else{let t=/--!?>/g;t.lastIndex=c+4;let r=t.exec(e);s=null===r?n:r.index+r[0].length,l(c+4,null===r?n:r.index)}else if("!"===e[c+1]||"?"===e[c+1]){let t=e.indexOf(">",c+2);s=-1===t?n:t+1,/^<!doctype/i.test(e.slice(c,c+9))||l(c+2,-1===t?n:t)}else if("/"===e[c+1]&&/[A-Za-z]/.test(e[c+2]??"")){let t=c+2;for(;t<n&&!r.test(e[t])&&!"/>".includes(e[t]);)t++;s=a(t,!1)+1}else if(/[A-Za-z]/.test(e[c+1]??"")){let o=c+1;for(;o<n&&!r.test(e[o])&&!"/>".includes(e[o]);)o++;let u=e.slice(c+1,o).toLowerCase(),d=a(o,!0,u);if(s=d+1,Mn.has(u)&&d<n){let r=new RegExp(`</${u}[\\t\\n\\f\\r />]`,"gi");r.lastIndex=d+1;let o=r.exec(e),a=null===o?n:o.index;if("style"===u){let n=e.slice(d+1,a),r=Pn(n,t);r!==n&&i.push([d+1,a,r])}else l(d+1,a);s=a}}else s=c+1,o=!1;o&&(l(u,c),u=s),c=e.indexOf("<",s)}l(u,n),i.sort((e,t)=>e[0]-t[0]);let d=i.length,h=new RegExp(Kn.source,"gi"),f=0,p=0;for(let t=h.exec(e);null!==t;t=h.exec(e)){let e=t[3]??t[4]??t[5]??"",n=t.index+t[0].length-(void 0===t[5]?1:0),r=n-e.length;for(h.lastIndex=r;f<d&&i[f][1]<=r;)f++;if(s.has(`${r}:${n}`)||f<d&&i[f][0]<n||r<p)continue;let a=void 0!==t[3]?'"':void 0!==t[4]?"'":"",l=i.length;o(t[2].toLowerCase(),r,n,a),i.length>l&&(p=n)}if(0===i.length)return e;i.sort((e,t)=>e[0]-t[0]);let g="",y=0;for(let[t,n,r]of i)g+=e.slice(y,t)+r,y=n;return g+e.slice(y)}(t,n):"content"===e?i=function(e,t){if(!_n(e))return e;let n=Tn.exec(e);if(null!==n&&""!==n[3]){let r=mn(!0,n[3],t);return r===n[3]?e:n[1]+n[2]+r+n[4]}return/^\s*https?:\/\//i.test(e)?zn(e,t):e}(t,n):kn.has(e)?i=mn(function(e,t){return"href"===e||"xlink:href"===e?""===t||"a"===t||"area"===t:"action"===e||"formaction"===e}(e,r),t,n):Xn.test(t)&&(i=mn(!1,t,n)),i}var Xn=/^(?:(?:[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):|\.{0,2}\/)[^\s?#;]*[?#;]|[?#])\S*$/i;function Gn(e,t,n=[]){let r=[gn,yn];gn=n,yn=!0;try{return Pn(e,t)}finally{[gn,yn]=r}}function Qn(e){let t=e.map(e=>e.textContent).join(""),n=G(t).sort((e,t)=>e[0]-t[0]),r=0,i=0;for(let s of e){let e=i+s.textContent.length,o="",a=i;for(;r<n.length&&n[r][0]<e;){let[i,s]=n[r];if(i>=a&&(o+=`${t.slice(a,i)}[REDACTED]`),a=Math.max(a,Math.min(s,e)),s>e)break;r++}s.textContent=o+t.slice(a,e),i=e}}function Yn(e){let t=e;return 3===t?.type&&"string"==typeof t.textContent}function er(e){let t=[];for(let n of e)Yn(n)?t.push(n):5!==n?.type&&(t.length>1&&Qn(t),t=[]);t.length>1&&Qn(t)}function tr(e,t,n=[]){let r=[gn,yn];gn=n,yn=!0;try{!function(e,t){let n=[e],r=new Set;for(;n.length>0;){let e=n.pop();if(null===e||"object"!=typeof e||r.has(e))continue;if(r.add(e),"string"==typeof e.textContent){let n=!0===e.isStyle?Pn(e.textContent,t):t&&5===e.type?"":Vn(e.textContent);n!==e.textContent&&(e.textContent=n)}let i=e.attributes;if(null!==i&&"object"==typeof i&&Fn(i,t,"string"==typeof e.tagName?e.tagName.toLowerCase():"",!0===e.isSVG),Array.isArray(e.childNodes)){er(e.childNodes);for(let t of e.childNodes)n.push(t)}}}(e,t)}finally{[gn,yn]=r}}function nr(e,t,n){switch(e){case"location":case"content-location":return n(t);case"link":return t.replace(/<([^>]*)>/g,(e,t)=>`<${n(t)}>`);case"refresh":{let e=/^\s*(?:\d[\d.]*\s*[;,]\s*)?url\s*=\s*/i.exec(t);if(null===e)return le(t);let r=t.slice(e[0].length),i=/^(["'])(.*)\1$/.exec(r);return i?`${e[0]}${i[1]}${n(i[2])}${i[1]}`:`${e[0]}${n(r)}`}}return le(t)}var rr=new Set(["accept","accept-encoding","accept-ranges","age","cache-control","connection","content-encoding","content-language","content-length","content-type","date","etag","expires","keep-alive","last-modified","pragma","transfer-encoding","vary"]);function ir(e){if(e.startsWith("access-control-"))return!1;if(B(e))return!0;let t=e.split(/[-_\s]+/).filter(e=>""!==e);t.length>1&&/^v?\d+$/.test(t[t.length-1])&&t.pop();let n=t[t.length-1]??"",r=t[t.length-2]??"";return B(n)||""!==r&&B(r+n)}function sr(){return{maskSelectors:[],unmaskSelectors:[],blockSelectors:[],maskNetworkBodies:!1,sensitiveHeaders:[...sn],piiPatterns:[],secretRoutes:[],keepRoutes:[]}}function or(e,t){let n=Object.fromEntries(Object.entries(t).filter(([,e])=>void 0!==e)),r={...e,...n};if(n.sensitiveHeaders){let t=new Set;r.sensitiveHeaders=[...sn,...e.sensitiveHeaders,...n.sensitiveHeaders].filter(e=>{let n=e.toLowerCase();return!t.has(n)&&(t.add(n),!0)})}return r}function ar(e){return e.map(({pattern:e})=>e.flags.includes("g")?new RegExp(e.source,e.flags):new RegExp(e.source,e.flags+"g"))}var lr={},ur="[MASKED]",cr=class{config;builtinPatterns;userPatterns;strict;constructor(e={},t="balanced"){this.strict="strict"===t,this.config=this.settle(or(sr(),e)),this.builtinPatterns=ar(rn),this.userPatterns=ar(this.config.piiPatterns)}settle(e){return this.strict?{...e,maskNetworkBodies:!0}:e}maskText(e){if(!e)return e;let t=V(e,this.userPatterns);for(let e of this.builtinPatterns)t=t.replace(e,"[REDACTED]");return t}maskUrl(e){if(!e)return e;let t=e.indexOf("#");return function(e,t=!1){return I(e,t?ve:ye)}(-1===t?e:e.slice(0,t),this.strict)}maskNetworkData(e,t){let n={...e};n.requestHeaders=this.maskHeaders(e.requestHeaders),n.responseHeaders=this.maskHeaders(e.responseHeaders);let r=this.bodyJob(e),i=r&&(t??lr.redact?.(r)??{requestBody:e.requestBody?ur:null,responseBody:e.responseBody?ur:null});return n.requestBody=i?i.requestBody:e.requestBody?ur:null,n.responseBody=i?i.responseBody:e.responseBody?ur:null,n.url=this.maskUrl(e.url),n}bodyJob(e){return this.config.maskNetworkBodies?null:{requestBody:e.requestBody,responseBody:e.responseBody,requestType:nn(e.requestHeaders),responseType:nn(e.responseHeaders),patterns:this.userPatterns}}getConfig(){return this.config}updateConfig(e){this.config=this.settle(or(this.config,e)),this.userPatterns=ar(this.config.piiPatterns)}maskHeaders(e){let t={},n=new Set(this.config.sensitiveHeaders.map(e=>e.toLowerCase()));for(let[r,i]of Object.entries(e)){let e=r.toLowerCase();n.has(e)||ir(e)||this.strict&&!rr.has(e)?t[r]="[REDACTED]":t[r]=this.maskText(nr(e,i,e=>this.maskUrl(e)))}return t}},dr=200,hr=/^[A-Za-z0-9_-]+(\.[A-Za-z0-9_-]+)*$/,fr="must be 1-200 characters of letters, digits, dot, dash and underscore, with no empty dot-separated segment";function pr(e){return"string"==typeof e&&e.length>0&&e.length<=200&&hr.test(e)}var gr=["status","serverMessage","endpoint","sessionId"],yr=["issues"];function vr(e){let t={};for(let n of Object.keys(e)){let r=e[n],i="https://keploy.io/docs/ui-capture/errors#"+n.toLowerCase().replace(/_/g,"-");t[n]={summary:r.summary,remedy:{command:null,manual:i,docs:i},evidence:r.evidence,optionalEvidence:r.optionalEvidence??[]}}return t}var mr=vr({KUI_E_INGEST_KEY_REJECTED:{summary:"The ingest server refused the SDK's API key (401 or 403). Capture has stopped.",evidence:gr,optionalEvidence:yr},KUI_E_INGEST_ENDPOINT_NOT_FOUND:{summary:"The ingest server answered 404 or 405: nothing at `endpoint` accepts a POST. Capture has stopped.",evidence:gr,optionalEvidence:yr},KUI_E_SESSION_CONFLICT:{summary:"The ingest server answered 409: this session id is already claimed, or a batchId was re-used. Capture has stopped.",evidence:gr,optionalEvidence:yr},KUI_E_INGEST_REJECTED:{summary:"The ingest server refused a batch with a terminal 4xx (400, 413 or 415). Capture has stopped.",evidence:gr,optionalEvidence:yr},KUI_E_SESSION_ID_INVALID:{summary:"The configured `sessionIdGenerator` did not produce a session id the ingest server would accept. Capture did not start.",evidence:["sessionId","received","rule"]},KUI_E_DOM_RECORDER_UNAVAILABLE:{summary:"The capture SDK could not load rrweb, the library it records the page with. The capture ended before anything was sent.",evidence:["reason"]},KUI_E_STRICT_ATTRIBUTES_UNAVAILABLE:{summary:"Under strict, the capture SDK could not load its attribute allow-list. The capture ended before anything was recorded or sent.",evidence:["reason"]},KUI_E_PRIVACY_ROUTE_INVALID:{summary:"A route in `privacy.secretRoutes` or `privacy.keepRoutes` is not one the SDK can match. Capture did not start.",evidence:["option","received","rule"]},KUI_E_CAPTURE_DECLINED:{summary:"The browser sent Do Not Track or Global Privacy Control, and `honorPrivacySignals` is on. Capture did not start; nothing was recorded or sent.",evidence:["signal"]},KUI_E_PRIVACY_CONFLICT:{summary:'`privacyMode: "strict"` records no body, and `privacy.maskNetworkBodies` is `false`, which asks for them. Capture did not start.',evidence:["privacyMode","option"]}}),wr=vr({KUI_E_EVENT_UNSERIALISABLE:{summary:"The SDK dropped one captured event because it could not be serialised to JSON. The capture continues without it.",evidence:["eventId","eventType","reason"]},KUI_E_EVENT_OVERSIZED:{summary:"The SDK dropped one captured event that alone is over the ingest server's decoded cap (`evidence.cap` bytes). The capture continues without it.",evidence:["eventId","eventType","bytes","cap"]},KUI_E_EVENT_OVERSIZED_SCRUBBING:{summary:"The SDK dropped one captured event whose scrub of the page URL's credentials passed the ingest server's decoded cap (`evidence.cap` bytes). The capture continues without it.",evidence:["eventType","atLeast","cap"]},KUI_E_NAVIGATION_UNWRAPPED:{summary:"The page made a History or Navigation API method the SDK wraps (`evidence.method`) impossible to replace and put back, so the SDK wrapped none of them. The capture continues.",evidence:["method"]},KUI_E_REQUEST_TERM_FAILED:{summary:"The SDK recorded a request without its canonical-key.v2 term (computing it threw: `evidence.reason`), or body:* (its term code did not load). The page's request was unaffected.",evidence:["method","reason"]},KUI_E_BODY_WORKER_UNAVAILABLE:{summary:"No body worker or chunk (`evidence.part`): no worker, a body over 64 KiB is recorded cut; no chunk, one the main thread redacts keeps nothing; tests over them are unproven.",evidence:["part","reason"]}});function br(e){return e.replace(/\s+/g," ").trim()}function kr(e,t){let{code:n,...r}=e;return`[keploy] ${n}: dropped an event: ${br(t)} The capture continues; any further such events in this capture are dropped silently. evidence=${xr(r)}`}function Sr(e,t){let{code:n,...r}=e;return`[keploy] ${n}: ${br(t)} evidence=${xr(r)}`}function xr(e){try{return JSON.stringify(e)}catch{let t={};for(let[n,r]of Object.entries(e))t[n]="string"==typeof r||"number"==typeof r?r:Cr(r);return JSON.stringify(t)}}function Er(e){return 401===e||403===e?"KUI_E_INGEST_KEY_REJECTED":404===e||405===e?"KUI_E_INGEST_ENDPOINT_NOT_FOUND":409===e?"KUI_E_SESSION_CONFLICT":e>=400&&e<500&&429!==e?"KUI_E_INGEST_REJECTED":null}var Ir={message:null,issues:null},Ar=500;function Tr(e){if(null===e)return Ir;let t=e.trim();if(""===t)return Ir;try{let e=JSON.parse(t);if(null!==e&&"object"==typeof e){let t=e;if("string"==typeof t.error){let e=t.error.trim();return{message:""===e?null:e.slice(0,Ar),issues:_r(t.issues)}}}}catch{}return{message:t.slice(0,Ar),issues:null}}var Rr=100;function _r(e){if(!Array.isArray(e))return null;let t=[];for(let n of e){if(t.length===Rr)break;if(null===n||"object"!=typeof n)continue;let{path:e,message:r}=n;"string"!=typeof e||"string"!=typeof r||t.push({path:e.slice(0,Ar),message:r.slice(0,Ar)})}return t.length>0?t:null}function Cr(e){if("string"==typeof e)return e;if(e instanceof Error)return`${e.name}: ${e.message}`;if("function"==typeof e)return`[function ${e.name}]`;if("object"!=typeof e||null===e)return String(e);try{return JSON.stringify(e)}catch{let t=e.constructor;return`[${"string"==typeof t?.name?t.name:"object"} not JSON-serialisable]`}}var Or=class extends Error{code;status;serverMessage;issues;remedy;evidence;constructor(e,t,n,r,i){super(t),this.name="CaptureError",this.code=e,this.remedy=mr[e].remedy,this.status=n,this.serverMessage=r.message,this.issues=r.issues,this.evidence=i}},$r=class extends Or{constructor(e){let{message:t,issues:n}=e.server,r=`[keploy] capture stopped: the server rejected this batch with ${e.status} and will reject the rest, so capture has stopped (${e.code}). ${null===t?"(no response body)":t}`;if(null!==n){let e=n.slice(0,5).map(e=>`${""===e.path?"body":e.path}: ${e.message}`).join("; "),t=n.length-5;r+=` -- ${e}${t>0?` (+${t} more)`:""}`}super(e.code,r,e.status,e.server,{status:e.status,serverMessage:t,endpoint:e.endpoint,sessionId:e.sessionId,...null!==n?{issues:n}:{}})}},Dr=class extends Or{constructor(e){super("KUI_E_SESSION_ID_INVALID",`[keploy] capture did not start: sessionIdGenerator ${null!==e.sessionId?`returned ${JSON.stringify(e.sessionId)}, which the ingest server would refuse`:e.received.startsWith("threw ")?e.received:`returned ${e.received}, which is not a session id`} (KUI_E_SESSION_ID_INVALID). A session id ${fr}.`,null,Ir,{sessionId:e.sessionId,received:e.received,rule:fr})}},Nr=class extends Or{constructor(e){super("KUI_E_STRICT_ATTRIBUTES_UNAVAILABLE",`[keploy] capture ended before anything was recorded: privacyMode "strict" could not load its attribute allow-list (KUI_E_STRICT_ATTRIBUTES_UNAVAILABLE): ${e.reason}. What to do: ${mr.KUI_E_STRICT_ATTRIBUTES_UNAVAILABLE.remedy.docs}`,null,Ir,{reason:e.reason})}},zr=class extends Or{constructor(e){super("KUI_E_DOM_RECORDER_UNAVAILABLE",`[keploy] capture ended before anything was sent: rrweb, the library the SDK records the page with, could not be loaded (KUI_E_DOM_RECORDER_UNAVAILABLE): ${e.reason}. What to do: ${mr.KUI_E_DOM_RECORDER_UNAVAILABLE.remedy.docs}`,null,Ir,{reason:e.reason})}},Lr=class extends Or{constructor(e){super("KUI_E_PRIVACY_ROUTE_INVALID",`[keploy] capture did not start: privacy.${e.option} has ${e.received}, which is no route (KUI_E_PRIVACY_ROUTE_INVALID). ${Je}.`,null,Ir,{option:e.option,received:e.received,rule:Je})}},Br=class extends Or{constructor(e){super("KUI_E_CAPTURE_DECLINED",`[keploy] capture did not start: the browser sent ${"doNotTrack"===e?"Do Not Track":"Global Privacy Control"}, and honorPrivacySignals is on (KUI_E_CAPTURE_DECLINED). Nothing was recorded or sent.`,null,Ir,{signal:e})}},Ur=class extends Or{constructor(){super("KUI_E_PRIVACY_CONFLICT",'[keploy] capture did not start: privacyMode "strict" records no request or response body, and privacy.maskNetworkBodies is false, which asks for them (KUI_E_PRIVACY_CONFLICT). Remove privacy.maskNetworkBodies, or use privacyMode "balanced".',null,Ir,{privacyMode:"strict",option:"privacy.maskNetworkBodies"})}};function Pr(e){if("threw"in e)return`threw ${Cr(e.threw)}`;let t=e.returned;if("object"==typeof t&&null!==t){if("function"==typeof t.then)return"a Promise (sessionIdGenerator must return a string synchronously)";let e=t.constructor,n="string"==typeof e?.name?e.name:"";if(""!==n&&"Object"!==n)return`object ${n} ${Cr(t)}`}return`${typeof t} ${Cr(t)}`}var qr,jr,Mr,Kr=!1,Wr=!1,Fr=[],Hr=0,Zr=()=>Hr,Vr=new WeakSet,Jr=!1,Xr=[],Gr=!1,Qr=[];function Yr(e=!0){if(!Kr)return;for(let t of Qr)t(e);Kr=Wr=Jr=!1,qr=jr=Mr=void 0;let t=Xr;Xr=[],ii(),setTimeout(()=>{for(let e of t)oi(e)||e()},0)}var ei=new Set,ti=(e,t)=>new Promise((n,r)=>{let i=()=>{if(Wr&&!t)return n(void 0);let i=()=>n(void 0);ei.add(i),e.then(e=>(ei.delete(i),n(e)),e=>(ei.delete(i),r(e)))};(t||!ri(i))&&i()});function ni(){for(let e of ei)e();ei.clear()}function ri(e){let t=Kr&&!Wr;return t&&Fr.push(e),t}function ii(){let e=Fr;Fr=[];for(let t of e)t()}function si(){!Kr||Wr||(Wr=!0,Xr.length&&ni(),ii())}function oi(e){return Kr&&(Xr.push(e),Wr&&ni()),Kr}function ai(e){return new Promise((t,n)=>{let r=()=>{new Promise(t=>t(e())).then(t,e=>{oi(r)||n(e)})};oi(r)||r()})}var li=()=>globalThis.navigation;function ui(e,t,n,r){let i=Hr;setTimeout(()=>{if(!r)return void(qr===e&&t()&&Yr(n));if(Jr||i!==Hr||!Kr)return;let s=r.defaultPrevented||Vr.has(r);if(r===Mr&&qr===r&&(s||t()))return Yr(n);r!==Mr&&s||(Jr=!0,si())},0)}function ci(e){let t=e.type,n=e;if("currententrychange"===t)return void(jr&&(n.from!==li()?.currentEntry||n.navigationType)&&Vr.add(jr));if("pageshow"===t)return void(e.isTrusted&&e.persisted&&Yr());Kr||(jr=void 0);let r=Kr;"navigate"===t&&(jr=e),!n.destination?.sameDocument&&null==n.downloadRequest&&(r||Hr++,Kr=!0,qr=e,"navigate"!==t?setTimeout(()=>{qr===e&&(Jr=!0,si())},0):(ui(e,()=>li()?.transition,r&&Wr,Mr=n),n.signal?.addEventListener("abort",()=>ui(qr,()=>jr===e,!1))))}var di=["beforeunload","pageshow"];function hi(e,t=e){if(t&&Yr(),Gr===e||"function"!=typeof addEventListener)return;Gr=e;let n={capture:!0,passive:!0},r=(t,r)=>{for(let i of r)e?t?.addEventListener(i,ci,n):t?.removeEventListener(i,ci,n)};r(globalThis,di),r(li(),["navigate","currententrychange"])}var fi="3.1.0-rc.2";function pi(e){return"default"in e?e.default:e}function gi(e,t){let n=e=>{let t=pi(e),n=t.version;if(n!==fi)throw new Error(`a chunk of version ${String(n)}, not the SDK's ${fi}`);return t};return ai(e).then(n).catch(e=>t?ai(t).then(n).catch(t=>Promise.reject(new Error(`${String(e)}; beside the SDK: ${String(t)}`,{cause:e}))):Promise.reject(e))}var yi,vi,mi,wi,bi=!1,ki=!1,Si=!1,xi=new Set,Ei=new Map,Ii=0,Ai=e=>e.mark===Zr();function Ti(e){(typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout)(e,{timeout:1e3,valueOf:()=>0})}var Ri,_i,Ci="";function Oi(e,t){if(!Ci.includes(e)){Ci+=e;try{console.warn(function(e,t){return Sr({code:"KUI_E_BODY_WORKER_UNAVAILABLE",part:e,reason:t},"could not run the body worker or load the body chunk (evidence.part): without the worker, a body over 64 KiB is recorded cut; without the chunk, a body the main thread must redact is recorded with nothing kept; replay reports a test over a cut body unproven. Allow worker-src 'self' in the page's CSP, use a bundler that emits the worker (or copy dist/body-worker.js beside the bundle), serve it from the page's origin, or serve the SDK's dist/ as it is. Said once per page for each part.")}(e,typeof Event<"u"&&t instanceof Event?t.message||"the worker's script did not load or run (refused by the page's CSP, a 404, or a script that does not parse)":Cr(t)))}catch{}}}function $i(e){if(typeof navigator>"u"||!1!==navigator.onLine||function(){try{return!!navigator.serviceWorker?.controller}catch{return!1}}()||"function"!=typeof addEventListener)return!1;if(!Ri){Ri=[];let e=()=>{if(!1===navigator.onLine)return;_i?.();let e=Ri??[];Ri=void 0;for(let t of e)t()};addEventListener("online",e);let t=setInterval(e,1e3);_i=()=>{removeEventListener("online",e),clearInterval(t),_i=void 0}}return Ri.push(e),!0}function Di(){return vi??=new Promise(e=>{let t=()=>{bi=!1,gi(()=>import("@keploy/capture-sdk/body-redact"),void 0).then(e=>{if("function"!=typeof e.redactBodies)throw new TypeError("the body chunk has no redactBodies export");return e}).then(t=>{yi=t,lr.redact=e=>t.redactBodies(e),e()},t=>{ki=!0,Oi("code",t),e()})};(bi=$i(t))||t()})}function Ni(){if(Si||void 0!==mi)return;Si=!0;let e=()=>{gi(()=>import("@keploy/capture-sdk/body-worker-start"),void 0).then(e=>ai(()=>e.startBodyWorker())).then(e=>{e.onmessage=({data:t})=>{wi=e;let n=Ei.get(t.id);n&&(Ei.delete(t.id),n.owner.answered(n,t.out))},e.onerror=t=>ji(e,t),mi=e,Si=!1;let t=xi;xi=new Set;for(let e of t)qi(e)}).catch(e=>ji(null,e))};$i(e)||e()}function zi(){Di(),Ni()}var Li,Bi=!1,Ui=!1;function Pi(e=!1){vi&&void 0!==mi||(e?Bi:Ui)||(e?Bi=!0:Ui=!0,(e?Ti:e=>setTimeout(e,0))(()=>{e?Bi=!1:Ui=!1,zi()}))}function qi(e){if(!e.owner.has(e))return;let t=mi?mi===wi:null===mi&&yi;if(t||!Ai(e)||!ri(()=>qi(e))){if(!t&&(e=>Wr&&Ai(e))(e))return e.owner.answered(e,Fi(e.job)),void(e.job=null);if(mi){Ei.set(++Ii,e);try{mi.postMessage({id:Ii,job:e.job})}catch{Ei.delete(Ii),e.owner.alone(e)}}else null===mi?e.owner.alone(e):(xi.add(e),zi())}}function ji(e,t){if(e&&mi!==e)return;try{e?.terminate()}catch{}let n=[...Ei.values(),...xi].filter(e=>e.owner.has(e));Ei.clear(),mi=void 0,xi=new Set(n),Si=!0;let r=()=>{Si=!1,Ni()};if(!$i(r)&&!oi(r)){Si=!1,mi=null,xi=new Set,Oi("worker",t);for(let e of n)e.owner.alone(e)}}function Mi(){if(Li=void 0,mi&&!(Ei.size>0)){try{mi.terminate()}catch{}mi=void 0}}var Ki=()=>{Li&&(Ei.clear(),Mi())};function Wi(e=!0,t=()=>!1){if(e&&Ri&&(_i?.(),Ri=void 0,bi&&(vi=void 0),void 0===mi&&(Si=!1),xi=new Set),t()&&void 0!==wi&&mi===wi&&Kr)return Li=t,void addEventListener("pagehide",Ki);Mi()}function Fi(e){let t=e=>e&&function(e,t){return`${function(e,t){return`[Body cut: 0 of ${t} characters kept, unverified]\n`}(0,e)}[Body not captured: ${$[t]}]\n`}(e.length,ki?"code-failed":"left");return{requestBody:t(e.requestBody),responseBody:t(e.responseBody)}}function Hi(e,t,n=t){try{return yi.redactBodies(e,t,n)}catch{return null}}function Zi(e){return(e?.requestBody?.length??0)+(e?.responseBody?.length??0)}Qr.push(e=>{e&&mi&&mi!==wi&&ji(mi,"left"),Li&&!Li()&&Mi()});var Vi=class{held=new Map;redact(e,t,n,r=Zr()){let i={job:e,owner:this,after:n,mark:r};this.held.set(i,t),e&&(e.requestBody||e.responseBody)?typeof requestIdleCallback>"u"&&(i.sent=!0,qi(i)):i.out={requestBody:e?e.requestBody:null,responseBody:e?e.responseBody:null},Promise.resolve(n).then(()=>Ti(()=>{this.held.has(i)&&(void 0!==i.out?this.answer(i,i.out):i.sent||qi(i))}))}holds(){return this.held.size>0}has(e){return this.held.has(e)}answered(e,t){this.held.has(e)&&(e.out=t,Promise.resolve(e.after).then(()=>Ti(()=>this.answer(e,t))))}answer(e,t){let n=this.held.get(e);n&&(this.held.delete(e),xi.delete(e),e.job=null,n(t))}alone(e){Promise.all([Di(),e.after]).then(()=>Ti(()=>{if(!this.held.has(e))return;let t=e.job;this.answer(e,yi?Hi(t,65536):Fi(t))}))}now(e){let t=65536;for(let n of e?[!0,!1]:[!0])for(let e of[...this.held.keys()]){if(void 0!==e.out){this.answer(e,e.out);continue}let r=e.job;if(!r){this.answer(e,{requestBody:null,responseBody:null});continue}let i=Zi(r);if(n&&!(yi&&i<=t))continue;let s=Math.min(r.requestBody?.length??0,t);this.answer(e,yi?Hi(r,s,t-s):Fi(r)),t-=n?i:t}}},Ji=/^[\t\n\r ]*\{/,Xi=/[^\t\n\r ]/;var Gi,Qi=!1;function Yi(e){try{let t=typeof document<"u"?document.baseURI:void 0;return new URL(e,t).href}catch{return e}}function es(e){let t={};if(!e)return t;if(e instanceof Headers)e.forEach((e,n)=>{t[n]=e});else if(Array.isArray(e))for(let[n,r]of e)t[n]=r;else Object.assign(t,e);return t}function ts(e,t){return e.length>t?e.slice(0,t)+ue:e}function ns(e){let t=e=>encodeURIComponent(e).replace(/%20/g,"+"),n=[];return e.forEach((e,r)=>{n.push("string"==typeof e?`${t(r)}=${t(e)}`:`${t(r)}=${t(`[File: ${e.name}, ${e.size} bytes]`)}`)}),n.join("&")}function rs(e,t){let n=e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(n.byteLength>t)return`[Binary: ${n.byteLength} bytes]`;try{return new TextDecoder("utf-8",{fatal:!0}).decode(n)}catch{return`[Binary: ${n.byteLength} bytes]`}}function is(e,t){if(null==e)return null;try{if("string"==typeof e)return""===e?null:ur;if(e instanceof URLSearchParams||e instanceof FormData)return e.keys().next().done?null:ur;if(e instanceof Blob)return t||e.size>0?ur:null;if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return e.byteLength>0?ur:null;if(t&&typeof Document<"u"&&e instanceof Document)return e.hasChildNodes()?ur:null}catch{}return ur}function ss(e){return"object"==typeof e&&null!==e&&"Request"===e[Symbol.toStringTag]}var os=/^\s*multipart\/form-data\s*(?:;|$)/i;var as=()=>new TextDecoder("utf-8",{ignoreBOM:!0}),ls=(e,t)=>t<4194304&&"{"!==(Xi.exec(e)?.[0]??"{"),us=async e=>as().decode(await e.arrayBuffer());function cs(e){return e+ue}var ds=Reflect.get(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag)??{},"get"),hs=["url","redirected","type","headers"];function fs(e,t){for(let n of hs)Object.defineProperty(e,n,{get:()=>t[n],configurable:!0});let n=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),"clone")?.value;n&&Object.defineProperty(e,"clone",{value:function(){let e=n.call(this);return fs(e,t),e},writable:!0,configurable:!0})}function ps(e,t,n){let r=e.body;if(!r)return null;let i,s,o,a=Object.getPrototypeOf(r).constructor,l=Object.getPrototypeOf(e).constructor,u=new TextDecoder,c="",d=!1,h=!1,f=!1,p=!1,g=!1,y=[],v=0,m=null,w=null,b=new Promise(e=>i=e),k=e=>{p||(p=!0,n(e))},S=()=>{if(!m||!w)return;let e=y.shift();if(e)w.enqueue(new Uint8Array(e.chunk)),v=e.textEnd;else{if(!h)return;w.close(),w.byobRequest?.respond(0)}let t=m;m=null,t()},x=()=>{g||h||f||d&&!m||(g=!0,A.read().then(e=>{if(g=!1,!f)try{if(e.done)h=!0,i(),d||k(ts(c+u.decode(),t));else{let n=function(e){if("Uint8Array"===function(e){return"function"==typeof ds?Reflect.apply(ds,e,[]):void 0}(e))return e;throw new TypeError("a response body chunk is not a Uint8Array")}(e.value);n.byteLength>0&&(d||(c+=u.decode(n,{stream:!0}),c.length>t&&(d=!0,setTimeout(i,1e3),k(ts(c,t)),c="")),y.push({chunk:n,textEnd:c.length}))}S(),x()}catch(e){E(e),A.cancel(e).catch(()=>{})}},e=>{g=!1,!f&&E(e)}))},E=e=>{f=!0,i(),k(cs(c)),y.length=0;try{w?.error(e)}catch{}let t=m;m=null,t?.()},I={start(e){w=e},pull:()=>new Promise(e=>{m=e,S(),x()}),cancel:e=>(f=!0,i(),k(c.slice(0,v)),y.length=0,A.cancel(e))};try{s=new a({...I,type:"bytes"},{highWaterMark:0})}catch{s=new a(I,{highWaterMark:0})}try{o=new l(s,{status:e.status,statusText:e.statusText,headers:e.headers})}catch{return null}let A=r.getReader();return fs(o,e),x(),{page:o,cut:()=>{d||k(cs(c)),i()},done:b}}function gs(e){let t=typeof document<"u"&&document.baseURI?document.baseURI:typeof location<"u"?location.href:void 0;return new URL(e,t).href}var ys=class{callback=null;privacyEngine;maxBodySize;ignored;active=!1;inflight=new Set;unloadCuts=new Set;bodies=new Vi;place;admit=null;run=0;originalFetch=null;originalXhrOpen=null;originalXhrSend=null;originalXhrSetHeader=null;constructor(e={},t=524288,n=[],r="balanced"){this.privacyEngine=new cr(e,r),this.maxBodySize=t,this.ignored=new Set(n.map(Yi))}ignores(e){return this.ignored.size>0&&this.ignored.has(Yi(e))}start(e,t,n){this.active||(this.active=!0,this.run++,this.callback=e,this.admit=t??null,this.place=n,this.termWarned=!1,this.privacyEngine.getConfig().maskNetworkBodies||Pi(!0),this.patchFetch(),this.patchXHR())}askForCode(){this.privacyEngine.getConfig().maskNetworkBodies||Di()}stop(){this.active&&(this.active=!1,0===this.inflight.size&&(this.callback=null),this.restoreFetch(),this.restoreXHR())}settle(e){let t,n=Promise.allSettled([...this.inflight]),r=new Promise(n=>{t=setTimeout(n,e)});return Promise.race([n,r]).then(()=>{clearTimeout(t),!this.active&&(this.cutInflight(),this.callback=null)})}cutInflight(){this.cutBodies(),this.bodies.now(!0)}cutBodies(){for(let e of[...this.unloadCuts])e()}reportDue(){this.bodies.now(!1)}hasInflight(){return this.inflight.size>0}admits(){if(!this.active)return!1;try{let e=!this.admit||this.admit();return e&&!this.privacyEngine.getConfig().maskNetworkBodies&&Pi(),e}catch{return!1}}emitFor(e,t,n,r,i){e===this.run&&this.emit(t,n,r,i)}track(e){this.inflight.add(e),e.finally(()=>{this.inflight.delete(e),!this.active&&0===this.inflight.size&&(this.callback=null)})}recordResponse(e,t){let n=Number(e.headers.get("content-length")??0);if(n>this.maxBodySize)return t(`[Response body too large: ${n} bytes]`),{page:e,cut:null};if(null===e.body)return t(""),{page:e,cut:null};let r=null;if(void 0!==e.body)try{r=ps(e,this.maxBodySize,t)}catch{return t(null),{page:e,cut:null}}if(r)return r;try{e.clone().text().then(e=>t(ts(e,this.maxBodySize)),()=>t(null))}catch{t(null)}return{page:e,cut:null}}patchFetch(){if("function"!=typeof globalThis.fetch)return;let e=globalThis.fetch;this.originalFetch=e,globalThis.fetch=(t,n)=>{if(!this.active||!this.admits())return e.call(globalThis,t,n);let r;try{r=ss(t)?t.url:t instanceof URL?t.href:String(t)}catch{return e.call(globalThis,t,n)}if(this.ignores(r))return e.call(globalThis,t,n);let i,s=t;if(ss(t)&&null==n?.body)try{s=t.clone()}catch{return e.call(globalThis,t,n)}try{i=new Request(s,n)}catch{return e.call(globalThis,t,n)}let o=this.run,a=performance.now(),l=i.method,u=gs(i.url),c=es(i.headers),d=this.privacyEngine.getConfig().maskNetworkBodies,h=e.call(globalThis,t,n),f=null==n?.body&&(i.body||ss(t)&&void 0===i.body&&!/^(?:GET|HEAD)$/.test(l))?function(e,t,n=!1){if(os.test(e.headers.get("content-type")??""))return e.formData().then(ns);let r=e.body;if(r)return async function(e,t,n){let r=e.getReader(),i=as(),s="",o="";try{for(;;){let e=await r.read();if(e.done)return s+i.decode();let a=i.decode(e.value,{stream:!0});if(o||(o=Xi.exec(a)?.[0]??""),s+=a,n&&ls(o,t))return r.cancel().catch(()=>{}),s;if(s.length>t&&(s.length>4194304||""!==o&&"{"!==o))return r.cancel().catch(()=>{}),s}}catch{return null}}(r,t,n);let i=3*t+4;return e.blob().then(async e=>{if(0===e.size)return;if(n){let n=await us(e.slice(0,1024));if(ls(n,t))return n}let r=await us(e.slice(0,i));return e.size>i&&/^[\t\n\r ]*(?:\{|$)/.test(r)?us(e.slice(0,12582916)):r}).catch(()=>null)}(i,this.maxBodySize,d):null,p=null!=n?.body?d?Promise.resolve(is(n.body,!1)):async function(e,t){if(null==e)return null;try{return"string"==typeof e?ts(e,t):e instanceof URLSearchParams?ts(e.toString(),t):e instanceof FormData?ts(ns(e),t):e instanceof Blob?e.size>t?`[Blob: ${e.size} bytes, truncated]`:await e.text():e instanceof ArrayBuffer||ArrayBuffer.isView(e)?rs(e,t):"[ReadableStream]"}catch{return"[Unreadable body]"}}(n.body,this.maxBodySize):f?f.then(e=>null==e?null:ts(e,this.maxBodySize),()=>"[Unreadable body]"):Promise.resolve(null),g=null!=n?.body?this.termFor(n.body,l):f?f.then(e=>null===e?"body:*":this.termFor(e,l),()=>"body:*"):this.termFor(null,l);return Promise.resolve(h).then(e=>{if(o!==this.run||!this.admits())return e;try{let t,n="HEAD"===l||[204,205,304].includes(e.status);return this.reportWhenKnown(o,Date.now(),{method:l,url:u,requestHeaders:c,requestBody:null,responseHeaders:es(e.headers),responseBody:null,statusCode:e.status,duration:performance.now()-a,type:"fetch"},p,g,r=>{return n?(r(""),t={page:e,cut:null}):d?(r(null===(i=e).body||i.body?.locked||/^\s*0+\s*$/.test(i.headers.get("content-length")??"")?null:ur),t={page:e,cut:null}):t=this.recordResponse(e,r);var i}),t.page}catch{return e}},e=>{throw o!==this.run||!this.admits()||this.reportWhenKnown(o,Date.now(),{method:l,url:u,requestHeaders:c,requestBody:null,responseHeaders:{},responseBody:null,statusCode:0,duration:performance.now()-a,type:"fetch"},p,g),e})}}restoreFetch(){this.originalFetch&&(globalThis.fetch=this.originalFetch,this.originalFetch=null)}patchXHR(){if(typeof XMLHttpRequest>"u")return;let e=XMLHttpRequest.prototype.open,t=XMLHttpRequest.prototype.send;this.originalXhrOpen=e,this.originalXhrSend=t;let n=this.maxBodySize,r=()=>this.admits(),i=()=>this.run,s=(e,t)=>this.termFor(e,t),o=(...e)=>this.reportWhenKnown(...e),a=e=>this.ignores(e),l=()=>this.privacyEngine.getConfig().maskNetworkBodies,u=new WeakMap,c=XMLHttpRequest.prototype.setRequestHeader;this.originalXhrSetHeader=c,XMLHttpRequest.prototype.setRequestHeader=function(e,t){let n=u.get(this);return n&&(n.requestHeaders[e]=t),c.call(this,e,t)};let d=e;XMLHttpRequest.prototype.open=function(e,t,...n){let r="string"==typeof t?t:t.toString(),i=d.call(this,e,t,...n);return a(r)||u.set(this,{method:e,url:gs(r),requestHeaders:{},startTime:0}),i},XMLHttpRequest.prototype.send=function(e){let a=u.get(this);a&&(a.startTime=performance.now());let c,d=i(),h=r(),f=()=>{this.readyState<2||(c=Zr(),this.removeEventListener("readystatechange",f))};a&&h&&this.addEventListener("readystatechange",f);let p=l();return this.addEventListener("loadend",()=>{if(!a||!h||!r())return;let t=performance.now()-a.startTime,i=this.getAllResponseHeaders(),l={};if(i)for(let e of i.trim().split(/[\r\n]+/)){let t=e.indexOf(": ");t>0&&(l[e.slice(0,t)]=e.slice(t+2))}let u=null;if(p)u=function(e){if(""!==e.responseType&&"text"!==e.responseType)return ur;try{return e.responseText?ur:null}catch{return ur}}(this);else try{"string"==typeof this.responseText&&(u=ts(this.responseText,n))}catch{u=`[${this.responseType} response]`}let f=p?is(e,!0):function(e,t){if(null==e)return null;if("string"==typeof e)return ts(e,t);if(e instanceof FormData)return ts(ns(e),t);if(e instanceof URLSearchParams)return ts(e.toString(),t);if(typeof Blob<"u"&&e instanceof Blob)return`[Blob: ${e.size} bytes]`;if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return rs(e,t);if(typeof Document<"u"&&e instanceof Document)try{return ts((new XMLSerializer).serializeToString(e),t)}catch{return"[Unreadable body]"}return"[Unreadable body]"}(e,n);o(d,Date.now(),{method:a.method,url:a.url,requestHeaders:a.requestHeaders,requestBody:f,responseHeaders:l,responseBody:u,statusCode:this.status,duration:t,type:"xhr"},null,s(e,a.method),void 0,c)},{once:!0}),t.call(this,e)}}restoreXHR(){typeof XMLHttpRequest>"u"||(this.originalXhrOpen&&(XMLHttpRequest.prototype.open=this.originalXhrOpen,this.originalXhrOpen=null),this.originalXhrSend&&(XMLHttpRequest.prototype.send=this.originalXhrSend,this.originalXhrSend=null),this.originalXhrSetHeader&&(XMLHttpRequest.prototype.setRequestHeader=this.originalXhrSetHeader,this.originalXhrSetHeader=null))}reportWhenKnown(e,t,n,r,i,s,o=Zr()){let a,l=r?null:{value:n.requestBody},u="object"==typeof i?null:{value:i},c=s?null:{value:n.responseBody},d=!1,h=()=>{},f=(r,i,s)=>{d||(d=!0,this.unloadCuts.delete(g),h(),this.emitFor(e,{...n,requestBody:r.value,responseBody:s.value,...void 0===i.value?{}:{requestTerm:i.value}},t,a?.done,o))},p=()=>{l&&u&&c&&f(l,u,c)},g=()=>{a?.cut?.(),f(l??{value:"[Unreadable body]"},u??{value:"body:*"},c??{value:null})};if(l&&u&&c)return p();this.unloadCuts.add(g),this.track(new Promise(e=>h=e)),r?.then(e=>{l={value:e},p()}),"object"==typeof i&&i.then(e=>{u={value:e},p()}),a=s?.(e=>{c={value:e},p()})}termWarned=!1;termFor(e,t){try{let r=null==(n=e)||""===n?"":"string"==typeof n?n.length>4194304?"body:*":function(e){return Ji.test(e)&&(e.includes('"query"')||e.includes("persistedQuery")||e.includes("\\u"))}(n)?null:"":n instanceof URLSearchParams||typeof FormData<"u"&&n instanceof FormData?"":"body:*";if(null!==r)return r;let i=globalThis.crypto?.subtle;return ti((Gi||(Gi=gi(()=>import("@keploy/capture-sdk/request-term"),void 0).then(e=>(Qi=!0,e))).catch(()=>{}),Gi),Qi).then(t=>t?t.recordTermFor(e,i):"body:*",e=>(this.termFailed(t,e),"body:*")).catch(e=>this.termFailed(t,e))}catch(e){return this.termFailed(t,e)}var n}termFailed(e,t){if(!this.termWarned){this.termWarned=!0;try{console.warn(function(e,t){return Sr({code:"KUI_E_REQUEST_TERM_FAILED",method:e,reason:t},"recorded a request without its term, or body:*: computing it failed; the request itself was not affected. The capture continues; any further such requests in this capture are recorded that way, silently.")}(e,Cr(t)))}catch{}}}emit(e,t,n,r){let i=this.callback;if(!i)return;let s,o,a=this.place?.();this.track(new Promise(e=>s=e));try{o=this.privacyEngine.bodyJob(e)}catch{return s()}this.bodies.redact(o,n=>{if(s(),n)try{i(this.privacyEngine.maskNetworkData(e,n),t,a)}catch{}},n,r)}},vs=fi,ms=32768;function ws(e){try{e()}catch(e){setTimeout(()=>{throw e})}}function bs(e){return(new TextEncoder).encode(e).length}var ks=10485760,Ss=16777216,xs=class{config;queue=[];retryQueue=[];batchCounter=0;flushTimer=null;current=null;sessionId=null;metadata=null;captureIdentity=null;get online(){return typeof navigator>"u"||!1!==navigator.onLine}started=!1;nextSeq=1;drainPending=!1;holding=!1;asked=0;rushDeferred=!1;wakeSender=null;inflightKeepaliveBytes=0;envelopeBytes=0;reportedUnserialisable=!1;reportedOversized=!1;reportedScrubOversized=!1;reportedNavigationUnwrapped=!1;jsonOf=new WeakMap;inFlight=null;held=0;queued=0;counted=!1;failures=0;notBefore=0;constructor(e){this.config={...e,batchSize:Math.min(e.batchSize,5e3)}}fail(e,t,n){this.discard();let r=new $r({code:e,status:t,server:Tr(n),endpoint:this.config.endpoint,sessionId:this.sessionId??null});if(this.config.endsSessionOnly?.(e,function(e){if(null===e)return null;try{let t=JSON.parse(e)?.reason;return"string"==typeof t?t.slice(0,100):null}catch{return null}}(n))){this.stop();try{this.config.onSessionEnd?.()}catch{}}else{ws(()=>console.error(r.message)),this.stop();try{this.config.onCaptureEnd?.()}catch{}try{this.config.onError?.(r)}catch{}}}start(e,t,n=null){this.started||(this.started=!0,this.sessionId=e,this.metadata=t,this.captureIdentity=n,this.envelopeBytes=bs(JSON.stringify(this.payload([],this.mintBatchId()))),this.flushTimer=setInterval(()=>{this.paced||this.flush(this.rushDeferred&&this.online)},this.config.batchInterval),typeof window<"u"&&(window.addEventListener("online",this.handleOnline),window.addEventListener("pagehide",this.handleUnload),window.addEventListener("beforeunload",this.handleUnload),document.addEventListener("visibilitychange",this.handleVisibility)))}hold(){this.holding=!0}release(){this.holding=!1,this.flush(!0)}discard(){this.queue=[],this.queued=0,this.retryQueue=[]}stop(){if(!this.started)return this.current??Promise.resolve();this.started=!1,this.holding&&this.discard(),this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null);let e=this.flush(!0);return typeof window<"u"&&(window.removeEventListener("online",this.handleOnline),e.finally(()=>this.disarmWhenDrained())),e}disarmWhenDrained(){this.started||this.pendingCount()>0||typeof window>"u"||(window.removeEventListener("pagehide",this.handleUnload),window.removeEventListener("beforeunload",this.handleUnload),document.removeEventListener("visibilitychange",this.handleVisibility))}enqueue(e){if(!this.started)return;let t;e.seq??=this.nextSeq++;try{let n=JSON.stringify(e),r=bs(n);this.jsonOf.set(e,[n,r]),t=this.envelopeBytes+r}catch(t){return this.reportUnserialisable(e,t),void this.dropped([e])}if(t>ks)return this.reportOversized(e,t),void this.dropped([e]);this.queue.push(e),this.held+=t,this.queued+=this.eventBytes(e);let n=[];for(;this.queue.length>this.config.maxQueueSize;){let e=this.queue.shift();this.queued-=this.eventBytes(e),n.push(e)}n.length>0&&this.dropped(n),this.fit(),!this.paced&&(t>ms?this.online?this.flush(!0):this.rushDeferred=!0:this.queue.length>=this.config.batchSize?(null!==this.current&&this.asked++,this.flush()):this.online&&this.pastShare()&&(this.counted=!0,this.flush()))}place(){return this.nextSeq++}get paced(){return performance.now()<this.notBefore}fit(){if(this.held<=Ss)return;let e=0;for(let t of this.retryQueue)e+=t.bytes;for(let t of this.queue)e+=this.eventBytes(t);let t=[];for(;e>Ss;){let n=this.retryQueue.shift();if(n)e-=n.bytes,t.push(...n.events);else{let n=this.queue.shift();e-=this.eventBytes(n),this.queued-=this.eventBytes(n),t.push(n)}}this.held=e,t.length>0&&this.dropped(t)}dropped(e){!this.online&&0===this.failures&&(this.failures=1,ws(()=>this.config.onFailing?.(!0)));let t=1/0;for(let n of e)"dom"===n.type&&(t=Math.min(t,n.seq??-1/0));let n=!1;if(t!==1/0){let r=[];for(let i of this.queue){let s=(i.seq??-1/0)>t,o="dom"===i.type?i.data?.type:void 0;s&&2===o&&(n=!0),s&&!n&&3===o?(e.push(i),this.queued-=this.eventBytes(i)):r.push(i)}this.queue=r}ws(()=>this.config.onDropped?.(e,n))}reportUnserialisable(e,t){if(this.reportedUnserialisable)return;this.reportedUnserialisable=!0;let n=t instanceof Error?t.message:String(t);console.warn(kr({code:"KUI_E_EVENT_UNSERIALISABLE",eventId:e.id,eventType:e.type,reason:n},"it cannot be serialised to JSON."))}reportOversized(e,t){this.reportedOversized||(this.reportedOversized=!0,this.warnOversized({code:"KUI_E_EVENT_OVERSIZED",eventId:e.id,eventType:e.type,bytes:t,cap:ks},`${t} bytes in a body, over the ingest server's ${ks}-byte cap, so no batch could carry it.`))}reportScrubOversized(e,t,n){this.reportedScrubOversized||(this.reportedScrubOversized=!0,this.warnOversized({code:"KUI_E_EVENT_OVERSIZED_SCRUBBING",eventType:e,atLeast:t,cap:n},`scrubbing the page URL's credentials out of it was certain to write at least ${t} characters, over the ingest server's ${n}-byte cap, so no batch could carry it.`))}reportNavigationUnwrapped(e){this.reportedNavigationUnwrapped||(this.reportedNavigationUnwrapped=!0,this.warn(Sr({code:"KUI_E_NAVIGATION_UNWRAPPED",method:e},"the page made a History or Navigation API method impossible to replace and put back, so the SDK wrapped none of them. The capture continues: route changes are still recorded, with less detail, and none says that the page's script asked for it.")))}warnOversized(e,t){this.warn(kr(e,t))}warn(e){console.warn(e)}payload(e,t){return{sessionId:this.sessionId,batchId:t,events:e,metadata:this.metadata,sdk:{name:"@keploy/capture-sdk",version:vs},captureIdentity:this.captureIdentity}}flush(e=!1){return this.holding?Promise.resolve():(e&&(this.drainPending=!0),this.current?this.current:0===this.pendingCount()||!this.online&&!this.drainPending?(this.drainPending=!1,this.failures>0&&0===this.pendingCount()&&this.online&&(this.failures=this.notBefore=0,ws(()=>this.config.onFailing?.(!1))),Promise.resolve()):(this.current=this.run(),this.current))}async run(){let e=!1;try{do{let t=this.reviveNext()??this.formFlight();if(null===t)return;this.inFlight=t;try{await this.sendWithRetry(t)}catch{return this.notBefore=performance.now()+Math.min(2e3*2**this.failures,6e4)*(1+Math.random()/2),0===this.failures++&&ws(()=>this.config.onFailing?.(!0)),this.held+=t.bytes,this.retryQueue.unshift(t),void this.trimToCapacity()}finally{this.inFlight===t&&(this.inFlight=null)}this.counted=!this.drainPending&&this.online&&this.pastShare(),e=this.asked>0&&!this.holding&&this.online&&this.queue.length>=this.config.batchSize,e&&this.asked--}while((this.drainPending||this.counted||e)&&this.pendingCount()>0)}finally{this.drainPending=!1,this.counted=!1,this.asked=0,0===this.pendingCount()&&(this.rushDeferred=!1),this.current=null,this.disarmWhenDrained()}}backoff(e){return new Promise(t=>{let n=()=>{clearTimeout(r),this.wakeSender===n&&(this.wakeSender=null),t()},r=setTimeout(n,e);this.wakeSender=n})}async sendWithRetry(e){let t=e.json,n=e.wire??=async function(e){if(typeof CompressionStream<"u"&&typeof Response<"u")try{let t=new Response(e).body.pipeThrough(new CompressionStream("gzip")),n=await new Response(t).arrayBuffer(),r=bs(e);return n.byteLength<r?{body:n,bytes:n.byteLength,encoding:"gzip"}:{body:e,bytes:r,encoding:null}}catch{}return{body:e,bytes:bs(e),encoding:null}}(t);for(let t=0;t<3;t++){if(e.abandoned)return;let r,i=null;try{let{body:t,bytes:s,encoding:o}=e.sent=await n;if(e.abandoned)return;let a={"Content-Type":"application/json","X-API-Key":this.config.apiKey};o&&(a["Content-Encoding"]=o);let l=!e.early&&s<=ms-this.inflightKeepaliveBytes;l&&(this.inflightKeepaliveBytes+=s),e.onWire=!0,e.dispatched=!0;try{r=await fetch(this.config.endpoint,{method:"POST",headers:a,body:t,keepalive:l});try{i=await r.text()}catch{i=null}}finally{e.onWire=!1,l&&(this.inflightKeepaliveBytes-=s)}}catch{}if(r){if(r.ok)return this.failures>0&&(this.failures=this.notBefore=0,this.drainPending=!0,ws(()=>this.config.onFailing?.(!1))),void ws(()=>this.config.onDelivered?.(e.events));let{status:t}=r,n=Er(t);if(null!==n)return void ws(()=>this.fail(n,t,i))}if(this.failures>0||2===t)break;let s=1e3*Math.pow(2,t)*(.5+.5*Math.random());await this.backoff(s)}throw new Error("Transport: all retry attempts failed")}reclaimInFlight(){let e=this.inFlight;if(e&&!e.onWire&&!e.abandoned){if(e.abandoned=!0,this.inFlight=null,this.held+=e.bytes,e.dispatched)return this.retryQueue.unshift(e),void this.trimToCapacity();this.queue.unshift(...e.events),this.uncount(e.events,-1),this.trimToCapacity()}}reviveNext(){let e=this.retryQueue.shift();return e?{events:e.events,batchId:e.batchId,json:e.json,bytes:e.bytes,wire:e.wire,dispatched:e.dispatched,onWire:!1,abandoned:!1,early:e.early}:null}formFlight(){if(0===this.queue.length)return null;let e=this.pastShare(),t=this.counted&&!this.drainPending&&e?ms-this.inflightKeepaliveBytes:ks;this.counted=!1;let n=0,r=this.envelopeBytes,i=0,s=Math.min(this.config.batchSize,this.queue.length);for(;i<s;){let e=this.eventBytes(this.queue[i])+(0===i?0:1);if(r+e>t)break;e>n&&(n=e),r+=e,i++}0===i&&(n=this.eventBytes(this.queue[0]),r+=n);let o=this.queue.splice(0,Math.max(i,1));this.uncount(o);let a=this.mintBatchId(),l=this.body(o,a);for(let e of o)this.jsonOf.delete(e);return{events:o,batchId:a,json:l,dispatched:!1,onWire:!1,abandoned:!1,bytes:r,early:e&&this.envelopeBytes+n<=ms}}body(e,t){return JSON.stringify(this.payload([],t)).replace('"events":[]',()=>`"events":[${e.map(e=>this.jsonOf.get(e)?.[0]??JSON.stringify(e)).join()}]`)}eventBytes(e){return this.jsonOf.get(e)?.[1]??bs(JSON.stringify(e))}mintBatchId(){let e=typeof crypto<"u"?crypto:void 0;if(e&&"function"==typeof e.randomUUID)return e.randomUUID();this.batchCounter+=1;let t=Math.floor(4294967295*Math.random()).toString(16).padStart(8,"0");return`${Date.now().toString(16).padStart(12,"0")}-${(this.batchCounter%4294967296).toString(16).padStart(8,"0")}-`+t}uncount(e,t=1){for(let n of e)this.queued-=t*this.eventBytes(n)}pastShare(){return this.envelopeBytes+this.queued+this.queue.length>ms-this.inflightKeepaliveBytes}pendingCount(){let e=this.queue.length;for(let t of this.retryQueue)e+=t.events.length;return e}trimToCapacity(){let e=0;for(let t of this.retryQueue)e+=t.events.length;let t=[];for(;this.queue.length>0&&e+this.queue.length>this.config.maxQueueSize;){let e=this.queue.pop();this.queued-=this.eventBytes(e),t.push(e)}t.length>0&&this.dropped(t.reverse()),this.fit()}flushOnUnload(e=!1){if(this.holding||(this.reclaimInFlight(),this.queue.sort((e,t)=>e.seq-t.seq),"function"!=typeof fetch))return;for(;this.retryQueue.length>0;){let e=this.retryQueue[0],t=e.sent,n=t?t.bytes:bs(e.json);if(n>ms-this.inflightKeepaliveBytes)return;this.retryQueue.shift(),e.dispatched=!0,this.postKeepalive(t?t.body:e.json,n,t?.encoding)}if(0===this.queue.length)return;let t=ms-this.inflightKeepaliveBytes-(e&&this.inFlight?.early&&this.inFlight.onWire?this.inFlight.sent?.bytes??this.inFlight.bytes:0),n=this.mintBatchId(),r=this.envelopeBytes,i=0;for(let e of this.queue){let n=this.eventBytes(e)+(0===i?0:1);if(r+n>t)break;r+=n,i++}if(0===i)return;let s=this.queue.splice(0,i);this.uncount(s);let o=this.body(s,n);this.postKeepalive(o,bs(o))}postKeepalive(e,t,n){try{this.inflightKeepaliveBytes+=t,fetch(this.config.endpoint,{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":this.config.apiKey,...n?{"Content-Encoding":n}:{}},body:e,keepalive:!0}).then(e=>e.arrayBuffer()).catch(()=>{}).finally(()=>{this.inflightKeepaliveBytes-=t})}catch{this.inflightKeepaliveBytes-=t}}handleOnline=()=>{try{this.config.beforeOnlineFlush?.()}catch{}this.wakeSender?.(),this.flush(this.rushDeferred)};handleUnload=e=>{if("pagehide"===e.type)try{this.config.beforeUnloadFlush?.()}catch{}this.flushOnUnload("beforeunload"===e.type),this.disarmWhenDrained()};handleVisibility=()=>{"hidden"===document.visibilityState&&(this.config.beforeHiddenFlush?.(),this.flush(!0))};get queueSize(){return this.pendingCount()}};function Es(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}var Is=null,As=!1;function Ts(){return Is||(Is=ai(()=>import("rrweb")).then(e=>(As=!0,{record:pi(e).record}),e=>(Is=null,{failed:Cr(e)}))),Is}var Rs=null,_s=!1;function Cs(e){return e?Promise.all([Ts(),Rs??=gi(()=>import("@keploy/capture-sdk/strict-attributes"),void 0).then(e=>{if("function"!=typeof e.kept)throw new TypeError("strict-attributes has no kept()");return function(e){wn=e}(e.kept),_s=!0,null}).catch(e=>(Rs=null,Cr(e)))]).then(([e,t])=>null===t||"failed"in e?e:{failed:t,strict:!0}):Ts()}var Os=[new Set,new Set],$s=[0,0],Ds=e=>e.strict?new Nr({reason:e.failed}):new zr({reason:e.failed});function Ns(){let e=document.documentElement;return{width:window.innerWidth||e?.clientWidth||document.body?.clientWidth||0,height:window.innerHeight||e?.clientHeight||document.body?.clientHeight||0}}function zs(e){return e.split("#").map(e=>{let t=e.indexOf("?");return-1===t?e:e.slice(0,t)}).join("#")}var Ls=new Map,Bs="",Us=-1,Ps=null;function qs(e){return 2===e.kind?`2${e.before}/${e.value}`:`${e.kind}${e.value}`}function js(e){let t=!1;for(let n=e.length-1;n>=0;n--){let r=qs(e[n]);Ls.delete(r)||(t=!0),Ls.set(r,e[n])}let n=new Set(e.map(qs)),r=0;for(let e of Ls.keys())r+=e.length;for(let e of Ls.keys()){if(n.has(e)||Ls.size<=256&&r<=65536)break;Ls.delete(e),r-=e.length,t=!0}return t}var Ms=new Set;function Ks(e){let t=Ye;if(e!==Bs||t!==Us){let n=!1;if(""===Bs||t!==Us){let e=globalThis.performance?.getEntriesByType?.("navigation");e?.[0]&&(n=js(ct(e[0].name)));for(let e of Ms)js(ct(e))&&(n=!0)}Bs=e,Us=t,function(e){Ms.delete(e),Ms.add(e);let t=0;for(let e of Ms)t+=e.length;for(let n of Ms){if(n===e||Ms.size<=64&&t<=524288)break;Ms.delete(n),t-=n.length}}(e),(js(ct(e))||n)&&(Ps=Vt([...Ls.values()]))}return Ps}var Ws=new Set,Fs=null,Hs=null,Zs=null,Vs=[],Js=null,Xs=null,Gs=new Map,Qs=!1;function Ys(e){let t=e,n=t.destination?.url;Zs="string"==typeof n&&"boolean"==typeof t.userInitiated?{href:n,userInitiated:t.userInitiated}:null;let r=t.destination?.key;if("replace"!==t.navigationType){if("traverse"===t.navigationType&&"string"==typeof r){let e=Vs[0]===r&&!1===t.userInitiated;e||r===Xs?Gs.set(r,(Gs.get(r)??0)+1):Gs.delete(r),Vs=e?Vs.slice(1):[],Xs=null}else{let n=[];if("push"===t.navigationType)try{let t=e.currentTarget;n=t.entries().slice(0,t.currentEntry.index).map(e=>e.key)}catch{}Vs=Vs.filter(e=>n.includes(e)),Js=null,(!0!==t.userInitiated||!n.includes(Xs))&&(Xs=null),Gs.clear()}Qs=!1}}function eo(e,t,n){if("object"==typeof t||"function"==typeof t)return null;let r=e;try{let e=0|Number(t),i=r?.entries()??[],s=null===n?Number(r?.currentEntry?.index):i.findIndex(e=>e.key===n);return s<0?null:i[s+e]?.key??null}catch{return null}}function to(e,t){return function(...n){if(Qs)return Reflect.apply(e,this,n);let{next:r,now:i}=t(n);Xs=i,null!==i&&null!==r&&(Js=r,r!==eo(Fs?.navigation??null,0,null)&&Vs.push(r)),Qs=!0;try{return Reflect.apply(e,this,n)}catch(e){throw Vs=[],Xs=null,e}finally{Qs=!1}}}function no(e){let t=e,n=t.navigationType,r=function(){let e=Zs;return Zs=null,null!==e&&e.href===location.href?e.userInitiated:void 0}(),i=function(e){let t=e?.currentEntry?.key;if("string"!=typeof t)return;for(;Vs[0]===t;)Vs.shift();let n=Gs.get(t)??0;return n>1?Gs.set(t,n-1):Gs.delete(t),n?"script":void 0}(Fs?.navigation??null);if("traverse"===n)io("traverse",r,i);else if("push"===n||"replace"===n){let e="string"==typeof t.from?.url?t.from.url:"";io(Hs??(function(e,t){return e!==t&&e.split("#")[0]===t.split("#")[0]}(e,location.href)?"hash":n),r)}}function ro(){let e=Reflect.get(window,"event")?.type;return"popstate"===e||"hashchange"===e?"traverse":"push"}function io(e,t,n){Ks(location.href);for(let r of Ws)try{r(e,t,n)}catch{}}function so([e,t,,n]){let r=Object.getOwnPropertyDescriptor(e,t);return void 0!==r&&r.value===n.value&&r.configurable===n.configurable&&(!0===r.configurable||!0===r.writable)}function oo([e,t,n]){n?Object.defineProperty(e,t,n):Reflect.deleteProperty(e,t)}function ao(e){if(typeof window>"u"||!window.history)return()=>{};Ws.add(e),function(){if(Fs)return;let e=window.history,t=e.pushState,n=e.replaceState,r=Reflect.get(window,"navigation")??null;r?.addEventListener("currententrychange",no,{capture:!0}),r?.addEventListener("navigate",Ys,{capture:!0});let i=e=>t=>{let n=e(t);return{next:eo(r,n,Vs.length?Js:null),now:eo(r,n,null)}},s=e=>t=>{let n=e(t);return{next:n,now:n}},o=[[e,"back",i(()=>-1)],[e,"forward",i(()=>1)],[e,"go",i(e=>e[0])],[r,"back",s(()=>eo(r,-1,null))],[r,"forward",s(()=>eo(r,1,null))],[r,"traverseTo",s(e=>"string"==typeof e[0]?eo(r,0,e[0]):null)]],a=[[e,"pushState",function(...e){let n=location.href,r=Hs;Hs="push";try{t.apply(this,e)}finally{Hs=r}io(location.href===n?ro():"push")}],[e,"replaceState",function(...e){let t=location.href,r=Hs;Hs="replace";try{n.apply(this,e)}finally{Hs=r}io(location.href===t?ro():"replace")}]];for(let[e,t,n]of o){let r=e&&Reflect.get(e,t);"function"==typeof r&&a.push([e,t,to(r,n)])}let l=a.find(([e,t])=>!function(e,t){let n=Object.getOwnPropertyDescriptor(e,t);return void 0===n?Object.isExtensible(e):!0===n.configurable||!0===n.writable}(e,t));Fs={navigation:r,methods:l?[]:a.map(([e,t,n])=>function(e,t,n){let r=Object.getOwnPropertyDescriptor(e,t);return Object.defineProperty(e,t,!1===r?.configurable?{value:n}:{value:n,writable:!0,enumerable:r?.enumerable??!0,configurable:!0}),[e,t,r,Object.getOwnPropertyDescriptor(e,t)]}(e,t,n)),refused:l?`${l[0]===e?"history":"navigation"}.${l[1]}`:null}}();let t=()=>{Ks(location.href),e("traverse")};return window.addEventListener("popstate",t,{capture:!0}),window.addEventListener("hashchange",t,{capture:!0}),()=>{Ws.delete(e),window.removeEventListener("popstate",t,{capture:!0}),window.removeEventListener("hashchange",t,{capture:!0}),function(){if(Fs&&!(Ws.size>0)&&Fs.methods.every(so)){for(let e of Fs.methods)oo(e);Fs.navigation?.removeEventListener("currententrychange",no,{capture:!0}),Fs.navigation?.removeEventListener("navigate",Ys,{capture:!0}),Zs=null,Vs=[],Xs=null,Gs.clear(),Fs=null}}()}}var lo=class e{phase="idle";userPaused=!1;hidden=!1;droppedWhileShut=!1;baselineLost=!1;retakeTimer=null;retakeAtOnce=!1;retakeDelay=5e3;outage=!1;failing(e){this.outage=e,null!==this.retakeTimer&&clearTimeout(this.retakeTimer),this.retakeTimer=null,!e&&this.baselineLost&&this.rebaseline(!1)}lost(e,t){t||!e.some(e=>"dom"===e.type)||(this.baselineLost=!0,this.rebaseline(e.some(e=>"dom"===e.type&&2===e.data?.type)))}rebaseline(e){if(this.outage)return;if(null!==this.retakeTimer){if(!e||!this.retakeAtOnce)return;clearTimeout(this.retakeTimer)}this.retakeAtOnce=!e;let t=e?this.retakeDelay:0;e&&(this.retakeDelay=Math.min(2*this.retakeDelay,6e4)),this.retakeTimer=setTimeout(()=>{if(this.retakeTimer=null,!this.baselineLost||"recording"!==this.getState())return;let e=this.rrwebRecord?.takeFullSnapshot;if(e){this.droppedWhileShut=!1;try{e.call(this.rrwebRecord)}catch{this.droppedWhileShut=!0}}},t)}delivered(e){e.some(e=>"dom"===e.type&&2===e.data?.type)&&(this.retakeDelay=5e3)}styles=new Xt({note:e=>{let t=this.rrwebRecord?.mirror?.getNode(e);t&&this.styleNodes.set(e,t)},present:e=>this.inPage(e),forget:e=>{this.styleNodes.delete(e)}});styleNodes=new Map;sessionId=null;metadata=null;config;onEvent=null;onSessionEnd=null;onScrubOversized=null;onRRWeb=null;landing=!1;onlineRetry=null;onlinePoll=null;rrwebStopFn=null;rrwebRecord=null;rrwebRequested=!1;generation=0;sessionTimer=null;visibilityHandler=null;stopNavigation=null;lastHref="";seenHref="";constructor(e){this.config=e}async start(e,t=null,n=!1,r=null,i=null,s=null){if("active"===this.phase)return this.sessionId;"stopping"===this.phase&&this.stop();let o={secretRoutes:[],keepRoutes:[]};for(let e of["secretRoutes","keepRoutes"]){let t=this.config.privacy?.[e]??[];if(!Array.isArray(t))throw this.phase="stopped",new Lr({option:e,received:Pr({returned:t})});for(let n of t){let t=Xe(n,"keepRoutes"===e);if(null===t)throw this.phase="stopped",new Lr({option:e,received:Pr({returned:n})});o[e].push(t)}}!function(e,t){for(let[n,r]of[[Ge.secret,e],[Ge.keep,t]])for(let e of r){let t=`${n===Ge.keep}${e.join("/")}`;Qe.has(t)||(Qe.add(t),n.push(e),Ye++,dt=["",[],!1,null])}}(o.secretRoutes,o.keepRoutes);let a,l=this.config.sampleRate??1;if(Math.random()>l)return this.phase="stopped","";this.onEvent=e,this.onSessionEnd=t,this.onScrubOversized=r,this.onRRWeb=i;try{a=this.config.sessionIdGenerator?this.config.sessionIdGenerator():Es()}catch(e){throw this.phase="stopped",new Dr({sessionId:null,received:Pr({threw:e})})}if(!pr(a))throw this.phase="stopped",new Dr({sessionId:"string"==typeof a?a:null,received:Pr({returned:a})});this.sessionId=a,this.metadata=function(e){let t=typeof window<"u"?window:void 0,n=t?.location?.href??"",r=""===n?null:Ks(n);return{url:en(e(n),r),userAgent:typeof navigator<"u"?navigator.userAgent:"",viewport:{width:t?.innerWidth??0,height:t?.innerHeight??0},referrer:typeof document<"u"&&document.referrer?en(e(document.referrer),r):"",language:typeof navigator<"u"?navigator.language:"",devicePixelRatio:t?.devicePixelRatio??1,timestamp:Date.now()}}(this.scrubUrl),this.phase="active",this.userPaused=n,this.droppedWhileShut=!1,this.hidden=typeof document<"u"&&"hidden"===document.visibilityState,this.rrwebRequested=!1;let u=++this.generation;typeof document<"u"&&(this.visibilityHandler=()=>{this.hidden="hidden"===document.visibilityState,"recording"===this.getState()&&this.openDomGate()},document.addEventListener("visibilitychange",this.visibilityHandler)),this.seenHref=typeof location<"u"?location.href:"",this.lastHref=typeof location<"u"?this.scrubUrl(location.href):"",this.stopNavigation=ao((e,t,n)=>this.navigated(e,t,n));let c=await this.startRRWeb();if(u!==this.generation||"active"!==this.phase)return"";if(null!==c&&typeof window<"u")throw this.stop(),Ds(c);let d=this.config.maxSessionDuration??6e5;return this.sessionTimer=setTimeout(()=>{try{this.onSessionEnd?.()}finally{"active"===this.phase&&this.stop()}},d),Fs?.refused&&s?.(Fs.refused),this.sessionId}stopDom(){"active"===this.phase&&(this.phase="stopping"),this.rrwebStopFn&&(this.rrwebStopFn(),this.rrwebStopFn=null),this.sessionTimer&&(clearTimeout(this.sessionTimer),this.sessionTimer=null)}stop(){if("active"===this.phase||"stopping"===this.phase){null!==this.onlineRetry&&(window.removeEventListener("online",this.onlineRetry),this.onlineRetry=null,this.stopOnlinePoll()),this.landing=!1;for(let e of Os)e.delete(this);this.stopDom(),this.rrwebRecord=null,this.retakeTimer&&(clearTimeout(this.retakeTimer),this.retakeTimer=null),this.visibilityHandler&&typeof document<"u"&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=null),this.stopNavigation?.(),this.stopNavigation=null,this.phase="stopped"}}navigated(e,t,n){if("active"!==this.phase)return;this.seenHref=location.href;let r=this.scrubUrl(location.href);zs(r)!==zs(this.lastHref)&&(this.lastHref=r,this.emitEvent("dom",{type:4,data:{href:r,...Ns(),cause:e,...void 0===t?{}:{userInitiated:t},...void 0===n?{}:{initiator:n}},timestamp:Date.now()}))}recordedRRWebEvent(e){if("object"!=typeof e||null===e)return e;let t=e,n=t.data?.href;return 4!==t.type||"string"!=typeof n?e:(this.lastHref=this.scrubUrl(n),{...t,data:{...t.data,href:this.lastHref}})}isUserPaused(){return this.userPaused}pause(){"active"===this.phase&&(this.userPaused=!0)}resume(){"active"===this.phase&&(this.userPaused=!1,"recording"===this.getState()&&this.openDomGate())}openDomGate(){if(!this.rrwebStopFn){this.droppedWhileShut=!1;let e=this.generation;return void this.startRRWeb().then(t=>{null!==t?this.refuseLate(e,t):this.landedBeforeTheRetry(e)})}if(!this.droppedWhileShut&&!this.baselineLost)return;let e=this.rrwebRecord?.takeFullSnapshot;if(e){if(this.outage)return void(this.baselineLost=!0);this.droppedWhileShut=!1;try{e.call(this.rrwebRecord)}catch{this.droppedWhileShut=!0}}}getSessionId(){return"active"===this.phase?this.sessionId:null}get sessionOpen(){return"active"===this.phase&&!this.userPaused}getState(){return"idle"===this.phase?"idle":"stopped"===this.phase||"stopping"===this.phase?"stopped":this.userPaused||this.hidden?"paused":"recording"}getMetadata(){return this.metadata}async startRRWeb(){if(this.rrwebRequested)return null;this.rrwebRequested=!0;let t=this.generation;if(!this.loaded()&&typeof window<"u"&&!1===navigator.onLine&&!function(){try{return!!navigator.serviceWorker?.controller}catch{return!1}}())return this.rrwebRequested=!1,this.retryWhenOnline(t),null;let n=+("strict"===this.config.privacyMode);if($s[n])return Os[n].add(this),this.land();let r=Cs(n>0),i=await ti(r,this.loaded());if(!i)return t===this.generation&&"active"===this.phase&&(Os[n].add(this),this.land(),$s[n]||e.whenLanded(n,r)),null;if(t!==this.generation)return null;if("failed"in i)return this.rrwebRequested=!1,i;let s=i.record;return"recording"!==this.getState()?(this.rrwebRequested=!1,null):(this.rrwebRecord=s,this.rrwebStopFn=s(this.rrwebOptions())??null,null)}retryWhenOnline(e){if(null!==this.onlineRetry)return;let t=()=>{if(window.removeEventListener("online",t),this.stopOnlinePoll(),this.onlineRetry=null,e===this.generation&&"active"===this.phase){if(!1===navigator.onLine)return void this.retryWhenOnline(e);Cs("strict"===this.config.privacyMode).then(t=>this.loadedLate(e,t))}};this.onlineRetry=t,window.addEventListener("online",t,{once:!0}),this.onlinePoll=setInterval(()=>{!1!==navigator.onLine&&t()},1e3)}static whenLanded(e,t){$s[e]++,t.then(t=>{$s[e]--;let n=[...Os[e]];Os[e].clear();for(let e of n)e.landing&&e.loadedLate(e.generation,t)})}land(){return this.rrwebRequested=!1,this.landing=!0,null}loadedLate(e,t){if(e===this.generation&&"active"===this.phase){if(this.landing=!1,"failed"in t)return void this.refuseLate(e,t);this.startRRWeb(),this.onRRWeb?.(null)}}stopOnlinePoll(){null!==this.onlinePoll&&(clearInterval(this.onlinePoll),this.onlinePoll=null)}refuseLate(e,t){e!==this.generation||"active"!==this.phase||(this.stop(),this.onRRWeb?.(Ds(t)))}landedBeforeTheRetry(e){e!==this.generation||"active"!==this.phase||!this.loaded()||null===this.onlineRetry||(window.removeEventListener("online",this.onlineRetry),this.onlineRetry=null,this.stopOnlinePoll(),this.onRRWeb?.(null))}loaded(){return As&&(_s||"strict"!==this.config.privacyMode)}awaitingRRWeb(){return null!==this.onlineRetry||this.landing}rrwebOptions(){let e=this.config.privacyMode??"balanced",t=this.config.privacy??{},n=[...this.config.maskSelectors??[],...t.maskSelectors??[]],r=[...this.config.unmaskSelectors??[],...t.unmaskSelectors??[]],i="off"!==e,s={color:i,date:i,"datetime-local":i,email:i,file:i,month:i,number:i,range:i,search:i,tel:i,text:i,time:i,url:i,week:i,textarea:i,select:i,password:!0,hidden:!0},o='[contenteditable]:not([contenteditable="false"])',a=[...n,...i?[o]:[]].join(","),l=r.join(","),u=l?(e,t)=>{try{if(i&&t?.closest(o))return e.replace(/[\S]/g,"*");if(t?.closest(l))return e}catch{}return e.replace(/[\S]/g,"*")}:void 0;return{emit:e=>this.emitEvent("dom",e,e=>this.recordedRRWebEvent(e)),maskTextSelector:"strict"===e?"*":a||void 0,...u?{maskTextFn:u}:{},blockSelector:t.blockSelectors?.join(",")||void 0,maskInputOptions:s,userTriggeredOnInput:!0}}inPage(e){let t=this.rrwebRecord?.mirror;if(void 0===t)return!0;let n=this.styleNodes.get(e)??t.getNode(e);if(!n||!n.isConnected)return!1;for(let e=n.ownerDocument;null!==e&&e!==document;){let t=e.defaultView?.frameElement??null;if(null===t||!t.isConnected)return!1;e=t.ownerDocument}return!0}noticeUnheardMove(e){if(!(typeof location>"u"||location.href===this.seenHref)){if(4===e?.type)return void(this.seenHref=location.href);this.navigated(ro())}}scrubUrl=e=>function(e,t=!1){return e&&I(e,t?Nn:Dn)}(function(e){let[,t,n]=ht(e);if(t)return`${ut(e)}/[REDACTED]`;let r=e.indexOf("#"),i=Fe(ot(e),He(Se(e))),s=Ee(-1===r?e:e.slice(0,r),i);if(-1!==r){let t=e.slice(r+1).split("#")[0];Ie.test(t)&&(s+=`#${Ee(t,i)}`)}return null===n?s:Lt(s,n)}(e),"strict"===(this.config.privacyMode??"balanced"));scrubDomUrls(e,t){let n=e;if(null===n||"object"!=typeof n)return e;let r=n.data;if(null===r||"object"!=typeof r)return e;let i="strict"===(this.config.privacyMode??"balanced"),s=null===t?[]:[...t.plain,...t.bounded];if(2===n.type&&tr(r.node,i,s),3===n.type&&0===r.source){if(Array.isArray(r.adds)){!function(e){let t=new Map;for(let n of e){let e=n?.node?.type;(3===e||5===e)&&t.set(n.node.id,n)}let n=new Set;for(let e of t.values())n.add(t.get(e.nextId));for(let e of t.values()){if(n.has(e))continue;let r=[];for(let n=e;n;n=t.get(n.nextId))Yn(n.node)&&r.push(n.node);r.length>1&&Qn(r)}}(r.adds);for(let e of r.adds)null!==e&&"object"==typeof e&&tr(e.node,i,s)}if(Array.isArray(r.attributes))for(let e of r.attributes){let t=e?.attributes;if(null!==t&&"object"==typeof t){let n=i?this.rrwebRecord?.mirror?.getNode(e.id??-1):null;Wn(t,i,s,n?.localName??"","http://www.w3.org/2000/svg"===n?.namespaceURI)}}if(Array.isArray(r.texts)){let e=this.styles.recordsIn(n);for(let t of r.texts)"string"==typeof t?.value&&(t.value=e.has(t)?Gn(t.value,i,s):Vn(t.value))}}if(3===n.type&&(8===r.source||15===r.source)){let e=[...Array.isArray(r.adds)?r.adds:[],...Array.isArray(r.styles)?r.styles.flatMap(e=>Array.isArray(e?.rules)?e.rules:[]):[]];for(let t of e)null!==t&&"string"==typeof t?.rule&&(t.rule=Gn(t.rule,i,s));"string"==typeof r.replace&&(r.replace=Gn(r.replace,i,s)),"string"==typeof r.replaceSync&&(r.replaceSync=Gn(r.replaceSync,i,s))}if(3===n.type&&5===r.source&&"string"==typeof r.text&&(r.text=i?r.text.replace(/\S/g,"*"):Vn(r.text)),3===n.type&&9===r.source&&"string"==typeof r.fontSource&&(r.fontSource=Gn(r.fontSource,i,s)),3===n.type&&13===r.source){let e=r.set;null!==e&&"string"==typeof e?.value&&(e.value=Gn(e.value,i,s))}return e}acceptsNetwork(){return this.sessionOpen}emitEvent(e,t,n,r=!1,i,s){if("dom"===e&&"active"===this.phase&&"recording"!==this.getState()&&(this.droppedWhileShut=!0),(r?"active"!==this.phase&&"stopping"!==this.phase:!this.sessionOpen)||"dom"===e&&this.hidden||!this.onEvent||!this.sessionId)return;this.noticeUnheardMove("dom"===e?t:null);let o=n?n(t):t,a="dom"===e&&null!==o&&"object"==typeof o?o.type:void 0;if(this.baselineLost&&3===a)return;let l=o;if(typeof location<"u")try{"dom"===e&&(l=this.scrubDomUrls(o,Ks(location.href))),l=en(l,Ks(location.href),e,this.styles,ks)}catch(t){return"dom"===e&&(this.baselineLost=!0,this.rebaseline(2===a)),void(t instanceof Gt&&this.onScrubOversized?.(e,t.atLeast,t.cap))}2===a&&(this.baselineLost=!1,null!==this.retakeTimer&&(clearTimeout(this.retakeTimer),this.retakeTimer=null));let u={id:Es(),sessionId:this.sessionId,timestamp:i??Date.now(),type:e,data:l,seq:s};this.onEvent(u)}};function uo(){let e=typeof crypto<"u"?crypto:void 0;if(!e||"function"!=typeof e.getRandomValues)return null;let t=new Uint8Array(16);e.getRandomValues(t);let n="";for(let e of t)n+=e.toString(16).padStart(2,"0");return n}function co(){if(typeof window>"u"||!window.location)return null;let e=window.location.origin;return"string"!=typeof e||""===e||"null"===e?null:e}var ho=class{captureId;nonce;t0WallMs;origins;constructor(e,t=Date.now()){this.captureId=e,this.nonce=uo(),this.t0WallMs=t;let n=co();this.origins=null===n?[]:[n]}build(){return null===this.nonce?{refusal:"no-csprng"}:{identity:{captureId:this.captureId,sessionNonce:this.nonce,t0WallMs:this.t0WallMs,appOrigins:[...this.origins]}}}},fo=!1,po=class e{static instance=null;recorder;network;transport;config;started=!1;identity=null;constructor(e){this.config=e,this.recorder=new lo(e),this.network=new ys(e.privacy??{},e.maxBodySize??524288,[e.endpoint],e.privacyMode);let t={endpoint:e.endpoint,apiKey:e.apiKey,batchSize:e.batchSize??50,batchInterval:e.batchInterval??5e3,maxQueueSize:e.maxQueueSize??5e3,...void 0!==e.onError?{onError:e.onError}:{},onCaptureEnd:()=>this.endCapture(),endsSessionOnly:(t,n)=>!0===e.continuous&&void 0===e.sessionIdGenerator&&("KUI_E_SESSION_CONFLICT"===t&&"session_completed"===n||"KUI_E_INGEST_REJECTED"===t&&"session_full"===n),onSessionEnd:()=>this.endSession(),onDropped:(e,t)=>this.recorder.lost(e,t),onDelivered:e=>this.recorder.delivered(e),onFailing:e=>this.recorder.failing(e),beforeUnloadFlush:()=>this.network.cutInflight(),beforeHiddenFlush:()=>this.network.reportDue(),beforeOnlineFlush:()=>this.network.reportDue()};this.transport=new xs(t)}static async init(t){if(e.instance)return e.instance;let n=e.nextSessionPaused;return e.cancelNextSession(),e.nextSessionPaused=!1,e.begin(t,n)}static async begin(t,n,r=!1){let i=new e(t);e.instance=i;try{await i.start(n,r)}catch(t){throw e.instance===i&&(e.instance=null),t}return i}static stop(){e.cancelNextSession(),e.nextSessionPaused=!1;let t=e.instance;e.instance=null;let n=Promise.all(e.ending),r=new Promise(e=>{let t=setTimeout(e,1e4);n.then(()=>{clearTimeout(t),e()})});return t||r.then(()=>{!e.instance&&!e.restartPending&&(hi(!1),Wi())}),Promise.all([t?t.stop():void 0,r]).then(()=>{})}static pause(){e.instance?.pause(),null===e.instance&&e.restartPending&&(e.nextSessionPaused=!0)}static resume(){e.instance?.resume(),e.nextSessionPaused=!1}static getSessionId(){return e.instance?.recorder.getSessionId()??""}static getInstance(){return e.instance}static getCaptureIdentity(){let t=e.instance?.identity;return t?t.build():null}async start(t,n=!1){if(this.started)return;if(this.started=!0,"strict"===this.config.privacyMode&&!1===this.config.privacy?.maskNetworkBodies)return void this.refuse(new Ur);let r=!1!==this.config.honorPrivacySignals?function(){try{if(typeof navigator>"u")return null;let e=navigator;if(!0===e.globalPrivacyControl)return"globalPrivacyControl";if("1"===e.doNotTrack||"yes"===e.doNotTrack||typeof window<"u"&&"1"===window.doNotTrack||"1"===e.msDoNotTrack)return"doNotTrack"}catch{}return null}():null;if(null!==r)return void this.decline(new Br(r));let i,s=[],o=e=>{s?s.push(e):this.transport.enqueue(e)};try{hi(!0,!n);let e=this.recorder.start(o,()=>!0===this.config.continuous&&void 0===this.config.sessionIdGenerator?this.endSession():this.endCapture(),t,(e,t,n)=>this.transport.reportScrubOversized(e,t,n),e=>{null===e?this.transport.release():this.refuse(e)},e=>this.transport.reportNavigationUnwrapped(e));!1!==this.config.networkCapture&&null!==this.recorder.getSessionId()&&this.network.askForCode(),i=await e}catch(e){if(!(e instanceof Dr||e instanceof zr||e instanceof Nr||e instanceof Lr))throw e;return void this.refuse(e)}if(!i)return this.started=!1,void((e.instance??this)===this&&hi(!1));let a=this.recorder.getMetadata();this.identity=new ho(i);let l=this.identity.build();this.recorder.awaitingRRWeb()&&this.transport.hold(),this.transport.start(i,a,"identity"in l?l.identity:null);let u=s;s=null;for(let e of u)this.transport.enqueue(e);!1!==this.config.networkCapture&&this.network.start((e,t,n)=>{this.recorder.emitEvent("network",e,void 0,!0,t,n)},()=>this.recorder.acceptsNetwork(),()=>this.transport.place())}stop(){return this.network.reportDue(),this.recorder.stopDom(),this.network.stop(),this.started=!1,this.network.settle(1e3).then(()=>{let t=null===e.instance;return Wi(t,()=>null!==e.instance||e.restartPending),t&&!e.restartPending&&hi(!1),this.recorder.stop(),this.transport.stop()})}decline(e){fo||console.info(e.message),fo=!0,this.endCapture();try{this.config.onError?.(e)}catch{}}refuse(e){console.error(e.message),this.endCapture();try{this.config.onError?.(e)}catch{}}endCapture(){let t=this.stop().catch(()=>{}).finally(()=>e.ending.delete(t));e.ending.add(t),e.instance===this&&(e.instance=null)}static cancelNextSession=()=>{};static nextSessionPaused=!1;static ending=new Set;static restartPending=!1;endSession(){let t=e.instance===this,n=this.recorder.isUserPaused();if(this.endCapture(),!t||typeof document>"u")return;e.cancelNextSession(),e.nextSessionPaused=n;let r={...this.config,sampleRate:1},i=()=>{let t=e.nextSessionPaused;e.cancelNextSession(),e.nextSessionPaused=!1,null===e.instance&&e.begin(r,t,!0).catch(e=>{console.warn("[keploy] the capture's next session could not start:",e)})},s={capture:!0,passive:!0};document.addEventListener("pointerdown",i,s),document.addEventListener("keydown",i,s);let o=ao(()=>{});e.restartPending=!0,e.cancelNextSession=()=>{o(),document.removeEventListener("pointerdown",i,s),document.removeEventListener("keydown",i,s),e.restartPending=!1,e.cancelNextSession=()=>{}}}pause(){this.recorder.pause(),this.network.cutBodies()}resume(){this.recorder.resume()}};export{Br as CaptureDeclined,Or as CaptureError,ho as CaptureIdentityBuilder,zr as DomRecorderRefusal,$r as IngestRejection,po as KeployCapture,lo as KeployCaptureRecorder,ys as NetworkInterceptor,Ur as PrivacyConflict,cr as PrivacyEngine,Lr as PrivacyRouteRefusal,mr as SDK_ERRORS,wr as SDK_WARNINGS,dr as SESSION_ID_MAX_LENGTH,hr as SESSION_ID_PATTERN,fr as SESSION_ID_RULE,Dr as SessionIdRefusal,Nr as StrictAttributesRefusal,xs as Transport,Er as codeForStatus,co as currentOrigin,sr as defaultPrivacyConfig,Cr as describeValue,pr as isValidSessionId,uo as mintSessionNonce,Tr as parseServerError};//# sourceMappingURL=index.bundler.mjs.map
|