@posthog/rrweb-player 0.0.45 → 0.0.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/rrweb-player.cjs +1 -1
- package/dist/rrweb-player.cjs.map +1 -1
- package/dist/rrweb-player.js +1 -1
- package/dist/rrweb-player.js.map +1 -1
- package/dist/rrweb-player.umd.cjs +1 -1
- package/dist/rrweb-player.umd.cjs.map +1 -1
- package/dist/rrweb-player.umd.min.cjs +26 -15
- package/dist/rrweb-player.umd.min.cjs.map +2 -2
- package/package.json +3 -3
|
@@ -78,8 +78,17 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
78
78
|
}
|
|
79
79
|
return base64;
|
|
80
80
|
};
|
|
81
|
-
const
|
|
81
|
+
const lastFingerprintMap = /* @__PURE__ */ new Map();
|
|
82
82
|
const transparentBlobMap = /* @__PURE__ */ new Map();
|
|
83
|
+
function fnv1aHash(buffer) {
|
|
84
|
+
const view = new Uint8Array(buffer);
|
|
85
|
+
let hash = 2166136261;
|
|
86
|
+
for (let i2 = 0; i2 < view.length; i2++) {
|
|
87
|
+
hash ^= view[i2];
|
|
88
|
+
hash = hash * 16777619 | 0;
|
|
89
|
+
}
|
|
90
|
+
return (hash >>> 0).toString(16);
|
|
91
|
+
}
|
|
83
92
|
async function getTransparentBlobFor(width, height, dataURLOptions) {
|
|
84
93
|
const id = \`\${width}-\${height}\`;
|
|
85
94
|
if ("OffscreenCanvas" in globalThis) {
|
|
@@ -116,27 +125,29 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
116
125
|
const blob = await reusableCanvas.convertToBlob(dataURLOptions);
|
|
117
126
|
const type = blob.type;
|
|
118
127
|
const arrayBuffer = await blob.arrayBuffer();
|
|
119
|
-
const
|
|
120
|
-
if (!
|
|
121
|
-
|
|
122
|
-
|
|
128
|
+
const fingerprint = fnv1aHash(arrayBuffer);
|
|
129
|
+
if (!lastFingerprintMap.has(id)) {
|
|
130
|
+
const base642 = encode(arrayBuffer);
|
|
131
|
+
if (await transparentBase64 === base642) {
|
|
132
|
+
lastFingerprintMap.set(id, fingerprint);
|
|
133
|
+
return worker.postMessage({ id });
|
|
134
|
+
}
|
|
135
|
+
lastFingerprintMap.set(id, fingerprint);
|
|
136
|
+
worker.postMessage({ id, type, base64: base642, width, height });
|
|
137
|
+
return;
|
|
123
138
|
}
|
|
124
|
-
if (
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
width,
|
|
130
|
-
height
|
|
131
|
-
});
|
|
132
|
-
lastBlobMap.set(id, base64);
|
|
139
|
+
if (lastFingerprintMap.get(id) === fingerprint)
|
|
140
|
+
return worker.postMessage({ id });
|
|
141
|
+
const base64 = encode(arrayBuffer);
|
|
142
|
+
worker.postMessage({ id, type, base64, width, height });
|
|
143
|
+
lastFingerprintMap.set(id, fingerprint);
|
|
133
144
|
} else {
|
|
134
145
|
e.data.bitmap.close();
|
|
135
146
|
return worker.postMessage({ id: e.data.id });
|
|
136
147
|
}
|
|
137
148
|
};
|
|
138
149
|
})();
|
|
139
|
-
//# sourceMappingURL=image-bitmap-data-url-worker-
|
|
150
|
+
//# sourceMappingURL=image-bitmap-data-url-worker-B8-18rdG.js.map
|
|
140
151
|
`;typeof self!="undefined"&&self.Blob&&new Blob([Tu],{type:"text/javascript;charset=utf-8"});try{if(Array.from([1],e=>e*2)[0]!==2){const e=document.createElement("iframe");document.body.appendChild(e),Array.from=((Vi=e.contentWindow)==null?void 0:Vi.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}Zn();function Lo(e){return{all:e=e||new Map,on:function(t,r){var s=e.get(t);s?s.push(r):e.set(t,[r])},off:function(t,r){var s=e.get(t);s&&(r?s.splice(s.indexOf(r)>>>0,1):e.set(t,[]))},emit:function(t,r){var s=e.get(t);s&&s.slice().map(function(i){i(r)}),(s=e.get("*"))&&s.slice().map(function(i){i(t,r)})}}}const ku=Object.freeze(Object.defineProperty({__proto__:null,default:Lo},Symbol.toStringTag,{value:"Module"}));function Iu(e=window,t=document){if("scrollBehavior"in t.documentElement.style&&e.__forceSmoothScrollPolyfill__!==!0)return;const r=e.HTMLElement||e.Element,s=468,i={scroll:e.scroll||e.scrollTo,scrollBy:e.scrollBy,elementScroll:r.prototype.scroll||d,scrollIntoView:r.prototype.scrollIntoView},a=e.performance&&e.performance.now?e.performance.now.bind(e.performance):Date.now;function o(v){const y=["MSIE ","Trident/","Edge/"];return new RegExp(y.join("|")).test(v)}const u=o(e.navigator.userAgent)?1:0;function d(v,y){this.scrollLeft=v,this.scrollTop=y}function l(v){return .5*(1-Math.cos(Math.PI*v))}function n(v){if(v===null||typeof v!="object"||v.behavior===void 0||v.behavior==="auto"||v.behavior==="instant")return!0;if(typeof v=="object"&&v.behavior==="smooth")return!1;throw new TypeError("behavior member of ScrollOptions "+v.behavior+" is not a valid value for enumeration ScrollBehavior.")}function c(v,y){if(y==="Y")return v.clientHeight+u<v.scrollHeight;if(y==="X")return v.clientWidth+u<v.scrollWidth}function f(v,y){const S=e.getComputedStyle(v,null)["overflow"+y];return S==="auto"||S==="scroll"}function h(v){const y=c(v,"Y")&&f(v,"Y"),S=c(v,"X")&&f(v,"X");return y||S}function p(v){for(;v!==t.body&&h(v)===!1;)v=v.parentNode||v.host;return v}function m(v){const y=a();let S,E,w,b=(y-v.startTime)/s;b=b>1?1:b,S=l(b),E=v.startX+(v.x-v.startX)*S,w=v.startY+(v.y-v.startY)*S,v.method.call(v.scrollable,E,w),(E!==v.x||w!==v.y)&&e.requestAnimationFrame(m.bind(e,v))}function g(v,y,S){let E,w,b,C;const R=a();v===t.body?(E=e,w=e.scrollX||e.pageXOffset,b=e.scrollY||e.pageYOffset,C=i.scroll):(E=v,w=v.scrollLeft,b=v.scrollTop,C=d),m({scrollable:E,method:C,startTime:R,startX:w,startY:b,x:y,y:S})}e.scroll=e.scrollTo=function(){if(arguments[0]!==void 0){if(n(arguments[0])===!0){i.scroll.call(e,arguments[0].left!==void 0?arguments[0].left:typeof arguments[0]!="object"?arguments[0]:e.scrollX||e.pageXOffset,arguments[0].top!==void 0?arguments[0].top:arguments[1]!==void 0?arguments[1]:e.scrollY||e.pageYOffset);return}g.call(e,t.body,arguments[0].left!==void 0?~~arguments[0].left:e.scrollX||e.pageXOffset,arguments[0].top!==void 0?~~arguments[0].top:e.scrollY||e.pageYOffset)}},e.scrollBy=function(){if(arguments[0]!==void 0){if(n(arguments[0])){i.scrollBy.call(e,arguments[0].left!==void 0?arguments[0].left:typeof arguments[0]!="object"?arguments[0]:0,arguments[0].top!==void 0?arguments[0].top:arguments[1]!==void 0?arguments[1]:0);return}g.call(e,t.body,~~arguments[0].left+(e.scrollX||e.pageXOffset),~~arguments[0].top+(e.scrollY||e.pageYOffset))}},r.prototype.scroll=r.prototype.scrollTo=function(){if(arguments[0]===void 0)return;if(n(arguments[0])===!0){if(typeof arguments[0]=="number"&&arguments[1]===void 0)throw new SyntaxError("Value could not be converted");i.elementScroll.call(this,arguments[0].left!==void 0?~~arguments[0].left:typeof arguments[0]!="object"?~~arguments[0]:this.scrollLeft,arguments[0].top!==void 0?~~arguments[0].top:arguments[1]!==void 0?~~arguments[1]:this.scrollTop);return}const v=arguments[0].left,y=arguments[0].top;g.call(this,this,typeof v=="undefined"?this.scrollLeft:~~v,typeof y=="undefined"?this.scrollTop:~~y)},r.prototype.scrollBy=function(){if(arguments[0]!==void 0){if(n(arguments[0])===!0){i.elementScroll.call(this,arguments[0].left!==void 0?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,arguments[0].top!==void 0?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop);return}this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior})}},r.prototype.scrollIntoView=function(){if(n(arguments[0])===!0){i.scrollIntoView.call(this,arguments[0]===void 0?!0:arguments[0]);return}const v=p(this),y=v.getBoundingClientRect(),S=this.getBoundingClientRect();v!==t.body?(g.call(this,v,v.scrollLeft+S.left-y.left,v.scrollTop+S.top-y.top),e.getComputedStyle(v).position!=="fixed"&&e.scrollBy({left:y.left,top:y.top,behavior:"smooth"})):e.scrollBy({left:S.left,top:S.top,behavior:"smooth"})}}class Lu{constructor(t=[],r){F(this,"timeOffset",0),F(this,"speed"),F(this,"actions"),F(this,"raf",null),F(this,"lastTimestamp"),this.actions=t,this.speed=r.speed}addAction(t){const r=this.raf===!0;if(!this.actions.length||this.actions[this.actions.length-1].delay<=t.delay)this.actions.push(t);else{const s=this.findActionIndex(t);this.actions.splice(s,0,t)}r&&(this.raf=requestAnimationFrame(this.rafCheck.bind(this)))}start(){this.timeOffset=0,this.lastTimestamp=performance.now(),this.raf=requestAnimationFrame(this.rafCheck.bind(this))}rafCheck(){const t=performance.now();for(this.timeOffset+=(t-this.lastTimestamp)*this.speed,this.lastTimestamp=t;this.actions.length;){const r=this.actions[0];if(this.timeOffset>=r.delay)this.actions.shift(),r.doAction();else break}this.actions.length>0?this.raf=requestAnimationFrame(this.rafCheck.bind(this)):this.raf=!0}clear(){this.raf&&(this.raf!==!0&&cancelAnimationFrame(this.raf),this.raf=null),this.actions.length=0}setSpeed(t){this.speed=t}isActive(){return this.raf!==null}findActionIndex(t){let r=0,s=this.actions.length-1;for(;r<=s;){const i=Math.floor((r+s)/2);if(this.actions[i].delay<t.delay)r=i+1;else if(this.actions[i].delay>t.delay)s=i-1;else return i+1}return r}}function gn(e,t){if(e.type===te.IncrementalSnapshot&&e.data.source===Y.MouseMove&&e.data.positions&&e.data.positions.length){const r=e.data.positions[0].timeOffset,s=e.timestamp+r;return e.delay=s-t,s-t}return e.delay=e.timestamp-t,e.delay}/*! *****************************************************************************
|
|
141
152
|
Copyright (c) Microsoft Corporation.
|
|
142
153
|
|