@cloudcare/browser-rum 3.3.16 → 3.3.17

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 (28) hide show
  1. package/bundle/dataflux-rum.js +1 -1
  2. package/cjs/boot/buildEnv.js +1 -1
  3. package/cjs/domain/deflate/deflateWorker.js +1 -1
  4. package/cjs/domain/replay/record/canvasEncodeWorker.js +1 -1
  5. package/cjs/domain/replay/record/record.js +18 -10
  6. package/cjs/domain/replay/record/record.js.map +1 -1
  7. package/cjs/domain/replay/record/serialize.js +5 -8
  8. package/cjs/domain/replay/record/serialize.js.map +1 -1
  9. package/cjs/domain/replay/segmentCollection/segment.js +14 -10
  10. package/cjs/domain/replay/segmentCollection/segment.js.map +1 -1
  11. package/cjs/domain/replay/segmentCollection/segmentCollection.js +9 -8
  12. package/cjs/domain/replay/segmentCollection/segmentCollection.js.map +1 -1
  13. package/esm/boot/buildEnv.js +1 -1
  14. package/esm/domain/deflate/deflateWorker.js +1 -1
  15. package/esm/domain/replay/record/canvasEncodeWorker.js +1 -1
  16. package/esm/domain/replay/record/record.js +19 -11
  17. package/esm/domain/replay/record/record.js.map +1 -1
  18. package/esm/domain/replay/record/serialize.js +4 -7
  19. package/esm/domain/replay/record/serialize.js.map +1 -1
  20. package/esm/domain/replay/segmentCollection/segment.js +14 -10
  21. package/esm/domain/replay/segmentCollection/segment.js.map +1 -1
  22. package/esm/domain/replay/segmentCollection/segmentCollection.js +9 -8
  23. package/esm/domain/replay/segmentCollection/segmentCollection.js.map +1 -1
  24. package/package.json +4 -4
  25. package/src/domain/replay/record/record.js +21 -18
  26. package/src/domain/replay/record/serialize.js +4 -14
  27. package/src/domain/replay/segmentCollection/segment.js +16 -9
  28. package/src/domain/replay/segmentCollection/segmentCollection.js +18 -14
@@ -5,7 +5,7 @@ export function createDeflateWorker(configuration) {
5
5
  if (configuration.workerUrl) {
6
6
  return new Worker(configuration.workerUrl);
7
7
  }
8
- var objectUrl = URL.createObjectURL(new Blob(["!function(){\"use strict\";function r(r){for(var t=r.reduce((function(r,t){return r+t.length}),0),n=new Uint8Array(t),i=0,e=0,f=r;e<f.length;e++){var o=f[e];n.set(o,i),i+=o.length}return n}function t(r){for(var t=r.length;--t>=0;)r[t]=0}var n=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]),i=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]),e=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),f=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),o=new Array(576);t(o);var s=new Array(60);t(s);var u=new Array(512);t(u);var h=new Array(256);t(h);var a=new Array(29);t(a);var c,w,v,l=new Array(30);function y(r,t,n,i,e){this.t=r,this.i=t,this.o=n,this.u=i,this.h=e,this.v=r&&r.length}function A(r,t){this.l=r,this.A=0,this.U=t}t(l);var d=function(r){return r<256?u[r]:u[256+(r>>>7)]},U=function(r,t){r.m[r.p++]=255&t,r.m[r.p++]=t>>>8&255},b=function(r,t,n){r.k>16-n?(r.I|=t<<r.k&65535,U(r,r.I),r.I=t>>16-r.k,r.k+=n-16):(r.I|=t<<r.k&65535,r.k+=n)},m=function(r,t,n){b(r,n[2*t],n[2*t+1])},p=function(r,t){var n=0;do{n|=1&r,r>>>=1,n<<=1}while(--t>0);return n>>>1},k=function(r,t,n){var i,e,f=new Array(16),o=0;for(i=1;i<=15;i++)f[i]=o=o+n[i-1]<<1;for(e=0;e<=t;e++){var s=r[2*e+1];0!==s&&(r[2*e]=p(f[s]++,s))}},E=function(r){var t;for(t=0;t<286;t++)r.T[2*t]=0;for(t=0;t<30;t++)r.j[2*t]=0;for(t=0;t<19;t++)r.B[2*t]=0;r.T[512]=1,r.S=r.C=0,r.M=r.O=0},I=function(r){r.k>8?U(r,r.I):r.k>0&&(r.m[r.p++]=r.I),r.I=0,r.k=0},x=function(r,t,n,i){var e=2*t,f=2*n;return r[e]<r[f]||r[e]===r[f]&&i[t]<=i[n]},T=function(r,t,n){for(var i=r.q[n],e=n<<1;e<=r.D&&(e<r.D&&x(t,r.q[e+1],r.q[e],r.F)&&e++,!x(t,i,r.q[e],r.F));)r.q[n]=r.q[e],n=e,e<<=1;r.q[n]=i},g=function(r,t,e){var f,o,s,u,c=0;if(0!==r.M)do{f=r.m[r.G+2*c]<<8|r.m[r.G+2*c+1],o=r.m[r.H+c],c++,0===f?m(r,o,t):(s=h[o],m(r,s+256+1,t),0!==(u=n[s])&&(o-=a[s],b(r,o,u)),f--,s=d(f),m(r,s,e),0!==(u=i[s])&&(f-=l[s],b(r,f,u)))}while(c<r.M);m(r,256,t)},j=function(r,t){var n,i,e,f=t.l,o=t.U.t,s=t.U.v,u=t.U.u,h=-1;for(r.D=0,r.J=573,n=0;n<u;n++)0!==f[2*n]?(r.q[++r.D]=h=n,r.F[n]=0):f[2*n+1]=0;for(;r.D<2;)f[2*(e=r.q[++r.D]=h<2?++h:0)]=1,r.F[e]=0,r.S--,s&&(r.C-=o[2*e+1]);for(t.A=h,n=r.D>>1;n>=1;n--)T(r,f,n);e=u;do{n=r.q[1],r.q[1]=r.q[r.D--],T(r,f,1),i=r.q[1],r.q[--r.J]=n,r.q[--r.J]=i,f[2*e]=f[2*n]+f[2*i],r.F[e]=(r.F[n]>=r.F[i]?r.F[n]:r.F[i])+1,f[2*n+1]=f[2*i+1]=e,r.q[1]=e++,T(r,f,1)}while(r.D>=2);r.q[--r.J]=r.q[1],function(r,t){var n,i,e,f,o,s,u=t.l,h=t.A,a=t.U.t,c=t.U.v,w=t.U.i,v=t.U.o,l=t.U.h,y=0;for(f=0;f<=15;f++)r.K[f]=0;for(u[2*r.q[r.J]+1]=0,n=r.J+1;n<573;n++)(f=u[2*u[2*(i=r.q[n])+1]+1]+1)>l&&(f=l,y++),u[2*i+1]=f,i>h||(r.K[f]++,o=0,i>=v&&(o=w[i-v]),s=u[2*i],r.S+=s*(f+o),c&&(r.C+=s*(a[2*i+1]+o)));if(0!==y){do{for(f=l-1;0===r.K[f];)f--;r.K[f]--,r.K[f+1]+=2,r.K[l]--,y-=2}while(y>0);for(f=l;0!==f;f--)for(i=r.K[f];0!==i;)(e=r.q[--n])>h||(u[2*e+1]!==f&&(r.S+=(f-u[2*e+1])*u[2*e],u[2*e+1]=f),i--)}}(r,t),k(f,h,r.K)},z=function(r,t,n){var i,e,f=-1,o=t[1],s=0,u=7,h=4;for(0===o&&(u=138,h=3),t[2*(n+1)+1]=65535,i=0;i<=n;i++)e=o,o=t[2*(i+1)+1],++s<u&&e===o||(s<h?r.B[2*e]+=s:0!==e?(e!==f&&r.B[2*e]++,r.B[32]++):s<=10?r.B[34]++:r.B[36]++,s=0,f=e,0===o?(u=138,h=3):e===o?(u=6,h=3):(u=7,h=4))},B=function(r,t,n){var i,e,f=-1,o=t[1],s=0,u=7,h=4;for(0===o&&(u=138,h=3),i=0;i<=n;i++)if(e=o,o=t[2*(i+1)+1],!(++s<u&&e===o)){if(s<h)do{m(r,e,r.B)}while(0!=--s);else 0!==e?(e!==f&&(m(r,e,r.B),s--),m(r,16,r.B),b(r,s-3,2)):s<=10?(m(r,17,r.B),b(r,s-3,3)):(m(r,18,r.B),b(r,s-11,7));s=0,f=e,0===o?(u=138,h=3):e===o?(u=6,h=3):(u=7,h=4)}},S=!1,C=function(r,t,n,i){b(r,0+(i?1:0),3),function(r,t,n){I(r),U(r,n),U(r,~n),r.m.set(r.L.subarray(t,t+n),r.p),r.p+=n}(r,t,n)},M=C,O=(new Uint32Array(function(){for(var r,t=[],n=0;n<256;n++){r=n;for(var i=0;i<8;i++)r=1&r?3988292384^r>>>1:r>>>1;t[n]=r}return t}()),{0:\"\",\"-2\":\"stream error\",\"-3\":\"data error\",\"-5\":\"buffer error\"}),q=function(r){S||(function(){var r,t,f,A,d,U=new Array(16);for(f=0,A=0;A<28;A++)for(a[A]=f,r=0;r<1<<n[A];r++)h[f++]=A;for(h[f-1]=A,d=0,A=0;A<16;A++)for(l[A]=d,r=0;r<1<<i[A];r++)u[d++]=A;for(d>>=7;A<30;A++)for(l[A]=d<<7,r=0;r<1<<i[A]-7;r++)u[256+d++]=A;for(t=0;t<=15;t++)U[t]=0;for(r=0;r<=143;)o[2*r+1]=8,r++,U[8]++;for(;r<=255;)o[2*r+1]=9,r++,U[9]++;for(;r<=279;)o[2*r+1]=7,r++,U[7]++;for(;r<=287;)o[2*r+1]=8,r++,U[8]++;for(k(o,287,U),r=0;r<30;r++)s[2*r+1]=5,s[2*r]=p(r,5);c=new y(o,n,257,286,15),w=new y(s,i,0,30,15),v=new y(new Array(0),e,0,19,7)}(),S=!0),r.N=new A(r.T,c),r.P=new A(r.j,w),r.R=new A(r.B,v),r.I=0,r.k=0,E(r)},D=M,F=function(r,t,n,i){var e,u,h=0;r.V>0?(2===r.X.W&&(r.X.W=function(r){var t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==r.T[2*t])return 0;if(0!==r.T[18]||0!==r.T[20]||0!==r.T[26])return 1;for(t=32;t<256;t++)if(0!==r.T[2*t])return 1;return 0}(r)),j(r,r.N),j(r,r.P),h=function(r){var t;for(z(r,r.T,r.N.A),z(r,r.j,r.P.A),j(r,r.R),t=18;t>=3&&0===r.B[2*f[t]+1];t--);return r.S+=3*(t+1)+5+5+4,t}(r),e=r.S+3+7>>>3,(u=r.C+3+7>>>3)<=e&&(e=u)):e=u=n+5,n+4<=e&&-1!==t?C(r,t,n,i):4===r.Y||u===e?(b(r,2+(i?1:0),3),g(r,o,s)):(b(r,4+(i?1:0),3),function(r,t,n,i){var e;for(b(r,t-257,5),b(r,n-1,5),b(r,i-4,4),e=0;e<i;e++)b(r,r.B[2*f[e]+1],3);B(r,r.T,t-1),B(r,r.j,n-1)}(r,r.N.A+1,r.P.A+1,h+1),g(r,r.T,r.j)),E(r),i&&I(r)},G=function(r,t,n){return r.m[r.G+2*r.M]=t>>>8&255,r.m[r.G+2*r.M+1]=255&t,r.m[r.H+r.M]=255&n,r.M++,0===t?r.T[2*n]++:(r.O++,t--,r.T[2*(h[n]+256+1)]++,r.j[2*d(t)]++),r.M===r.Z-1},H=function(r){b(r,2,3),m(r,256,o),function(r){16===r.k?(U(r,r.I),r.I=0,r.k=0):r.k>=8&&(r.m[r.p++]=255&r.I,r.I>>=8,r.k-=8)}(r)},J=-2,K=262,L=666,N=function(r,t){return r.$=O[t],t},P=function(r){return(r<<1)-(r>4?9:0)},Q=function(r){for(var t=r.length;--t>=0;)r[t]=0},R=function(r,t,n){return(t<<r._^n)&r.rr},V=function(r){var t=r.tr,n=t.p;n>r.nr&&(n=r.nr),0!==n&&(r.ir.set(t.m.subarray(t.er,t.er+n),r.sr),r.sr+=n,t.er+=n,r.ur+=n,r.nr-=n,t.p-=n,0===t.p&&(t.er=0))},W=function(r,t){F(r,r.hr>=0?r.hr:-1,r.ar-r.hr,t),r.hr=r.ar,V(r.X)},X=function(r,t){r.m[r.p++]=t>>>8&255,r.m[r.p++]=255&t},Y=function(r,t,n,i){var e=r.cr;return e>i&&(e=i),0===e?0:(r.cr-=e,t.set(r.wr.subarray(r.vr,r.vr+e),n),r.lr=function(r,t,n,i){for(var e=65535&r,f=r>>>16&65535,o=0;0!==n;){n-=o=n>2e3?2e3:n;do{f=f+(e=e+t[i++]|0)|0}while(--o);e%=65521,f%=65521}return e|f<<16}(r.lr,t,e,n),r.vr+=e,r.yr+=e,e)},Z=function(r,t){var n,i,e=r.Ar,f=r.ar,o=r.dr,s=r.Ur,u=r.ar>r.br-K?r.ar-(r.br-K):0,h=r.L,a=r.mr,c=r.pr,w=r.ar+258,v=h[f+o-1],l=h[f+o];r.dr>=r.kr&&(e>>=2),s>r.Er&&(s=r.Er);do{if(h[(n=t)+o]===l&&h[n+o-1]===v&&h[n]===h[f]&&h[++n]===h[f+1]){f+=2,n++;do{}while(h[++f]===h[++n]&&h[++f]===h[++n]&&h[++f]===h[++n]&&h[++f]===h[++n]&&h[++f]===h[++n]&&h[++f]===h[++n]&&h[++f]===h[++n]&&h[++f]===h[++n]&&f<w);if(i=258-(w-f),f=w-258,i>o){if(r.Ir=t,o=i,i>=s)break;v=h[f+o-1],l=h[f+o]}}}while((t=c[t&a])>u&&0!=--e);return o<=r.Er?o:r.Er},$=function(r){var t,n,i,e,f,o=r.br;do{if(e=r.Tr-r.Er-r.ar,r.ar>=o+(o-K)){r.L.set(r.L.subarray(o,o+o),0),r.Ir-=o,r.ar-=o,r.hr-=o,t=n=r.gr;do{i=r.jr[--t],r.jr[t]=i>=o?i-o:0}while(--n);t=n=o;do{i=r.pr[--t],r.pr[t]=i>=o?i-o:0}while(--n);e+=o}if(0===r.X.cr)break;if(n=Y(r.X,r.L,r.ar+r.Er,e),r.Er+=n,r.Er+r.zr>=3)for(f=r.ar-r.zr,r.Br=r.L[f],r.Br=R(r,r.Br,r.L[f+1]);r.zr&&(r.Br=R(r,r.Br,r.L[f+3-1]),r.pr[f&r.mr]=r.jr[r.Br],r.jr[r.Br]=f,f++,r.zr--,!(r.Er+r.zr<3)););}while(r.Er<K&&0!==r.X.cr)};function _(){this.X=null,this.Sr=0,this.m=null,this.Cr=0,this.er=0,this.p=0,this.Mr=0,this.Or=-1,this.br=0,this.mr=0,this.L=null,this.Tr=0,this.pr=null,this.jr=null,this.Br=0,this.gr=0,this.rr=0,this._=0,this.hr=0,this.qr=0,this.Dr=0,this.Fr=0,this.ar=0,this.Ir=0,this.Er=0,this.dr=0,this.Ar=0,this.Gr=0,this.V=0,this.Y=0,this.kr=0,this.Ur=0,this.T=new Uint16Array(1146),this.j=new Uint16Array(122),this.B=new Uint16Array(78),Q(this.T),Q(this.j),Q(this.B),this.N=null,this.P=null,this.R=null,this.K=new Uint16Array(16),this.q=new Uint16Array(573),Q(this.q),this.D=0,this.J=0,this.F=new Uint16Array(573),Q(this.F),this.H=0,this.Z=0,this.M=0,this.G=0,this.S=0,this.C=0,this.O=0,this.zr=0,this.I=0,this.k=0}for(var rr=function(r,t){if(!r||!r.tr||t>5||t<0)return r?N(r,J):J;var n=r.tr;if(!r.ir||!r.wr&&0!==r.cr||n.Sr===L&&4!==t)return N(r,0===r.nr?-5:J);n.X=r;var i=n.Or;if(n.Or=t,42===n.Sr&&(n.Sr=113,X(n,30876),r.lr=1),0!==n.p){if(V(r),0===r.nr)return n.Or=-1,0}else if(0===r.cr&&P(t)<=P(i)&&4!==t)return N(r,-5);if(n.Sr===L&&0!==r.cr)return N(r,-5);if(0!==r.cr||0!==n.Er||0!==t&&n.Sr!==L){var e=function(r,t){for(var n,i,e;;){if(r.Er<K){if($(r),r.Er<K&&0===t)return 1;if(0===r.Er)break}if(n=0,r.Er>=3&&(r.Br=R(r,r.Br,r.L[r.ar+3-1]),n=r.pr[r.ar&r.mr]=r.jr[r.Br],r.jr[r.Br]=r.ar),r.dr=r.qr,r.Dr=r.Ir,r.qr=2,0!==n&&r.dr<r.Gr&&r.ar-n<=r.br-K&&(r.qr=Z(r,n),r.qr<=5&&(1===r.Y||3===r.qr&&r.ar-r.Ir>4096)&&(r.qr=2)),r.dr>=3&&r.qr<=r.dr){e=r.ar+r.Er-3,i=G(r,r.ar-1-r.Dr,r.dr-3),r.Er-=r.dr-1,r.dr-=2;do{++r.ar<=e&&(r.Br=R(r,r.Br,r.L[r.ar+3-1]),n=r.pr[r.ar&r.mr]=r.jr[r.Br],r.jr[r.Br]=r.ar)}while(0!=--r.dr);if(r.Fr=0,r.qr=2,r.ar++,i&&(W(r,!1),0===r.X.nr))return 1}else if(r.Fr){if((i=G(r,0,r.L[r.ar-1]))&&W(r,!1),r.ar++,r.Er--,0===r.X.nr)return 1}else r.Fr=1,r.ar++,r.Er--}return r.Fr&&(i=G(r,0,r.L[r.ar-1]),r.Fr=0),r.zr=r.ar<2?r.ar:2,4===t?(W(r,!0),0===r.X.nr?3:4):r.M&&(W(r,!1),0===r.X.nr)?1:2}(n,t);if(3!==e&&4!==e||(n.Sr=L),1===e||3===e)return 0===r.nr&&(n.Or=-1),0;if(2===e&&(1===t?H(n):5!==t&&(D(n,0,0,!1),3===t&&(Q(n.jr),0===n.Er&&(n.ar=0,n.hr=0,n.zr=0))),V(r),0===r.nr))return n.Or=-1,0}return 4!==t?0:(X(n,r.lr>>>16),X(n,65535&r.lr),V(r),n.Mr=-1,0!==n.p?0:1)},tr=function(r){if(!r||!r.tr)return J;var t=r.tr.Sr;return 42!==t&&113!==t&&t!==L?N(r,J):(r.tr=null,113===t?N(r,-3):0)},nr=new Uint8Array(256),ir=0;ir<256;ir++)nr[ir]=ir>=252?6:ir>=248?5:ir>=240?4:ir>=224?3:ir>=192?2:1;nr[254]=nr[254]=1;var er=function(){this.wr=null,this.vr=0,this.cr=0,this.yr=0,this.ir=null,this.sr=0,this.nr=0,this.ur=0,this.$=\"\",this.tr=null,this.W=2,this.lr=0},fr=Object.prototype.toString;function or(){this.options={Hr:16384},this.err=0,this.$=\"\",this.ended=!1,this.Jr=[],this.X=new er,this.X.nr=0;var r=function(r){if(!r)return J;var t=new _;return r.tr=t,t.X=r,t.Mr=1,t.br=32768,t.mr=32767,t.gr=32768,t.rr=32767,t._=5,t.L=new Uint8Array(2*t.br),t.jr=new Uint16Array(t.gr),t.pr=new Uint16Array(t.br),t.Z=16384,t.Cr=4*t.Z,t.m=new Uint8Array(t.Cr),t.G=1*t.Z,t.H=3*t.Z,t.V=6,t.Y=0,function(r){var t=function(r){if(!r||!r.tr)return N(r,J);r.yr=r.ur=0,r.W=2;var t=r.tr;return t.p=0,t.er=0,t.Mr=1,t.Sr=42,r.lr=1,t.Or=0,q(t),0}(r);return 0===t&&function(r){r.Tr=2*r.br,Q(r.jr),r.Gr=16,r.kr=8,r.Ur=128,r.Ar=128,r.ar=0,r.hr=0,r.Er=0,r.zr=0,r.qr=r.dr=2,r.Fr=0,r.Br=0}(r.tr),t}(r)}(this.X);if(0!==r)throw new Error(O[r])}function sr(r,t,n){try{r.postMessage({type:\"errored\",error:t,streamId:n})}catch(i){r.postMessage({type:\"errored\",error:String(t),streamId:n})}}function ur(r){var t=r.X.lr;return new Uint8Array([3,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])}or.prototype.push=function(r,t){var n,i,e=this.X,f=this.options.Hr;if(this.ended)return!1;for(i=t===~~t?t:!0===t?4:0,\"[object ArrayBuffer]\"===fr.call(r)?e.wr=new Uint8Array(r):e.wr=r,e.vr=0,e.cr=e.wr.length;;)if(0===e.nr&&(e.ir=new Uint8Array(f),e.sr=0,e.nr=f),(2===i||3===i)&&e.nr<=6)this.Kr(e.ir.subarray(0,e.sr)),e.nr=0;else{if(1===(n=rr(e,i)))return e.sr>0&&this.Kr(e.ir.subarray(0,e.sr)),n=tr(this.X),this.Lr(n),this.ended=!0,0===n;if(0!==e.nr){if(i>0&&e.sr>0)this.Kr(e.ir.subarray(0,e.sr)),e.nr=0;else if(0===e.cr)break}else this.Kr(e.ir)}return!0},or.prototype.Kr=function(r){this.Jr.push(r)},or.prototype.Lr=function(r){0===r&&(this.result=function(r){for(var t=0,n=0,i=r.length;n<i;n++)t+=r[n].length;for(var e=new Uint8Array(t),f=0,o=0,s=r.length;f<s;f++){var u=r[f];e.set(u,o),o+=u.length}return e}(this.Jr)),this.Jr=[],this.err=r,this.$=this.X.$},function(t){void 0===t&&(t=self);try{var n=new Map;t.addEventListener(\"message\",(function(i){try{var e=function(t,n){switch(n.action){case\"init\":return{type:\"initialized\",version:\"3.3.16\"};case\"write\":var i=t.get(n.streamId);i||(i=new or,t.set(n.streamId,i));var e=i.Jr.length,f=function(r){if(\"function\"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(r);var t,n,i,e,f,o=r.length,s=0;for(e=0;e<o;e++)55296==(64512&(n=r.charCodeAt(e)))&&e+1<o&&56320==(64512&(i=r.charCodeAt(e+1)))&&(n=65536+(n-55296<<10)+(i-56320),e++),s+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Uint8Array(s),f=0,e=0;f<s;e++)55296==(64512&(n=r.charCodeAt(e)))&&e+1<o&&56320==(64512&(i=r.charCodeAt(e+1)))&&(n=65536+(n-55296<<10)+(i-56320),e++),n<128?t[f++]=n:n<2048?(t[f++]=192|n>>>6,t[f++]=128|63&n):n<65536?(t[f++]=224|n>>>12,t[f++]=128|n>>>6&63,t[f++]=128|63&n):(t[f++]=240|n>>>18,t[f++]=128|n>>>12&63,t[f++]=128|n>>>6&63,t[f++]=128|63&n);return t}(n.data);return i.push(f,2),{type:\"wrote\",id:n.id,streamId:n.streamId,result:r(i.Jr.slice(e)),trailer:ur(i),additionalBytesCount:f.length};case\"reset\":t.delete(n.streamId)}}(n,i.data);e&&t.postMessage(e)}catch(r){sr(t,r,i.data&&\"streamId\"in i.data?i.data.streamId:void 0)}}))}catch(r){sr(t,r)}}()}();"]));
8
+ var objectUrl = URL.createObjectURL(new Blob(["!function(){\"use strict\";function r(r){for(var t=r.reduce((function(r,t){return r+t.length}),0),n=new Uint8Array(t),i=0,e=0,f=r;e<f.length;e++){var o=f[e];n.set(o,i),i+=o.length}return n}function t(r){for(var t=r.length;--t>=0;)r[t]=0}var n=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]),i=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]),e=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),f=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),o=new Array(576);t(o);var s=new Array(60);t(s);var u=new Array(512);t(u);var h=new Array(256);t(h);var a=new Array(29);t(a);var c,w,v,l=new Array(30);function y(r,t,n,i,e){this.t=r,this.i=t,this.o=n,this.u=i,this.h=e,this.v=r&&r.length}function A(r,t){this.l=r,this.A=0,this.U=t}t(l);var d=function(r){return r<256?u[r]:u[256+(r>>>7)]},U=function(r,t){r.m[r.p++]=255&t,r.m[r.p++]=t>>>8&255},b=function(r,t,n){r.k>16-n?(r.I|=t<<r.k&65535,U(r,r.I),r.I=t>>16-r.k,r.k+=n-16):(r.I|=t<<r.k&65535,r.k+=n)},m=function(r,t,n){b(r,n[2*t],n[2*t+1])},p=function(r,t){var n=0;do{n|=1&r,r>>>=1,n<<=1}while(--t>0);return n>>>1},k=function(r,t,n){var i,e,f=new Array(16),o=0;for(i=1;i<=15;i++)f[i]=o=o+n[i-1]<<1;for(e=0;e<=t;e++){var s=r[2*e+1];0!==s&&(r[2*e]=p(f[s]++,s))}},E=function(r){var t;for(t=0;t<286;t++)r.T[2*t]=0;for(t=0;t<30;t++)r.j[2*t]=0;for(t=0;t<19;t++)r.B[2*t]=0;r.T[512]=1,r.S=r.C=0,r.M=r.O=0},I=function(r){r.k>8?U(r,r.I):r.k>0&&(r.m[r.p++]=r.I),r.I=0,r.k=0},x=function(r,t,n,i){var e=2*t,f=2*n;return r[e]<r[f]||r[e]===r[f]&&i[t]<=i[n]},T=function(r,t,n){for(var i=r.q[n],e=n<<1;e<=r.D&&(e<r.D&&x(t,r.q[e+1],r.q[e],r.F)&&e++,!x(t,i,r.q[e],r.F));)r.q[n]=r.q[e],n=e,e<<=1;r.q[n]=i},g=function(r,t,e){var f,o,s,u,c=0;if(0!==r.M)do{f=r.m[r.G+2*c]<<8|r.m[r.G+2*c+1],o=r.m[r.H+c],c++,0===f?m(r,o,t):(s=h[o],m(r,s+256+1,t),0!==(u=n[s])&&(o-=a[s],b(r,o,u)),f--,s=d(f),m(r,s,e),0!==(u=i[s])&&(f-=l[s],b(r,f,u)))}while(c<r.M);m(r,256,t)},j=function(r,t){var n,i,e,f=t.l,o=t.U.t,s=t.U.v,u=t.U.u,h=-1;for(r.D=0,r.J=573,n=0;n<u;n++)0!==f[2*n]?(r.q[++r.D]=h=n,r.F[n]=0):f[2*n+1]=0;for(;r.D<2;)f[2*(e=r.q[++r.D]=h<2?++h:0)]=1,r.F[e]=0,r.S--,s&&(r.C-=o[2*e+1]);for(t.A=h,n=r.D>>1;n>=1;n--)T(r,f,n);e=u;do{n=r.q[1],r.q[1]=r.q[r.D--],T(r,f,1),i=r.q[1],r.q[--r.J]=n,r.q[--r.J]=i,f[2*e]=f[2*n]+f[2*i],r.F[e]=(r.F[n]>=r.F[i]?r.F[n]:r.F[i])+1,f[2*n+1]=f[2*i+1]=e,r.q[1]=e++,T(r,f,1)}while(r.D>=2);r.q[--r.J]=r.q[1],function(r,t){var n,i,e,f,o,s,u=t.l,h=t.A,a=t.U.t,c=t.U.v,w=t.U.i,v=t.U.o,l=t.U.h,y=0;for(f=0;f<=15;f++)r.K[f]=0;for(u[2*r.q[r.J]+1]=0,n=r.J+1;n<573;n++)(f=u[2*u[2*(i=r.q[n])+1]+1]+1)>l&&(f=l,y++),u[2*i+1]=f,i>h||(r.K[f]++,o=0,i>=v&&(o=w[i-v]),s=u[2*i],r.S+=s*(f+o),c&&(r.C+=s*(a[2*i+1]+o)));if(0!==y){do{for(f=l-1;0===r.K[f];)f--;r.K[f]--,r.K[f+1]+=2,r.K[l]--,y-=2}while(y>0);for(f=l;0!==f;f--)for(i=r.K[f];0!==i;)(e=r.q[--n])>h||(u[2*e+1]!==f&&(r.S+=(f-u[2*e+1])*u[2*e],u[2*e+1]=f),i--)}}(r,t),k(f,h,r.K)},z=function(r,t,n){var i,e,f=-1,o=t[1],s=0,u=7,h=4;for(0===o&&(u=138,h=3),t[2*(n+1)+1]=65535,i=0;i<=n;i++)e=o,o=t[2*(i+1)+1],++s<u&&e===o||(s<h?r.B[2*e]+=s:0!==e?(e!==f&&r.B[2*e]++,r.B[32]++):s<=10?r.B[34]++:r.B[36]++,s=0,f=e,0===o?(u=138,h=3):e===o?(u=6,h=3):(u=7,h=4))},B=function(r,t,n){var i,e,f=-1,o=t[1],s=0,u=7,h=4;for(0===o&&(u=138,h=3),i=0;i<=n;i++)if(e=o,o=t[2*(i+1)+1],!(++s<u&&e===o)){if(s<h)do{m(r,e,r.B)}while(0!=--s);else 0!==e?(e!==f&&(m(r,e,r.B),s--),m(r,16,r.B),b(r,s-3,2)):s<=10?(m(r,17,r.B),b(r,s-3,3)):(m(r,18,r.B),b(r,s-11,7));s=0,f=e,0===o?(u=138,h=3):e===o?(u=6,h=3):(u=7,h=4)}},S=!1,C=function(r,t,n,i){b(r,0+(i?1:0),3),function(r,t,n){I(r),U(r,n),U(r,~n),r.m.set(r.L.subarray(t,t+n),r.p),r.p+=n}(r,t,n)},M=C,O=(new Uint32Array(function(){for(var r,t=[],n=0;n<256;n++){r=n;for(var i=0;i<8;i++)r=1&r?3988292384^r>>>1:r>>>1;t[n]=r}return t}()),{0:\"\",\"-2\":\"stream error\",\"-3\":\"data error\",\"-5\":\"buffer error\"}),q=function(r){S||(function(){var r,t,f,A,d,U=new Array(16);for(f=0,A=0;A<28;A++)for(a[A]=f,r=0;r<1<<n[A];r++)h[f++]=A;for(h[f-1]=A,d=0,A=0;A<16;A++)for(l[A]=d,r=0;r<1<<i[A];r++)u[d++]=A;for(d>>=7;A<30;A++)for(l[A]=d<<7,r=0;r<1<<i[A]-7;r++)u[256+d++]=A;for(t=0;t<=15;t++)U[t]=0;for(r=0;r<=143;)o[2*r+1]=8,r++,U[8]++;for(;r<=255;)o[2*r+1]=9,r++,U[9]++;for(;r<=279;)o[2*r+1]=7,r++,U[7]++;for(;r<=287;)o[2*r+1]=8,r++,U[8]++;for(k(o,287,U),r=0;r<30;r++)s[2*r+1]=5,s[2*r]=p(r,5);c=new y(o,n,257,286,15),w=new y(s,i,0,30,15),v=new y(new Array(0),e,0,19,7)}(),S=!0),r.N=new A(r.T,c),r.P=new A(r.j,w),r.R=new A(r.B,v),r.I=0,r.k=0,E(r)},D=M,F=function(r,t,n,i){var e,u,h=0;r.V>0?(2===r.X.W&&(r.X.W=function(r){var t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==r.T[2*t])return 0;if(0!==r.T[18]||0!==r.T[20]||0!==r.T[26])return 1;for(t=32;t<256;t++)if(0!==r.T[2*t])return 1;return 0}(r)),j(r,r.N),j(r,r.P),h=function(r){var t;for(z(r,r.T,r.N.A),z(r,r.j,r.P.A),j(r,r.R),t=18;t>=3&&0===r.B[2*f[t]+1];t--);return r.S+=3*(t+1)+5+5+4,t}(r),e=r.S+3+7>>>3,(u=r.C+3+7>>>3)<=e&&(e=u)):e=u=n+5,n+4<=e&&-1!==t?C(r,t,n,i):4===r.Y||u===e?(b(r,2+(i?1:0),3),g(r,o,s)):(b(r,4+(i?1:0),3),function(r,t,n,i){var e;for(b(r,t-257,5),b(r,n-1,5),b(r,i-4,4),e=0;e<i;e++)b(r,r.B[2*f[e]+1],3);B(r,r.T,t-1),B(r,r.j,n-1)}(r,r.N.A+1,r.P.A+1,h+1),g(r,r.T,r.j)),E(r),i&&I(r)},G=function(r,t,n){return r.m[r.G+2*r.M]=t>>>8&255,r.m[r.G+2*r.M+1]=255&t,r.m[r.H+r.M]=255&n,r.M++,0===t?r.T[2*n]++:(r.O++,t--,r.T[2*(h[n]+256+1)]++,r.j[2*d(t)]++),r.M===r.Z-1},H=function(r){b(r,2,3),m(r,256,o),function(r){16===r.k?(U(r,r.I),r.I=0,r.k=0):r.k>=8&&(r.m[r.p++]=255&r.I,r.I>>=8,r.k-=8)}(r)},J=-2,K=262,L=666,N=function(r,t){return r.$=O[t],t},P=function(r){return(r<<1)-(r>4?9:0)},Q=function(r){for(var t=r.length;--t>=0;)r[t]=0},R=function(r,t,n){return(t<<r._^n)&r.rr},V=function(r){var t=r.tr,n=t.p;n>r.nr&&(n=r.nr),0!==n&&(r.ir.set(t.m.subarray(t.er,t.er+n),r.sr),r.sr+=n,t.er+=n,r.ur+=n,r.nr-=n,t.p-=n,0===t.p&&(t.er=0))},W=function(r,t){F(r,r.hr>=0?r.hr:-1,r.ar-r.hr,t),r.hr=r.ar,V(r.X)},X=function(r,t){r.m[r.p++]=t>>>8&255,r.m[r.p++]=255&t},Y=function(r,t,n,i){var e=r.cr;return e>i&&(e=i),0===e?0:(r.cr-=e,t.set(r.wr.subarray(r.vr,r.vr+e),n),r.lr=function(r,t,n,i){for(var e=65535&r,f=r>>>16&65535,o=0;0!==n;){n-=o=n>2e3?2e3:n;do{f=f+(e=e+t[i++]|0)|0}while(--o);e%=65521,f%=65521}return e|f<<16}(r.lr,t,e,n),r.vr+=e,r.yr+=e,e)},Z=function(r,t){var n,i,e=r.Ar,f=r.ar,o=r.dr,s=r.Ur,u=r.ar>r.br-K?r.ar-(r.br-K):0,h=r.L,a=r.mr,c=r.pr,w=r.ar+258,v=h[f+o-1],l=h[f+o];r.dr>=r.kr&&(e>>=2),s>r.Er&&(s=r.Er);do{if(h[(n=t)+o]===l&&h[n+o-1]===v&&h[n]===h[f]&&h[++n]===h[f+1]){f+=2,n++;do{}while(h[++f]===h[++n]&&h[++f]===h[++n]&&h[++f]===h[++n]&&h[++f]===h[++n]&&h[++f]===h[++n]&&h[++f]===h[++n]&&h[++f]===h[++n]&&h[++f]===h[++n]&&f<w);if(i=258-(w-f),f=w-258,i>o){if(r.Ir=t,o=i,i>=s)break;v=h[f+o-1],l=h[f+o]}}}while((t=c[t&a])>u&&0!=--e);return o<=r.Er?o:r.Er},$=function(r){var t,n,i,e,f,o=r.br;do{if(e=r.Tr-r.Er-r.ar,r.ar>=o+(o-K)){r.L.set(r.L.subarray(o,o+o),0),r.Ir-=o,r.ar-=o,r.hr-=o,t=n=r.gr;do{i=r.jr[--t],r.jr[t]=i>=o?i-o:0}while(--n);t=n=o;do{i=r.pr[--t],r.pr[t]=i>=o?i-o:0}while(--n);e+=o}if(0===r.X.cr)break;if(n=Y(r.X,r.L,r.ar+r.Er,e),r.Er+=n,r.Er+r.zr>=3)for(f=r.ar-r.zr,r.Br=r.L[f],r.Br=R(r,r.Br,r.L[f+1]);r.zr&&(r.Br=R(r,r.Br,r.L[f+3-1]),r.pr[f&r.mr]=r.jr[r.Br],r.jr[r.Br]=f,f++,r.zr--,!(r.Er+r.zr<3)););}while(r.Er<K&&0!==r.X.cr)};function _(){this.X=null,this.Sr=0,this.m=null,this.Cr=0,this.er=0,this.p=0,this.Mr=0,this.Or=-1,this.br=0,this.mr=0,this.L=null,this.Tr=0,this.pr=null,this.jr=null,this.Br=0,this.gr=0,this.rr=0,this._=0,this.hr=0,this.qr=0,this.Dr=0,this.Fr=0,this.ar=0,this.Ir=0,this.Er=0,this.dr=0,this.Ar=0,this.Gr=0,this.V=0,this.Y=0,this.kr=0,this.Ur=0,this.T=new Uint16Array(1146),this.j=new Uint16Array(122),this.B=new Uint16Array(78),Q(this.T),Q(this.j),Q(this.B),this.N=null,this.P=null,this.R=null,this.K=new Uint16Array(16),this.q=new Uint16Array(573),Q(this.q),this.D=0,this.J=0,this.F=new Uint16Array(573),Q(this.F),this.H=0,this.Z=0,this.M=0,this.G=0,this.S=0,this.C=0,this.O=0,this.zr=0,this.I=0,this.k=0}for(var rr=function(r,t){if(!r||!r.tr||t>5||t<0)return r?N(r,J):J;var n=r.tr;if(!r.ir||!r.wr&&0!==r.cr||n.Sr===L&&4!==t)return N(r,0===r.nr?-5:J);n.X=r;var i=n.Or;if(n.Or=t,42===n.Sr&&(n.Sr=113,X(n,30876),r.lr=1),0!==n.p){if(V(r),0===r.nr)return n.Or=-1,0}else if(0===r.cr&&P(t)<=P(i)&&4!==t)return N(r,-5);if(n.Sr===L&&0!==r.cr)return N(r,-5);if(0!==r.cr||0!==n.Er||0!==t&&n.Sr!==L){var e=function(r,t){for(var n,i,e;;){if(r.Er<K){if($(r),r.Er<K&&0===t)return 1;if(0===r.Er)break}if(n=0,r.Er>=3&&(r.Br=R(r,r.Br,r.L[r.ar+3-1]),n=r.pr[r.ar&r.mr]=r.jr[r.Br],r.jr[r.Br]=r.ar),r.dr=r.qr,r.Dr=r.Ir,r.qr=2,0!==n&&r.dr<r.Gr&&r.ar-n<=r.br-K&&(r.qr=Z(r,n),r.qr<=5&&(1===r.Y||3===r.qr&&r.ar-r.Ir>4096)&&(r.qr=2)),r.dr>=3&&r.qr<=r.dr){e=r.ar+r.Er-3,i=G(r,r.ar-1-r.Dr,r.dr-3),r.Er-=r.dr-1,r.dr-=2;do{++r.ar<=e&&(r.Br=R(r,r.Br,r.L[r.ar+3-1]),n=r.pr[r.ar&r.mr]=r.jr[r.Br],r.jr[r.Br]=r.ar)}while(0!=--r.dr);if(r.Fr=0,r.qr=2,r.ar++,i&&(W(r,!1),0===r.X.nr))return 1}else if(r.Fr){if((i=G(r,0,r.L[r.ar-1]))&&W(r,!1),r.ar++,r.Er--,0===r.X.nr)return 1}else r.Fr=1,r.ar++,r.Er--}return r.Fr&&(i=G(r,0,r.L[r.ar-1]),r.Fr=0),r.zr=r.ar<2?r.ar:2,4===t?(W(r,!0),0===r.X.nr?3:4):r.M&&(W(r,!1),0===r.X.nr)?1:2}(n,t);if(3!==e&&4!==e||(n.Sr=L),1===e||3===e)return 0===r.nr&&(n.Or=-1),0;if(2===e&&(1===t?H(n):5!==t&&(D(n,0,0,!1),3===t&&(Q(n.jr),0===n.Er&&(n.ar=0,n.hr=0,n.zr=0))),V(r),0===r.nr))return n.Or=-1,0}return 4!==t?0:(X(n,r.lr>>>16),X(n,65535&r.lr),V(r),n.Mr=-1,0!==n.p?0:1)},tr=function(r){if(!r||!r.tr)return J;var t=r.tr.Sr;return 42!==t&&113!==t&&t!==L?N(r,J):(r.tr=null,113===t?N(r,-3):0)},nr=new Uint8Array(256),ir=0;ir<256;ir++)nr[ir]=ir>=252?6:ir>=248?5:ir>=240?4:ir>=224?3:ir>=192?2:1;nr[254]=nr[254]=1;var er=function(){this.wr=null,this.vr=0,this.cr=0,this.yr=0,this.ir=null,this.sr=0,this.nr=0,this.ur=0,this.$=\"\",this.tr=null,this.W=2,this.lr=0},fr=Object.prototype.toString;function or(){this.options={Hr:16384},this.err=0,this.$=\"\",this.ended=!1,this.Jr=[],this.X=new er,this.X.nr=0;var r=function(r){if(!r)return J;var t=new _;return r.tr=t,t.X=r,t.Mr=1,t.br=32768,t.mr=32767,t.gr=32768,t.rr=32767,t._=5,t.L=new Uint8Array(2*t.br),t.jr=new Uint16Array(t.gr),t.pr=new Uint16Array(t.br),t.Z=16384,t.Cr=4*t.Z,t.m=new Uint8Array(t.Cr),t.G=1*t.Z,t.H=3*t.Z,t.V=6,t.Y=0,function(r){var t=function(r){if(!r||!r.tr)return N(r,J);r.yr=r.ur=0,r.W=2;var t=r.tr;return t.p=0,t.er=0,t.Mr=1,t.Sr=42,r.lr=1,t.Or=0,q(t),0}(r);return 0===t&&function(r){r.Tr=2*r.br,Q(r.jr),r.Gr=16,r.kr=8,r.Ur=128,r.Ar=128,r.ar=0,r.hr=0,r.Er=0,r.zr=0,r.qr=r.dr=2,r.Fr=0,r.Br=0}(r.tr),t}(r)}(this.X);if(0!==r)throw new Error(O[r])}function sr(r,t,n){try{r.postMessage({type:\"errored\",error:t,streamId:n})}catch(i){r.postMessage({type:\"errored\",error:String(t),streamId:n})}}function ur(r){var t=r.X.lr;return new Uint8Array([3,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])}or.prototype.push=function(r,t){var n,i,e=this.X,f=this.options.Hr;if(this.ended)return!1;for(i=t===~~t?t:!0===t?4:0,\"[object ArrayBuffer]\"===fr.call(r)?e.wr=new Uint8Array(r):e.wr=r,e.vr=0,e.cr=e.wr.length;;)if(0===e.nr&&(e.ir=new Uint8Array(f),e.sr=0,e.nr=f),(2===i||3===i)&&e.nr<=6)this.Kr(e.ir.subarray(0,e.sr)),e.nr=0;else{if(1===(n=rr(e,i)))return e.sr>0&&this.Kr(e.ir.subarray(0,e.sr)),n=tr(this.X),this.Lr(n),this.ended=!0,0===n;if(0!==e.nr){if(i>0&&e.sr>0)this.Kr(e.ir.subarray(0,e.sr)),e.nr=0;else if(0===e.cr)break}else this.Kr(e.ir)}return!0},or.prototype.Kr=function(r){this.Jr.push(r)},or.prototype.Lr=function(r){0===r&&(this.result=function(r){for(var t=0,n=0,i=r.length;n<i;n++)t+=r[n].length;for(var e=new Uint8Array(t),f=0,o=0,s=r.length;f<s;f++){var u=r[f];e.set(u,o),o+=u.length}return e}(this.Jr)),this.Jr=[],this.err=r,this.$=this.X.$},function(t){void 0===t&&(t=self);try{var n=new Map;t.addEventListener(\"message\",(function(i){try{var e=function(t,n){switch(n.action){case\"init\":return{type:\"initialized\",version:\"3.3.17\"};case\"write\":var i=t.get(n.streamId);i||(i=new or,t.set(n.streamId,i));var e=i.Jr.length,f=function(r){if(\"function\"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(r);var t,n,i,e,f,o=r.length,s=0;for(e=0;e<o;e++)55296==(64512&(n=r.charCodeAt(e)))&&e+1<o&&56320==(64512&(i=r.charCodeAt(e+1)))&&(n=65536+(n-55296<<10)+(i-56320),e++),s+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Uint8Array(s),f=0,e=0;f<s;e++)55296==(64512&(n=r.charCodeAt(e)))&&e+1<o&&56320==(64512&(i=r.charCodeAt(e+1)))&&(n=65536+(n-55296<<10)+(i-56320),e++),n<128?t[f++]=n:n<2048?(t[f++]=192|n>>>6,t[f++]=128|63&n):n<65536?(t[f++]=224|n>>>12,t[f++]=128|n>>>6&63,t[f++]=128|63&n):(t[f++]=240|n>>>18,t[f++]=128|n>>>12&63,t[f++]=128|n>>>6&63,t[f++]=128|63&n);return t}(n.data);return i.push(f,2),{type:\"wrote\",id:n.id,streamId:n.streamId,result:r(i.Jr.slice(e)),trailer:ur(i),additionalBytesCount:f.length};case\"reset\":t.delete(n.streamId)}}(n,i.data);e&&t.postMessage(e)}catch(r){sr(t,r,i.data&&\"streamId\"in i.data?i.data.streamId:void 0)}}))}catch(r){sr(t,r)}}()}();"]));
9
9
  try {
10
10
  var worker = new Worker(objectUrl);
11
11
  workerObjectUrls.set(worker, objectUrl);
@@ -11,7 +11,7 @@ export function createCanvasEncodeWorker(configuration, workerCtor, urlObject) {
11
11
  var workerUrl = configuration.replayCanvasWorkerUrl;
12
12
  var usesExternalUrl = !!workerUrl;
13
13
  if (!workerUrl) {
14
- workerUrl = urlObject.createObjectURL(new Blob(["!function(){\"use strict\";function n(n){for(var t=new Uint8Array(n),r=[],i=0;i<t.length;i+=8192){for(var e=t.subarray(i,i+8192),o=\"\",f=0;f<e.length;f+=1)o+=String.fromCharCode(e[f]);r.push(o)}return btoa(r.join(\"\"))}function t(n,t){try{n.postMessage(t)}catch(r){n.postMessage({action:\"errored\",id:t&&t.id,error:String(r&&r.message?r.message:r)})}}var r=16777216;function i(n){var t=Number(n&&n.width),r=Number(n&&n.height);if(!isFinite(t)||!isFinite(r)||t<0||r<0)return 1/0;var i=t*r*4;return isFinite(i)?i:1/0}function e(n){if(n)try{n.width=0,n.height=0}catch(n){}}!function(o){void 0===o&&(o=self);var f=[],c=0;o.addEventListener(\"message\",(function(a){var u=a.data;if(u)if(\"init\"!==u.action){if(\"encode\"===u.action){var d,h=!1;Promise.resolve().then((function(){var t=function(n,t,r){if(!n||!t||!r)return{width:n,height:t};if(n<=r&&t<=r)return{width:n,height:t};var i=n>t?r/n:r/t;return{width:Math.max(1,Math.round(n*i)),height:Math.max(1,Math.round(t*i))}}(u.width,u.height,u.maxSize),r=(d=function(n,t){var r=f.pop();return r?c=Math.max(0,c-i(r)):r=new OffscreenCanvas(n,t),r.width!==n&&(r.width=n),r.height!==t&&(r.height=t),r}(t.width,t.height)).getContext(\"2d\");if(!r)throw new Error(\"Cannot create offscreen canvas 2d context for encoding\");if(function(n,t,r,i){var e=\"function\"==typeof n.save&&\"function\"==typeof n.restore;e&&n.save();try{\"function\"==typeof n.resetTransform?n.resetTransform():\"function\"==typeof n.setTransform&&n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,r,i),n.drawImage(t,0,0,r,i)}finally{e&&n.restore()}}(r,u.bitmap,t.width,t.height),\"function\"!=typeof d.convertToBlob)throw new Error(\"OffscreenCanvas convertToBlob is not supported\");return d.convertToBlob({type:u.mimeType,quality:u.quality}).then((function(r){return\"number\"==typeof u.maxEncodedBytes&&r.size>u.maxEncodedBytes?{action:\"dropped\",id:u.id,reason:\"encode_too_large\",encodedBytesCount:r.size,width:t.width,height:t.height}:r.arrayBuffer().then((function(i){var e=r.type||u.mimeType;return{action:\"encoded\",id:u.id,dataUrl:\"data:\"+e+\";base64,\"+n(i),width:t.width,height:t.height}}))})).then((function(n){return h=!0,n}))})).finally((function(){!function(n){if(n&&\"function\"==typeof n.close)try{n.close()}catch(n){}}(u.bitmap),h?function(n){var t=i(n);f.length>=4||!t||t>r||c>r-t?e(n):(f.push(n),c+=t)}(d):e(d)})).then((function(n){t(o,n)})).catch((function(n){t(o,{action:\"errored\",id:u.id,error:String(n&&n.message?n.message:n)})}))}}else t(o,{action:\"initialized\",version:\"3.3.16\"})}))}()}();"]));
14
+ workerUrl = urlObject.createObjectURL(new Blob(["!function(){\"use strict\";function n(n){for(var t=new Uint8Array(n),r=[],i=0;i<t.length;i+=8192){for(var e=t.subarray(i,i+8192),o=\"\",f=0;f<e.length;f+=1)o+=String.fromCharCode(e[f]);r.push(o)}return btoa(r.join(\"\"))}function t(n,t){try{n.postMessage(t)}catch(r){n.postMessage({action:\"errored\",id:t&&t.id,error:String(r&&r.message?r.message:r)})}}var r=16777216;function i(n){var t=Number(n&&n.width),r=Number(n&&n.height);if(!isFinite(t)||!isFinite(r)||t<0||r<0)return 1/0;var i=t*r*4;return isFinite(i)?i:1/0}function e(n){if(n)try{n.width=0,n.height=0}catch(n){}}!function(o){void 0===o&&(o=self);var f=[],c=0;o.addEventListener(\"message\",(function(a){var u=a.data;if(u)if(\"init\"!==u.action){if(\"encode\"===u.action){var d,h=!1;Promise.resolve().then((function(){var t=function(n,t,r){if(!n||!t||!r)return{width:n,height:t};if(n<=r&&t<=r)return{width:n,height:t};var i=n>t?r/n:r/t;return{width:Math.max(1,Math.round(n*i)),height:Math.max(1,Math.round(t*i))}}(u.width,u.height,u.maxSize),r=(d=function(n,t){var r=f.pop();return r?c=Math.max(0,c-i(r)):r=new OffscreenCanvas(n,t),r.width!==n&&(r.width=n),r.height!==t&&(r.height=t),r}(t.width,t.height)).getContext(\"2d\");if(!r)throw new Error(\"Cannot create offscreen canvas 2d context for encoding\");if(function(n,t,r,i){var e=\"function\"==typeof n.save&&\"function\"==typeof n.restore;e&&n.save();try{\"function\"==typeof n.resetTransform?n.resetTransform():\"function\"==typeof n.setTransform&&n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,r,i),n.drawImage(t,0,0,r,i)}finally{e&&n.restore()}}(r,u.bitmap,t.width,t.height),\"function\"!=typeof d.convertToBlob)throw new Error(\"OffscreenCanvas convertToBlob is not supported\");return d.convertToBlob({type:u.mimeType,quality:u.quality}).then((function(r){return\"number\"==typeof u.maxEncodedBytes&&r.size>u.maxEncodedBytes?{action:\"dropped\",id:u.id,reason:\"encode_too_large\",encodedBytesCount:r.size,width:t.width,height:t.height}:r.arrayBuffer().then((function(i){var e=r.type||u.mimeType;return{action:\"encoded\",id:u.id,dataUrl:\"data:\"+e+\";base64,\"+n(i),width:t.width,height:t.height}}))})).then((function(n){return h=!0,n}))})).finally((function(){!function(n){if(n&&\"function\"==typeof n.close)try{n.close()}catch(n){}}(u.bitmap),h?function(n){var t=i(n);f.length>=4||!t||t>r||c>r-t?e(n):(f.push(n),c+=t)}(d):e(d)})).then((function(n){t(o,n)})).catch((function(n){t(o,{action:\"errored\",id:u.id,error:String(n&&n.message?n.message:n)})}))}}else t(o,{action:\"initialized\",version:\"3.3.17\"})}))}()}();"]));
15
15
  }
16
16
  try {
17
17
  return {
@@ -5,7 +5,7 @@ import { SESSION_REPLAY_TIME_ANCHOR_INTERVAL, SESSION_REPLAY_TIME_ANCHOR_RECORD_
5
5
  export { SESSION_REPLAY_TIME_ANCHOR_INTERVAL, SESSION_REPLAY_TIME_ANCHOR_RECORD_TYPE, SESSION_REPLAY_TIME_ANCHOR_TAG } from '../timeAnchor';
6
6
  import { RecordType, IncrementalSource } from '../../../types';
7
7
  import { NodePrivacyLevel } from '../../../constants';
8
- import { createMutationSerializerTask, SerializationContextStatus, getSerializedNodeApproxBytes, SERIALIZATION_MAX_NODE_COUNT, SERIALIZATION_MAX_APPROX_BYTES, FULL_SNAPSHOT_SERIALIZATION_MAX_APPROX_BYTES } from './serialize';
8
+ import { createMutationSerializerTask, SerializationContextStatus, getSerializedNodeApproxBytes, SERIALIZATION_MAX_NODE_COUNT, SERIALIZATION_MAX_APPROX_BYTES } from './serialize';
9
9
  import { initInputObserver, initObservers } from './observers';
10
10
  import { getVisualViewport } from './viewports';
11
11
  import { assembleIncrementalSnapshot } from './utils';
@@ -1335,11 +1335,14 @@ export function record(options) {
1335
1335
  }
1336
1336
  function advanceFullSnapshotSerializerTask(serializerTask, deadline) {
1337
1337
  var maxNodeCount = Math.min(serializerTask.processedNodeCount + SERIALIZATION_MAX_NODE_COUNT, FULL_SNAPSHOT_SERIALIZATION_MAX_NODE_COUNT);
1338
- var maxApproxBytes = Math.min(serializerTask.approxBytes + SERIALIZATION_MAX_APPROX_BYTES, FULL_SNAPSHOT_SERIALIZATION_MAX_APPROX_BYTES);
1338
+ // The byte watermark yields traversal work; it must not reject an entire
1339
+ // baseline just because its DOM and complete CSS exceed the encoder's
1340
+ // backlog watermark. Keep advancing until the snapshot is complete.
1341
+ var maxApproxBytes = serializerTask.approxBytes + SERIALIZATION_MAX_APPROX_BYTES;
1339
1342
  var completed = serializerTask.advance(deadline, maxNodeCount, maxApproxBytes);
1340
1343
  return {
1341
1344
  completed: completed,
1342
- isWatermarkReached: !completed && (serializerTask.isMaxDepthReached || serializerTask.isMaxNodeComplexityReached || serializerTask.isMaxNodeCountReached && maxNodeCount >= FULL_SNAPSHOT_SERIALIZATION_MAX_NODE_COUNT || serializerTask.isMaxApproxBytesReached && maxApproxBytes >= FULL_SNAPSHOT_SERIALIZATION_MAX_APPROX_BYTES)
1345
+ isWatermarkReached: !completed && (serializerTask.isMaxDepthReached || serializerTask.isMaxNodeComplexityReached || serializerTask.isMaxNodeCountReached && maxNodeCount >= FULL_SNAPSHOT_SERIALIZATION_MAX_NODE_COUNT)
1343
1346
  };
1344
1347
  }
1345
1348
  function createFullSnapshotBaselineRecords(timestamp, serializedDocument) {
@@ -1377,7 +1380,6 @@ export function record(options) {
1377
1380
  // result from an earlier record: only the segment/encoder result for this
1378
1381
  // exact baseline may classify its rejection as transient backpressure.
1379
1382
  lastEmitWasLocallyBackpressured = false;
1380
- var timestamp = baselineRecords[0].timestamp;
1381
1383
  var fullSnapshotAccepted;
1382
1384
  if (rawEmitBaseline) {
1383
1385
  fullSnapshotAccepted = rawEmitBaseline(baselineRecords) !== false;
@@ -1389,13 +1391,6 @@ export function record(options) {
1389
1391
  }
1390
1392
  fullSnapshotWasPublished = true;
1391
1393
  currentFullSnapshotPublicationToken.$rPublished = true;
1392
- if (window.visualViewport) {
1393
- rawEmit({
1394
- data: getVisualViewport(),
1395
- type: RecordType.VisualViewport,
1396
- timestamp: timestamp
1397
- });
1398
- }
1399
1394
  if (false) {
1400
1395
  updateReplayPerformanceStats({
1401
1396
  fullSnapshotCount: 1,
@@ -1404,6 +1399,17 @@ export function record(options) {
1404
1399
  }
1405
1400
  return true;
1406
1401
  }
1402
+ function emitFullSnapshotViewport(timestamp) {
1403
+ if (window.visualViewport) {
1404
+ // Call after leaving the previous replay tree so encoder backpressure
1405
+ // retains this record on the new baseline's normal retry queue.
1406
+ emit({
1407
+ data: getVisualViewport(),
1408
+ type: RecordType.VisualViewport,
1409
+ timestamp: timestamp
1410
+ });
1411
+ }
1412
+ }
1407
1413
  function invalidateFullSnapshotCanvasBaseline() {
1408
1414
  fullSnapshotCanvasBaselineGeneration += 1;
1409
1415
  }
@@ -1543,6 +1549,7 @@ export function record(options) {
1543
1549
  }
1544
1550
  var baselineRecords = createFullSnapshotBaselineRecords(timestamp, serializerTask.serializedNode);
1545
1551
  if (emitFullSnapshot(baselineRecords, fullSnapshotStartedAt)) {
1552
+ emitFullSnapshotViewport(timestamp);
1546
1553
  return {
1547
1554
  status: 'completed'
1548
1555
  };
@@ -2347,6 +2354,7 @@ export function record(options) {
2347
2354
  resetPreviousReplayTreeRecords();
2348
2355
  previousReplayTreeAdmissionActive = false;
2349
2356
  captureRecordsAgainstPreviousReplayTree = false;
2357
+ emitFullSnapshotViewport(baselineRecords[0].timestamp);
2350
2358
  flushDeferredRecords();
2351
2359
  if (!suppressRecordsUntilFullSnapshot && !recordStopped) {
2352
2360
  takeFullSnapshotCanvasBaseline();