const t="cookieStorage",e="localStorage",r="memoryStorage",n=t=>"function"==typeof t&&Boolean(t.constructor&&t.call&&t.apply),a=t=>"string"==typeof t,o=t=>null===t,i=t=>void 0===t,u=t=>o(t)||i(t),c=t=>!i(t),s=t=>!u(t),l=t=>t.replace(/\/{2,}/g,"/");for(var f,y=[],p=0;p<256;p++)y[p]=(p+256).toString(16).substring(1);function h(){var t;(!f||p+16>4096)&&(t=4096,f=crypto.getRandomValues(new Uint8Array(t)),p=0);for(var e,r=0,n="";r<16;r++)e=f[p+r],n+=6==r?y[15&e|64]:8==r?y[63&e|128]:y[e],1&r&&r>1&&r<11&&(n+="-");return p+=16,n}for(var g,b=256,d=[];b--;)d[b]=(b+256).toString(16).substring(1);const v=()=>!u(globalThis.crypto)&&n(globalThis.crypto.getRandomValues)?h():function(){var t,e=0,r="";if(!g||b+16>256){for(g=Array(e=256);e--;)g[e]=256*Math.random()|0;e=b=0}for(;e<16;e++)t=g[b+e],r+=6==e?d[15&t|64]:8==e?d[63&t|128]:d[t],1&e&&e>1&&e<11&&(r+="-");return b++,r}(),m=t=>429===t||!(t>=400&&t<500),O=t=>{let e=t;if(!a(t)&&!u(t))try{e=JSON.stringify(t)}catch(t){e=null}return e},A=t=>(t=>{const e=Array.from(t,(t=>String.fromCodePoint(t))).join("");return globalThis.btoa(e)})((new TextEncoder).encode(t)),j=t=>(new TextDecoder).decode((t=>{const e=globalThis.atob(t).split("").map((t=>t.charCodeAt(0)));return new Uint8Array(e)})(t)),w=":: ";function S(t){return null!=t&&"object"==typeof t&&!0===t["@@functional/placeholder"]}function E(t){return function e(r){return 0===arguments.length||S(r)?e:t.apply(this,arguments)}}function P(t){return function e(r,n){switch(arguments.length){case 0:return e;case 1:return S(r)?e:E((function(e){return t(r,e)}));default:return S(r)&&S(n)?e:S(r)?E((function(e){return t(e,n)})):S(n)?E((function(e){return t(r,e)})):t(r,n)}}}function T(t){return function e(r,n,a){switch(arguments.length){case 0:return e;case 1:return S(r)?e:P((function(e,n){return t(r,e,n)}));case 2:return S(r)&&S(n)?e:S(r)?P((function(e,r){return t(e,n,r)})):S(n)?P((function(e,n){return t(r,e,n)})):E((function(e){return t(r,n,e)}));default:return S(r)&&S(n)&&S(a)?e:S(r)&&S(n)?P((function(e,r){return t(e,r,a)})):S(r)&&S(a)?P((function(e,r){return t(e,n,r)})):S(n)&&S(a)?P((function(e,n){return t(r,e,n)})):S(r)?E((function(e){return t(e,n,a)})):S(n)?E((function(e){return t(r,e,a)})):S(a)?E((function(e){return t(r,n,e)})):t(r,n,a)}}}function U(t,e){return Object.prototype.hasOwnProperty.call(e,t)}var C=E((function(t){return null===t?"Null":void 0===t?"Undefined":Object.prototype.toString.call(t).slice(8,-1)}));function R(t){return"[object Object]"===Object.prototype.toString.call(t)}function $(t,e,r){if(r||(r=new D),function(t){var e=typeof t;return null==t||"object"!=e&&"function"!=e}(t))return t;var n,a=function(e){var n=r.get(t);if(n)return n;for(var a in r.set(t,e),t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=$(t[a],!0,r));return e};switch(C(t)){case"Object":return a(Object.create(Object.getPrototypeOf(t)));case"Array":return a(Array(t.length));case"Date":return new Date(t.valueOf());case"RegExp":return n=t,new RegExp(n.source,n.flags?n.flags:(n.global?"g":"")+(n.ignoreCase?"i":"")+(n.multiline?"m":"")+(n.sticky?"y":"")+(n.unicode?"u":"")+(n.dotAll?"s":""));case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"BigInt64Array":case"BigUint64Array":return t.slice();default:return t}}var D=function(){function t(){this.map={},this.length=0}return t.prototype.set=function(t,e){var r=this.hash(t),n=this.map[r];n||(this.map[r]=n=[]),n.push([t,e]),this.length+=1},t.prototype.hash=function(t){var e=[];for(var r in t)e.push(Object.prototype.toString.call(t[r]));return e.join()},t.prototype.get=function(t){if(this.length<=180)for(var e in this.map)for(var r=this.map[e],n=0;n!o(t)&&"[object Object]"===Object.prototype.toString.call(t),k=(t,e)=>{if(!Array.isArray(t)||!Array.isArray(e))return N(e);const r=N(t);return e.forEach(((t,e)=>{r[e]=Array.isArray(t)||(t=>!o(t)&&(t=>"object"==typeof t)(t)&&!Array.isArray(t))(t)?B(r[e],t):t})),r},B=(t,e)=>L(k,t,e),z=t=>_(t)&&Object.keys(t).length>0,J="[Circular Reference]",Q=(t,e,r)=>{const n=[];return function(t,e){if(!u(e)){if("object"!=typeof e||o(e))return e;for(;n.length>0&&n[n.length-1]!==this;)n.pop();return n.includes(e)?(null==r||r.warn(((t,e)=>`${t}${w}A circular reference has been detected in the object and the property "${e}" has been dropped from the output.`)("JSONStringify",t)),J):(n.push(e),e)}}},F=(t,e,r,n)=>{try{return JSON.stringify(t,Q(0,0,n))}catch(t){return null==n||n.warn("Failed to convert the value to a JSON string.",t),null}},M=t=>{const e=[];return function(t,r){if((t=>"bigint"==typeof t)(r))return"[BigInt]";for(;e.length>0&&e[e.length-1]!==this;)e.pop();return e.includes(r)?J:(e.push(r),r)}},q=(t,e)=>{const r=Array.isArray(t)?[]:{};for(const n in t)if(Object.hasOwnProperty.call(t,n)){const a=t[n],o=e.call(t,n,a);_(o)||Array.isArray(o)?r[n]=q(o,e):r[n]=o}return r},V=(t,e)=>{const r=M(),n=r.call(t,"",t);return _(t)||Array.isArray(t)?q(t,r):n},G=()=>(new Date).toISOString();function H(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function K(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function W(t){for(var e=1;e`${X}${A(t)}`,Z=t=>null!=t&&t.startsWith(X)?j(t.substring(10)):t,tt="QueueUtilities",et=(t,e)=>F(t,0,0,e),rt=(t,e)=>F(t,0,0,e),nt=(t,e)=>{const r=et(t,e);if(r){const t=r.length;t>32768&&(null==e||e.warn(((t,e,r)=>`${t}${w}The size of the event payload (${e} bytes) exceeds the maximum limit of ${r} bytes. Events with large payloads may be dropped in the future. Please review your instrumentation to ensure that event payloads are within the size limit.`)(tt,t,32768)))}else null==e||e.warn(`${tt}${w}Failed to validate event payload size. Please make sure that the event payload is within the size limit and is a valid JSON object.`)},at=(t,e)=>{const r=N(t);return r.sentAt=e,r},ot=t=>{let e=!1,r=!1;function n(){e||(e=!0,t(r),setTimeout((()=>{e=!1}),0))}globalThis.addEventListener("beforeunload",(()=>{r=!1,n()})),globalThis.addEventListener("blur",(()=>{r=!0,n()})),globalThis.addEventListener("focus",(()=>{e=!1})),document.addEventListener("pagehide",(()=>{r="hidden"===document.visibilityState,n()})),document.addEventListener("visibilitychange",(()=>{r=!0,"hidden"===document.visibilityState?n():e=!1}))},it={IN_PROGRESS:"inProgress",QUEUE:"queue",RECLAIM_START:"reclaimStart",RECLAIM_END:"reclaimEnd",ACK:"ack",BATCH_QUEUE:"batchQueue"};export{v as A,ot as B,t as C,H as D,e as L,r as M,it as Q,W as _,_ as a,o as b,N as c,c as d,s as e,a as f,i as g,Z as h,n as i,Y as j,w as k,u as l,B as m,G as n,at as o,V as p,z as q,l as r,F as s,O as t,rt as u,nt as v,m as w,j as x,et as y,A as z}; //# sourceMappingURL=rsa-plugins-common.min.js.map