@product-intelligence-hub/sdk-web 0.3.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.global.js +37 -5
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +5 -2
package/dist/index.global.js
CHANGED
|
@@ -1,16 +1,48 @@
|
|
|
1
|
-
var PIH=(function(exports){'use strict';var Ut=Object.create;var ve=Object.defineProperty;var Nt=Object.getOwnPropertyDescriptor;var Lt=Object.getOwnPropertyNames;var xt=Object.getPrototypeOf,jt=Object.prototype.hasOwnProperty;var Mt=(e,n,r)=>n in e?ve(e,n,{enumerable:true,configurable:true,writable:true,value:r}):e[n]=r;var ye=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports);var Dt=(e,n,r,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of Lt(n))!jt.call(e,a)&&a!==r&&ve(e,a,{get:()=>n[a],enumerable:!(s=Nt(n,a))||s.enumerable});return e};var Ft=(e,n,r)=>(r=e!=null?Ut(xt(e)):{},Dt(ve(r,"default",{value:e,enumerable:true}),e));var p=(e,n,r)=>Mt(e,typeof n!="symbol"?n+"":n,r);var vt=ye(h=>{var be=Symbol.for("react.transitional.element"),nn=Symbol.for("react.portal"),rn=Symbol.for("react.fragment"),sn=Symbol.for("react.strict_mode"),on=Symbol.for("react.profiler"),an=Symbol.for("react.consumer"),un=Symbol.for("react.context"),ln=Symbol.for("react.forward_ref"),cn=Symbol.for("react.suspense"),dn=Symbol.for("react.memo"),dt=Symbol.for("react.lazy"),hn=Symbol.for("react.activity"),at=Symbol.iterator;function fn(e){return e===null||typeof e!="object"?null:(e=at&&e[at]||e["@@iterator"],typeof e=="function"?e:null)}var ht={isMounted:function(){return false},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ft=Object.assign,pt={};function M(e,n,r){this.props=e,this.context=n,this.refs=pt,this.updater=r||ht;}M.prototype.isReactComponent={};M.prototype.setState=function(e,n){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,n,"setState");};M.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate");};function gt(){}gt.prototype=M.prototype;function Te(e,n,r){this.props=e,this.context=n,this.refs=pt,this.updater=r||ht;}var Ie=Te.prototype=new gt;Ie.constructor=Te;ft(Ie,M.prototype);Ie.isPureReactComponent=true;var ut=Array.isArray;function Se(){}var _={H:null,A:null,T:null,S:null},mt=Object.prototype.hasOwnProperty;function ke(e,n,r){var s=r.ref;return {$$typeof:be,type:e,key:n,ref:s!==void 0?s:null,props:r}}function pn(e,n){return ke(e.type,n,e.props)}function Re(e){return typeof e=="object"&&e!==null&&e.$$typeof===be}function gn(e){var n={"=":"=0",":":"=2"};return "$"+e.replace(/[=:]/g,function(r){return n[r]})}var lt=/\/+/g;function _e(e,n){return typeof e=="object"&&e!==null&&e.key!=null?gn(""+e.key):n.toString(36)}function mn(e){switch(e.status){case "fulfilled":return e.value;case "rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(Se,Se):(e.status="pending",e.then(function(n){e.status==="pending"&&(e.status="fulfilled",e.value=n);},function(n){e.status==="pending"&&(e.status="rejected",e.reason=n);})),e.status){case "fulfilled":return e.value;case "rejected":throw e.reason}}throw e}function j(e,n,r,s,a){var l=typeof e;(l==="undefined"||l==="boolean")&&(e=null);var g=false;if(e===null)g=true;else switch(l){case "bigint":case "string":case "number":g=true;break;case "object":switch(e.$$typeof){case be:case nn:g=true;break;case dt:return g=e._init,j(g(e._payload),n,r,s,a)}}if(g)return a=a(e),g=s===""?"."+_e(e,0):s,ut(a)?(r="",g!=null&&(r=g.replace(lt,"$&/")+"/"),j(a,n,r,"",function(H){return H})):a!=null&&(Re(a)&&(a=pn(a,r+(a.key==null||e&&e.key===a.key?"":(""+a.key).replace(lt,"$&/")+"/")+g)),n.push(a)),1;g=0;var k=s===""?".":s+":";if(ut(e))for(var T=0;T<e.length;T++)s=e[T],l=k+_e(s,T),g+=j(s,n,r,l,a);else if(T=fn(e),typeof T=="function")for(e=T.call(e),T=0;!(s=e.next()).done;)s=s.value,l=k+_e(s,T++),g+=j(s,n,r,l,a);else if(l==="object"){if(typeof e.then=="function")return j(mn(e),n,r,s,a);throw n=String(e),Error("Objects are not valid as a React child (found: "+(n==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":n)+"). If you meant to render a collection of children, use an array instead.")}return g}function re(e,n,r){if(e==null)return e;var s=[],a=0;return j(e,s,"","",function(l){return n.call(r,l,a++)}),s}function vn(e){if(e._status===-1){var n=e._result;n=n(),n.then(function(r){(e._status===0||e._status===-1)&&(e._status=1,e._result=r);},function(r){(e._status===0||e._status===-1)&&(e._status=2,e._result=r);}),e._status===-1&&(e._status=0,e._result=n);}if(e._status===1)return e._result.default;throw e._result}var ct=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:true,cancelable:true,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e);},yn={map:re,forEach:function(e,n,r){re(e,function(){n.apply(this,arguments);},r);},count:function(e){var n=0;return re(e,function(){n++;}),n},toArray:function(e){return re(e,function(n){return n})||[]},only:function(e){if(!Re(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};h.Activity=hn;h.Children=yn;h.Component=M;h.Fragment=rn;h.Profiler=on;h.PureComponent=Te;h.StrictMode=sn;h.Suspense=cn;h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=_;h.__COMPILER_RUNTIME={__proto__:null,c:function(e){return _.H.useMemoCache(e)}};h.cache=function(e){return function(){return e.apply(null,arguments)}};h.cacheSignal=function(){return null};h.cloneElement=function(e,n,r){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var s=ft({},e.props),a=e.key;if(n!=null)for(l in n.key!==void 0&&(a=""+n.key),n)!mt.call(n,l)||l==="key"||l==="__self"||l==="__source"||l==="ref"&&n.ref===void 0||(s[l]=n[l]);var l=arguments.length-2;if(l===1)s.children=r;else if(1<l){for(var g=Array(l),k=0;k<l;k++)g[k]=arguments[k+2];s.children=g;}return ke(e.type,a,s)};h.createContext=function(e){return e={$$typeof:un,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:an,_context:e},e};h.createElement=function(e,n,r){var s,a={},l=null;if(n!=null)for(s in n.key!==void 0&&(l=""+n.key),n)mt.call(n,s)&&s!=="key"&&s!=="__self"&&s!=="__source"&&(a[s]=n[s]);var g=arguments.length-2;if(g===1)a.children=r;else if(1<g){for(var k=Array(g),T=0;T<g;T++)k[T]=arguments[T+2];a.children=k;}if(e&&e.defaultProps)for(s in g=e.defaultProps,g)a[s]===void 0&&(a[s]=g[s]);return ke(e,l,a)};h.createRef=function(){return {current:null}};h.forwardRef=function(e){return {$$typeof:ln,render:e}};h.isValidElement=Re;h.lazy=function(e){return {$$typeof:dt,_payload:{_status:-1,_result:e},_init:vn}};h.memo=function(e,n){return {$$typeof:dn,type:e,compare:n===void 0?null:n}};h.startTransition=function(e){var n=_.T,r={};_.T=r;try{var s=e(),a=_.S;a!==null&&a(r,s),typeof s=="object"&&s!==null&&typeof s.then=="function"&&s.then(Se,ct);}catch(l){ct(l);}finally{n!==null&&r.types!==null&&(n.types=r.types),_.T=n;}};h.unstable_useCacheRefresh=function(){return _.H.useCacheRefresh()};h.use=function(e){return _.H.use(e)};h.useActionState=function(e,n,r){return _.H.useActionState(e,n,r)};h.useCallback=function(e,n){return _.H.useCallback(e,n)};h.useContext=function(e){return _.H.useContext(e)};h.useDebugValue=function(){};h.useDeferredValue=function(e,n){return _.H.useDeferredValue(e,n)};h.useEffect=function(e,n){return _.H.useEffect(e,n)};h.useEffectEvent=function(e){return _.H.useEffectEvent(e)};h.useId=function(){return _.H.useId()};h.useImperativeHandle=function(e,n,r){return _.H.useImperativeHandle(e,n,r)};h.useInsertionEffect=function(e,n){return _.H.useInsertionEffect(e,n)};h.useLayoutEffect=function(e,n){return _.H.useLayoutEffect(e,n)};h.useMemo=function(e,n){return _.H.useMemo(e,n)};h.useOptimistic=function(e,n){return _.H.useOptimistic(e,n)};h.useReducer=function(e,n,r){return _.H.useReducer(e,n,r)};h.useRef=function(e){return _.H.useRef(e)};h.useState=function(e){return _.H.useState(e)};h.useSyncExternalStore=function(e,n,r){return _.H.useSyncExternalStore(e,n,r)};h.useTransition=function(){return _.H.useTransition()};h.version="19.2.4";});var yt=ye((d,ie)=>{process.env.NODE_ENV!=="production"&&(function(){function e(t,i){Object.defineProperty(s.prototype,t,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",i[0],i[1]);}});}function n(t){return t===null||typeof t!="object"?null:(t=Ve&&t[Ve]||t["@@iterator"],typeof t=="function"?t:null)}function r(t,i){t=(t=t.constructor)&&(t.displayName||t.name)||"ReactClass";var o=t+"."+i;ze[o]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",i,t),ze[o]=true);}function s(t,i,o){this.props=t,this.context=i,this.refs=ge,this.updater=o||Ye;}function a(){}function l(t,i,o){this.props=t,this.context=i,this.refs=ge,this.updater=o||Ye;}function g(){}function k(t){return ""+t}function T(t){try{k(t);var i=!1;}catch{i=true;}if(i){i=console;var o=i.error,u=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return o.call(i,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",u),k(t)}}function H(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===At?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case he:return "Fragment";case Me:return "Profiler";case je:return "StrictMode";case $e:return "Suspense";case Rt:return "SuspenseList";case qe:return "Activity"}if(typeof t=="object")switch(typeof t.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case xe:return "Portal";case De:return t.displayName||"Context";case fe:return (t._context.displayName||"Context")+".Consumer";case Fe:var i=t.render;return t=t.displayName,t||(t=i.displayName||i.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case pe:return i=t.displayName||null,i!==null?i:H(t.type)||"Memo";case $:i=t._payload,t=t._init;try{return H(t(i))}catch{}}return null}function Pe(t){if(t===he)return "<>";if(typeof t=="object"&&t!==null&&t.$$typeof===$)return "<...>";try{var i=H(t);return i?"<"+i+">":"<...>"}catch{return "<...>"}}function Oe(){var t=m.A;return t===null?null:t.getOwner()}function He(){return Error("react-stack-top-frame")}function Ue(t){if(Q.call(t,"key")){var i=Object.getOwnPropertyDescriptor(t,"key").get;if(i&&i.isReactWarning)return false}return t.key!==void 0}function _t(t,i){function o(){Ke||(Ke=true,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",i));}o.isReactWarning=true,Object.defineProperty(t,"key",{get:o,configurable:true});}function St(){var t=H(this.type);return Xe[t]||(Xe[t]=true,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),t=this.props.ref,t!==void 0?t:null}function ae(t,i,o,u,c,y){var f=o.ref;return t={$$typeof:de,type:t,key:i,props:o,_owner:u},(f!==void 0?f:null)!==null?Object.defineProperty(t,"ref",{enumerable:false,get:St}):Object.defineProperty(t,"ref",{enumerable:false,value:null}),t._store={},Object.defineProperty(t._store,"validated",{configurable:false,enumerable:false,writable:true,value:0}),Object.defineProperty(t,"_debugInfo",{configurable:false,enumerable:false,writable:true,value:null}),Object.defineProperty(t,"_debugStack",{configurable:false,enumerable:false,writable:true,value:c}),Object.defineProperty(t,"_debugTask",{configurable:false,enumerable:false,writable:true,value:y}),Object.freeze&&(Object.freeze(t.props),Object.freeze(t)),t}function bt(t,i){return i=ae(t.type,i,t.props,t._owner,t._debugStack,t._debugTask),t._store&&(i._store.validated=t._store.validated),i}function Ne(t){N(t)?t._store&&(t._store.validated=1):typeof t=="object"&&t!==null&&t.$$typeof===$&&(t._payload.status==="fulfilled"?N(t._payload.value)&&t._payload.value._store&&(t._payload.value._store.validated=1):t._store&&(t._store.validated=1));}function N(t){return typeof t=="object"&&t!==null&&t.$$typeof===de}function Tt(t){var i={"=":"=0",":":"=2"};return "$"+t.replace(/[=:]/g,function(o){return i[o]})}function ue(t,i){return typeof t=="object"&&t!==null&&t.key!=null?(T(t.key),Tt(""+t.key)):i.toString(36)}function It(t){switch(t.status){case "fulfilled":return t.value;case "rejected":throw t.reason;default:switch(typeof t.status=="string"?t.then(g,g):(t.status="pending",t.then(function(i){t.status==="pending"&&(t.status="fulfilled",t.value=i);},function(i){t.status==="pending"&&(t.status="rejected",t.reason=i);})),t.status){case "fulfilled":return t.value;case "rejected":throw t.reason}}throw t}function L(t,i,o,u,c){var y=typeof t;(y==="undefined"||y==="boolean")&&(t=null);var f=false;if(t===null)f=true;else switch(y){case "bigint":case "string":case "number":f=true;break;case "object":switch(t.$$typeof){case de:case xe:f=true;break;case $:return f=t._init,L(f(t._payload),i,o,u,c)}}if(f){f=t,c=c(f);var w=u===""?"."+ue(f,0):u;return Be(c)?(o="",w!=null&&(o=w.replace(Je,"$&/")+"/"),L(c,i,o,"",function(U){return U})):c!=null&&(N(c)&&(c.key!=null&&(f&&f.key===c.key||T(c.key)),o=bt(c,o+(c.key==null||f&&f.key===c.key?"":(""+c.key).replace(Je,"$&/")+"/")+w),u!==""&&f!=null&&N(f)&&f.key==null&&f._store&&!f._store.validated&&(o._store.validated=2),c=o),i.push(c)),1}if(f=0,w=u===""?".":u+":",Be(t))for(var E=0;E<t.length;E++)u=t[E],y=w+ue(u,E),f+=L(u,i,o,y,c);else if(E=n(t),typeof E=="function")for(E===t.entries&&(Ze||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),Ze=true),t=E.call(t),E=0;!(u=t.next()).done;)u=u.value,y=w+ue(u,E++),f+=L(u,i,o,y,c);else if(y==="object"){if(typeof t.then=="function")return L(It(t),i,o,u,c);throw i=String(t),Error("Objects are not valid as a React child (found: "+(i==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":i)+"). If you meant to render a collection of children, use an array instead.")}return f}function Y(t,i,o){if(t==null)return t;var u=[],c=0;return L(t,u,"","",function(y){return i.call(o,y,c++)}),u}function kt(t){if(t._status===-1){var i=t._ioInfo;i!=null&&(i.start=i.end=performance.now()),i=t._result;var o=i();if(o.then(function(c){if(t._status===0||t._status===-1){t._status=1,t._result=c;var y=t._ioInfo;y!=null&&(y.end=performance.now()),o.status===void 0&&(o.status="fulfilled",o.value=c);}},function(c){if(t._status===0||t._status===-1){t._status=2,t._result=c;var y=t._ioInfo;y!=null&&(y.end=performance.now()),o.status===void 0&&(o.status="rejected",o.reason=c);}}),i=t._ioInfo,i!=null){i.value=o;var u=o.displayName;typeof u=="string"&&(i.name=u);}t._status===-1&&(t._status=0,t._result=o);}if(t._status===1)return i=t._result,i===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
1
|
+
var PIH=(function(exports){'use strict';var zo=Object.create;var Qt=Object.defineProperty;var Yo=Object.getOwnPropertyDescriptor;var Ko=Object.getOwnPropertyNames;var Zo=Object.getPrototypeOf,qo=Object.prototype.hasOwnProperty;var Qo=(e,t,r)=>t in e?Qt(e,t,{enumerable:true,configurable:true,writable:true,value:r}):e[t]=r;var Ur=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var V=(e,t)=>()=>(e&&(t=e(e=0)),t);var Br=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Wr=(e,t)=>{for(var r in t)Qt(e,r,{get:t[r],enumerable:true});},Xo=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ko(t))!qo.call(e,i)&&i!==r&&Qt(e,i,{get:()=>t[i],enumerable:!(n=Yo(t,i))||n.enumerable});return e};var $o=(e,t,r)=>(r=e!=null?zo(Zo(e)):{},Xo(Qt(r,"default",{value:e,enumerable:true}),e));var _=(e,t,r)=>Qo(e,typeof t!="symbol"?t+"":t,r);function Ri(e){return e.nodeType===e.ELEMENT_NODE}function lt(e){var t=e?.host;return t?.shadowRoot===e}function ot(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function pa(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),e}function Vr(e){try{var t=e.rules||e.cssRules;return t?pa(Array.from(t).map(jr).join("")):null}catch{return null}}function jr(e){var t=e.cssText;if(ma(e))try{t=Vr(e.styleSheet)||t;}catch{}return t}function ma(e){return "styleSheet"in e}function ir(){return new zr}function Nt(e){var t=e.maskInputOptions,r=e.tagName,n=e.type,i=e.value,s=e.maskInputFn,o=i||"";return (t[r.toLowerCase()]||t[n])&&(s?o=s(o):o="*".repeat(o.length)),o}function ga(e){var t=e.getContext("2d");if(!t)return true;for(var r=50,n=0;n<e.width;n+=r)for(var i=0;i<e.height;i+=r){var s=t.getImageData,o=Ci in s?s[Ci]:s,a=new Uint32Array(o.call(t,n,i,Math.min(r,e.width-n),Math.min(r,e.height-i)).data.buffer);if(a.some(function(l){return l!==0}))return false}return true}function Yr(){return va++}function Ia(e){if(e instanceof HTMLFormElement)return "form";var t=e.tagName.toLowerCase().trim();return ya.test(t)?"div":t}function Sa(e){return e.cssRules?Array.from(e.cssRules).map(function(t){return t.cssText||""}).join(""):""}function ba(e){var t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}function nr(e,t){return (e||"").replace(Ca,function(r,n,i,s,o,a){var l=i||o||a,c=n||s||"";if(!l)return r;if(!wa.test(l)||Ea.test(l))return "url(".concat(c).concat(l).concat(c,")");if(l[0]==="/")return "url(".concat(c).concat(ba(t)+l).concat(c,")");var d=t.split("/"),h=l.split("/");d.pop();for(var f=0,m=h;f<m.length;f++){var g=m[f];g!=="."&&(g===".."?d.pop():d.push(g));}return "url(".concat(c).concat(d.join("/")).concat(c,")")})}function Ra(e,t){if(t.trim()==="")return t;var r=0;function n(c){var d,h=c.exec(t.substring(r));return h?(d=h[0],r+=d.length,d):""}for(var i=[];n(Aa),!(r>=t.length);){var s=n(Ta);if(s.slice(-1)===",")s=yt(e,s.substring(0,s.length-1)),i.push(s);else {var o="";s=yt(e,s);for(var a=false;;){var l=t.charAt(r);if(l===""){i.push((s+o).trim());break}else if(a)l===")"&&(a=false);else if(l===","){r+=1,i.push((s+o).trim());break}else l==="("&&(a=true);o+=l,r+=1;}}}return i.join(", ")}function yt(e,t){if(!t||t.trim()==="")return t;var r=e.createElement("a");return r.href=t,r.href}function ka(e){return !!(e.tagName==="svg"||e.ownerSVGElement)}function Kr(){var e=document.createElement("a");return e.href="",e.href}function Zr(e,t,r,n){return r==="src"||r==="href"&&n&&!(t==="use"&&n[0]==="#")||r==="xlink:href"&&n&&n[0]!=="#"||r==="background"&&n&&(t==="table"||t==="td"||t==="th")?yt(e,n):r==="srcset"&&n?Ra(e,n):r==="style"&&n?nr(n,Kr()):t==="object"&&r==="data"&&n?yt(e,n):n}function Na(e,t,r){if(typeof t=="string"){if(e.classList.contains(t))return true}else for(var n=e.classList.length;n--;){var i=e.classList[n];if(t.test(i))return true}return r?e.matches(r):false}function kt(e,t,r){if(!e)return false;if(e.nodeType!==e.ELEMENT_NODE)return r?kt(e.parentNode,t,r):false;for(var n=e.classList.length;n--;){var i=e.classList[n];if(t.test(i))return true}return r?kt(e.parentNode,t,r):false}function qr(e,t,r){var n=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(n===null)return false;if(typeof t=="string"){if(n.classList.contains(t)||n.closest(".".concat(t)))return true}else if(kt(n,t,true))return true;return !!(r&&(n.matches(r)||n.closest(r)))}function _a(e,t,r){var n=e.contentWindow;if(n){var i=false,s;try{s=n.document.readyState;}catch{return}if(s!=="complete"){var o=setTimeout(function(){i||(t(),i=true);},r);e.addEventListener("load",function(){clearTimeout(o),i=true,t();});return}var a="about:blank";if(n.location.href!==a||e.src===a||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t);}}function Ma(e,t,r){var n=false,i;try{i=e.sheet;}catch{return}if(!i){var s=setTimeout(function(){n||(t(),n=true);},r);e.addEventListener("load",function(){clearTimeout(s),n=true,t();});}}function Oa(e,t){var r=t.doc,n=t.mirror,i=t.blockClass,s=t.blockSelector,o=t.maskTextClass,a=t.maskTextSelector,l=t.inlineStylesheet,c=t.maskInputOptions,d=c===void 0?{}:c,h=t.maskTextFn,f=t.maskInputFn,m=t.dataURLOptions,g=m===void 0?{}:m,I=t.inlineImages,C=t.recordCanvas,y=t.keepIframeSrcFn,v=t.newlyAddedElement,S=v===void 0?false:v,T=xa(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:te.Document,childNodes:[],compatMode:e.compatMode}:{type:te.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return {type:te.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:T};case e.ELEMENT_NODE:return La(e,{doc:r,blockClass:i,blockSelector:s,inlineStylesheet:l,maskInputOptions:d,maskInputFn:f,dataURLOptions:g,inlineImages:I,recordCanvas:C,keepIframeSrcFn:y,newlyAddedElement:S,rootId:T});case e.TEXT_NODE:return Da(e,{maskTextClass:o,maskTextSelector:a,maskTextFn:h,rootId:T});case e.CDATA_SECTION_NODE:return {type:te.CDATA,textContent:"",rootId:T};case e.COMMENT_NODE:return {type:te.Comment,textContent:e.textContent||"",rootId:T};default:return false}}function xa(e,t){if(t.hasNode(e)){var r=t.getId(e);return r===1?void 0:r}}function Da(e,t){var r,n=t.maskTextClass,i=t.maskTextSelector,s=t.maskTextFn,o=t.rootId,a=e.parentNode&&e.parentNode.tagName,l=e.textContent,c=a==="STYLE"?true:void 0,d=a==="SCRIPT"?true:void 0;if(c&&l){try{e.nextSibling||e.previousSibling||!((r=e.parentNode.sheet)===null||r===void 0)&&r.cssRules&&(l=Sa(e.parentNode.sheet));}catch(h){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(h),e);}l=nr(l,Kr());}return d&&(l="SCRIPT_PLACEHOLDER"),!c&&!d&&l&&qr(e,n,i)&&(l=s?s(l):l.replace(/[\S]/g,"*")),{type:te.Text,textContent:l||"",isStyle:c,rootId:o}}function La(e,t){for(var r=t.doc,n=t.blockClass,i=t.blockSelector,s=t.inlineStylesheet,o=t.maskInputOptions,a=o===void 0?{}:o,l=t.maskInputFn,c=t.dataURLOptions,d=c===void 0?{}:c,h=t.inlineImages,f=t.recordCanvas,m=t.keepIframeSrcFn,g=t.newlyAddedElement,I=g===void 0?false:g,C=t.rootId,y=Na(e,n,i),v=Ia(e),S={},T=e.attributes.length,L=0;L<T;L++){var O=e.attributes[L];S[O.name]=Zr(r,v,O.name,O.value);}if(v==="link"&&s){var P=Array.from(r.styleSheets).find(function(b){return b.href===e.href}),A=null;P&&(A=Vr(P)),A&&(delete S.rel,delete S.href,S._cssText=nr(A,P.href));}if(v==="style"&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){var A=Vr(e.sheet);A&&(S._cssText=nr(A,Kr()));}if(v==="input"||v==="textarea"||v==="select"){var oe=e.value,F=e.checked;S.type!=="radio"&&S.type!=="checkbox"&&S.type!=="submit"&&S.type!=="button"&&oe?S.value=Nt({type:S.type,tagName:v,value:oe,maskInputOptions:a,maskInputFn:l}):F&&(S.checked=F);}if(v==="option"&&(e.selected&&!a.select?S.selected=true:delete S.selected),v==="canvas"&&f){if(e.__context==="2d")ga(e)||(S.rr_dataURL=e.toDataURL(d.type,d.quality));else if(!("__context"in e)){var de=e.toDataURL(d.type,d.quality),z=document.createElement("canvas");z.width=e.width,z.height=e.height;var Q=z.toDataURL(d.type,d.quality);de!==Q&&(S.rr_dataURL=de);}}if(v==="img"&&h){vt||(vt=r.createElement("canvas"),wi=vt.getContext("2d"));var W=e,J=W.crossOrigin;W.crossOrigin="anonymous";var j=function(){try{vt.width=W.naturalWidth,vt.height=W.naturalHeight,wi.drawImage(W,0,0),S.rr_dataURL=vt.toDataURL(d.type,d.quality);}catch(b){console.warn("Cannot inline img src=".concat(W.currentSrc,"! Error: ").concat(b));}J?S.crossOrigin=J:W.removeAttribute("crossorigin");};W.complete&&W.naturalWidth!==0?j():W.onload=j;}if((v==="audio"||v==="video")&&(S.rr_mediaState=e.paused?"paused":"played",S.rr_mediaCurrentTime=e.currentTime),I||(e.scrollLeft&&(S.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(S.rr_scrollTop=e.scrollTop)),y){var U=e.getBoundingClientRect(),se=U.width,w=U.height;S={class:S.class,rr_width:"".concat(se,"px"),rr_height:"".concat(w,"px")};}return v==="iframe"&&!m(S.src)&&(e.contentDocument||(S.rr_src=S.src),delete S.src),{type:te.Element,tagName:v,attributes:S,childNodes:[],isSVG:ka(e)||void 0,needBlock:y,rootId:C}}function fe(e){return e===void 0?"":e.toLowerCase()}function Fa(e,t){if(t.comment&&e.type===te.Comment)return true;if(e.type===te.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&e.attributes.rel==="preload"&&e.attributes.as==="script"||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&e.attributes.href.endsWith(".js")))return true;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(fe(e.attributes.name).match(/^msapplication-tile(image|color)$/)||fe(e.attributes.name)==="application-name"||fe(e.attributes.rel)==="icon"||fe(e.attributes.rel)==="apple-touch-icon"||fe(e.attributes.rel)==="shortcut icon")))return true;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&fe(e.attributes.name).match(/^description|keywords$/))return true;if(t.headMetaSocial&&(fe(e.attributes.property).match(/^(og|twitter|fb):/)||fe(e.attributes.name).match(/^(og|twitter):/)||fe(e.attributes.name)==="pinterest"))return true;if(t.headMetaRobots&&(fe(e.attributes.name)==="robots"||fe(e.attributes.name)==="googlebot"||fe(e.attributes.name)==="bingbot"))return true;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return true;if(t.headMetaAuthorship&&(fe(e.attributes.name)==="author"||fe(e.attributes.name)==="generator"||fe(e.attributes.name)==="framework"||fe(e.attributes.name)==="publisher"||fe(e.attributes.name)==="progid"||fe(e.attributes.property).match(/^article:/)||fe(e.attributes.property).match(/^product:/)))return true;if(t.headMetaVerification&&(fe(e.attributes.name)==="google-site-verification"||fe(e.attributes.name)==="yandex-verification"||fe(e.attributes.name)==="csrf-token"||fe(e.attributes.name)==="p:domain_verify"||fe(e.attributes.name)==="verify-v1"||fe(e.attributes.name)==="verification"||fe(e.attributes.name)==="shopify-checkout-api-token"))return true}}return false}function st(e,t){var r=t.doc,n=t.mirror,i=t.blockClass,s=t.blockSelector,o=t.maskTextClass,a=t.maskTextSelector,l=t.skipChild,c=l===void 0?false:l,d=t.inlineStylesheet,h=d===void 0?true:d,f=t.maskInputOptions,m=f===void 0?{}:f,g=t.maskTextFn,I=t.maskInputFn,C=t.slimDOMOptions,y=t.dataURLOptions,v=y===void 0?{}:y,S=t.inlineImages,T=S===void 0?false:S,L=t.recordCanvas,O=L===void 0?false:L,P=t.onSerialize,A=t.onIframeLoad,oe=t.iframeLoadTimeout,F=oe===void 0?5e3:oe,de=t.onStylesheetLoad,z=t.stylesheetLoadTimeout,Q=z===void 0?5e3:z,W=t.keepIframeSrcFn,J=W===void 0?function(){return false}:W,j=t.newlyAddedElement,U=j===void 0?false:j,se=t.preserveWhiteSpace,w=se===void 0?true:se,b=Oa(e,{doc:r,mirror:n,blockClass:i,blockSelector:s,maskTextClass:o,maskTextSelector:a,inlineStylesheet:h,maskInputOptions:m,maskTextFn:g,maskInputFn:I,dataURLOptions:v,inlineImages:T,recordCanvas:O,keepIframeSrcFn:J,newlyAddedElement:U});if(!b)return console.warn(e,"not serialized"),null;var x;n.hasNode(e)?x=n.getId(e):Fa(b,C)||!w&&b.type===te.Text&&!b.isStyle&&!b.textContent.replace(/^\s+|\s+$/gm,"").length?x=at:x=Yr();var M=Object.assign(b,{id:x});if(n.add(e,M),x===at)return null;P&&P(e);var K=!c;if(M.type===te.Element){K=K&&!M.needBlock,delete M.needBlock;var ie=e.shadowRoot;ie&&ot(ie)&&(M.isShadowHost=true);}if((M.type===te.Document||M.type===te.Element)&&K){C.headWhitespace&&M.type===te.Element&&M.tagName==="head"&&(w=false);for(var he={doc:r,mirror:n,blockClass:i,blockSelector:s,maskTextClass:o,maskTextSelector:a,skipChild:c,inlineStylesheet:h,maskInputOptions:m,maskTextFn:g,maskInputFn:I,slimDOMOptions:C,dataURLOptions:v,inlineImages:T,recordCanvas:O,preserveWhiteSpace:w,onSerialize:P,onIframeLoad:A,iframeLoadTimeout:F,onStylesheetLoad:de,stylesheetLoadTimeout:Q,keepIframeSrcFn:J},B=0,pe=Array.from(e.childNodes);B<pe.length;B++){var le=pe[B],ce=st(le,he);ce&&M.childNodes.push(ce);}if(Ri(e)&&e.shadowRoot)for(var Ee=0,ee=Array.from(e.shadowRoot.childNodes);Ee<ee.length;Ee++){var le=ee[Ee],ce=st(le,he);ce&&(ot(e.shadowRoot)&&(ce.isShadow=true),M.childNodes.push(ce));}}return e.parentNode&<(e.parentNode)&&ot(e.parentNode)&&(M.isShadow=true),M.type===te.Element&&M.tagName==="iframe"&&_a(e,function(){var we=e.contentDocument;if(we&&A){var $e=st(we,{doc:we,mirror:n,blockClass:i,blockSelector:s,maskTextClass:o,maskTextSelector:a,skipChild:false,inlineStylesheet:h,maskInputOptions:m,maskTextFn:g,maskInputFn:I,slimDOMOptions:C,dataURLOptions:v,inlineImages:T,recordCanvas:O,preserveWhiteSpace:w,onSerialize:P,onIframeLoad:A,iframeLoadTimeout:F,onStylesheetLoad:de,stylesheetLoadTimeout:Q,keepIframeSrcFn:J});$e&&A(e,$e);}},F),M.type===te.Element&&M.tagName==="link"&&M.attributes.rel==="stylesheet"&&Ma(e,function(){if(de){var we=st(e,{doc:r,mirror:n,blockClass:i,blockSelector:s,maskTextClass:o,maskTextSelector:a,skipChild:false,inlineStylesheet:h,maskInputOptions:m,maskTextFn:g,maskInputFn:I,slimDOMOptions:C,dataURLOptions:v,inlineImages:T,recordCanvas:O,preserveWhiteSpace:w,onSerialize:P,onIframeLoad:A,iframeLoadTimeout:F,onStylesheetLoad:de,stylesheetLoadTimeout:Q,keepIframeSrcFn:J});we&&de(e,we);}},Q),M}function ki(e,t){var r=t||{},n=r.mirror,i=n===void 0?new zr:n,s=r.blockClass,o=s===void 0?"rr-block":s,a=r.blockSelector,l=a===void 0?null:a,c=r.maskTextClass,d=c===void 0?"rr-mask":c,h=r.maskTextSelector,f=h===void 0?null:h,m=r.inlineStylesheet,g=m===void 0?true:m,I=r.inlineImages,C=I===void 0?false:I,y=r.recordCanvas,v=y===void 0?false:y,S=r.maskAllInputs,T=S===void 0?false:S,L=r.maskTextFn,O=r.maskInputFn,P=r.slimDOM,A=P===void 0?false:P,oe=r.dataURLOptions,F=r.preserveWhiteSpace,de=r.onSerialize,z=r.onIframeLoad,Q=r.iframeLoadTimeout,W=r.onStylesheetLoad,J=r.stylesheetLoadTimeout,j=r.keepIframeSrcFn,U=j===void 0?function(){return false}:j,se=T===true?{color:true,date:true,"datetime-local":true,email:true,month:true,number:true,range:true,search:true,tel:true,text:true,time:true,url:true,week:true,textarea:true,select:true,password:true}:T===false?{password:true}:T,w=A===true||A==="all"?{script:true,comment:true,headFavicon:true,headWhitespace:true,headMetaDescKeywords:A==="all",headMetaSocial:true,headMetaRobots:true,headMetaHttpEquiv:true,headMetaAuthorship:true,headMetaVerification:true}:A===false?{}:A;return st(e,{doc:e,mirror:i,blockClass:o,blockSelector:l,maskTextClass:d,maskTextSelector:f,skipChild:false,inlineStylesheet:g,maskInputOptions:se,maskTextFn:L,maskInputFn:O,slimDOMOptions:w,dataURLOptions:oe,inlineImages:C,recordCanvas:v,preserveWhiteSpace:F,onSerialize:de,onIframeLoad:z,iframeLoadTimeout:Q,onStylesheetLoad:W,stylesheetLoadTimeout:J,keepIframeSrcFn:U,newlyAddedElement:false})}function Pa(e,t){t===void 0&&(t={});var r=1,n=1;function i(w){var b=w.match(/\n/g);b&&(r+=b.length);var x=w.lastIndexOf(`
|
|
2
|
+
`);n=x===-1?n+w.length:w.length-x;}function s(){var w={line:r,column:n};return function(b){return b.position=new o(w),g(),b}}var o=(function(){function w(b){this.start=b,this.end={line:r,column:n},this.source=t.source;}return w})();o.prototype.content=e;var a=[];function l(w){var b=new Error("".concat(t.source||"",":").concat(r,":").concat(n,": ").concat(w));if(b.reason=w,b.filename=t.source,b.line=r,b.column=n,b.source=e,t.silent)a.push(b);else throw b}function c(){var w=f();return {type:"stylesheet",stylesheet:{source:t.source,rules:w,parsingErrors:a}}}function d(){return m(/^{\s*/)}function h(){return m(/^}/)}function f(){var w,b=[];for(g(),I(b);e.length&&e.charAt(0)!=="}"&&(w=U()||se());)w!==false&&(b.push(w),I(b));return b}function m(w){var b=w.exec(e);if(b){var x=b[0];return i(x),e=e.slice(x.length),b}}function g(){m(/^\s*/);}function I(w){w===void 0&&(w=[]);for(var b;b=C();)b!==false&&w.push(b),b=C();return w}function C(){var w=s();if(!(e.charAt(0)!=="/"||e.charAt(1)!=="*")){for(var b=2;e.charAt(b)!==""&&(e.charAt(b)!=="*"||e.charAt(b+1)!=="/");)++b;if(b+=2,e.charAt(b-1)==="")return l("End of comment missing");var x=e.slice(2,b-2);return n+=2,i(x),e=e.slice(b),n+=2,w({type:"comment",comment:x})}}function y(){var w=m(/^([^{]+)/);if(w)return ze(w[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,function(b){return b.replace(/,/g,"\u200C")}).split(/\s*(?![^(]*\)),\s*/).map(function(b){return b.replace(/\u200C/g,",")})}function v(){var w=s(),b=m(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(b){var x=ze(b[0]);if(!m(/^:\s*/))return l("property missing ':'");var M=m(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),K=w({type:"declaration",property:x.replace(Ei,""),value:M?ze(M[0]).replace(Ei,""):""});return m(/^[;\s]*/),K}}function S(){var w=[];if(!d())return l("missing '{'");I(w);for(var b;b=v();)b!==false&&(w.push(b),I(w)),b=v();return h()?w:l("missing '}'")}function T(){for(var w,b=[],x=s();w=m(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)b.push(w[1]),m(/^,\s*/);if(b.length)return x({type:"keyframe",values:b,declarations:S()})}function L(){var w=s(),b=m(/^@([-\w]+)?keyframes\s*/);if(b){var x=b[1];if(b=m(/^([-\w]+)\s*/),!b)return l("@keyframes missing name");var M=b[1];if(!d())return l("@keyframes missing '{'");for(var K,ie=I();K=T();)ie.push(K),ie=ie.concat(I());return h()?w({type:"keyframes",name:M,vendor:x,keyframes:ie}):l("@keyframes missing '}'")}}function O(){var w=s(),b=m(/^@supports *([^{]+)/);if(b){var x=ze(b[1]);if(!d())return l("@supports missing '{'");var M=I().concat(f());return h()?w({type:"supports",supports:x,rules:M}):l("@supports missing '}'")}}function P(){var w=s(),b=m(/^@host\s*/);if(b){if(!d())return l("@host missing '{'");var x=I().concat(f());return h()?w({type:"host",rules:x}):l("@host missing '}'")}}function A(){var w=s(),b=m(/^@media *([^{]+)/);if(b){var x=ze(b[1]);if(!d())return l("@media missing '{'");var M=I().concat(f());return h()?w({type:"media",media:x,rules:M}):l("@media missing '}'")}}function oe(){var w=s(),b=m(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(b)return w({type:"custom-media",name:ze(b[1]),media:ze(b[2])})}function F(){var w=s(),b=m(/^@page */);if(b){var x=y()||[];if(!d())return l("@page missing '{'");for(var M=I(),K;K=v();)M.push(K),M=M.concat(I());return h()?w({type:"page",selectors:x,declarations:M}):l("@page missing '}'")}}function de(){var w=s(),b=m(/^@([-\w]+)?document *([^{]+)/);if(b){var x=ze(b[1]),M=ze(b[2]);if(!d())return l("@document missing '{'");var K=I().concat(f());return h()?w({type:"document",document:M,vendor:x,rules:K}):l("@document missing '}'")}}function z(){var w=s(),b=m(/^@font-face\s*/);if(b){if(!d())return l("@font-face missing '{'");for(var x=I(),M;M=v();)x.push(M),x=x.concat(I());return h()?w({type:"font-face",declarations:x}):l("@font-face missing '}'")}}var Q=j("import"),W=j("charset"),J=j("namespace");function j(w){var b=new RegExp("^@"+w+"\\s*([^;]+);");return function(){var x=s(),M=m(b);if(M){var K={type:w};return K[w]=M[1].trim(),x(K)}}}function U(){if(e[0]==="@")return L()||A()||oe()||O()||Q()||W()||J()||de()||F()||P()||z()}function se(){var w=s(),b=y();return b?(I(),w({type:"rule",selectors:b,declarations:S()})):l("selector missing")}return Gr(c())}function ze(e){return e?e.replace(/^\s+|\s+$/g,""):""}function Gr(e,t){for(var r=e&&typeof e.type=="string",n=r?e:t,i=0,s=Object.keys(e);i<s.length;i++){var o=s[i],a=e[o];Array.isArray(a)?a.forEach(function(l){Gr(l,n);}):a&&typeof a=="object"&&Gr(a,n);}return r&&Object.defineProperty(e,"parent",{configurable:true,writable:true,enumerable:false,value:t||null}),e}function Ua(e){var t=Ti[e.tagName]?Ti[e.tagName]:e.tagName;return t==="link"&&e.attributes._cssText&&(t="style"),t}function Ba(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ai(e,t){var r=t?.stylesWithHoverClass.get(e);if(r)return r;var n=Pa(e,{silent:true});if(!n.stylesheet)return e;var i=[];if(n.stylesheet.rules.forEach(function(a){"selectors"in a&&(a.selectors||[]).forEach(function(l){Ni.test(l)&&i.push(l);});}),i.length===0)return e;var s=new RegExp(i.filter(function(a,l){return i.indexOf(a)===l}).sort(function(a,l){return l.length-a.length}).map(function(a){return Ba(a)}).join("|"),"g"),o=e.replace(s,function(a){var l=a.replace(Wa,"$1.\\:hover");return "".concat(a,", ").concat(l)});return t?.stylesWithHoverClass.set(e,o),o}function Qr(){var e=new Map;return {stylesWithHoverClass:e}}function Ha(e,t){var r=t.doc,n=t.hackCss,i=t.cache;switch(e.type){case te.Document:return r.implementation.createDocument(null,"",null);case te.DocumentType:return r.implementation.createDocumentType(e.name||"html",e.publicId,e.systemId);case te.Element:{var s=Ua(e),o;e.isSVG?o=r.createElementNS("http://www.w3.org/2000/svg",s):o=r.createElement(s);var a={};for(var l in e.attributes)if(Object.prototype.hasOwnProperty.call(e.attributes,l)){var c=e.attributes[l];if(!(s==="option"&&l==="selected"&&c===false)){if(c===true&&(c=""),l.startsWith("rr_")){a[l]=c;continue}var d=s==="textarea"&&l==="value",h=s==="style"&&l==="_cssText";if(h&&n&&typeof c=="string"&&(c=Ai(c,i)),(d||h)&&typeof c=="string"){for(var f=r.createTextNode(c),m=0,g=Array.from(o.childNodes);m<g.length;m++){var I=g[m];I.nodeType===o.TEXT_NODE&&o.removeChild(I);}o.appendChild(f);continue}try{if(e.isSVG&&l==="xlink:href")o.setAttributeNS("http://www.w3.org/1999/xlink",l,c.toString());else if(l==="onload"||l==="onclick"||l.substring(0,7)==="onmouse")o.setAttribute("_"+l,c.toString());else if(s==="meta"&&e.attributes["http-equiv"]==="Content-Security-Policy"&&l==="content"){o.setAttribute("csp-content",c.toString());continue}else s==="link"&&e.attributes.rel==="preload"&&e.attributes.as==="script"||s==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&e.attributes.href.endsWith(".js")||(s==="img"&&e.attributes.srcset&&e.attributes.rr_dataURL?o.setAttribute("rrweb-original-srcset",e.attributes.srcset):o.setAttribute(l,c.toString()));}catch{}}}var C=function(v){var S=a[v];if(s==="canvas"&&v==="rr_dataURL"){var T=document.createElement("img");T.onload=function(){var O=o.getContext("2d");O&&O.drawImage(T,0,0,T.width,T.height);},T.src=S.toString(),o.RRNodeType&&(o.rr_dataURL=S.toString());}else if(s==="img"&&v==="rr_dataURL"){var L=o;L.currentSrc.startsWith("data:")||(L.setAttribute("rrweb-original-src",e.attributes.src),L.src=S.toString());}if(v==="rr_width")o.style.width=S.toString();else if(v==="rr_height")o.style.height=S.toString();else if(v==="rr_mediaCurrentTime"&&typeof S=="number")o.currentTime=S;else if(v==="rr_mediaState")switch(S){case "played":o.play().catch(function(O){return console.warn("media playback error",O)});break;case "paused":o.pause();break}};for(var y in a)C(y);if(e.isShadowHost)if(!o.shadowRoot)o.attachShadow({mode:"open"});else for(;o.shadowRoot.firstChild;)o.shadowRoot.removeChild(o.shadowRoot.firstChild);return o}case te.Text:return r.createTextNode(e.isStyle&&n?Ai(e.textContent,i):e.textContent);case te.CDATA:return r.createCDATASection(e.textContent);case te.Comment:return r.createComment(e.textContent);default:return null}}function It(e,t){var r=t.doc,n=t.mirror,i=t.skipChild,s=i===void 0?false:i,o=t.hackCss,a=o===void 0?true:o,l=t.afterAppend,c=t.cache,d=Ha(e,{doc:r,hackCss:a,cache:c});if(!d)return null;if(e.rootId&&n.getNode(e.rootId)!==r&&n.replace(e.rootId,r),e.type===te.Document&&(r.close(),r.open(),e.compatMode==="BackCompat"&&e.childNodes&&e.childNodes[0].type!==te.DocumentType&&(e.childNodes[0].type===te.Element&&"xmlns"in e.childNodes[0].attributes&&e.childNodes[0].attributes.xmlns==="http://www.w3.org/1999/xhtml"?r.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'):r.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">')),d=r),n.add(d,e),(e.type===te.Document||e.type===te.Element)&&!s)for(var h=0,f=e.childNodes;h<f.length;h++){var m=f[h],g=It(m,{doc:r,mirror:n,skipChild:false,hackCss:a,afterAppend:l,cache:c});if(!g){console.warn("Failed to rebuild",m);continue}m.isShadow&&Ri(d)&&d.shadowRoot?d.shadowRoot.appendChild(g):d.appendChild(g),l&&l(g,m.id);}return d}function Va(e,t){function r(o){t(o);}for(var n=0,i=e.getIds();n<i.length;n++){var s=i[n];e.has(s)&&r(e.getNode(s));}}function Ga(e,t){var r=t.getMeta(e);if(r?.type===te.Element){var n=e;for(var i in r.attributes)if(Object.prototype.hasOwnProperty.call(r.attributes,i)&&i.startsWith("rr_")){var s=r.attributes[i];i==="rr_scrollLeft"&&(n.scrollLeft=s),i==="rr_scrollTop"&&(n.scrollTop=s);}}}function _i(e,t){var r=t.doc,n=t.onVisit,i=t.hackCss,s=i===void 0?true:i,o=t.afterAppend,a=t.cache,l=t.mirror,c=l===void 0?new zr:l,d=It(e,{doc:r,mirror:c,skipChild:false,hackCss:s,afterAppend:o,cache:a});return Va(c,function(h){n&&n(h),Ga(h,c);}),d}var te,zr,Ci,va,ya,at,vt,wi,Ca,wa,Ea,Ta,Aa,Ei,Ti,Ni,Wa,Ye=V(()=>{(function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment";})(te||(te={}));zr=(function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap;}return e.prototype.getId=function(t){var r;if(!t)return -1;var n=(r=this.getMeta(t))===null||r===void 0?void 0:r.id;return n??-1},e.prototype.getNode=function(t){return this.idNodeMap.get(t)||null},e.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},e.prototype.getMeta=function(t){return this.nodeMetaMap.get(t)||null},e.prototype.removeNodeFromMap=function(t){var r=this,n=this.getId(t);this.idNodeMap.delete(n),t.childNodes&&t.childNodes.forEach(function(i){return r.removeNodeFromMap(i)});},e.prototype.has=function(t){return this.idNodeMap.has(t)},e.prototype.hasNode=function(t){return this.nodeMetaMap.has(t)},e.prototype.add=function(t,r){var n=r.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,r);},e.prototype.replace=function(t,r){var n=this.getNode(t);if(n){var i=this.nodeMetaMap.get(n);i&&this.nodeMetaMap.set(r,i);}this.idNodeMap.set(t,r);},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap;},e})();Ci="__rrweb_original__";va=1,ya=new RegExp("[^a-z0-9-_:]"),at=-2;Ca=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,wa=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,Ea=/^(data:)([^,]*),(.*)/i;Ta=/^[^ \t\n\r\u000c]+/,Aa=/^[, \t\n\r\u000c]+/;Ei=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;Ti={script:"noscript",altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};Ni=/([^\\]):hover/,Wa=new RegExp(Ni.source,"g");});var en={};Wr(en,{StyleSheetMirror:()=>ct,_mirror:()=>_t,getBaseDimension:()=>lr,getNestedRule:()=>dt,getPositionsAndIndex:()=>cr,getWindowHeight:()=>Mt,getWindowWidth:()=>Ot,hasShadowRoot:()=>Ve,hookSetter:()=>et,isAncestorRemoved:()=>sr,isBlocked:()=>Ie,isIgnored:()=>xt,isSerialized:()=>Xr,isSerializedIframe:()=>Ke,isSerializedStylesheet:()=>Lt,isTouchEvent:()=>or,iterateResolveTree:()=>ar,on:()=>Ae,patch:()=>_e,polyfill:()=>Dt,queueToResolveTrees:()=>$r,throttle:()=>ut,uniqueTextMutations:()=>Jr});function Ae(e,t,r=document){let n={capture:true,passive:true};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}function ut(e,t,r={}){let n=null,i=0;return function(...s){let o=Date.now();!i&&r.leading===false&&(i=o);let a=t-(o-i),l=this;a<=0||a>t?(n&&(clearTimeout(n),n=null),i=o,e.apply(l,s)):!n&&r.trailing!==false&&(n=setTimeout(()=>{i=r.leading===false?0:Date.now(),n=null,e.apply(l,s);},a));}}function et(e,t,r,n,i=window){let s=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,n?r:{set(o){setTimeout(()=>{r.set.call(this,o);},0),s&&s.set&&s.set.call(this,o);}}),()=>et(e,t,s||{},true)}function _e(e,t,r){try{if(!(t in e))return ()=>{};let n=e[t],i=r(n);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=i,()=>{e[t]=n;}}catch{return ()=>{}}}function Mt(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Ot(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Ie(e,t,r,n){if(!e)return false;let i=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(!i)return false;if(typeof t=="string"){if(i.classList.contains(t)||n&&i.closest("."+t)!==null)return true}else if(kt(i,t,n))return true;return !!(r&&(e.matches(r)||n&&i.closest(r)!==null))}function Xr(e,t){return t.getId(e)!==-1}function xt(e,t){return t.getId(e)===at}function sr(e,t){if(lt(e))return false;let r=t.getId(e);return t.has(r)?e.parentNode&&e.parentNode.nodeType===e.DOCUMENT_NODE?false:e.parentNode?sr(e.parentNode,t):true:true}function or(e){return !!e.changedTouches}function Dt(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...t)=>{let r=t[0];if(!(0 in t))throw new TypeError("1 argument is required");do if(this===r)return true;while(r=r&&r.parentNode);return false});}function $r(e){let t={},r=(i,s)=>{let o={value:i,parent:s,children:[]};return t[i.node.id]=o,o},n=[];for(let i of e){let{nextId:s,parentId:o}=i;if(s&&s in t){let a=t[s];if(a.parent){let l=a.parent.children.indexOf(a);a.parent.children.splice(l,0,r(i,a.parent));}else {let l=n.indexOf(a);n.splice(l,0,r(i,null));}continue}if(o in t){let a=t[o];a.children.push(r(i,a));continue}n.push(r(i,null));}return n}function ar(e,t){t(e.value);for(let r=e.children.length-1;r>=0;r--)ar(e.children[r],t);}function Ke(e,t){return !!(e.nodeName==="IFRAME"&&t.getMeta(e))}function Lt(e,t){return !!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function lr(e,t){var r,n;let i=(n=(r=e.ownerDocument)===null||r===void 0?void 0:r.defaultView)===null||n===void 0?void 0:n.frameElement;if(!i||i===t)return {x:0,y:0,relativeScale:1,absoluteScale:1};let s=i.getBoundingClientRect(),o=lr(i,t),a=s.height/i.clientHeight;return {x:s.x*o.relativeScale+o.x,y:s.y*o.relativeScale+o.y,relativeScale:a,absoluteScale:o.absoluteScale*a}}function Ve(e){return !!e?.shadowRoot}function dt(e,t){let r=e[t[0]];return t.length===1?r:dt(r.cssRules[t[1]].cssRules,t.slice(2))}function cr(e){let t=[...e],r=t.pop();return {positions:t,index:r}}function Jr(e){let t=new Set,r=[];for(let n=e.length;n--;){let i=e[n];t.has(i.id)||(r.push(i),t.add(i.id));}return r}var St,_t,ct,Me=V(()=>{Ye();St=`Please stop import mirror directly. Instead of that,\r
|
|
3
|
+
now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
|
|
4
|
+
or you can use record.mirror to access the mirror instance during recording.`,_t={map:{},getId(){return console.error(St),-1},getNode(){return console.error(St),null},removeNodeFromMap(){console.error(St);},has(){return console.error(St),false},reset(){console.error(St);}};typeof window<"u"&&window.Proxy&&window.Reflect&&(_t=new Proxy(_t,{get(e,t,r){return t==="map"&&console.error(St),Reflect.get(e,t,r)}}));ct=class{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map;}getId(t){var r;return (r=this.styleIDMap.get(t))!==null&&r!==void 0?r:-1}has(t){return this.styleIDMap.has(t)}add(t,r){if(this.has(t))return this.getId(t);let n;return r===void 0?n=this.id++:n=r,this.styleIDMap.set(t,n),this.idStyleMap.set(n,t),n}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1;}generateId(){return this.id++}};});var N,k,be,Oe,ne,xe=V(()=>{N=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(N||{}),k=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e))(k||{}),be=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(be||{}),Oe=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Oe||{}),ne=(e=>(e.Start="start",e.Pause="pause",e.Resume="resume",e.Resize="resize",e.Finish="finish",e.FullsnapshotRebuilded="fullsnapshot-rebuilded",e.LoadStylesheetStart="load-stylesheet-start",e.LoadStylesheetEnd="load-stylesheet-end",e.SkipStart="skip-start",e.SkipEnd="skip-end",e.MouseInteraction="mouse-interaction",e.EventCast="event-cast",e.CustomEvent="custom-event",e.Flush="flush",e.StateChange="state-change",e.PlayBack="play-back",e.Destroy="destroy",e))(ne||{});});function Mi(e){return "__ln"in e}function rn(e,t){e.delete(t),t.childNodes.forEach(r=>rn(e,r));}function xi(e,t,r){return e.length===0?false:Li(e,t,r)}function Li(e,t,r){let{parentNode:n}=t;if(!n)return false;let i=r.getId(n);return e.some(s=>s.id===i)?true:Li(e,n,r)}function Di(e,t){return e.size===0?false:Fi(e,t)}function Fi(e,t){let{parentNode:r}=t;return r?e.has(r)?true:Fi(e,r):false}var tn,Oi,ur,Pi=V(()=>{Ye();Me();tn=class{constructor(){this.length=0,this.head=null;}get(t){if(t>=this.length)throw new Error("Position outside of list range");let r=this.head;for(let n=0;n<t;n++)r=r?.next||null;return r}addNode(t){let r={value:t,previous:null,next:null};if(t.__ln=r,t.previousSibling&&Mi(t.previousSibling)){let n=t.previousSibling.__ln.next;r.next=n,r.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=r,n&&(n.previous=r);}else if(t.nextSibling&&Mi(t.nextSibling)&&t.nextSibling.__ln.previous){let n=t.nextSibling.__ln.previous;r.previous=n,r.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=r,n&&(n.next=r);}else this.head&&(this.head.previous=r),r.next=this.head,this.head=r;this.length++;}removeNode(t){let r=t.__ln;this.head&&(r.previous?(r.previous.next=r.next,r.next&&(r.next.previous=r.previous)):(this.head=r.next,this.head&&(this.head.previous=null)),t.__ln&&delete t.__ln,this.length--);}},Oi=(e,t)=>`${e}@${t}`,ur=class{constructor(){this.frozen=false,this.locked=false,this.texts=[],this.attributes=[],this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=t=>{t.forEach(this.processMutation),this.emit();},this.emit=()=>{if(this.frozen||this.locked)return;let t=[],r=new tn,n=a=>{let l=a,c=at;for(;c===at;)l=l&&l.nextSibling,c=l&&this.mirror.getId(l);return c},i=a=>{var l,c,d,h;let f=null;((c=(l=a.getRootNode)===null||l===void 0?void 0:l.call(a))===null||c===void 0?void 0:c.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&a.getRootNode().host&&(f=a.getRootNode().host);let m=f;for(;((h=(d=m?.getRootNode)===null||d===void 0?void 0:d.call(m))===null||h===void 0?void 0:h.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&m.getRootNode().host;)m=m.getRootNode().host;let g=!this.doc.contains(a)&&(!m||!this.doc.contains(m));if(!a.parentNode||g)return;let I=lt(a.parentNode)?this.mirror.getId(f):this.mirror.getId(a.parentNode),C=n(a);if(I===-1||C===-1)return r.addNode(a);let y=st(a,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:true,newlyAddedElement:true,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:v=>{Ke(v,this.mirror)&&this.iframeManager.addIframe(v),Lt(v,this.mirror)&&this.stylesheetManager.trackLinkElement(v),Ve(a)&&this.shadowDomManager.addShadowRoot(a.shadowRoot,this.doc);},onIframeLoad:(v,S)=>{this.iframeManager.attachIframe(v,S),this.shadowDomManager.observeAttachShadow(v);},onStylesheetLoad:(v,S)=>{this.stylesheetManager.attachLinkElement(v,S);}});y&&t.push({parentId:I,nextId:C,node:y});};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let a of Array.from(this.movedSet.values()))xi(this.removes,a,this.mirror)&&!this.movedSet.has(a.parentNode)||i(a);for(let a of Array.from(this.addedSet.values()))!Di(this.droppedSet,a)&&!xi(this.removes,a,this.mirror)||Di(this.movedSet,a)?i(a):this.droppedSet.add(a);let s=null;for(;r.length;){let a=null;if(s){let l=this.mirror.getId(s.value.parentNode),c=n(s.value);l!==-1&&c!==-1&&(a=s);}if(!a)for(let l=r.length-1;l>=0;l--){let c=r.get(l);if(c){let d=this.mirror.getId(c.value.parentNode);if(n(c.value)===-1)continue;if(d!==-1){a=c;break}else {let f=c.value;if(f.parentNode&&f.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let m=f.parentNode.host;if(this.mirror.getId(m)!==-1){a=c;break}}}}}if(!a){for(;r.head;)r.removeNode(r.head.value);break}s=a.previous,r.removeNode(a.value),i(a.value);}let o={texts:this.texts.map(a=>({id:this.mirror.getId(a.node),value:a.value})).filter(a=>this.mirror.has(a.id)),attributes:this.attributes.map(a=>({id:this.mirror.getId(a.node),attributes:a.attributes})).filter(a=>this.mirror.has(a.id)),removes:this.removes,adds:t};!o.texts.length&&!o.attributes.length&&!o.removes.length&&!o.adds.length||(this.texts=[],this.attributes=[],this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(o));},this.processMutation=t=>{if(!xt(t.target,this.mirror))switch(t.type){case "characterData":{let r=t.target.textContent;!Ie(t.target,this.blockClass,this.blockSelector,false)&&r!==t.oldValue&&this.texts.push({value:qr(t.target,this.maskTextClass,this.maskTextSelector)&&r?this.maskTextFn?this.maskTextFn(r):r.replace(/[\S]/g,"*"):r,node:t.target});break}case "attributes":{let r=t.target,n=t.target.getAttribute(t.attributeName);if(t.attributeName==="value"&&(n=Nt({maskInputOptions:this.maskInputOptions,tagName:t.target.tagName,type:t.target.getAttribute("type"),value:n,maskInputFn:this.maskInputFn})),Ie(t.target,this.blockClass,this.blockSelector,false)||n===t.oldValue)return;let i=this.attributes.find(s=>s.node===t.target);if(r.tagName==="IFRAME"&&t.attributeName==="src"&&!this.keepIframeSrcFn(n))if(!r.contentDocument)t.attributeName="rr_src";else return;if(i||(i={node:t.target,attributes:{}},this.attributes.push(i)),t.attributeName==="style"){let s=this.doc.createElement("span");t.oldValue&&s.setAttribute("style",t.oldValue),(i.attributes.style===void 0||i.attributes.style===null)&&(i.attributes.style={});let o=i.attributes.style;for(let a of Array.from(r.style)){let l=r.style.getPropertyValue(a),c=r.style.getPropertyPriority(a);(l!==s.style.getPropertyValue(a)||c!==s.style.getPropertyPriority(a))&&(c===""?o[a]=l:o[a]=[l,c]);}for(let a of Array.from(s.style))r.style.getPropertyValue(a)===""&&(o[a]=false);}else i.attributes[t.attributeName]=Zr(this.doc,r.tagName,t.attributeName,n);break}case "childList":{if(Ie(t.target,this.blockClass,this.blockSelector,true))return;t.addedNodes.forEach(r=>this.genAdds(r,t.target)),t.removedNodes.forEach(r=>{let n=this.mirror.getId(r),i=lt(t.target)?this.mirror.getId(t.target.host):this.mirror.getId(t.target);Ie(t.target,this.blockClass,this.blockSelector,false)||xt(r,this.mirror)||!Xr(r,this.mirror)||(this.addedSet.has(r)?(rn(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&n===-1||sr(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[Oi(n,i)]?rn(this.movedSet,r):this.removes.push({parentId:i,id:n,isShadow:lt(t.target)&&ot(t.target)?true:void 0})),this.mapRemoves.push(r));});break}}},this.genAdds=(t,r)=>{if(this.mirror.hasNode(t)){if(xt(t,this.mirror))return;this.movedSet.add(t);let n=null;r&&this.mirror.hasNode(r)&&(n=this.mirror.getId(r)),n&&n!==-1&&(this.movedMap[Oi(this.mirror.getId(t),n)]=true);}else this.addedSet.add(t),this.droppedSet.delete(t);Ie(t,this.blockClass,this.blockSelector,false)||t.childNodes.forEach(n=>this.genAdds(n));};}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager"].forEach(r=>{this[r]=t[r];});}freeze(){this.frozen=true,this.canvasManager.freeze();}unfreeze(){this.frozen=false,this.canvasManager.unfreeze(),this.emit();}isFrozen(){return this.frozen}lock(){this.locked=true,this.canvasManager.lock();}unlock(){this.locked=false,this.canvasManager.unlock(),this.emit();}reset(){this.shadowDomManager.reset(),this.canvasManager.reset();}};});function Ft(e){try{if("composedPath"in e){let t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0];return e.target}catch{return e.target}}function nn(e,t){var r,n;let i=new ur;rt.push(i),i.init(e);let s=window.MutationObserver||window.__rrMutationObserver,o=(n=(r=window?.Zone)===null||r===void 0?void 0:r.__symbol__)===null||n===void 0?void 0:n.call(r,"MutationObserver");o&&window[o]&&(s=window[o]);let a=new s(i.processMutations.bind(i));return a.observe(t,{attributes:true,attributeOldValue:true,characterData:true,characterDataOldValue:true,childList:true,subtree:true}),a}function ja({mousemoveCb:e,sampling:t,doc:r,mirror:n}){if(t.mousemove===false)return ()=>{};let i=typeof t.mousemove=="number"?t.mousemove:50,s=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500,o=[],a,l=ut(h=>{let f=Date.now()-a;e(o.map(m=>(m.timeOffset-=f,m)),h),o=[],a=null;},s),c=ut(h=>{let f=Ft(h),{clientX:m,clientY:g}=or(h)?h.changedTouches[0]:h;a||(a=Date.now()),o.push({x:m,y:g,id:n.getId(f),timeOffset:Date.now()-a}),l(typeof DragEvent<"u"&&h instanceof DragEvent?k.Drag:h instanceof MouseEvent?k.MouseMove:k.TouchMove);},i,{trailing:false}),d=[Ae("mousemove",c,r),Ae("touchmove",c,r),Ae("drag",c,r)];return ()=>{d.forEach(h=>h());}}function za({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,sampling:s}){if(s.mouseInteraction===false)return ()=>{};let o=s.mouseInteraction===true||s.mouseInteraction===void 0?{}:s.mouseInteraction,a=[],l=c=>d=>{let h=Ft(d);if(Ie(h,n,i,true))return;let f=or(d)?d.changedTouches[0]:d;if(!f)return;let m=r.getId(h),{clientX:g,clientY:I}=f;e({type:be[c],id:m,x:g,y:I});};return Object.keys(be).filter(c=>Number.isNaN(Number(c))&&!c.endsWith("_Departed")&&o[c]!==false).forEach(c=>{let d=c.toLowerCase(),h=l(c);a.push(Ae(d,h,t));}),()=>{a.forEach(c=>c());}}function sn({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,sampling:s}){let o=ut(a=>{let l=Ft(a);if(!l||Ie(l,n,i,true))return;let c=r.getId(l);if(l===t){let d=t.scrollingElement||t.documentElement;e({id:c,x:d.scrollLeft,y:d.scrollTop});}else e({id:c,x:l.scrollLeft,y:l.scrollTop});},s.scroll||100);return Ae("scroll",o,t)}function Ya({viewportResizeCb:e}){let t=-1,r=-1,n=ut(()=>{let i=Mt(),s=Ot();(t!==i||r!==s)&&(e({width:Number(s),height:Number(i)}),t=i,r=s);},200);return Ae("resize",n,window)}function Ui(e,t){let r=Object.assign({},e);return t||delete r.userTriggered,r}function Za({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,ignoreClass:s,maskInputOptions:o,maskInputFn:a,sampling:l,userTriggeredOnInput:c}){function d(y){let v=Ft(y),S=y.isTrusted;if(v&&v.tagName==="OPTION"&&(v=v.parentElement),!v||!v.tagName||Ka.indexOf(v.tagName)<0||Ie(v,n,i,true))return;let T=v.type;if(v.classList.contains(s))return;let L=v.value,O=false;T==="radio"||T==="checkbox"?O=v.checked:(o[v.tagName.toLowerCase()]||o[T])&&(L=Nt({maskInputOptions:o,tagName:v.tagName,type:T,value:L,maskInputFn:a})),h(v,Ui({text:L,isChecked:O,userTriggered:S},c));let P=v.name;T==="radio"&&P&&O&&t.querySelectorAll(`input[type="radio"][name="${P}"]`).forEach(A=>{A!==v&&h(A,Ui({text:A.value,isChecked:!O,userTriggered:false},c));});}function h(y,v){let S=Bi.get(y);if(!S||S.text!==v.text||S.isChecked!==v.isChecked){Bi.set(y,v);let T=r.getId(y);e(Object.assign(Object.assign({},v),{id:T}));}}let m=(l.input==="last"?["change"]:["input","change"]).map(y=>Ae(y,d,t)),g=t.defaultView;if(!g)return ()=>{m.forEach(y=>y());};let I=g.Object.getOwnPropertyDescriptor(g.HTMLInputElement.prototype,"value"),C=[[g.HTMLInputElement.prototype,"value"],[g.HTMLInputElement.prototype,"checked"],[g.HTMLSelectElement.prototype,"value"],[g.HTMLTextAreaElement.prototype,"value"],[g.HTMLSelectElement.prototype,"selectedIndex"],[g.HTMLOptionElement.prototype,"selected"]];return I&&I.set&&m.push(...C.map(y=>et(y[0],y[1],{set(){d({target:this});}},false,g))),()=>{m.forEach(y=>y());}}function dr(e){let t=[];function r(n,i){if(Wi&&n.parentRule instanceof CSSGroupingRule||Hi&&n.parentRule instanceof CSSMediaRule||Vi&&n.parentRule instanceof CSSSupportsRule||Gi&&n.parentRule instanceof CSSConditionRule){let o=Array.from(n.parentRule.cssRules).indexOf(n);i.unshift(o);}else if(n.parentStyleSheet){let o=Array.from(n.parentStyleSheet.cssRules).indexOf(n);i.unshift(o);}return i}return r(e,t)}function tt(e,t,r){let n,i;return e?(e.ownerNode?n=t.getId(e.ownerNode):i=r.getId(e),{styleId:i,id:n}):{}}function qa({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){let i=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=function(d,h){let{id:f,styleId:m}=tt(this,t,r.styleMirror);return (f&&f!==-1||m&&m!==-1)&&e({id:f,styleId:m,adds:[{rule:d,index:h}]}),i.apply(this,[d,h])};let s=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=function(d){let{id:h,styleId:f}=tt(this,t,r.styleMirror);return (h&&h!==-1||f&&f!==-1)&&e({id:h,styleId:f,removes:[{index:d}]}),s.apply(this,[d])};let o;n.CSSStyleSheet.prototype.replace&&(o=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=function(d){let{id:h,styleId:f}=tt(this,t,r.styleMirror);return (h&&h!==-1||f&&f!==-1)&&e({id:h,styleId:f,replace:d}),o.apply(this,[d])});let a;n.CSSStyleSheet.prototype.replaceSync&&(a=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=function(d){let{id:h,styleId:f}=tt(this,t,r.styleMirror);return (h&&h!==-1||f&&f!==-1)&&e({id:h,styleId:f,replaceSync:d}),a.apply(this,[d])});let l={};Wi?l.CSSGroupingRule=n.CSSGroupingRule:(Hi&&(l.CSSMediaRule=n.CSSMediaRule),Gi&&(l.CSSConditionRule=n.CSSConditionRule),Vi&&(l.CSSSupportsRule=n.CSSSupportsRule));let c={};return Object.entries(l).forEach(([d,h])=>{c[d]={insertRule:h.prototype.insertRule,deleteRule:h.prototype.deleteRule},h.prototype.insertRule=function(f,m){let{id:g,styleId:I}=tt(this.parentStyleSheet,t,r.styleMirror);return (g&&g!==-1||I&&I!==-1)&&e({id:g,styleId:I,adds:[{rule:f,index:[...dr(this),m||0]}]}),c[d].insertRule.apply(this,[f,m])},h.prototype.deleteRule=function(f){let{id:m,styleId:g}=tt(this.parentStyleSheet,t,r.styleMirror);return (m&&m!==-1||g&&g!==-1)&&e({id:m,styleId:g,removes:[{index:[...dr(this),f]}]}),c[d].deleteRule.apply(this,[f])};}),()=>{n.CSSStyleSheet.prototype.insertRule=i,n.CSSStyleSheet.prototype.deleteRule=s,o&&(n.CSSStyleSheet.prototype.replace=o),a&&(n.CSSStyleSheet.prototype.replaceSync=a),Object.entries(l).forEach(([d,h])=>{h.prototype.insertRule=c[d].insertRule,h.prototype.deleteRule=c[d].deleteRule;});}}function on({mirror:e,stylesheetManager:t},r){var n,i,s;let o=null;r.nodeName==="#document"?o=e.getId(r):o=e.getId(r.host);let a=r.nodeName==="#document"?(n=r.defaultView)===null||n===void 0?void 0:n.Document:(s=(i=r.ownerDocument)===null||i===void 0?void 0:i.defaultView)===null||s===void 0?void 0:s.ShadowRoot,l=Object.getOwnPropertyDescriptor(a?.prototype,"adoptedStyleSheets");return o===null||o===-1||!a||!l?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var c;return (c=l.get)===null||c===void 0?void 0:c.call(this)},set(c){var d;let h=(d=l.set)===null||d===void 0?void 0:d.call(this,c);if(o!==null&&o!==-1)try{t.adoptStyleSheets(c,o);}catch{}return h}}),()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set});})}function Qa({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:i}){let s=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=function(a,l,c){var d;if(r.has(a))return s.apply(this,[a,l,c]);let{id:h,styleId:f}=tt((d=this.parentRule)===null||d===void 0?void 0:d.parentStyleSheet,t,n.styleMirror);return (h&&h!==-1||f&&f!==-1)&&e({id:h,styleId:f,set:{property:a,value:l,priority:c},index:dr(this.parentRule)}),s.apply(this,[a,l,c])};let o=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=function(a){var l;if(r.has(a))return o.apply(this,[a]);let{id:c,styleId:d}=tt((l=this.parentRule)===null||l===void 0?void 0:l.parentStyleSheet,t,n.styleMirror);return (c&&c!==-1||d&&d!==-1)&&e({id:c,styleId:d,remove:{property:a},index:dr(this.parentRule)}),o.apply(this,[a])},()=>{i.CSSStyleDeclaration.prototype.setProperty=s,i.CSSStyleDeclaration.prototype.removeProperty=o;}}function Xa({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:i}){let s=a=>ut(l=>{let c=Ft(l);if(!c||Ie(c,t,r,true))return;let{currentTime:d,volume:h,muted:f,playbackRate:m}=c;e({type:a,id:n.getId(c),currentTime:d,volume:h,muted:f,playbackRate:m});},i.media||500),o=[Ae("play",s(0)),Ae("pause",s(1)),Ae("seeked",s(2)),Ae("volumechange",s(3)),Ae("ratechange",s(4))];return ()=>{o.forEach(a=>a());}}function $a({fontCb:e,doc:t}){let r=t.defaultView;if(!r)return ()=>{};let n=[],i=new WeakMap,s=r.FontFace;r.FontFace=function(l,c,d){let h=new s(l,c,d);return i.set(h,{family:l,buffer:typeof c!="string",descriptors:d,fontSource:typeof c=="string"?c:JSON.stringify(Array.from(new Uint8Array(c)))}),h};let o=_e(t.fonts,"add",function(a){return function(l){return setTimeout(()=>{let c=i.get(l);c&&(e(c),i.delete(l));},0),a.apply(this,[l])}});return n.push(()=>{r.FontFace=s;}),n.push(o),()=>{n.forEach(a=>a());}}function Ja(e){let{doc:t,mirror:r,blockClass:n,blockSelector:i,selectionCb:s}=e,o=true,a=()=>{let l=t.getSelection();if(!l||o&&l?.isCollapsed)return;o=l.isCollapsed||false;let c=[],d=l.rangeCount||0;for(let h=0;h<d;h++){let f=l.getRangeAt(h),{startContainer:m,startOffset:g,endContainer:I,endOffset:C}=f;Ie(m,n,i,true)||Ie(I,n,i,true)||c.push({start:r.getId(m),startOffset:g,end:r.getId(I),endOffset:C});}s({ranges:c});};return a(),Ae("selectionchange",a)}function el(e,t){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:i,scrollCb:s,viewportResizeCb:o,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:c,styleDeclarationCb:d,canvasMutationCb:h,fontCb:f,selectionCb:m}=e;e.mutationCb=(...g)=>{t.mutation&&t.mutation(...g),r(...g);},e.mousemoveCb=(...g)=>{t.mousemove&&t.mousemove(...g),n(...g);},e.mouseInteractionCb=(...g)=>{t.mouseInteraction&&t.mouseInteraction(...g),i(...g);},e.scrollCb=(...g)=>{t.scroll&&t.scroll(...g),s(...g);},e.viewportResizeCb=(...g)=>{t.viewportResize&&t.viewportResize(...g),o(...g);},e.inputCb=(...g)=>{t.input&&t.input(...g),a(...g);},e.mediaInteractionCb=(...g)=>{t.mediaInteaction&&t.mediaInteaction(...g),l(...g);},e.styleSheetRuleCb=(...g)=>{t.styleSheetRule&&t.styleSheetRule(...g),c(...g);},e.styleDeclarationCb=(...g)=>{t.styleDeclaration&&t.styleDeclaration(...g),d(...g);},e.canvasMutationCb=(...g)=>{t.canvasMutation&&t.canvasMutation(...g),h(...g);},e.fontCb=(...g)=>{t.font&&t.font(...g),f(...g);},e.selectionCb=(...g)=>{t.selection&&t.selection(...g),m(...g);};}function ji(e,t={}){let r=e.doc.defaultView;if(!r)return ()=>{};el(e,t);let n=nn(e,e.doc),i=ja(e),s=za(e),o=sn(e),a=Ya(e),l=Za(e),c=Xa(e),d=qa(e,{win:r}),h=on(e,e.doc),f=Qa(e,{win:r}),m=e.collectFonts?$a(e):()=>{},g=Ja(e),I=[];for(let C of e.plugins)I.push(C.observer(C.callback,r,C.options));return ()=>{rt.forEach(C=>C.reset()),n.disconnect(),i(),s(),o(),a(),l(),c(),d(),h(),f(),m(),g(),I.forEach(C=>C());}}var rt,Wi,Hi,Vi,Gi,Ka,Bi,an=V(()=>{Ye();Me();xe();Pi();rt=[],Wi=typeof CSSGroupingRule<"u",Hi=typeof CSSMediaRule<"u",Vi=typeof CSSSupportsRule<"u",Gi=typeof CSSConditionRule<"u";Ka=["INPUT","TEXTAREA","SELECT"],Bi=new WeakMap;});var Pt,zi=V(()=>{Pt=class{constructor(t){this.generateIdFn=t,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;}getId(t,r,n,i){let s=n||this.getIdToRemoteIdMap(t),o=i||this.getRemoteIdToIdMap(t),a=s.get(r);return a||(a=this.generateIdFn(),s.set(r,a),o.set(a,r)),a}getIds(t,r){let n=this.getIdToRemoteIdMap(t),i=this.getRemoteIdToIdMap(t);return r.map(s=>this.getId(t,s,n,i))}getRemoteId(t,r,n){let i=n||this.getRemoteIdToIdMap(t);if(typeof r!="number")return r;let s=i.get(r);return s||-1}getRemoteIds(t,r){let n=this.getRemoteIdToIdMap(t);return r.map(i=>this.getRemoteId(t,i,n))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t);}getIdToRemoteIdMap(t){let r=this.iframeIdToRemoteIdMap.get(t);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(t,r)),r}getRemoteIdToIdMap(t){let r=this.iframeRemoteIdToIdMap.get(t);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(t,r)),r}};});var hr,Yi=V(()=>{Ye();zi();xe();hr=class{constructor(t){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Pt(Yr),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Pt(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this));}addIframe(t){this.iframes.set(t,true),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t);}addLoadListener(t){this.loadListener=t;}attachIframe(t,r){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:true}),(n=this.loadListener)===null||n===void 0||n.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument));}handleMessage(t){if(t.data.type==="rrweb"){if(!t.source)return;let n=this.crossOriginIframeMap.get(t.source);if(!n)return;let i=this.transformCrossOriginEvent(n,t.data.event);i&&this.wrappedEmit(i,t.data.isCheckout);}}transformCrossOriginEvent(t,r){var n;switch(r.type){case N.FullSnapshot:return this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(r.data.node,t),{timestamp:r.timestamp,type:N.IncrementalSnapshot,data:{source:k.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:true}};case N.Meta:case N.Load:case N.DomContentLoaded:return false;case N.Plugin:return r;case N.Custom:return this.replaceIds(r.data.payload,t,["id","parentId","previousId","nextId"]),r;case N.IncrementalSnapshot:switch(r.data.source){case k.Mutation:return r.data.adds.forEach(i=>{this.replaceIds(i,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,t);}),r.data.removes.forEach(i=>{this.replaceIds(i,t,["parentId","id"]);}),r.data.attributes.forEach(i=>{this.replaceIds(i,t,["id"]);}),r.data.texts.forEach(i=>{this.replaceIds(i,t,["id"]);}),r;case k.Drag:case k.TouchMove:case k.MouseMove:return r.data.positions.forEach(i=>{this.replaceIds(i,t,["id"]);}),r;case k.ViewportResize:return false;case k.MediaInteraction:case k.MouseInteraction:case k.Scroll:case k.CanvasMutation:case k.Input:return this.replaceIds(r.data,t,["id"]),r;case k.StyleSheetRule:case k.StyleDeclaration:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleId"]),r;case k.Font:return r;case k.Selection:return r.data.ranges.forEach(i=>{this.replaceIds(i,t,["start","end"]);}),r;case k.AdoptedStyleSheet:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleIds"]),(n=r.data.styles)===null||n===void 0||n.forEach(i=>{this.replaceStyleIds(i,t,["styleId"]);}),r}}}replace(t,r,n,i){for(let s of i)!Array.isArray(r[s])&&typeof r[s]!="number"||(Array.isArray(r[s])?r[s]=t.getIds(n,r[s]):r[s]=t.getId(n,r[s]));return r}replaceIds(t,r,n){return this.replace(this.crossOriginIframeMirror,t,r,n)}replaceStyleIds(t,r,n){return this.replace(this.crossOriginIframeStyleMirror,t,r,n)}replaceIdOnNode(t,r){this.replaceIds(t,r,["id"]),"childNodes"in t&&t.childNodes.forEach(n=>{this.replaceIdOnNode(n,r);});}};});var fr,Ki=V(()=>{an();Me();Ye();fr=class{constructor(t){this.shadowDoms=new WeakSet,this.restorePatches=[],this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror;let r=this;this.restorePatches.push(_e(Element.prototype,"attachShadow",function(n){return function(i){let s=n.call(this,i);return this.shadowRoot&&r.addShadowRoot(this.shadowRoot,this.ownerDocument),s}}));}addShadowRoot(t,r){ot(t)&&(this.shadowDoms.has(t)||(this.shadowDoms.add(t),nn(Object.assign(Object.assign({},this.bypassOptions),{doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t),sn(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(t.host)),on({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t);},0)));}observeAttachShadow(t){if(t.contentWindow){let r=this;this.restorePatches.push(_e(t.contentWindow.HTMLElement.prototype,"attachShadow",function(n){return function(i){let s=n.call(this,i);return this.shadowRoot&&r.addShadowRoot(this.shadowRoot,t.contentDocument),s}}));}}reset(){this.restorePatches.forEach(t=>t()),this.shadowDoms=new WeakSet;}};});function Zi(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function De(e,t,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s);})}return new(r||(r=Promise))(function(s,o){function a(d){try{c(n.next(d));}catch(h){o(h);}}function l(d){try{c(n.throw(d));}catch(h){o(h);}}function c(d){d.done?s(d.value):i(d.value).then(a,l);}c((n=n.apply(e,[])).next());})}var ht=V(()=>{});var bt,Bt,Ut,qi,Qi,ln=V(()=>{bt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Bt=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(Ut=0;Ut<bt.length;Ut++)Bt[bt.charCodeAt(Ut)]=Ut;qi=function(e){var t=new Uint8Array(e),r,n=t.length,i="";for(r=0;r<n;r+=3)i+=bt[t[r]>>2],i+=bt[(t[r]&3)<<4|t[r+1]>>4],i+=bt[(t[r+1]&15)<<2|t[r+2]>>6],i+=bt[t[r+2]&63];return n%3===2?i=i.substring(0,i.length-1)+"=":n%3===1&&(i=i.substring(0,i.length-2)+"=="),i},Qi=function(e){var t=e.length*.75,r=e.length,n,i=0,s,o,a,l;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);var c=new ArrayBuffer(t),d=new Uint8Array(c);for(n=0;n<r;n+=4)s=Bt[e.charCodeAt(n)],o=Bt[e.charCodeAt(n+1)],a=Bt[e.charCodeAt(n+2)],l=Bt[e.charCodeAt(n+3)],d[i++]=s<<2|o>>4,d[i++]=(o&15)<<4|a>>2,d[i++]=(a&3)<<6|l&63;return c};});function tl(e,t){let r=Xi.get(e);return r||(r=new Map,Xi.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}function pr(e,t,r){if(e instanceof Array)return e.map(n=>pr(n,t,r));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return {rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){let n=e.constructor.name,i=qi(e);return {rr_type:n,base64:i}}else {if(e instanceof DataView)return {rr_type:e.constructor.name,args:[pr(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let n=e.constructor.name,{src:i}=e;return {rr_type:n,src:i}}else if(e instanceof HTMLCanvasElement){let n="HTMLImageElement",i=e.toDataURL();return {rr_type:n,src:i}}else {if(e instanceof ImageData)return {rr_type:e.constructor.name,args:[pr(e.data,t,r),e.width,e.height]};if($i(e,t)||typeof e=="object"){let n=e.constructor.name,i=cn(e,t,r);return {rr_type:n,index:i}}}}return e}var Xi,cn,mr,$i,un=V(()=>{ln();Xi=new Map;cn=(e,t,r)=>{if(!e||!($i(e,t)||typeof e=="object"))return;let n=e.constructor.name,i=tl(r,n),s=i.indexOf(e);return s===-1&&(s=i.length,i.push(e)),s};mr=(e,t,r)=>[...e].map(n=>pr(n,t,r)),$i=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof t[i]=="function").find(i=>e instanceof t[i]);});function Ji(e,t,r,n){let i=[],s=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let o of s)try{if(typeof t.CanvasRenderingContext2D.prototype[o]!="function")continue;let a=_e(t.CanvasRenderingContext2D.prototype,o,function(l){return function(...c){return Ie(this.canvas,r,n,!0)||setTimeout(()=>{let d=mr([...c],t,this);e(this.canvas,{type:Oe["2D"],property:o,args:d});},0),l.apply(this,c)}});i.push(a);}catch{let l=et(t.CanvasRenderingContext2D.prototype,o,{set(c){e(this.canvas,{type:Oe["2D"],property:o,args:[c],setter:true});}});i.push(l);}return ()=>{i.forEach(o=>o());}}var es=V(()=>{xe();Me();un();});function dn(e,t,r){let n=[];try{let i=_e(e.HTMLCanvasElement.prototype,"getContext",function(s){return function(o,...a){return Ie(this,t,r,!0)||"__context"in this||(this.__context=o),s.apply(this,[o,...a])}});n.push(i);}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext");}return ()=>{n.forEach(i=>i());}}var ts=V(()=>{Me();});function rs(e,t,r,n,i,s,o){let a=[],l=Object.getOwnPropertyNames(e);for(let c of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(c))try{if(typeof e[c]!="function")continue;let d=_e(e,c,function(h){return function(...f){let m=h.apply(this,f);if(cn(m,o,this),!Ie(this.canvas,n,i,!0)){let g=mr([...f],o,this),I={type:t,property:c,args:g};r(this.canvas,I);}return m}});a.push(d);}catch{let h=et(e,c,{set(f){r(this.canvas,{type:t,property:c,args:[f],setter:true});}});a.push(h);}return a}function ns(e,t,r,n,i){let s=[];return s.push(...rs(t.WebGLRenderingContext.prototype,Oe.WebGL,e,r,n,i,t)),typeof t.WebGL2RenderingContext<"u"&&s.push(...rs(t.WebGL2RenderingContext.prototype,Oe.WebGL2,e,r,n,i,t)),()=>{s.forEach(o=>o());}}var is=V(()=>{xe();Me();un();});var hn,ss,os=V(()=>{hn=null;try{ss=typeof module<"u"&&typeof module.require=="function"&&module.require("worker_threads")||typeof __non_webpack_require__=="function"&&__non_webpack_require__("worker_threads")||typeof Ur=="function"&&Ur("worker_threads"),hn=ss.Worker;}catch{}});function rl(e,t){return Buffer.from(e,"base64").toString("utf8")}function as(e,t,r){var s=rl(e),o=s.indexOf(`
|
|
5
|
+
`,10)+1,a=s.substring(o)+("");return function(c){return new hn(a,Object.assign({},c,{eval:true}))}}var ls=V(()=>{os();});function nl(e,t){var r=atob(e);return r}function il(e,t,r){var s=nl(e),o=s.indexOf(`
|
|
6
|
+
`,10)+1,a=s.substring(o)+(""),l=new Blob([a],{type:"application/javascript"});return URL.createObjectURL(l)}function cs(e,t,r){var n;return function(s){return n=n||il(e),new Worker(n,s)}}var us=V(()=>{});function ds(){return sl}var sl,hs=V(()=>{sl=Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]";});function fs(e,t,r){return ds()?as(e):cs(e)}var ps=V(()=>{ls();us();hs();});var ms,gs=V(()=>{ps();ms=fs("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCiAgICBPVEhFUiBUT1JUSU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgVVNFIE9SDQogICAgUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS4NCiAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLw0KDQogICAgZnVuY3Rpb24gX19hd2FpdGVyKHRoaXNBcmcsIF9hcmd1bWVudHMsIFAsIGdlbmVyYXRvcikgew0KICAgICAgICBmdW5jdGlvbiBhZG9wdCh2YWx1ZSkgeyByZXR1cm4gdmFsdWUgaW5zdGFuY2VvZiBQID8gdmFsdWUgOiBuZXcgUChmdW5jdGlvbiAocmVzb2x2ZSkgeyByZXNvbHZlKHZhbHVlKTsgfSk7IH0NCiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7DQogICAgICAgICAgICBmdW5jdGlvbiBmdWxmaWxsZWQodmFsdWUpIHsgdHJ5IHsgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgeyB0cnkgeyBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgeyByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsgfQ0KICAgICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOw0KICAgICAgICB9KTsNCiAgICB9CgogICAgLyoKICAgICAqIGJhc2U2NC1hcnJheWJ1ZmZlciAxLjAuMSA8aHR0cHM6Ly9naXRodWIuY29tL25pa2xhc3ZoL2Jhc2U2NC1hcnJheWJ1ZmZlcj4KICAgICAqIENvcHlyaWdodCAoYykgMjAyMSBOaWtsYXMgdm9uIEhlcnR6ZW4gPGh0dHBzOi8vaGVydHplbi5jb20+CiAgICAgKiBSZWxlYXNlZCB1bmRlciBNSVQgTGljZW5zZQogICAgICovCiAgICB2YXIgY2hhcnMgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyc7CiAgICAvLyBVc2UgYSBsb29rdXAgdGFibGUgdG8gZmluZCB0aGUgaW5kZXguCiAgICB2YXIgbG9va3VwID0gdHlwZW9mIFVpbnQ4QXJyYXkgPT09ICd1bmRlZmluZWQnID8gW10gOiBuZXcgVWludDhBcnJheSgyNTYpOwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaGFycy5sZW5ndGg7IGkrKykgewogICAgICAgIGxvb2t1cFtjaGFycy5jaGFyQ29kZUF0KGkpXSA9IGk7CiAgICB9CiAgICB2YXIgZW5jb2RlID0gZnVuY3Rpb24gKGFycmF5YnVmZmVyKSB7CiAgICAgICAgdmFyIGJ5dGVzID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlidWZmZXIpLCBpLCBsZW4gPSBieXRlcy5sZW5ndGgsIGJhc2U2NCA9ICcnOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkgKz0gMykgewogICAgICAgICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaV0gPj4gMl07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1soKGJ5dGVzW2ldICYgMykgPDwgNCkgfCAoYnl0ZXNbaSArIDFdID4+IDQpXTsKICAgICAgICAgICAgYmFzZTY0ICs9IGNoYXJzWygoYnl0ZXNbaSArIDFdICYgMTUpIDw8IDIpIHwgKGJ5dGVzW2kgKyAyXSA+PiA2KV07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1tieXRlc1tpICsgMl0gJiA2M107CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgJz0nOwogICAgICAgIH0KICAgICAgICBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgJz09JzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJhc2U2NDsKICAgIH07CgogICAgY29uc3QgbGFzdEJsb2JNYXAgPSBuZXcgTWFwKCk7DQogICAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gbmV3IE1hcCgpOw0KICAgIGZ1bmN0aW9uIGdldFRyYW5zcGFyZW50QmxvYkZvcih3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucykgew0KICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkgew0KICAgICAgICAgICAgY29uc3QgaWQgPSBgJHt3aWR0aH0tJHtoZWlnaHR9YDsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgaWYgKHRyYW5zcGFyZW50QmxvYk1hcC5oYXMoaWQpKQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNwYXJlbnRCbG9iTWFwLmdldChpZCk7DQogICAgICAgICAgICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsNCiAgICAgICAgICAgICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgnMmQnKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0geWllbGQgYmxvYi5hcnJheUJ1ZmZlcigpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7DQogICAgICAgICAgICAgICAgdHJhbnNwYXJlbnRCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICcnOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9KTsNCiAgICB9DQogICAgY29uc3Qgd29ya2VyID0gc2VsZjsNCiAgICB3b3JrZXIub25tZXNzYWdlID0gZnVuY3Rpb24gKGUpIHsNCiAgICAgICAgcmV0dXJuIF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgY29uc3QgeyBpZCwgYml0bWFwLCB3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucyB9ID0gZS5kYXRhOw0KICAgICAgICAgICAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zKTsNCiAgICAgICAgICAgICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=");});var gr,vs=V(()=>{ht();Me();xe();es();ts();is();gs();gr=class{constructor(t){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=false,this.locked=false,this.processMutation=(l,c)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(l)||this.pendingCanvasMutations.set(l,[]),this.pendingCanvasMutations.get(l).push(c);};let{sampling:r="all",win:n,blockClass:i,blockSelector:s,recordCanvas:o,dataURLOptions:a}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,o&&r==="all"&&this.initCanvasMutationObserver(n,i,s),o&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,i,s,{dataURLOptions:a});}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers();}freeze(){this.frozen=true;}unfreeze(){this.frozen=false;}lock(){this.locked=true;}unlock(){this.locked=false;}initCanvasFPSObserver(t,r,n,i,s){let o=dn(r,n,i),a=new Map,l=new ms;l.onmessage=g=>{let{id:I}=g.data;if(a.set(I,false),!("base64"in g.data))return;let{base64:C,type:y,width:v,height:S}=g.data;this.mutationCb({id:I,type:Oe["2D"],commands:[{property:"clearRect",args:[0,0,v,S]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:C}],type:y}]},0,0]}]});};let c=1e3/t,d=0,h,f=()=>{let g=[];return r.document.querySelectorAll("canvas").forEach(I=>{Ie(I,n,i,true)||g.push(I);}),g},m=g=>{if(d&&g-d<c){h=requestAnimationFrame(m);return}d=g,f().forEach(I=>De(this,void 0,void 0,function*(){var C;let y=this.mirror.getId(I);if(a.get(y))return;if(a.set(y,true),["webgl","webgl2"].includes(I.__context)){let S=I.getContext(I.__context);((C=S?.getContextAttributes())===null||C===void 0?void 0:C.preserveDrawingBuffer)===false&&S?.clear(S.COLOR_BUFFER_BIT);}let v=yield createImageBitmap(I);l.postMessage({id:y,bitmap:v,width:I.width,height:I.height,dataURLOptions:s.dataURLOptions},[v]);})),h=requestAnimationFrame(m);};h=requestAnimationFrame(m),this.resetObservers=()=>{o(),cancelAnimationFrame(h);};}initCanvasMutationObserver(t,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let i=dn(t,r,n),s=Ji(this.processMutation.bind(this),t,r,n),o=ns(this.processMutation.bind(this),t,r,n,this.mirror);this.resetObservers=()=>{i(),s(),o();};}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations());}startRAFTimestamping(){let t=r=>{this.rafStamps.latestId=r,requestAnimationFrame(t);};requestAnimationFrame(t);}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,r)=>{let n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n);}),requestAnimationFrame(()=>this.flushPendingCanvasMutations());}flushPendingCanvasMutationFor(t,r){if(this.frozen||this.locked)return;let n=this.pendingCanvasMutations.get(t);if(!n||r===-1)return;let i=n.map(o=>Zi(o,["type"])),{type:s}=n[0];this.mutationCb({id:r,type:s,commands:i}),this.pendingCanvasMutations.delete(t);}};});var vr,ys=V(()=>{Ye();Me();vr=class{constructor(t){this.trackedLinkElements=new WeakSet,this.styleMirror=new ct,this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb;}attachLinkElement(t,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(t);}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t));}adoptStyleSheets(t,r){if(t.length===0)return;let n={id:r,styleIds:[]},i=[];for(let s of t){let o;if(this.styleMirror.has(s))o=this.styleMirror.getId(s);else {o=this.styleMirror.add(s);let a=Array.from(s.rules||CSSRule);i.push({styleId:o,rules:a.map((l,c)=>({rule:jr(l),index:c}))});}n.styleIds.push(o);}i.length>0&&(n.styles=i),this.adoptedStyleSheetCb(n);}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet;}trackStylesheetInLinkElement(t){}};});function Te(e){return Object.assign(Object.assign({},e),{timestamp:Date.now()})}function Ze(e={}){let{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:i="rr-block",blockSelector:s=null,ignoreClass:o="rr-ignore",maskTextClass:a="rr-mask",maskTextSelector:l=null,inlineStylesheet:c=true,maskAllInputs:d,maskInputOptions:h,slimDOMOptions:f,maskInputFn:m,maskTextFn:g,hooks:I,packFn:C,sampling:y={},dataURLOptions:v={},mousemoveWait:S,recordCanvas:T=false,recordCrossOriginIframes:L=false,userTriggeredOnInput:O=false,collectFonts:P=false,inlineImages:A=false,plugins:oe,keepIframeSrcFn:F=()=>false,ignoreCSSAttributes:de=new Set([])}=e,z=L?window.parent===window:true,Q=false;if(!z)try{window.parent.document,Q=!1;}catch{Q=true;}if(z&&!t)throw new Error("emit function is required");S!==void 0&&y.mousemove===void 0&&(y.mousemove=S),Ue.reset();let W=d===true?{color:true,date:true,"datetime-local":true,email:true,month:true,number:true,range:true,search:true,tel:true,text:true,time:true,url:true,week:true,textarea:true,select:true,password:true}:h!==void 0?h:{password:true},J=f===true||f==="all"?{script:true,comment:true,headFavicon:true,headWhitespace:true,headMetaSocial:true,headMetaRobots:true,headMetaHttpEquiv:true,headMetaVerification:true,headMetaAuthorship:f==="all",headMetaDescKeywords:f==="all"}:f||{};Dt();let j,U=0,se=B=>{for(let pe of oe||[])pe.eventProcessor&&(B=pe.eventProcessor(B));return C&&(B=C(B)),B};Ce=(B,pe)=>{var le;if(!((le=rt[0])===null||le===void 0)&&le.isFrozen()&&B.type!==N.FullSnapshot&&!(B.type===N.IncrementalSnapshot&&B.data.source===k.Mutation)&&rt.forEach(ce=>ce.unfreeze()),z)t?.(se(B),pe);else if(Q){let ce={type:"rrweb",event:se(B),isCheckout:pe};window.parent.postMessage(ce,"*");}if(B.type===N.FullSnapshot)j=B,U=0;else if(B.type===N.IncrementalSnapshot){if(B.data.source===k.Mutation&&B.data.isAttachIframe)return;U++;let ce=n&&U>=n,Ee=r&&B.timestamp-j.timestamp>r;(ce||Ee)&&yr(true);}};let w=B=>{Ce(Te({type:N.IncrementalSnapshot,data:Object.assign({source:k.Mutation},B)}));},b=B=>Ce(Te({type:N.IncrementalSnapshot,data:Object.assign({source:k.Scroll},B)})),x=B=>Ce(Te({type:N.IncrementalSnapshot,data:Object.assign({source:k.CanvasMutation},B)})),M=B=>Ce(Te({type:N.IncrementalSnapshot,data:Object.assign({source:k.AdoptedStyleSheet},B)})),K=new vr({mutationCb:w,adoptedStyleSheetCb:M}),ie=new hr({mirror:Ue,mutationCb:w,stylesheetManager:K,recordCrossOriginIframes:L,wrappedEmit:Ce});for(let B of oe||[])B.getMirror&&B.getMirror({nodeMirror:Ue,crossOriginIframeMirror:ie.crossOriginIframeMirror,crossOriginIframeStyleMirror:ie.crossOriginIframeStyleMirror});fn=new gr({recordCanvas:T,mutationCb:x,win:window,blockClass:i,blockSelector:s,mirror:Ue,sampling:y.canvas,dataURLOptions:v});let he=new fr({mutationCb:w,scrollCb:b,bypassOptions:{blockClass:i,blockSelector:s,maskTextClass:a,maskTextSelector:l,inlineStylesheet:c,maskInputOptions:W,dataURLOptions:v,maskTextFn:g,maskInputFn:m,recordCanvas:T,inlineImages:A,sampling:y,slimDOMOptions:J,iframeManager:ie,stylesheetManager:K,canvasManager:fn,keepIframeSrcFn:F},mirror:Ue});yr=(B=false)=>{var pe,le,ce,Ee,ee,we;Ce(Te({type:N.Meta,data:{href:window.location.href,width:Ot(),height:Mt()}}),B),K.reset(),rt.forEach(ve=>ve.lock());let $e=ki(document,{mirror:Ue,blockClass:i,blockSelector:s,maskTextClass:a,maskTextSelector:l,inlineStylesheet:c,maskAllInputs:W,maskTextFn:g,slimDOM:J,dataURLOptions:v,recordCanvas:T,inlineImages:A,onSerialize:ve=>{Ke(ve,Ue)&&ie.addIframe(ve),Lt(ve,Ue)&&K.trackLinkElement(ve),Ve(ve)&&he.addShadowRoot(ve.shadowRoot,document);},onIframeLoad:(ve,ke)=>{ie.attachIframe(ve,ke),he.observeAttachShadow(ve);},onStylesheetLoad:(ve,ke)=>{K.attachLinkElement(ve,ke);},keepIframeSrcFn:F});if(!$e)return console.warn("Failed to snapshot the document");Ce(Te({type:N.FullSnapshot,data:{node:$e,initialOffset:{left:window.pageXOffset!==void 0?window.pageXOffset:document?.documentElement.scrollLeft||((le=(pe=document?.body)===null||pe===void 0?void 0:pe.parentElement)===null||le===void 0?void 0:le.scrollLeft)||((ce=document?.body)===null||ce===void 0?void 0:ce.scrollLeft)||0,top:window.pageYOffset!==void 0?window.pageYOffset:document?.documentElement.scrollTop||((ee=(Ee=document?.body)===null||Ee===void 0?void 0:Ee.parentElement)===null||ee===void 0?void 0:ee.scrollTop)||((we=document?.body)===null||we===void 0?void 0:we.scrollTop)||0}}})),rt.forEach(ve=>ve.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&K.adoptStyleSheets(document.adoptedStyleSheets,Ue.getId(document));};try{let B=[];B.push(Ae("DOMContentLoaded",()=>{Ce(Te({type:N.DomContentLoaded,data:{}}));}));let pe=ce=>{var Ee;return ji({mutationCb:w,mousemoveCb:(ee,we)=>Ce(Te({type:N.IncrementalSnapshot,data:{source:we,positions:ee}})),mouseInteractionCb:ee=>Ce(Te({type:N.IncrementalSnapshot,data:Object.assign({source:k.MouseInteraction},ee)})),scrollCb:b,viewportResizeCb:ee=>Ce(Te({type:N.IncrementalSnapshot,data:Object.assign({source:k.ViewportResize},ee)})),inputCb:ee=>Ce(Te({type:N.IncrementalSnapshot,data:Object.assign({source:k.Input},ee)})),mediaInteractionCb:ee=>Ce(Te({type:N.IncrementalSnapshot,data:Object.assign({source:k.MediaInteraction},ee)})),styleSheetRuleCb:ee=>Ce(Te({type:N.IncrementalSnapshot,data:Object.assign({source:k.StyleSheetRule},ee)})),styleDeclarationCb:ee=>Ce(Te({type:N.IncrementalSnapshot,data:Object.assign({source:k.StyleDeclaration},ee)})),canvasMutationCb:x,fontCb:ee=>Ce(Te({type:N.IncrementalSnapshot,data:Object.assign({source:k.Font},ee)})),selectionCb:ee=>{Ce(Te({type:N.IncrementalSnapshot,data:Object.assign({source:k.Selection},ee)}));},blockClass:i,ignoreClass:o,maskTextClass:a,maskTextSelector:l,maskInputOptions:W,inlineStylesheet:c,sampling:y,recordCanvas:T,inlineImages:A,userTriggeredOnInput:O,collectFonts:P,doc:ce,maskInputFn:m,maskTextFn:g,keepIframeSrcFn:F,blockSelector:s,slimDOMOptions:J,dataURLOptions:v,mirror:Ue,iframeManager:ie,stylesheetManager:K,shadowDomManager:he,canvasManager:fn,ignoreCSSAttributes:de,plugins:((Ee=oe?.filter(ee=>ee.observer))===null||Ee===void 0?void 0:Ee.map(ee=>({observer:ee.observer,options:ee.options,callback:we=>Ce(Te({type:N.Plugin,data:{plugin:ee.name,payload:we}}))})))||[]},I)};ie.addLoadListener(ce=>{B.push(pe(ce.contentDocument));});let le=()=>{yr(),B.push(pe(document)),Ir=!0;};return document.readyState==="interactive"||document.readyState==="complete"?le():B.push(Ae("load",()=>{Ce(Te({type:N.Load,data:{}})),le();},window)),()=>{B.forEach(ce=>ce()),Ir=!1;}}catch(B){console.warn(B);}}var Ce,yr,fn,Ir,Ue,pn=V(()=>{Ye();an();Me();xe();Yi();Ki();vs();ys();Ir=false,Ue=ir();Ze.addCustomEvent=(e,t)=>{if(!Ir)throw new Error("please add custom event after start recording");Ce(Te({type:N.Custom,data:{tag:e,payload:t}}));};Ze.freezePage=()=>{rt.forEach(e=>e.freeze());};Ze.takeFullSnapshot=e=>{if(!Ir)throw new Error("please take full snapshot after start recording");yr(e);};Ze.mirror=Ue;});function al(){return new ol}function ll(e){let t={},r=/;(?![^(]*\))/g,n=/:(.+)/,i=/\/\*.*?\*\//g;return e.replace(i,"").split(r).forEach(function(s){if(s){let o=s.split(n);o.length>1&&(t[mn(o[0].trim())]=o[1].trim());}}),t}function Is(e){let t=[];for(let r in e){let n=e[r];if(typeof n!="string")continue;let i=hl(r);t.push(`${i}: ${n};`);}return t.join(" ")}function fl(e){return class bs extends e{constructor(){super(...arguments),this.nodeType=Se.DOCUMENT_NODE,this.nodeName="#document",this.compatMode="CSS1Compat",this.RRNodeType=re.Document,this.textContent=null;}get documentElement(){return this.childNodes.find(r=>r.RRNodeType===re.Element&&r.tagName==="HTML")||null}get body(){var r;return ((r=this.documentElement)===null||r===void 0?void 0:r.childNodes.find(n=>n.RRNodeType===re.Element&&n.tagName==="BODY"))||null}get head(){var r;return ((r=this.documentElement)===null||r===void 0?void 0:r.childNodes.find(n=>n.RRNodeType===re.Element&&n.tagName==="HEAD"))||null}get implementation(){return this}get firstElementChild(){return this.documentElement}appendChild(r){let n=r.RRNodeType;if((n===re.Element||n===re.DocumentType)&&this.childNodes.some(i=>i.RRNodeType===n))throw new Error(`RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${n===re.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);return r.parentElement=null,r.parentNode=this,this.childNodes.push(r),r}insertBefore(r,n){let i=r.RRNodeType;if((i===re.Element||i===re.DocumentType)&&this.childNodes.some(o=>o.RRNodeType===i))throw new Error(`RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${i===re.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);if(n===null)return this.appendChild(r);let s=this.childNodes.indexOf(n);if(s==-1)throw new Error("Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode.");return this.childNodes.splice(s,0,r),r.parentElement=null,r.parentNode=this,r}removeChild(r){let n=this.childNodes.indexOf(r);if(n===-1)throw new Error("Failed to execute 'removeChild' on 'RRDocument': The RRNode to be removed is not a child of this RRNode.");return this.childNodes.splice(n,1),r.parentElement=null,r.parentNode=null,r}open(){this.childNodes=[];}close(){}write(r){let n;if(r==='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'?n="-//W3C//DTD XHTML 1.0 Transitional//EN":r==='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">'&&(n="-//W3C//DTD HTML 4.0 Transitional//EN"),n){let i=this.createDocumentType("html",n,"");this.open(),this.appendChild(i);}}createDocument(r,n,i){return new bs}createDocumentType(r,n,i){let s=new(Cs(Le))(r,n,i);return s.ownerDocument=this,s}createElement(r){let n=new(ws(Le))(r);return n.ownerDocument=this,n}createElementNS(r,n){return this.createElement(n)}createTextNode(r){let n=new(Es(Le))(r);return n.ownerDocument=this,n}createComment(r){let n=new(Ts(Le))(r);return n.ownerDocument=this,n}createCDATASection(r){let n=new(As(Le))(r);return n.ownerDocument=this,n}toString(){return "RRDocument"}}}function Cs(e){return class extends e{constructor(r,n,i){super(),this.nodeType=Se.DOCUMENT_TYPE_NODE,this.RRNodeType=re.DocumentType,this.textContent=null,this.name=r,this.publicId=n,this.systemId=i,this.nodeName=r;}toString(){return "RRDocumentType"}}}function ws(e){return class extends e{constructor(r){super(),this.nodeType=Se.ELEMENT_NODE,this.RRNodeType=re.Element,this.attributes={},this.shadowRoot=null,this.tagName=r.toUpperCase(),this.nodeName=r.toUpperCase();}get textContent(){let r="";return this.childNodes.forEach(n=>r+=n.textContent),r}set textContent(r){this.childNodes=[this.ownerDocument.createTextNode(r)];}get classList(){return new gn(this.attributes.class,r=>{this.attributes.class=r;})}get id(){return this.attributes.id||""}get className(){return this.attributes.class||""}get style(){let r=this.attributes.style?ll(this.attributes.style):{},n=/\B([A-Z])/g;return r.setProperty=(i,s,o)=>{if(n.test(i))return;let a=mn(i);s?r[a]=s:delete r[a],o==="important"&&(r[a]+=" !important"),this.attributes.style=Is(r);},r.removeProperty=i=>{if(n.test(i))return "";let s=mn(i),o=r[s]||"";return delete r[s],this.attributes.style=Is(r),o},r}getAttribute(r){return this.attributes[r]||null}setAttribute(r,n){this.attributes[r]=n;}setAttributeNS(r,n,i){this.setAttribute(n,i);}removeAttribute(r){delete this.attributes[r];}appendChild(r){return this.childNodes.push(r),r.parentNode=this,r.parentElement=this,r}insertBefore(r,n){if(n===null)return this.appendChild(r);let i=this.childNodes.indexOf(n);if(i==-1)throw new Error("Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode.");return this.childNodes.splice(i,0,r),r.parentElement=this,r.parentNode=this,r}removeChild(r){let n=this.childNodes.indexOf(r);if(n===-1)throw new Error("Failed to execute 'removeChild' on 'RRElement': The RRNode to be removed is not a child of this RRNode.");return this.childNodes.splice(n,1),r.parentElement=null,r.parentNode=null,r}attachShadow(r){let n=this.ownerDocument.createElement("SHADOWROOT");return this.shadowRoot=n,n}dispatchEvent(r){return true}toString(){let r="";for(let n in this.attributes)r+=`${n}="${this.attributes[n]}" `;return `${this.tagName} ${r}`}}}function pl(e){return class extends e{attachShadow(r){throw new Error("RRDomException: Failed to execute 'attachShadow' on 'RRElement': This RRElement does not support attachShadow")}play(){this.paused=false;}pause(){this.paused=true;}}}function Es(e){return class extends e{constructor(r){super(),this.nodeType=Se.TEXT_NODE,this.nodeName="#text",this.RRNodeType=re.Text,this.data=r;}get textContent(){return this.data}set textContent(r){this.data=r;}toString(){return `RRText text=${JSON.stringify(this.data)}`}}}function Ts(e){return class extends e{constructor(r){super(),this.nodeType=Se.COMMENT_NODE,this.nodeName="#comment",this.RRNodeType=re.Comment,this.data=r;}get textContent(){return this.data}set textContent(r){this.data=r;}toString(){return `RRComment text=${JSON.stringify(this.data)}`}}}function As(e){return class extends e{constructor(r){super(),this.nodeName="#cdata-section",this.nodeType=Se.CDATA_SECTION_NODE,this.RRNodeType=re.CDATA,this.data=r;}get textContent(){return this.data}set textContent(r){this.data=r;}toString(){return `RRCDATASection data=${JSON.stringify(this.data)}`}}}function Be(e,t,r,n){let i=e.childNodes,s=t.childNodes;n=n||t.mirror||t.ownerDocument.mirror,(i.length>0||s.length>0)&&Ss(Array.from(i),s,e,r,n);let o=null,a=null;switch(t.RRNodeType){case re.Document:{a=t.scrollData;break}case re.Element:{let l=e,c=t;switch(gl(l,c,n),a=c.scrollData,o=c.inputData,c.tagName){case "AUDIO":case "VIDEO":{let d=e,h=c;h.paused!==void 0&&(h.paused?d.pause():d.play()),h.muted!==void 0&&(d.muted=h.muted),h.volume!==void 0&&(d.volume=h.volume),h.currentTime!==void 0&&(d.currentTime=h.currentTime),h.playbackRate!==void 0&&(d.playbackRate=h.playbackRate);break}case "CANVAS":{let d=t;if(d.rr_dataURL!==null){let h=document.createElement("img");h.onload=()=>{let f=l.getContext("2d");f&&f.drawImage(h,0,0,h.width,h.height);},h.src=d.rr_dataURL;}d.canvasMutations.forEach(h=>r.applyCanvas(h.event,h.mutation,e));}break;case "STYLE":{let d=l.sheet;d&&t.rules.forEach(h=>r.applyStyleSheetMutation(h,d));}break}if(c.shadowRoot){l.shadowRoot||l.attachShadow({mode:"open"});let d=l.shadowRoot.childNodes,h=c.shadowRoot.childNodes;(d.length>0||h.length>0)&&Ss(Array.from(d),h,l.shadowRoot,r,n);}break}case re.Text:case re.Comment:case re.CDATA:e.textContent!==t.data&&(e.textContent=t.data);break}if(a&&r.applyScroll(a,true),o&&r.applyInput(o),t.nodeName==="IFRAME"){let l=e.contentDocument,c=t;if(l){let d=n.getMeta(c.contentDocument);d&&r.mirror.add(l,Object.assign({},d)),Be(l,c.contentDocument,r,n);}}}function gl(e,t,r){let n=e.attributes,i=t.attributes;for(let s in i){let o=i[s],a=r.getMeta(t);if(a&&"isSVG"in a&&a.isSVG&&vn[s])e.setAttributeNS(vn[s],s,o);else if(t.tagName==="CANVAS"&&s==="rr_dataURL"){let l=document.createElement("img");l.src=o,l.onload=()=>{let c=e.getContext("2d");c&&c.drawImage(l,0,0,l.width,l.height);};}else e.setAttribute(s,o);}for(let{name:s}of Array.from(n))s in i||e.removeAttribute(s);t.scrollLeft&&(e.scrollLeft=t.scrollLeft),t.scrollTop&&(e.scrollTop=t.scrollTop);}function Ss(e,t,r,n,i){var s;let o=0,a=e.length-1,l=0,c=t.length-1,d=e[o],h=e[a],f=t[l],m=t[c],g,I;for(;o<=a&&l<=c;){let C=n.mirror.getId(d),y=n.mirror.getId(h),v=i.getId(f),S=i.getId(m);if(d===void 0)d=e[++o];else if(h===void 0)h=e[--a];else if(C!==-1&&C===v)Be(d,f,n,i),d=e[++o],f=t[++l];else if(y!==-1&&y===S)Be(h,m,n,i),h=e[--a],m=t[--c];else if(C!==-1&&C===S)r.insertBefore(d,h.nextSibling),Be(d,m,n,i),d=e[++o],m=t[--c];else if(y!==-1&&y===v)r.insertBefore(h,d),Be(h,f,n,i),h=e[--a],f=t[++l];else {if(!g){g={};for(let T=o;T<=a;T++){let L=e[T];L&&n.mirror.hasNode(L)&&(g[n.mirror.getId(L)]=T);}}if(I=g[i.getId(f)],I){let T=e[I];r.insertBefore(T,d),Be(T,f,n,i),e[I]=void 0;}else {let T=Sr(f,n.mirror,i);r.nodeName==="#document"&&((s=n.mirror.getMeta(T))===null||s===void 0?void 0:s.type)===re.Element&&r.documentElement&&(r.removeChild(r.documentElement),e[o]=void 0,d=void 0),r.insertBefore(T,d||null),Be(T,f,n,i);}f=t[++l];}}if(o>a){let C=t[c+1],y=null;for(C&&r.childNodes.forEach(v=>{n.mirror.getId(v)===i.getId(C)&&(y=v);});l<=c;++l){let v=Sr(t[l],n.mirror,i);r.insertBefore(v,y),Be(v,t[l],n,i);}}else if(l>c)for(;o<=a;o++){let C=e[o];C&&(r.removeChild(C),n.mirror.removeNodeFromMap(C));}}function Sr(e,t,r){let n=r.getId(e),i=r.getMeta(e),s=null;if(n>-1&&(s=t.getNode(n)),s!==null)return s;switch(e.RRNodeType){case re.Document:s=new Document;break;case re.DocumentType:s=document.implementation.createDocumentType(e.name,e.publicId,e.systemId);break;case re.Element:{let o=e.tagName.toLowerCase();o=ml[o]||o,i&&"isSVG"in i&&i?.isSVG?s=document.createElementNS(vn.svg,o):s=document.createElement(e.tagName);break}case re.Text:s=document.createTextNode(e.data);break;case re.Comment:s=document.createComment(e.data);break;case re.CDATA:s=document.createCDATASection(e.data);break}return i&&t.add(s,Object.assign({},i)),s}function bl(e){return e instanceof HTMLFormElement?"FORM":e.tagName.toUpperCase()}function wn(e,t,r,n){let i;switch(e.nodeType){case Se.DOCUMENT_NODE:n&&n.nodeName==="IFRAME"?i=n.contentDocument:(i=t,i.compatMode=e.compatMode);break;case Se.DOCUMENT_TYPE_NODE:{let o=e;i=t.createDocumentType(o.name,o.publicId,o.systemId);break}case Se.ELEMENT_NODE:{let o=e,a=bl(o);i=t.createElement(a);let l=i;for(let{name:c,value:d}of Array.from(o.attributes))l.attributes[c]=d;o.scrollLeft&&(l.scrollLeft=o.scrollLeft),o.scrollTop&&(l.scrollTop=o.scrollTop);break}case Se.TEXT_NODE:i=t.createTextNode(e.textContent||"");break;case Se.CDATA_SECTION_NODE:i=t.createCDATASection(e.data);break;case Se.COMMENT_NODE:i=t.createComment(e.textContent||"");break;case Se.DOCUMENT_FRAGMENT_NODE:i=n.attachShadow({mode:"open"});break;default:return null}let s=r.getMeta(e);return t instanceof ft&&(s||(s=En(i,t.unserializedId),r.add(e,s)),t.mirror.add(i,Object.assign({},s))),i}function Rs(e,t=al(),r=new ft){function n(i,s){let o=wn(i,r,t,s);if(o!==null)if(s?.nodeName!=="IFRAME"&&i.nodeType!==Se.DOCUMENT_FRAGMENT_NODE&&(s?.appendChild(o),o.parentNode=s,o.parentElement=s),i.nodeName==="IFRAME"){let a=i.contentDocument;a&&n(a,o);}else (i.nodeType===Se.DOCUMENT_NODE||i.nodeType===Se.ELEMENT_NODE||i.nodeType===Se.DOCUMENT_FRAGMENT_NODE)&&(i.nodeType===Se.ELEMENT_NODE&&i.shadowRoot&&n(i.shadowRoot,o),i.childNodes.forEach(a=>n(a,o)));}return n(e,null),r}function Cl(){return new Cn}function En(e,t){switch(e.RRNodeType){case re.Document:return {id:t,type:e.RRNodeType,childNodes:[]};case re.DocumentType:{let r=e;return {id:t,type:e.RRNodeType,name:r.name,publicId:r.publicId,systemId:r.systemId}}case re.Element:return {id:t,type:e.RRNodeType,tagName:e.tagName.toLowerCase(),attributes:{},childNodes:[]};case re.Text:return {id:t,type:e.RRNodeType,textContent:e.textContent||""};case re.Comment:return {id:t,type:e.RRNodeType,textContent:e.textContent||""};case re.CDATA:return {id:t,type:e.RRNodeType,textContent:""}}}var re,ol,cl,ul,mn,dl,hl,Le,gn,Se,vn,ml,ft,vl,pt,yn,In,Sn,bn,yl,Il,Sl,Cn,ks=V(()=>{(function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment";})(re||(re={}));ol=(function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap;}return e.prototype.getId=function(t){var r;if(!t)return -1;var n=(r=this.getMeta(t))===null||r===void 0?void 0:r.id;return n??-1},e.prototype.getNode=function(t){return this.idNodeMap.get(t)||null},e.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},e.prototype.getMeta=function(t){return this.nodeMetaMap.get(t)||null},e.prototype.removeNodeFromMap=function(t){var r=this,n=this.getId(t);this.idNodeMap.delete(n),t.childNodes&&t.childNodes.forEach(function(i){return r.removeNodeFromMap(i)});},e.prototype.has=function(t){return this.idNodeMap.has(t)},e.prototype.hasNode=function(t){return this.nodeMetaMap.has(t)},e.prototype.add=function(t,r){var n=r.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,r);},e.prototype.replace=function(t,r){var n=this.getNode(t);if(n){var i=this.nodeMetaMap.get(n);i&&this.nodeMetaMap.set(r,i);}this.idNodeMap.set(t,r);},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap;},e})();cl=/-([a-z])/g,ul=/^--[a-zA-Z0-9-]+$/,mn=e=>ul.test(e)?e:e.replace(cl,(t,r)=>r?r.toUpperCase():""),dl=/\B([A-Z])/g,hl=e=>e.replace(dl,"-$1").toLowerCase(),Le=class{constructor(...t){this.childNodes=[],this.parentElement=null,this.parentNode=null,this.ELEMENT_NODE=Se.ELEMENT_NODE,this.TEXT_NODE=Se.TEXT_NODE;}get firstChild(){return this.childNodes[0]||null}get lastChild(){return this.childNodes[this.childNodes.length-1]||null}get nextSibling(){let t=this.parentNode;if(!t)return null;let r=t.childNodes,n=r.indexOf(this);return r[n+1]||null}contains(t){if(t===this)return true;for(let r of this.childNodes)if(r.contains(t))return true;return false}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,r){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return "RRNode"}};gn=class{constructor(t,r){if(this.classes=[],this.add=(...n)=>{for(let i of n){let s=String(i);this.classes.indexOf(s)>=0||this.classes.push(s);}this.onChange&&this.onChange(this.classes.join(" "));},this.remove=(...n)=>{this.classes=this.classes.filter(i=>n.indexOf(i)===-1),this.onChange&&this.onChange(this.classes.join(" "));},t){let n=t.trim().split(/\s+/);this.classes.push(...n);}this.onChange=r;}};(function(e){e[e.PLACEHOLDER=0]="PLACEHOLDER",e[e.ELEMENT_NODE=1]="ELEMENT_NODE",e[e.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",e[e.TEXT_NODE=3]="TEXT_NODE",e[e.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",e[e.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",e[e.ENTITY_NODE=6]="ENTITY_NODE",e[e.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",e[e.COMMENT_NODE=8]="COMMENT_NODE",e[e.DOCUMENT_NODE=9]="DOCUMENT_NODE",e[e.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",e[e.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE";})(Se||(Se={}));vn={svg:"http://www.w3.org/2000/svg","xlink:href":"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/xmlns/"},ml={altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};ft=class e extends fl(Le){constructor(t){super(),this.UNSERIALIZED_STARTING_ID=-2,this._unserializedId=this.UNSERIALIZED_STARTING_ID,this.mirror=Cl(),this.scrollData=null,t&&(this.mirror=t);}get unserializedId(){return this._unserializedId--}createDocument(t,r,n){return new e}createDocumentType(t,r,n){let i=new vl(t,r,n);return i.ownerDocument=this,i}createElement(t){let r=t.toUpperCase(),n;switch(r){case "AUDIO":case "VIDEO":n=new yn(r);break;case "IFRAME":n=new bn(r,this.mirror);break;case "CANVAS":n=new In(r);break;case "STYLE":n=new Sn(r);break;default:n=new pt(r);break}return n.ownerDocument=this,n}createComment(t){let r=new Il(t);return r.ownerDocument=this,r}createCDATASection(t){let r=new Sl(t);return r.ownerDocument=this,r}createTextNode(t){let r=new yl(t);return r.ownerDocument=this,r}destroyTree(){this.childNodes=[],this.mirror.reset();}open(){super.open(),this._unserializedId=this.UNSERIALIZED_STARTING_ID;}},vl=Cs(Le),pt=class extends ws(Le){constructor(){super(...arguments),this.inputData=null,this.scrollData=null;}},yn=class extends pl(pt){},In=class extends pt{constructor(){super(...arguments),this.rr_dataURL=null,this.canvasMutations=[];}getContext(){return null}},Sn=class extends pt{constructor(){super(...arguments),this.rules=[];}},bn=class extends pt{constructor(t,r){super(t),this.contentDocument=new ft,this.contentDocument.mirror=r;}},yl=Es(Le),Il=Ts(Le),Sl=As(Le);Cn=class{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap;}getId(t){var r;if(!t)return -1;let n=(r=this.getMeta(t))===null||r===void 0?void 0:r.id;return n??-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){let r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(n=>this.removeNodeFromMap(n));}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,r){let n=r.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,r);}replace(t,r){let n=this.getNode(t);if(n){let i=this.nodeMetaMap.get(n);i&&this.nodeMetaMap.set(r,i);}this.idNodeMap.set(t,r);}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap;}};});var Ns,_s,Ms=V(()=>{pn();(({addCustomEvent:Ns}=Ze)),{freezePage:_s}=Ze;});function Bs(e,t){t===void 0&&(t={});var r=Ol();r.p(e);var n=xl(e,t,2,4);return Ll(n,t),Dl(n,n.length-4,r.d()),n}function Ws(e,t){return kl((Fl(e),e.subarray(2,-4)),t)}function Er(e,t){var r=e.length;if(!t&&typeof TextEncoder<"u")return new TextEncoder().encode(e);for(var n=new Re(e.length+(e.length>>>1)),i=0,s=function(c){n[i++]=c;},o=0;o<r;++o){if(i+5>n.length){var a=new Re(i+8+(r-o<<1));a.set(n),n=a;}var l=e.charCodeAt(o);l<128||t?s(l):l<2048?(s(192|l>>>6),s(128|l&63)):l>55295&&l<57344?(l=65536+(l&1047552)|e.charCodeAt(++o)&1023,s(240|l>>>18),s(128|l>>>12&63),s(128|l>>>6&63),s(128|l&63)):(s(224|l>>>12),s(128|l>>>6&63),s(128|l&63));}return xn(n,0,i)}function Tr(e,t){var r="";if(!t&&typeof TextDecoder<"u")return new TextDecoder().decode(e);for(var n=0;n<e.length;){var i=e[n++];i<128||t?r+=String.fromCharCode(i):i<224?r+=String.fromCharCode((i&31)<<6|e[n++]&63):i<240?r+=String.fromCharCode((i&15)<<12|(e[n++]&63)<<6|e[n++]&63):(i=((i&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,r+=String.fromCharCode(55296|i>>10,56320|i&1023));}return r}var Re,Ne,Vt,Cr,wr,kn,Ls,Fs,Ps,Nn,Us,wl,Os,_n,qe,ae,Ge,nt,ae,ae,ae,ae,Gt,ae,El,Tl,Al,Rl,Tn,We,An,On,xn,kl,Qe,Wt,Rn,Mn,xs,Ht,br,Ds,Nl,_l,Ml,Ol,xl,Dl,Ll,Fl,Dn=V(()=>{Re=Uint8Array,Ne=Uint16Array,Vt=Uint32Array,Cr=new Re([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]),wr=new Re([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]),kn=new Re([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ls=function(e,t){for(var r=new Ne(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];for(var i=new Vt(r[30]),n=1;n<30;++n)for(var s=r[n];s<r[n+1];++s)i[s]=s-r[n]<<5|n;return [r,i]},Fs=Ls(Cr,2),Ps=Fs[0],Nn=Fs[1];Ps[28]=258,Nn[258]=28;Us=Ls(wr,0),wl=Us[0],Os=Us[1],_n=new Ne(32768);for(ae=0;ae<32768;++ae)qe=(ae&43690)>>>1|(ae&21845)<<1,qe=(qe&52428)>>>2|(qe&13107)<<2,qe=(qe&61680)>>>4|(qe&3855)<<4,_n[ae]=((qe&65280)>>>8|(qe&255)<<8)>>>1;Ge=(function(e,t,r){for(var n=e.length,i=0,s=new Ne(t);i<n;++i)++s[e[i]-1];var o=new Ne(t);for(i=0;i<t;++i)o[i]=o[i-1]+s[i-1]<<1;var a;if(r){a=new Ne(1<<t);var l=15-t;for(i=0;i<n;++i)if(e[i])for(var c=i<<4|e[i],d=t-e[i],h=o[e[i]-1]++<<d,f=h|(1<<d)-1;h<=f;++h)a[_n[h]>>>l]=c;}else for(a=new Ne(n),i=0;i<n;++i)a[i]=_n[o[e[i]-1]++]>>>15-e[i];return a}),nt=new Re(288);for(ae=0;ae<144;++ae)nt[ae]=8;for(ae=144;ae<256;++ae)nt[ae]=9;for(ae=256;ae<280;++ae)nt[ae]=7;for(ae=280;ae<288;++ae)nt[ae]=8;Gt=new Re(32);for(ae=0;ae<32;++ae)Gt[ae]=5;El=Ge(nt,9,0),Tl=Ge(nt,9,1),Al=Ge(Gt,5,0),Rl=Ge(Gt,5,1),Tn=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},We=function(e,t,r){var n=t/8>>0;return (e[n]|e[n+1]<<8)>>>(t&7)&r},An=function(e,t){var r=t/8>>0;return (e[r]|e[r+1]<<8|e[r+2]<<16)>>>(t&7)},On=function(e){return (e/8>>0)+(e&7&&1)},xn=function(e,t,r){(t==null||t<0)&&(t=0),(r==null||r>e.length)&&(r=e.length);var n=new(e instanceof Ne?Ne:e instanceof Vt?Vt:Re)(r-t);return n.set(e.subarray(t,r)),n},kl=function(e,t,r){var n=e.length,i=!t||r,s=!r||r.i;r||(r={}),t||(t=new Re(n*3));var o=function(B){var pe=t.length;if(B>pe){var le=new Re(Math.max(pe*2,B));le.set(t),t=le;}},a=r.f||0,l=r.p||0,c=r.b||0,d=r.l,h=r.d,f=r.m,m=r.n,g=n*8;do{if(!d){r.f=a=We(e,l,1);var I=We(e,l+1,3);if(l+=3,I)if(I==1)d=Tl,h=Rl,f=9,m=5;else if(I==2){var S=We(e,l,31)+257,T=We(e,l+10,15)+4,L=S+We(e,l+5,31)+1;l+=14;for(var O=new Re(L),P=new Re(19),A=0;A<T;++A)P[kn[A]]=We(e,l+A*3,7);l+=T*3;var oe=Tn(P),F=(1<<oe)-1;if(!s&&l+L*(oe+7)>g)break;for(var de=Ge(P,oe,1),A=0;A<L;){var z=de[We(e,l,F)];l+=z&15;var C=z>>>4;if(C<16)O[A++]=C;else {var Q=0,W=0;for(C==16?(W=3+We(e,l,3),l+=2,Q=O[A-1]):C==17?(W=3+We(e,l,7),l+=3):C==18&&(W=11+We(e,l,127),l+=7);W--;)O[A++]=Q;}}var J=O.subarray(0,S),j=O.subarray(S);f=Tn(J),m=Tn(j),d=Ge(J,f,1),h=Ge(j,m,1);}else throw "invalid block type";else {var C=On(l)+4,y=e[C-4]|e[C-3]<<8,v=C+y;if(v>n){if(s)throw "unexpected EOF";break}i&&o(c+y),t.set(e.subarray(C,v),c),r.b=c+=y,r.p=l=v*8;continue}if(l>g)throw "unexpected EOF"}i&&o(c+131072);for(var U=(1<<f)-1,se=(1<<m)-1,w=f+m+18;s||l+w<g;){var Q=d[An(e,l)&U],b=Q>>>4;if(l+=Q&15,l>g)throw "unexpected EOF";if(!Q)throw "invalid length/literal";if(b<256)t[c++]=b;else if(b==256){d=null;break}else {var x=b-254;if(b>264){var A=b-257,M=Cr[A];x=We(e,l,(1<<M)-1)+Ps[A],l+=M;}var K=h[An(e,l)&se],ie=K>>>4;if(!K)throw "invalid distance";l+=K&15;var j=wl[ie];if(ie>3){var M=wr[ie];j+=An(e,l)&(1<<M)-1,l+=M;}if(l>g)throw "unexpected EOF";i&&o(c+131072);for(var he=c+x;c<he;c+=4)t[c]=t[c-j],t[c+1]=t[c+1-j],t[c+2]=t[c+2-j],t[c+3]=t[c+3-j];c=he;}}r.l=d,r.p=l,r.b=c,d&&(a=1,r.m=f,r.d=h,r.n=m);}while(!a);return c==t.length?t:xn(t,0,c)},Qe=function(e,t,r){r<<=t&7;var n=t/8>>0;e[n]|=r,e[n+1]|=r>>>8;},Wt=function(e,t,r){r<<=t&7;var n=t/8>>0;e[n]|=r,e[n+1]|=r>>>8,e[n+2]|=r>>>16;},Rn=function(e,t){for(var r=[],n=0;n<e.length;++n)e[n]&&r.push({s:n,f:e[n]});var i=r.length,s=r.slice();if(!i)return [new Re(0),0];if(i==1){var o=new Re(r[0].s+1);return o[r[0].s]=1,[o,1]}r.sort(function(L,O){return L.f-O.f}),r.push({s:-1,f:25001});var a=r[0],l=r[1],c=0,d=1,h=2;for(r[0]={s:-1,f:a.f+l.f,l:a,r:l};d!=i-1;)a=r[r[c].f<r[h].f?c++:h++],l=r[c!=d&&r[c].f<r[h].f?c++:h++],r[d++]={s:-1,f:a.f+l.f,l:a,r:l};for(var f=s[0].s,n=1;n<i;++n)s[n].s>f&&(f=s[n].s);var m=new Ne(f+1),g=Mn(r[d-1],m,0);if(g>t){var n=0,I=0,C=g-t,y=1<<C;for(s.sort(function(O,P){return m[P.s]-m[O.s]||O.f-P.f});n<i;++n){var v=s[n].s;if(m[v]>t)I+=y-(1<<g-m[v]),m[v]=t;else break}for(I>>>=C;I>0;){var S=s[n].s;m[S]<t?I-=1<<t-m[S]++-1:++n;}for(;n>=0&&I;--n){var T=s[n].s;m[T]==t&&(--m[T],++I);}g=t;}return [new Re(m),g]},Mn=function(e,t,r){return e.s==-1?Math.max(Mn(e.l,t,r+1),Mn(e.r,t,r+1)):t[e.s]=r},xs=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new Ne(++t),n=0,i=e[0],s=1,o=function(l){r[n++]=l;},a=1;a<=t;++a)if(e[a]==i&&a!=t)++s;else {if(!i&&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(i),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0);}for(;s--;)o(i);s=1,i=e[a];}return [r.subarray(0,n),t]},Ht=function(e,t){for(var r=0,n=0;n<t.length;++n)r+=e[n]*t[n];return r},br=function(e,t,r){var n=r.length,i=On(t+2);e[i]=n&255,e[i+1]=n>>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var s=0;s<n;++s)e[i+s+4]=r[s];return (i+4+n)*8},Ds=function(e,t,r,n,i,s,o,a,l,c,d){Qe(t,d++,r),++i[256];for(var h=Rn(i,15),f=h[0],m=h[1],g=Rn(s,15),I=g[0],C=g[1],y=xs(f),v=y[0],S=y[1],T=xs(I),L=T[0],O=T[1],P=new Ne(19),A=0;A<v.length;++A)P[v[A]&31]++;for(var A=0;A<L.length;++A)P[L[A]&31]++;for(var oe=Rn(P,7),F=oe[0],de=oe[1],z=19;z>4&&!F[kn[z-1]];--z);var Q=c+5<<3,W=Ht(i,nt)+Ht(s,Gt)+o,J=Ht(i,f)+Ht(s,I)+o+14+3*z+Ht(P,F)+(2*P[16]+3*P[17]+7*P[18]);if(Q<=W&&Q<=J)return br(t,d,e.subarray(l,l+c));var j,U,se,w;if(Qe(t,d,1+(J<W)),d+=2,J<W){j=Ge(f,m,0),U=f,se=Ge(I,C,0),w=I;var b=Ge(F,de,0);Qe(t,d,S-257),Qe(t,d+5,O-1),Qe(t,d+10,z-4),d+=14;for(var A=0;A<z;++A)Qe(t,d+3*A,F[kn[A]]);d+=3*z;for(var x=[v,L],M=0;M<2;++M)for(var K=x[M],A=0;A<K.length;++A){var ie=K[A]&31;Qe(t,d,b[ie]),d+=F[ie],ie>15&&(Qe(t,d,K[A]>>>5&127),d+=K[A]>>>12);}}else j=El,U=nt,se=Al,w=Gt;for(var A=0;A<a;++A)if(n[A]>255){var ie=n[A]>>>18&31;Wt(t,d,j[ie+257]),d+=U[ie+257],ie>7&&(Qe(t,d,n[A]>>>23&31),d+=Cr[ie]);var he=n[A]&31;Wt(t,d,se[he]),d+=w[he],he>3&&(Wt(t,d,n[A]>>>5&8191),d+=wr[he]);}else Wt(t,d,j[n[A]]),d+=U[n[A]];return Wt(t,d,j[256]),d+U[256]},Nl=new Vt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),_l=new Re(0),Ml=function(e,t,r,n,i,s){var o=e.length,a=new Re(n+o+5*(1+Math.floor(o/7e3))+i),l=a.subarray(n,a.length-i),c=0;if(!t||o<8)for(var d=0;d<=o;d+=65535){var h=d+65535;h<o?c=br(l,c,e.subarray(d,h)):(l[d]=s,c=br(l,c,e.subarray(d,o)));}else {for(var f=Nl[t-1],m=f>>>13,g=f&8191,I=(1<<r)-1,C=new Ne(32768),y=new Ne(I+1),v=Math.ceil(r/3),S=2*v,T=function(ve){return (e[ve]^e[ve+1]<<v^e[ve+2]<<S)&I},L=new Vt(25e3),O=new Ne(288),P=new Ne(32),A=0,oe=0,d=0,F=0,de=0,z=0;d<o;++d){var Q=T(d),W=d&32767,J=y[Q];if(C[W]=J,y[Q]=W,de<=d){var j=o-d;if((A>7e3||F>24576)&&j>423){c=Ds(e,l,0,L,O,P,oe,F,z,d-z,c),F=A=oe=0,z=d;for(var U=0;U<286;++U)O[U]=0;for(var U=0;U<30;++U)P[U]=0;}var se=2,w=0,b=g,x=W-J&32767;if(j>2&&Q==T(d-x))for(var M=Math.min(m,j)-1,K=Math.min(32767,d),ie=Math.min(258,j);x<=K&&--b&&W!=J;){if(e[d+se]==e[d+se-x]){for(var he=0;he<ie&&e[d+he]==e[d+he-x];++he);if(he>se){if(se=he,w=x,he>M)break;for(var B=Math.min(x,he-2),pe=0,U=0;U<B;++U){var le=d-x+U+32768&32767,ce=C[le],Ee=le-ce+32768&32767;Ee>pe&&(pe=Ee,J=le);}}}W=J,J=C[W],x+=W-J+32768&32767;}if(w){L[F++]=268435456|Nn[se]<<18|Os[w];var ee=Nn[se]&31,we=Os[w]&31;oe+=Cr[ee]+wr[we],++O[257+ee],++P[we],de=d+se,++A;}else L[F++]=e[d],++O[e[d]];}}c=Ds(e,l,s,L,O,P,oe,F,z,d-z,c),s||(c=br(l,c,_l));}return xn(a,0,n+On(c)+i)},Ol=function(){var e=1,t=0;return {p:function(r){for(var n=e,i=t,s=r.length,o=0;o!=s;){for(var a=Math.min(o+5552,s);o<a;++o)n+=r[o],i+=n;n%=65521,i%=65521;}e=n,t=i;},d:function(){return (e>>>8<<16|(t&255)<<8|t>>>8)+((e&255)<<23)*2}}},xl=function(e,t,r,n,i){return Ml(e,t.level==null?6:t.level,t.mem==null?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):12+t.mem,r,n,!i)},Dl=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8;},Ll=function(e,t){var r=t.level,n=r==0?0:r<6?1:r==9?3:2;e[0]=120,e[1]=n<<6|(n?32-2*n:1);},Fl=function(e){if((e[0]&15)!=8||e[0]>>>4>7||(e[0]<<8|e[1])%31)throw "invalid zlib data";if(e[1]&32)throw "invalid zlib data: preset dictionaries not supported"};});var Vs,Gs=V(()=>{Dn();Vs=e=>{let t=Object.assign(Object.assign({},e),{v:"v1"});return Tr(Bs(Er(JSON.stringify(t))),true)};});var js,zs=V(()=>{Dn();js=e=>{if(typeof e!="string")return e;try{let t=JSON.parse(e);if(t.timestamp)return t}catch{}try{let t=JSON.parse(Tr(Ws(Er(e,!0))));if(t.v==="v1")return t;throw new Error(`These events were packed with packer ${t.v} which is incompatible with current packer ${"v1"}.`)}catch(t){throw console.error(t),new Error("Unknown data format.")}};});var it,Pl,Ys,Ul,Ln,Ks=V(()=>{it=class{constructor(t){this.fileName=t.fileName||"",this.functionName=t.functionName||"",this.lineNumber=t.lineNumber,this.columnNumber=t.columnNumber;}toString(){let t=this.lineNumber||"",r=this.columnNumber||"";return this.functionName?`${this.functionName} (${this.fileName}:${t}:${r})`:`${this.fileName}:${t}:${r}`}},Pl=/(^|@)\S+:\d+/,Ys=/^\s*at .*(\S+:\d+|\(native\))/m,Ul=/^(eval@)?(\[native code])?$/,Ln={parse:function(e){if(!e)return [];if(typeof e.stacktrace<"u"||typeof e["opera#sourceloc"]<"u")return this.parseOpera(e);if(e.stack&&e.stack.match(Ys))return this.parseV8OrIE(e);if(e.stack)return this.parseFFOrSafari(e);throw new Error("Cannot parse given Error object")},extractLocation:function(e){if(e.indexOf(":")===-1)return [e];let r=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!r)throw new Error(`Cannot parse given url: ${e}`);return [r[1],r[2]||void 0,r[3]||void 0]},parseV8OrIE:function(e){return e.stack.split(`
|
|
7
|
+
`).filter(function(r){return !!r.match(Ys)},this).map(function(r){r.indexOf("(eval ")>-1&&(r=r.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let n=r.replace(/^\s+/,"").replace(/\(eval code/g,"("),i=n.match(/ (\((.+):(\d+):(\d+)\)$)/);n=i?n.replace(i[0],""):n;let s=n.split(/\s+/).slice(1),o=this.extractLocation(i?i[1]:s.pop()),a=s.join(" ")||void 0,l=["eval","<anonymous>"].indexOf(o[0])>-1?void 0:o[0];return new it({functionName:a,fileName:l,lineNumber:o[1],columnNumber:o[2]})},this)},parseFFOrSafari:function(e){return e.stack.split(`
|
|
8
|
+
`).filter(function(r){return !r.match(Ul)},this).map(function(r){if(r.indexOf(" > eval")>-1&&(r=r.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),r.indexOf("@")===-1&&r.indexOf(":")===-1)return new it({functionName:r});{let n=/((.*".+"[^@]*)?[^@]*)(?:@)/,i=r.match(n),s=i&&i[1]?i[1]:void 0,o=this.extractLocation(r.replace(n,""));return new it({functionName:s,fileName:o[0],lineNumber:o[1],columnNumber:o[2]})}},this)},parseOpera:function(e){return !e.stacktrace||e.message.indexOf(`
|
|
9
|
+
`)>-1&&e.message.split(`
|
|
10
|
+
`).length>e.stacktrace.split(`
|
|
11
|
+
`).length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){let t=/Line (\d+).*script (?:in )?(\S+)/i,r=e.message.split(`
|
|
12
|
+
`),n=[];for(let i=2,s=r.length;i<s;i+=2){let o=t.exec(r[i]);o&&n.push(new it({fileName:o[2],lineNumber:parseFloat(o[1])}));}return n},parseOpera10:function(e){let t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=e.stacktrace.split(`
|
|
13
|
+
`),n=[];for(let i=0,s=r.length;i<s;i+=2){let o=t.exec(r[i]);o&&n.push(new it({functionName:o[3]||void 0,fileName:o[2],lineNumber:parseFloat(o[1])}));}return n},parseOpera11:function(e){return e.stack.split(`
|
|
14
|
+
`).filter(function(r){return !!r.match(Pl)&&!r.match(/^Error created at/)},this).map(function(r){let n=r.split("@"),i=this.extractLocation(n.pop()),o=(n.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new it({functionName:o,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})},this)}};});function Bl(e){if(!e||!e.outerHTML)return "";let t="";for(;e.parentElement;){let r=e.localName;if(!r)break;r=r.toLowerCase();let n=e.parentElement,i=[];if(n.children&&n.children.length>0)for(let s=0;s<n.children.length;s++){let o=n.children[s];o.localName&&o.localName.toLowerCase&&o.localName.toLowerCase()===r&&i.push(o);}i.length>1&&(r+=`:eq(${i.indexOf(e)})`),t=r+(t?">"+t:""),e=n;}return t}function Fn(e){return Object.prototype.toString.call(e)==="[object Object]"}function Zs(e,t){if(t===0)return true;let r=Object.keys(e);for(let n of r)if(Fn(e[n])&&Zs(e[n],t-1))return true;return false}function Ar(e,t){let r={numOfKeysLimit:50,depthOfLimit:4};Object.assign(r,t);let n=[],i=[];return JSON.stringify(e,function(a,l){if(n.length>0){let c=n.indexOf(this);~c?n.splice(c+1):n.push(this),~c?i.splice(c,1/0,a):i.push(a),~n.indexOf(l)&&(n[0]===l?l="[Circular ~]":l="[Circular ~."+i.slice(0,n.indexOf(l)).join(".")+"]");}else n.push(l);if(l===null)return l;if(l===void 0)return "undefined";if(s(l))return o(l);if(l instanceof Event){let c={};for(let d in l){let h=l[d];Array.isArray(h)?c[d]=Bl(h.length?h[0]:null):c[d]=h;}return c}else {if(l instanceof Node)return l instanceof HTMLElement?l?l.outerHTML:"":l.nodeName;if(l instanceof Error)return l.stack?l.stack+`
|
|
15
|
+
End of stack for Error object`:l.name+": "+l.message}return l});function s(a){return !!(Fn(a)&&Object.keys(a).length>r.numOfKeysLimit||typeof a=="function"||Fn(a)&&Zs(a,r.depthOfLimit))}function o(a){let l=a.toString();return r.stringLengthLimit&&l.length>r.stringLengthLimit&&(l=`${l.slice(0,r.stringLengthLimit)}...`),l}}var qs=V(()=>{});function Wl(e,t,r){let n=r?Object.assign({},Qs,r):Qs,i=n.logger;if(!i)return ()=>{};let s;typeof i=="string"?s=t[i]:s=i;let o=0,a=[];if(n.level.includes("error")&&window){let c=d=>{let h=d.message,f=d.error,m=Ln.parse(f).map(I=>I.toString()),g=[Ar(h,n.stringifyOptions)];e({level:"error",trace:m,payload:g});};window.addEventListener("error",c),a.push(()=>{window&&window.removeEventListener("error",c);});}for(let c of n.level)a.push(l(s,c));return ()=>{a.forEach(c=>c());};function l(c,d){return c[d]?_e(c,d,h=>(...f)=>{h.apply(this,f);try{let m=Ln.parse(new Error).map(I=>I.toString()).splice(1),g=f.map(I=>Ar(I,n.stringifyOptions));o++,o<n.lengthThreshold?e({level:d,trace:m,payload:g}):o===n.lengthThreshold&&e({level:"warn",trace:[],payload:[Ar("The number of log records reached the threshold.")]});}catch(m){h("rrweb logger error:",m,...f);}}):()=>{}}}var Qs,jt,Xs,Pn=V(()=>{Me();Ks();qs();Qs={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:"console"};jt="rrweb/console@1",Xs=e=>({name:jt,observer:Wl,options:e});});var Rr,Hl,Un,$s,Js=V(()=>{Pn();xe();Rr="__rrweb_original__",Hl={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],replayLogger:void 0},Un=class{constructor(t){this.config=Object.assign(Hl,t);}getConsoleLogger(){let t={};for(let r of this.config.level)r==="trace"?t[r]=n=>{(console.log[Rr]?console.log[Rr]:console.log)(...n.payload.map(s=>JSON.parse(s)),this.formatMessage(n));}:t[r]=n=>{(console[r][Rr]?console[r][Rr]:console[r])(...n.payload.map(s=>JSON.parse(s)),this.formatMessage(n));};return t}formatMessage(t){if(t.trace.length===0)return "";let r=`
|
|
16
|
+
at `,n=r;return n+=t.trace.join(r),n}},$s=e=>{let t=e?.replayLogger||new Un(e).getConsoleLogger();return {handler(r,n,i){let s=null;if(r.type===N.IncrementalSnapshot&&r.data.source===k.Log?s=r.data:r.type===N.Plugin&&r.data.plugin===jt&&(s=r.data.payload),s)try{typeof t[s.level]=="function"&&t[s.level](s);}catch(o){i.replayer.config.showWarning&&console.warn(o);}}}};});var Wn={};Wr(Wn,{default:()=>Bn});function Bn(e){return {all:e=e||new Map,on:function(t,r){var n=e.get(t);n?n.push(r):e.set(t,[r]);},off:function(t,r){var n=e.get(t);n&&(r?n.splice(n.indexOf(r)>>>0,1):e.set(t,[]));},emit:function(t,r){var n=e.get(t);n&&n.slice().map(function(i){i(r);}),(n=e.get("*"))&&n.slice().map(function(i){i(t,r);});}}}var Hn=V(()=>{});function eo(e=window,t=document){if("scrollBehavior"in t.documentElement.style&&e.__forceSmoothScrollPolyfill__!==true)return;let r=e.HTMLElement||e.Element,n=468,i={scroll:e.scroll||e.scrollTo,scrollBy:e.scrollBy,elementScroll:r.prototype.scroll||l,scrollIntoView:r.prototype.scrollIntoView},s=e.performance&&e.performance.now?e.performance.now.bind(e.performance):Date.now;function o(y){let v=["MSIE ","Trident/","Edge/"];return new RegExp(v.join("|")).test(y)}let a=o(e.navigator.userAgent)?1:0;function l(y,v){this.scrollLeft=y,this.scrollTop=v;}function c(y){return .5*(1-Math.cos(Math.PI*y))}function d(y){if(y===null||typeof y!="object"||y.behavior===void 0||y.behavior==="auto"||y.behavior==="instant")return true;if(typeof y=="object"&&y.behavior==="smooth")return false;throw new TypeError("behavior member of ScrollOptions "+y.behavior+" is not a valid value for enumeration ScrollBehavior.")}function h(y,v){if(v==="Y")return y.clientHeight+a<y.scrollHeight;if(v==="X")return y.clientWidth+a<y.scrollWidth}function f(y,v){let S=e.getComputedStyle(y,null)["overflow"+v];return S==="auto"||S==="scroll"}function m(y){let v=h(y,"Y")&&f(y,"Y"),S=h(y,"X")&&f(y,"X");return v||S}function g(y){for(;y!==t.body&&m(y)===false;)y=y.parentNode||y.host;return y}function I(y){let v=s(),S,T,L,O=(v-y.startTime)/n;O=O>1?1:O,S=c(O),T=y.startX+(y.x-y.startX)*S,L=y.startY+(y.y-y.startY)*S,y.method.call(y.scrollable,T,L),(T!==y.x||L!==y.y)&&e.requestAnimationFrame(I.bind(e,y));}function C(y,v,S){let T,L,O,P,A=s();y===t.body?(T=e,L=e.scrollX||e.pageXOffset,O=e.scrollY||e.pageYOffset,P=i.scroll):(T=y,L=y.scrollLeft,O=y.scrollTop,P=l),I({scrollable:T,method:P,startTime:A,startX:L,startY:O,x:v,y:S});}e.scroll=e.scrollTo=function(){if(arguments[0]!==void 0){if(d(arguments[0])===true){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}C.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(d(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}C.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(d(arguments[0])===true){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}let y=arguments[0].left,v=arguments[0].top;C.call(this,this,typeof y>"u"?this.scrollLeft:~~y,typeof v>"u"?this.scrollTop:~~v);},r.prototype.scrollBy=function(){if(arguments[0]!==void 0){if(d(arguments[0])===true){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(d(arguments[0])===true){i.scrollIntoView.call(this,arguments[0]===void 0?true:arguments[0]);return}let y=g(this),v=y.getBoundingClientRect(),S=this.getBoundingClientRect();y!==t.body?(C.call(this,y,y.scrollLeft+S.left-v.left,y.scrollTop+S.top-v.top),e.getComputedStyle(y).position!=="fixed"&&e.scrollBy({left:v.left,top:v.top,behavior:"smooth"})):e.scrollBy({left:S.left,top:S.top,behavior:"smooth"});};}var to=V(()=>{});function Vn(e,t){if(e.type===N.IncrementalSnapshot&&e.data.source===k.MouseMove&&e.data.positions&&e.data.positions.length){let r=e.data.positions[0].timeOffset,n=e.timestamp+r;return e.delay=n-t,n-t}return e.delay=e.timestamp-t,e.delay}var kr,Gn=V(()=>{xe();kr=class{constructor(t=[],r){this.timeOffset=0,this.raf=null,this.actions=t,this.speed=r.speed,this.liveMode=r.liveMode;}addAction(t){if(!this.actions.length||this.actions[this.actions.length-1].delay<=t.delay){this.actions.push(t);return}let r=this.findActionIndex(t);this.actions.splice(r,0,t);}start(){this.timeOffset=0;let t=performance.now(),r=()=>{let n=performance.now();for(this.timeOffset+=(n-t)*this.speed,t=n;this.actions.length;){let i=this.actions[0];if(this.timeOffset>=i.delay)this.actions.shift(),i.doAction();else break}(this.actions.length>0||this.liveMode)&&(this.raf=requestAnimationFrame(r));};this.raf=requestAnimationFrame(r);}clear(){this.raf&&(cancelAnimationFrame(this.raf),this.raf=null),this.actions.length=0;}setSpeed(t){this.speed=t;}toggleLiveMode(t){this.liveMode=t;}isActive(){return this.raf!==null}findActionIndex(t){let r=0,n=this.actions.length-1;for(;r<=n;){let i=Math.floor((r+n)/2);if(this.actions[i].delay<t.delay)r=i+1;else if(this.actions[i].delay>t.delay)n=i-1;else return i+1}return r}};});function ro(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n,i,s=r.call(e),o=[];try{for(;(t===void 0||t-- >0)&&!(n=s.next()).done;)o.push(n.value);}catch(a){i={error:a};}finally{try{n&&!n.done&&(r=s.return)&&r.call(s);}finally{if(i)throw i.error}}return o}function jn(e){return e===void 0?[]:[].concat(e)}function mt(e){return {type:"xstate.assign",assignment:e}}function no(e,t){return typeof(e=typeof e=="string"&&t&&t[e]?t[e]:e)=="string"?{type:e}:typeof e=="function"?{type:e.name,exec:e}:e}function Nr(e){return function(t){return e===t}}function lo(e){return typeof e=="string"?{type:e}:e}function io(e,t){return {value:e,context:t,actions:[],changed:false,matches:Nr(e)}}function so(e,t,r){var n=t,i=false;return [e.filter((function(s){if(s.type==="xstate.assign"){i=true;var o=Object.assign({},n);return typeof s.assignment=="function"?o=s.assignment(n,r):Object.keys(s.assignment).forEach((function(a){o[a]=typeof s.assignment[a]=="function"?s.assignment[a](n,r):s.assignment[a];})),n=o,false}return true})),n,i]}function zn(e,t){t===void 0&&(t={});var r=ro(so(jn(e.states[e.initial].entry).map((function(o){return no(o,t.actions)})),e.context,ao),2),n=r[0],i=r[1],s={config:e,_options:t,initialState:{value:e.initial,actions:n,context:i,matches:Nr(e.initial)},transition:function(o,a){var l,c,d=typeof o=="string"?{value:o,context:e.context}:o,h=d.value,f=d.context,m=lo(a),g=e.states[h];if(g.on){var I=jn(g.on[m.type]);try{for(var C=(function(U){var se=typeof Symbol=="function"&&Symbol.iterator,w=se&&U[se],b=0;if(w)return w.call(U);if(U&&typeof U.length=="number")return {next:function(){return U&&b>=U.length&&(U=void 0),{value:U&&U[b++],done:!U}}};throw new TypeError(se?"Object is not iterable.":"Symbol.iterator is not defined.")})(I),y=C.next();!y.done;y=C.next()){var v=y.value;if(v===void 0)return io(h,f);var S=typeof v=="string"?{target:v}:v,T=S.target,L=S.actions,O=L===void 0?[]:L,P=S.cond,A=P===void 0?function(){return !0}:P,oe=T===void 0,F=T??h,de=e.states[F];if(A(f,m)){var z=ro(so((oe?jn(O):[].concat(g.exit,O,de.entry).filter((function(U){return U}))).map((function(U){return no(U,s._options.actions)})),f,m),3),Q=z[0],W=z[1],J=z[2],j=T??h;return {value:j,context:W,actions:Q,changed:T!==h||Q.length>0||J,matches:Nr(j)}}}}catch(U){l={error:U};}finally{try{y&&!y.done&&(c=C.return)&&c.call(C);}finally{if(l)throw l.error}}}return io(h,f)}};return s}function Yn(e){var t=e.initialState,r=Ct.NotStarted,n=new Set,i={_machine:e,send:function(s){r===Ct.Running&&(t=e.transition(t,s),oo(t,lo(s)),n.forEach((function(o){return o(t)})));},subscribe:function(s){return n.add(s),s(t),{unsubscribe:function(){return n.delete(s)}}},start:function(s){if(s){var o=typeof s=="object"?s:{context:e.config.context,value:s};t={value:o.value,actions:[],context:o.context,matches:Nr(o.value)};}return r=Ct.Running,oo(t,ao),i},stop:function(){return r=Ct.Stopped,n.clear(),i},get state(){return t},get status(){return r}};return i}var Ct,ao,oo,co=V(()=>{(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped";})(Ct||(Ct={}));ao={type:"xstate.init"};oo=function(e,t){return e.actions.forEach((function(r){var n=r.exec;return n&&n(e.context,t)}))};});function Vl(e,t){for(let r=e.length-1;r>=0;r--){let n=e[r];if(n.type===N.Meta&&n.timestamp<=t)return e.slice(r)}return e}function uo(e,{getCastFn:t,applyEventsSynchronously:r,emitter:n}){let i=zn({id:"player",context:e,initial:"paused",states:{playing:{on:{PAUSE:{target:"paused",actions:["pause"]},CAST_EVENT:{target:"playing",actions:"castEvent"},END:{target:"paused",actions:["resetLastPlayedEvent","pause"]},ADD_EVENT:{target:"playing",actions:["addEvent"]}}},paused:{on:{PLAY:{target:"playing",actions:["recordTimeOffset","play"]},CAST_EVENT:{target:"paused",actions:"castEvent"},TO_LIVE:{target:"live",actions:["startLive"]},ADD_EVENT:{target:"paused",actions:["addEvent"]}}},live:{on:{ADD_EVENT:{target:"live",actions:["addEvent"]},CAST_EVENT:{target:"live",actions:["castEvent"]}}}}},{actions:{castEvent:mt({lastPlayedEvent:(s,o)=>o.type==="CAST_EVENT"?o.payload.event:s.lastPlayedEvent}),recordTimeOffset:mt((s,o)=>{let a=s.timeOffset;return "payload"in o&&"timeOffset"in o.payload&&(a=o.payload.timeOffset),Object.assign(Object.assign({},s),{timeOffset:a,baselineTime:s.events[0].timestamp+a})}),play(s){var o;let{timer:a,events:l,baselineTime:c,lastPlayedEvent:d}=s;a.clear();for(let g of l)Vn(g,c);let h=Vl(l,c),f=d?.timestamp;d?.type===N.IncrementalSnapshot&&d.data.source===k.MouseMove&&(f=d.timestamp+((o=d.data.positions[0])===null||o===void 0?void 0:o.timeOffset)),c<(f||0)&&n.emit(ne.PlayBack);let m=new Array;for(let g of h)if(!(f&&f<c&&(g.timestamp<=f||g===d)))if(g.timestamp<c)m.push(g);else {let I=t(g,false);a.addAction({doAction:()=>{I();},delay:g.delay});}r(m),n.emit(ne.Flush),a.start();},pause(s){s.timer.clear();},resetLastPlayedEvent:mt(s=>Object.assign(Object.assign({},s),{lastPlayedEvent:null})),startLive:mt({baselineTime:(s,o)=>(s.timer.toggleLiveMode(true),s.timer.start(),o.type==="TO_LIVE"&&o.payload.baselineTime?o.payload.baselineTime:Date.now())}),addEvent:mt((s,o)=>{let{baselineTime:a,timer:l,events:c}=s;if(o.type==="ADD_EVENT"){let{event:d}=o.payload;Vn(d,a);let h=c.length-1;if(!c[h]||c[h].timestamp<=d.timestamp)c.push(d);else {let g=-1,I=0;for(;I<=h;){let C=Math.floor((I+h)/2);c[C].timestamp<=d.timestamp?I=C+1:h=C-1;}g===-1&&(g=I),c.splice(g,0,d);}let f=d.timestamp<a,m=t(d,f);f?m():l.isActive()&&l.addAction({doAction:()=>{m();},delay:d.delay});}return Object.assign(Object.assign({},s),{events:c})})}});return Yn(i)}function ho(e){let t=zn({id:"speed",context:e,initial:"normal",states:{normal:{on:{FAST_FORWARD:{target:"skipping",actions:["recordSpeed","setSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}},skipping:{on:{BACK_TO_NORMAL:{target:"normal",actions:["restoreSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}}}},{actions:{setSpeed:(r,n)=>{"payload"in n&&r.timer.setSpeed(n.payload.speed);},recordSpeed:mt({normalSpeed:r=>r.timer.speed}),restoreSpeed:r=>{r.timer.setSpeed(r.normalSpeed);}}});return Yn(t)}var fo=V(()=>{co();xe();Gn();});var po,mo=V(()=>{po=e=>[`.${e} { background: currentColor }`,"noscript { display: none !important; }"];});function Kn(e,t){let r=go.get(e);return r||(r=new Map,go.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}function He(e,t,r){return n=>De(this,void 0,void 0,function*(){if(n&&typeof n=="object"&&"rr_type"in n)if(r&&(r.isUnchanged=false),n.rr_type==="ImageBitmap"&&"args"in n){let i=yield He(e,t,r)(n.args);return yield createImageBitmap.apply(null,i)}else if("index"in n){if(r||t===null)return n;let{rr_type:i,index:s}=n;return Kn(t,i)[s]}else if("args"in n){let{rr_type:i,args:s}=n,o=window[i];return new o(...yield Promise.all(s.map(He(e,t,r))))}else {if("base64"in n)return Qi(n.base64);if("src"in n){let i=e.get(n.src);if(i)return i;{let s=new Image;return s.src=n.src,e.set(n.src,s),s}}else if("data"in n&&n.rr_type==="Blob"){let i=yield Promise.all(n.data.map(He(e,t,r)));return new Blob(i,{type:n.type})}}else if(Array.isArray(n))return yield Promise.all(n.map(He(e,t,r)));return n})}var go,_r=V(()=>{ht();ln();go=new Map;});function Gl(e,t){try{return t===Oe.WebGL?e.getContext("webgl")||e.getContext("experimental-webgl"):e.getContext("webgl2")}catch{return null}}function zl(e,t){if(!t?.constructor)return;let{name:r}=t.constructor;if(!jl.includes(r))return;let n=Kn(e,r);n.includes(t)||n.push(t);}function vo({mutation:e,target:t,type:r,imageMap:n,errorHandler:i}){return De(this,void 0,void 0,function*(){try{let s=Gl(t,r);if(!s)return;if(e.setter){s[e.property]=e.args[0];return}let o=s[e.property],a=yield Promise.all(e.args.map(He(n,s))),l=o.apply(s,a);zl(s,l);let c=!1;}catch(s){i(e,s);}})}var jl,yo=V(()=>{ht();xe();_r();jl=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject"];});function Io({event:e,mutation:t,target:r,imageMap:n,errorHandler:i}){return De(this,void 0,void 0,function*(){try{let s=r.getContext("2d");if(t.setter){s[t.property]=t.args[0];return}let o=s[t.property];if(t.property==="drawImage"&&typeof t.args[0]=="string")n.get(e),o.apply(s,t.args);else {let a=yield Promise.all(t.args.map(He(n,s)));o.apply(s,a);}}catch(s){i(t,s);}})}var So=V(()=>{ht();_r();});function Zn({event:e,mutation:t,target:r,imageMap:n,canvasEventMap:i,errorHandler:s}){return De(this,void 0,void 0,function*(){try{let o=i.get(e)||t,a="commands"in o?o.commands:[o];if([Oe.WebGL,Oe.WebGL2].includes(t.type)){for(let l=0;l<a.length;l++){let c=a[l];yield vo({mutation:c,type:t.type,target:r,imageMap:n,errorHandler:s});}return}for(let l=0;l<a.length;l++){let c=a[l];yield Io({event:e,mutation:c,target:r,imageMap:n,errorHandler:s});}}catch(o){s(t,o);}})}var bo=V(()=>{ht();xe();yo();So();});function Co(e){return e.type==N.IncrementalSnapshot&&(e.data.source==k.TouchMove||e.data.source==k.MouseInteraction&&e.data.type==be.TouchStart)}var Yl,Kl,Zl,qn,Qn,Mr,wo=V(()=>{ht();Ye();ks();Hn();Hn();to();Gn();fo();xe();Me();mo();bo();_r();Yl=10*1e3,Kl=5*1e3,Zl=Bn||Wn,qn="[replayer]",Qn={duration:500,lineCap:"round",lineWidth:3,strokeStyle:"red"};Mr=class{constructor(t,r){if(this.usingVirtualDom=false,this.virtualDom=new ft,this.mouseTail=null,this.tailPositions=[],this.emitter=Zl(),this.legacy_missingNodeRetryMap={},this.cache=Qr(),this.imageMap=new Map,this.canvasEventMap=new Map,this.mirror=ir(),this.styleMirror=new ct,this.firstFullSnapshot=null,this.newDocumentQueue=[],this.mousePos=null,this.touchActive=null,this.lastSelectionData=null,this.constructedStyleMutations=[],this.adoptedStyleSheets=[],this.handleResize=a=>{this.iframe.style.display="inherit";for(let l of [this.mouseTail,this.iframe])l&&(l.setAttribute("width",String(a.width)),l.setAttribute("height",String(a.height)));},this.applyEventsSynchronously=a=>{for(let l of a){switch(l.type){case N.DomContentLoaded:case N.Load:case N.Custom:continue;case N.FullSnapshot:case N.Meta:case N.Plugin:case N.IncrementalSnapshot:break}this.getCastFn(l,true)();}this.touchActive===true?this.mouse.classList.add("touch-active"):this.touchActive===false&&this.mouse.classList.remove("touch-active"),this.touchActive=null;},this.getCastFn=(a,l=false)=>{let c;switch(a.type){case N.DomContentLoaded:case N.Load:break;case N.Custom:c=()=>{this.emitter.emit(ne.CustomEvent,a);};break;case N.Meta:c=()=>this.emitter.emit(ne.Resize,{width:a.data.width,height:a.data.height});break;case N.FullSnapshot:c=()=>{var h;if(this.firstFullSnapshot){if(this.firstFullSnapshot===a){this.firstFullSnapshot=true;return}}else this.firstFullSnapshot=true;this.rebuildFullSnapshot(a,l),(h=this.iframe.contentWindow)===null||h===void 0||h.scrollTo(a.data.initialOffset),this.styleMirror.reset();};break;case N.IncrementalSnapshot:c=()=>{if(this.applyIncremental(a,l),!l&&(a===this.nextUserInteractionEvent&&(this.nextUserInteractionEvent=null,this.backToNormal()),this.config.skipInactive&&!this.nextUserInteractionEvent)){for(let h of this.service.state.context.events)if(!(h.timestamp<=a.timestamp)&&this.isUserInteraction(h)){h.delay-a.delay>Yl*this.speedService.state.context.timer.speed&&(this.nextUserInteractionEvent=h);break}if(this.nextUserInteractionEvent){let h=this.nextUserInteractionEvent.delay-a.delay,f={speed:Math.min(Math.round(h/Kl),this.config.maxSpeed)};this.speedService.send({type:"FAST_FORWARD",payload:f}),this.emitter.emit(ne.SkipStart,f);}}};break}return ()=>{c&&c();for(let f of this.config.plugins||[])f.handler&&f.handler(a,l,{replayer:this});this.service.send({type:"CAST_EVENT",payload:{event:a}});let h=this.service.state.context.events.length-1;if(a===this.service.state.context.events[h]){let f=()=>{h<this.service.state.context.events.length-1||(this.backToNormal(),this.service.send("END"),this.emitter.emit(ne.Finish));};a.type===N.IncrementalSnapshot&&a.data.source===k.MouseMove&&a.data.positions.length?setTimeout(()=>{f();},Math.max(0,-a.data.positions[0].timeOffset+50)):f();}this.emitter.emit(ne.EventCast,a);}},!r?.liveMode&&t.length<2)throw new Error("Replayer need at least 2 events.");let n={speed:1,maxSpeed:360,root:document.body,loadTimeout:0,skipInactive:false,showWarning:true,showDebug:false,blockClass:"rr-block",liveMode:false,insertStyleRules:[],triggerFocus:true,UNSAFE_replayCanvas:false,pauseAnimation:true,mouseTail:Qn,useVirtualDom:true};this.config=Object.assign({},n,r),this.handleResize=this.handleResize.bind(this),this.getCastFn=this.getCastFn.bind(this),this.applyEventsSynchronously=this.applyEventsSynchronously.bind(this),this.emitter.on(ne.Resize,this.handleResize),this.setupDom();for(let a of this.config.plugins||[])a.getMirror&&a.getMirror({nodeMirror:this.mirror});this.emitter.on(ne.Flush,()=>{if(this.usingVirtualDom){let a={mirror:this.mirror,applyCanvas:(l,c,d)=>{Zn({event:l,mutation:c,target:d,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)});},applyInput:this.applyInput.bind(this),applyScroll:this.applyScroll.bind(this),applyStyleSheetMutation:(l,c)=>{l.source===k.StyleSheetRule?this.applyStyleSheetRule(l,c):l.source===k.StyleDeclaration&&this.applyStyleDeclaration(l,c);}};if(this.iframe.contentDocument&&Be(this.iframe.contentDocument,this.virtualDom,a,this.virtualDom.mirror),this.virtualDom.destroyTree(),this.usingVirtualDom=false,Object.keys(this.legacy_missingNodeRetryMap).length)for(let l in this.legacy_missingNodeRetryMap)try{let c=this.legacy_missingNodeRetryMap[l],d=Sr(c.node,this.mirror,this.virtualDom.mirror);Be(d,c.node,a,this.virtualDom.mirror),c.node=d;}catch(c){this.config.showWarning&&console.warn(c);}this.constructedStyleMutations.forEach(l=>{this.applyStyleSheetMutation(l);}),this.constructedStyleMutations=[],this.adoptedStyleSheets.forEach(l=>{this.applyAdoptedStyleSheet(l);}),this.adoptedStyleSheets=[];}this.mousePos&&(this.moveAndHover(this.mousePos.x,this.mousePos.y,this.mousePos.id,true,this.mousePos.debugData),this.mousePos=null),this.lastSelectionData&&(this.applySelection(this.lastSelectionData),this.lastSelectionData=null);}),this.emitter.on(ne.PlayBack,()=>{this.firstFullSnapshot=null,this.mirror.reset(),this.styleMirror.reset();});let i=new kr([],{speed:this.config.speed,liveMode:this.config.liveMode});this.service=uo({events:t.map(a=>r&&r.unpackFn?r.unpackFn(a):a).sort((a,l)=>a.timestamp-l.timestamp),timer:i,timeOffset:0,baselineTime:0,lastPlayedEvent:null},{getCastFn:this.getCastFn,applyEventsSynchronously:this.applyEventsSynchronously,emitter:this.emitter}),this.service.start(),this.service.subscribe(a=>{this.emitter.emit(ne.StateChange,{player:a});}),this.speedService=ho({normalSpeed:-1,timer:i}),this.speedService.start(),this.speedService.subscribe(a=>{this.emitter.emit(ne.StateChange,{speed:a});});let s=this.service.state.context.events.find(a=>a.type===N.Meta),o=this.service.state.context.events.find(a=>a.type===N.FullSnapshot);if(s){let{width:a,height:l}=s.data;setTimeout(()=>{this.emitter.emit(ne.Resize,{width:a,height:l});},0);}o&&setTimeout(()=>{var a;this.firstFullSnapshot||(this.firstFullSnapshot=o,this.rebuildFullSnapshot(o),(a=this.iframe.contentWindow)===null||a===void 0||a.scrollTo(o.data.initialOffset));},1),this.service.state.context.events.find(Co)&&this.mouse.classList.add("touch-device");}get timer(){return this.service.state.context.timer}on(t,r){return this.emitter.on(t,r),this}off(t,r){return this.emitter.off(t,r),this}setConfig(t){Object.keys(t).forEach(r=>{t[r],this.config[r]=t[r];}),this.config.skipInactive||this.backToNormal(),typeof t.speed<"u"&&this.speedService.send({type:"SET_SPEED",payload:{speed:t.speed}}),typeof t.mouseTail<"u"&&(t.mouseTail===false?this.mouseTail&&(this.mouseTail.style.display="none"):(this.mouseTail||(this.mouseTail=document.createElement("canvas"),this.mouseTail.width=Number.parseFloat(this.iframe.width),this.mouseTail.height=Number.parseFloat(this.iframe.height),this.mouseTail.classList.add("replayer-mouse-tail"),this.wrapper.insertBefore(this.mouseTail,this.iframe)),this.mouseTail.style.display="inherit"));}getMetaData(){let t=this.service.state.context.events[0],r=this.service.state.context.events[this.service.state.context.events.length-1];return {startTime:t.timestamp,endTime:r.timestamp,totalTime:r.timestamp-t.timestamp}}getCurrentTime(){return this.timer.timeOffset+this.getTimeOffset()}getTimeOffset(){let{baselineTime:t,events:r}=this.service.state.context;return t-r[0].timestamp}getMirror(){return this.mirror}play(t=0){var r,n;this.service.state.matches("paused")?this.service.send({type:"PLAY",payload:{timeOffset:t}}):(this.service.send({type:"PAUSE"}),this.service.send({type:"PLAY",payload:{timeOffset:t}})),(n=(r=this.iframe.contentDocument)===null||r===void 0?void 0:r.getElementsByTagName("html")[0])===null||n===void 0||n.classList.remove("rrweb-paused"),this.emitter.emit(ne.Start);}pause(t){var r,n;t===void 0&&this.service.state.matches("playing")&&this.service.send({type:"PAUSE"}),typeof t=="number"&&(this.play(t),this.service.send({type:"PAUSE"})),(n=(r=this.iframe.contentDocument)===null||r===void 0?void 0:r.getElementsByTagName("html")[0])===null||n===void 0||n.classList.add("rrweb-paused"),this.emitter.emit(ne.Pause);}resume(t=0){console.warn("The 'resume' was deprecated in 1.0. Please use 'play' method which has the same interface."),this.play(t),this.emitter.emit(ne.Resume);}destroy(){this.pause(),this.config.root.removeChild(this.wrapper),this.emitter.emit(ne.Destroy);}startLive(t){this.service.send({type:"TO_LIVE",payload:{baselineTime:t}});}addEvent(t){let r=this.config.unpackFn?this.config.unpackFn(t):t;Co(r)&&this.mouse.classList.add("touch-device"),Promise.resolve().then(()=>this.service.send({type:"ADD_EVENT",payload:{event:r}}));}enableInteract(){this.iframe.setAttribute("scrolling","auto"),this.iframe.style.pointerEvents="auto";}disableInteract(){this.iframe.setAttribute("scrolling","no"),this.iframe.style.pointerEvents="none";}resetCache(){this.cache=Qr();}setupDom(){this.wrapper=document.createElement("div"),this.wrapper.classList.add("replayer-wrapper"),this.config.root.appendChild(this.wrapper),this.mouse=document.createElement("div"),this.mouse.classList.add("replayer-mouse"),this.wrapper.appendChild(this.mouse),this.config.mouseTail!==false&&(this.mouseTail=document.createElement("canvas"),this.mouseTail.classList.add("replayer-mouse-tail"),this.mouseTail.style.display="inherit",this.wrapper.appendChild(this.mouseTail)),this.iframe=document.createElement("iframe");let t=["allow-same-origin"];this.config.UNSAFE_replayCanvas&&t.push("allow-scripts"),this.iframe.style.display="none",this.iframe.setAttribute("sandbox",t.join(" ")),this.disableInteract(),this.wrapper.appendChild(this.iframe),this.iframe.contentWindow&&this.iframe.contentDocument&&(eo(this.iframe.contentWindow,this.iframe.contentDocument),Dt(this.iframe.contentWindow));}rebuildFullSnapshot(t,r=false){if(!this.iframe.contentDocument)return console.warn("Looks like your replayer has been destroyed.");Object.keys(this.legacy_missingNodeRetryMap).length&&console.warn("Found unresolved missing node map",this.legacy_missingNodeRetryMap),this.legacy_missingNodeRetryMap={};let n=[],i=(a,l)=>{this.collectIframeAndAttachDocument(n,a);for(let c of this.config.plugins||[])c.onBuild&&c.onBuild(a,{id:l,replayer:this});};_i(t.data.node,{doc:this.iframe.contentDocument,afterAppend:i,cache:this.cache,mirror:this.mirror}),i(this.iframe.contentDocument,t.data.node.id);for(let{mutationInQueue:a,builtNode:l}of n)this.attachDocumentToIframe(a,l),this.newDocumentQueue=this.newDocumentQueue.filter(c=>c!==a);let{documentElement:s,head:o}=this.iframe.contentDocument;this.insertStyleRules(s,o),this.service.state.matches("playing")||this.iframe.contentDocument.getElementsByTagName("html")[0].classList.add("rrweb-paused"),this.emitter.emit(ne.FullsnapshotRebuilded,t),r||this.waitForStylesheetLoad(),this.config.UNSAFE_replayCanvas&&this.preloadAllImages();}insertStyleRules(t,r){var n;let i=po(this.config.blockClass).concat(this.config.insertStyleRules);if(this.config.pauseAnimation&&i.push("html.rrweb-paused *, html.rrweb-paused *:before, html.rrweb-paused *:after { animation-play-state: paused !important; }"),this.usingVirtualDom){let s=this.virtualDom.createElement("style");this.virtualDom.mirror.add(s,En(s,this.virtualDom.unserializedId)),t.insertBefore(s,r),s.rules.push({source:k.StyleSheetRule,adds:i.map((o,a)=>({rule:o,index:a}))});}else {let s=document.createElement("style");t.insertBefore(s,r);for(let o=0;o<i.length;o++)(n=s.sheet)===null||n===void 0||n.insertRule(i[o],o);}}attachDocumentToIframe(t,r){let n=this.usingVirtualDom?this.virtualDom.mirror:this.mirror,i=[],s=(o,a)=>{this.collectIframeAndAttachDocument(i,o);let l=n.getMeta(o);if(l?.type===te.Element&&l?.tagName.toUpperCase()==="HTML"){let{documentElement:c,head:d}=r.contentDocument;this.insertStyleRules(c,d);}for(let c of this.config.plugins||[])c.onBuild&&c.onBuild(o,{id:a,replayer:this});};It(t.node,{doc:r.contentDocument,mirror:n,hackCss:true,skipChild:false,afterAppend:s,cache:this.cache}),s(r.contentDocument,t.node.id);for(let{mutationInQueue:o,builtNode:a}of i)this.attachDocumentToIframe(o,a),this.newDocumentQueue=this.newDocumentQueue.filter(l=>l!==o);}collectIframeAndAttachDocument(t,r){if(Ke(r,this.mirror)){let n=this.newDocumentQueue.find(i=>i.parentId===this.mirror.getId(r));n&&t.push({mutationInQueue:n,builtNode:r});}}waitForStylesheetLoad(){var t;let r=(t=this.iframe.contentDocument)===null||t===void 0?void 0:t.head;if(r){let n=new Set,i,s=this.service.state,o=()=>{s=this.service.state;};this.emitter.on(ne.Start,o),this.emitter.on(ne.Pause,o);let a=()=>{this.emitter.off(ne.Start,o),this.emitter.off(ne.Pause,o);};r.querySelectorAll('link[rel="stylesheet"]').forEach(l=>{l.sheet||(n.add(l),l.addEventListener("load",()=>{n.delete(l),n.size===0&&i!==-1&&(s.matches("playing")&&this.play(this.getCurrentTime()),this.emitter.emit(ne.LoadStylesheetEnd),i&&clearTimeout(i),a());}));}),n.size>0&&(this.service.send({type:"PAUSE"}),this.emitter.emit(ne.LoadStylesheetStart),i=setTimeout(()=>{s.matches("playing")&&this.play(this.getCurrentTime()),i=-1,a();},this.config.loadTimeout));}}preloadAllImages(){return De(this,void 0,void 0,function*(){this.service.state;let t=()=>{this.service.state;};this.emitter.on(ne.Start,t),this.emitter.on(ne.Pause,t);let r=[];for(let n of this.service.state.context.events)n.type===N.IncrementalSnapshot&&n.data.source===k.CanvasMutation&&(r.push(this.deserializeAndPreloadCanvasEvents(n.data,n)),("commands"in n.data?n.data.commands:[n.data]).forEach(s=>{this.preloadImages(s,n);}));return Promise.all(r)})}preloadImages(t,r){if(t.property==="drawImage"&&typeof t.args[0]=="string"&&!this.imageMap.has(r)){let n=document.createElement("canvas"),i=n.getContext("2d"),s=i?.createImageData(n.width,n.height);s?.data,JSON.parse(t.args[0]),i?.putImageData(s,0,0);}}deserializeAndPreloadCanvasEvents(t,r){return De(this,void 0,void 0,function*(){if(!this.canvasEventMap.has(r)){let n={isUnchanged:true};if("commands"in t){let i=yield Promise.all(t.commands.map(s=>De(this,void 0,void 0,function*(){let o=yield Promise.all(s.args.map(He(this.imageMap,null,n)));return Object.assign(Object.assign({},s),{args:o})})));n.isUnchanged===false&&this.canvasEventMap.set(r,Object.assign(Object.assign({},t),{commands:i}));}else {let i=yield Promise.all(t.args.map(He(this.imageMap,null,n)));n.isUnchanged===false&&this.canvasEventMap.set(r,Object.assign(Object.assign({},t),{args:i}));}}})}applyIncremental(t,r){var n,i,s;let{data:o}=t;switch(o.source){case k.Mutation:{try{this.applyMutation(o,r);}catch(a){this.warn(`Exception in mutation ${a.message||a}`,o);}break}case k.Drag:case k.TouchMove:case k.MouseMove:if(r){let a=o.positions[o.positions.length-1];this.mousePos={x:a.x,y:a.y,id:a.id,debugData:o};}else o.positions.forEach(a=>{let l={doAction:()=>{this.moveAndHover(a.x,a.y,a.id,r,o);},delay:a.timeOffset+t.timestamp-this.service.state.context.baselineTime};this.timer.addAction(l);}),this.timer.addAction({doAction(){},delay:t.delay-((n=o.positions[0])===null||n===void 0?void 0:n.timeOffset)});break;case k.MouseInteraction:{if(o.id===-1||r)break;let a=new Event(be[o.type].toLowerCase()),l=this.mirror.getNode(o.id);if(!l)return this.debugNodeNotFound(o,o.id);this.emitter.emit(ne.MouseInteraction,{type:o.type,target:l});let{triggerFocus:c}=this.config;switch(o.type){case be.Blur:"blur"in l&&l.blur();break;case be.Focus:c&&l.focus&&l.focus({preventScroll:true});break;case be.Click:case be.TouchStart:case be.TouchEnd:r?(o.type===be.TouchStart?this.touchActive=true:o.type===be.TouchEnd&&(this.touchActive=false),this.mousePos={x:o.x,y:o.y,id:o.id,debugData:o}):(o.type===be.TouchStart&&(this.tailPositions.length=0),this.moveAndHover(o.x,o.y,o.id,r,o),o.type===be.Click?(this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active")):o.type===be.TouchStart?(this.mouse.offsetWidth,this.mouse.classList.add("touch-active")):o.type===be.TouchEnd&&this.mouse.classList.remove("touch-active"));break;case be.TouchCancel:r?this.touchActive=false:this.mouse.classList.remove("touch-active");break;default:l.dispatchEvent(a);}break}case k.Scroll:{if(o.id===-1)break;if(this.usingVirtualDom){let a=this.virtualDom.mirror.getNode(o.id);if(!a)return this.debugNodeNotFound(o,o.id);a.scrollData=o;break}this.applyScroll(o,r);break}case k.ViewportResize:this.emitter.emit(ne.Resize,{width:o.width,height:o.height});break;case k.Input:{if(o.id===-1)break;if(this.usingVirtualDom){let a=this.virtualDom.mirror.getNode(o.id);if(!a)return this.debugNodeNotFound(o,o.id);a.inputData=o;break}this.applyInput(o);break}case k.MediaInteraction:{let a=this.usingVirtualDom?this.virtualDom.mirror.getNode(o.id):this.mirror.getNode(o.id);if(!a)return this.debugNodeNotFound(o,o.id);let l=a;try{o.currentTime&&(l.currentTime=o.currentTime),o.volume&&(l.volume=o.volume),o.muted&&(l.muted=o.muted),o.type===1&&l.pause(),o.type===0&&l.play(),o.type===4&&(l.playbackRate=o.playbackRate);}catch(c){this.config.showWarning&&console.warn(`Failed to replay media interactions: ${c.message||c}`);}break}case k.StyleSheetRule:case k.StyleDeclaration:{this.usingVirtualDom?o.styleId?this.constructedStyleMutations.push(o):o.id&&((i=this.virtualDom.mirror.getNode(o.id))===null||i===void 0||i.rules.push(o)):this.applyStyleSheetMutation(o);break}case k.CanvasMutation:{if(!this.config.UNSAFE_replayCanvas)return;if(this.usingVirtualDom){let a=this.virtualDom.mirror.getNode(o.id);if(!a)return this.debugNodeNotFound(o,o.id);a.canvasMutations.push({event:t,mutation:o});}else {let a=this.mirror.getNode(o.id);if(!a)return this.debugNodeNotFound(o,o.id);Zn({event:t,mutation:o,target:a,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)});}break}case k.Font:{try{let a=new FontFace(o.family,o.buffer?new Uint8Array(JSON.parse(o.fontSource)):o.fontSource,o.descriptors);(s=this.iframe.contentDocument)===null||s===void 0||s.fonts.add(a);}catch(a){this.config.showWarning&&console.warn(a);}break}case k.Selection:{if(r){this.lastSelectionData=o;break}this.applySelection(o);break}case k.AdoptedStyleSheet:{this.usingVirtualDom?this.adoptedStyleSheets.push(o):this.applyAdoptedStyleSheet(o);break}}}applyMutation(t,r){if(this.config.useVirtualDom&&!this.usingVirtualDom&&r&&(this.usingVirtualDom=true,Rs(this.iframe.contentDocument,this.mirror,this.virtualDom),Object.keys(this.legacy_missingNodeRetryMap).length))for(let c in this.legacy_missingNodeRetryMap)try{let d=this.legacy_missingNodeRetryMap[c],h=wn(d.node,this.virtualDom,this.mirror);h&&(d.node=h);}catch(d){this.config.showWarning&&console.warn(d);}let n=this.usingVirtualDom?this.virtualDom.mirror:this.mirror;t.removes.forEach(c=>{var d;let h=n.getNode(c.id);if(!h)return t.removes.find(m=>m.id===c.parentId)?void 0:this.warnNodeNotFound(t,c.id);let f=n.getNode(c.parentId);if(!f)return this.warnNodeNotFound(t,c.parentId);if(c.isShadow&&Ve(f)&&(f=f.shadowRoot),n.removeNodeFromMap(h),f)try{f.removeChild(h),this.usingVirtualDom&&h.nodeName==="#text"&&f.nodeName==="STYLE"&&((d=f.rules)===null||d===void 0?void 0:d.length)>0&&(f.rules=[]);}catch(m){if(m instanceof DOMException)this.warn("parent could not remove child in mutation",f,h,t);else throw m}});let i=Object.assign({},this.legacy_missingNodeRetryMap),s=[],o=c=>{let d=null;return c.nextId&&(d=n.getNode(c.nextId)),c.nextId!==null&&c.nextId!==void 0&&c.nextId!==-1&&!d},a=c=>{var d;if(!this.iframe.contentDocument)return console.warn("Looks like your replayer has been destroyed.");let h=n.getNode(c.parentId);if(!h)return c.node.type===te.Document?this.newDocumentQueue.push(c):s.push(c);c.node.isShadow&&(Ve(h)||h.attachShadow({mode:"open"}),h=h.shadowRoot);let f=null,m=null;if(c.previousId&&(f=n.getNode(c.previousId)),c.nextId&&(m=n.getNode(c.nextId)),o(c))return s.push(c);if(c.node.rootId&&!n.getNode(c.node.rootId))return;let g=c.node.rootId?n.getNode(c.node.rootId):this.usingVirtualDom?this.virtualDom:this.iframe.contentDocument;if(Ke(h,n)){this.attachDocumentToIframe(c,h);return}let I=(v,S)=>{for(let T of this.config.plugins||[])T.onBuild&&T.onBuild(v,{id:S,replayer:this});},C=It(c.node,{doc:g,mirror:n,skipChild:true,hackCss:true,cache:this.cache,afterAppend:I});if(c.previousId===-1||c.nextId===-1){i[c.node.id]={node:C,mutation:c};return}let y=n.getMeta(h);if(y&&y.type===te.Element&&y.tagName==="textarea"&&c.node.type===te.Text){let v=Array.isArray(h.childNodes)?h.childNodes:Array.from(h.childNodes);for(let S of v)S.nodeType===h.TEXT_NODE&&h.removeChild(S);}if(f&&f.nextSibling&&f.nextSibling.parentNode)h.insertBefore(C,f.nextSibling);else if(m&&m.parentNode)h.contains(m)?h.insertBefore(C,m):h.insertBefore(C,null);else {if(h===g)for(;g.firstChild;)g.removeChild(g.firstChild);h.appendChild(C);}if(I(C,c.node.id),this.usingVirtualDom&&C.nodeName==="#text"&&h.nodeName==="STYLE"&&((d=h.rules)===null||d===void 0?void 0:d.length)>0&&(h.rules=[]),Ke(C,this.mirror)){let v=this.mirror.getId(C),S=this.newDocumentQueue.find(T=>T.parentId===v);S&&(this.attachDocumentToIframe(S,C),this.newDocumentQueue=this.newDocumentQueue.filter(T=>T!==S));}(c.previousId||c.nextId)&&this.legacy_resolveMissingNode(i,h,C,c);};t.adds.forEach(c=>{a(c);});let l=Date.now();for(;s.length;){let c=$r(s);if(s.length=0,Date.now()-l>500){this.warn("Timeout in the loop, please check the resolve tree data:",c);break}for(let d of c)n.getNode(d.value.parentId)?ar(d,f=>{a(f);}):this.debug("Drop resolve tree since there is no parent for the root node.",d);}Object.keys(i).length&&Object.assign(this.legacy_missingNodeRetryMap,i),Jr(t.texts).forEach(c=>{var d;let h=n.getNode(c.id);if(!h)return t.removes.find(f=>f.id===c.id)?void 0:this.warnNodeNotFound(t,c.id);if(h.textContent=c.value,this.usingVirtualDom){let f=h.parentNode;((d=f?.rules)===null||d===void 0?void 0:d.length)>0&&(f.rules=[]);}}),t.attributes.forEach(c=>{let d=n.getNode(c.id);if(!d)return t.removes.find(h=>h.id===c.id)?void 0:this.warnNodeNotFound(t,c.id);for(let h in c.attributes)if(typeof h=="string"){let f=c.attributes[h];if(f===null)d.removeAttribute(h);else if(typeof f=="string")try{if(h==="_cssText"&&(d.nodeName==="LINK"||d.nodeName==="STYLE"))try{let m=n.getMeta(d);Object.assign(m.attributes,c.attributes);let g=It(m,{doc:d.ownerDocument,mirror:n,skipChild:!0,hackCss:!0,cache:this.cache}),I=d.nextSibling,C=d.parentNode;if(g&&C){C.removeChild(d),C.insertBefore(g,I),n.replace(c.id,g);break}}catch{}d.setAttribute(h,f);}catch(m){this.config.showWarning&&console.warn("An error occurred may due to the checkout feature.",m);}else if(h==="style"){let m=f,g=d;for(let I in m)if(m[I]===false)g.style.removeProperty(I);else if(m[I]instanceof Array){let C=m[I];g.style.setProperty(I,C[0],C[1]);}else {let C=m[I];g.style.setProperty(I,C);}}}});}applyScroll(t,r){var n,i;let s=this.mirror.getNode(t.id);if(!s)return this.debugNodeNotFound(t,t.id);let o=this.mirror.getMeta(s);if(s===this.iframe.contentDocument)(n=this.iframe.contentWindow)===null||n===void 0||n.scrollTo({top:t.y,left:t.x,behavior:r?"auto":"smooth"});else if(o?.type===te.Document)(i=s.defaultView)===null||i===void 0||i.scrollTo({top:t.y,left:t.x,behavior:r?"auto":"smooth"});else try{s.scrollTo({top:t.y,left:t.x,behavior:r?"auto":"smooth"});}catch{}}applyInput(t){let r=this.mirror.getNode(t.id);if(!r)return this.debugNodeNotFound(t,t.id);try{r.checked=t.isChecked,r.value=t.text;}catch{}}applySelection(t){try{let r=new Set,n=t.ranges.map(({start:i,startOffset:s,end:o,endOffset:a})=>{let l=this.mirror.getNode(i),c=this.mirror.getNode(o);if(!l||!c)return;let d=new Range;d.setStart(l,s),d.setEnd(c,a);let h=l.ownerDocument,f=h?.getSelection();return f&&r.add(f),{range:d,selection:f}});r.forEach(i=>i.removeAllRanges()),n.forEach(i=>{var s;return i&&((s=i.selection)===null||s===void 0?void 0:s.addRange(i.range))});}catch{}}applyStyleSheetMutation(t){var r;let n=null;t.styleId?n=this.styleMirror.getStyle(t.styleId):t.id&&(n=((r=this.mirror.getNode(t.id))===null||r===void 0?void 0:r.sheet)||null),n&&(t.source===k.StyleSheetRule?this.applyStyleSheetRule(t,n):t.source===k.StyleDeclaration&&this.applyStyleDeclaration(t,n));}applyStyleSheetRule(t,r){var n,i,s,o;if((n=t.adds)===null||n===void 0||n.forEach(({rule:a,index:l})=>{try{if(Array.isArray(l)){let{positions:c,index:d}=cr(l);dt(r.cssRules,c).insertRule(a,d);}else {let c=l===void 0?void 0:Math.min(l,r.cssRules.length);r?.insertRule(a,c);}}catch{}}),(i=t.removes)===null||i===void 0||i.forEach(({index:a})=>{try{if(Array.isArray(a)){let{positions:l,index:c}=cr(a);dt(r.cssRules,l).deleteRule(c||0);}else r?.deleteRule(a);}catch{}}),t.replace)try{(s=r.replace)===null||s===void 0||s.call(r,t.replace);}catch{}if(t.replaceSync)try{(o=r.replaceSync)===null||o===void 0||o.call(r,t.replaceSync);}catch{}}applyStyleDeclaration(t,r){t.set&&dt(r.rules,t.index).style.setProperty(t.set.property,t.set.value,t.set.priority),t.remove&&dt(r.rules,t.index).style.removeProperty(t.remove.property);}applyAdoptedStyleSheet(t){var r;let n=this.mirror.getNode(t.id);if(!n)return;(r=t.styles)===null||r===void 0||r.forEach(a=>{var l;let c=null,d=null;if(Ve(n)?d=((l=n.ownerDocument)===null||l===void 0?void 0:l.defaultView)||null:n.nodeName==="#document"&&(d=n.defaultView),!!d)try{c=new d.CSSStyleSheet,this.styleMirror.add(c,a.styleId),this.applyStyleSheetRule({source:k.StyleSheetRule,adds:a.rules},c);}catch{}});let i=10,s=0,o=(a,l)=>{let c=l.map(d=>this.styleMirror.getStyle(d)).filter(d=>d!==null);Ve(a)?a.shadowRoot.adoptedStyleSheets=c:a.nodeName==="#document"&&(a.adoptedStyleSheets=c),c.length!==l.length&&s<i&&(setTimeout(()=>o(a,l),0+100*s),s++);};o(n,t.styleIds);}legacy_resolveMissingNode(t,r,n,i){let{previousId:s,nextId:o}=i,a=s&&t[s],l=o&&t[o];if(a){let{node:c,mutation:d}=a;r.insertBefore(c,n),delete t[d.node.id],delete this.legacy_missingNodeRetryMap[d.node.id],(d.previousId||d.nextId)&&this.legacy_resolveMissingNode(t,r,c,d);}if(l){let{node:c,mutation:d}=l;r.insertBefore(c,n.nextSibling),delete t[d.node.id],delete this.legacy_missingNodeRetryMap[d.node.id],(d.previousId||d.nextId)&&this.legacy_resolveMissingNode(t,r,c,d);}}moveAndHover(t,r,n,i,s){let o=this.mirror.getNode(n);if(!o)return this.debugNodeNotFound(s,n);let a=lr(o,this.iframe),l=t*a.absoluteScale+a.x,c=r*a.absoluteScale+a.y;this.mouse.style.left=`${l}px`,this.mouse.style.top=`${c}px`,i||this.drawMouseTail({x:l,y:c}),this.hoverElements(o);}drawMouseTail(t){if(!this.mouseTail)return;let{lineCap:r,lineWidth:n,strokeStyle:i,duration:s}=this.config.mouseTail===true?Qn:Object.assign({},Qn,this.config.mouseTail),o=()=>{if(!this.mouseTail)return;let a=this.mouseTail.getContext("2d");!a||!this.tailPositions.length||(a.clearRect(0,0,this.mouseTail.width,this.mouseTail.height),a.beginPath(),a.lineWidth=n,a.lineCap=r,a.strokeStyle=i,a.moveTo(this.tailPositions[0].x,this.tailPositions[0].y),this.tailPositions.forEach(l=>a.lineTo(l.x,l.y)),a.stroke());};this.tailPositions.push(t),o(),setTimeout(()=>{this.tailPositions=this.tailPositions.filter(a=>a!==t),o();},s/this.speedService.state.context.timer.speed);}hoverElements(t){var r;(r=this.iframe.contentDocument)===null||r===void 0||r.querySelectorAll(".\\:hover").forEach(i=>{i.classList.remove(":hover");});let n=t;for(;n;)n.classList&&n.classList.add(":hover"),n=n.parentElement;}isUserInteraction(t){return t.type!==N.IncrementalSnapshot?false:t.data.source>k.Mutation&&t.data.source<=k.Input}backToNormal(){this.nextUserInteractionEvent=null,!this.speedService.state.matches("normal")&&(this.speedService.send({type:"BACK_TO_NORMAL"}),this.emitter.emit(ne.SkipEnd,{speed:this.speedService.state.context.normalSpeed}));}warnNodeNotFound(t,r){this.warn(`Node with id '${r}' not found. `,t);}warnCanvasMutationFailed(t,r){this.warn("Has error on canvas update",r,"canvas mutation:",t);}debugNodeNotFound(t,r){this.debug(qn,`Node with id '${r}' not found. `,t);}warn(...t){this.config.showWarning&&console.warn(qn,...t);}debug(...t){this.config.showDebug&&[...t];}};});var Eo={};Wr(Eo,{EventType:()=>N,IncrementalSource:()=>k,MouseInteractions:()=>be,PLUGIN_NAME:()=>jt,Replayer:()=>Mr,ReplayerEvents:()=>ne,addCustomEvent:()=>Ns,freezePage:()=>_s,getRecordConsolePlugin:()=>Xs,getReplayConsolePlugin:()=>$s,mirror:()=>_t,pack:()=>Vs,record:()=>Ze,unpack:()=>js,utils:()=>en});var To=V(()=>{Ms();Gs();zs();Pn();Js();pn();xe();wo();Me();Me();});var Fo=Br(G=>{var ti=Symbol.for("react.transitional.element"),Ql=Symbol.for("react.portal"),Xl=Symbol.for("react.fragment"),$l=Symbol.for("react.strict_mode"),Jl=Symbol.for("react.profiler"),ec=Symbol.for("react.consumer"),tc=Symbol.for("react.context"),rc=Symbol.for("react.forward_ref"),nc=Symbol.for("react.suspense"),ic=Symbol.for("react.memo"),_o=Symbol.for("react.lazy"),sc=Symbol.for("react.activity"),Ao=Symbol.iterator;function oc(e){return e===null||typeof e!="object"?null:(e=Ao&&e[Ao]||e["@@iterator"],typeof e=="function"?e:null)}var Mo={isMounted:function(){return false},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Oo=Object.assign,xo={};function Et(e,t,r){this.props=e,this.context=t,this.refs=xo,this.updater=r||Mo;}Et.prototype.isReactComponent={};Et.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState");};Et.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate");};function Do(){}Do.prototype=Et.prototype;function ri(e,t,r){this.props=e,this.context=t,this.refs=xo,this.updater=r||Mo;}var ni=ri.prototype=new Do;ni.constructor=ri;Oo(ni,Et.prototype);ni.isPureReactComponent=true;var Ro=Array.isArray;function ei(){}var me={H:null,A:null,T:null,S:null},Lo=Object.prototype.hasOwnProperty;function ii(e,t,r){var n=r.ref;return {$$typeof:ti,type:e,key:t,ref:n!==void 0?n:null,props:r}}function ac(e,t){return ii(e.type,t,e.props)}function si(e){return typeof e=="object"&&e!==null&&e.$$typeof===ti}function lc(e){var t={"=":"=0",":":"=2"};return "$"+e.replace(/[=:]/g,function(r){return t[r]})}var ko=/\/+/g;function Jn(e,t){return typeof e=="object"&&e!==null&&e.key!=null?lc(""+e.key):t.toString(36)}function cc(e){switch(e.status){case "fulfilled":return e.value;case "rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(ei,ei):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t);},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t);})),e.status){case "fulfilled":return e.value;case "rejected":throw e.reason}}throw e}function wt(e,t,r,n,i){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var o=false;if(e===null)o=true;else switch(s){case "bigint":case "string":case "number":o=true;break;case "object":switch(e.$$typeof){case ti:case Ql:o=true;break;case _o:return o=e._init,wt(o(e._payload),t,r,n,i)}}if(o)return i=i(e),o=n===""?"."+Jn(e,0):n,Ro(i)?(r="",o!=null&&(r=o.replace(ko,"$&/")+"/"),wt(i,t,r,"",function(c){return c})):i!=null&&(si(i)&&(i=ac(i,r+(i.key==null||e&&e.key===i.key?"":(""+i.key).replace(ko,"$&/")+"/")+o)),t.push(i)),1;o=0;var a=n===""?".":n+":";if(Ro(e))for(var l=0;l<e.length;l++)n=e[l],s=a+Jn(n,l),o+=wt(n,t,r,s,i);else if(l=oc(e),typeof l=="function")for(e=l.call(e),l=0;!(n=e.next()).done;)n=n.value,s=a+Jn(n,l++),o+=wt(n,t,r,s,i);else if(s==="object"){if(typeof e.then=="function")return wt(cc(e),t,r,n,i);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return o}function xr(e,t,r){if(e==null)return e;var n=[],i=0;return wt(e,n,"","",function(s){return t.call(r,s,i++)}),n}function uc(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(r){(e._status===0||e._status===-1)&&(e._status=1,e._result=r);},function(r){(e._status===0||e._status===-1)&&(e._status=2,e._result=r);}),e._status===-1&&(e._status=0,e._result=t);}if(e._status===1)return e._result.default;throw e._result}var No=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:true,cancelable:true,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e);},dc={map:xr,forEach:function(e,t,r){xr(e,function(){t.apply(this,arguments);},r);},count:function(e){var t=0;return xr(e,function(){t++;}),t},toArray:function(e){return xr(e,function(t){return t})||[]},only:function(e){if(!si(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};G.Activity=sc;G.Children=dc;G.Component=Et;G.Fragment=Xl;G.Profiler=Jl;G.PureComponent=ri;G.StrictMode=$l;G.Suspense=nc;G.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=me;G.__COMPILER_RUNTIME={__proto__:null,c:function(e){return me.H.useMemoCache(e)}};G.cache=function(e){return function(){return e.apply(null,arguments)}};G.cacheSignal=function(){return null};G.cloneElement=function(e,t,r){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var n=Oo({},e.props),i=e.key;if(t!=null)for(s in t.key!==void 0&&(i=""+t.key),t)!Lo.call(t,s)||s==="key"||s==="__self"||s==="__source"||s==="ref"&&t.ref===void 0||(n[s]=t[s]);var s=arguments.length-2;if(s===1)n.children=r;else if(1<s){for(var o=Array(s),a=0;a<s;a++)o[a]=arguments[a+2];n.children=o;}return ii(e.type,i,n)};G.createContext=function(e){return e={$$typeof:tc,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:ec,_context:e},e};G.createElement=function(e,t,r){var n,i={},s=null;if(t!=null)for(n in t.key!==void 0&&(s=""+t.key),t)Lo.call(t,n)&&n!=="key"&&n!=="__self"&&n!=="__source"&&(i[n]=t[n]);var o=arguments.length-2;if(o===1)i.children=r;else if(1<o){for(var a=Array(o),l=0;l<o;l++)a[l]=arguments[l+2];i.children=a;}if(e&&e.defaultProps)for(n in o=e.defaultProps,o)i[n]===void 0&&(i[n]=o[n]);return ii(e,s,i)};G.createRef=function(){return {current:null}};G.forwardRef=function(e){return {$$typeof:rc,render:e}};G.isValidElement=si;G.lazy=function(e){return {$$typeof:_o,_payload:{_status:-1,_result:e},_init:uc}};G.memo=function(e,t){return {$$typeof:ic,type:e,compare:t===void 0?null:t}};G.startTransition=function(e){var t=me.T,r={};me.T=r;try{var n=e(),i=me.S;i!==null&&i(r,n),typeof n=="object"&&n!==null&&typeof n.then=="function"&&n.then(ei,No);}catch(s){No(s);}finally{t!==null&&r.types!==null&&(t.types=r.types),me.T=t;}};G.unstable_useCacheRefresh=function(){return me.H.useCacheRefresh()};G.use=function(e){return me.H.use(e)};G.useActionState=function(e,t,r){return me.H.useActionState(e,t,r)};G.useCallback=function(e,t){return me.H.useCallback(e,t)};G.useContext=function(e){return me.H.useContext(e)};G.useDebugValue=function(){};G.useDeferredValue=function(e,t){return me.H.useDeferredValue(e,t)};G.useEffect=function(e,t){return me.H.useEffect(e,t)};G.useEffectEvent=function(e){return me.H.useEffectEvent(e)};G.useId=function(){return me.H.useId()};G.useImperativeHandle=function(e,t,r){return me.H.useImperativeHandle(e,t,r)};G.useInsertionEffect=function(e,t){return me.H.useInsertionEffect(e,t)};G.useLayoutEffect=function(e,t){return me.H.useLayoutEffect(e,t)};G.useMemo=function(e,t){return me.H.useMemo(e,t)};G.useOptimistic=function(e,t){return me.H.useOptimistic(e,t)};G.useReducer=function(e,t,r){return me.H.useReducer(e,t,r)};G.useRef=function(e){return me.H.useRef(e)};G.useState=function(e){return me.H.useState(e)};G.useSyncExternalStore=function(e,t,r){return me.H.useSyncExternalStore(e,t,r)};G.useTransition=function(){return me.H.useTransition()};G.version="19.2.4";});var Po=Br((H,Dr)=>{process.env.NODE_ENV!=="production"&&(function(){function e(u,p){Object.defineProperty(n.prototype,u,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",p[0],p[1]);}});}function t(u){return u===null||typeof u!="object"?null:(u=Ee&&u[Ee]||u["@@iterator"],typeof u=="function"?u:null)}function r(u,p){u=(u=u.constructor)&&(u.displayName||u.name)||"ReactClass";var E=u+"."+p;ee[E]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",p,u),ee[E]=true);}function n(u,p,E){this.props=u,this.context=p,this.refs=ve,this.updater=E||we;}function i(){}function s(u,p,E){this.props=u,this.context=p,this.refs=ve,this.updater=E||we;}function o(){}function a(u){return ""+u}function l(u){try{a(u);var p=!1;}catch{p=true;}if(p){p=console;var E=p.error,R=typeof Symbol=="function"&&Symbol.toStringTag&&u[Symbol.toStringTag]||u.constructor.name||"Object";return E.call(p,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",R),a(u)}}function c(u){if(u==null)return null;if(typeof u=="function")return u.$$typeof===Wo?null:u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case w:return "Fragment";case x:return "Profiler";case b:return "StrictMode";case he:return "Suspense";case B:return "SuspenseList";case ce:return "Activity"}if(typeof u=="object")switch(typeof u.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),u.$$typeof){case se:return "Portal";case K:return u.displayName||"Context";case M:return (u._context.displayName||"Context")+".Consumer";case ie:var p=u.render;return u=u.displayName,u||(u=p.displayName||p.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case pe:return p=u.displayName||null,p!==null?p:c(u.type)||"Memo";case le:p=u._payload,u=u._init;try{return c(u(p))}catch{}}return null}function d(u){if(u===w)return "<>";if(typeof u=="object"&&u!==null&&u.$$typeof===le)return "<...>";try{var p=c(u);return p?"<"+p+">":"<...>"}catch{return "<...>"}}function h(){var u=Z.A;return u===null?null:u.getOwner()}function f(){return Error("react-stack-top-frame")}function m(u){if(Yt.call(u,"key")){var p=Object.getOwnPropertyDescriptor(u,"key").get;if(p&&p.isReactWarning)return false}return u.key!==void 0}function g(u,p){function E(){ui||(ui=true,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",p));}E.isReactWarning=true,Object.defineProperty(u,"key",{get:E,configurable:true});}function I(){var u=c(this.type);return hi[u]||(hi[u]=true,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),u=this.props.ref,u!==void 0?u:null}function C(u,p,E,R,D,X){var Y=E.ref;return u={$$typeof:U,type:u,key:p,props:E,_owner:R},(Y!==void 0?Y:null)!==null?Object.defineProperty(u,"ref",{enumerable:false,get:I}):Object.defineProperty(u,"ref",{enumerable:false,value:null}),u._store={},Object.defineProperty(u._store,"validated",{configurable:false,enumerable:false,writable:true,value:0}),Object.defineProperty(u,"_debugInfo",{configurable:false,enumerable:false,writable:true,value:null}),Object.defineProperty(u,"_debugStack",{configurable:false,enumerable:false,writable:true,value:D}),Object.defineProperty(u,"_debugTask",{configurable:false,enumerable:false,writable:true,value:X}),Object.freeze&&(Object.freeze(u.props),Object.freeze(u)),u}function y(u,p){return p=C(u.type,p,u.props,u._owner,u._debugStack,u._debugTask),u._store&&(p._store.validated=u._store.validated),p}function v(u){S(u)?u._store&&(u._store.validated=1):typeof u=="object"&&u!==null&&u.$$typeof===le&&(u._payload.status==="fulfilled"?S(u._payload.value)&&u._payload.value._store&&(u._payload.value._store.validated=1):u._store&&(u._store.validated=1));}function S(u){return typeof u=="object"&&u!==null&&u.$$typeof===U}function T(u){var p={"=":"=0",":":"=2"};return "$"+u.replace(/[=:]/g,function(E){return p[E]})}function L(u,p){return typeof u=="object"&&u!==null&&u.key!=null?(l(u.key),T(""+u.key)):p.toString(36)}function O(u){switch(u.status){case "fulfilled":return u.value;case "rejected":throw u.reason;default:switch(typeof u.status=="string"?u.then(o,o):(u.status="pending",u.then(function(p){u.status==="pending"&&(u.status="fulfilled",u.value=p);},function(p){u.status==="pending"&&(u.status="rejected",u.reason=p);})),u.status){case "fulfilled":return u.value;case "rejected":throw u.reason}}throw u}function P(u,p,E,R,D){var X=typeof u;(X==="undefined"||X==="boolean")&&(u=null);var Y=false;if(u===null)Y=true;else switch(X){case "bigint":case "string":case "number":Y=true;break;case "object":switch(u.$$typeof){case U:case se:Y=true;break;case le:return Y=u._init,P(Y(u._payload),p,E,R,D)}}if(Y){Y=u,D=D(Y);var ue=R===""?"."+L(Y,0):R;return li(D)?(E="",ue!=null&&(E=ue.replace(pi,"$&/")+"/"),P(D,p,E,"",function(Je){return Je})):D!=null&&(S(D)&&(D.key!=null&&(Y&&Y.key===D.key||l(D.key)),E=y(D,E+(D.key==null||Y&&Y.key===D.key?"":(""+D.key).replace(pi,"$&/")+"/")+ue),R!==""&&Y!=null&&S(Y)&&Y.key==null&&Y._store&&!Y._store.validated&&(E._store.validated=2),D=E),p.push(D)),1}if(Y=0,ue=R===""?".":R+":",li(u))for(var $=0;$<u.length;$++)R=u[$],X=ue+L(R,$),Y+=P(R,p,E,X,D);else if($=t(u),typeof $=="function")for($===u.entries&&(fi||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),fi=true),u=$.call(u),$=0;!(R=u.next()).done;)R=R.value,X=ue+L(R,$++),Y+=P(R,p,E,X,D);else if(X==="object"){if(typeof u.then=="function")return P(O(u),p,E,R,D);throw p=String(u),Error("Objects are not valid as a React child (found: "+(p==="[object Object]"?"object with keys {"+Object.keys(u).join(", ")+"}":p)+"). If you meant to render a collection of children, use an array instead.")}return Y}function A(u,p,E){if(u==null)return u;var R=[],D=0;return P(u,R,"","",function(X){return p.call(E,X,D++)}),R}function oe(u){if(u._status===-1){var p=u._ioInfo;p!=null&&(p.start=p.end=performance.now()),p=u._result;var E=p();if(E.then(function(D){if(u._status===0||u._status===-1){u._status=1,u._result=D;var X=u._ioInfo;X!=null&&(X.end=performance.now()),E.status===void 0&&(E.status="fulfilled",E.value=D);}},function(D){if(u._status===0||u._status===-1){u._status=2,u._result=D;var X=u._ioInfo;X!=null&&(X.end=performance.now()),E.status===void 0&&(E.status="rejected",E.reason=D);}}),p=u._ioInfo,p!=null){p.value=E;var R=E.displayName;typeof R=="string"&&(p.name=R);}u._status===-1&&(u._status=0,u._result=E);}if(u._status===1)return p=u._result,p===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
2
17
|
|
|
3
18
|
Your code should look like:
|
|
4
19
|
const MyComponent = lazy(() => import('./MyComponent'))
|
|
5
20
|
|
|
6
|
-
Did you accidentally put curly braces around the import?`,
|
|
21
|
+
Did you accidentally put curly braces around the import?`,p),"default"in p||console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
7
22
|
|
|
8
23
|
Your code should look like:
|
|
9
|
-
const MyComponent = lazy(() => import('./MyComponent'))`,
|
|
24
|
+
const MyComponent = lazy(() => import('./MyComponent'))`,p),p.default;throw u._result}function F(){var u=Z.H;return u===null&&console.error(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
|
|
10
25
|
1. You might have mismatching versions of React and the renderer (such as React DOM)
|
|
11
26
|
2. You might be breaking the Rules of Hooks
|
|
12
27
|
3. You might have more than one copy of React in the same app
|
|
13
|
-
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),t}function Le(){m.asyncTransitions--;}function W(t){if(K===null)try{var i=("require"+Math.random()).slice(0,7);K=(ie&&ie[i]).call(ie,"timers").setImmediate;}catch{K=function(u){tt===false&&(tt=true,typeof MessageChannel>"u"&&console.error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var c=new MessageChannel;c.port1.onmessage=u,c.port2.postMessage(void 0);};}return K(t)}function F(t){return 1<t.length&&typeof AggregateError=="function"?new AggregateError(t):t[0]}function B(t,i){i!==G-1&&console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),G=i;}function le(t,i,o){var u=m.actQueue;if(u!==null)if(u.length!==0)try{ce(u),W(function(){return le(t,i,o)});return}catch(c){m.thrownErrors.push(c);}else m.actQueue=null;0<m.thrownErrors.length?(u=F(m.thrownErrors),m.thrownErrors.length=0,o(u)):i(t);}function ce(t){if(!me){me=true;var i=0;try{for(;i<t.length;i++){var o=t[i];do{m.didUsePromise=!1;var u=o(!1);if(u!==null){if(m.didUsePromise){t[i]=o,t.splice(0,i);return}o=u;}else break}while(!0)}t.length=0;}catch(c){t.splice(0,i+1),m.thrownErrors.push(c);}finally{me=false;}}}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var de=Symbol.for("react.transitional.element"),xe=Symbol.for("react.portal"),he=Symbol.for("react.fragment"),je=Symbol.for("react.strict_mode"),Me=Symbol.for("react.profiler"),fe=Symbol.for("react.consumer"),De=Symbol.for("react.context"),Fe=Symbol.for("react.forward_ref"),$e=Symbol.for("react.suspense"),Rt=Symbol.for("react.suspense_list"),pe=Symbol.for("react.memo"),$=Symbol.for("react.lazy"),qe=Symbol.for("react.activity"),Ve=Symbol.iterator,ze={},Ye={isMounted:function(){return false},enqueueForceUpdate:function(t){r(t,"forceUpdate");},enqueueReplaceState:function(t){r(t,"replaceState");},enqueueSetState:function(t){r(t,"setState");}},We=Object.assign,ge={};Object.freeze(ge),s.prototype.isReactComponent={},s.prototype.setState=function(t,i){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,i,"setState");},s.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate");};var R={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]};for(q in R)R.hasOwnProperty(q)&&e(q,R[q]);a.prototype=s.prototype,R=l.prototype=new a,R.constructor=l,We(R,s.prototype),R.isPureReactComponent=true;var Be=Array.isArray,At=Symbol.for("react.client.reference"),m={H:null,A:null,T:null,S:null,actQueue:null,asyncTransitions:0,isBatchingLegacy:false,didScheduleLegacyUpdate:false,didUsePromise:false,thrownErrors:[],getCurrentStack:null,recentlyCreatedOwnerStacks:0},Q=Object.prototype.hasOwnProperty,Qe=console.createTask?console.createTask:function(){return null};R={react_stack_bottom_frame:function(t){return t()}};var Ke,Ge,Xe={},Ct=R.react_stack_bottom_frame.bind(R,He)(),Pt=Qe(Pe(He)),Ze=false,Je=/\/+/g,et=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:true,cancelable:true,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t);},tt=false,K=null,G=0,X=false,me=false,nt=typeof queueMicrotask=="function"?function(t){queueMicrotask(function(){return queueMicrotask(t)});}:W;R=Object.freeze({__proto__:null,c:function(t){return I().useMemoCache(t)}});var q={map:Y,forEach:function(t,i,o){Y(t,function(){i.apply(this,arguments);},o);},count:function(t){var i=0;return Y(t,function(){i++;}),i},toArray:function(t){return Y(t,function(i){return i})||[]},only:function(t){if(!N(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};d.Activity=qe,d.Children=q,d.Component=s,d.Fragment=he,d.Profiler=Me,d.PureComponent=l,d.StrictMode=je,d.Suspense=$e,d.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=m,d.__COMPILER_RUNTIME=R,d.act=function(t){var i=m.actQueue,o=G;G++;var u=m.actQueue=i!==null?i:[],c=false;try{var y=t();}catch(E){m.thrownErrors.push(E);}if(0<m.thrownErrors.length)throw B(i,o),t=F(m.thrownErrors),m.thrownErrors.length=0,t;if(y!==null&&typeof y=="object"&&typeof y.then=="function"){var f=y;return nt(function(){c||X||(X=true,console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"));}),{then:function(E,U){c=true,f.then(function(x){if(B(i,o),o===0){try{ce(u),W(function(){return le(x,E,U)});}catch(Ht){m.thrownErrors.push(Ht);}if(0<m.thrownErrors.length){var Ot=F(m.thrownErrors);m.thrownErrors.length=0,U(Ot);}}else E(x);},function(x){B(i,o),0<m.thrownErrors.length&&(x=F(m.thrownErrors),m.thrownErrors.length=0),U(x);});}}}var w=y;if(B(i,o),o===0&&(ce(u),u.length!==0&&nt(function(){c||X||(X=true,console.error("A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"));}),m.actQueue=null),0<m.thrownErrors.length)throw t=F(m.thrownErrors),m.thrownErrors.length=0,t;return {then:function(E,U){c=true,o===0?(m.actQueue=u,W(function(){return le(w,E,U)})):E(w);}}},d.cache=function(t){return function(){return t.apply(null,arguments)}},d.cacheSignal=function(){return null},d.captureOwnerStack=function(){var t=m.getCurrentStack;return t===null?null:t()},d.cloneElement=function(t,i,o){if(t==null)throw Error("The argument must be a React element, but you passed "+t+".");var u=We({},t.props),c=t.key,y=t._owner;if(i!=null){var f;e:{if(Q.call(i,"ref")&&(f=Object.getOwnPropertyDescriptor(i,"ref").get)&&f.isReactWarning){f=false;break e}f=i.ref!==void 0;}f&&(y=Oe()),Ue(i)&&(T(i.key),c=""+i.key);for(w in i)!Q.call(i,w)||w==="key"||w==="__self"||w==="__source"||w==="ref"&&i.ref===void 0||(u[w]=i[w]);}var w=arguments.length-2;if(w===1)u.children=o;else if(1<w){f=Array(w);for(var E=0;E<w;E++)f[E]=arguments[E+2];u.children=f;}for(u=ae(t.type,c,u,y,t._debugStack,t._debugTask),c=2;c<arguments.length;c++)Ne(arguments[c]);return u},d.createContext=function(t){return t={$$typeof:De,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null},t.Provider=t,t.Consumer={$$typeof:fe,_context:t},t._currentRenderer=null,t._currentRenderer2=null,t},d.createElement=function(t,i,o){for(var u=2;u<arguments.length;u++)Ne(arguments[u]);u={};var c=null;if(i!=null)for(E in Ge||!("__self"in i)||"key"in i||(Ge=true,console.warn("Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform")),Ue(i)&&(T(i.key),c=""+i.key),i)Q.call(i,E)&&E!=="key"&&E!=="__self"&&E!=="__source"&&(u[E]=i[E]);var y=arguments.length-2;if(y===1)u.children=o;else if(1<y){for(var f=Array(y),w=0;w<y;w++)f[w]=arguments[w+2];Object.freeze&&Object.freeze(f),u.children=f;}if(t&&t.defaultProps)for(E in y=t.defaultProps,y)u[E]===void 0&&(u[E]=y[E]);c&&_t(u,typeof t=="function"?t.displayName||t.name||"Unknown":t);var E=1e4>m.recentlyCreatedOwnerStacks++;return ae(t,c,u,Oe(),E?Error("react-stack-top-frame"):Ct,E?Qe(Pe(t)):Pt)},d.createRef=function(){var t={current:null};return Object.seal(t),t},d.forwardRef=function(t){t!=null&&t.$$typeof===pe?console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof t!="function"?console.error("forwardRef requires a render function but was given %s.",t===null?"null":typeof t):t.length!==0&&t.length!==2&&console.error("forwardRef render functions accept exactly two parameters: props and ref. %s",t.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),t!=null&&t.defaultProps!=null&&console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");var i={$$typeof:Fe,render:t},o;return Object.defineProperty(i,"displayName",{enumerable:false,configurable:true,get:function(){return o},set:function(u){o=u,t.name||t.displayName||(Object.defineProperty(t,"name",{value:u}),t.displayName=u);}}),i},d.isValidElement=N,d.lazy=function(t){t={_status:-1,_result:t};var i={$$typeof:$,_payload:t,_init:kt},o={name:"lazy",start:-1,end:-1,value:null,owner:null,debugStack:Error("react-stack-top-frame"),debugTask:console.createTask?console.createTask("lazy()"):null};return t._ioInfo=o,i._debugInfo=[{awaited:o}],i},d.memo=function(t,i){t==null&&console.error("memo: The first argument must be a component. Instead received: %s",t===null?"null":typeof t),i={$$typeof:pe,type:t,compare:i===void 0?null:i};var o;return Object.defineProperty(i,"displayName",{enumerable:false,configurable:true,get:function(){return o},set:function(u){o=u,t.name||t.displayName||(Object.defineProperty(t,"name",{value:u}),t.displayName=u);}}),i},d.startTransition=function(t){var i=m.T,o={};o._updatedFibers=new Set,m.T=o;try{var u=t(),c=m.S;c!==null&&c(o,u),typeof u=="object"&&u!==null&&typeof u.then=="function"&&(m.asyncTransitions++,u.then(Le,Le),u.then(g,et));}catch(y){et(y);}finally{i===null&&o._updatedFibers&&(t=o._updatedFibers.size,o._updatedFibers.clear(),10<t&&console.warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.")),i!==null&&o.types!==null&&(i.types!==null&&i.types!==o.types&&console.error("We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."),i.types=o.types),m.T=i;}},d.unstable_useCacheRefresh=function(){return I().useCacheRefresh()},d.use=function(t){return I().use(t)},d.useActionState=function(t,i,o){return I().useActionState(t,i,o)},d.useCallback=function(t,i){return I().useCallback(t,i)},d.useContext=function(t){var i=I();return t.$$typeof===fe&&console.error("Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"),i.useContext(t)},d.useDebugValue=function(t,i){return I().useDebugValue(t,i)},d.useDeferredValue=function(t,i){return I().useDeferredValue(t,i)},d.useEffect=function(t,i){return t==null&&console.warn("React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"),I().useEffect(t,i)},d.useEffectEvent=function(t){return I().useEffectEvent(t)},d.useId=function(){return I().useId()},d.useImperativeHandle=function(t,i,o){return I().useImperativeHandle(t,i,o)},d.useInsertionEffect=function(t,i){return t==null&&console.warn("React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"),I().useInsertionEffect(t,i)},d.useLayoutEffect=function(t,i){return t==null&&console.warn("React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"),I().useLayoutEffect(t,i)},d.useMemo=function(t,i){return I().useMemo(t,i)},d.useOptimistic=function(t,i){return I().useOptimistic(t,i)},d.useReducer=function(t,i,o){return I().useReducer(t,i,o)},d.useRef=function(t){return I().useRef(t)},d.useState=function(t){return I().useState(t)},d.useSyncExternalStore=function(t,i,o){return I().useSyncExternalStore(t,i,o)},d.useTransition=function(){return I().useTransition()},d.version="19.2.4",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());})();});var Et=ye((Bn,Ae)=>{process.env.NODE_ENV==="production"?Ae.exports=vt():Ae.exports=yt();});var $t=Object.defineProperty,qt=(e,n,r)=>n in e?$t(e,n,{enumerable:true,configurable:true,writable:true,value:r}):e[n]=r,v=(e,n,r)=>qt(e,typeof n!="symbol"?n+"":n,r),b=class A extends Error{constructor(n,r,s){super(n),v(this,"code"),v(this,"details"),this.name="PIHError",this.code=r,this.details=s,Error.captureStackTrace&&Error.captureStackTrace(this,A);}static networkError(n,r){return new A(n,"NETWORK_ERROR",r)}static invalidConfig(n,r){return new A(n,"INVALID_CONFIG",r)}static queueFull(n,r){return new A(n,"QUEUE_FULL",r)}static rateLimited(n,r){return new A(n,"RATE_LIMITED",r)}static invalidPayload(n,r){return new A(n,"INVALID_PAYLOAD",r)}static storageError(n,r){return new A(n,"STORAGE_ERROR",r)}static sessionError(n,r){return new A(n,"SESSION_ERROR",r)}static fromUnknown(n){return n instanceof A?n:n instanceof Error?new A(n.message,"UNKNOWN_ERROR",n):new A(String(n),"UNKNOWN_ERROR",n)}};function Z(){if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function"){let e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let n=Array.from(e,r=>r.toString(16).padStart(2,"0")).join("");return `${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let n=Math.random()*16|0;return (e==="x"?n:n&3|8).toString(16)})}function rt(){return new Date().toISOString()}function Vt(e){return e.toISOString()}function zt(e,n=1e3,r=16e3){let s=n*Math.pow(2,e);return Math.min(s,r)}var P="pih_",S={QUEUE:`${P}queue`,ANONYMOUS_ID:`${P}anonymous_id`,USER_ID:`${P}user_id`,USER_TRAITS:`${P}user_traits`,SESSION_ID:`${P}session_id`,SESSION_LAST_ACTIVITY:`${P}session_last_activity`,SESSION_NUMBER:`${P}session_number`,EVENT_INDEX:`${P}event_index`,FLAGS:`${P}flags`},C={API_URL:"https://repoingest-production.up.railway.app",FLUSH_INTERVAL:1e4,FLUSH_AT:25,MAX_QUEUE_SIZE:5e3,SESSION_TIMEOUT:18e5,MAX_BATCH_SIZE:100,MAX_RETRIES:5,BASE_BACKOFF_DELAY:1e3,MAX_BACKOFF_DELAY:16e3},Yt=class{constructor(e,n=false){v(this,"anonymousId"),v(this,"userId",null),v(this,"userTraits",{}),v(this,"storage"),v(this,"debug"),this.storage=e,this.debug=n,this.anonymousId=Z();}async initialize(){if(!this.storage){this.log("No storage adapter, using in-memory identity only");return}try{let e=await this.storage.get(S.ANONYMOUS_ID);e?(this.anonymousId=e,this.log("Loaded anonymous ID from storage:",this.anonymousId)):(await this.storage.set(S.ANONYMOUS_ID,this.anonymousId),this.log("Generated new anonymous ID:",this.anonymousId));let n=await this.storage.get(S.USER_ID);n&&(this.userId=n,this.log("Loaded user ID from storage:",this.userId));let r=await this.storage.get(S.USER_TRAITS);if(r)try{this.userTraits=JSON.parse(r),this.log("Loaded user traits from storage:",this.userTraits);}catch{this.log("Failed to parse stored user traits");}}catch(e){this.log("Error loading identity from storage:",e);}}getAnonymousId(){return this.anonymousId}getUserId(){return this.userId}getUserTraits(){return {...this.userTraits}}async setUserId(e){if(this.userId=e,this.log("Set user ID:",e),this.storage)try{await this.storage.set(S.USER_ID,e);}catch(n){this.log("Error persisting user ID:",n);}}async setUserTraits(e){if(this.userTraits={...this.userTraits,...e},this.log("Set user traits:",this.userTraits),this.storage)try{await this.storage.set(S.USER_TRAITS,JSON.stringify(this.userTraits));}catch(n){this.log("Error persisting user traits:",n);}}async reset(){if(this.anonymousId=Z(),this.userId=null,this.userTraits={},this.log("Identity reset, new anonymous ID:",this.anonymousId),this.storage)try{await Promise.all([this.storage.set(S.ANONYMOUS_ID,this.anonymousId),this.storage.remove(S.USER_ID),this.storage.remove(S.USER_TRAITS)]);}catch(e){this.log("Error resetting identity in storage:",e);}}setDebug(e){this.debug=e;}log(...e){this.debug&&[...e];}},Wt=class{constructor(e){v(this,"queue",[]),v(this,"isFlushing",false),v(this,"flushTimer",null),v(this,"retryTimer",null),v(this,"config"),v(this,"initialized",false),this.config={flushAt:e.flushAt??C.FLUSH_AT,flushInterval:e.flushInterval??C.FLUSH_INTERVAL,maxQueueSize:e.maxQueueSize??C.MAX_QUEUE_SIZE,storage:e.storage,transport:e.transport,onError:e.onError,debug:e.debug??false};}async initialize(){this.initialized||(await this.loadPersistedQueue(),this.startFlushTimer(),this.initialized=true,this.log("Queue initialized with",this.queue.length,"persisted events"));}async enqueue(e){for(;this.queue.length>=this.config.maxQueueSize;){let r=this.queue.shift();r&&(this.log("Queue full, dropping oldest event:",r.event.event_id),this.config.onError?.(b.queueFull("Queue full, dropped oldest event",{dropped_event_id:r.event.event_id}),[r.event]));}let n={event:e,attempts:0,firstAttempt:Date.now()};this.queue.push(n),this.log("Enqueued event:",e.event_id,"Queue size:",this.queue.length),await this.persistQueue(),this.queue.length>=this.config.flushAt&&(this.log("Queue reached flushAt threshold, flushing"),this.flush());}async flush(e){if(!(this.isFlushing||this.queue.length===0)){this.isFlushing=true,this.log("Flushing",this.queue.length,"events");try{let n=this.queue.splice(0,C.MAX_BATCH_SIZE),r=n.map(s=>s.event);try{let s=await this.config.transport.sendEvents(r,e);for(let a of s.rejected)if(a.reason==="rate_limited"){let l=n.find(g=>g.event.event_id===a.event_id);l&&l.attempts<C.MAX_RETRIES&&(l.attempts++,this.queue.unshift(l),this.log("Rate limited event re-queued:",a.event_id,"attempt:",l.attempts));}else this.log("Event permanently rejected:",a.event_id,a.reason,a.details);this.log("Flush complete. Accepted:",s.stats.accepted,"Rejected:",s.stats.rejected);}catch(s){let a=b.fromUnknown(s);for(let k of n)k.attempts<C.MAX_RETRIES?(k.attempts++,this.queue.unshift(k)):this.log("Event dropped after max retries:",k.event.event_id);let l=n[0]?.attempts??1,g=zt(l);this.log("Network error, scheduling retry in",g,"ms"),this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.flush(e);},g),this.config.onError?.(a,r);}await this.persistQueue(),this.queue.length>=this.config.flushAt&&setTimeout(()=>this.flush(e),0);}finally{this.isFlushing=false;}}}getQueueLength(){return this.queue.length}isEmpty(){return this.queue.length===0}isBusy(){return this.isFlushing}async clear(){this.queue=[],await this.persistQueue(),this.log("Queue cleared");}destroy(){this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null),this.retryTimer&&(clearTimeout(this.retryTimer),this.retryTimer=null),this.log("Queue destroyed");}setDebug(e){this.config.debug=e;}async persistQueue(){if(this.config.storage)try{await this.config.storage.set(S.QUEUE,JSON.stringify(this.queue));}catch(e){this.log("Error persisting queue:",e);}}async loadPersistedQueue(){if(this.config.storage)try{let e=await this.config.storage.get(S.QUEUE);if(e){let n=JSON.parse(e);Array.isArray(n)&&(this.queue=n.filter(r=>r&&typeof r=="object"&&"event"in r&&"attempts"in r));}}catch(e){this.log("Error loading persisted queue:",e),this.queue=[];}}startFlushTimer(){this.flushTimer||(this.flushTimer=setInterval(()=>{this.queue.length>0&&(this.log("Flush timer triggered"),this.flush());},this.config.flushInterval));}log(...e){this.config.debug&&[...e];}},Bt=class{constructor(e,n=C.SESSION_TIMEOUT,r={},s=false){v(this,"sessionId",null),v(this,"sessionStartTime",0),v(this,"lastActivity",0),v(this,"timeout"),v(this,"storage"),v(this,"callbacks"),v(this,"debug"),this.storage=e,this.timeout=n,this.callbacks=r,this.debug=s;}async initialize(){if(!this.storage){this.log("No storage adapter, using in-memory session only");return}try{let e=await this.storage.get(S.SESSION_ID),n=await this.storage.get(S.SESSION_LAST_ACTIVITY);if(e&&n){let r=parseInt(n,10);Date.now()-r<this.timeout?(this.sessionId=e,this.lastActivity=r,this.sessionStartTime=r,this.log("Restored session from storage:",this.sessionId)):(this.log("Stored session expired, will start new session"),await this.clearStoredSession());}}catch(e){this.log("Error loading session from storage:",e);}}getSessionId(){let e=Date.now();return this.sessionId&&e-this.lastActivity>this.timeout&&this.endSession(),this.sessionId||this.startSession(),this.lastActivity=e,this.persistLastActivity(),this.sessionId}touch(){this.sessionId&&(this.lastActivity=Date.now(),this.persistLastActivity());}hasActiveSession(){return this.sessionId?Date.now()-this.lastActivity<this.timeout:false}getCurrentSessionId(){return this.sessionId}getSessionDuration(){return this.sessionId?Date.now()-this.sessionStartTime:0}startSession(){let e=Date.now();this.sessionId=Z(),this.sessionStartTime=e,this.lastActivity=e,this.log("Started new session:",this.sessionId),this.persistSession(),this.callbacks.onSessionStart?.(this.sessionId);}endSession(){if(!this.sessionId)return;let e=this.getSessionDuration(),n=this.sessionId;this.log("Ended session:",n,"duration:",e),this.sessionId=null,this.sessionStartTime=0,this.lastActivity=0,this.clearStoredSession(),this.callbacks.onSessionEnd?.(n,e);}forceEndSession(){this.sessionId&&this.endSession();}setDebug(e){this.debug=e;}setTimeout(e){this.timeout=e;}async persistSession(){if(!(!this.storage||!this.sessionId))try{await Promise.all([this.storage.set(S.SESSION_ID,this.sessionId),this.storage.set(S.SESSION_LAST_ACTIVITY,String(this.lastActivity))]);}catch(e){this.log("Error persisting session:",e);}}async persistLastActivity(){if(this.storage)try{await this.storage.set(S.SESSION_LAST_ACTIVITY,String(this.lastActivity));}catch(e){this.log("Error persisting last activity:",e);}}async clearStoredSession(){if(this.storage)try{await Promise.all([this.storage.remove(S.SESSION_ID),this.storage.remove(S.SESSION_LAST_ACTIVITY)]);}catch(e){this.log("Error clearing stored session:",e);}}log(...e){this.debug&&[...e];}},Qt={name:"pih-sdk-core",version:"0.3.0"},Kt=class{constructor(e){v(this,"apiUrl"),v(this,"apiKey"),v(this,"tenantId"),v(this,"debug"),v(this,"sdkMeta"),this.apiUrl=e.apiUrl.replace(/\/$/,""),this.apiKey=e.apiKey,this.tenantId=e.tenantId,this.debug=e.debug??false,this.sdkMeta=e.sdkMeta??Qt;}async sendEvents(e,n){let r=`${this.apiUrl}/v1/track`,s=e.map(l=>this.toTrackApiPayload(l)),a=JSON.stringify({events:s});if(this.log("Sending",e.length,"events to",r),n?.useBeacon&&typeof navigator<"u"&&typeof navigator.sendBeacon=="function"&&this.sendViaBeacon(r,a))return this.log("Events sent via sendBeacon"),{accepted:e.map(l=>({event_id:l.event_id,timestamp:l.timestamp})),rejected:[],stats:{received:e.length,accepted:e.length,rejected:0,processing_time_ms:0}};try{let l=await this.fetch(r,{method:"POST",headers:this.getHeaders(),body:a,keepalive:n?.useBeacon});if(!l.ok)throw l.status===429?b.rateLimited(`Rate limited: ${l.statusText}`,{status:l.status}):b.networkError(`HTTP ${l.status}: ${l.statusText}`,{status:l.status});let g=await l.json();return this.log("Track response:",g),g}catch(l){throw l instanceof b?l:b.networkError(`Failed to send events: ${l instanceof Error?l.message:String(l)}`,l)}}async sendIdentify(e){let n=`${this.apiUrl}/v1/identify`,r=JSON.stringify(this.toIdentifyApiPayload(e));this.log("Sending identify to",n,e);try{let s=await this.fetch(n,{method:"POST",headers:this.getHeaders(),body:r});if(!s.ok)throw s.status===429?b.rateLimited(`Rate limited: ${s.statusText}`,{status:s.status}):b.networkError(`HTTP ${s.status}: ${s.statusText}`,{status:s.status});let a=await s.json();return this.log("Identify response:",a),a}catch(s){throw s instanceof b?s:b.networkError(`Failed to send identify: ${s instanceof Error?s.message:String(s)}`,s)}}async fetchFlags(){let e=`${this.apiUrl}/v1/flags`;this.log("Fetching flags from",e);try{let n=await this.fetch(e,{method:"GET",headers:this.getHeaders()});if(!n.ok)throw b.networkError(`HTTP ${n.status}: ${n.statusText}`);let r=await n.json();return this.log("Flags response:",r),r.flags}catch(n){throw n instanceof b?n:b.networkError(`Failed to fetch flags: ${n instanceof Error?n.message:String(n)}`)}}async evaluateFlags(e){let n=`${this.apiUrl}/v1/flags/evaluate`,r=JSON.stringify({userId:e.userId??void 0,anonymousId:e.anonymousId,userTraits:e.userTraits});this.log("Evaluating flags at",n);try{let s=await this.fetch(n,{method:"POST",headers:this.getHeaders(),body:r});if(!s.ok)throw b.networkError(`HTTP ${s.status}: ${s.statusText}`);let a=await s.json();return this.log("Evaluate flags response:",a),a.flags}catch(s){throw s instanceof b?s:b.networkError(`Failed to evaluate flags: ${s instanceof Error?s.message:String(s)}`)}}setTenantId(e){this.tenantId=e;}setDebug(e){this.debug=e;}setSDKMeta(e){this.sdkMeta=e;}getHeaders(){let e={"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`,"X-SDK-Name":this.sdkMeta.name,"X-SDK-Version":this.sdkMeta.version};return this.tenantId&&(e["X-Tenant-Id"]=this.tenantId),e}toTrackApiPayload(e){return {eventId:e.event_id,eventName:e.event_name,timestamp:e.timestamp,anonymousId:e.anonymous_id,userId:e.user_id??void 0,sessionId:e.session_id??void 0,properties:e.properties,userTraits:e.user_traits,context:{platform:e.platform,appVersion:e.app_version??void 0,...e.context??{}}}}toIdentifyApiPayload(e){return {userId:e.user_id,anonymousId:e.anonymous_id,traits:e.traits,timestamp:e.timestamp}}sendViaBeacon(e,n){try{let r=new Blob([n],{type:"application/json"});return navigator.sendBeacon(e,r)}catch(r){return this.log("sendBeacon failed:",r),false}}async fetch(e,n){if(typeof fetch<"u")return fetch(e,n);throw b.networkError("fetch is not available in this environment")}log(...e){this.debug&&[...e];}},it=class{constructor(e,n=null){v(this,"config"),v(this,"storage",null),v(this,"identity"),v(this,"session"),v(this,"transport"),v(this,"queue"),v(this,"initialized",false),v(this,"tenantId"),v(this,"sessionNumber",0),v(this,"eventIndex",0),v(this,"lastSessionId",null),v(this,"flags",{}),v(this,"flagRefreshTimer",null),this.validateConfig(e),this.config={apiUrl:C.API_URL,debug:false,flushInterval:C.FLUSH_INTERVAL,flushAt:C.FLUSH_AT,maxQueueSize:C.MAX_QUEUE_SIZE,sessionTimeout:C.SESSION_TIMEOUT,...e},this.storage=n,this.tenantId=e.tenantId??"",this.identity=new Yt(n,this.config.debug),this.session=new Bt(n,this.config.sessionTimeout,{onSessionStart:r=>{this.log("Session started:",r),this.trackInternal("session_started",{session_id:r});},onSessionEnd:(r,s)=>{this.log("Session ended:",r,"duration:",s),this.trackInternal("session_ended",{session_id:r,duration_ms:s});}},this.config.debug),this.transport=new Kt({apiUrl:this.config.apiUrl,apiKey:this.config.apiKey,tenantId:this.tenantId,debug:this.config.debug}),this.queue=new Wt({flushAt:this.config.flushAt,flushInterval:this.config.flushInterval,maxQueueSize:this.config.maxQueueSize,storage:n,transport:this.transport,onError:(r,s)=>{this.config.onError?.(r),this.log("Queue error:",r.message,"events:",s.length);},debug:this.config.debug});}async initialize(){if(!this.initialized&&(await Promise.all([this.identity.initialize(),this.session.initialize(),this.queue.initialize()]),await this.loadSessionEnrichment(),await this.loadCachedFlags(),this.initialized=true,this.log("Client initialized"),this.config.featureFlags?.autoFetch!==false)){this.refreshFlags().catch(n=>{this.log("Auto-fetch flags error:",n);});let e=this.config.featureFlags?.refreshInterval??3e5;e>0&&(this.flagRefreshTimer=setInterval(()=>{this.refreshFlags().catch(n=>{this.log("Flag refresh error:",n);});},e));}}setTenant(e){this.tenantId=e,this.transport.setTenantId(e),this.log("Tenant set:",e);}async identify(e,n){await this.ensureInitialized(),await this.identity.setUserId(e),n&&await this.identity.setUserTraits(n);try{await this.transport.sendIdentify({project_id:this.config.projectId,environment:this.config.environment,tenant_id:this.tenantId,anonymous_id:this.identity.getAnonymousId(),user_id:e,traits:n,timestamp:rt()});}catch(r){let s=b.fromUnknown(r);this.config.onError?.(s),this.log("Identify error:",s.message);}this.config.featureFlags?.autoFetch!==false&&this.refreshFlags().catch(r=>{this.log("Post-identify flag refresh error:",r);});}async setUserTraits(e){await this.ensureInitialized(),await this.identity.setUserTraits(e);}async track(e,n,r){await this.ensureInitialized();let s=this.createEvent(e,n,r);if(this.session.touch(),r?.immediate)try{await this.transport.sendEvents([s]);}catch(a){let l=b.fromUnknown(a);this.config.onError?.(l),this.log("Immediate track error:",l.message);}else await this.queue.enqueue(s);}async flush(e){await this.ensureInitialized(),await this.queue.flush(e);}async reset(){await this.ensureInitialized(),this.session.forceEndSession(),await this.identity.reset(),this.log("Client reset");}setDebug(e){this.config.debug=e,this.identity.setDebug(e),this.session.setDebug(e),this.transport.setDebug(e),this.queue.setDebug(e);}getAnonymousId(){return this.identity.getAnonymousId()}getUserId(){return this.identity.getUserId()}getSessionId(){return this.session.getCurrentSessionId()}getQueueLength(){return this.queue.getQueueLength()}isFeatureEnabled(e,n=false){return this.flags[e]??n}getFeatureFlag(e,n=false){return this.flags[e]??n}getFeatureFlags(){return {...this.flags}}async refreshFlags(){try{let e=await this.transport.evaluateFlags({userId:this.identity.getUserId(),anonymousId:this.identity.getAnonymousId(),userTraits:this.identity.getUserTraits()});this.flags=e,this.persistFlags(),this.config.featureFlags?.onFlagsUpdated?.(e),this.log("Flags refreshed:",Object.keys(e).length,"flags");}catch(e){this.log("Flag refresh error:",e);}}destroy(){this.flagRefreshTimer&&(clearInterval(this.flagRefreshTimer),this.flagRefreshTimer=null),this.queue.destroy(),this.log("Client destroyed");}trackInternal(e,n){let r=this.createEvent(e,n);this.queue.enqueue(r).catch(s=>{this.log("Internal track error:",s);});}getContext(){return {}}createEvent(e,n,r){let s=r?.timestamp?Vt(r.timestamp):rt(),a=this.session.getSessionId();this.updateSessionEnrichment();let l={...this.getContext(),sessionNumber:this.sessionNumber,eventIndex:this.eventIndex};return {event_id:Z(),timestamp:s,project_id:this.config.projectId,environment:this.config.environment,tenant_id:this.tenantId,event_name:e,anonymous_id:this.identity.getAnonymousId(),user_id:this.identity.getUserId(),session_id:a,platform:this.config.platform,app_version:this.config.appVersion??null,properties:n??{},user_traits:this.identity.getUserTraits(),context:l}}async ensureInitialized(){this.initialized||await this.initialize();}validateConfig(e){if(!e.apiKey)throw b.invalidConfig("apiKey is required");if(!e.projectId)throw b.invalidConfig("projectId is required");if(!e.environment)throw b.invalidConfig("environment is required");if(!e.platform)throw b.invalidConfig("platform is required")}async loadSessionEnrichment(){if(this.storage)try{let e=await this.storage.get(S.SESSION_NUMBER),n=await this.storage.get(S.EVENT_INDEX);e&&(this.sessionNumber=parseInt(e,10)||0),n&&(this.eventIndex=parseInt(n,10)||0);}catch(e){this.log("Error loading session enrichment:",e);}}updateSessionEnrichment(){let e=this.session.getCurrentSessionId();e&&e!==this.lastSessionId&&(this.sessionNumber++,this.eventIndex=0,this.lastSessionId=e,this.persistSessionEnrichment()),this.eventIndex++,this.persistEventIndex();}persistSessionEnrichment(){this.storage&&this.storage.set(S.SESSION_NUMBER,String(this.sessionNumber)).catch(e=>{this.log("Error persisting session number:",e);});}persistEventIndex(){this.storage&&this.storage.set(S.EVENT_INDEX,String(this.eventIndex)).catch(e=>{this.log("Error persisting event index:",e);});}async loadCachedFlags(){if(this.storage)try{let e=await this.storage.get(S.FLAGS);e&&(this.flags=JSON.parse(e));}catch(e){this.log("Error loading cached flags:",e);}}persistFlags(){this.storage&&this.storage.set(S.FLAGS,JSON.stringify(this.flags)).catch(e=>{this.log("Error persisting flags:",e);});}log(...e){this.config.debug&&[...e];}};var st="pih_utm_params",Gt=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],V=class{constructor(n,r={}){p(this,"client");p(this,"config");p(this,"cachedUtmParams",null);p(this,"originalPushState",null);p(this,"originalReplaceState",null);p(this,"boundHandleClick");p(this,"boundHandlePopState");p(this,"boundHandleSubmit");this.client=n,this.config={pageViews:r.pageViews!==false,clicks:r.clicks??false,clickSelector:r.clickSelector??"[data-track]",forms:r.forms??false},this.boundHandleClick=this.handleClick.bind(this),this.boundHandlePopState=this.handlePopState.bind(this),this.boundHandleSubmit=this.handleSubmit.bind(this);}start(){typeof window>"u"||typeof document>"u"||(this.loadCachedUtmParams(),this.config.pageViews&&(this.setupPageViews(),this.trackPageView()),this.config.clicks&&this.setupClickTracking(),this.config.forms&&this.setupFormTracking());}stop(){this.originalPushState&&(history.pushState=this.originalPushState,this.originalPushState=null),this.originalReplaceState&&(history.replaceState=this.originalReplaceState,this.originalReplaceState=null),typeof window<"u"&&window.removeEventListener("popstate",this.boundHandlePopState),typeof document<"u"&&(document.removeEventListener("click",this.boundHandleClick,true),document.removeEventListener("submit",this.boundHandleSubmit,true));}trackPageView(){let n=new URL(window.location.href),r=this.extractUtmParams(n);Object.keys(r).length>0&&!this.cachedUtmParams&&(this.cachedUtmParams=r,this.persistUtmParams(r)),this.client.track("page_viewed",{path:n.pathname,search:n.search,hash:n.hash,referrer:document.referrer||null,title:document.title,url:window.location.href,...this.getUtmParams(n)});}setupPageViews(){this.originalPushState=history.pushState,this.originalReplaceState=history.replaceState;let n=this.originalPushState,r=this.originalReplaceState,s=()=>this.trackPageView();history.pushState=function(...a){n.apply(history,a),setTimeout(s,0);},history.replaceState=function(...a){r.apply(history,a),setTimeout(s,0);},window.addEventListener("popstate",this.boundHandlePopState);}handlePopState(){this.trackPageView();}setupClickTracking(){document.addEventListener("click",this.boundHandleClick,true);}handleClick(n){let r=n.target;if(!r)return;let s=r.closest(this.config.clickSelector);if(!s)return;let a=s.tagName.toLowerCase(),l=(s.textContent||"").trim().slice(0,100),g=s.id||null,k=s.className||null,T=s.getAttribute("data-track"),H=s instanceof HTMLAnchorElement?s.href:null;this.client.track("element_clicked",{element_tag:a,element_text:l,element_id:g,element_classes:k,data_track:T,href:H,path:window.location.pathname});}setupFormTracking(){document.addEventListener("submit",this.boundHandleSubmit,true);}handleSubmit(n){let r=n.target;!r||!(r instanceof HTMLFormElement)||this.client.track("form_submitted",{form_id:r.id||void 0,form_action:r.action||void 0,form_method:(r.method||"get").toUpperCase(),field_count:r.elements.length});}extractUtmParams(n){let r={};for(let s of Gt){let a=n.searchParams.get(s);a&&(r[s]=a);}return r}getUtmParams(n){let r=this.extractUtmParams(n);return Object.keys(r).length>0?r:this.cachedUtmParams??{}}loadCachedUtmParams(){try{let n=localStorage.getItem(st);n&&(this.cachedUtmParams=JSON.parse(n));}catch{}}persistUtmParams(n){try{localStorage.setItem(st,JSON.stringify(n));}catch{}}};var J=class{constructor(n){p(this,"client");p(this,"boundHandleVisibilityChange");p(this,"boundHandleBeforeUnload");this.client=n,this.boundHandleVisibilityChange=this.handleVisibilityChange.bind(this),this.boundHandleBeforeUnload=this.handleBeforeUnload.bind(this);}start(){typeof document<"u"&&document.addEventListener("visibilitychange",this.boundHandleVisibilityChange),typeof window<"u"&&(window.addEventListener("beforeunload",this.boundHandleBeforeUnload),window.addEventListener("pagehide",this.boundHandleBeforeUnload));}stop(){typeof document<"u"&&document.removeEventListener("visibilitychange",this.boundHandleVisibilityChange),typeof window<"u"&&(window.removeEventListener("beforeunload",this.boundHandleBeforeUnload),window.removeEventListener("pagehide",this.boundHandleBeforeUnload));}handleVisibilityChange(){document.visibilityState==="hidden"&&this.flushWithBeacon();}handleBeforeUnload(){this.flushWithBeacon();}flushWithBeacon(){this.client.flush({useBeacon:true}).catch(()=>{});}};function Xt(){if(typeof navigator>"u"||typeof window>"u")return "unknown";let e=navigator.userAgent.toLowerCase();if(/ipad|tablet|playbook|silk/.test(e))return "tablet";if(/mobile|iphone|ipod|android.*mobile|windows phone|blackberry|opera mini|opera mobi/.test(e))return "mobile";let n=window.screen?.width??0;return n>0&&n<768?"mobile":n>=768&&n<1024?"tablet":"desktop"}function Zt(){return typeof navigator>"u"?void 0:navigator.connection?.effectiveType??void 0}function ot(){if(typeof window>"u"||typeof document>"u")return {};let e={screenWidth:window.screen?.width??void 0,screenHeight:window.screen?.height??void 0,viewportWidth:window.innerWidth??void 0,viewportHeight:window.innerHeight??void 0,locale:navigator?.language??void 0,timezone:Jt(),deviceType:Xt(),pageUrl:window.location.href,pagePath:window.location.pathname,pageTitle:document.title||void 0,referrer:document.referrer||void 0},n=Zt();return n&&(e.connectionType=n),Object.fromEntries(Object.entries(e).filter(([,r])=>r!==void 0))}function Jt(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}var en=[25,50,75,100],ee=class{constructor(){p(this,"client",null);p(this,"started",false);p(this,"visibleStartTime",0);p(this,"totalVisibleTime",0);p(this,"reachedThresholds",new Set);p(this,"boundHandleVisibilityChange");p(this,"boundHandleScroll");this.boundHandleVisibilityChange=this.handleVisibilityChange.bind(this),this.boundHandleScroll=this.handleScroll.bind(this);}start(n){this.started||typeof window>"u"||typeof document>"u"||(this.client=n,this.started=true,this.visibleStartTime=Date.now(),this.totalVisibleTime=0,this.reachedThresholds.clear(),document.visibilityState==="visible"&&(this.visibleStartTime=Date.now()),document.addEventListener("visibilitychange",this.boundHandleVisibilityChange),window.addEventListener("scroll",this.boundHandleScroll,{passive:true}));}stop(){this.started&&(this.accumulateVisibleTime(),this.totalVisibleTime>0&&this.client&&this.client.track("page_engaged",{visible_duration_ms:this.totalVisibleTime,page_path:typeof window<"u"?window.location.pathname:void 0}),typeof document<"u"&&document.removeEventListener("visibilitychange",this.boundHandleVisibilityChange),typeof window<"u"&&window.removeEventListener("scroll",this.boundHandleScroll),this.started=false,this.client=null);}handleVisibilityChange(){!this.started||!this.client||(document.visibilityState==="hidden"?(this.accumulateVisibleTime(),this.totalVisibleTime>0&&(this.client.track("page_engaged",{visible_duration_ms:this.totalVisibleTime,page_path:window.location.pathname}),this.totalVisibleTime=0)):this.visibleStartTime=Date.now());}accumulateVisibleTime(){this.visibleStartTime>0&&(this.totalVisibleTime+=Date.now()-this.visibleStartTime,this.visibleStartTime=Date.now());}handleScroll(){if(!this.started||!this.client)return;let n=this.getScrollPercent();for(let r of en)n>=r&&!this.reachedThresholds.has(r)&&(this.reachedThresholds.add(r),this.client.track("scroll_depth_reached",{depth_percent:r,page_path:window.location.pathname}));}getScrollPercent(){let n=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight),r=window.innerHeight,s=window.scrollY||document.documentElement.scrollTop,a=n-r;return a<=0?100:Math.min(100,Math.round(s/a*100))}};var te=class{constructor(){p(this,"client",null);p(this,"started",false);p(this,"errorCount",0);p(this,"boundHandleError");p(this,"boundHandleRejection");this.boundHandleError=this.handleError.bind(this),this.boundHandleRejection=this.handleRejection.bind(this);}start(n){this.started||typeof window>"u"||(this.client=n,this.started=true,this.errorCount=0,window.addEventListener("error",this.boundHandleError),window.addEventListener("unhandledrejection",this.boundHandleRejection));}stop(){this.started&&(typeof window<"u"&&(window.removeEventListener("error",this.boundHandleError),window.removeEventListener("unhandledrejection",this.boundHandleRejection)),this.started=false,this.client=null);}handleError(n){!this.started||!this.client||this.canReport()&&(this.errorCount++,this.client.track("js_error",{message:n.message||"Unknown error",filename:n.filename||void 0,lineno:n.lineno||void 0,colno:n.colno||void 0,stack:n.error?.stack||void 0}));}handleRejection(n){if(!this.started||!this.client||!this.canReport())return;this.errorCount++;let r=n.reason,s=r instanceof Error?r.message:typeof r=="string"?r:"Unhandled promise rejection",a=r instanceof Error?r.stack:void 0;this.client.track("js_error",{message:s,filename:void 0,lineno:void 0,colno:void 0,stack:a});}canReport(){return this.errorCount<10}};var ne=class{constructor(){p(this,"client",null);p(this,"started",false);}start(n){this.started||(this.client=n,this.started=true,this.initWebVitals());}stop(){this.started=false,this.client=null;}async initWebVitals(){try{let r=await import('web-vitals'),s=a=>{!this.started||!this.client||this.client.track("web_vital",{name:a.name,value:a.value,rating:a.rating});};r.onLCP&&r.onLCP(s),r.onFID&&r.onFID(s),r.onCLS&&r.onCLS(s),r.onINP&&r.onINP(s),r.onTTFB&&r.onTTFB(s);}catch{}}};var z=class{constructor(){p(this,"data",new Map);}async get(n){return this.data.get(n)??null}async set(n,r){this.data.set(n,r);}async remove(n){this.data.delete(n);}};function tn(){try{let e="__pih_test__";return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch{return false}}var Ee=class{constructor(){p(this,"fallback",null);p(this,"useLocalStorage");this.useLocalStorage=tn(),this.useLocalStorage||(this.fallback=new z,console.warn("[PIH] localStorage unavailable, using in-memory storage. Data will not persist across page loads."));}async get(n){if(this.fallback)return this.fallback.get(n);try{return localStorage.getItem(n)}catch{return this.fallback||(this.fallback=new z),this.fallback.get(n)}}async set(n,r){if(this.fallback)return this.fallback.set(n,r);try{localStorage.setItem(n,r);}catch(s){return this.fallback||(this.fallback=new z,console.warn("[PIH] localStorage write failed, falling back to in-memory storage:",s)),this.fallback.set(n,r)}}async remove(n){if(this.fallback)return this.fallback.remove(n);try{localStorage.removeItem(n);}catch{}}};function we(){return new Ee}we();var D=Ft(Et());var Ce=new Set;function wt(e){return Ce.add(e),()=>Ce.delete(e)}function En(){for(let e of Ce)e();}function wn(e,n=false){let r=(0, D.useCallback)(()=>se()?.isFeatureEnabled(e,n)??n,[e,n]);return (0, D.useSyncExternalStore)(wt,r,()=>n)}function _n(){let e=(0, D.useCallback)(()=>se()?.getFeatureFlags()??{},[]);return (0, D.useSyncExternalStore)(wt,e,()=>({}))}var oe=class extends it{constructor(r,s){let a={...r,platform:"web"};super(a,s??we());p(this,"autocapture",null);p(this,"beacon");p(this,"performanceTracker",null);p(this,"engagementTracker",null);p(this,"errorTracker",null);this.transport.setSDKMeta({name:"pih-sdk-web",version:"0.2.0"}),this.beacon=new J(this);}getContext(){return ot()}async initialize(){await super.initialize(),this.beacon.start(),this.config.autocapture&&(this.autocapture=new V(this,this.config.autocapture),this.autocapture.start(),this.config.autocapture.performance&&(this.performanceTracker=new ne,this.performanceTracker.start(this)),this.config.autocapture.engagement&&(this.engagementTracker=new ee,this.engagementTracker.start(this)),this.config.autocapture.errorTracking&&(this.errorTracker=new te,this.errorTracker.start(this))),this.log("Web client initialized");}enableAutocapture(r){this.autocapture&&this.autocapture.stop(),this.autocapture=new V(this,r),this.autocapture.start();}disableAutocapture(){this.autocapture&&(this.autocapture.stop(),this.autocapture=null);}trackPageView(){if(this.autocapture)this.autocapture.trackPageView();else {let r=new URL(window.location.href);this.track("page_viewed",{path:r.pathname,search:r.search,hash:r.hash,referrer:document.referrer||null,title:document.title,url:window.location.href});}}destroy(){this.beacon.stop(),this.autocapture&&this.autocapture.stop(),this.performanceTracker&&(this.performanceTracker.stop(),this.performanceTracker=null),this.engagementTracker&&(this.engagementTracker.stop(),this.engagementTracker=null),this.errorTracker&&(this.errorTracker.stop(),this.errorTracker=null),super.destroy();}log(...r){this.config.debug&&[...r];}},O=null;function Sn(e){return O?(console.warn("[PIH] SDK already initialized. Returning existing instance."),O):(O=new oe(e),O.initialize().catch(n=>{console.error("[PIH] Failed to initialize:",n);}),O)}function se(){return O}function bn(){O&&(O.destroy(),O=null);}var Tn={init:Sn,getInstance:se,resetInstance:bn,WebPIHClient:oe},ir=Tn;/*! Bundled license information:
|
|
28
|
+
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),u}function de(){Z.asyncTransitions--;}function z(u){if(Kt===null)try{var p=("require"+Math.random()).slice(0,7);Kt=(Dr&&Dr[p]).call(Dr,"timers").setImmediate;}catch{Kt=function(R){gi===false&&(gi=true,typeof MessageChannel>"u"&&console.error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var D=new MessageChannel;D.port1.onmessage=R,D.port2.postMessage(void 0);};}return Kt(u)}function Q(u){return 1<u.length&&typeof AggregateError=="function"?new AggregateError(u):u[0]}function W(u,p){p!==Zt-1&&console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),Zt=p;}function J(u,p,E){var R=Z.actQueue;if(R!==null)if(R.length!==0)try{j(R),z(function(){return J(u,p,E)});return}catch(D){Z.thrownErrors.push(D);}else Z.actQueue=null;0<Z.thrownErrors.length?(R=Q(Z.thrownErrors),Z.thrownErrors.length=0,E(R)):p(u);}function j(u){if(!Pr){Pr=true;var p=0;try{for(;p<u.length;p++){var E=u[p];do{Z.didUsePromise=!1;var R=E(!1);if(R!==null){if(Z.didUsePromise){u[p]=E,u.splice(0,p);return}E=R;}else break}while(!0)}u.length=0;}catch(D){u.splice(0,p+1),Z.thrownErrors.push(D);}finally{Pr=false;}}}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var U=Symbol.for("react.transitional.element"),se=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),K=Symbol.for("react.context"),ie=Symbol.for("react.forward_ref"),he=Symbol.for("react.suspense"),B=Symbol.for("react.suspense_list"),pe=Symbol.for("react.memo"),le=Symbol.for("react.lazy"),ce=Symbol.for("react.activity"),Ee=Symbol.iterator,ee={},we={isMounted:function(){return false},enqueueForceUpdate:function(u){r(u,"forceUpdate");},enqueueReplaceState:function(u){r(u,"replaceState");},enqueueSetState:function(u){r(u,"setState");}},$e=Object.assign,ve={};Object.freeze(ve),n.prototype.isReactComponent={},n.prototype.setState=function(u,p){if(typeof u!="object"&&typeof u!="function"&&u!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,u,p,"setState");},n.prototype.forceUpdate=function(u){this.updater.enqueueForceUpdate(this,u,"forceUpdate");};var ke={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]};for(At in ke)ke.hasOwnProperty(At)&&e(At,ke[At]);i.prototype=n.prototype,ke=s.prototype=new i,ke.constructor=s,$e(ke,n.prototype),ke.isPureReactComponent=true;var li=Array.isArray,Wo=Symbol.for("react.client.reference"),Z={H:null,A:null,T:null,S:null,actQueue:null,asyncTransitions:0,isBatchingLegacy:false,didScheduleLegacyUpdate:false,didUsePromise:false,thrownErrors:[],getCurrentStack:null,recentlyCreatedOwnerStacks:0},Yt=Object.prototype.hasOwnProperty,ci=console.createTask?console.createTask:function(){return null};ke={react_stack_bottom_frame:function(u){return u()}};var ui,di,hi={},Ho=ke.react_stack_bottom_frame.bind(ke,f)(),Vo=ci(d(f)),fi=false,pi=/\/+/g,mi=typeof reportError=="function"?reportError:function(u){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var p=new window.ErrorEvent("error",{bubbles:true,cancelable:true,message:typeof u=="object"&&u!==null&&typeof u.message=="string"?String(u.message):String(u),error:u});if(!window.dispatchEvent(p))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",u);return}console.error(u);},gi=false,Kt=null,Zt=0,qt=false,Pr=false,vi=typeof queueMicrotask=="function"?function(u){queueMicrotask(function(){return queueMicrotask(u)});}:z;ke=Object.freeze({__proto__:null,c:function(u){return F().useMemoCache(u)}});var At={map:A,forEach:function(u,p,E){A(u,function(){p.apply(this,arguments);},E);},count:function(u){var p=0;return A(u,function(){p++;}),p},toArray:function(u){return A(u,function(p){return p})||[]},only:function(u){if(!S(u))throw Error("React.Children.only expected to receive a single React element child.");return u}};H.Activity=ce,H.Children=At,H.Component=n,H.Fragment=w,H.Profiler=x,H.PureComponent=s,H.StrictMode=b,H.Suspense=he,H.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Z,H.__COMPILER_RUNTIME=ke,H.act=function(u){var p=Z.actQueue,E=Zt;Zt++;var R=Z.actQueue=p!==null?p:[],D=false;try{var X=u();}catch($){Z.thrownErrors.push($);}if(0<Z.thrownErrors.length)throw W(p,E),u=Q(Z.thrownErrors),Z.thrownErrors.length=0,u;if(X!==null&&typeof X=="object"&&typeof X.then=="function"){var Y=X;return vi(function(){D||qt||(qt=true,console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"));}),{then:function($,Je){D=true,Y.then(function(gt){if(W(p,E),E===0){try{j(R),z(function(){return J(gt,$,Je)});}catch(jo){Z.thrownErrors.push(jo);}if(0<Z.thrownErrors.length){var Go=Q(Z.thrownErrors);Z.thrownErrors.length=0,Je(Go);}}else $(gt);},function(gt){W(p,E),0<Z.thrownErrors.length&&(gt=Q(Z.thrownErrors),Z.thrownErrors.length=0),Je(gt);});}}}var ue=X;if(W(p,E),E===0&&(j(R),R.length!==0&&vi(function(){D||qt||(qt=true,console.error("A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"));}),Z.actQueue=null),0<Z.thrownErrors.length)throw u=Q(Z.thrownErrors),Z.thrownErrors.length=0,u;return {then:function($,Je){D=true,E===0?(Z.actQueue=R,z(function(){return J(ue,$,Je)})):$(ue);}}},H.cache=function(u){return function(){return u.apply(null,arguments)}},H.cacheSignal=function(){return null},H.captureOwnerStack=function(){var u=Z.getCurrentStack;return u===null?null:u()},H.cloneElement=function(u,p,E){if(u==null)throw Error("The argument must be a React element, but you passed "+u+".");var R=$e({},u.props),D=u.key,X=u._owner;if(p!=null){var Y;e:{if(Yt.call(p,"ref")&&(Y=Object.getOwnPropertyDescriptor(p,"ref").get)&&Y.isReactWarning){Y=false;break e}Y=p.ref!==void 0;}Y&&(X=h()),m(p)&&(l(p.key),D=""+p.key);for(ue in p)!Yt.call(p,ue)||ue==="key"||ue==="__self"||ue==="__source"||ue==="ref"&&p.ref===void 0||(R[ue]=p[ue]);}var ue=arguments.length-2;if(ue===1)R.children=E;else if(1<ue){Y=Array(ue);for(var $=0;$<ue;$++)Y[$]=arguments[$+2];R.children=Y;}for(R=C(u.type,D,R,X,u._debugStack,u._debugTask),D=2;D<arguments.length;D++)v(arguments[D]);return R},H.createContext=function(u){return u={$$typeof:K,_currentValue:u,_currentValue2:u,_threadCount:0,Provider:null,Consumer:null},u.Provider=u,u.Consumer={$$typeof:M,_context:u},u._currentRenderer=null,u._currentRenderer2=null,u},H.createElement=function(u,p,E){for(var R=2;R<arguments.length;R++)v(arguments[R]);R={};var D=null;if(p!=null)for($ in di||!("__self"in p)||"key"in p||(di=true,console.warn("Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform")),m(p)&&(l(p.key),D=""+p.key),p)Yt.call(p,$)&&$!=="key"&&$!=="__self"&&$!=="__source"&&(R[$]=p[$]);var X=arguments.length-2;if(X===1)R.children=E;else if(1<X){for(var Y=Array(X),ue=0;ue<X;ue++)Y[ue]=arguments[ue+2];Object.freeze&&Object.freeze(Y),R.children=Y;}if(u&&u.defaultProps)for($ in X=u.defaultProps,X)R[$]===void 0&&(R[$]=X[$]);D&&g(R,typeof u=="function"?u.displayName||u.name||"Unknown":u);var $=1e4>Z.recentlyCreatedOwnerStacks++;return C(u,D,R,h(),$?Error("react-stack-top-frame"):Ho,$?ci(d(u)):Vo)},H.createRef=function(){var u={current:null};return Object.seal(u),u},H.forwardRef=function(u){u!=null&&u.$$typeof===pe?console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof u!="function"?console.error("forwardRef requires a render function but was given %s.",u===null?"null":typeof u):u.length!==0&&u.length!==2&&console.error("forwardRef render functions accept exactly two parameters: props and ref. %s",u.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),u!=null&&u.defaultProps!=null&&console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");var p={$$typeof:ie,render:u},E;return Object.defineProperty(p,"displayName",{enumerable:false,configurable:true,get:function(){return E},set:function(R){E=R,u.name||u.displayName||(Object.defineProperty(u,"name",{value:R}),u.displayName=R);}}),p},H.isValidElement=S,H.lazy=function(u){u={_status:-1,_result:u};var p={$$typeof:le,_payload:u,_init:oe},E={name:"lazy",start:-1,end:-1,value:null,owner:null,debugStack:Error("react-stack-top-frame"),debugTask:console.createTask?console.createTask("lazy()"):null};return u._ioInfo=E,p._debugInfo=[{awaited:E}],p},H.memo=function(u,p){u==null&&console.error("memo: The first argument must be a component. Instead received: %s",u===null?"null":typeof u),p={$$typeof:pe,type:u,compare:p===void 0?null:p};var E;return Object.defineProperty(p,"displayName",{enumerable:false,configurable:true,get:function(){return E},set:function(R){E=R,u.name||u.displayName||(Object.defineProperty(u,"name",{value:R}),u.displayName=R);}}),p},H.startTransition=function(u){var p=Z.T,E={};E._updatedFibers=new Set,Z.T=E;try{var R=u(),D=Z.S;D!==null&&D(E,R),typeof R=="object"&&R!==null&&typeof R.then=="function"&&(Z.asyncTransitions++,R.then(de,de),R.then(o,mi));}catch(X){mi(X);}finally{p===null&&E._updatedFibers&&(u=E._updatedFibers.size,E._updatedFibers.clear(),10<u&&console.warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.")),p!==null&&E.types!==null&&(p.types!==null&&p.types!==E.types&&console.error("We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."),p.types=E.types),Z.T=p;}},H.unstable_useCacheRefresh=function(){return F().useCacheRefresh()},H.use=function(u){return F().use(u)},H.useActionState=function(u,p,E){return F().useActionState(u,p,E)},H.useCallback=function(u,p){return F().useCallback(u,p)},H.useContext=function(u){var p=F();return u.$$typeof===M&&console.error("Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"),p.useContext(u)},H.useDebugValue=function(u,p){return F().useDebugValue(u,p)},H.useDeferredValue=function(u,p){return F().useDeferredValue(u,p)},H.useEffect=function(u,p){return u==null&&console.warn("React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"),F().useEffect(u,p)},H.useEffectEvent=function(u){return F().useEffectEvent(u)},H.useId=function(){return F().useId()},H.useImperativeHandle=function(u,p,E){return F().useImperativeHandle(u,p,E)},H.useInsertionEffect=function(u,p){return u==null&&console.warn("React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"),F().useInsertionEffect(u,p)},H.useLayoutEffect=function(u,p){return u==null&&console.warn("React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"),F().useLayoutEffect(u,p)},H.useMemo=function(u,p){return F().useMemo(u,p)},H.useOptimistic=function(u,p){return F().useOptimistic(u,p)},H.useReducer=function(u,p,E){return F().useReducer(u,p,E)},H.useRef=function(u){return F().useRef(u)},H.useState=function(u){return F().useState(u)},H.useSyncExternalStore=function(u,p,E){return F().useSyncExternalStore(u,p,E)},H.useTransition=function(){return F().useTransition()},H.version="19.2.4",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());})();});var Uo=Br((vh,oi)=>{process.env.NODE_ENV==="production"?oi.exports=Fo():oi.exports=Po();});var Jo=Object.defineProperty,ea=(e,t,r)=>t in e?Jo(e,t,{enumerable:true,configurable:true,writable:true,value:r}):e[t]=r,q=(e,t,r)=>ea(e,typeof t!="symbol"?t+"":t,r),ye=class Fe extends Error{constructor(t,r,n){super(t),q(this,"code"),q(this,"details"),this.name="PIHError",this.code=r,this.details=n,Error.captureStackTrace&&Error.captureStackTrace(this,Fe);}static networkError(t,r){return new Fe(t,"NETWORK_ERROR",r)}static invalidConfig(t,r){return new Fe(t,"INVALID_CONFIG",r)}static queueFull(t,r){return new Fe(t,"QUEUE_FULL",r)}static rateLimited(t,r){return new Fe(t,"RATE_LIMITED",r)}static invalidPayload(t,r){return new Fe(t,"INVALID_PAYLOAD",r)}static storageError(t,r){return new Fe(t,"STORAGE_ERROR",r)}static sessionError(t,r){return new Fe(t,"SESSION_ERROR",r)}static fromUnknown(t){return t instanceof Fe?t:t instanceof Error?new Fe(t.message,"UNKNOWN_ERROR",t):new Fe(String(t),"UNKNOWN_ERROR",t)}};function Xt(){if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function"){let e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e,r=>r.toString(16).padStart(2,"0")).join("");return `${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return (e==="x"?t:t&3|8).toString(16)})}function yi(){return new Date().toISOString()}function ta(e){return e.toISOString()}function ra(e,t=1e3,r=16e3){let n=t*Math.pow(2,e);return Math.min(n,r)}var je="pih_",ge={QUEUE:`${je}queue`,ANONYMOUS_ID:`${je}anonymous_id`,USER_ID:`${je}user_id`,USER_TRAITS:`${je}user_traits`,SESSION_ID:`${je}session_id`,SESSION_LAST_ACTIVITY:`${je}session_last_activity`,SESSION_NUMBER:`${je}session_number`,EVENT_INDEX:`${je}event_index`,FLAGS:`${je}flags`},Pe={API_URL:"https://repoingest-production.up.railway.app",FLUSH_INTERVAL:1e4,FLUSH_AT:25,MAX_QUEUE_SIZE:5e3,SESSION_TIMEOUT:18e5,MAX_BATCH_SIZE:100,MAX_RETRIES:5,BASE_BACKOFF_DELAY:1e3,MAX_BACKOFF_DELAY:16e3},na=class{constructor(e,t=false){q(this,"anonymousId"),q(this,"userId",null),q(this,"userTraits",{}),q(this,"storage"),q(this,"debug"),this.storage=e,this.debug=t,this.anonymousId=Xt();}async initialize(){if(!this.storage){this.log("No storage adapter, using in-memory identity only");return}try{let e=await this.storage.get(ge.ANONYMOUS_ID);e?(this.anonymousId=e,this.log("Loaded anonymous ID from storage:",this.anonymousId)):(await this.storage.set(ge.ANONYMOUS_ID,this.anonymousId),this.log("Generated new anonymous ID:",this.anonymousId));let t=await this.storage.get(ge.USER_ID);t&&(this.userId=t,this.log("Loaded user ID from storage:",this.userId));let r=await this.storage.get(ge.USER_TRAITS);if(r)try{this.userTraits=JSON.parse(r),this.log("Loaded user traits from storage:",this.userTraits);}catch{this.log("Failed to parse stored user traits");}}catch(e){this.log("Error loading identity from storage:",e);}}getAnonymousId(){return this.anonymousId}getUserId(){return this.userId}getUserTraits(){return {...this.userTraits}}async setUserId(e){if(this.userId=e,this.log("Set user ID:",e),this.storage)try{await this.storage.set(ge.USER_ID,e);}catch(t){this.log("Error persisting user ID:",t);}}async setUserTraits(e){if(this.userTraits={...this.userTraits,...e},this.log("Set user traits:",this.userTraits),this.storage)try{await this.storage.set(ge.USER_TRAITS,JSON.stringify(this.userTraits));}catch(t){this.log("Error persisting user traits:",t);}}async reset(){if(this.anonymousId=Xt(),this.userId=null,this.userTraits={},this.log("Identity reset, new anonymous ID:",this.anonymousId),this.storage)try{await Promise.all([this.storage.set(ge.ANONYMOUS_ID,this.anonymousId),this.storage.remove(ge.USER_ID),this.storage.remove(ge.USER_TRAITS)]);}catch(e){this.log("Error resetting identity in storage:",e);}}setDebug(e){this.debug=e;}log(...e){this.debug&&[...e];}},ia=class{constructor(e){q(this,"queue",[]),q(this,"isFlushing",false),q(this,"flushTimer",null),q(this,"retryTimer",null),q(this,"config"),q(this,"initialized",false),this.config={flushAt:e.flushAt??Pe.FLUSH_AT,flushInterval:e.flushInterval??Pe.FLUSH_INTERVAL,maxQueueSize:e.maxQueueSize??Pe.MAX_QUEUE_SIZE,storage:e.storage,transport:e.transport,onError:e.onError,debug:e.debug??false};}async initialize(){this.initialized||(await this.loadPersistedQueue(),this.startFlushTimer(),this.initialized=true,this.log("Queue initialized with",this.queue.length,"persisted events"));}async enqueue(e){for(;this.queue.length>=this.config.maxQueueSize;){let r=this.queue.shift();r&&(this.log("Queue full, dropping oldest event:",r.event.event_id),this.config.onError?.(ye.queueFull("Queue full, dropped oldest event",{dropped_event_id:r.event.event_id}),[r.event]));}let t={event:e,attempts:0,firstAttempt:Date.now()};this.queue.push(t),this.log("Enqueued event:",e.event_id,"Queue size:",this.queue.length),await this.persistQueue(),this.queue.length>=this.config.flushAt&&(this.log("Queue reached flushAt threshold, flushing"),this.flush());}async flush(e){if(!(this.isFlushing||this.queue.length===0)){this.isFlushing=true,this.log("Flushing",this.queue.length,"events");try{let t=this.queue.splice(0,Pe.MAX_BATCH_SIZE),r=t.map(n=>n.event);try{let n=await this.config.transport.sendEvents(r,e);for(let i of n.rejected)if(i.reason==="rate_limited"){let s=t.find(o=>o.event.event_id===i.event_id);s&&s.attempts<Pe.MAX_RETRIES&&(s.attempts++,this.queue.unshift(s),this.log("Rate limited event re-queued:",i.event_id,"attempt:",s.attempts));}else this.log("Event permanently rejected:",i.event_id,i.reason,i.details);this.log("Flush complete. Accepted:",n.stats.accepted,"Rejected:",n.stats.rejected);}catch(n){let i=ye.fromUnknown(n);for(let a of t)a.attempts<Pe.MAX_RETRIES?(a.attempts++,this.queue.unshift(a)):this.log("Event dropped after max retries:",a.event.event_id);let s=t[0]?.attempts??1,o=ra(s);this.log("Network error, scheduling retry in",o,"ms"),this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.flush(e);},o),this.config.onError?.(i,r);}await this.persistQueue(),this.queue.length>=this.config.flushAt&&setTimeout(()=>this.flush(e),0);}finally{this.isFlushing=false;}}}getQueueLength(){return this.queue.length}isEmpty(){return this.queue.length===0}isBusy(){return this.isFlushing}async clear(){this.queue=[],await this.persistQueue(),this.log("Queue cleared");}destroy(){this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null),this.retryTimer&&(clearTimeout(this.retryTimer),this.retryTimer=null),this.log("Queue destroyed");}setDebug(e){this.config.debug=e;}async persistQueue(){if(this.config.storage)try{await this.config.storage.set(ge.QUEUE,JSON.stringify(this.queue));}catch(e){this.log("Error persisting queue:",e);}}async loadPersistedQueue(){if(this.config.storage)try{let e=await this.config.storage.get(ge.QUEUE);if(e){let t=JSON.parse(e);Array.isArray(t)&&(this.queue=t.filter(r=>r&&typeof r=="object"&&"event"in r&&"attempts"in r));}}catch(e){this.log("Error loading persisted queue:",e),this.queue=[];}}startFlushTimer(){this.flushTimer||(this.flushTimer=setInterval(()=>{this.queue.length>0&&(this.log("Flush timer triggered"),this.flush());},this.config.flushInterval));}log(...e){this.config.debug&&[...e];}},sa=class{constructor(e,t=Pe.SESSION_TIMEOUT,r={},n=false){q(this,"sessionId",null),q(this,"sessionStartTime",0),q(this,"lastActivity",0),q(this,"timeout"),q(this,"storage"),q(this,"callbacks"),q(this,"debug"),this.storage=e,this.timeout=t,this.callbacks=r,this.debug=n;}async initialize(){if(!this.storage){this.log("No storage adapter, using in-memory session only");return}try{let e=await this.storage.get(ge.SESSION_ID),t=await this.storage.get(ge.SESSION_LAST_ACTIVITY);if(e&&t){let r=parseInt(t,10);Date.now()-r<this.timeout?(this.sessionId=e,this.lastActivity=r,this.sessionStartTime=r,this.log("Restored session from storage:",this.sessionId)):(this.log("Stored session expired, will start new session"),await this.clearStoredSession());}}catch(e){this.log("Error loading session from storage:",e);}}getSessionId(){let e=Date.now();return this.sessionId&&e-this.lastActivity>this.timeout&&this.endSession(),this.sessionId||this.startSession(),this.lastActivity=e,this.persistLastActivity(),this.sessionId}touch(){this.sessionId&&(this.lastActivity=Date.now(),this.persistLastActivity());}hasActiveSession(){return this.sessionId?Date.now()-this.lastActivity<this.timeout:false}getCurrentSessionId(){return this.sessionId}getSessionDuration(){return this.sessionId?Date.now()-this.sessionStartTime:0}startSession(){let e=Date.now();this.sessionId=Xt(),this.sessionStartTime=e,this.lastActivity=e,this.log("Started new session:",this.sessionId),this.persistSession(),this.callbacks.onSessionStart?.(this.sessionId);}endSession(){if(!this.sessionId)return;let e=this.getSessionDuration(),t=this.sessionId;this.log("Ended session:",t,"duration:",e),this.sessionId=null,this.sessionStartTime=0,this.lastActivity=0,this.clearStoredSession(),this.callbacks.onSessionEnd?.(t,e);}forceEndSession(){this.sessionId&&this.endSession();}setDebug(e){this.debug=e;}setTimeout(e){this.timeout=e;}async persistSession(){if(!(!this.storage||!this.sessionId))try{await Promise.all([this.storage.set(ge.SESSION_ID,this.sessionId),this.storage.set(ge.SESSION_LAST_ACTIVITY,String(this.lastActivity))]);}catch(e){this.log("Error persisting session:",e);}}async persistLastActivity(){if(this.storage)try{await this.storage.set(ge.SESSION_LAST_ACTIVITY,String(this.lastActivity));}catch(e){this.log("Error persisting last activity:",e);}}async clearStoredSession(){if(this.storage)try{await Promise.all([this.storage.remove(ge.SESSION_ID),this.storage.remove(ge.SESSION_LAST_ACTIVITY)]);}catch(e){this.log("Error clearing stored session:",e);}}log(...e){this.debug&&[...e];}},oa={name:"pih-sdk-core",version:"0.4.1"},aa=class{constructor(e){q(this,"apiUrl"),q(this,"apiKey"),q(this,"tenantId"),q(this,"debug"),q(this,"sdkMeta"),this.apiUrl=e.apiUrl.replace(/\/$/,""),this.apiKey=e.apiKey,this.tenantId=e.tenantId,this.debug=e.debug??false,this.sdkMeta=e.sdkMeta??oa;}async sendEvents(e,t){let r=`${this.apiUrl}/v1/track`,n=e.map(s=>this.toTrackApiPayload(s)),i=JSON.stringify({events:n});this.log("Sending",e.length,"events to",r);try{let s=await this.fetch(r,{method:"POST",headers:this.getHeaders(),body:i,keepalive:t?.useBeacon});if(!s.ok)throw s.status===429?ye.rateLimited(`Rate limited: ${s.statusText}`,{status:s.status}):ye.networkError(`HTTP ${s.status}: ${s.statusText}`,{status:s.status});let o=await s.json();return this.log("Track response:",o),o}catch(s){throw s instanceof ye?s:ye.networkError(`Failed to send events: ${s instanceof Error?s.message:String(s)}`,s)}}async sendIdentify(e){let t=`${this.apiUrl}/v1/identify`,r=JSON.stringify(this.toIdentifyApiPayload(e));this.log("Sending identify to",t,e);try{let n=await this.fetch(t,{method:"POST",headers:this.getHeaders(),body:r});if(!n.ok)throw n.status===429?ye.rateLimited(`Rate limited: ${n.statusText}`,{status:n.status}):ye.networkError(`HTTP ${n.status}: ${n.statusText}`,{status:n.status});let i=await n.json();return this.log("Identify response:",i),i}catch(n){throw n instanceof ye?n:ye.networkError(`Failed to send identify: ${n instanceof Error?n.message:String(n)}`,n)}}async fetchFlags(){let e=`${this.apiUrl}/v1/flags`;this.log("Fetching flags from",e);try{let t=await this.fetch(e,{method:"GET",headers:this.getHeaders()});if(!t.ok)throw ye.networkError(`HTTP ${t.status}: ${t.statusText}`);let r=await t.json();return this.log("Flags response:",r),r.flags}catch(t){throw t instanceof ye?t:ye.networkError(`Failed to fetch flags: ${t instanceof Error?t.message:String(t)}`)}}async evaluateFlags(e){let t=`${this.apiUrl}/v1/flags/evaluate`,r=JSON.stringify({userId:e.userId??void 0,anonymousId:e.anonymousId,userTraits:e.userTraits});this.log("Evaluating flags at",t);try{let n=await this.fetch(t,{method:"POST",headers:this.getHeaders(),body:r});if(!n.ok)throw ye.networkError(`HTTP ${n.status}: ${n.statusText}`);let i=await n.json();return this.log("Evaluate flags response:",i),i.flags}catch(n){throw n instanceof ye?n:ye.networkError(`Failed to evaluate flags: ${n instanceof Error?n.message:String(n)}`)}}setTenantId(e){this.tenantId=e;}setDebug(e){this.debug=e;}setSDKMeta(e){this.sdkMeta=e;}getHeaders(){let e={"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`,"X-SDK-Name":this.sdkMeta.name,"X-SDK-Version":this.sdkMeta.version};return this.tenantId&&(e["X-Tenant-Id"]=this.tenantId),e}toTrackApiPayload(e){return {eventId:e.event_id,eventName:e.event_name,timestamp:e.timestamp,anonymousId:e.anonymous_id,userId:e.user_id??void 0,sessionId:e.session_id??void 0,properties:e.properties,userTraits:e.user_traits,context:{platform:e.platform,appVersion:e.app_version??void 0,...e.context??{}}}}toIdentifyApiPayload(e){return {userId:e.user_id,anonymousId:e.anonymous_id,traits:e.traits,timestamp:e.timestamp}}async fetch(e,t){if(typeof fetch<"u")return fetch(e,t);throw ye.networkError("fetch is not available in this environment")}log(...e){this.debug&&[...e];}},Ii=class{constructor(e,t=null){q(this,"config"),q(this,"storage",null),q(this,"identity"),q(this,"session"),q(this,"transport"),q(this,"queue"),q(this,"initialized",false),q(this,"tenantId"),q(this,"sessionNumber",0),q(this,"eventIndex",0),q(this,"lastSessionId",null),q(this,"flags",{}),q(this,"flagRefreshTimer",null),this.validateConfig(e);let r=Object.fromEntries(Object.entries(e).filter(([,n])=>n!==void 0));this.config={apiUrl:Pe.API_URL,debug:false,flushInterval:Pe.FLUSH_INTERVAL,flushAt:Pe.FLUSH_AT,maxQueueSize:Pe.MAX_QUEUE_SIZE,sessionTimeout:Pe.SESSION_TIMEOUT,...r},this.storage=t,this.tenantId=e.tenantId??"",this.identity=new na(t,this.config.debug),this.session=new sa(t,this.config.sessionTimeout,{onSessionStart:n=>{this.log("Session started:",n),this.trackInternal("session_started",{session_id:n});},onSessionEnd:(n,i)=>{this.log("Session ended:",n,"duration:",i),this.trackInternal("session_ended",{session_id:n,duration_ms:i});}},this.config.debug),this.transport=new aa({apiUrl:this.config.apiUrl,apiKey:this.config.apiKey,tenantId:this.tenantId,debug:this.config.debug}),this.queue=new ia({flushAt:this.config.flushAt,flushInterval:this.config.flushInterval,maxQueueSize:this.config.maxQueueSize,storage:t,transport:this.transport,onError:(n,i)=>{this.config.onError?.(n),this.log("Queue error:",n.message,"events:",i.length);},debug:this.config.debug});}async initialize(){if(!this.initialized&&(await Promise.all([this.identity.initialize(),this.session.initialize(),this.queue.initialize()]),await this.loadSessionEnrichment(),await this.loadCachedFlags(),this.initialized=true,this.log("Client initialized"),this.config.featureFlags?.autoFetch!==false)){this.refreshFlags().catch(t=>{this.log("Auto-fetch flags error:",t);});let e=this.config.featureFlags?.refreshInterval??3e5;e>0&&(this.flagRefreshTimer=setInterval(()=>{this.refreshFlags().catch(t=>{this.log("Flag refresh error:",t);});},e));}}setTenant(e){this.tenantId=e,this.transport.setTenantId(e),this.log("Tenant set:",e);}async identify(e,t){await this.ensureInitialized(),await this.identity.setUserId(e),t&&await this.identity.setUserTraits(t);try{await this.transport.sendIdentify({project_id:this.config.projectId,environment:this.config.environment,tenant_id:this.tenantId,anonymous_id:this.identity.getAnonymousId(),user_id:e,traits:t,timestamp:yi()});}catch(r){let n=ye.fromUnknown(r);this.config.onError?.(n),this.log("Identify error:",n.message);}this.config.featureFlags?.autoFetch!==false&&this.refreshFlags().catch(r=>{this.log("Post-identify flag refresh error:",r);});}async setUserTraits(e){await this.ensureInitialized(),await this.identity.setUserTraits(e);}async track(e,t,r){await this.ensureInitialized();let n=this.createEvent(e,t,r);if(this.session.touch(),r?.immediate)try{await this.transport.sendEvents([n]);}catch(i){let s=ye.fromUnknown(i);this.config.onError?.(s),this.log("Immediate track error:",s.message);}else await this.queue.enqueue(n);}async flush(e){await this.ensureInitialized(),await this.queue.flush(e);}async reset(){await this.ensureInitialized(),this.session.forceEndSession(),await this.identity.reset(),this.log("Client reset");}setDebug(e){this.config.debug=e,this.identity.setDebug(e),this.session.setDebug(e),this.transport.setDebug(e),this.queue.setDebug(e);}getAnonymousId(){return this.identity.getAnonymousId()}getUserId(){return this.identity.getUserId()}getSessionId(){return this.session.getCurrentSessionId()}getQueueLength(){return this.queue.getQueueLength()}isFeatureEnabled(e,t=false){return this.flags[e]??t}getFeatureFlag(e,t=false){return this.flags[e]??t}getFeatureFlags(){return {...this.flags}}async refreshFlags(){try{let e=await this.transport.evaluateFlags({userId:this.identity.getUserId(),anonymousId:this.identity.getAnonymousId(),userTraits:this.identity.getUserTraits()});this.flags=e,this.persistFlags(),this.config.featureFlags?.onFlagsUpdated?.(e),this.log("Flags refreshed:",Object.keys(e).length,"flags");}catch(e){this.log("Flag refresh error:",e);}}destroy(){this.flagRefreshTimer&&(clearInterval(this.flagRefreshTimer),this.flagRefreshTimer=null),this.queue.destroy(),this.log("Client destroyed");}trackInternal(e,t){let r=this.createEvent(e,t);this.queue.enqueue(r).catch(n=>{this.log("Internal track error:",n);});}getContext(){return {}}createEvent(e,t,r){let n=r?.timestamp?ta(r.timestamp):yi(),i=this.session.getSessionId();this.updateSessionEnrichment();let s={...this.getContext(),sessionNumber:this.sessionNumber,eventIndex:this.eventIndex};return {event_id:Xt(),timestamp:n,project_id:this.config.projectId,environment:this.config.environment,tenant_id:this.tenantId,event_name:e,anonymous_id:this.identity.getAnonymousId(),user_id:this.identity.getUserId(),session_id:i,platform:this.config.platform,app_version:this.config.appVersion??null,properties:t??{},user_traits:this.identity.getUserTraits(),context:s}}async ensureInitialized(){this.initialized||await this.initialize();}validateConfig(e){if(!e.apiKey)throw ye.invalidConfig("apiKey is required");if(!e.projectId)throw ye.invalidConfig("projectId is required");if(!e.environment)throw ye.invalidConfig("environment is required");if(!e.platform)throw ye.invalidConfig("platform is required")}async loadSessionEnrichment(){if(this.storage)try{let e=await this.storage.get(ge.SESSION_NUMBER),t=await this.storage.get(ge.EVENT_INDEX);e&&(this.sessionNumber=parseInt(e,10)||0),t&&(this.eventIndex=parseInt(t,10)||0);}catch(e){this.log("Error loading session enrichment:",e);}}updateSessionEnrichment(){let e=this.session.getCurrentSessionId();e&&e!==this.lastSessionId&&(this.sessionNumber++,this.eventIndex=0,this.lastSessionId=e,this.persistSessionEnrichment()),this.eventIndex++,this.persistEventIndex();}persistSessionEnrichment(){this.storage&&this.storage.set(ge.SESSION_NUMBER,String(this.sessionNumber)).catch(e=>{this.log("Error persisting session number:",e);});}persistEventIndex(){this.storage&&this.storage.set(ge.EVENT_INDEX,String(this.eventIndex)).catch(e=>{this.log("Error persisting event index:",e);});}async loadCachedFlags(){if(this.storage)try{let e=await this.storage.get(ge.FLAGS);e&&(this.flags=JSON.parse(e));}catch(e){this.log("Error loading cached flags:",e);}}persistFlags(){this.storage&&this.storage.set(ge.FLAGS,JSON.stringify(this.flags)).catch(e=>{this.log("Error persisting flags:",e);});}log(...e){this.config.debug&&[...e];}};var Si="pih_utm_params",la=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],ca="data-pih-",Rt=class{constructor(t,r={}){_(this,"client");_(this,"config");_(this,"attributePrefix");_(this,"cachedUtmParams",null);_(this,"originalPushState",null);_(this,"originalReplaceState",null);_(this,"boundHandleClick");_(this,"boundHandlePopState");_(this,"boundHandleSubmit");this.client=t,this.config={pageViews:r.pageViews!==false,clicks:r.clicks??false,clickSelector:r.clickSelector??"[data-track]",forms:r.forms??false},this.attributePrefix=r.attributePrefix??ca,this.boundHandleClick=this.handleClick.bind(this),this.boundHandlePopState=this.handlePopState.bind(this),this.boundHandleSubmit=this.handleSubmit.bind(this);}start(){typeof window>"u"||typeof document>"u"||(this.loadCachedUtmParams(),this.config.pageViews&&(this.setupPageViews(),this.trackPageView()),this.setupClickTracking(),this.config.forms&&this.setupFormTracking());}stop(){this.originalPushState&&(history.pushState=this.originalPushState,this.originalPushState=null),this.originalReplaceState&&(history.replaceState=this.originalReplaceState,this.originalReplaceState=null),typeof window<"u"&&window.removeEventListener("popstate",this.boundHandlePopState),typeof document<"u"&&(document.removeEventListener("click",this.boundHandleClick,true),document.removeEventListener("submit",this.boundHandleSubmit,true));}trackPageView(){let t=new URL(window.location.href),r=this.extractUtmParams(t);Object.keys(r).length>0&&!this.cachedUtmParams&&(this.cachedUtmParams=r,this.persistUtmParams(r)),this.client.track("page_viewed",{path:t.pathname,search:t.search,hash:t.hash,referrer:document.referrer||null,title:document.title,url:window.location.href,...this.getUtmParams(t)});}setupPageViews(){this.originalPushState=history.pushState,this.originalReplaceState=history.replaceState;let t=this.originalPushState,r=this.originalReplaceState,n=()=>this.trackPageView();history.pushState=function(...i){t.apply(history,i),setTimeout(n,0);},history.replaceState=function(...i){r.apply(history,i),setTimeout(n,0);},window.addEventListener("popstate",this.boundHandlePopState);}handlePopState(){this.trackPageView();}setupClickTracking(){document.addEventListener("click",this.boundHandleClick,true);}collectActionAttributes(t){let r={},n=t.attributes;for(let i=0;i<n.length;i++){let s=n[i];if(s.name.startsWith(this.attributePrefix)&&s.name!==`${this.attributePrefix}action`){let o=s.name.slice(this.attributePrefix.length).replace(/-/g,"_");r[o]=s.value;}}return r}findActionElement(t){let r=`${this.attributePrefix}action`,n=t;for(;n;){if(n.hasAttribute(r))return n;n=n.parentElement;}return null}handleClick(t){let r=t.target;if(!r)return;r.closest("[data-track]")&&console.warn("[PIH] data-track is deprecated. Use data-pih-action instead.");let i=this.findActionElement(r);if(i){let d=i.getAttribute(`${this.attributePrefix}action`),h=this.collectActionAttributes(i);this.client.track("$action",{action_name:d,...h,path:window.location.pathname});return}if(!this.config.clicks)return;let s=r.tagName.toLowerCase(),o=(r.textContent||"").trim().slice(0,100),a=r.id||null,l=r.className||null,c=r instanceof HTMLAnchorElement?r.href:null;this.client.track("$click",{element_tag:s,element_text:o,element_id:a,element_classes:l,href:c,path:window.location.pathname});}setupFormTracking(){document.addEventListener("submit",this.boundHandleSubmit,true);}handleSubmit(t){let r=t.target;!r||!(r instanceof HTMLFormElement)||this.client.track("form_submitted",{form_id:r.id||void 0,form_action:r.action||void 0,form_method:(r.method||"get").toUpperCase(),field_count:r.elements.length});}extractUtmParams(t){let r={};for(let n of la){let i=t.searchParams.get(n);i&&(r[n]=i);}return r}getUtmParams(t){let r=this.extractUtmParams(t);return Object.keys(r).length>0?r:this.cachedUtmParams??{}}loadCachedUtmParams(){try{let t=localStorage.getItem(Si);t&&(this.cachedUtmParams=JSON.parse(t));}catch{}}persistUtmParams(t){try{localStorage.setItem(Si,JSON.stringify(t));}catch{}}};var $t=class{constructor(t){_(this,"client");_(this,"boundHandleVisibilityChange");_(this,"boundHandleBeforeUnload");this.client=t,this.boundHandleVisibilityChange=this.handleVisibilityChange.bind(this),this.boundHandleBeforeUnload=this.handleBeforeUnload.bind(this);}start(){typeof document<"u"&&document.addEventListener("visibilitychange",this.boundHandleVisibilityChange),typeof window<"u"&&(window.addEventListener("beforeunload",this.boundHandleBeforeUnload),window.addEventListener("pagehide",this.boundHandleBeforeUnload));}stop(){typeof document<"u"&&document.removeEventListener("visibilitychange",this.boundHandleVisibilityChange),typeof window<"u"&&(window.removeEventListener("beforeunload",this.boundHandleBeforeUnload),window.removeEventListener("pagehide",this.boundHandleBeforeUnload));}handleVisibilityChange(){document.visibilityState==="hidden"&&this.flushWithBeacon();}handleBeforeUnload(){this.flushWithBeacon();}flushWithBeacon(){this.client.flush({useBeacon:true}).catch(()=>{});}};var Hr="pih_outbound",Jt=class{constructor(t,r={}){_(this,"client");_(this,"thresholdMs");_(this,"boundHandleClick");this.client=t,this.thresholdMs=(r.thresholdSeconds??30)*1e3,this.boundHandleClick=this.handleClick.bind(this);}start(){typeof window>"u"||typeof document>"u"||(this.checkBounceBack(),document.addEventListener("click",this.boundHandleClick,true));}stop(){typeof document<"u"&&document.removeEventListener("click",this.boundHandleClick,true);}handleClick(t){let r=t.target;if(!r)return;let n=r.closest("a");if(!(!n||!n.href))try{if(new URL(n.href).origin===window.location.origin)return;let s={};for(let a of Array.from(n.attributes))if(a.name.startsWith("data-pih-")){let l=a.name.slice(9).replace(/-/g,"_");s[l]=a.value;}let o={url:n.href,timestamp:Date.now(),pihAttributes:s};try{sessionStorage.setItem(Hr,JSON.stringify(o));}catch{}}catch{}}checkBounceBack(){try{let t=sessionStorage.getItem(Hr);if(!t)return;sessionStorage.removeItem(Hr);let r=JSON.parse(t),n=Date.now()-r.timestamp;n<=this.thresholdMs&&this.client.track("$bounce_back",{original_click_url:r.url,time_away_seconds:Math.round(n/1e3),page_returned_to:window.location.href,...r.pihAttributes});}catch{}}};function ua(){if(typeof navigator>"u"||typeof window>"u")return "unknown";let e=navigator.userAgent.toLowerCase();if(/ipad|tablet|playbook|silk/.test(e))return "tablet";if(/mobile|iphone|ipod|android.*mobile|windows phone|blackberry|opera mini|opera mobi/.test(e))return "mobile";let t=window.screen?.width??0;return t>0&&t<768?"mobile":t>=768&&t<1024?"tablet":"desktop"}function da(){return typeof navigator>"u"?void 0:navigator.connection?.effectiveType??void 0}function bi(){if(typeof window>"u"||typeof document>"u")return {};let e={screenWidth:window.screen?.width??void 0,screenHeight:window.screen?.height??void 0,viewportWidth:window.innerWidth??void 0,viewportHeight:window.innerHeight??void 0,locale:navigator?.language??void 0,timezone:ha(),deviceType:ua(),pageUrl:window.location.href,pagePath:window.location.pathname,pageTitle:document.title||void 0,referrer:document.referrer||void 0},t=da();return t&&(e.connectionType=t),Object.fromEntries(Object.entries(e).filter(([,r])=>r!==void 0))}function ha(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}var fa=[25,50,75,100],er=class{constructor(){_(this,"client",null);_(this,"started",false);_(this,"visibleStartTime",0);_(this,"totalVisibleTime",0);_(this,"reachedThresholds",new Set);_(this,"boundHandleVisibilityChange");_(this,"boundHandleScroll");this.boundHandleVisibilityChange=this.handleVisibilityChange.bind(this),this.boundHandleScroll=this.handleScroll.bind(this);}start(t){this.started||typeof window>"u"||typeof document>"u"||(this.client=t,this.started=true,this.visibleStartTime=Date.now(),this.totalVisibleTime=0,this.reachedThresholds.clear(),document.visibilityState==="visible"&&(this.visibleStartTime=Date.now()),document.addEventListener("visibilitychange",this.boundHandleVisibilityChange),window.addEventListener("scroll",this.boundHandleScroll,{passive:true}));}stop(){this.started&&(this.accumulateVisibleTime(),this.totalVisibleTime>0&&this.client&&this.client.track("page_engaged",{visible_duration_ms:this.totalVisibleTime,page_path:typeof window<"u"?window.location.pathname:void 0}),typeof document<"u"&&document.removeEventListener("visibilitychange",this.boundHandleVisibilityChange),typeof window<"u"&&window.removeEventListener("scroll",this.boundHandleScroll),this.started=false,this.client=null);}handleVisibilityChange(){!this.started||!this.client||(document.visibilityState==="hidden"?(this.accumulateVisibleTime(),this.totalVisibleTime>0&&(this.client.track("page_engaged",{visible_duration_ms:this.totalVisibleTime,page_path:window.location.pathname}),this.totalVisibleTime=0)):this.visibleStartTime=Date.now());}accumulateVisibleTime(){this.visibleStartTime>0&&(this.totalVisibleTime+=Date.now()-this.visibleStartTime,this.visibleStartTime=Date.now());}handleScroll(){if(!this.started||!this.client)return;let t=this.getScrollPercent();for(let r of fa)t>=r&&!this.reachedThresholds.has(r)&&(this.reachedThresholds.add(r),this.client.track("scroll_depth_reached",{depth_percent:r,page_path:window.location.pathname}));}getScrollPercent(){let t=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight),r=window.innerHeight,n=window.scrollY||document.documentElement.scrollTop,i=t-r;return i<=0?100:Math.min(100,Math.round(n/i*100))}};var tr=class{constructor(){_(this,"client",null);_(this,"started",false);_(this,"errorCount",0);_(this,"boundHandleError");_(this,"boundHandleRejection");this.boundHandleError=this.handleError.bind(this),this.boundHandleRejection=this.handleRejection.bind(this);}start(t){this.started||typeof window>"u"||(this.client=t,this.started=true,this.errorCount=0,window.addEventListener("error",this.boundHandleError),window.addEventListener("unhandledrejection",this.boundHandleRejection));}stop(){this.started&&(typeof window<"u"&&(window.removeEventListener("error",this.boundHandleError),window.removeEventListener("unhandledrejection",this.boundHandleRejection)),this.started=false,this.client=null);}handleError(t){!this.started||!this.client||this.canReport()&&(this.errorCount++,this.client.track("js_error",{message:t.message||"Unknown error",filename:t.filename||void 0,lineno:t.lineno||void 0,colno:t.colno||void 0,stack:t.error?.stack||void 0}));}handleRejection(t){if(!this.started||!this.client||!this.canReport())return;this.errorCount++;let r=t.reason,n=r instanceof Error?r.message:typeof r=="string"?r:"Unhandled promise rejection",i=r instanceof Error?r.stack:void 0;this.client.track("js_error",{message:n,filename:void 0,lineno:void 0,colno:void 0,stack:i});}canReport(){return this.errorCount<10}};var rr=class{constructor(){_(this,"client",null);_(this,"started",false);}start(t){this.started||(this.client=t,this.started=true,this.initWebVitals());}stop(){this.started=false,this.client=null;}async initWebVitals(){try{let r=await import('web-vitals'),n=i=>{!this.started||!this.client||this.client.track("web_vital",{name:i.name,value:i.value,rating:i.rating});};r.onLCP&&r.onLCP(n),r.onFID&&r.onFID(n),r.onCLS&&r.onCLS(n),r.onINP&&r.onINP(n),r.onTTFB&&r.onTTFB(n);}catch{}}};var Or=class{constructor(t,r,n,i=false){_(this,"client");_(this,"apiUrl");_(this,"apiKey");_(this,"config",null);_(this,"buffer",[]);_(this,"sequence",0);_(this,"flushTimer",null);_(this,"durationTimer",null);_(this,"rrwebStop",null);_(this,"sessionId",null);_(this,"recording",false);_(this,"rageClickState",{clicks:[]});_(this,"debug");_(this,"matchedRule",null);_(this,"boundHandleClick",null);this.client=t,this.apiUrl=r.replace(/\/$/,""),this.apiKey=n,this.debug=i;}async start(){try{if(await this.fetchConfig(),!this.config||!this.config.enabled){this.log("Recording not enabled");return}let t=this.evaluateRules(this.config.rules);if(!t){this.log("No recording rule matched");return}if(this.matchedRule=t.type,Math.random()>t.sampleRate){this.log("Sampled out by rule",t.type);return}await this.startRecording();}catch(t){this.log("Failed to start recording:",t);}}stop(){this.rrwebStop&&(this.rrwebStop(),this.rrwebStop=null),this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null),this.durationTimer&&(clearTimeout(this.durationTimer),this.durationTimer=null),this.buffer.length>0&&this.flush().catch(t=>this.log("Final flush error:",t)),this.recording=false,this.removeRageClickListener(),this.log("Recording stopped");}isRecording(){return this.recording}async fetchConfig(){let t=`${this.apiUrl}/v1/recording-config`,r=await fetch(t,{method:"GET",headers:{Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"}});if(!r.ok)throw new Error(`Failed to fetch recording config: ${r.status}`);let n=await r.json();this.config=n.config,this.log("Fetched recording config:",this.config);}evaluateRules(t){let r=window.location.href;for(let n of t)switch(n.type){case "all_sessions":return n;case "url_match":if(n.pattern)try{if(new RegExp(n.pattern).test(r))return n}catch{this.log("Invalid URL regex pattern:",n.pattern);}break;case "event_match":break;case "rage_click":return n}return null}async startRecording(){if(!this.recording){if(this.sessionId=this.client.getSessionId(),!this.sessionId){this.log("No session ID available, skipping recording");return}try{let t=await Promise.resolve().then(()=>(To(),Eo)),r=this.config?.maskingConfig??{maskAllInputs:!0,maskAllText:!1,maskSelectors:[],unmaskSelectors:[],blockSelectors:[]};this.rrwebStop=t.record({emit:i=>{this.onEvent(i);},maskAllInputs:r.maskAllInputs,maskTextSelector:r.maskAllText?"*":void 0,maskInputOptions:{password:!0,email:r.maskAllInputs},blockSelector:r.blockSelectors.length>0?r.blockSelectors.join(", "):void 0}),this.recording=!0,this.flushTimer=setInterval(()=>{this.buffer.length>0&&this.flush().catch(i=>this.log("Flush error:",i));},5e3);let n=(this.config?.maxDurationSeconds??600)*1e3;this.durationTimer=setTimeout(()=>{this.log("Duration cap reached, stopping recording"),this.stop();},n),this.setupRageClickDetection(),this.log("Recording started for session:",this.sessionId);}catch(t){this.log("Failed to import rrweb or start recording:",t);}}}onEvent(t){this.buffer.push(t),this.buffer.length>=50&&this.flush().catch(r=>this.log("Buffer flush error:",r));}async flush(){if(this.buffer.length===0||!this.sessionId)return;let t=[...this.buffer];this.buffer=[];let r=this.sequence++;try{let n=`${this.apiUrl}/v1/recordings`,i=await fetch(n,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify({sessionId:this.sessionId,sequence:r,events:t,pageUrl:window.location.href,triggerRule:this.matchedRule??void 0})});i.ok?this.log("Uploaded chunk",r,"with",t.length,"events"):(this.log("Failed to upload recording chunk:",i.status),this.buffer.unshift(...t));}catch(n){this.log("Failed to upload recording chunk:",n),this.buffer.unshift(...t);}}setupRageClickDetection(){this.boundHandleClick=this.handleClickForRageDetection.bind(this),document.addEventListener("click",this.boundHandleClick,true);}removeRageClickListener(){this.boundHandleClick&&(document.removeEventListener("click",this.boundHandleClick,true),this.boundHandleClick=null);}handleClickForRageDetection(t){let r=Date.now(),{clientX:n,clientY:i}=t;if(this.rageClickState.clicks=this.rageClickState.clicks.filter(s=>r-s.timestamp<500),this.rageClickState.clicks.push({x:n,y:i,timestamp:r}),this.rageClickState.clicks.length>=3){let s=this.rageClickState.clicks,o=s[0];s.every(l=>Math.abs(l.x-o.x)<=30&&Math.abs(l.y-o.y)<=30)&&(this.client.track("rage_click",{x:o.x,y:o.y,click_count:s.length,page_url:window.location.href}),this.rageClickState.clicks=[]);}}log(...t){this.debug&&[...t];}};var zt=class{constructor(){_(this,"data",new Map);}async get(t){return this.data.get(t)??null}async set(t,r){this.data.set(t,r);}async remove(t){this.data.delete(t);}};function ql(){try{let e="__pih_test__";return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch{return false}}var Xn=class{constructor(){_(this,"fallback",null);_(this,"useLocalStorage");this.useLocalStorage=ql(),this.useLocalStorage||(this.fallback=new zt,console.warn("[PIH] localStorage unavailable, using in-memory storage. Data will not persist across page loads."));}async get(t){if(this.fallback)return this.fallback.get(t);try{return localStorage.getItem(t)}catch{return this.fallback||(this.fallback=new zt),this.fallback.get(t)}}async set(t,r){if(this.fallback)return this.fallback.set(t,r);try{localStorage.setItem(t,r);}catch(n){return this.fallback||(this.fallback=new zt,console.warn("[PIH] localStorage write failed, falling back to in-memory storage:",n)),this.fallback.set(t,r)}}async remove(t){if(this.fallback)return this.fallback.remove(t);try{localStorage.removeItem(t);}catch{}}};function $n(){return new Xn}$n();var Tt=$o(Uo());var ai=new Set;function Bo(e){return ai.add(e),()=>ai.delete(e)}function hc(){for(let e of ai)e();}function fc(e,t=false){let r=(0, Tt.useCallback)(()=>Lr()?.isFeatureEnabled(e,t)??t,[e,t]);return (0, Tt.useSyncExternalStore)(Bo,r,()=>t)}function pc(){let e=(0, Tt.useCallback)(()=>Lr()?.getFeatureFlags()??{},[]);return (0, Tt.useSyncExternalStore)(Bo,e,()=>({}))}var Fr=class extends Ii{constructor(r,n){let i={...r,platform:"web"};super(i,n??$n());_(this,"autocapture",null);_(this,"beacon");_(this,"performanceTracker",null);_(this,"engagementTracker",null);_(this,"errorTracker",null);_(this,"bounceBackDetector",null);_(this,"recordingManager",null);this.transport.setSDKMeta({name:"pih-sdk-web",version:"0.4.0"}),this.beacon=new $t(this);}getContext(){return bi()}async initialize(){await super.initialize(),this.beacon.start(),this.config.autocapture&&(this.autocapture=new Rt(this,this.config.autocapture),this.autocapture.start(),this.config.autocapture.performance&&(this.performanceTracker=new rr,this.performanceTracker.start(this)),this.config.autocapture.engagement&&(this.engagementTracker=new er,this.engagementTracker.start(this)),this.config.autocapture.errorTracking&&(this.errorTracker=new tr,this.errorTracker.start(this))),this.config.bounceBack?.enabled&&(this.bounceBackDetector=new Jt(this,this.config.bounceBack),this.bounceBackDetector.start()),this.config.recording?.enabled&&(this.recordingManager=new Or(this,this.config.apiUrl??"https://repoingest-production.up.railway.app",this.config.apiKey,this.config.debug),this.recordingManager.start().catch(r=>{this.log("Failed to start recording:",r);})),this.log("Web client initialized");}enableAutocapture(r){this.autocapture&&this.autocapture.stop(),this.autocapture=new Rt(this,r),this.autocapture.start();}disableAutocapture(){this.autocapture&&(this.autocapture.stop(),this.autocapture=null);}trackPageView(){if(this.autocapture)this.autocapture.trackPageView();else {let r=new URL(window.location.href);this.track("page_viewed",{path:r.pathname,search:r.search,hash:r.hash,referrer:document.referrer||null,title:document.title,url:window.location.href});}}destroy(){this.beacon.stop(),this.autocapture&&this.autocapture.stop(),this.performanceTracker&&(this.performanceTracker.stop(),this.performanceTracker=null),this.engagementTracker&&(this.engagementTracker.stop(),this.engagementTracker=null),this.errorTracker&&(this.errorTracker.stop(),this.errorTracker=null),this.bounceBackDetector&&(this.bounceBackDetector.stop(),this.bounceBackDetector=null),this.recordingManager&&(this.recordingManager.stop(),this.recordingManager=null),super.destroy();}log(...r){this.config.debug&&[...r];}},Xe=null;function mc(e){return Xe?(console.warn("[PIH] SDK already initialized. Returning existing instance."),Xe):(Xe=new Fr(e),Xe.initialize().catch(t=>{console.error("[PIH] Failed to initialize:",t);}),Xe)}function Lr(){return Xe}function gc(){Xe&&(Xe.destroy(),Xe=null);}var vc={init:mc,getInstance:Lr,resetInstance:gc,WebPIHClient:Fr},_h=vc;/*! Bundled license information:
|
|
29
|
+
|
|
30
|
+
rrweb/es/rrweb/ext/tslib/tslib.es6.js:
|
|
31
|
+
rrweb/es/rrweb/ext/@xstate/fsm/es/index.js:
|
|
32
|
+
(*! *****************************************************************************
|
|
33
|
+
Copyright (c) Microsoft Corporation.
|
|
34
|
+
|
|
35
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
36
|
+
purpose with or without fee is hereby granted.
|
|
37
|
+
|
|
38
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
39
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
40
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
41
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
42
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
43
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
44
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
45
|
+
***************************************************************************** *)
|
|
14
46
|
|
|
15
47
|
react/cjs/react.production.js:
|
|
16
48
|
(**
|
|
@@ -33,5 +65,5 @@ react/cjs/react.development.js:
|
|
|
33
65
|
* This source code is licensed under the MIT license found in the
|
|
34
66
|
* LICENSE file in the root directory of this source tree.
|
|
35
67
|
*)
|
|
36
|
-
*/exports.WebPIHClient=
|
|
68
|
+
*/exports.WebPIHClient=Fr;exports.default=_h;exports.getInstance=Lr;exports.init=mc;exports.notifyFlagListeners=hc;exports.resetInstance=gc;exports.useFeatureFlag=fc;exports.useFeatureFlags=pc;Object.defineProperty(exports,'__esModule',{value:true});return exports;})({});//# sourceMappingURL=index.global.js.map
|
|
37
69
|
//# sourceMappingURL=index.global.js.map
|