@sentry/replay 7.77.0 → 7.78.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/cjs/index.js +170 -1163
  2. package/cjs/index.js.map +1 -1
  3. package/esm/index.js +171 -1164
  4. package/esm/index.js.map +1 -1
  5. package/package.json +9 -8
  6. package/types/coreHandlers/handleClick.d.ts +10 -2
  7. package/types/coreHandlers/handleClick.d.ts.map +1 -1
  8. package/types/coreHandlers/handleScope.d.ts.map +1 -1
  9. package/types/coreHandlers/util/domUtils.d.ts +2 -0
  10. package/types/coreHandlers/util/domUtils.d.ts.map +1 -1
  11. package/types/coreHandlers/util/networkUtils.d.ts.map +1 -1
  12. package/types/integration.d.ts +1 -1
  13. package/types/integration.d.ts.map +1 -1
  14. package/types/types/replay.d.ts +17 -1
  15. package/types/types/replay.d.ts.map +1 -1
  16. package/types/types/request.d.ts +1 -1
  17. package/types/types/request.d.ts.map +1 -1
  18. package/types/util/handleRecordingEmit.d.ts.map +1 -1
  19. package/types/util/sendReplayRequest.d.ts +8 -0
  20. package/types/util/sendReplayRequest.d.ts.map +1 -1
  21. package/types-ts3.8/coreHandlers/handleClick.d.ts +10 -2
  22. package/types-ts3.8/coreHandlers/util/domUtils.d.ts +2 -0
  23. package/types-ts3.8/integration.d.ts +1 -1
  24. package/types-ts3.8/types/replay.d.ts +17 -1
  25. package/types-ts3.8/types/request.d.ts +1 -1
  26. package/types-ts3.8/util/sendReplayRequest.d.ts +8 -0
  27. package/types/util/truncateJson/completeJson.d.ts +0 -9
  28. package/types/util/truncateJson/completeJson.d.ts.map +0 -1
  29. package/types/util/truncateJson/constants.d.ts +0 -12
  30. package/types/util/truncateJson/constants.d.ts.map +0 -1
  31. package/types/util/truncateJson/evaluateJson.d.ts +0 -6
  32. package/types/util/truncateJson/evaluateJson.d.ts.map +0 -1
  33. package/types/util/truncateJson/fixJson.d.ts +0 -6
  34. package/types/util/truncateJson/fixJson.d.ts.map +0 -1
  35. package/types-ts3.8/util/truncateJson/completeJson.d.ts +0 -9
  36. package/types-ts3.8/util/truncateJson/constants.d.ts +0 -12
  37. package/types-ts3.8/util/truncateJson/evaluateJson.d.ts +0 -6
  38. package/types-ts3.8/util/truncateJson/fixJson.d.ts +0 -6
package/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { getCurrentHub, isSentryRequestUrl, addGlobalEventProcessor, prepareEvent, setContext, captureException } from '@sentry/core';
2
- import { GLOBAL_OBJ, normalize, fill, htmlTreeAsString, browserPerformanceTimeOrigin, logger, uuid4, SENTRY_XHR_DATA_KEY, dropUndefinedKeys, stringMatchesSomePattern, addInstrumentationHandler, createEnvelope, createEventEnvelopeHeaders, getSdkMetadataForEnvelopeHeader, isBrowser } from '@sentry/utils';
2
+ import { GLOBAL_OBJ, normalize, fill, htmlTreeAsString, browserPerformanceTimeOrigin, logger, uuid4, SENTRY_XHR_DATA_KEY, dropUndefinedKeys, stringMatchesSomePattern, addInstrumentationHandler, createEnvelope, createEventEnvelopeHeaders, getSdkMetadataForEnvelopeHeader, updateRateLimits, isRateLimited, isBrowser } from '@sentry/utils';
3
3
  import { addPerformanceInstrumentationHandler, addLcpInstrumentationHandler } from '@sentry-internal/tracing';
4
4
 
5
5
  // exporting a separate copy of `WINDOW` rather than exporting the one from `@sentry/browser`
@@ -1585,12 +1585,6 @@ var PointerTypes = /* @__PURE__ */ ((PointerTypes2) => {
1585
1585
  PointerTypes2[PointerTypes2["Touch"] = 2] = "Touch";
1586
1586
  return PointerTypes2;
1587
1587
  })(PointerTypes || {});
1588
- var CanvasContext = /* @__PURE__ */ ((CanvasContext2) => {
1589
- CanvasContext2[CanvasContext2["2D"] = 0] = "2D";
1590
- CanvasContext2[CanvasContext2["WebGL"] = 1] = "WebGL";
1591
- CanvasContext2[CanvasContext2["WebGL2"] = 2] = "WebGL2";
1592
- return CanvasContext2;
1593
- })(CanvasContext || {});
1594
1588
 
1595
1589
  function isNodeInLinkedList(n) {
1596
1590
  return '__ln' in n;
@@ -2423,12 +2417,6 @@ function initViewportResizeObserver({ viewportResizeCb }, { win }) {
2423
2417
  }), 200));
2424
2418
  return on('resize', updateDimension, win);
2425
2419
  }
2426
- function wrapEventWithUserTriggeredFlag(v, enable) {
2427
- const value = Object.assign({}, v);
2428
- if (!enable)
2429
- delete value.userTriggered;
2430
- return value;
2431
- }
2432
2420
  const INPUT_TAGS = ['INPUT', 'TEXTAREA', 'SELECT'];
2433
2421
  const lastInputValueMap = new WeakMap();
2434
2422
  function initInputObserver({ inputCb, doc, mirror, blockClass, blockSelector, unblockSelector, ignoreClass, ignoreSelector, maskInputOptions, maskInputFn, sampling, userTriggeredOnInput, maskTextClass, unmaskTextClass, maskTextSelector, unmaskTextSelector, }) {
@@ -2467,7 +2455,9 @@ function initInputObserver({ inputCb, doc, mirror, blockClass, blockSelector, un
2467
2455
  value: text,
2468
2456
  maskInputFn,
2469
2457
  });
2470
- cbWithDedup(target, callbackWrapper(wrapEventWithUserTriggeredFlag)({ text, isChecked, userTriggered }, userTriggeredOnInput));
2458
+ cbWithDedup(target, userTriggeredOnInput
2459
+ ? { text, isChecked, userTriggered }
2460
+ : { text, isChecked });
2471
2461
  const name = target.name;
2472
2462
  if (type === 'radio' && name && isChecked) {
2473
2463
  doc
@@ -2480,11 +2470,9 @@ function initInputObserver({ inputCb, doc, mirror, blockClass, blockSelector, un
2480
2470
  value: getInputValue(el, tagName, type),
2481
2471
  maskInputFn,
2482
2472
  });
2483
- cbWithDedup(el, callbackWrapper(wrapEventWithUserTriggeredFlag)({
2484
- text,
2485
- isChecked: !isChecked,
2486
- userTriggered: false,
2487
- }, userTriggeredOnInput));
2473
+ cbWithDedup(el, userTriggeredOnInput
2474
+ ? { text, isChecked: !isChecked, userTriggered: false }
2475
+ : { text, isChecked: !isChecked });
2488
2476
  }
2489
2477
  });
2490
2478
  }
@@ -2929,94 +2917,12 @@ function initCustomElementObserver({ doc, customElementCb, }) {
2929
2917
  });
2930
2918
  return restoreHandler;
2931
2919
  }
2932
- function mergeHooks(o, hooks) {
2933
- const { mutationCb, mousemoveCb, mouseInteractionCb, scrollCb, viewportResizeCb, inputCb, mediaInteractionCb, styleSheetRuleCb, styleDeclarationCb, canvasMutationCb, fontCb, selectionCb, customElementCb, } = o;
2934
- o.mutationCb = (...p) => {
2935
- if (hooks.mutation) {
2936
- hooks.mutation(...p);
2937
- }
2938
- mutationCb(...p);
2939
- };
2940
- o.mousemoveCb = (...p) => {
2941
- if (hooks.mousemove) {
2942
- hooks.mousemove(...p);
2943
- }
2944
- mousemoveCb(...p);
2945
- };
2946
- o.mouseInteractionCb = (...p) => {
2947
- if (hooks.mouseInteraction) {
2948
- hooks.mouseInteraction(...p);
2949
- }
2950
- mouseInteractionCb(...p);
2951
- };
2952
- o.scrollCb = (...p) => {
2953
- if (hooks.scroll) {
2954
- hooks.scroll(...p);
2955
- }
2956
- scrollCb(...p);
2957
- };
2958
- o.viewportResizeCb = (...p) => {
2959
- if (hooks.viewportResize) {
2960
- hooks.viewportResize(...p);
2961
- }
2962
- viewportResizeCb(...p);
2963
- };
2964
- o.inputCb = (...p) => {
2965
- if (hooks.input) {
2966
- hooks.input(...p);
2967
- }
2968
- inputCb(...p);
2969
- };
2970
- o.mediaInteractionCb = (...p) => {
2971
- if (hooks.mediaInteaction) {
2972
- hooks.mediaInteaction(...p);
2973
- }
2974
- mediaInteractionCb(...p);
2975
- };
2976
- o.styleSheetRuleCb = (...p) => {
2977
- if (hooks.styleSheetRule) {
2978
- hooks.styleSheetRule(...p);
2979
- }
2980
- styleSheetRuleCb(...p);
2981
- };
2982
- o.styleDeclarationCb = (...p) => {
2983
- if (hooks.styleDeclaration) {
2984
- hooks.styleDeclaration(...p);
2985
- }
2986
- styleDeclarationCb(...p);
2987
- };
2988
- o.canvasMutationCb = (...p) => {
2989
- if (hooks.canvasMutation) {
2990
- hooks.canvasMutation(...p);
2991
- }
2992
- canvasMutationCb(...p);
2993
- };
2994
- o.fontCb = (...p) => {
2995
- if (hooks.font) {
2996
- hooks.font(...p);
2997
- }
2998
- fontCb(...p);
2999
- };
3000
- o.selectionCb = (...p) => {
3001
- if (hooks.selection) {
3002
- hooks.selection(...p);
3003
- }
3004
- selectionCb(...p);
3005
- };
3006
- o.customElementCb = (...c) => {
3007
- if (hooks.customElement) {
3008
- hooks.customElement(...c);
3009
- }
3010
- customElementCb(...c);
3011
- };
3012
- }
3013
- function initObservers(o, hooks = {}) {
2920
+ function initObservers(o, _hooks = {}) {
3014
2921
  const currentWindow = o.doc.defaultView;
3015
2922
  if (!currentWindow) {
3016
2923
  return () => {
3017
2924
  };
3018
2925
  }
3019
- mergeHooks(o, hooks);
3020
2926
  const mutationObserver = initMutationObserver(o, o.doc);
3021
2927
  const mousemoveHandler = initMoveObserver(o);
3022
2928
  const mouseInteractionHandler = initMouseInteractionObserver(o);
@@ -3037,10 +2943,6 @@ function initObservers(o, hooks = {}) {
3037
2943
  };
3038
2944
  const selectionObserver = initSelectionObserver(o);
3039
2945
  const customElementObserver = initCustomElementObserver(o);
3040
- const pluginHandlers = [];
3041
- for (const plugin of o.plugins) {
3042
- pluginHandlers.push(plugin.observer(plugin.callback, currentWindow, plugin.options));
3043
- }
3044
2946
  return callbackWrapper(() => {
3045
2947
  mutationBuffers.forEach((b) => b.reset());
3046
2948
  mutationObserver.disconnect();
@@ -3056,7 +2958,6 @@ function initObservers(o, hooks = {}) {
3056
2958
  fontObserver();
3057
2959
  selectionObserver();
3058
2960
  customElementObserver();
3059
- pluginHandlers.forEach((h) => h());
3060
2961
  });
3061
2962
  }
3062
2963
  function hasNestedCSSRule(prop) {
@@ -3425,369 +3326,6 @@ class ShadowDomManager {
3425
3326
  }
3426
3327
  }
3427
3328
 
3428
- /*! *****************************************************************************
3429
- Copyright (c) Microsoft Corporation.
3430
-
3431
- Permission to use, copy, modify, and/or distribute this software for any
3432
- purpose with or without fee is hereby granted.
3433
-
3434
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
3435
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
3436
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
3437
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
3438
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
3439
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
3440
- PERFORMANCE OF THIS SOFTWARE.
3441
- ***************************************************************************** */
3442
-
3443
- function __rest(s, e) {
3444
- var t = {};
3445
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
3446
- t[p] = s[p];
3447
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
3448
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
3449
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
3450
- t[p[i]] = s[p[i]];
3451
- }
3452
- return t;
3453
- }
3454
-
3455
- function __awaiter(thisArg, _arguments, P, generator) {
3456
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3457
- return new (P || (P = Promise))(function (resolve, reject) {
3458
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
3459
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
3460
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
3461
- step((generator = generator.apply(thisArg, _arguments || [])).next());
3462
- });
3463
- }
3464
-
3465
- /*
3466
- * base64-arraybuffer 1.0.1 <https://github.com/niklasvh/base64-arraybuffer>
3467
- * Copyright (c) 2021 Niklas von Hertzen <https://hertzen.com>
3468
- * Released under MIT License
3469
- */
3470
- var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
3471
- // Use a lookup table to find the index.
3472
- var lookup = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256);
3473
- for (var i = 0; i < chars.length; i++) {
3474
- lookup[chars.charCodeAt(i)] = i;
3475
- }
3476
- var encode = function (arraybuffer) {
3477
- var bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = '';
3478
- for (i = 0; i < len; i += 3) {
3479
- base64 += chars[bytes[i] >> 2];
3480
- base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];
3481
- base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];
3482
- base64 += chars[bytes[i + 2] & 63];
3483
- }
3484
- if (len % 3 === 2) {
3485
- base64 = base64.substring(0, base64.length - 1) + '=';
3486
- }
3487
- else if (len % 3 === 1) {
3488
- base64 = base64.substring(0, base64.length - 2) + '==';
3489
- }
3490
- return base64;
3491
- };
3492
-
3493
- const canvasVarMap = new Map();
3494
- function variableListFor(ctx, ctor) {
3495
- let contextMap = canvasVarMap.get(ctx);
3496
- if (!contextMap) {
3497
- contextMap = new Map();
3498
- canvasVarMap.set(ctx, contextMap);
3499
- }
3500
- if (!contextMap.has(ctor)) {
3501
- contextMap.set(ctor, []);
3502
- }
3503
- return contextMap.get(ctor);
3504
- }
3505
- const saveWebGLVar = (value, win, ctx) => {
3506
- if (!value ||
3507
- !(isInstanceOfWebGLObject(value, win) || typeof value === 'object'))
3508
- return;
3509
- const name = value.constructor.name;
3510
- const list = variableListFor(ctx, name);
3511
- let index = list.indexOf(value);
3512
- if (index === -1) {
3513
- index = list.length;
3514
- list.push(value);
3515
- }
3516
- return index;
3517
- };
3518
- function serializeArg(value, win, ctx) {
3519
- if (value instanceof Array) {
3520
- return value.map((arg) => serializeArg(arg, win, ctx));
3521
- }
3522
- else if (value === null) {
3523
- return value;
3524
- }
3525
- else if (value instanceof Float32Array ||
3526
- value instanceof Float64Array ||
3527
- value instanceof Int32Array ||
3528
- value instanceof Uint32Array ||
3529
- value instanceof Uint8Array ||
3530
- value instanceof Uint16Array ||
3531
- value instanceof Int16Array ||
3532
- value instanceof Int8Array ||
3533
- value instanceof Uint8ClampedArray) {
3534
- const name = value.constructor.name;
3535
- return {
3536
- rr_type: name,
3537
- args: [Object.values(value)],
3538
- };
3539
- }
3540
- else if (value instanceof ArrayBuffer) {
3541
- const name = value.constructor.name;
3542
- const base64 = encode(value);
3543
- return {
3544
- rr_type: name,
3545
- base64,
3546
- };
3547
- }
3548
- else if (value instanceof DataView) {
3549
- const name = value.constructor.name;
3550
- return {
3551
- rr_type: name,
3552
- args: [
3553
- serializeArg(value.buffer, win, ctx),
3554
- value.byteOffset,
3555
- value.byteLength,
3556
- ],
3557
- };
3558
- }
3559
- else if (value instanceof HTMLImageElement) {
3560
- const name = value.constructor.name;
3561
- const { src } = value;
3562
- return {
3563
- rr_type: name,
3564
- src,
3565
- };
3566
- }
3567
- else if (value instanceof HTMLCanvasElement) {
3568
- const name = 'HTMLImageElement';
3569
- const src = value.toDataURL();
3570
- return {
3571
- rr_type: name,
3572
- src,
3573
- };
3574
- }
3575
- else if (value instanceof ImageData) {
3576
- const name = value.constructor.name;
3577
- return {
3578
- rr_type: name,
3579
- args: [serializeArg(value.data, win, ctx), value.width, value.height],
3580
- };
3581
- }
3582
- else if (isInstanceOfWebGLObject(value, win) || typeof value === 'object') {
3583
- const name = value.constructor.name;
3584
- const index = saveWebGLVar(value, win, ctx);
3585
- return {
3586
- rr_type: name,
3587
- index: index,
3588
- };
3589
- }
3590
- return value;
3591
- }
3592
- const serializeArgs = (args, win, ctx) => {
3593
- return [...args].map((arg) => serializeArg(arg, win, ctx));
3594
- };
3595
- const isInstanceOfWebGLObject = (value, win) => {
3596
- const webGLConstructorNames = [
3597
- 'WebGLActiveInfo',
3598
- 'WebGLBuffer',
3599
- 'WebGLFramebuffer',
3600
- 'WebGLProgram',
3601
- 'WebGLRenderbuffer',
3602
- 'WebGLShader',
3603
- 'WebGLShaderPrecisionFormat',
3604
- 'WebGLTexture',
3605
- 'WebGLUniformLocation',
3606
- 'WebGLVertexArrayObject',
3607
- 'WebGLVertexArrayObjectOES',
3608
- ];
3609
- const supportedWebGLConstructorNames = webGLConstructorNames.filter((name) => typeof win[name] === 'function');
3610
- return Boolean(supportedWebGLConstructorNames.find((name) => value instanceof win[name]));
3611
- };
3612
-
3613
- function initCanvas2DMutationObserver(cb, win, blockClass, blockSelector, unblockSelector) {
3614
- const handlers = [];
3615
- const props2D = Object.getOwnPropertyNames(win.CanvasRenderingContext2D.prototype);
3616
- for (const prop of props2D) {
3617
- try {
3618
- if (typeof win.CanvasRenderingContext2D.prototype[prop] !== 'function') {
3619
- continue;
3620
- }
3621
- const restoreHandler = patch(win.CanvasRenderingContext2D.prototype, prop, function (original) {
3622
- return function (...args) {
3623
- if (!isBlocked(this.canvas, blockClass, blockSelector, unblockSelector, true)) {
3624
- setTimeout(() => {
3625
- const recordArgs = serializeArgs([...args], win, this);
3626
- cb(this.canvas, {
3627
- type: CanvasContext['2D'],
3628
- property: prop,
3629
- args: recordArgs,
3630
- });
3631
- }, 0);
3632
- }
3633
- return original.apply(this, args);
3634
- };
3635
- });
3636
- handlers.push(restoreHandler);
3637
- }
3638
- catch (_a) {
3639
- const hookHandler = hookSetter(win.CanvasRenderingContext2D.prototype, prop, {
3640
- set(v) {
3641
- cb(this.canvas, {
3642
- type: CanvasContext['2D'],
3643
- property: prop,
3644
- args: [v],
3645
- setter: true,
3646
- });
3647
- },
3648
- });
3649
- handlers.push(hookHandler);
3650
- }
3651
- }
3652
- return () => {
3653
- handlers.forEach((h) => h());
3654
- };
3655
- }
3656
-
3657
- function getNormalizedContextName(contextType) {
3658
- return contextType === 'experimental-webgl' ? 'webgl' : contextType;
3659
- }
3660
- function initCanvasContextObserver(win, blockClass, blockSelector, unblockSelector, setPreserveDrawingBufferToTrue) {
3661
- const handlers = [];
3662
- try {
3663
- const restoreHandler = patch(win.HTMLCanvasElement.prototype, 'getContext', function (original) {
3664
- return function (contextType, ...args) {
3665
- if (!isBlocked(this, blockClass, blockSelector, unblockSelector, true)) {
3666
- const ctxName = getNormalizedContextName(contextType);
3667
- if (!('__context' in this))
3668
- this.__context = ctxName;
3669
- if (setPreserveDrawingBufferToTrue &&
3670
- ['webgl', 'webgl2'].includes(ctxName)) {
3671
- if (args[0] && typeof args[0] === 'object') {
3672
- const contextAttributes = args[0];
3673
- if (!contextAttributes.preserveDrawingBuffer) {
3674
- contextAttributes.preserveDrawingBuffer = true;
3675
- }
3676
- }
3677
- else {
3678
- args.splice(0, 1, {
3679
- preserveDrawingBuffer: true,
3680
- });
3681
- }
3682
- }
3683
- }
3684
- return original.apply(this, [contextType, ...args]);
3685
- };
3686
- });
3687
- handlers.push(restoreHandler);
3688
- }
3689
- catch (_a) {
3690
- console.error('failed to patch HTMLCanvasElement.prototype.getContext');
3691
- }
3692
- return () => {
3693
- handlers.forEach((h) => h());
3694
- };
3695
- }
3696
-
3697
- function patchGLPrototype(prototype, type, cb, blockClass, blockSelector, unblockSelector, mirror, win) {
3698
- const handlers = [];
3699
- const props = Object.getOwnPropertyNames(prototype);
3700
- for (const prop of props) {
3701
- if ([
3702
- 'isContextLost',
3703
- 'canvas',
3704
- 'drawingBufferWidth',
3705
- 'drawingBufferHeight',
3706
- ].includes(prop)) {
3707
- continue;
3708
- }
3709
- try {
3710
- if (typeof prototype[prop] !== 'function') {
3711
- continue;
3712
- }
3713
- const restoreHandler = patch(prototype, prop, function (original) {
3714
- return function (...args) {
3715
- const result = original.apply(this, args);
3716
- saveWebGLVar(result, win, this);
3717
- if ('tagName' in this.canvas &&
3718
- !isBlocked(this.canvas, blockClass, blockSelector, unblockSelector, true)) {
3719
- const recordArgs = serializeArgs([...args], win, this);
3720
- const mutation = {
3721
- type,
3722
- property: prop,
3723
- args: recordArgs,
3724
- };
3725
- cb(this.canvas, mutation);
3726
- }
3727
- return result;
3728
- };
3729
- });
3730
- handlers.push(restoreHandler);
3731
- }
3732
- catch (_a) {
3733
- const hookHandler = hookSetter(prototype, prop, {
3734
- set(v) {
3735
- cb(this.canvas, {
3736
- type,
3737
- property: prop,
3738
- args: [v],
3739
- setter: true,
3740
- });
3741
- },
3742
- });
3743
- handlers.push(hookHandler);
3744
- }
3745
- }
3746
- return handlers;
3747
- }
3748
- function initCanvasWebGLMutationObserver(cb, win, blockClass, blockSelector, unblockSelector, mirror) {
3749
- const handlers = [];
3750
- handlers.push(...patchGLPrototype(win.WebGLRenderingContext.prototype, CanvasContext.WebGL, cb, blockClass, blockSelector, unblockSelector, mirror, win));
3751
- if (typeof win.WebGL2RenderingContext !== 'undefined') {
3752
- handlers.push(...patchGLPrototype(win.WebGL2RenderingContext.prototype, CanvasContext.WebGL2, cb, blockClass, blockSelector, unblockSelector, mirror, win));
3753
- }
3754
- return () => {
3755
- handlers.forEach((h) => h());
3756
- };
3757
- }
3758
-
3759
- function decodeBase64(base64, enableUnicode) {
3760
- var binaryString = atob(base64);
3761
- if (enableUnicode) {
3762
- var binaryView = new Uint8Array(binaryString.length);
3763
- for (var i = 0, n = binaryString.length; i < n; ++i) {
3764
- binaryView[i] = binaryString.charCodeAt(i);
3765
- }
3766
- return String.fromCharCode.apply(null, new Uint16Array(binaryView.buffer));
3767
- }
3768
- return binaryString;
3769
- }
3770
-
3771
- function createURL(base64, sourcemapArg, enableUnicodeArg) {
3772
- var sourcemap = sourcemapArg === undefined ? null : sourcemapArg;
3773
- var enableUnicode = enableUnicodeArg === undefined ? false : enableUnicodeArg;
3774
- var source = decodeBase64(base64, enableUnicode);
3775
- var start = source.indexOf('\n', 10) + 1;
3776
- var body = source.substring(start) + (sourcemap ? '\/\/# sourceMappingURL=' + sourcemap : '');
3777
- var blob = new Blob([body], { type: 'application/javascript' });
3778
- return URL.createObjectURL(blob);
3779
- }
3780
-
3781
- function createBase64WorkerFactory(base64, sourcemapArg, enableUnicodeArg) {
3782
- var url;
3783
- return function WorkerFactory(options) {
3784
- url = url || createURL(base64, sourcemapArg, enableUnicodeArg);
3785
- return new Worker(url, options);
3786
- };
3787
- }
3788
-
3789
- var WorkerFactory = createBase64WorkerFactory('Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCiAgICBPVEhFUiBUT1JUSU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgVVNFIE9SDQogICAgUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS4NCiAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLw0KDQogICAgZnVuY3Rpb24gX19hd2FpdGVyKHRoaXNBcmcsIF9hcmd1bWVudHMsIFAsIGdlbmVyYXRvcikgew0KICAgICAgICBmdW5jdGlvbiBhZG9wdCh2YWx1ZSkgeyByZXR1cm4gdmFsdWUgaW5zdGFuY2VvZiBQID8gdmFsdWUgOiBuZXcgUChmdW5jdGlvbiAocmVzb2x2ZSkgeyByZXNvbHZlKHZhbHVlKTsgfSk7IH0NCiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7DQogICAgICAgICAgICBmdW5jdGlvbiBmdWxmaWxsZWQodmFsdWUpIHsgdHJ5IHsgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgeyB0cnkgeyBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgeyByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsgfQ0KICAgICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOw0KICAgICAgICB9KTsNCiAgICB9CgogICAgLyoKICAgICAqIGJhc2U2NC1hcnJheWJ1ZmZlciAxLjAuMSA8aHR0cHM6Ly9naXRodWIuY29tL25pa2xhc3ZoL2Jhc2U2NC1hcnJheWJ1ZmZlcj4KICAgICAqIENvcHlyaWdodCAoYykgMjAyMSBOaWtsYXMgdm9uIEhlcnR6ZW4gPGh0dHBzOi8vaGVydHplbi5jb20+CiAgICAgKiBSZWxlYXNlZCB1bmRlciBNSVQgTGljZW5zZQogICAgICovCiAgICB2YXIgY2hhcnMgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyc7CiAgICAvLyBVc2UgYSBsb29rdXAgdGFibGUgdG8gZmluZCB0aGUgaW5kZXguCiAgICB2YXIgbG9va3VwID0gdHlwZW9mIFVpbnQ4QXJyYXkgPT09ICd1bmRlZmluZWQnID8gW10gOiBuZXcgVWludDhBcnJheSgyNTYpOwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaGFycy5sZW5ndGg7IGkrKykgewogICAgICAgIGxvb2t1cFtjaGFycy5jaGFyQ29kZUF0KGkpXSA9IGk7CiAgICB9CiAgICB2YXIgZW5jb2RlID0gZnVuY3Rpb24gKGFycmF5YnVmZmVyKSB7CiAgICAgICAgdmFyIGJ5dGVzID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlidWZmZXIpLCBpLCBsZW4gPSBieXRlcy5sZW5ndGgsIGJhc2U2NCA9ICcnOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkgKz0gMykgewogICAgICAgICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaV0gPj4gMl07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1soKGJ5dGVzW2ldICYgMykgPDwgNCkgfCAoYnl0ZXNbaSArIDFdID4+IDQpXTsKICAgICAgICAgICAgYmFzZTY0ICs9IGNoYXJzWygoYnl0ZXNbaSArIDFdICYgMTUpIDw8IDIpIHwgKGJ5dGVzW2kgKyAyXSA+PiA2KV07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1tieXRlc1tpICsgMl0gJiA2M107CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgJz0nOwogICAgICAgIH0KICAgICAgICBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgJz09JzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJhc2U2NDsKICAgIH07CgogICAgY29uc3QgbGFzdEJsb2JNYXAgPSBuZXcgTWFwKCk7DQogICAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gbmV3IE1hcCgpOw0KICAgIGZ1bmN0aW9uIGdldFRyYW5zcGFyZW50QmxvYkZvcih3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucykgew0KICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkgew0KICAgICAgICAgICAgY29uc3QgaWQgPSBgJHt3aWR0aH0tJHtoZWlnaHR9YDsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgaWYgKHRyYW5zcGFyZW50QmxvYk1hcC5oYXMoaWQpKQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNwYXJlbnRCbG9iTWFwLmdldChpZCk7DQogICAgICAgICAgICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsNCiAgICAgICAgICAgICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgnMmQnKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0geWllbGQgYmxvYi5hcnJheUJ1ZmZlcigpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7DQogICAgICAgICAgICAgICAgdHJhbnNwYXJlbnRCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICcnOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9KTsNCiAgICB9DQogICAgY29uc3Qgd29ya2VyID0gc2VsZjsNCiAgICB3b3JrZXIub25tZXNzYWdlID0gZnVuY3Rpb24gKGUpIHsNCiAgICAgICAgcmV0dXJuIF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgY29uc3QgeyBpZCwgYml0bWFwLCB3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucyB9ID0gZS5kYXRhOw0KICAgICAgICAgICAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zKTsNCiAgICAgICAgICAgICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=', null, false);
3790
-
3791
3329
  class CanvasManagerNoop {
3792
3330
  reset() {
3793
3331
  }
@@ -3800,180 +3338,6 @@ class CanvasManagerNoop {
3800
3338
  unlock() {
3801
3339
  }
3802
3340
  }
3803
- class CanvasManager {
3804
- reset() {
3805
- this.pendingCanvasMutations.clear();
3806
- this.resetObservers && this.resetObservers();
3807
- }
3808
- freeze() {
3809
- this.frozen = true;
3810
- }
3811
- unfreeze() {
3812
- this.frozen = false;
3813
- }
3814
- lock() {
3815
- this.locked = true;
3816
- }
3817
- unlock() {
3818
- this.locked = false;
3819
- }
3820
- constructor(options) {
3821
- this.pendingCanvasMutations = new Map();
3822
- this.rafStamps = { latestId: 0, invokeId: null };
3823
- this.frozen = false;
3824
- this.locked = false;
3825
- this.processMutation = (target, mutation) => {
3826
- const newFrame = this.rafStamps.invokeId &&
3827
- this.rafStamps.latestId !== this.rafStamps.invokeId;
3828
- if (newFrame || !this.rafStamps.invokeId)
3829
- this.rafStamps.invokeId = this.rafStamps.latestId;
3830
- if (!this.pendingCanvasMutations.has(target)) {
3831
- this.pendingCanvasMutations.set(target, []);
3832
- }
3833
- this.pendingCanvasMutations.get(target).push(mutation);
3834
- };
3835
- const { sampling = 'all', win, blockClass, blockSelector, unblockSelector, recordCanvas, dataURLOptions, } = options;
3836
- this.mutationCb = options.mutationCb;
3837
- this.mirror = options.mirror;
3838
- if (recordCanvas && sampling === 'all')
3839
- this.initCanvasMutationObserver(win, blockClass, blockSelector, unblockSelector);
3840
- if (recordCanvas && typeof sampling === 'number')
3841
- this.initCanvasFPSObserver(sampling, win, blockClass, blockSelector, unblockSelector, {
3842
- dataURLOptions,
3843
- });
3844
- }
3845
- initCanvasFPSObserver(fps, win, blockClass, blockSelector, unblockSelector, options) {
3846
- const canvasContextReset = initCanvasContextObserver(win, blockClass, blockSelector, unblockSelector, true);
3847
- const snapshotInProgressMap = new Map();
3848
- const worker = new WorkerFactory();
3849
- worker.onmessage = (e) => {
3850
- const { id } = e.data;
3851
- snapshotInProgressMap.set(id, false);
3852
- if (!('base64' in e.data))
3853
- return;
3854
- const { base64, type, width, height } = e.data;
3855
- this.mutationCb({
3856
- id,
3857
- type: CanvasContext['2D'],
3858
- commands: [
3859
- {
3860
- property: 'clearRect',
3861
- args: [0, 0, width, height],
3862
- },
3863
- {
3864
- property: 'drawImage',
3865
- args: [
3866
- {
3867
- rr_type: 'ImageBitmap',
3868
- args: [
3869
- {
3870
- rr_type: 'Blob',
3871
- data: [{ rr_type: 'ArrayBuffer', base64 }],
3872
- type,
3873
- },
3874
- ],
3875
- },
3876
- 0,
3877
- 0,
3878
- ],
3879
- },
3880
- ],
3881
- });
3882
- };
3883
- const timeBetweenSnapshots = 1000 / fps;
3884
- let lastSnapshotTime = 0;
3885
- let rafId;
3886
- const getCanvas = () => {
3887
- const matchedCanvas = [];
3888
- win.document.querySelectorAll('canvas').forEach((canvas) => {
3889
- if (!isBlocked(canvas, blockClass, blockSelector, unblockSelector, true)) {
3890
- matchedCanvas.push(canvas);
3891
- }
3892
- });
3893
- return matchedCanvas;
3894
- };
3895
- const takeCanvasSnapshots = (timestamp) => {
3896
- if (lastSnapshotTime &&
3897
- timestamp - lastSnapshotTime < timeBetweenSnapshots) {
3898
- rafId = requestAnimationFrame(takeCanvasSnapshots);
3899
- return;
3900
- }
3901
- lastSnapshotTime = timestamp;
3902
- getCanvas()
3903
- .forEach((canvas) => __awaiter(this, void 0, void 0, function* () {
3904
- var _a;
3905
- const id = this.mirror.getId(canvas);
3906
- if (snapshotInProgressMap.get(id))
3907
- return;
3908
- snapshotInProgressMap.set(id, true);
3909
- if (['webgl', 'webgl2'].includes(canvas.__context)) {
3910
- const context = canvas.getContext(canvas.__context);
3911
- if (((_a = context === null || context === void 0 ? void 0 : context.getContextAttributes()) === null || _a === void 0 ? void 0 : _a.preserveDrawingBuffer) === false) {
3912
- context.clear(context.COLOR_BUFFER_BIT);
3913
- }
3914
- }
3915
- const bitmap = yield createImageBitmap(canvas);
3916
- worker.postMessage({
3917
- id,
3918
- bitmap,
3919
- width: canvas.width,
3920
- height: canvas.height,
3921
- dataURLOptions: options.dataURLOptions,
3922
- }, [bitmap]);
3923
- }));
3924
- rafId = requestAnimationFrame(takeCanvasSnapshots);
3925
- };
3926
- rafId = requestAnimationFrame(takeCanvasSnapshots);
3927
- this.resetObservers = () => {
3928
- canvasContextReset();
3929
- cancelAnimationFrame(rafId);
3930
- };
3931
- }
3932
- initCanvasMutationObserver(win, blockClass, blockSelector, unblockSelector) {
3933
- this.startRAFTimestamping();
3934
- this.startPendingCanvasMutationFlusher();
3935
- const canvasContextReset = initCanvasContextObserver(win, blockClass, blockSelector, unblockSelector, false);
3936
- const canvas2DReset = initCanvas2DMutationObserver(this.processMutation.bind(this), win, blockClass, blockSelector, unblockSelector);
3937
- const canvasWebGL1and2Reset = initCanvasWebGLMutationObserver(this.processMutation.bind(this), win, blockClass, blockSelector, unblockSelector, this.mirror);
3938
- this.resetObservers = () => {
3939
- canvasContextReset();
3940
- canvas2DReset();
3941
- canvasWebGL1and2Reset();
3942
- };
3943
- }
3944
- startPendingCanvasMutationFlusher() {
3945
- requestAnimationFrame(() => this.flushPendingCanvasMutations());
3946
- }
3947
- startRAFTimestamping() {
3948
- const setLatestRAFTimestamp = (timestamp) => {
3949
- this.rafStamps.latestId = timestamp;
3950
- requestAnimationFrame(setLatestRAFTimestamp);
3951
- };
3952
- requestAnimationFrame(setLatestRAFTimestamp);
3953
- }
3954
- flushPendingCanvasMutations() {
3955
- this.pendingCanvasMutations.forEach((values, canvas) => {
3956
- const id = this.mirror.getId(canvas);
3957
- this.flushPendingCanvasMutationFor(canvas, id);
3958
- });
3959
- requestAnimationFrame(() => this.flushPendingCanvasMutations());
3960
- }
3961
- flushPendingCanvasMutationFor(canvas, id) {
3962
- if (this.frozen || this.locked) {
3963
- return;
3964
- }
3965
- const valuesWithType = this.pendingCanvasMutations.get(canvas);
3966
- if (!valuesWithType || id === -1)
3967
- return;
3968
- const values = valuesWithType.map((value) => {
3969
- const rest = __rest(value, ["type"]);
3970
- return rest;
3971
- });
3972
- const { type } = valuesWithType[0];
3973
- this.mutationCb({ id, type, commands: values });
3974
- this.pendingCanvasMutations.delete(canvas);
3975
- }
3976
- }
3977
3341
 
3978
3342
  class StylesheetManager {
3979
3343
  constructor(options) {
@@ -4069,17 +3433,16 @@ class ProcessedNodeManager {
4069
3433
  }
4070
3434
 
4071
3435
  function wrapEvent(e) {
4072
- return Object.assign(Object.assign({}, e), { timestamp: nowTimestamp() });
3436
+ const eWithTime = e;
3437
+ eWithTime.timestamp = nowTimestamp();
3438
+ return eWithTime;
4073
3439
  }
4074
- let wrappedEmit;
4075
- let takeFullSnapshot;
4076
- let canvasManager;
4077
- let recording = false;
3440
+ let _takeFullSnapshot;
4078
3441
  const mirror = createMirror();
4079
3442
  function record(options = {}) {
4080
- const { emit, checkoutEveryNms, checkoutEveryNth, blockClass = 'rr-block', blockSelector = null, unblockSelector = null, ignoreClass = 'rr-ignore', ignoreSelector = null, maskAllText = false, maskTextClass = 'rr-mask', unmaskTextClass = null, maskTextSelector = null, unmaskTextSelector = null, inlineStylesheet = true, maskAllInputs, maskInputOptions: _maskInputOptions, slimDOMOptions: _slimDOMOptions, maskAttributeFn, maskInputFn, maskTextFn, hooks, packFn, sampling = {}, dataURLOptions = {}, mousemoveWait, recordCanvas = false, recordCrossOriginIframes = false, recordAfter = options.recordAfter === 'DOMContentLoaded'
3443
+ const { emit, checkoutEveryNms, checkoutEveryNth, blockClass = 'rr-block', blockSelector = null, unblockSelector = null, ignoreClass = 'rr-ignore', ignoreSelector = null, maskAllText = false, maskTextClass = 'rr-mask', unmaskTextClass = null, maskTextSelector = null, unmaskTextSelector = null, inlineStylesheet = true, maskAllInputs, maskInputOptions: _maskInputOptions, slimDOMOptions: _slimDOMOptions, maskAttributeFn, maskInputFn, maskTextFn, packFn, sampling = {}, dataURLOptions = {}, mousemoveWait, recordCanvas = false, recordCrossOriginIframes = false, recordAfter = options.recordAfter === 'DOMContentLoaded'
4081
3444
  ? options.recordAfter
4082
- : 'load', userTriggeredOnInput = false, collectFonts = false, inlineImages = false, plugins, keepIframeSrcFn = () => false, ignoreCSSAttributes = new Set([]), errorHandler, onMutation, } = options;
3445
+ : 'load', userTriggeredOnInput = false, collectFonts = false, inlineImages = false, keepIframeSrcFn = () => false, ignoreCSSAttributes = new Set([]), errorHandler, onMutation, getCanvasManager, } = options;
4083
3446
  registerErrorHandler(errorHandler);
4084
3447
  const inEmittingFrame = recordCrossOriginIframes
4085
3448
  ? window.parent === window
@@ -4145,18 +3508,13 @@ function record(options = {}) {
4145
3508
  let lastFullSnapshotEvent;
4146
3509
  let incrementalSnapshotCount = 0;
4147
3510
  const eventProcessor = (e) => {
4148
- for (const plugin of plugins || []) {
4149
- if (plugin.eventProcessor) {
4150
- e = plugin.eventProcessor(e);
4151
- }
4152
- }
4153
3511
  if (packFn &&
4154
3512
  !passEmitsToParent) {
4155
3513
  e = packFn(e);
4156
3514
  }
4157
3515
  return e;
4158
3516
  };
4159
- wrappedEmit = (e, isCheckout) => {
3517
+ const wrappedEmit = (e, isCheckout) => {
4160
3518
  var _a;
4161
3519
  if (((_a = mutationBuffers[0]) === null || _a === void 0 ? void 0 : _a.isFrozen()) &&
4162
3520
  e.type !== EventType.FullSnapshot &&
@@ -4225,29 +3583,17 @@ function record(options = {}) {
4225
3583
  recordCrossOriginIframes,
4226
3584
  wrappedEmit,
4227
3585
  });
4228
- for (const plugin of plugins || []) {
4229
- if (plugin.getMirror)
4230
- plugin.getMirror({
4231
- nodeMirror: mirror,
4232
- crossOriginIframeMirror: iframeManager.crossOriginIframeMirror,
4233
- crossOriginIframeStyleMirror: iframeManager.crossOriginIframeStyleMirror,
4234
- });
4235
- }
4236
3586
  const processedNodeManager = new ProcessedNodeManager();
4237
- canvasManager =
4238
- typeof __RRWEB_EXCLUDE_CANVAS__ === 'boolean' && __RRWEB_EXCLUDE_CANVAS__
4239
- ? new CanvasManagerNoop()
4240
- : new CanvasManager({
4241
- recordCanvas,
4242
- mutationCb: wrappedCanvasMutationEmit,
4243
- win: window,
4244
- blockClass,
4245
- blockSelector,
4246
- unblockSelector,
4247
- mirror,
4248
- sampling: sampling.canvas,
4249
- dataURLOptions,
4250
- });
3587
+ const canvasManager = getCanvasManager
3588
+ ? getCanvasManager({
3589
+ recordCanvas,
3590
+ blockClass,
3591
+ blockSelector,
3592
+ unblockSelector,
3593
+ sampling: sampling['canvas'],
3594
+ dataURLOptions,
3595
+ })
3596
+ : new CanvasManagerNoop();
4251
3597
  const shadowDomManager = typeof __RRWEB_EXCLUDE_SHADOW_DOM__ === 'boolean' &&
4252
3598
  __RRWEB_EXCLUDE_SHADOW_DOM__
4253
3599
  ? new ShadowDomManagerNoop()
@@ -4282,7 +3628,7 @@ function record(options = {}) {
4282
3628
  },
4283
3629
  mirror,
4284
3630
  });
4285
- takeFullSnapshot = (isCheckout = false) => {
3631
+ const takeFullSnapshot = (isCheckout = false) => {
4286
3632
  wrappedEmit(wrapEvent({
4287
3633
  type: EventType.Meta,
4288
3634
  data: {
@@ -4347,10 +3693,10 @@ function record(options = {}) {
4347
3693
  if (document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0)
4348
3694
  stylesheetManager.adoptStyleSheets(document.adoptedStyleSheets, mirror.getId(document));
4349
3695
  };
3696
+ _takeFullSnapshot = takeFullSnapshot;
4350
3697
  try {
4351
3698
  const handlers = [];
4352
3699
  const observe = (doc) => {
4353
- var _a;
4354
3700
  return callbackWrapper(initObservers)({
4355
3701
  onMutation,
4356
3702
  mutationCb: wrappedMutationEmit,
@@ -4434,18 +3780,8 @@ function record(options = {}) {
4434
3780
  processedNodeManager,
4435
3781
  canvasManager,
4436
3782
  ignoreCSSAttributes,
4437
- plugins: ((_a = plugins === null || plugins === void 0 ? void 0 : plugins.filter((p) => p.observer)) === null || _a === void 0 ? void 0 : _a.map((p) => ({
4438
- observer: p.observer,
4439
- options: p.options,
4440
- callback: (payload) => wrappedEmit(wrapEvent({
4441
- type: EventType.Plugin,
4442
- data: {
4443
- plugin: p.name,
4444
- payload,
4445
- },
4446
- })),
4447
- }))) || [],
4448
- }, hooks);
3783
+ plugins: [],
3784
+ }, {});
4449
3785
  };
4450
3786
  iframeManager.addLoadListener((iframeEl) => {
4451
3787
  try {
@@ -4458,7 +3794,6 @@ function record(options = {}) {
4458
3794
  const init = () => {
4459
3795
  takeFullSnapshot();
4460
3796
  handlers.push(observe(document));
4461
- recording = true;
4462
3797
  };
4463
3798
  if (document.readyState === 'interactive' ||
4464
3799
  document.readyState === 'complete') {
@@ -4485,7 +3820,7 @@ function record(options = {}) {
4485
3820
  return () => {
4486
3821
  handlers.forEach((h) => h());
4487
3822
  processedNodeManager.destroy();
4488
- recording = false;
3823
+ _takeFullSnapshot = undefined;
4489
3824
  unregisterErrorHandler();
4490
3825
  };
4491
3826
  }
@@ -4493,28 +3828,17 @@ function record(options = {}) {
4493
3828
  console.warn(error);
4494
3829
  }
4495
3830
  }
4496
- record.addCustomEvent = (tag, payload) => {
4497
- if (!recording) {
4498
- throw new Error('please add custom event after start recording');
4499
- }
4500
- wrappedEmit(wrapEvent({
4501
- type: EventType.Custom,
4502
- data: {
4503
- tag,
4504
- payload,
4505
- },
4506
- }));
4507
- };
4508
- record.freezePage = () => {
4509
- mutationBuffers.forEach((buf) => buf.freeze());
4510
- };
4511
- record.takeFullSnapshot = (isCheckout) => {
4512
- if (!recording) {
3831
+ function takeFullSnapshot(isCheckout) {
3832
+ if (!_takeFullSnapshot) {
4513
3833
  throw new Error('please take full snapshot after start recording');
4514
3834
  }
4515
- takeFullSnapshot(isCheckout);
4516
- };
3835
+ _takeFullSnapshot(isCheckout);
3836
+ }
4517
3837
  record.mirror = mirror;
3838
+ record.takeFullSnapshot = takeFullSnapshot;
3839
+
3840
+ const ReplayEventTypeIncrementalSnapshot = 3;
3841
+ const ReplayEventTypeCustom = 5;
4518
3842
 
4519
3843
  /**
4520
3844
  * Converts a timestamp to ms, if it was in s, or keeps it as ms.
@@ -4566,6 +3890,12 @@ function addBreadcrumbEvent(replay, breadcrumb) {
4566
3890
 
4567
3891
  const INTERACTIVE_SELECTOR = 'button,a';
4568
3892
 
3893
+ /** Get the closest interactive parent element, or else return the given element. */
3894
+ function getClosestInteractive(element) {
3895
+ const closestInteractive = element.closest(INTERACTIVE_SELECTOR);
3896
+ return closestInteractive || element;
3897
+ }
3898
+
4569
3899
  /**
4570
3900
  * For clicks, we check if the target is inside of a button or link
4571
3901
  * If so, we use this as the target instead
@@ -4579,8 +3909,7 @@ function getClickTargetNode(event) {
4579
3909
  return target;
4580
3910
  }
4581
3911
 
4582
- const closestInteractive = target.closest(INTERACTIVE_SELECTOR);
4583
- return closestInteractive || target;
3912
+ return getClosestInteractive(target);
4584
3913
  }
4585
3914
 
4586
3915
  /** Get the event target node. */
@@ -4665,48 +3994,14 @@ class ClickDetector {
4665
3994
 
4666
3995
  /** Register click detection handlers on mutation or scroll. */
4667
3996
  addListeners() {
4668
- const mutationHandler = () => {
4669
- this._lastMutation = nowInSeconds();
4670
- };
4671
-
4672
- const scrollHandler = () => {
4673
- this._lastScroll = nowInSeconds();
4674
- };
4675
-
4676
3997
  const cleanupWindowOpen = onWindowOpen(() => {
4677
3998
  // Treat window.open as mutation
4678
3999
  this._lastMutation = nowInSeconds();
4679
4000
  });
4680
4001
 
4681
- const clickHandler = (event) => {
4682
- if (!event.target) {
4683
- return;
4684
- }
4685
-
4686
- const node = getClickTargetNode(event);
4687
- if (node) {
4688
- this._handleMultiClick(node );
4689
- }
4690
- };
4691
-
4692
- const obs = new MutationObserver(mutationHandler);
4693
-
4694
- obs.observe(WINDOW.document.documentElement, {
4695
- attributes: true,
4696
- characterData: true,
4697
- childList: true,
4698
- subtree: true,
4699
- });
4700
-
4701
- WINDOW.addEventListener('scroll', scrollHandler, { passive: true });
4702
- WINDOW.addEventListener('click', clickHandler, { passive: true });
4703
-
4704
4002
  this._teardown = () => {
4705
- WINDOW.removeEventListener('scroll', scrollHandler);
4706
- WINDOW.removeEventListener('click', clickHandler);
4707
4003
  cleanupWindowOpen();
4708
4004
 
4709
- obs.disconnect();
4710
4005
  this._clicks = [];
4711
4006
  this._lastMutation = 0;
4712
4007
  this._lastScroll = 0;
@@ -4724,7 +4019,7 @@ class ClickDetector {
4724
4019
  }
4725
4020
  }
4726
4021
 
4727
- /** Handle a click */
4022
+ /** @inheritDoc */
4728
4023
  handleClick(breadcrumb, node) {
4729
4024
  if (ignoreElement(node, this._ignoreSelector) || !isClickBreadcrumb(breadcrumb)) {
4730
4025
  return;
@@ -4753,6 +4048,22 @@ class ClickDetector {
4753
4048
  }
4754
4049
  }
4755
4050
 
4051
+ /** @inheritDoc */
4052
+ registerMutation(timestamp = Date.now()) {
4053
+ this._lastMutation = timestampToS(timestamp);
4054
+ }
4055
+
4056
+ /** @inheritDoc */
4057
+ registerScroll(timestamp = Date.now()) {
4058
+ this._lastScroll = timestampToS(timestamp);
4059
+ }
4060
+
4061
+ /** @inheritDoc */
4062
+ registerClick(element) {
4063
+ const node = getClosestInteractive(element);
4064
+ this._handleMultiClick(node );
4065
+ }
4066
+
4756
4067
  /** Count multiple clicks on elements. */
4757
4068
  _handleMultiClick(node) {
4758
4069
  this._getClicks(node).forEach(click => {
@@ -4907,6 +4218,53 @@ function nowInSeconds() {
4907
4218
  return Date.now() / 1000;
4908
4219
  }
4909
4220
 
4221
+ /** Update the click detector based on a recording event of rrweb. */
4222
+ function updateClickDetectorForRecordingEvent(clickDetector, event) {
4223
+ try {
4224
+ // note: We only consider incremental snapshots here
4225
+ // This means that any full snapshot is ignored for mutation detection - the reason is that we simply cannot know if a mutation happened here.
4226
+ // E.g. think that we are buffering, an error happens and we take a full snapshot because we switched to session mode -
4227
+ // in this scenario, we would not know if a dead click happened because of the error, which is a key dead click scenario.
4228
+ // Instead, by ignoring full snapshots, we have the risk that we generate a false positive
4229
+ // (if a mutation _did_ happen but was "swallowed" by the full snapshot)
4230
+ // But this should be more unlikely as we'd generally capture the incremental snapshot right away
4231
+
4232
+ if (!isIncrementalEvent(event)) {
4233
+ return;
4234
+ }
4235
+
4236
+ const { source } = event.data;
4237
+ if (source === IncrementalSource.Mutation) {
4238
+ clickDetector.registerMutation(event.timestamp);
4239
+ }
4240
+
4241
+ if (source === IncrementalSource.Scroll) {
4242
+ clickDetector.registerScroll(event.timestamp);
4243
+ }
4244
+
4245
+ if (isIncrementalMouseInteraction(event)) {
4246
+ const { type, id } = event.data;
4247
+ const node = record.mirror.getNode(id);
4248
+
4249
+ if (node instanceof HTMLElement && type === MouseInteractions.Click) {
4250
+ clickDetector.registerClick(node);
4251
+ }
4252
+ }
4253
+ } catch (e) {
4254
+ // ignore errors here, e.g. if accessing something that does not exist
4255
+ }
4256
+ }
4257
+
4258
+ function isIncrementalEvent(event) {
4259
+ return event.type === ReplayEventTypeIncrementalSnapshot;
4260
+ }
4261
+
4262
+ function isIncrementalMouseInteraction(
4263
+ event,
4264
+ ) {
4265
+ return event.data.source === IncrementalSource.MouseInteraction;
4266
+ }
4267
+
4910
4268
  /**
4911
4269
  * Create a breadcrumb for a replay.
4912
4270
  */
@@ -5313,7 +4671,7 @@ function setupPerformanceObserver(replay) {
5313
4671
  };
5314
4672
  }
5315
4673
 
5316
- const r = `var t={},e={};function a(t){let e=t.length;for(;--e>=0;)t[e]=0}const s=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),r=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),n=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),i=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_=new Array(576);a(_);const l=new Array(60);a(l);const h=new Array(512);a(h);const o=new Array(256);a(o);const d=new Array(29);a(d);const u=new Array(30);function f(t,e,a,s,r){this.static_tree=t,this.extra_bits=e,this.extra_base=a,this.elems=s,this.max_length=r,this.has_stree=t&&t.length}let c,p,g;function w(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}a(u);const m=t=>t<256?h[t]:h[256+(t>>>7)],b=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},y=(t,e,a)=>{t.bi_valid>16-a?(t.bi_buf|=e<<t.bi_valid&65535,b(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=a-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=a)},v=(t,e,a)=>{y(t,a[2*e],a[2*e+1])},z=(t,e)=>{let a=0;do{a|=1&t,t>>>=1,a<<=1}while(--e>0);return a>>>1},k=(t,e,a)=>{const s=new Array(16);let r,n,i=0;for(r=1;r<=15;r++)i=i+a[r-1]<<1,s[r]=i;for(n=0;n<=e;n++){let e=t[2*n+1];0!==e&&(t[2*n]=z(s[e]++,e))}},x=t=>{let e;for(e=0;e<286;e++)t.dyn_ltree[2*e]=0;for(e=0;e<30;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},A=t=>{t.bi_valid>8?b(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},E=(t,e,a,s)=>{const r=2*e,n=2*a;return t[r]<t[n]||t[r]===t[n]&&s[e]<=s[a]},Z=(t,e,a)=>{const s=t.heap[a];let r=a<<1;for(;r<=t.heap_len&&(r<t.heap_len&&E(e,t.heap[r+1],t.heap[r],t.depth)&&r++,!E(e,s,t.heap[r],t.depth));)t.heap[a]=t.heap[r],a=r,r<<=1;t.heap[a]=s},S=(t,e,a)=>{let n,i,_,l,h=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+h++],n+=(255&t.pending_buf[t.sym_buf+h++])<<8,i=t.pending_buf[t.sym_buf+h++],0===n?v(t,i,e):(_=o[i],v(t,_+256+1,e),l=s[_],0!==l&&(i-=d[_],y(t,i,l)),n--,_=m(n),v(t,_,a),l=r[_],0!==l&&(n-=u[_],y(t,n,l)))}while(h<t.sym_next);v(t,256,e)},U=(t,e)=>{const a=e.dyn_tree,s=e.stat_desc.static_tree,r=e.stat_desc.has_stree,n=e.stat_desc.elems;let i,_,l,h=-1;for(t.heap_len=0,t.heap_max=573,i=0;i<n;i++)0!==a[2*i]?(t.heap[++t.heap_len]=h=i,t.depth[i]=0):a[2*i+1]=0;for(;t.heap_len<2;)l=t.heap[++t.heap_len]=h<2?++h:0,a[2*l]=1,t.depth[l]=0,t.opt_len--,r&&(t.static_len-=s[2*l+1]);for(e.max_code=h,i=t.heap_len>>1;i>=1;i--)Z(t,a,i);l=n;do{i=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Z(t,a,1),_=t.heap[1],t.heap[--t.heap_max]=i,t.heap[--t.heap_max]=_,a[2*l]=a[2*i]+a[2*_],t.depth[l]=(t.depth[i]>=t.depth[_]?t.depth[i]:t.depth[_])+1,a[2*i+1]=a[2*_+1]=l,t.heap[1]=l++,Z(t,a,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const a=e.dyn_tree,s=e.max_code,r=e.stat_desc.static_tree,n=e.stat_desc.has_stree,i=e.stat_desc.extra_bits,_=e.stat_desc.extra_base,l=e.stat_desc.max_length;let h,o,d,u,f,c,p=0;for(u=0;u<=15;u++)t.bl_count[u]=0;for(a[2*t.heap[t.heap_max]+1]=0,h=t.heap_max+1;h<573;h++)o=t.heap[h],u=a[2*a[2*o+1]+1]+1,u>l&&(u=l,p++),a[2*o+1]=u,o>s||(t.bl_count[u]++,f=0,o>=_&&(f=i[o-_]),c=a[2*o],t.opt_len+=c*(u+f),n&&(t.static_len+=c*(r[2*o+1]+f)));if(0!==p){do{for(u=l-1;0===t.bl_count[u];)u--;t.bl_count[u]--,t.bl_count[u+1]+=2,t.bl_count[l]--,p-=2}while(p>0);for(u=l;0!==u;u--)for(o=t.bl_count[u];0!==o;)d=t.heap[--h],d>s||(a[2*d+1]!==u&&(t.opt_len+=(u-a[2*d+1])*a[2*d],a[2*d+1]=u),o--)}})(t,e),k(a,h,t.bl_count)},R=(t,e,a)=>{let s,r,n=-1,i=e[1],_=0,l=7,h=4;for(0===i&&(l=138,h=3),e[2*(a+1)+1]=65535,s=0;s<=a;s++)r=i,i=e[2*(s+1)+1],++_<l&&r===i||(_<h?t.bl_tree[2*r]+=_:0!==r?(r!==n&&t.bl_tree[2*r]++,t.bl_tree[32]++):_<=10?t.bl_tree[34]++:t.bl_tree[36]++,_=0,n=r,0===i?(l=138,h=3):r===i?(l=6,h=3):(l=7,h=4))},L=(t,e,a)=>{let s,r,n=-1,i=e[1],_=0,l=7,h=4;for(0===i&&(l=138,h=3),s=0;s<=a;s++)if(r=i,i=e[2*(s+1)+1],!(++_<l&&r===i)){if(_<h)do{v(t,r,t.bl_tree)}while(0!=--_);else 0!==r?(r!==n&&(v(t,r,t.bl_tree),_--),v(t,16,t.bl_tree),y(t,_-3,2)):_<=10?(v(t,17,t.bl_tree),y(t,_-3,3)):(v(t,18,t.bl_tree),y(t,_-11,7));_=0,n=r,0===i?(l=138,h=3):r===i?(l=6,h=3):(l=7,h=4)}};let T=!1;const F=(t,e,a,s)=>{y(t,0+(s?1:0),3),A(t),b(t,a),b(t,~a),a&&t.pending_buf.set(t.window.subarray(e,e+a),t.pending),t.pending+=a};e._tr_init=t=>{T||((()=>{let t,e,a,i,w;const m=new Array(16);for(a=0,i=0;i<28;i++)for(d[i]=a,t=0;t<1<<s[i];t++)o[a++]=i;for(o[a-1]=i,w=0,i=0;i<16;i++)for(u[i]=w,t=0;t<1<<r[i];t++)h[w++]=i;for(w>>=7;i<30;i++)for(u[i]=w<<7,t=0;t<1<<r[i]-7;t++)h[256+w++]=i;for(e=0;e<=15;e++)m[e]=0;for(t=0;t<=143;)_[2*t+1]=8,t++,m[8]++;for(;t<=255;)_[2*t+1]=9,t++,m[9]++;for(;t<=279;)_[2*t+1]=7,t++,m[7]++;for(;t<=287;)_[2*t+1]=8,t++,m[8]++;for(k(_,287,m),t=0;t<30;t++)l[2*t+1]=5,l[2*t]=z(t,5);c=new f(_,s,257,286,15),p=new f(l,r,0,30,15),g=new f(new Array(0),n,0,19,7)})(),T=!0),t.l_desc=new w(t.dyn_ltree,c),t.d_desc=new w(t.dyn_dtree,p),t.bl_desc=new w(t.bl_tree,g),t.bi_buf=0,t.bi_valid=0,x(t)},e._tr_stored_block=F,e._tr_flush_block=(t,e,a,s)=>{let r,n,h=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,a=4093624447;for(e=0;e<=31;e++,a>>>=1)if(1&a&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<256;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0})(t)),U(t,t.l_desc),U(t,t.d_desc),h=(t=>{let e;for(R(t,t.dyn_ltree,t.l_desc.max_code),R(t,t.dyn_dtree,t.d_desc.max_code),U(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*i[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),r=t.opt_len+3+7>>>3,n=t.static_len+3+7>>>3,n<=r&&(r=n)):r=n=a+5,a+4<=r&&-1!==e?F(t,e,a,s):4===t.strategy||n===r?(y(t,2+(s?1:0),3),S(t,_,l)):(y(t,4+(s?1:0),3),((t,e,a,s)=>{let r;for(y(t,e-257,5),y(t,a-1,5),y(t,s-4,4),r=0;r<s;r++)y(t,t.bl_tree[2*i[r]+1],3);L(t,t.dyn_ltree,e-1),L(t,t.dyn_dtree,a-1)})(t,t.l_desc.max_code+1,t.d_desc.max_code+1,h+1),S(t,t.dyn_ltree,t.dyn_dtree)),x(t),s&&A(t)},e._tr_tally=(t,e,a)=>(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=a,0===e?t.dyn_ltree[2*a]++:(t.matches++,e--,t.dyn_ltree[2*(o[a]+256+1)]++,t.dyn_dtree[2*m(e)]++),t.sym_next===t.sym_end),e._tr_align=t=>{y(t,2,3),v(t,256,_),(t=>{16===t.bi_valid?(b(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)};var O=(t,e,a,s)=>{let r=65535&t|0,n=t>>>16&65535|0,i=0;for(;0!==a;){i=a>2e3?2e3:a,a-=i;do{r=r+e[s++]|0,n=n+r|0}while(--i);r%=65521,n%=65521}return r|n<<16|0};const D=new Uint32Array((()=>{let t,e=[];for(var a=0;a<256;a++){t=a;for(var s=0;s<8;s++)t=1&t?3988292384^t>>>1:t>>>1;e[a]=t}return e})());var N=(t,e,a,s)=>{const r=D,n=s+a;t^=-1;for(let a=s;a<n;a++)t=t>>>8^r[255&(t^e[a])];return-1^t},C={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},I={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:H,_tr_stored_block:B,_tr_flush_block:M,_tr_tally:P,_tr_align:Y}=e,K=O,j=N,G=C,{Z_NO_FLUSH:X,Z_PARTIAL_FLUSH:W,Z_FULL_FLUSH:q,Z_FINISH:J,Z_BLOCK:Q,Z_OK:V,Z_STREAM_END:$,Z_STREAM_ERROR:tt,Z_DATA_ERROR:et,Z_BUF_ERROR:at,Z_DEFAULT_COMPRESSION:st,Z_FILTERED:rt,Z_HUFFMAN_ONLY:nt,Z_RLE:it,Z_FIXED:_t,Z_DEFAULT_STRATEGY:lt,Z_UNKNOWN:ht,Z_DEFLATED:ot}=I,dt=(t,e)=>(t.msg=G[e],e),ut=t=>2*t-(t>4?9:0),ft=t=>{let e=t.length;for(;--e>=0;)t[e]=0},ct=t=>{let e,a,s,r=t.w_size;e=t.hash_size,s=e;do{a=t.head[--s],t.head[s]=a>=r?a-r:0}while(--e);e=r,s=e;do{a=t.prev[--s],t.prev[s]=a>=r?a-r:0}while(--e)};let pt=(t,e,a)=>(e<<t.hash_shift^a)&t.hash_mask;const gt=t=>{const e=t.state;let a=e.pending;a>t.avail_out&&(a=t.avail_out),0!==a&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+a),t.next_out),t.next_out+=a,e.pending_out+=a,t.total_out+=a,t.avail_out-=a,e.pending-=a,0===e.pending&&(e.pending_out=0))},wt=(t,e)=>{M(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,gt(t.strm)},mt=(t,e)=>{t.pending_buf[t.pending++]=e},bt=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},yt=(t,e,a,s)=>{let r=t.avail_in;return r>s&&(r=s),0===r?0:(t.avail_in-=r,e.set(t.input.subarray(t.next_in,t.next_in+r),a),1===t.state.wrap?t.adler=K(t.adler,e,r,a):2===t.state.wrap&&(t.adler=j(t.adler,e,r,a)),t.next_in+=r,t.total_in+=r,r)},vt=(t,e)=>{let a,s,r=t.max_chain_length,n=t.strstart,i=t.prev_length,_=t.nice_match;const l=t.strstart>t.w_size-262?t.strstart-(t.w_size-262):0,h=t.window,o=t.w_mask,d=t.prev,u=t.strstart+258;let f=h[n+i-1],c=h[n+i];t.prev_length>=t.good_match&&(r>>=2),_>t.lookahead&&(_=t.lookahead);do{if(a=e,h[a+i]===c&&h[a+i-1]===f&&h[a]===h[n]&&h[++a]===h[n+1]){n+=2,a++;do{}while(h[++n]===h[++a]&&h[++n]===h[++a]&&h[++n]===h[++a]&&h[++n]===h[++a]&&h[++n]===h[++a]&&h[++n]===h[++a]&&h[++n]===h[++a]&&h[++n]===h[++a]&&n<u);if(s=258-(u-n),n=u-258,s>i){if(t.match_start=e,i=s,s>=_)break;f=h[n+i-1],c=h[n+i]}}}while((e=d[e&o])>l&&0!=--r);return i<=t.lookahead?i:t.lookahead},zt=t=>{const e=t.w_size;let a,s,r;do{if(s=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-262)&&(t.window.set(t.window.subarray(e,e+e-s),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),ct(t),s+=e),0===t.strm.avail_in)break;if(a=yt(t.strm,t.window,t.strstart+t.lookahead,s),t.lookahead+=a,t.lookahead+t.insert>=3)for(r=t.strstart-t.insert,t.ins_h=t.window[r],t.ins_h=pt(t,t.ins_h,t.window[r+1]);t.insert&&(t.ins_h=pt(t,t.ins_h,t.window[r+3-1]),t.prev[r&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=r,r++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<262&&0!==t.strm.avail_in)},kt=(t,e)=>{let a,s,r,n=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,i=0,_=t.strm.avail_in;do{if(a=65535,r=t.bi_valid+42>>3,t.strm.avail_out<r)break;if(r=t.strm.avail_out-r,s=t.strstart-t.block_start,a>s+t.strm.avail_in&&(a=s+t.strm.avail_in),a>r&&(a=r),a<n&&(0===a&&e!==J||e===X||a!==s+t.strm.avail_in))break;i=e===J&&a===s+t.strm.avail_in?1:0,B(t,0,0,i),t.pending_buf[t.pending-4]=a,t.pending_buf[t.pending-3]=a>>8,t.pending_buf[t.pending-2]=~a,t.pending_buf[t.pending-1]=~a>>8,gt(t.strm),s&&(s>a&&(s=a),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+s),t.strm.next_out),t.strm.next_out+=s,t.strm.avail_out-=s,t.strm.total_out+=s,t.block_start+=s,a-=s),a&&(yt(t.strm,t.strm.output,t.strm.next_out,a),t.strm.next_out+=a,t.strm.avail_out-=a,t.strm.total_out+=a)}while(0===i);return _-=t.strm.avail_in,_&&(_>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=_&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-_,t.strm.next_in),t.strstart),t.strstart+=_,t.insert+=_>t.w_size-t.insert?t.w_size-t.insert:_),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),i?4:e!==X&&e!==J&&0===t.strm.avail_in&&t.strstart===t.block_start?2:(r=t.window_size-t.strstart,t.strm.avail_in>r&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,r+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),r>t.strm.avail_in&&(r=t.strm.avail_in),r&&(yt(t.strm,t.window,t.strstart,r),t.strstart+=r,t.insert+=r>t.w_size-t.insert?t.w_size-t.insert:r),t.high_water<t.strstart&&(t.high_water=t.strstart),r=t.bi_valid+42>>3,r=t.pending_buf_size-r>65535?65535:t.pending_buf_size-r,n=r>t.w_size?t.w_size:r,s=t.strstart-t.block_start,(s>=n||(s||e===J)&&e!==X&&0===t.strm.avail_in&&s<=r)&&(a=s>r?r:s,i=e===J&&0===t.strm.avail_in&&a===s?1:0,B(t,t.block_start,a,i),t.block_start+=a,gt(t.strm)),i?3:1)},xt=(t,e)=>{let a,s;for(;;){if(t.lookahead<262){if(zt(t),t.lookahead<262&&e===X)return 1;if(0===t.lookahead)break}if(a=0,t.lookahead>=3&&(t.ins_h=pt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==a&&t.strstart-a<=t.w_size-262&&(t.match_length=vt(t,a)),t.match_length>=3)if(s=P(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=pt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=pt(t,t.ins_h,t.window[t.strstart+1]);else s=P(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(s&&(wt(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===J?(wt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(wt(t,!1),0===t.strm.avail_out)?1:2},At=(t,e)=>{let a,s,r;for(;;){if(t.lookahead<262){if(zt(t),t.lookahead<262&&e===X)return 1;if(0===t.lookahead)break}if(a=0,t.lookahead>=3&&(t.ins_h=pt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==a&&t.prev_length<t.max_lazy_match&&t.strstart-a<=t.w_size-262&&(t.match_length=vt(t,a),t.match_length<=5&&(t.strategy===rt||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){r=t.strstart+t.lookahead-3,s=P(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=r&&(t.ins_h=pt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,s&&(wt(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(s=P(t,0,t.window[t.strstart-1]),s&&wt(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(s=P(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===J?(wt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(wt(t,!1),0===t.strm.avail_out)?1:2};function Et(t,e,a,s,r){this.good_length=t,this.max_lazy=e,this.nice_length=a,this.max_chain=s,this.func=r}const Zt=[new Et(0,0,0,0,kt),new Et(4,4,8,4,xt),new Et(4,5,16,8,xt),new Et(4,6,32,32,xt),new Et(4,4,16,16,At),new Et(8,16,32,32,At),new Et(8,16,128,128,At),new Et(8,32,128,256,At),new Et(32,128,258,1024,At),new Et(32,258,258,4096,At)];function St(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ot,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),ft(this.dyn_ltree),ft(this.dyn_dtree),ft(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),ft(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),ft(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Ut=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||42!==e.status&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&113!==e.status&&666!==e.status?1:0},Rt=t=>{if(Ut(t))return dt(t,tt);t.total_in=t.total_out=0,t.data_type=ht;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?42:113,t.adler=2===e.wrap?0:1,e.last_flush=-2,H(e),V},Lt=t=>{const e=Rt(t);var a;return e===V&&((a=t.state).window_size=2*a.w_size,ft(a.head),a.max_lazy_match=Zt[a.level].max_lazy,a.good_match=Zt[a.level].good_length,a.nice_match=Zt[a.level].nice_length,a.max_chain_length=Zt[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=2,a.match_available=0,a.ins_h=0),e},Tt=(t,e,a,s,r,n)=>{if(!t)return tt;let i=1;if(e===st&&(e=6),s<0?(i=0,s=-s):s>15&&(i=2,s-=16),r<1||r>9||a!==ot||s<8||s>15||e<0||e>9||n<0||n>_t||8===s&&1!==i)return dt(t,tt);8===s&&(s=9);const _=new St;return t.state=_,_.strm=t,_.status=42,_.wrap=i,_.gzhead=null,_.w_bits=s,_.w_size=1<<_.w_bits,_.w_mask=_.w_size-1,_.hash_bits=r+7,_.hash_size=1<<_.hash_bits,_.hash_mask=_.hash_size-1,_.hash_shift=~~((_.hash_bits+3-1)/3),_.window=new Uint8Array(2*_.w_size),_.head=new Uint16Array(_.hash_size),_.prev=new Uint16Array(_.w_size),_.lit_bufsize=1<<r+6,_.pending_buf_size=4*_.lit_bufsize,_.pending_buf=new Uint8Array(_.pending_buf_size),_.sym_buf=_.lit_bufsize,_.sym_end=3*(_.lit_bufsize-1),_.level=e,_.strategy=n,_.method=a,Lt(t)};t.deflateInit=(t,e)=>Tt(t,e,ot,15,8,lt),t.deflateInit2=Tt,t.deflateReset=Lt,t.deflateResetKeep=Rt,t.deflateSetHeader=(t,e)=>Ut(t)||2!==t.state.wrap?tt:(t.state.gzhead=e,V),t.deflate=(t,e)=>{if(Ut(t)||e>Q||e<0)return t?dt(t,tt):tt;const a=t.state;if(!t.output||0!==t.avail_in&&!t.input||666===a.status&&e!==J)return dt(t,0===t.avail_out?at:tt);const s=a.last_flush;if(a.last_flush=e,0!==a.pending){if(gt(t),0===t.avail_out)return a.last_flush=-1,V}else if(0===t.avail_in&&ut(e)<=ut(s)&&e!==J)return dt(t,at);if(666===a.status&&0!==t.avail_in)return dt(t,at);if(42===a.status&&0===a.wrap&&(a.status=113),42===a.status){let e=ot+(a.w_bits-8<<4)<<8,s=-1;if(s=a.strategy>=nt||a.level<2?0:a.level<6?1:6===a.level?2:3,e|=s<<6,0!==a.strstart&&(e|=32),e+=31-e%31,bt(a,e),0!==a.strstart&&(bt(a,t.adler>>>16),bt(a,65535&t.adler)),t.adler=1,a.status=113,gt(t),0!==a.pending)return a.last_flush=-1,V}if(57===a.status)if(t.adler=0,mt(a,31),mt(a,139),mt(a,8),a.gzhead)mt(a,(a.gzhead.text?1:0)+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),mt(a,255&a.gzhead.time),mt(a,a.gzhead.time>>8&255),mt(a,a.gzhead.time>>16&255),mt(a,a.gzhead.time>>24&255),mt(a,9===a.level?2:a.strategy>=nt||a.level<2?4:0),mt(a,255&a.gzhead.os),a.gzhead.extra&&a.gzhead.extra.length&&(mt(a,255&a.gzhead.extra.length),mt(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(t.adler=j(t.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=69;else if(mt(a,0),mt(a,0),mt(a,0),mt(a,0),mt(a,0),mt(a,9===a.level?2:a.strategy>=nt||a.level<2?4:0),mt(a,3),a.status=113,gt(t),0!==a.pending)return a.last_flush=-1,V;if(69===a.status){if(a.gzhead.extra){let e=a.pending,s=(65535&a.gzhead.extra.length)-a.gzindex;for(;a.pending+s>a.pending_buf_size;){let r=a.pending_buf_size-a.pending;if(a.pending_buf.set(a.gzhead.extra.subarray(a.gzindex,a.gzindex+r),a.pending),a.pending=a.pending_buf_size,a.gzhead.hcrc&&a.pending>e&&(t.adler=j(t.adler,a.pending_buf,a.pending-e,e)),a.gzindex+=r,gt(t),0!==a.pending)return a.last_flush=-1,V;e=0,s-=r}let r=new Uint8Array(a.gzhead.extra);a.pending_buf.set(r.subarray(a.gzindex,a.gzindex+s),a.pending),a.pending+=s,a.gzhead.hcrc&&a.pending>e&&(t.adler=j(t.adler,a.pending_buf,a.pending-e,e)),a.gzindex=0}a.status=73}if(73===a.status){if(a.gzhead.name){let e,s=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>s&&(t.adler=j(t.adler,a.pending_buf,a.pending-s,s)),gt(t),0!==a.pending)return a.last_flush=-1,V;s=0}e=a.gzindex<a.gzhead.name.length?255&a.gzhead.name.charCodeAt(a.gzindex++):0,mt(a,e)}while(0!==e);a.gzhead.hcrc&&a.pending>s&&(t.adler=j(t.adler,a.pending_buf,a.pending-s,s)),a.gzindex=0}a.status=91}if(91===a.status){if(a.gzhead.comment){let e,s=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>s&&(t.adler=j(t.adler,a.pending_buf,a.pending-s,s)),gt(t),0!==a.pending)return a.last_flush=-1,V;s=0}e=a.gzindex<a.gzhead.comment.length?255&a.gzhead.comment.charCodeAt(a.gzindex++):0,mt(a,e)}while(0!==e);a.gzhead.hcrc&&a.pending>s&&(t.adler=j(t.adler,a.pending_buf,a.pending-s,s))}a.status=103}if(103===a.status){if(a.gzhead.hcrc){if(a.pending+2>a.pending_buf_size&&(gt(t),0!==a.pending))return a.last_flush=-1,V;mt(a,255&t.adler),mt(a,t.adler>>8&255),t.adler=0}if(a.status=113,gt(t),0!==a.pending)return a.last_flush=-1,V}if(0!==t.avail_in||0!==a.lookahead||e!==X&&666!==a.status){let s=0===a.level?kt(a,e):a.strategy===nt?((t,e)=>{let a;for(;;){if(0===t.lookahead&&(zt(t),0===t.lookahead)){if(e===X)return 1;break}if(t.match_length=0,a=P(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,a&&(wt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===J?(wt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(wt(t,!1),0===t.strm.avail_out)?1:2})(a,e):a.strategy===it?((t,e)=>{let a,s,r,n;const i=t.window;for(;;){if(t.lookahead<=258){if(zt(t),t.lookahead<=258&&e===X)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(r=t.strstart-1,s=i[r],s===i[++r]&&s===i[++r]&&s===i[++r])){n=t.strstart+258;do{}while(s===i[++r]&&s===i[++r]&&s===i[++r]&&s===i[++r]&&s===i[++r]&&s===i[++r]&&s===i[++r]&&s===i[++r]&&r<n);t.match_length=258-(n-r),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(a=P(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(a=P(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),a&&(wt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===J?(wt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(wt(t,!1),0===t.strm.avail_out)?1:2})(a,e):Zt[a.level].func(a,e);if(3!==s&&4!==s||(a.status=666),1===s||3===s)return 0===t.avail_out&&(a.last_flush=-1),V;if(2===s&&(e===W?Y(a):e!==Q&&(B(a,0,0,!1),e===q&&(ft(a.head),0===a.lookahead&&(a.strstart=0,a.block_start=0,a.insert=0))),gt(t),0===t.avail_out))return a.last_flush=-1,V}return e!==J?V:a.wrap<=0?$:(2===a.wrap?(mt(a,255&t.adler),mt(a,t.adler>>8&255),mt(a,t.adler>>16&255),mt(a,t.adler>>24&255),mt(a,255&t.total_in),mt(a,t.total_in>>8&255),mt(a,t.total_in>>16&255),mt(a,t.total_in>>24&255)):(bt(a,t.adler>>>16),bt(a,65535&t.adler)),gt(t),a.wrap>0&&(a.wrap=-a.wrap),0!==a.pending?V:$)},t.deflateEnd=t=>{if(Ut(t))return tt;const e=t.state.status;return t.state=null,113===e?dt(t,et):V},t.deflateSetDictionary=(t,e)=>{let a=e.length;if(Ut(t))return tt;const s=t.state,r=s.wrap;if(2===r||1===r&&42!==s.status||s.lookahead)return tt;if(1===r&&(t.adler=K(t.adler,e,a,0)),s.wrap=0,a>=s.w_size){0===r&&(ft(s.head),s.strstart=0,s.block_start=0,s.insert=0);let t=new Uint8Array(s.w_size);t.set(e.subarray(a-s.w_size,a),0),e=t,a=s.w_size}const n=t.avail_in,i=t.next_in,_=t.input;for(t.avail_in=a,t.next_in=0,t.input=e,zt(s);s.lookahead>=3;){let t=s.strstart,e=s.lookahead-2;do{s.ins_h=pt(s,s.ins_h,s.window[t+3-1]),s.prev[t&s.w_mask]=s.head[s.ins_h],s.head[s.ins_h]=t,t++}while(--e);s.strstart=t,s.lookahead=2,zt(s)}return s.strstart+=s.lookahead,s.block_start=s.strstart,s.insert=s.lookahead,s.lookahead=0,s.match_length=s.prev_length=2,s.match_available=0,t.next_in=i,t.input=_,t.avail_in=n,s.wrap=r,V},t.deflateInfo="pako deflate (from Nodeca project)";var Ft={};const Ot=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);Ft.assign=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const a=e.shift();if(a){if("object"!=typeof a)throw new TypeError(a+"must be non-object");for(const e in a)Ot(a,e)&&(t[e]=a[e])}}return t},Ft.flattenChunks=t=>{let e=0;for(let a=0,s=t.length;a<s;a++)e+=t[a].length;const a=new Uint8Array(e);for(let e=0,s=0,r=t.length;e<r;e++){let r=t[e];a.set(r,s),s+=r.length}return a};var Dt={};let Nt=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){Nt=!1}const Ct=new Uint8Array(256);for(let t=0;t<256;t++)Ct[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;Ct[254]=Ct[254]=1,Dt.string2buf=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,a,s,r,n,i=t.length,_=0;for(r=0;r<i;r++)a=t.charCodeAt(r),55296==(64512&a)&&r+1<i&&(s=t.charCodeAt(r+1),56320==(64512&s)&&(a=65536+(a-55296<<10)+(s-56320),r++)),_+=a<128?1:a<2048?2:a<65536?3:4;for(e=new Uint8Array(_),n=0,r=0;n<_;r++)a=t.charCodeAt(r),55296==(64512&a)&&r+1<i&&(s=t.charCodeAt(r+1),56320==(64512&s)&&(a=65536+(a-55296<<10)+(s-56320),r++)),a<128?e[n++]=a:a<2048?(e[n++]=192|a>>>6,e[n++]=128|63&a):a<65536?(e[n++]=224|a>>>12,e[n++]=128|a>>>6&63,e[n++]=128|63&a):(e[n++]=240|a>>>18,e[n++]=128|a>>>12&63,e[n++]=128|a>>>6&63,e[n++]=128|63&a);return e};Dt.buf2string=(t,e)=>{const a=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let s,r;const n=new Array(2*a);for(r=0,s=0;s<a;){let e=t[s++];if(e<128){n[r++]=e;continue}let i=Ct[e];if(i>4)n[r++]=65533,s+=i-1;else{for(e&=2===i?31:3===i?15:7;i>1&&s<a;)e=e<<6|63&t[s++],i--;i>1?n[r++]=65533:e<65536?n[r++]=e:(e-=65536,n[r++]=55296|e>>10&1023,n[r++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&Nt)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let a="";for(let s=0;s<e;s++)a+=String.fromCharCode(t[s]);return a})(n,r)},Dt.utf8border=(t,e)=>{(e=e||t.length)>t.length&&(e=t.length);let a=e-1;for(;a>=0&&128==(192&t[a]);)a--;return a<0||0===a?e:a+Ct[t[a]]>e?a:e};const It=t,Ht=Ft,Bt=Dt,Mt=C,Pt=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0},Yt=Object.prototype.toString,{Z_NO_FLUSH:Kt,Z_SYNC_FLUSH:jt,Z_FULL_FLUSH:Gt,Z_FINISH:Xt,Z_OK:Wt,Z_STREAM_END:qt,Z_DEFAULT_COMPRESSION:Jt,Z_DEFAULT_STRATEGY:Qt,Z_DEFLATED:Vt}=I;function $t(t){this.options=Ht.assign({level:Jt,method:Vt,chunkSize:16384,windowBits:15,memLevel:8,strategy:Qt},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Pt,this.strm.avail_out=0;let a=It.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(a!==Wt)throw new Error(Mt[a]);if(e.header&&It.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?Bt.string2buf(e.dictionary):"[object ArrayBuffer]"===Yt.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,a=It.deflateSetDictionary(this.strm,t),a!==Wt)throw new Error(Mt[a]);this._dict_set=!0}}$t.prototype.push=function(t,e){const a=this.strm,s=this.options.chunkSize;let r,n;if(this.ended)return!1;for(n=e===~~e?e:!0===e?Xt:Kt,"string"==typeof t?a.input=Bt.string2buf(t):"[object ArrayBuffer]"===Yt.call(t)?a.input=new Uint8Array(t):a.input=t,a.next_in=0,a.avail_in=a.input.length;;)if(0===a.avail_out&&(a.output=new Uint8Array(s),a.next_out=0,a.avail_out=s),(n===jt||n===Gt)&&a.avail_out<=6)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else{if(r=It.deflate(a,n),r===qt)return a.next_out>0&&this.onData(a.output.subarray(0,a.next_out)),r=It.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===Wt;if(0!==a.avail_out){if(n>0&&a.next_out>0)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else if(0===a.avail_in)break}else this.onData(a.output)}return!0},$t.prototype.onData=function(t){this.chunks.push(t)},$t.prototype.onEnd=function(t){t===Wt&&(this.result=Ht.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};const te=$t,ee=function(t,e){const a=new $t(e);if(a.push(t,!0),a.err)throw a.msg||Mt[a.err];return a.result},ae=I;const se=new class{constructor(){this._init()}clear(){this._init()}addEvent(t){if(!t)throw new Error("Adding invalid event");const e=this._hasEvents?",":"";this.deflate.push(e+t,ae.Z_SYNC_FLUSH),this._hasEvents=!0}finish(){if(this.deflate.push("]",ae.Z_FINISH),this.deflate.err)throw this.deflate.err;const t=this.deflate.result;return this._init(),t}_init(){this._hasEvents=!1,this.deflate=new te,this.deflate.push("[",ae.Z_NO_FLUSH)}},re={clear:()=>{se.clear()},addEvent:t=>se.addEvent(t),finish:()=>se.finish(),compress:t=>function(t){return ee(t)}(t)};addEventListener("message",(function(t){const e=t.data.method,a=t.data.id,s=t.data.arg;if(e in re&&"function"==typeof re[e])try{const t=re[e](s);postMessage({id:a,method:e,success:!0,response:t})}catch(t){postMessage({id:a,method:e,success:!1,response:t.message}),console.error(t)}})),postMessage({id:void 0,method:"init",success:!0,response:void 0});`;
4674
+ const r = `var t=Uint8Array,n=Uint16Array,r=Int32Array,e=new t([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),i=new t([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),a=new t([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),s=function(t,e){for(var i=new n(31),a=0;a<31;++a)i[a]=e+=1<<t[a-1];var s=new r(i[30]);for(a=1;a<30;++a)for(var o=i[a];o<i[a+1];++o)s[o]=o-i[a]<<5|a;return{b:i,r:s}},o=s(e,2),f=o.b,h=o.r;f[28]=258,h[258]=28;for(var l=s(i,0).r,u=new n(32768),c=0;c<32768;++c){var v=(43690&c)>>1|(21845&c)<<1;v=(61680&(v=(52428&v)>>2|(13107&v)<<2))>>4|(3855&v)<<4,u[c]=((65280&v)>>8|(255&v)<<8)>>1}var d=function(t,r,e){for(var i=t.length,a=0,s=new n(r);a<i;++a)t[a]&&++s[t[a]-1];var o,f=new n(r);for(a=1;a<r;++a)f[a]=f[a-1]+s[a-1]<<1;if(e){o=new n(1<<r);var h=15-r;for(a=0;a<i;++a)if(t[a])for(var l=a<<4|t[a],c=r-t[a],v=f[t[a]-1]++<<c,d=v|(1<<c)-1;v<=d;++v)o[u[v]>>h]=l}else for(o=new n(i),a=0;a<i;++a)t[a]&&(o[a]=u[f[t[a]-1]++]>>15-t[a]);return o},g=new t(288);for(c=0;c<144;++c)g[c]=8;for(c=144;c<256;++c)g[c]=9;for(c=256;c<280;++c)g[c]=7;for(c=280;c<288;++c)g[c]=8;var w=new t(32);for(c=0;c<32;++c)w[c]=5;var p=d(g,9,0),y=d(w,5,0),m=function(t){return(t+7)/8|0},b=function(n,r,e){return(null==r||r<0)&&(r=0),(null==e||e>n.length)&&(e=n.length),new t(n.subarray(r,e))},M=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],E=function(t,n,r){var e=new Error(n||M[t]);if(e.code=t,Error.captureStackTrace&&Error.captureStackTrace(e,E),!r)throw e;return e},z=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8},A=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8,t[e+2]|=r>>16},_=function(r,e){for(var i=[],a=0;a<r.length;++a)r[a]&&i.push({s:a,f:r[a]});var s=i.length,o=i.slice();if(!s)return{t:F,l:0};if(1==s){var f=new t(i[0].s+1);return f[i[0].s]=1,{t:f,l:1}}i.sort((function(t,n){return t.f-n.f})),i.push({s:-1,f:25001});var h=i[0],l=i[1],u=0,c=1,v=2;for(i[0]={s:-1,f:h.f+l.f,l:h,r:l};c!=s-1;)h=i[i[u].f<i[v].f?u++:v++],l=i[u!=c&&i[u].f<i[v].f?u++:v++],i[c++]={s:-1,f:h.f+l.f,l:h,r:l};var d=o[0].s;for(a=1;a<s;++a)o[a].s>d&&(d=o[a].s);var g=new n(d+1),w=x(i[c-1],g,0);if(w>e){a=0;var p=0,y=w-e,m=1<<y;for(o.sort((function(t,n){return g[n.s]-g[t.s]||t.f-n.f}));a<s;++a){var b=o[a].s;if(!(g[b]>e))break;p+=m-(1<<w-g[b]),g[b]=e}for(p>>=y;p>0;){var M=o[a].s;g[M]<e?p-=1<<e-g[M]++-1:++a}for(;a>=0&&p;--a){var E=o[a].s;g[E]==e&&(--g[E],++p)}w=e}return{t:new t(g),l:w}},x=function(t,n,r){return-1==t.s?Math.max(x(t.l,n,r+1),x(t.r,n,r+1)):n[t.s]=r},D=function(t){for(var r=t.length;r&&!t[--r];);for(var e=new n(++r),i=0,a=t[0],s=1,o=function(t){e[i++]=t},f=1;f<=r;++f)if(t[f]==a&&f!=r)++s;else{if(!a&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(a),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(a);s=1,a=t[f]}return{c:e.subarray(0,i),n:r}},T=function(t,n){for(var r=0,e=0;e<n.length;++e)r+=t[e]*n[e];return r},k=function(t,n,r){var e=r.length,i=m(n+2);t[i]=255&e,t[i+1]=e>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var a=0;a<e;++a)t[i+a+4]=r[a];return 8*(i+4+e)},C=function(t,r,s,o,f,h,l,u,c,v,m){z(r,m++,s),++f[256];for(var b=_(f,15),M=b.t,E=b.l,x=_(h,15),C=x.t,U=x.l,F=D(M),I=F.c,S=F.n,L=D(C),O=L.c,j=L.n,q=new n(19),B=0;B<I.length;++B)++q[31&I[B]];for(B=0;B<O.length;++B)++q[31&O[B]];for(var G=_(q,7),H=G.t,J=G.l,K=19;K>4&&!H[a[K-1]];--K);var N,P,Q,R,V=v+5<<3,W=T(f,g)+T(h,w)+l,X=T(f,M)+T(h,C)+l+14+3*K+T(q,H)+2*q[16]+3*q[17]+7*q[18];if(c>=0&&V<=W&&V<=X)return k(r,m,t.subarray(c,c+v));if(z(r,m,1+(X<W)),m+=2,X<W){N=d(M,E,0),P=M,Q=d(C,U,0),R=C;var Y=d(H,J,0);z(r,m,S-257),z(r,m+5,j-1),z(r,m+10,K-4),m+=14;for(B=0;B<K;++B)z(r,m+3*B,H[a[B]]);m+=3*K;for(var Z=[I,O],$=0;$<2;++$){var tt=Z[$];for(B=0;B<tt.length;++B){var nt=31&tt[B];z(r,m,Y[nt]),m+=H[nt],nt>15&&(z(r,m,tt[B]>>5&127),m+=tt[B]>>12)}}}else N=p,P=g,Q=y,R=w;for(B=0;B<u;++B){var rt=o[B];if(rt>255){A(r,m,N[(nt=rt>>18&31)+257]),m+=P[nt+257],nt>7&&(z(r,m,rt>>23&31),m+=e[nt]);var et=31&rt;A(r,m,Q[et]),m+=R[et],et>3&&(A(r,m,rt>>5&8191),m+=i[et])}else A(r,m,N[rt]),m+=P[rt]}return A(r,m,N[256]),m+P[256]},U=new r([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),F=new t(0),I=function(){for(var t=new Int32Array(256),n=0;n<256;++n){for(var r=n,e=9;--e;)r=(1&r&&-306674912)^r>>>1;t[n]=r}return t}(),S=function(){var t=1,n=0;return{p:function(r){for(var e=t,i=n,a=0|r.length,s=0;s!=a;){for(var o=Math.min(s+2655,a);s<o;++s)i+=e+=r[s];e=(65535&e)+15*(e>>16),i=(65535&i)+15*(i>>16)}t=e,n=i},d:function(){return(255&(t%=65521))<<24|(65280&t)<<8|(255&(n%=65521))<<8|n>>8}}},L=function(a,s,o,f,u){if(!u&&(u={l:1},s.dictionary)){var c=s.dictionary.subarray(-32768),v=new t(c.length+a.length);v.set(c),v.set(a,c.length),a=v,u.w=c.length}return function(a,s,o,f,u,c){var v=c.z||a.length,d=new t(f+v+5*(1+Math.ceil(v/7e3))+u),g=d.subarray(f,d.length-u),w=c.l,p=7&(c.r||0);if(s){p&&(g[0]=c.r>>3);for(var y=U[s-1],M=y>>13,E=8191&y,z=(1<<o)-1,A=c.p||new n(32768),_=c.h||new n(z+1),x=Math.ceil(o/3),D=2*x,T=function(t){return(a[t]^a[t+1]<<x^a[t+2]<<D)&z},F=new r(25e3),I=new n(288),S=new n(32),L=0,O=0,j=c.i||0,q=0,B=c.w||0,G=0;j+2<v;++j){var H=T(j),J=32767&j,K=_[H];if(A[J]=K,_[H]=J,B<=j){var N=v-j;if((L>7e3||q>24576)&&(N>423||!w)){p=C(a,g,0,F,I,S,O,q,G,j-G,p),q=L=O=0,G=j;for(var P=0;P<286;++P)I[P]=0;for(P=0;P<30;++P)S[P]=0}var Q=2,R=0,V=E,W=J-K&32767;if(N>2&&H==T(j-W))for(var X=Math.min(M,N)-1,Y=Math.min(32767,j),Z=Math.min(258,N);W<=Y&&--V&&J!=K;){if(a[j+Q]==a[j+Q-W]){for(var $=0;$<Z&&a[j+$]==a[j+$-W];++$);if($>Q){if(Q=$,R=W,$>X)break;var tt=Math.min(W,$-2),nt=0;for(P=0;P<tt;++P){var rt=j-W+P&32767,et=rt-A[rt]&32767;et>nt&&(nt=et,K=rt)}}}W+=(J=K)-(K=A[J])&32767}if(R){F[q++]=268435456|h[Q]<<18|l[R];var it=31&h[Q],at=31&l[R];O+=e[it]+i[at],++I[257+it],++S[at],B=j+Q,++L}else F[q++]=a[j],++I[a[j]]}}for(j=Math.max(j,B);j<v;++j)F[q++]=a[j],++I[a[j]];p=C(a,g,w,F,I,S,O,q,G,j-G,p),w||(c.r=7&p|g[p/8|0]<<3,p-=7,c.h=_,c.p=A,c.i=j,c.w=B)}else{for(j=c.w||0;j<v+w;j+=65535){var st=j+65535;st>=v&&(g[p/8|0]=w,st=v),p=k(g,p+1,a.subarray(j,st))}c.i=v}return b(d,0,f+m(p)+u)}(a,null==s.level?6:s.level,null==s.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(a.length)))):12+s.mem,o,f,u)},O=function(t,n,r){for(;r;++n)t[n]=r,r>>>=8},j=function(){function n(n,r){if("function"==typeof n&&(r=n,n={}),this.ondata=r,this.o=n||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new t(98304),this.o.dictionary){var e=this.o.dictionary.subarray(-32768);this.b.set(e,32768-e.length),this.s.i=32768-e.length}}return n.prototype.p=function(t,n){this.ondata(L(t,this.o,0,0,this.s),n)},n.prototype.push=function(n,r){this.ondata||E(5),this.s.l&&E(4);var e=n.length+this.s.z;if(e>this.b.length){if(e>2*this.b.length-32768){var i=new t(-32768&e);i.set(this.b.subarray(0,this.s.z)),this.b=i}var a=this.b.length-this.s.z;a&&(this.b.set(n.subarray(0,a),this.s.z),this.s.z=this.b.length,this.p(this.b,!1)),this.b.set(this.b.subarray(-32768)),this.b.set(n.subarray(a),32768),this.s.z=n.length-a+32768,this.s.i=32766,this.s.w=32768}else this.b.set(n,this.s.z),this.s.z+=n.length;this.s.l=1&r,(this.s.z>this.s.w+8191||r)&&(this.p(this.b,r||!1),this.s.w=this.s.i,this.s.i-=2)},n}();function q(t,n){n||(n={});var r=function(){var t=-1;return{p:function(n){for(var r=t,e=0;e<n.length;++e)r=I[255&r^n[e]]^r>>>8;t=r},d:function(){return~t}}}(),e=t.length;r.p(t);var i,a=L(t,n,10+((i=n).filename?i.filename.length+1:0),8),s=a.length;return function(t,n){var r=n.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=n.level<2?4:9==n.level?2:0,t[9]=3,0!=n.mtime&&O(t,4,Math.floor(new Date(n.mtime||Date.now())/1e3)),r){t[3]=8;for(var e=0;e<=r.length;++e)t[e+10]=r.charCodeAt(e)}}(a,n),O(a,s-8,r.d()),O(a,s-4,e),a}var B=function(){function t(t,n){this.c=S(),this.v=1,j.call(this,t,n)}return t.prototype.push=function(t,n){this.c.p(t),j.prototype.push.call(this,t,n)},t.prototype.p=function(t,n){var r=L(t,this.o,this.v&&(this.o.dictionary?6:2),n&&4,this.s);this.v&&(function(t,n){var r=n.level,e=0==r?0:r<6?1:9==r?3:2;if(t[0]=120,t[1]=e<<6|(n.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,n.dictionary){var i=S();i.p(n.dictionary),O(t,2,i.d())}}(r,this.o),this.v=0),n&&O(r,r.length-4,this.c.d()),this.ondata(r,n)},t}(),G="undefined"!=typeof TextEncoder&&new TextEncoder,H="undefined"!=typeof TextDecoder&&new TextDecoder;try{H.decode(F,{stream:!0})}catch(t){}var J=function(){function t(t){this.ondata=t}return t.prototype.push=function(t,n){this.ondata||E(5),this.d&&E(4),this.ondata(K(t),this.d=n||!1)},t}();function K(n,r){if(r){for(var e=new t(n.length),i=0;i<n.length;++i)e[i]=n.charCodeAt(i);return e}if(G)return G.encode(n);var a=n.length,s=new t(n.length+(n.length>>1)),o=0,f=function(t){s[o++]=t};for(i=0;i<a;++i){if(o+5>s.length){var h=new t(o+8+(a-i<<1));h.set(s),s=h}var l=n.charCodeAt(i);l<128||r?f(l):l<2048?(f(192|l>>6),f(128|63&l)):l>55295&&l<57344?(f(240|(l=65536+(1047552&l)|1023&n.charCodeAt(++i))>>18),f(128|l>>12&63),f(128|l>>6&63),f(128|63&l)):(f(224|l>>12),f(128|l>>6&63),f(128|63&l))}return b(s,0,o)}const N=new class{constructor(){this._init()}clear(){this._init()}addEvent(t){if(!t)throw new Error("Adding invalid event");const n=this._hasEvents?",":"";this.stream.push(n+t),this._hasEvents=!0}finish(){this.stream.push("]",!0);const t=function(t){let n=0;for(let r=0,e=t.length;r<e;r++)n+=t[r].length;const r=new Uint8Array(n);for(let n=0,e=0,i=t.length;n<i;n++){const i=t[n];r.set(i,e),e+=i.length}return r}(this._deflatedData);return this._init(),t}_init(){this._hasEvents=!1,this._deflatedData=[],this.deflate=new B,this.deflate.ondata=(t,n)=>{this._deflatedData.push(t)},this.stream=new J(((t,n)=>{this.deflate.push(t,n)})),this.stream.push("[")}},P={clear:()=>{N.clear()},addEvent:t=>N.addEvent(t),finish:()=>N.finish(),compress:t=>function(t){return q(K(t))}(t)};addEventListener("message",(function(t){const n=t.data.method,r=t.data.id,e=t.data.arg;if(n in P&&"function"==typeof P[n])try{const t=P[n](e);postMessage({id:r,method:n,success:!0,response:t})}catch(t){postMessage({id:r,method:n,success:!1,response:t.message}),console.error(t)}})),postMessage({id:void 0,method:"init",success:!0,response:void 0});`;
5317
4675
 
5318
4676
  function e(){const e=new Blob([r]);return URL.createObjectURL(e)}
5319
4677
 
@@ -6039,8 +5397,6 @@ function loadOrCreateSession(
6039
5397
  return createSession(sessionOptions, { previousSessionId: existingSession.id });
6040
5398
  }
6041
5399
 
6042
- const ReplayEventTypeCustom = 5;
6043
-
6044
5400
  function isCustomEvent(event) {
6045
5401
  return event.type === EventType.Custom;
6046
5402
  }
@@ -6239,12 +5595,19 @@ function handleErrorEvent(replay, event) {
6239
5595
 
6240
5596
  // If error event is tagged with replay id it means it was sampled (when in buffer mode)
6241
5597
  // Need to be very careful that this does not cause an infinite loop
6242
- if (replay.recordingMode === 'buffer' && event.tags && event.tags.replayId) {
6243
- setTimeout(() => {
6244
- // Capture current event buffer as new replay
6245
- void replay.sendBufferedReplayOrFlush();
6246
- });
5598
+ if (replay.recordingMode !== 'buffer' || !event.tags || !event.tags.replayId) {
5599
+ return;
6247
5600
  }
5601
+
5602
+ const { beforeErrorSampling } = replay.getOptions();
5603
+ if (typeof beforeErrorSampling === 'function' && !beforeErrorSampling(event)) {
5604
+ return;
5605
+ }
5606
+
5607
+ setTimeout(() => {
5608
+ // Capture current event buffer as new replay
5609
+ void replay.sendBufferedReplayOrFlush();
5610
+ });
6248
5611
  }
6249
5612
 
6250
5613
  function isBaseTransportSend() {
@@ -6562,393 +5925,6 @@ function handleXhrSpanListener(replay) {
6562
5925
  };
6563
5926
  }
6564
5927
 
6565
- const OBJ = 10;
6566
- const OBJ_KEY = 11;
6567
- const OBJ_KEY_STR = 12;
6568
- const OBJ_VAL = 13;
6569
- const OBJ_VAL_STR = 14;
6570
- const OBJ_VAL_COMPLETED = 15;
6571
-
6572
- const ARR = 20;
6573
- const ARR_VAL = 21;
6574
- const ARR_VAL_STR = 22;
6575
- const ARR_VAL_COMPLETED = 23;
6576
-
6577
- const ALLOWED_PRIMITIVES = ['true', 'false', 'null'];
6578
-
6579
- /**
6580
- * Complete an incomplete JSON string.
6581
- * This will ensure that the last element always has a `"~~"` to indicate it was truncated.
6582
- * For example, `[1,2,` will be completed to `[1,2,"~~"]`
6583
- * and `{"aa":"b` will be completed to `{"aa":"b~~"}`
6584
- */
6585
- function completeJson(incompleteJson, stack) {
6586
- if (!stack.length) {
6587
- return incompleteJson;
6588
- }
6589
-
6590
- let json = incompleteJson;
6591
-
6592
- // Most checks are only needed for the last step in the stack
6593
- const lastPos = stack.length - 1;
6594
- const lastStep = stack[lastPos];
6595
-
6596
- json = _fixLastStep(json, lastStep);
6597
-
6598
- // Complete remaining steps - just add closing brackets
6599
- for (let i = lastPos; i >= 0; i--) {
6600
- const step = stack[i];
6601
-
6602
- switch (step) {
6603
- case OBJ:
6604
- json = `${json}}`;
6605
- break;
6606
- case ARR:
6607
- json = `${json}]`;
6608
- break;
6609
- }
6610
- }
6611
-
6612
- return json;
6613
- }
6614
-
6615
- function _fixLastStep(json, lastStep) {
6616
- switch (lastStep) {
6617
- // Object cases
6618
- case OBJ:
6619
- return `${json}"~~":"~~"`;
6620
- case OBJ_KEY:
6621
- return `${json}:"~~"`;
6622
- case OBJ_KEY_STR:
6623
- return `${json}~~":"~~"`;
6624
- case OBJ_VAL:
6625
- return _maybeFixIncompleteObjValue(json);
6626
- case OBJ_VAL_STR:
6627
- return `${json}~~"`;
6628
- case OBJ_VAL_COMPLETED:
6629
- return `${json},"~~":"~~"`;
6630
-
6631
- // Array cases
6632
- case ARR:
6633
- return `${json}"~~"`;
6634
- case ARR_VAL:
6635
- return _maybeFixIncompleteArrValue(json);
6636
- case ARR_VAL_STR:
6637
- return `${json}~~"`;
6638
- case ARR_VAL_COMPLETED:
6639
- return `${json},"~~"`;
6640
- }
6641
-
6642
- return json;
6643
- }
6644
-
6645
- function _maybeFixIncompleteArrValue(json) {
6646
- const pos = _findLastArrayDelimiter(json);
6647
-
6648
- if (pos > -1) {
6649
- const part = json.slice(pos + 1);
6650
-
6651
- if (ALLOWED_PRIMITIVES.includes(part.trim())) {
6652
- return `${json},"~~"`;
6653
- }
6654
-
6655
- // Everything else is replaced with `"~~"`
6656
- return `${json.slice(0, pos + 1)}"~~"`;
6657
- }
6658
-
6659
- // fallback, this shouldn't happen, to be save
6660
- return json;
6661
- }
6662
-
6663
- function _findLastArrayDelimiter(json) {
6664
- for (let i = json.length - 1; i >= 0; i--) {
6665
- const char = json[i];
6666
-
6667
- if (char === ',' || char === '[') {
6668
- return i;
6669
- }
6670
- }
6671
-
6672
- return -1;
6673
- }
6674
-
6675
- function _maybeFixIncompleteObjValue(json) {
6676
- const startPos = json.lastIndexOf(':');
6677
-
6678
- const part = json.slice(startPos + 1);
6679
-
6680
- if (ALLOWED_PRIMITIVES.includes(part.trim())) {
6681
- return `${json},"~~":"~~"`;
6682
- }
6683
-
6684
- // Everything else is replaced with `"~~"`
6685
- // This also means we do not have incomplete numbers, e.g `[1` is replaced with `["~~"]`
6686
- return `${json.slice(0, startPos + 1)}"~~"`;
6687
- }
6688
-
6689
- /**
6690
- * Evaluate an (incomplete) JSON string.
6691
- */
6692
- function evaluateJson(json) {
6693
- const stack = [];
6694
-
6695
- for (let pos = 0; pos < json.length; pos++) {
6696
- _evaluateJsonPos(stack, json, pos);
6697
- }
6698
-
6699
- return stack;
6700
- }
6701
-
6702
- function _evaluateJsonPos(stack, json, pos) {
6703
- const curStep = stack[stack.length - 1];
6704
-
6705
- const char = json[pos];
6706
-
6707
- const whitespaceRegex = /\s/;
6708
-
6709
- if (whitespaceRegex.test(char)) {
6710
- return;
6711
- }
6712
-
6713
- if (char === '"' && !_isEscaped(json, pos)) {
6714
- _handleQuote(stack, curStep);
6715
- return;
6716
- }
6717
-
6718
- switch (char) {
6719
- case '{':
6720
- _handleObj(stack, curStep);
6721
- break;
6722
- case '[':
6723
- _handleArr(stack, curStep);
6724
- break;
6725
- case ':':
6726
- _handleColon(stack, curStep);
6727
- break;
6728
- case ',':
6729
- _handleComma(stack, curStep);
6730
- break;
6731
- case '}':
6732
- _handleObjClose(stack, curStep);
6733
- break;
6734
- case ']':
6735
- _handleArrClose(stack, curStep);
6736
- break;
6737
- }
6738
- }
6739
-
6740
- function _handleQuote(stack, curStep) {
6741
- // End of obj value
6742
- if (curStep === OBJ_VAL_STR) {
6743
- stack.pop();
6744
- stack.push(OBJ_VAL_COMPLETED);
6745
- return;
6746
- }
6747
-
6748
- // End of arr value
6749
- if (curStep === ARR_VAL_STR) {
6750
- stack.pop();
6751
- stack.push(ARR_VAL_COMPLETED);
6752
- return;
6753
- }
6754
-
6755
- // Start of obj value
6756
- if (curStep === OBJ_VAL) {
6757
- stack.push(OBJ_VAL_STR);
6758
- return;
6759
- }
6760
-
6761
- // Start of arr value
6762
- if (curStep === ARR_VAL) {
6763
- stack.push(ARR_VAL_STR);
6764
- return;
6765
- }
6766
-
6767
- // Start of obj key
6768
- if (curStep === OBJ) {
6769
- stack.push(OBJ_KEY_STR);
6770
- return;
6771
- }
6772
-
6773
- // End of obj key
6774
- if (curStep === OBJ_KEY_STR) {
6775
- stack.pop();
6776
- stack.push(OBJ_KEY);
6777
- return;
6778
- }
6779
- }
6780
-
6781
- function _handleObj(stack, curStep) {
6782
- // Initial object
6783
- if (!curStep) {
6784
- stack.push(OBJ);
6785
- return;
6786
- }
6787
-
6788
- // New object as obj value
6789
- if (curStep === OBJ_VAL) {
6790
- stack.push(OBJ);
6791
- return;
6792
- }
6793
-
6794
- // New object as array element
6795
- if (curStep === ARR_VAL) {
6796
- stack.push(OBJ);
6797
- }
6798
-
6799
- // New object as first array element
6800
- if (curStep === ARR) {
6801
- stack.push(OBJ);
6802
- return;
6803
- }
6804
- }
6805
-
6806
- function _handleArr(stack, curStep) {
6807
- // Initial array
6808
- if (!curStep) {
6809
- stack.push(ARR);
6810
- stack.push(ARR_VAL);
6811
- return;
6812
- }
6813
-
6814
- // New array as obj value
6815
- if (curStep === OBJ_VAL) {
6816
- stack.push(ARR);
6817
- stack.push(ARR_VAL);
6818
- return;
6819
- }
6820
-
6821
- // New array as array element
6822
- if (curStep === ARR_VAL) {
6823
- stack.push(ARR);
6824
- stack.push(ARR_VAL);
6825
- }
6826
-
6827
- // New array as first array element
6828
- if (curStep === ARR) {
6829
- stack.push(ARR);
6830
- stack.push(ARR_VAL);
6831
- return;
6832
- }
6833
- }
6834
-
6835
- function _handleColon(stack, curStep) {
6836
- if (curStep === OBJ_KEY) {
6837
- stack.pop();
6838
- stack.push(OBJ_VAL);
6839
- }
6840
- }
6841
-
6842
- function _handleComma(stack, curStep) {
6843
- // Comma after obj value
6844
- if (curStep === OBJ_VAL) {
6845
- stack.pop();
6846
- return;
6847
- }
6848
- if (curStep === OBJ_VAL_COMPLETED) {
6849
- // Pop OBJ_VAL_COMPLETED & OBJ_VAL
6850
- stack.pop();
6851
- stack.pop();
6852
- return;
6853
- }
6854
-
6855
- // Comma after arr value
6856
- if (curStep === ARR_VAL) {
6857
- // do nothing - basically we'd pop ARR_VAL but add it right back
6858
- return;
6859
- }
6860
-
6861
- if (curStep === ARR_VAL_COMPLETED) {
6862
- // Pop ARR_VAL_COMPLETED
6863
- stack.pop();
6864
-
6865
- // basically we'd pop ARR_VAL but add it right back
6866
- return;
6867
- }
6868
- }
6869
-
6870
- function _handleObjClose(stack, curStep) {
6871
- // Empty object {}
6872
- if (curStep === OBJ) {
6873
- stack.pop();
6874
- }
6875
-
6876
- // Object with element
6877
- if (curStep === OBJ_VAL) {
6878
- // Pop OBJ_VAL, OBJ
6879
- stack.pop();
6880
- stack.pop();
6881
- }
6882
-
6883
- // Obj with element
6884
- if (curStep === OBJ_VAL_COMPLETED) {
6885
- // Pop OBJ_VAL_COMPLETED, OBJ_VAL, OBJ
6886
- stack.pop();
6887
- stack.pop();
6888
- stack.pop();
6889
- }
6890
-
6891
- // if was obj value, complete it
6892
- if (stack[stack.length - 1] === OBJ_VAL) {
6893
- stack.push(OBJ_VAL_COMPLETED);
6894
- }
6895
-
6896
- // if was arr value, complete it
6897
- if (stack[stack.length - 1] === ARR_VAL) {
6898
- stack.push(ARR_VAL_COMPLETED);
6899
- }
6900
- }
6901
-
6902
- function _handleArrClose(stack, curStep) {
6903
- // Empty array []
6904
- if (curStep === ARR) {
6905
- stack.pop();
6906
- }
6907
-
6908
- // Array with element
6909
- if (curStep === ARR_VAL) {
6910
- // Pop ARR_VAL, ARR
6911
- stack.pop();
6912
- stack.pop();
6913
- }
6914
-
6915
- // Array with element
6916
- if (curStep === ARR_VAL_COMPLETED) {
6917
- // Pop ARR_VAL_COMPLETED, ARR_VAL, ARR
6918
- stack.pop();
6919
- stack.pop();
6920
- stack.pop();
6921
- }
6922
-
6923
- // if was obj value, complete it
6924
- if (stack[stack.length - 1] === OBJ_VAL) {
6925
- stack.push(OBJ_VAL_COMPLETED);
6926
- }
6927
-
6928
- // if was arr value, complete it
6929
- if (stack[stack.length - 1] === ARR_VAL) {
6930
- stack.push(ARR_VAL_COMPLETED);
6931
- }
6932
- }
6933
-
6934
- function _isEscaped(str, pos) {
6935
- const previousChar = str[pos - 1];
6936
-
6937
- return previousChar === '\\' && !_isEscaped(str, pos - 1);
6938
- }
6939
-
6940
- /* eslint-disable max-lines */
6941
-
6942
- /**
6943
- * Takes an incomplete JSON string, and returns a hopefully valid JSON string.
6944
- * Note that this _can_ fail, so you should check the return value is valid JSON.
6945
- */
6946
- function fixJson(incompleteJson) {
6947
- const stack = evaluateJson(incompleteJson);
6948
-
6949
- return completeJson(incompleteJson, stack);
6950
- }
6951
-
6952
5928
  /** Get the size of a body. */
6953
5929
  function getBodySize(
6954
5930
  body,
@@ -7083,7 +6059,7 @@ function buildNetworkRequestOrResponse(
7083
6059
 
7084
6060
  const { body: normalizedBody, warnings } = normalizeNetworkBody(body);
7085
6061
  info.body = normalizedBody;
7086
- if (warnings.length > 0) {
6062
+ if (warnings && warnings.length > 0) {
7087
6063
  info._meta = {
7088
6064
  warnings,
7089
6065
  };
@@ -7117,31 +6093,42 @@ function normalizeNetworkBody(body)
7117
6093
  if (!body || typeof body !== 'string') {
7118
6094
  return {
7119
6095
  body,
7120
- warnings: [],
7121
6096
  };
7122
6097
  }
7123
6098
 
7124
6099
  const exceedsSizeLimit = body.length > NETWORK_BODY_MAX_SIZE;
7125
6100
 
7126
- if (_strIsProbablyJson(body)) {
7127
- try {
7128
- const json = exceedsSizeLimit ? fixJson(body.slice(0, NETWORK_BODY_MAX_SIZE)) : body;
7129
- const normalizedBody = JSON.parse(json);
6101
+ const isProbablyJson = _strIsProbablyJson(body);
6102
+
6103
+ if (exceedsSizeLimit) {
6104
+ const truncatedBody = body.slice(0, NETWORK_BODY_MAX_SIZE);
6105
+
6106
+ if (isProbablyJson) {
7130
6107
  return {
7131
- body: normalizedBody,
7132
- warnings: exceedsSizeLimit ? ['JSON_TRUNCATED'] : [],
6108
+ body: truncatedBody,
6109
+ warnings: ['MAYBE_JSON_TRUNCATED'],
7133
6110
  };
7134
- } catch (e3) {
6111
+ }
6112
+
6113
+ return {
6114
+ body: `${truncatedBody}…`,
6115
+ warnings: ['TEXT_TRUNCATED'],
6116
+ };
6117
+ }
6118
+
6119
+ if (isProbablyJson) {
6120
+ try {
6121
+ const jsonBody = JSON.parse(body);
7135
6122
  return {
7136
- body: exceedsSizeLimit ? `${body.slice(0, NETWORK_BODY_MAX_SIZE)}…` : body,
7137
- warnings: exceedsSizeLimit ? ['INVALID_JSON', 'TEXT_TRUNCATED'] : ['INVALID_JSON'],
6123
+ body: jsonBody,
7138
6124
  };
6125
+ } catch (e3) {
6126
+ // fall back to just send the body as string
7139
6127
  }
7140
6128
  }
7141
6129
 
7142
6130
  return {
7143
- body: exceedsSizeLimit ? `${body.slice(0, NETWORK_BODY_MAX_SIZE)}…` : body,
7144
- warnings: exceedsSizeLimit ? ['TEXT_TRUNCATED'] : [],
6131
+ body,
7145
6132
  };
7146
6133
  }
7147
6134
 
@@ -7694,11 +6681,9 @@ function normalizeConsoleBreadcrumb(
7694
6681
  const normalizedArg = normalize(arg, 7);
7695
6682
  const stringified = JSON.stringify(normalizedArg);
7696
6683
  if (stringified.length > CONSOLE_ARG_MAX_SIZE) {
7697
- const fixedJson = fixJson(stringified.slice(0, CONSOLE_ARG_MAX_SIZE));
7698
- const json = JSON.parse(fixedJson);
7699
- // We only set this after JSON.parse() was successfull, so we know we didn't run into `catch`
7700
6684
  isTruncated = true;
7701
- return json;
6685
+ // We use the pretty printed JSON string here as a base
6686
+ return `${JSON.stringify(normalizedArg, null, 2).slice(0, CONSOLE_ARG_MAX_SIZE)}…`;
7702
6687
  }
7703
6688
  return normalizedArg;
7704
6689
  } catch (e) {
@@ -7896,6 +6881,10 @@ function getHandleRecordingEmit(replay) {
7896
6881
  const isCheckout = _isCheckout || !hadFirstEvent;
7897
6882
  hadFirstEvent = true;
7898
6883
 
6884
+ if (replay.clickDetector) {
6885
+ updateClickDetectorForRecordingEvent(replay.clickDetector, event);
6886
+ }
6887
+
7899
6888
  // The handler returns `true` if we do not want to trigger debounced flush, `false` if we want to debounce flush.
7900
6889
  replay.addUpdate(() => {
7901
6890
  // The session is always started immediately on pageload/init, but for
@@ -8241,6 +7230,11 @@ async function sendReplayRequest({
8241
7230
  throw new TransportStatusCodeError(response.statusCode);
8242
7231
  }
8243
7232
 
7233
+ const rateLimits = updateRateLimits({}, response);
7234
+ if (isRateLimited(rateLimits, 'replay')) {
7235
+ throw new RateLimitError(rateLimits);
7236
+ }
7237
+
8244
7238
  return response;
8245
7239
  }
8246
7240
 
@@ -8253,6 +7247,17 @@ class TransportStatusCodeError extends Error {
8253
7247
  }
8254
7248
  }
8255
7249
 
7250
+ /**
7251
+ * This error indicates that we hit a rate limit API error.
7252
+ */
7253
+ class RateLimitError extends Error {
7254
+
7255
+ constructor(rateLimits) {
7256
+ super('Rate limit hit');
7257
+ this.rateLimits = rateLimits;
7258
+ }
7259
+ }
7260
+
8256
7261
  /**
8257
7262
  * Finalize and send the current replay event to Sentry
8258
7263
  */
@@ -8274,7 +7279,7 @@ async function sendReplay(
8274
7279
  await sendReplayRequest(replayData);
8275
7280
  return true;
8276
7281
  } catch (err) {
8277
- if (err instanceof TransportStatusCodeError) {
7282
+ if (err instanceof TransportStatusCodeError || err instanceof RateLimitError) {
8278
7283
  throw err;
8279
7284
  }
8280
7285
 
@@ -9708,6 +8713,7 @@ class Replay {
9708
8713
  maskFn,
9709
8714
 
9710
8715
  beforeAddRecordingEvent,
8716
+ beforeErrorSampling,
9711
8717
 
9712
8718
  // eslint-disable-next-line deprecation/deprecation
9713
8719
  blockClass,
@@ -9796,6 +8802,7 @@ class Replay {
9796
8802
  networkRequestHeaders: _getMergedNetworkHeaders(networkRequestHeaders),
9797
8803
  networkResponseHeaders: _getMergedNetworkHeaders(networkResponseHeaders),
9798
8804
  beforeAddRecordingEvent,
8805
+ beforeErrorSampling,
9799
8806
 
9800
8807
  _experiments,
9801
8808
  };