@betterbugs/web-sdk 0.0.9 → 0.0.10

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/logsCapturer.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see logsCapturer.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Betterbugs=t():e.Betterbugs=t()}(this,(function(){return function(){var e={7753:function(e,t,n){e.exports=function(){"use strict";var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)},t=function(){return(t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function r(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||((r=r||Array.prototype.slice.call(t,0,i))[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,o=Object.keys,a=Array.isArray;function s(e,t){return"object"!=typeof t||o(t).forEach((function(n){e[n]=t[n]})),e}"undefined"==typeof Promise||i.Promise||(i.Promise=Promise);var u=Object.getPrototypeOf,c={}.hasOwnProperty;function l(e,t){return c.call(e,t)}function d(e,t){"function"==typeof t&&(t=t(u(e))),("undefined"==typeof Reflect?o:Reflect.ownKeys)(t).forEach((function(n){f(e,n,t[n])}))}var h=Object.defineProperty;function f(e,t,n,r){h(e,t,s(n&&l(n,"get")&&"function"==typeof n.get?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function p(e){return{from:function(t){return e.prototype=Object.create(t.prototype),f(e.prototype,"constructor",e),{extend:d.bind(null,e.prototype)}}}}var m=Object.getOwnPropertyDescriptor,y=[].slice;function v(e,t,n){return y.call(e,t,n)}function g(e,t){return t(e)}function b(e){if(!e)throw new Error("Assertion Failed")}function w(e){i.setImmediate?setImmediate(e):setTimeout(e,0)}function S(e,t){if("string"==typeof t&&l(e,t))return e[t];if(!t)return e;if("string"!=typeof t){for(var n=[],r=0,i=t.length;r<i;++r){var o=S(e,t[r]);n.push(o)}return n}var a=t.indexOf(".");if(-1!==a){var s=e[t.substr(0,a)];return null==s?void 0:S(s,t.substr(a+1))}}function k(e,t,n){if(e&&void 0!==t&&(!("isFrozen"in Object)||!Object.isFrozen(e)))if("string"!=typeof t&&"length"in t){b("string"!=typeof n&&"length"in n);for(var r=0,i=t.length;r<i;++r)k(e,t[r],n[r])}else{var o,s,u=t.indexOf(".");-1!==u?(o=t.substr(0,u),""===(s=t.substr(u+1))?void 0===n?a(e)&&!isNaN(parseInt(o))?e.splice(o,1):delete e[o]:e[o]=n:k(u=(u=e[o])&&l(e,o)?u:e[o]={},s,n)):void 0===n?a(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=n}}function I(e){var t,n={};for(t in e)l(e,t)&&(n[t]=e[t]);return n}var x=[].concat;function _(e){return x.apply([],e)}var C="BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(_([8,16,32,64].map((function(e){return["Int","Uint","Float"].map((function(t){return t+e+"Array"}))})))).filter((function(e){return i[e]})),E=new Set(C.map((function(e){return i[e]}))),O=null;function M(e){return O=new WeakMap,e=function e(t){if(!t||"object"!=typeof t)return t;var n=O.get(t);if(n)return n;if(a(t)){n=[],O.set(t,n);for(var r=0,i=t.length;r<i;++r)n.push(e(t[r]))}else if(E.has(t.constructor))n=t;else{var o,s=u(t);for(o in n=s===Object.prototype?{}:Object.create(s),O.set(t,n),t)l(t,o)&&(n[o]=e(t[o]))}return n}(e),O=null,e}var T={}.toString;function R(e){return T.call(e).slice(8,-1)}var D="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator",N="symbol"==typeof D?function(e){var t;return null!=e&&(t=e[D])&&t.apply(e)}:function(){return null};function A(e,t){return 0<=(t=e.indexOf(t))&&e.splice(t,1),0<=t}var L={};function P(e){var t,n,r,i;if(1===arguments.length){if(a(e))return e.slice();if(this===L&&"string"==typeof e)return[e];if(i=N(e)){for(n=[];!(r=i.next()).done;)n.push(r.value);return n}if(null==e)return[e];if("number"!=typeof(t=e.length))return[e];for(n=new Array(t);t--;)n[t]=e[t];return n}for(t=arguments.length,n=new Array(t);t--;)n[t]=arguments[t];return n}var F="undefined"!=typeof Symbol?function(e){return"AsyncFunction"===e[Symbol.toStringTag]}:function(){return!1},j=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(ue=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"]),B={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};function q(e,t){this.name=e,this.message=t}function K(e,t){return e+". Errors: "+Object.keys(t).map((function(e){return t[e].toString()})).filter((function(e,t,n){return n.indexOf(e)===t})).join("\n")}function z(e,t,n,r){this.failures=t,this.failedKeys=r,this.successCount=n,this.message=K(e,t)}function U(e,t){this.name="BulkError",this.failures=Object.keys(t).map((function(e){return t[e]})),this.failuresByPos=t,this.message=K(e,this.failures)}p(q).from(Error).extend({toString:function(){return this.name+": "+this.message}}),p(z).from(q),p(U).from(q);var W=j.reduce((function(e,t){return e[t]=t+"Error",e}),{}),H=q,V=j.reduce((function(e,t){var n=t+"Error";function r(e,r){this.name=n,e?"string"==typeof e?(this.message="".concat(e).concat(r?"\n "+r:""),this.inner=r||null):"object"==typeof e&&(this.message="".concat(e.name," ").concat(e.message),this.inner=e):(this.message=B[t]||n,this.inner=null)}return p(r).from(H),e[t]=r,e}),{});V.Syntax=SyntaxError,V.Type=TypeError,V.Range=RangeError;var $=ue.reduce((function(e,t){return e[t+"Error"]=V[t],e}),{}),G=j.reduce((function(e,t){return-1===["Syntax","Type","Range"].indexOf(t)&&(e[t+"Error"]=V[t]),e}),{});function X(){}function Y(e){return e}function Q(e,t){return null==e||e===Y?t:function(n){return t(e(n))}}function J(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function Z(e,t){return e===X?t:function(){var n=e.apply(this,arguments);void 0!==n&&(arguments[0]=n);var r=this.onsuccess,i=this.onerror;this.onsuccess=null,this.onerror=null;var o=t.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?J(r,this.onsuccess):r),i&&(this.onerror=this.onerror?J(i,this.onerror):i),void 0!==o?o:n}}function ee(e,t){return e===X?t:function(){e.apply(this,arguments);var n=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,t.apply(this,arguments),n&&(this.onsuccess=this.onsuccess?J(n,this.onsuccess):n),r&&(this.onerror=this.onerror?J(r,this.onerror):r)}}function te(e,t){return e===X?t:function(n){var r=e.apply(this,arguments);s(n,r);var i=this.onsuccess,o=this.onerror;return this.onsuccess=null,this.onerror=null,n=t.apply(this,arguments),i&&(this.onsuccess=this.onsuccess?J(i,this.onsuccess):i),o&&(this.onerror=this.onerror?J(o,this.onerror):o),void 0===r?void 0===n?void 0:n:s(r,n)}}function ne(e,t){return e===X?t:function(){return!1!==t.apply(this,arguments)&&e.apply(this,arguments)}}function re(e,t){return e===X?t:function(){var n=e.apply(this,arguments);if(n&&"function"==typeof n.then){for(var r=this,i=arguments.length,o=new Array(i);i--;)o[i]=arguments[i];return n.then((function(){return t.apply(r,o)}))}return t.apply(this,arguments)}}G.ModifyError=z,G.DexieError=q,G.BulkError=U;var ie="undefined"!=typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function oe(e){ie=e}var ae={},se=100,ue=(C="undefined"==typeof Promise?[]:function(){var e=Promise.resolve();if("undefined"==typeof crypto||!crypto.subtle)return[e,u(e),e];var t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,u(t),e]}(),C[0]),ce=(j=C[1],C=C[2],j=j&&j.then,ue&&ue.constructor),le=!!C,de=function(e,t){be.push([e,t]),fe&&(queueMicrotask(Me),fe=!1)},he=!0,fe=!0,pe=[],me=[],ye=Y,ve={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:X,pgp:!1,env:{},finalize:X},ge=ve,be=[],we=0,Se=[];function ke(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");this._listeners=[],this._lib=!1;var t=this._PSD=ge;if("function"!=typeof e){if(e!==ae)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&_e(this,this._value))}this._state=null,this._value=null,++t.ref,function e(t,n){try{n((function(n){if(null===t._state){if(n===t)throw new TypeError("A promise cannot be resolved with itself.");var r=t._lib&&Te();n&&"function"==typeof n.then?e(t,(function(e,t){n instanceof ke?n._then(e,t):n.then(e,t)})):(t._state=!0,t._value=n,Ce(t)),r&&Re()}}),_e.bind(null,t))}catch(n){_e(t,n)}}(this,e)}var Ie={get:function(){var e=ge,t=Be;function n(n,r){var i=this,o=!e.global&&(e!==ge||t!==Be),a=o&&!Ue(),s=new ke((function(t,s){Ee(i,new xe(Xe(n,e,o,a),Xe(r,e,o,a),t,s,e))}));return this._consoleTask&&(s._consoleTask=this._consoleTask),s}return n.prototype=ae,n},set:function(e){f(this,"then",e&&e.prototype===ae?Ie:{get:function(){return e},set:Ie.set})}};function xe(e,t,n,r,i){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.resolve=n,this.reject=r,this.psd=i}function _e(e,t){var n,r;me.push(t),null===e._state&&(n=e._lib&&Te(),t=ye(t),e._state=!1,e._value=t,r=e,pe.some((function(e){return e._value===r._value}))||pe.push(r),Ce(e),n&&Re())}function Ce(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)Ee(e,t[n]);var i=e._PSD;--i.ref||i.finalize(),0===we&&(++we,de((function(){0==--we&&De()}),[]))}function Ee(e,t){if(null!==e._state){var n=e._state?t.onFulfilled:t.onRejected;if(null===n)return(e._state?t.resolve:t.reject)(e._value);++t.psd.ref,++we,de(Oe,[n,e,t])}else e._listeners.push(t)}function Oe(e,t,n){try{var r,i=t._value;!t._state&&me.length&&(me=[]),r=ie&&t._consoleTask?t._consoleTask.run((function(){return e(i)})):e(i),t._state||-1!==me.indexOf(i)||function(e){for(var t=pe.length;t;)if(pe[--t]._value===e._value)return pe.splice(t,1)}(t),n.resolve(r)}catch(e){n.reject(e)}finally{0==--we&&De(),--n.psd.ref||n.psd.finalize()}}function Me(){Ge(ve,(function(){Te()&&Re()}))}function Te(){var e=he;return fe=he=!1,e}function Re(){var e,t,n;do{for(;0<be.length;)for(e=be,be=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}}while(0<be.length);fe=he=!0}function De(){var e=pe;pe=[],e.forEach((function(e){e._PSD.onunhandled.call(null,e._value,e)}));for(var t=Se.slice(0),n=t.length;n;)t[--n]()}function Ne(e){return new ke(ae,!1,e)}function Ae(e,t){var n=ge;return function(){var r=Te(),i=ge;try{return Ve(n,!0),e.apply(this,arguments)}catch(r){t&&t(r)}finally{Ve(i,!1),r&&Re()}}}d(ke.prototype,{then:Ie,_then:function(e,t){Ee(this,new xe(null,null,e,t,ge))},catch:function(e){if(1===arguments.length)return this.then(null,e);var t=e,n=arguments[1];return"function"==typeof t?this.then(null,(function(e){return(e instanceof t?n:Ne)(e)})):this.then(null,(function(e){return(e&&e.name===t?n:Ne)(e)}))},finally:function(e){return this.then((function(t){return ke.resolve(e()).then((function(){return t}))}),(function(t){return ke.resolve(e()).then((function(){return Ne(t)}))}))},timeout:function(e,t){var n=this;return e<1/0?new ke((function(r,i){var o=setTimeout((function(){return i(new V.Timeout(t))}),e);n.then(r,i).finally(clearTimeout.bind(null,o))})):this}}),"undefined"!=typeof Symbol&&Symbol.toStringTag&&f(ke.prototype,Symbol.toStringTag,"Dexie.Promise"),ve.env=$e(),d(ke,{all:function(){var e=P.apply(null,arguments).map(We);return new ke((function(t,n){0===e.length&&t([]);var r=e.length;e.forEach((function(i,o){return ke.resolve(i).then((function(n){e[o]=n,--r||t(e)}),n)}))}))},resolve:function(e){return e instanceof ke?e:e&&"function"==typeof e.then?new ke((function(t,n){e.then(t,n)})):new ke(ae,!0,e)},reject:Ne,race:function(){var e=P.apply(null,arguments).map(We);return new ke((function(t,n){e.map((function(e){return ke.resolve(e).then(t,n)}))}))},PSD:{get:function(){return ge},set:function(e){return ge=e}},totalEchoes:{get:function(){return Be}},newPSD:Ke,usePSD:Ge,scheduler:{get:function(){return de},set:function(e){de=e}},rejectionMapper:{get:function(){return ye},set:function(e){ye=e}},follow:function(e,t){return new ke((function(n,r){return Ke((function(t,n){var r=ge;r.unhandleds=[],r.onunhandled=n,r.finalize=J((function(){var e,r=this;e=function(){0===r.unhandleds.length?t():n(r.unhandleds[0])},Se.push((function t(){e(),Se.splice(Se.indexOf(t),1)})),++we,de((function(){0==--we&&De()}),[])}),r.finalize),e()}),t,n,r)}))}}),ce&&(ce.allSettled&&f(ke,"allSettled",(function(){var e=P.apply(null,arguments).map(We);return new ke((function(t){0===e.length&&t([]);var n=e.length,r=new Array(n);e.forEach((function(e,i){return ke.resolve(e).then((function(e){return r[i]={status:"fulfilled",value:e}}),(function(e){return r[i]={status:"rejected",reason:e}})).then((function(){return--n||t(r)}))}))}))})),ce.any&&"undefined"!=typeof AggregateError&&f(ke,"any",(function(){var e=P.apply(null,arguments).map(We);return new ke((function(t,n){0===e.length&&n(new AggregateError([]));var r=e.length,i=new Array(r);e.forEach((function(e,o){return ke.resolve(e).then((function(e){return t(e)}),(function(e){i[o]=e,--r||n(new AggregateError(i))}))}))}))})),ce.withResolvers&&(ke.withResolvers=ce.withResolvers));var Le={awaits:0,echoes:0,id:0},Pe=0,Fe=[],je=0,Be=0,qe=0;function Ke(e,t,n,r){var i=ge,o=Object.create(i);return o.parent=i,o.ref=0,o.global=!1,o.id=++qe,ve.env,o.env=le?{Promise:ke,PromiseProp:{value:ke,configurable:!0,writable:!0},all:ke.all,race:ke.race,allSettled:ke.allSettled,any:ke.any,resolve:ke.resolve,reject:ke.reject}:{},t&&s(o,t),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()},r=Ge(o,e,n,r),0===o.ref&&o.finalize(),r}function ze(){return Le.id||(Le.id=++Pe),++Le.awaits,Le.echoes+=se,Le.id}function Ue(){return!!Le.awaits&&(0==--Le.awaits&&(Le.id=0),Le.echoes=Le.awaits*se,!0)}function We(e){return Le.echoes&&e&&e.constructor===ce?(ze(),e.then((function(e){return Ue(),e}),(function(e){return Ue(),Qe(e)}))):e}function He(){var e=Fe[Fe.length-1];Fe.pop(),Ve(e,!1)}function Ve(e,t){var n,r=ge;(t?!Le.echoes||je++&&e===ge:!je||--je&&e===ge)||queueMicrotask(t?function(e){++Be,Le.echoes&&0!=--Le.echoes||(Le.echoes=Le.awaits=Le.id=0),Fe.push(ge),Ve(e,!0)}.bind(null,e):He),e!==ge&&(ge=e,r===ve&&(ve.env=$e()),le&&(n=ve.env.Promise,t=e.env,(r.global||e.global)&&(Object.defineProperty(i,"Promise",t.PromiseProp),n.all=t.all,n.race=t.race,n.resolve=t.resolve,n.reject=t.reject,t.allSettled&&(n.allSettled=t.allSettled),t.any&&(n.any=t.any))))}function $e(){var e=i.Promise;return le?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(i,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject}:{}}function Ge(e,t,n,r,i){var o=ge;try{return Ve(e,!0),t(n,r,i)}finally{Ve(o,!1)}}function Xe(e,t,n,r){return"function"!=typeof e?e:function(){var i=ge;n&&ze(),Ve(t,!0);try{return e.apply(this,arguments)}finally{Ve(i,!1),r&&queueMicrotask(Ue)}}}function Ye(e){Promise===ce&&0===Le.echoes?0===je?e():enqueueNativeMicroTask(e):setTimeout(e,0)}-1===(""+j).indexOf("[native code]")&&(ze=Ue=X);var Qe=ke.reject,Je=String.fromCharCode(65535),Ze="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",et="String expected.",tt=[],nt="__dbnames",rt="readonly",it="readwrite";function ot(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}var at={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function st(e){return"string"!=typeof e||/\./.test(e)?function(e){return e}:function(t){return void 0===t[e]&&e in t&&delete(t=M(t))[e],t}}function ut(){throw V.Type()}function ct(e,t){try{var n=lt(e),r=lt(t);if(n!==r)return"Array"===n?1:"Array"===r?-1:"binary"===n?1:"binary"===r?-1:"string"===n?1:"string"===r?-1:"Date"===n?1:"Date"!==r?NaN:-1;switch(n){case"number":case"Date":case"string":return t<e?1:e<t?-1:0;case"binary":return function(e,t){for(var n=e.length,r=t.length,i=n<r?n:r,o=0;o<i;++o)if(e[o]!==t[o])return e[o]<t[o]?-1:1;return n===r?0:n<r?-1:1}(dt(e),dt(t));case"Array":return function(e,t){for(var n=e.length,r=t.length,i=n<r?n:r,o=0;o<i;++o){var a=ct(e[o],t[o]);if(0!==a)return a}return n===r?0:n<r?-1:1}(e,t)}}catch(e){}return NaN}function lt(e){var t=typeof e;return"object"!=t?t:ArrayBuffer.isView(e)||"ArrayBuffer"===(e=R(e))?"binary":e}function dt(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}var ht=(ft.prototype._trans=function(e,t,n){var r=this._tx||ge.trans,i=this.name,o=ie&&"undefined"!=typeof console&&console.createTask&&void 0;function a(e,n,r){if(!r.schema[i])throw new V.NotFound("Table "+i+" not part of transaction");return t(r.idbtrans,r)}var s=Te();try{var u=r&&r.db._novip===this.db._novip?r===ge.trans?r._promise(e,a,n):Ke((function(){return r._promise(e,a,n)}),{trans:r,transless:ge.transless||ge}):function e(t,n,r,i){if(t.idbdb&&(t._state.openComplete||ge.letThrough||t._vip)){var o=t._createTransaction(n,r,t._dbSchema);try{o.create(),t._state.PR1398_maxLoop=3}catch(o){return o.name===W.InvalidState&&t.isOpen()&&0<--t._state.PR1398_maxLoop?(t.close({disableAutoOpen:!1}),t.open().then((function(){return e(t,n,r,i)}))):Qe(o)}return o._promise(n,(function(e,t){return Ke((function(){return ge.trans=o,i(e,t,o)}))})).then((function(e){if("readwrite"===n)try{o.idbtrans.commit()}catch(e){}return"readonly"===n?e:o._completion.then((function(){return e}))}))}if(t._state.openComplete)return Qe(new V.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._state.autoOpen)return Qe(new V.DatabaseClosed);t.open().catch(X)}return t._state.dbReadyPromise.then((function(){return e(t,n,r,i)}))}(this.db,e,[this.name],a);return o&&(u._consoleTask=o,u=u.catch((function(e){return Qe(e)}))),u}finally{s&&Re()}},ft.prototype.get=function(e,t){var n=this;return e&&e.constructor===Object?this.where(e).first(t):null==e?Qe(new V.Type("Invalid argument to Table.get()")):this._trans("readonly",(function(t){return n.core.get({trans:t,key:e}).then((function(e){return n.hook.reading.fire(e)}))})).then(t)},ft.prototype.where=function(e){if("string"==typeof e)return new this.db.WhereClause(this,e);if(a(e))return new this.db.WhereClause(this,"[".concat(e.join("+"),"]"));var t=o(e);if(1===t.length)return this.where(t[0]).equals(e[t[0]]);var n=this.schema.indexes.concat(this.schema.primKey).filter((function(e){if(e.compound&&t.every((function(t){return 0<=e.keyPath.indexOf(t)}))){for(var n=0;n<t.length;++n)if(-1===t.indexOf(e.keyPath[n]))return!1;return!0}return!1})).sort((function(e,t){return e.keyPath.length-t.keyPath.length}))[0];if(n&&this.db._maxKey!==Je){var r=n.keyPath.slice(0,t.length);return this.where(r).equals(r.map((function(t){return e[t]})))}var i=this.schema.idxByName;function s(e,t){return 0===ct(e,t)}var u=t.reduce((function(t,n){var r=t[0],o=t[1],u=(t=i[n],e[n]);return[r||t,r||!t?ot(o,t&&t.multi?function(e){return e=S(e,n),a(e)&&e.some((function(e){return s(u,e)}))}:function(e){return s(u,S(e,n))}):o]}),[null,null]);return r=u[0],u=u[1],r?this.where(r.name).equals(e[r.keyPath]).filter(u):n?this.filter(u):this.where(t).equals("")},ft.prototype.filter=function(e){return this.toCollection().and(e)},ft.prototype.count=function(e){return this.toCollection().count(e)},ft.prototype.offset=function(e){return this.toCollection().offset(e)},ft.prototype.limit=function(e){return this.toCollection().limit(e)},ft.prototype.each=function(e){return this.toCollection().each(e)},ft.prototype.toArray=function(e){return this.toCollection().toArray(e)},ft.prototype.toCollection=function(){return new this.db.Collection(new this.db.WhereClause(this))},ft.prototype.orderBy=function(e){return new this.db.Collection(new this.db.WhereClause(this,a(e)?"[".concat(e.join("+"),"]"):e))},ft.prototype.reverse=function(){return this.toCollection().reverse()},ft.prototype.mapToClass=function(t){var n,r=this.db,i=this.name;function o(){return null!==n&&n.apply(this,arguments)||this}(this.schema.mappedClass=t).prototype instanceof ut&&(function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}(o,n=t),Object.defineProperty(o.prototype,"db",{get:function(){return r},enumerable:!1,configurable:!0}),o.prototype.table=function(){return i},t=o);for(var a=new Set,s=t.prototype;s;s=u(s))Object.getOwnPropertyNames(s).forEach((function(e){return a.add(e)}));function c(e){if(!e)return e;var n,r=Object.create(t.prototype);for(n in e)if(!a.has(n))try{r[n]=e[n]}catch(e){}return r}return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=c,this.hook("reading",c),t},ft.prototype.defineClass=function(){return this.mapToClass((function(e){s(this,e)}))},ft.prototype.add=function(e,t){var n=this,r=this.schema.primKey,i=r.auto,o=r.keyPath,a=e;return o&&i&&(a=st(o)(e)),this._trans("readwrite",(function(e){return n.core.mutate({trans:e,type:"add",keys:null!=t?[t]:null,values:[a]})})).then((function(e){return e.numFailures?ke.reject(e.failures[0]):e.lastResult})).then((function(t){if(o)try{k(e,o,t)}catch(t){}return t}))},ft.prototype.update=function(e,t){return"object"!=typeof e||a(e)?this.where(":id").equals(e).modify(t):void 0===(e=S(e,this.schema.primKey.keyPath))?Qe(new V.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(e).modify(t)},ft.prototype.put=function(e,t){var n=this,r=this.schema.primKey,i=r.auto,o=r.keyPath,a=e;return o&&i&&(a=st(o)(e)),this._trans("readwrite",(function(e){return n.core.mutate({trans:e,type:"put",values:[a],keys:null!=t?[t]:null})})).then((function(e){return e.numFailures?ke.reject(e.failures[0]):e.lastResult})).then((function(t){if(o)try{k(e,o,t)}catch(t){}return t}))},ft.prototype.delete=function(e){var t=this;return this._trans("readwrite",(function(n){return t.core.mutate({trans:n,type:"delete",keys:[e]})})).then((function(e){return e.numFailures?ke.reject(e.failures[0]):void 0}))},ft.prototype.clear=function(){var e=this;return this._trans("readwrite",(function(t){return e.core.mutate({trans:t,type:"deleteRange",range:at})})).then((function(e){return e.numFailures?ke.reject(e.failures[0]):void 0}))},ft.prototype.bulkGet=function(e){var t=this;return this._trans("readonly",(function(n){return t.core.getMany({keys:e,trans:n}).then((function(e){return e.map((function(e){return t.hook.reading.fire(e)}))}))}))},ft.prototype.bulkAdd=function(e,t,n){var r=this,i=Array.isArray(t)?t:void 0,o=(n=n||(i?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",(function(t){var n=(s=r.schema.primKey).auto;if((s=s.keyPath)&&i)throw new V.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(i&&i.length!==e.length)throw new V.InvalidArgument("Arguments objects and keys must have the same length");var a=e.length,s=s&&n?e.map(st(s)):e;return r.core.mutate({trans:t,type:"add",keys:i,values:s,wantResults:o}).then((function(e){var t=e.numFailures,n=e.results,i=e.lastResult;if(e=e.failures,0===t)return o?n:i;throw new U("".concat(r.name,".bulkAdd(): ").concat(t," of ").concat(a," operations failed"),e)}))}))},ft.prototype.bulkPut=function(e,t,n){var r=this,i=Array.isArray(t)?t:void 0,o=(n=n||(i?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",(function(t){var n=(s=r.schema.primKey).auto;if((s=s.keyPath)&&i)throw new V.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(i&&i.length!==e.length)throw new V.InvalidArgument("Arguments objects and keys must have the same length");var a=e.length,s=s&&n?e.map(st(s)):e;return r.core.mutate({trans:t,type:"put",keys:i,values:s,wantResults:o}).then((function(e){var t=e.numFailures,n=e.results,i=e.lastResult;if(e=e.failures,0===t)return o?n:i;throw new U("".concat(r.name,".bulkPut(): ").concat(t," of ").concat(a," operations failed"),e)}))}))},ft.prototype.bulkUpdate=function(e){var t=this,n=this.core,r=e.map((function(e){return e.key})),i=e.map((function(e){return e.changes})),o=[];return this._trans("readwrite",(function(a){return n.getMany({trans:a,keys:r,cache:"clone"}).then((function(s){var u=[],c=[];e.forEach((function(e,n){var r=e.key,i=e.changes,a=s[n];if(a){for(var l=0,d=Object.keys(i);l<d.length;l++){var h=d[l],f=i[h];if(h===t.schema.primKey.keyPath){if(0!==ct(f,r))throw new V.Constraint("Cannot update primary key in bulkUpdate()")}else k(a,h,f)}o.push(n),u.push(r),c.push(a)}}));var l=u.length;return n.mutate({trans:a,type:"put",keys:u,values:c,updates:{keys:r,changeSpecs:i}}).then((function(e){var n=e.numFailures,r=e.failures;if(0===n)return l;for(var i=0,a=Object.keys(r);i<a.length;i++){var s,u=a[i],c=o[Number(u)];null!=c&&(s=r[u],delete r[u],r[c]=s)}throw new U("".concat(t.name,".bulkUpdate(): ").concat(n," of ").concat(l," operations failed"),r)}))}))}))},ft.prototype.bulkDelete=function(e){var t=this,n=e.length;return this._trans("readwrite",(function(n){return t.core.mutate({trans:n,type:"delete",keys:e})})).then((function(e){var r=e.numFailures,i=e.lastResult;if(e=e.failures,0===r)return i;throw new U("".concat(t.name,".bulkDelete(): ").concat(r," of ").concat(n," operations failed"),e)}))},ft);function ft(){}function pt(e){function t(t,r){if(r){for(var i=arguments.length,o=new Array(i-1);--i;)o[i-1]=arguments[i];return n[t].subscribe.apply(null,o),e}if("string"==typeof t)return n[t]}var n={};t.addEventType=s;for(var r=1,i=arguments.length;r<i;++r)s(arguments[r]);return t;function s(e,r,i){if("object"!=typeof e){var u;r=r||ne;var c={subscribers:[],fire:i=i||X,subscribe:function(e){-1===c.subscribers.indexOf(e)&&(c.subscribers.push(e),c.fire=r(c.fire,e))},unsubscribe:function(e){c.subscribers=c.subscribers.filter((function(t){return t!==e})),c.fire=c.subscribers.reduce(r,i)}};return n[e]=t[e]=c}o(u=e).forEach((function(e){var t=u[e];if(a(t))s(e,u[e][0],u[e][1]);else{if("asap"!==t)throw new V.InvalidArgument("Invalid event config");var n=s(e,Y,(function(){for(var e=arguments.length,t=new Array(e);e--;)t[e]=arguments[e];n.subscribers.forEach((function(e){w((function(){e.apply(null,t)}))}))}))}}))}}function mt(e,t){return p(t).from({prototype:e}),t}function yt(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function vt(e,t){e.filter=ot(e.filter,t)}function gt(e,t,n){var r=e.replayFilter;e.replayFilter=r?function(){return ot(r(),t())}:t,e.justLimit=n&&!r}function bt(e,t){if(e.isPrimKey)return t.primaryKey;var n=t.getIndexByKeyPath(e.index);if(!n)throw new V.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed");return n}function wt(e,t,n){var r=bt(e,t.schema);return t.openCursor({trans:n,values:!e.keysOnly,reverse:"prev"===e.dir,unique:!!e.unique,query:{index:r,range:e.range}})}function St(e,t,n,r){var i=e.replayFilter?ot(e.filter,e.replayFilter()):e.filter;if(e.or){var o={},a=function(e,n,r){var a,s;i&&!i(n,r,(function(e){return n.stop(e)}),(function(e){return n.fail(e)}))||("[object ArrayBuffer]"==(s=""+(a=n.primaryKey))&&(s=""+new Uint8Array(a)),l(o,s)||(o[s]=!0,t(e,n,r)))};return Promise.all([e.or._iterate(a,n),kt(wt(e,r,n),e.algorithm,a,!e.keysOnly&&e.valueMapper)])}return kt(wt(e,r,n),ot(e.algorithm,i),t,!e.keysOnly&&e.valueMapper)}function kt(e,t,n,r){var i=Ae(r?function(e,t,i){return n(r(e),t,i)}:n);return e.then((function(e){if(e)return e.start((function(){var n=function(){return e.continue()};t&&!t(e,(function(e){return n=e}),(function(t){e.stop(t),n=X}),(function(t){e.fail(t),n=X}))||i(e.value,e,(function(e){return n=e})),n()}))}))}var It=(xt.prototype.execute=function(e){var t=this["@@propmod"];if(void 0!==t.add){var n=t.add;if(a(n))return r(r([],a(e)?e:[],!0),n,!0).sort();if("number"==typeof n)return(Number(e)||0)+n;if("bigint"==typeof n)try{return BigInt(e)+n}catch(e){return BigInt(0)+n}throw new TypeError("Invalid term ".concat(n))}if(void 0!==t.remove){var i=t.remove;if(a(i))return a(e)?e.filter((function(e){return!i.includes(e)})).sort():[];if("number"==typeof i)return Number(e)-i;if("bigint"==typeof i)try{return BigInt(e)-i}catch(e){return BigInt(0)-i}throw new TypeError("Invalid subtrahend ".concat(i))}return(n=null===(n=t.replacePrefix)||void 0===n?void 0:n[0])&&"string"==typeof e&&e.startsWith(n)?t.replacePrefix[1]+e.substring(n.length):e},xt);function xt(e){this["@@propmod"]=e}var _t=(Ct.prototype._read=function(e,t){var n=this._ctx;return n.error?n.table._trans(null,Qe.bind(null,n.error)):n.table._trans("readonly",e).then(t)},Ct.prototype._write=function(e){var t=this._ctx;return t.error?t.table._trans(null,Qe.bind(null,t.error)):t.table._trans("readwrite",e,"locked")},Ct.prototype._addAlgorithm=function(e){var t=this._ctx;t.algorithm=ot(t.algorithm,e)},Ct.prototype._iterate=function(e,t){return St(this._ctx,e,t,this._ctx.table.core)},Ct.prototype.clone=function(e){var t=Object.create(this.constructor.prototype),n=Object.create(this._ctx);return e&&s(n,e),t._ctx=n,t},Ct.prototype.raw=function(){return this._ctx.valueMapper=null,this},Ct.prototype.each=function(e){var t=this._ctx;return this._read((function(n){return St(t,e,n,t.table.core)}))},Ct.prototype.count=function(e){var t=this;return this._read((function(e){var n=t._ctx,r=n.table.core;if(yt(n,!0))return r.count({trans:e,query:{index:bt(n,r.schema),range:n.range}}).then((function(e){return Math.min(e,n.limit)}));var i=0;return St(n,(function(){return++i,!1}),e,r).then((function(){return i}))})).then(e)},Ct.prototype.sortBy=function(e,t){var n=e.split(".").reverse(),r=n[0],i=n.length-1;function o(e,t){return t?o(e[n[t]],t-1):e[r]}var a="next"===this._ctx.dir?1:-1;function s(e,t){return ct(o(e,i),o(t,i))*a}return this.toArray((function(e){return e.sort(s)})).then(t)},Ct.prototype.toArray=function(e){var t=this;return this._read((function(e){var n=t._ctx;if("next"===n.dir&&yt(n,!0)&&0<n.limit){var r=n.valueMapper,i=bt(n,n.table.core.schema);return n.table.core.query({trans:e,limit:n.limit,values:!0,query:{index:i,range:n.range}}).then((function(e){return e=e.result,r?e.map(r):e}))}var o=[];return St(n,(function(e){return o.push(e)}),e,n.table.core).then((function(){return o}))}),e)},Ct.prototype.offset=function(e){var t=this._ctx;return e<=0||(t.offset+=e,yt(t)?gt(t,(function(){var t=e;return function(e,n){return 0===t||(1===t?--t:n((function(){e.advance(t),t=0})),!1)}})):gt(t,(function(){var t=e;return function(){return--t<0}}))),this},Ct.prototype.limit=function(e){return this._ctx.limit=Math.min(this._ctx.limit,e),gt(this._ctx,(function(){var t=e;return function(e,n,r){return--t<=0&&n(r),0<=t}}),!0),this},Ct.prototype.until=function(e,t){return vt(this._ctx,(function(n,r,i){return!e(n.value)||(r(i),t)})),this},Ct.prototype.first=function(e){return this.limit(1).toArray((function(e){return e[0]})).then(e)},Ct.prototype.last=function(e){return this.reverse().first(e)},Ct.prototype.filter=function(e){var t;return vt(this._ctx,(function(t){return e(t.value)})),(t=this._ctx).isMatch=ot(t.isMatch,e),this},Ct.prototype.and=function(e){return this.filter(e)},Ct.prototype.or=function(e){return new this.db.WhereClause(this._ctx.table,e,this)},Ct.prototype.reverse=function(){return this._ctx.dir="prev"===this._ctx.dir?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},Ct.prototype.desc=function(){return this.reverse()},Ct.prototype.eachKey=function(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,n){e(n.key,n)}))},Ct.prototype.eachUniqueKey=function(e){return this._ctx.unique="unique",this.eachKey(e)},Ct.prototype.eachPrimaryKey=function(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,n){e(n.primaryKey,n)}))},Ct.prototype.keys=function(e){var t=this._ctx;t.keysOnly=!t.isMatch;var n=[];return this.each((function(e,t){n.push(t.key)})).then((function(){return n})).then(e)},Ct.prototype.primaryKeys=function(e){var t=this._ctx;if("next"===t.dir&&yt(t,!0)&&0<t.limit)return this._read((function(e){var n=bt(t,t.table.core.schema);return t.table.core.query({trans:e,values:!1,limit:t.limit,query:{index:n,range:t.range}})})).then((function(e){return e.result})).then(e);t.keysOnly=!t.isMatch;var n=[];return this.each((function(e,t){n.push(t.primaryKey)})).then((function(){return n})).then(e)},Ct.prototype.uniqueKeys=function(e){return this._ctx.unique="unique",this.keys(e)},Ct.prototype.firstKey=function(e){return this.limit(1).keys((function(e){return e[0]})).then(e)},Ct.prototype.lastKey=function(e){return this.reverse().firstKey(e)},Ct.prototype.distinct=function(){var e;if(!(e=(e=this._ctx).index&&e.table.schema.idxByName[e.index])||!e.multi)return this;var t={};return vt(this._ctx,(function(e){var n=e.primaryKey.toString();return e=l(t,n),t[n]=!0,!e})),this},Ct.prototype.modify=function(e){var t=this,n=this._ctx;return this._write((function(r){var i,a,s;s="function"==typeof e?e:(i=o(e),a=i.length,function(t){for(var n=!1,r=0;r<a;++r){var o=i[r],s=e[o],u=S(t,o);s instanceof It?(k(t,o,s.execute(u)),n=!0):u!==s&&(k(t,o,s),n=!0)}return n});var u,c=n.table.core,l=(u=c.schema.primaryKey).outbound,d=u.extractKey,h=200;function f(e,t){var n=t.failures;t=t.numFailures,m+=e-t;for(var r=0,i=o(n);r<i.length;r++){var a=i[r];p.push(n[a])}}(u=t.db._options.modifyChunkSize)&&(h="object"==typeof u?u[c.name]||u["*"]||200:u);var p=[],m=0,y=[];return t.clone().primaryKeys().then((function(t){function i(n){var a=Math.min(h,t.length-n);return c.getMany({trans:r,keys:t.slice(n,n+a),cache:"immutable"}).then((function(u){for(var p=[],m=[],y=l?[]:null,v=[],g=0;g<a;++g){var b=u[g],w={value:M(b),primKey:t[n+g]};!1!==s.call(w,w.value,w)&&(null==w.value?v.push(t[n+g]):l||0===ct(d(b),d(w.value))?(m.push(w.value),l&&y.push(t[n+g])):(v.push(t[n+g]),p.push(w.value)))}return Promise.resolve(0<p.length&&c.mutate({trans:r,type:"add",values:p}).then((function(e){for(var t in e.failures)v.splice(parseInt(t),1);f(p.length,e)}))).then((function(){return(0<m.length||o&&"object"==typeof e)&&c.mutate({trans:r,type:"put",keys:y,values:m,criteria:o,changeSpec:"function"!=typeof e&&e,isAdditionalChunk:0<n}).then((function(e){return f(m.length,e)}))})).then((function(){return(0<v.length||o&&e===Et)&&c.mutate({trans:r,type:"delete",keys:v,criteria:o,isAdditionalChunk:0<n}).then((function(e){return f(v.length,e)}))})).then((function(){return t.length>n+a&&i(n+h)}))}))}var o=yt(n)&&n.limit===1/0&&("function"!=typeof e||e===Et)&&{index:n.index,range:n.range};return i(0).then((function(){if(0<p.length)throw new z("Error modifying one or more objects",p,m,y);return t.length}))}))}))},Ct.prototype.delete=function(){var e=this._ctx,t=e.range;return yt(e)&&(e.isPrimKey||3===t.type)?this._write((function(n){var r=e.table.core.schema.primaryKey,i=t;return e.table.core.count({trans:n,query:{index:r,range:i}}).then((function(t){return e.table.core.mutate({trans:n,type:"deleteRange",range:i}).then((function(e){var n=e.failures;if(e.lastResult,e.results,e=e.numFailures)throw new z("Could not delete some values",Object.keys(n).map((function(e){return n[e]})),t-e);return t-e}))}))})):this.modify(Et)},Ct);function Ct(){}var Et=function(e,t){return t.value=null};function Ot(e,t){return e<t?-1:e===t?0:1}function Mt(e,t){return t<e?-1:e===t?0:1}function Tt(e,t,n){return(e=e instanceof Lt?new e.Collection(e):e)._ctx.error=new(n||TypeError)(t),e}function Rt(e){return new e.Collection(e,(function(){return At("")})).limit(0)}function Dt(e,t,n,r){var i,o,a,s,u,c,l,d=n.length;if(!n.every((function(e){return"string"==typeof e})))return Tt(e,et);function h(e){i="next"===e?function(e){return e.toUpperCase()}:function(e){return e.toLowerCase()},o="next"===e?function(e){return e.toLowerCase()}:function(e){return e.toUpperCase()},a="next"===e?Ot:Mt;var t=n.map((function(e){return{lower:o(e),upper:i(e)}})).sort((function(e,t){return a(e.lower,t.lower)}));s=t.map((function(e){return e.upper})),u=t.map((function(e){return e.lower})),l="next"===(c=e)?"":r}h("next"),(e=new e.Collection(e,(function(){return Nt(s[0],u[d-1]+r)})))._ondirectionchange=function(e){h(e)};var f=0;return e._addAlgorithm((function(e,n,r){var i=e.key;if("string"!=typeof i)return!1;var h=o(i);if(t(h,u,f))return!0;for(var p=null,m=f;m<d;++m){var y=function(e,t,n,r,i,o){for(var a=Math.min(e.length,r.length),s=-1,u=0;u<a;++u){var c=t[u];if(c!==r[u])return i(e[u],n[u])<0?e.substr(0,u)+n[u]+n.substr(u+1):i(e[u],r[u])<0?e.substr(0,u)+r[u]+n.substr(u+1):0<=s?e.substr(0,s)+t[s]+n.substr(s+1):null;i(e[u],c)<0&&(s=u)}return a<r.length&&"next"===o?e+n.substr(e.length):a<e.length&&"prev"===o?e.substr(0,n.length):s<0?null:e.substr(0,s)+r[s]+n.substr(s+1)}(i,h,s[m],u[m],a,c);null===y&&null===p?f=m+1:(null===p||0<a(p,y))&&(p=y)}return n(null!==p?function(){e.continue(p+l)}:r),!1})),e}function Nt(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function At(e){return{type:1,lower:e,upper:e}}var Lt=(Object.defineProperty(Pt.prototype,"Collection",{get:function(){return this._ctx.table.db.Collection},enumerable:!1,configurable:!0}),Pt.prototype.between=function(e,t,n,r){n=!1!==n,r=!0===r;try{return 0<this._cmp(e,t)||0===this._cmp(e,t)&&(n||r)&&(!n||!r)?Rt(this):new this.Collection(this,(function(){return Nt(e,t,!n,!r)}))}catch(e){return Tt(this,Ze)}},Pt.prototype.equals=function(e){return null==e?Tt(this,Ze):new this.Collection(this,(function(){return At(e)}))},Pt.prototype.above=function(e){return null==e?Tt(this,Ze):new this.Collection(this,(function(){return Nt(e,void 0,!0)}))},Pt.prototype.aboveOrEqual=function(e){return null==e?Tt(this,Ze):new this.Collection(this,(function(){return Nt(e,void 0,!1)}))},Pt.prototype.below=function(e){return null==e?Tt(this,Ze):new this.Collection(this,(function(){return Nt(void 0,e,!1,!0)}))},Pt.prototype.belowOrEqual=function(e){return null==e?Tt(this,Ze):new this.Collection(this,(function(){return Nt(void 0,e)}))},Pt.prototype.startsWith=function(e){return"string"!=typeof e?Tt(this,et):this.between(e,e+Je,!0,!0)},Pt.prototype.startsWithIgnoreCase=function(e){return""===e?this.startsWith(e):Dt(this,(function(e,t){return 0===e.indexOf(t[0])}),[e],Je)},Pt.prototype.equalsIgnoreCase=function(e){return Dt(this,(function(e,t){return e===t[0]}),[e],"")},Pt.prototype.anyOfIgnoreCase=function(){var e=P.apply(L,arguments);return 0===e.length?Rt(this):Dt(this,(function(e,t){return-1!==t.indexOf(e)}),e,"")},Pt.prototype.startsWithAnyOfIgnoreCase=function(){var e=P.apply(L,arguments);return 0===e.length?Rt(this):Dt(this,(function(e,t){return t.some((function(t){return 0===e.indexOf(t)}))}),e,Je)},Pt.prototype.anyOf=function(){var e=this,t=P.apply(L,arguments),n=this._cmp;try{t.sort(n)}catch(r){return Tt(this,Ze)}if(0===t.length)return Rt(this);var r=new this.Collection(this,(function(){return Nt(t[0],t[t.length-1])}));r._ondirectionchange=function(r){n="next"===r?e._ascending:e._descending,t.sort(n)};var i=0;return r._addAlgorithm((function(e,r,o){for(var a=e.key;0<n(a,t[i]);)if(++i===t.length)return r(o),!1;return 0===n(a,t[i])||(r((function(){e.continue(t[i])})),!1)})),r},Pt.prototype.notEqual=function(e){return this.inAnyRange([[-1/0,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},Pt.prototype.noneOf=function(){var e=P.apply(L,arguments);if(0===e.length)return new this.Collection(this);try{e.sort(this._ascending)}catch(e){return Tt(this,Ze)}var t=e.reduce((function(e,t){return e?e.concat([[e[e.length-1][1],t]]):[[-1/0,t]]}),null);return t.push([e[e.length-1],this.db._maxKey]),this.inAnyRange(t,{includeLowers:!1,includeUppers:!1})},Pt.prototype.inAnyRange=function(e,t){var n=this,r=this._cmp,i=this._ascending,o=this._descending,a=this._min,s=this._max;if(0===e.length)return Rt(this);if(!e.every((function(e){return void 0!==e[0]&&void 0!==e[1]&&i(e[0],e[1])<=0})))return Tt(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",V.InvalidArgument);var u,c=!t||!1!==t.includeLowers,l=t&&!0===t.includeUppers,d=i;function h(e,t){return d(e[0],t[0])}try{(u=e.reduce((function(e,t){for(var n=0,i=e.length;n<i;++n){var o=e[n];if(r(t[0],o[1])<0&&0<r(t[1],o[0])){o[0]=a(o[0],t[0]),o[1]=s(o[1],t[1]);break}}return n===i&&e.push(t),e}),[])).sort(h)}catch(e){return Tt(this,Ze)}var f=0,p=l?function(e){return 0<i(e,u[f][1])}:function(e){return 0<=i(e,u[f][1])},m=c?function(e){return 0<o(e,u[f][0])}:function(e){return 0<=o(e,u[f][0])},y=p;return(e=new this.Collection(this,(function(){return Nt(u[0][0],u[u.length-1][1],!c,!l)})))._ondirectionchange=function(e){d="next"===e?(y=p,i):(y=m,o),u.sort(h)},e._addAlgorithm((function(e,t,r){for(var o,a=e.key;y(a);)if(++f===u.length)return t(r),!1;return!p(o=a)&&!m(o)||(0===n._cmp(a,u[f][1])||0===n._cmp(a,u[f][0])||t((function(){d===i?e.continue(u[f][0]):e.continue(u[f][1])})),!1)})),e},Pt.prototype.startsWithAnyOf=function(){var e=P.apply(L,arguments);return e.every((function(e){return"string"==typeof e}))?0===e.length?Rt(this):this.inAnyRange(e.map((function(e){return[e,e+Je]}))):Tt(this,"startsWithAnyOf() only works with strings")},Pt);function Pt(){}function Ft(e){return Ae((function(t){return jt(t),e(t.target.error),!1}))}function jt(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}var Bt="storagemutated",qt="x-storagemutated-1",Kt=pt(null,Bt),zt=(Ut.prototype._lock=function(){return b(!ge.global),++this._reculock,1!==this._reculock||ge.global||(ge.lockOwnerFor=this),this},Ut.prototype._unlock=function(){if(b(!ge.global),0==--this._reculock)for(ge.global||(ge.lockOwnerFor=null);0<this._blockedFuncs.length&&!this._locked();){var e=this._blockedFuncs.shift();try{Ge(e[1],e[0])}catch(e){}}return this},Ut.prototype._locked=function(){return this._reculock&&ge.lockOwnerFor!==this},Ut.prototype.create=function(e){var t=this;if(!this.mode)return this;var n=this.db.idbdb,r=this.db._state.dbOpenError;if(b(!this.idbtrans),!e&&!n)switch(r&&r.name){case"DatabaseClosedError":throw new V.DatabaseClosed(r);case"MissingAPIError":throw new V.MissingAPI(r.message,r);default:throw new V.OpenFailed(r)}if(!this.active)throw new V.TransactionInactive;return b(null===this._completion._state),(e=this.idbtrans=e||(this.db.core||n).transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability})).onerror=Ae((function(n){jt(n),t._reject(e.error)})),e.onabort=Ae((function(n){jt(n),t.active&&t._reject(new V.Abort(e.error)),t.active=!1,t.on("abort").fire(n)})),e.oncomplete=Ae((function(){t.active=!1,t._resolve(),"mutatedParts"in e&&Kt.storagemutated.fire(e.mutatedParts)})),this},Ut.prototype._promise=function(e,t,n){var r=this;if("readwrite"===e&&"readwrite"!==this.mode)return Qe(new V.ReadOnly("Transaction is readonly"));if(!this.active)return Qe(new V.TransactionInactive);if(this._locked())return new ke((function(i,o){r._blockedFuncs.push([function(){r._promise(e,t,n).then(i,o)},ge])}));if(n)return Ke((function(){var e=new ke((function(e,n){r._lock();var i=t(e,n,r);i&&i.then&&i.then(e,n)}));return e.finally((function(){return r._unlock()})),e._lib=!0,e}));var i=new ke((function(e,n){var i=t(e,n,r);i&&i.then&&i.then(e,n)}));return i._lib=!0,i},Ut.prototype._root=function(){return this.parent?this.parent._root():this},Ut.prototype.waitFor=function(e){var t,n=this._root(),r=ke.resolve(e);n._waitingFor?n._waitingFor=n._waitingFor.then((function(){return r})):(n._waitingFor=r,n._waitingQueue=[],t=n.idbtrans.objectStore(n.storeNames[0]),function e(){for(++n._spinCount;n._waitingQueue.length;)n._waitingQueue.shift()();n._waitingFor&&(t.get(-1/0).onsuccess=e)}());var i=n._waitingFor;return new ke((function(e,t){r.then((function(t){return n._waitingQueue.push(Ae(e.bind(null,t)))}),(function(e){return n._waitingQueue.push(Ae(t.bind(null,e)))})).finally((function(){n._waitingFor===i&&(n._waitingFor=null)}))}))},Ut.prototype.abort=function(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new V.Abort))},Ut.prototype.table=function(e){var t=this._memoizedTables||(this._memoizedTables={});if(l(t,e))return t[e];var n=this.schema[e];if(!n)throw new V.NotFound("Table "+e+" not part of transaction");return(n=new this.db.Table(e,n,this)).core=this.db.core.table(e),t[e]=n},Ut);function Ut(){}function Wt(e,t,n,r,i,o,a){return{name:e,keyPath:t,unique:n,multi:r,auto:i,compound:o,src:(n&&!a?"&":"")+(r?"*":"")+(i?"++":"")+Ht(t)}}function Ht(e){return"string"==typeof e?e:e?"["+[].join.call(e,"+")+"]":""}function Vt(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:(r=function(e){return[e.name,e]},n.reduce((function(e,t,n){return(n=r(t,n))&&(e[n[0]]=n[1]),e}),{}))};var r}var $t=function(e){try{return e.only([[]]),$t=function(){return[[]]},[[]]}catch(e){return $t=function(){return Je},Je}};function Gt(e){return null==e?function(){}:"string"==typeof e?1===(t=e).split(".").length?function(e){return e[t]}:function(e){return S(e,t)}:function(t){return S(t,e)};var t}function Xt(e){return[].slice.call(e)}var Yt=0;function Qt(e){return null==e?":id":"string"==typeof e?e:"[".concat(e.join("+"),"]")}function Jt(e,t,n){function r(e){if(3===e.type)return null;if(4===e.type)throw new Error("Cannot convert never type to IDBKeyRange");var n=e.lower,r=e.upper,i=e.lowerOpen;return e=e.upperOpen,void 0===n?void 0===r?null:t.upperBound(r,!!e):void 0===r?t.lowerBound(n,!!i):t.bound(n,r,!!i,!!e)}function i(e){var t,n=e.name;return{name:n,schema:e,mutate:function(e){var t=e.trans,i=e.type,o=e.keys,a=e.values,s=e.range;return new Promise((function(e,u){e=Ae(e);var c=t.objectStore(n),l=null==c.keyPath,d="put"===i||"add"===i;if(!d&&"delete"!==i&&"deleteRange"!==i)throw new Error("Invalid operation type: "+i);var h,f=(o||a||{length:1}).length;if(o&&a&&o.length!==a.length)throw new Error("Given keys array must have same length as given values array.");if(0===f)return e({numFailures:0,failures:{},results:[],lastResult:void 0});function p(e){++v,jt(e)}var m=[],y=[],v=0;if("deleteRange"===i){if(4===s.type)return e({numFailures:v,failures:y,results:[],lastResult:void 0});3===s.type?m.push(h=c.clear()):m.push(h=c.delete(r(s)))}else{var g=(l=d?l?[a,o]:[a,null]:[o,null])[0],b=l[1];if(d)for(var w=0;w<f;++w)m.push(h=b&&void 0!==b[w]?c[i](g[w],b[w]):c[i](g[w])),h.onerror=p;else for(w=0;w<f;++w)m.push(h=c[i](g[w])),h.onerror=p}function S(t){t=t.target.result,m.forEach((function(e,t){return null!=e.error&&(y[t]=e.error)})),e({numFailures:v,failures:y,results:"delete"===i?o:m.map((function(e){return e.result})),lastResult:t})}h.onerror=function(e){p(e),S(e)},h.onsuccess=S}))},getMany:function(e){var t=e.trans,r=e.keys;return new Promise((function(e,i){e=Ae(e);for(var o,a=t.objectStore(n),s=r.length,u=new Array(s),c=0,l=0,d=function(t){t=t.target,u[t._pos]=t.result,++l===c&&e(u)},h=Ft(i),f=0;f<s;++f)null!=r[f]&&((o=a.get(r[f]))._pos=f,o.onsuccess=d,o.onerror=h,++c);0===c&&e(u)}))},get:function(e){var t=e.trans,r=e.key;return new Promise((function(e,i){e=Ae(e);var o=t.objectStore(n).get(r);o.onsuccess=function(t){return e(t.target.result)},o.onerror=Ft(i)}))},query:(t=l,function(e){return new Promise((function(i,o){i=Ae(i);var a,s,u,c=e.trans,l=e.values,d=e.limit,h=e.query,f=d===1/0?void 0:d,p=h.index;if(h=h.range,c=c.objectStore(n),p=p.isPrimaryKey?c:c.index(p.name),h=r(h),0===d)return i({result:[]});t?((f=l?p.getAll(h,f):p.getAllKeys(h,f)).onsuccess=function(e){return i({result:e.target.result})},f.onerror=Ft(o)):(a=0,s=!l&&"openKeyCursor"in p?p.openKeyCursor(h):p.openCursor(h),u=[],s.onsuccess=function(e){var t=s.result;return t?(u.push(l?t.value:t.primaryKey),++a===d?i({result:u}):void t.continue()):i({result:u})},s.onerror=Ft(o))}))}),openCursor:function(e){var t=e.trans,i=e.values,o=e.query,a=e.reverse,s=e.unique;return new Promise((function(e,u){e=Ae(e);var c=o.index,l=o.range,d=t.objectStore(n),h=(d=c.isPrimaryKey?d:d.index(c.name),c=a?s?"prevunique":"prev":s?"nextunique":"next",!i&&"openKeyCursor"in d?d.openKeyCursor(r(l),c):d.openCursor(r(l),c));h.onerror=Ft(u),h.onsuccess=Ae((function(n){var r,i,o,a,s=h.result;s?(s.___id=++Yt,s.done=!1,r=s.continue.bind(s),i=(i=s.continuePrimaryKey)&&i.bind(s),o=s.advance.bind(s),a=function(){throw new Error("Cursor not stopped")},s.trans=t,s.stop=s.continue=s.continuePrimaryKey=s.advance=function(){throw new Error("Cursor not started")},s.fail=Ae(u),s.next=function(){var e=this,t=1;return this.start((function(){return t--?e.continue():e.stop()})).then((function(){return e}))},s.start=function(e){function t(){if(h.result)try{e()}catch(e){s.fail(e)}else s.done=!0,s.start=function(){throw new Error("Cursor behind last entry")},s.stop()}var n=new Promise((function(e,t){e=Ae(e),h.onerror=Ft(t),s.fail=t,s.stop=function(t){s.stop=s.continue=s.continuePrimaryKey=s.advance=a,e(t)}}));return h.onsuccess=Ae((function(e){h.onsuccess=t,t()})),s.continue=r,s.continuePrimaryKey=i,s.advance=o,t(),n},e(s)):e(null)}),u)}))},count:function(e){var t=e.query,i=e.trans,o=t.index,a=t.range;return new Promise((function(e,t){var s=i.objectStore(n),u=o.isPrimaryKey?s:s.index(o.name);(u=(s=r(a))?u.count(s):u.count()).onsuccess=Ae((function(t){return e(t.target.result)})),u.onerror=Ft(t)}))}}}var o,s,u,c=(s=n,u=Xt((o=e).objectStoreNames),{schema:{name:o.name,tables:u.map((function(e){return s.objectStore(e)})).map((function(e){var t=e.keyPath,n=e.autoIncrement,r=a(t),i={};return n={name:e.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:null==t,compound:r,keyPath:t,autoIncrement:n,unique:!0,extractKey:Gt(t)},indexes:Xt(e.indexNames).map((function(t){return e.index(t)})).map((function(e){var t=e.name,n=e.unique,r=e.multiEntry;return e=e.keyPath,r={name:t,compound:a(e),keyPath:e,unique:n,multiEntry:r,extractKey:Gt(e)},i[Qt(e)]=r})),getIndexByKeyPath:function(e){return i[Qt(e)]}},i[":id"]=n.primaryKey,null!=t&&(i[Qt(t)]=n.primaryKey),n}))},hasGetAll:0<u.length&&"getAll"in s.objectStore(u[0])&&!("undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}),l=(n=c.schema,c.hasGetAll),d=(c=n.tables.map(i),{});return c.forEach((function(e){return d[e.name]=e})),{stack:"dbcore",transaction:e.transaction.bind(e),table:function(e){if(!d[e])throw new Error("Table '".concat(e,"' not found"));return d[e]},MIN_KEY:-1/0,MAX_KEY:$t(t),schema:n}}function Zt(e,n,r,i){var o=r.IDBKeyRange;return r.indexedDB,{dbcore:(i=Jt(n,o,i),e.dbcore.reduce((function(e,n){return n=n.create,t(t({},e),n(e))}),i))}}function en(e,t){var n=t.db;t=Zt(e._middlewares,n,e._deps,t),e.core=t.dbcore,e.tables.forEach((function(t){var n=t.name;e.core.schema.tables.some((function(e){return e.name===n}))&&(t.core=e.core.table(n),e[n]instanceof e.Table&&(e[n].core=t.core))}))}function tn(e,t,n,r){n.forEach((function(n){var i=r[n];t.forEach((function(t){var r=function e(t,n){return m(t,n)||(t=u(t))&&e(t,n)}(t,n);(!r||"value"in r&&void 0===r.value)&&(t===e.Transaction.prototype||t instanceof e.Transaction?f(t,n,{get:function(){return this.table(n)},set:function(e){h(this,n,{value:e,writable:!0,configurable:!0,enumerable:!0})}}):t[n]=new e.Table(n,i))}))}))}function nn(e,t){t.forEach((function(t){for(var n in t)t[n]instanceof e.Table&&delete t[n]}))}function rn(e,t){return e._cfg.version-t._cfg.version}function on(e,t,n,r){var i=e._dbSchema;n.objectStoreNames.contains("$meta")&&!i.$meta&&(i.$meta=Vt("$meta",fn("")[0],[]),e._storeNames.push("$meta"));var a=e._createTransaction("readwrite",e._storeNames,i);a.create(n),a._completion.catch(r);var s=a._reject.bind(a),u=ge.transless||ge;Ke((function(){return ge.trans=a,ge.transless=u,0!==t?(en(e,n),c=t,((r=a).storeNames.includes("$meta")?r.table("$meta").get("version").then((function(e){return null!=e?e:c})):ke.resolve(c)).then((function(t){return i=t,s=a,u=n,c=[],t=(r=e)._versions,l=r._dbSchema=dn(0,r.idbdb,u),0!==(t=t.filter((function(e){return e._cfg.version>=i}))).length?(t.forEach((function(e){c.push((function(){var t=l,n=e._cfg.dbschema;hn(r,t,u),hn(r,n,u),l=r._dbSchema=n;var a=sn(t,n);a.add.forEach((function(e){un(u,e[0],e[1].primKey,e[1].indexes)})),a.change.forEach((function(e){if(e.recreate)throw new V.Upgrade("Not yet support for changing primary key");var t=u.objectStore(e.name);e.add.forEach((function(e){return ln(t,e)})),e.change.forEach((function(e){t.deleteIndex(e.name),ln(t,e)})),e.del.forEach((function(e){return t.deleteIndex(e)}))}));var c=e._cfg.contentUpgrade;if(c&&e._cfg.version>i){en(r,u),s._memoizedTables={};var d=I(n);a.del.forEach((function(e){d[e]=t[e]})),nn(r,[r.Transaction.prototype]),tn(r,[r.Transaction.prototype],o(d),d),s.schema=d;var h,f=F(c);return f&&ze(),a=ke.follow((function(){var e;(h=c(s))&&f&&(e=Ue.bind(null,null),h.then(e,e))})),h&&"function"==typeof h.then?ke.resolve(h):a.then((function(){return h}))}})),c.push((function(t){var n,i,o=e._cfg.dbschema;n=o,i=t,[].slice.call(i.db.objectStoreNames).forEach((function(e){return null==n[e]&&i.db.deleteObjectStore(e)})),nn(r,[r.Transaction.prototype]),tn(r,[r.Transaction.prototype],r._storeNames,r._dbSchema),s.schema=r._dbSchema})),c.push((function(t){r.idbdb.objectStoreNames.contains("$meta")&&(Math.ceil(r.idbdb.version/10)===e._cfg.version?(r.idbdb.deleteObjectStore("$meta"),delete r._dbSchema.$meta,r._storeNames=r._storeNames.filter((function(e){return"$meta"!==e}))):t.objectStore("$meta").put(e._cfg.version,"version"))}))})),function e(){return c.length?ke.resolve(c.shift()(s.idbtrans)).then(e):ke.resolve()}().then((function(){cn(l,u)}))):ke.resolve();var r,i,s,u,c,l})).catch(s)):(o(i).forEach((function(e){un(n,e,i[e].primKey,i[e].indexes)})),en(e,n),void ke.follow((function(){return e.on.populate.fire(a)})).catch(s));var r,c}))}function an(e,t){cn(e._dbSchema,t),t.db.version%10!=0||t.objectStoreNames.contains("$meta")||t.db.createObjectStore("$meta").add(Math.ceil(t.db.version/10-1),"version");var n=dn(0,e.idbdb,t);hn(e,e._dbSchema,t);for(var r=0,i=sn(n,e._dbSchema).change;r<i.length;r++){var o=function(e){if(e.change.length||e.recreate)return{value:void 0};var n=t.objectStore(e.name);e.add.forEach((function(e){ln(n,e)}))}(i[r]);if("object"==typeof o)return o.value}}function sn(e,t){var n,r={del:[],add:[],change:[]};for(n in e)t[n]||r.del.push(n);for(n in t){var i=e[n],o=t[n];if(i){var a={name:n,def:o,recreate:!1,del:[],add:[],change:[]};if(""+(i.primKey.keyPath||"")!=""+(o.primKey.keyPath||"")||i.primKey.auto!==o.primKey.auto)a.recreate=!0,r.change.push(a);else{var s=i.idxByName,u=o.idxByName,c=void 0;for(c in s)u[c]||a.del.push(c);for(c in u){var l=s[c],d=u[c];l?l.src!==d.src&&a.change.push(d):a.add.push(d)}(0<a.del.length||0<a.add.length||0<a.change.length)&&r.change.push(a)}}else r.add.push([n,o])}return r}function un(e,t,n,r){var i=e.db.createObjectStore(t,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return r.forEach((function(e){return ln(i,e)})),i}function cn(e,t){o(e).forEach((function(n){t.db.objectStoreNames.contains(n)||un(t,n,e[n].primKey,e[n].indexes)}))}function ln(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function dn(e,t,n){var r={};return v(t.objectStoreNames,0).forEach((function(e){for(var t=n.objectStore(e),i=Wt(Ht(s=t.keyPath),s||"",!0,!1,!!t.autoIncrement,s&&"string"!=typeof s,!0),o=[],a=0;a<t.indexNames.length;++a){var s=(u=t.index(t.indexNames[a])).keyPath,u=Wt(u.name,s,!!u.unique,!!u.multiEntry,!1,s&&"string"!=typeof s,!1);o.push(u)}r[e]=Vt(e,i,o)})),r}function hn(e,t,n){for(var r=n.db.objectStoreNames,o=0;o<r.length;++o){var a=r[o],s=n.objectStore(a);e._hasGetAll="getAll"in s;for(var u=0;u<s.indexNames.length;++u){var c=s.indexNames[u],l=s.index(c).keyPath,d="string"==typeof l?l:"["+v(l).join("+")+"]";!t[a]||(l=t[a].idxByName[d])&&(l.name=c,delete t[a].idxByName[d],t[a].idxByName[c]=l)}}"undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&i.WorkerGlobalScope&&i instanceof i.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}function fn(e){return e.split(",").map((function(e,t){var n=(e=e.trim()).replace(/([&*]|\+\+)/g,""),r=/^\[/.test(n)?n.match(/^\[(.*)\]$/)[1].split("+"):n;return Wt(n,r||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),a(r),0===t)}))}var pn=(mn.prototype._parseStoresSpec=function(e,t){o(e).forEach((function(n){if(null!==e[n]){var r=fn(e[n]),i=r.shift();if(i.unique=!0,i.multi)throw new V.Schema("Primary key cannot be multi-valued");r.forEach((function(e){if(e.auto)throw new V.Schema("Only primary key can be marked as autoIncrement (++)");if(!e.keyPath)throw new V.Schema("Index must have a name and cannot be an empty string")})),t[n]=Vt(n,i,r)}}))},mn.prototype.stores=function(e){var t=this.db;this._cfg.storesSource=this._cfg.storesSource?s(this._cfg.storesSource,e):e,e=t._versions;var n={},r={};return e.forEach((function(e){s(n,e._cfg.storesSource),r=e._cfg.dbschema={},e._parseStoresSpec(n,r)})),t._dbSchema=r,nn(t,[t._allTables,t,t.Transaction.prototype]),tn(t,[t._allTables,t,t.Transaction.prototype,this._cfg.tables],o(r),r),t._storeNames=o(r),this},mn.prototype.upgrade=function(e){return this._cfg.contentUpgrade=re(this._cfg.contentUpgrade||X,e),this},mn);function mn(){}function yn(e,t){var n=e._dbNamesDB;return n||(n=e._dbNamesDB=new tr(nt,{addons:[],indexedDB:e,IDBKeyRange:t})).version(1).stores({dbnames:"name"}),n.table("dbnames")}function vn(e){return e&&"function"==typeof e.databases}function gn(e){return Ke((function(){return ge.letThrough=!0,e()}))}function bn(e){return!("from"in e)}var wn=function(e,t){if(!this){var n=new wn;return e&&"d"in e&&s(n,e),n}s(this,arguments.length?{d:1,from:e,to:1<arguments.length?t:e}:{d:0})};function Sn(e,t,n){var r=ct(t,n);if(!isNaN(r)){if(0<r)throw RangeError();if(bn(e))return s(e,{from:t,to:n,d:1});var i=e.l;if(r=e.r,ct(n,e.from)<0)return i?Sn(i,t,n):e.l={from:t,to:n,d:1,l:null,r:null},_n(e);if(0<ct(t,e.to))return r?Sn(r,t,n):e.r={from:t,to:n,d:1,l:null,r:null},_n(e);ct(t,e.from)<0&&(e.from=t,e.l=null,e.d=r?r.d+1:1),0<ct(n,e.to)&&(e.to=n,e.r=null,e.d=e.l?e.l.d+1:1),n=!e.r,i&&!e.l&&kn(e,i),r&&n&&kn(e,r)}}function kn(e,t){bn(t)||function e(t,n){var r=n.from,i=n.to,o=n.l;n=n.r,Sn(t,r,i),o&&e(t,o),n&&e(t,n)}(e,t)}function In(e,t){var n=xn(t),r=n.next();if(r.done)return!1;for(var i=r.value,o=xn(e),a=o.next(i.from),s=a.value;!r.done&&!a.done;){if(ct(s.from,i.to)<=0&&0<=ct(s.to,i.from))return!0;ct(i.from,s.from)<0?i=(r=n.next(s.from)).value:s=(a=o.next(i.from)).value}return!1}function xn(e){var t=bn(e)?null:{s:0,n:e};return{next:function(e){for(var n=0<arguments.length;t;)switch(t.s){case 0:if(t.s=1,n)for(;t.n.l&&ct(e,t.n.from)<0;)t={up:t,n:t.n.l,s:1};else for(;t.n.l;)t={up:t,n:t.n.l,s:1};case 1:if(t.s=2,!n||ct(e,t.n.to)<=0)return{value:t.n,done:!1};case 2:if(t.n.r){t.s=3,t={up:t,n:t.n.r,s:0};continue}case 3:t=t.up}return{done:!0}}}}function _n(e){var n,r,i=((null===(n=e.r)||void 0===n?void 0:n.d)||0)-((null===(r=e.l)||void 0===r?void 0:r.d)||0),o=1<i?"r":i<-1?"l":"";o&&(n="r"==o?"l":"r",r=t({},e),i=e[o],e.from=i.from,e.to=i.to,e[o]=i[o],r[o]=i[n],(e[n]=r).d=Cn(r)),e.d=Cn(e)}function Cn(e){var t=e.r;return e=e.l,(t?e?Math.max(t.d,e.d):t.d:e?e.d:0)+1}function En(e,t){return o(t).forEach((function(n){e[n]?kn(e[n],t[n]):e[n]=function e(t){var n,r,i={};for(n in t)l(t,n)&&(r=t[n],i[n]=!r||"object"!=typeof r||E.has(r.constructor)?r:e(r));return i}(t[n])})),e}function On(e,t){return e.all||t.all||Object.keys(e).some((function(n){return t[n]&&In(t[n],e[n])}))}d(wn.prototype,((j={add:function(e){return kn(this,e),this},addKey:function(e){return Sn(this,e,e),this},addKeys:function(e){var t=this;return e.forEach((function(e){return Sn(t,e,e)})),this},hasKey:function(e){var t=xn(this).next(e).value;return t&&ct(t.from,e)<=0&&0<=ct(t.to,e)}})[D]=function(){return xn(this)},j));var Mn={},Tn={},Rn=!1;function Dn(e){En(Tn,e),Rn||(Rn=!0,setTimeout((function(){Rn=!1,Nn(Tn,!(Tn={}))}),0))}function Nn(e,t){void 0===t&&(t=!1);var n=new Set;if(e.all)for(var r=0,i=Object.values(Mn);r<i.length;r++)An(a=i[r],e,n,t);else for(var o in e){var a,s=/^idb\:\/\/(.*)\/(.*)\//.exec(o);s&&(o=s[1],s=s[2],(a=Mn["idb://".concat(o,"/").concat(s)])&&An(a,e,n,t))}n.forEach((function(e){return e()}))}function An(e,t,n,r){for(var i=[],o=0,a=Object.entries(e.queries.query);o<a.length;o++){for(var s=a[o],u=s[0],c=[],l=0,d=s[1];l<d.length;l++){var h=d[l];On(t,h.obsSet)?h.subscribers.forEach((function(e){return n.add(e)})):r&&c.push(h)}r&&i.push([u,c])}if(r)for(var f=0,p=i;f<p.length;f++){var m=p[f];u=m[0],c=m[1],e.queries.query[u]=c}}function Ln(e){var t=e._state,n=e._deps.indexedDB;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then((function(){return t.dbOpenError?Qe(t.dbOpenError):e}));t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;var r=t.openCanceller,i=Math.round(10*e.verno),a=!1;function s(){if(t.openCanceller!==r)throw new V.DatabaseClosed("db.open() was cancelled")}function u(){return new ke((function(r,c){if(s(),!n)throw new V.MissingAPI;var l=e.name,f=t.autoSchema||!i?n.open(l):n.open(l,i);if(!f)throw new V.MissingAPI;f.onerror=Ft(c),f.onblocked=Ae(e._fireOnBlocked),f.onupgradeneeded=Ae((function(r){var i;d=f.transaction,t.autoSchema&&!e._options.allowEmptyDB?(f.onerror=jt,d.abort(),f.result.close(),(i=n.deleteDatabase(l)).onsuccess=i.onerror=Ae((function(){c(new V.NoSuchDatabase("Database ".concat(l," doesnt exist")))}))):(d.onerror=Ft(c),r=r.oldVersion>Math.pow(2,62)?0:r.oldVersion,h=r<1,e.idbdb=f.result,a&&an(e,d),on(e,r/10,d,c))}),c),f.onsuccess=Ae((function(){d=null;var n,s,c,p,m,y=e.idbdb=f.result,g=v(y.objectStoreNames);if(0<g.length)try{var b=y.transaction(1===(p=g).length?p[0]:p,"readonly");if(t.autoSchema)s=y,c=b,(n=e).verno=s.version/10,c=n._dbSchema=dn(0,s,c),n._storeNames=v(s.objectStoreNames,0),tn(n,[n._allTables],o(c),c);else if(hn(e,e._dbSchema,b),((m=sn(dn(0,(m=e).idbdb,b),m._dbSchema)).add.length||m.change.some((function(e){return e.add.length||e.change.length})))&&!a)return y.close(),i=y.version+1,a=!0,r(u());en(e,b)}catch(n){}tt.push(e),y.onversionchange=Ae((function(n){t.vcFired=!0,e.on("versionchange").fire(n)})),y.onclose=Ae((function(t){e.on("close").fire(t)})),h&&(m=e._deps,b=l,y=m.indexedDB,m=m.IDBKeyRange,vn(y)||b===nt||yn(y,m).put({name:b}).catch(X)),r()}),c)})).catch((function(e){switch(null==e?void 0:e.name){case"UnknownError":if(0<t.PR1398_maxLoop)return t.PR1398_maxLoop--,u();break;case"VersionError":if(0<i)return i=0,u()}return ke.reject(e)}))}var c,l=t.dbReadyResolve,d=null,h=!1;return ke.race([r,("undefined"==typeof navigator?ke.resolve():!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise((function(e){function t(){return indexedDB.databases().finally(e)}c=setInterval(t,100),t()})).finally((function(){return clearInterval(c)})):Promise.resolve()).then(u)]).then((function(){return s(),t.onReadyBeingFired=[],ke.resolve(gn((function(){return e.on.ready.fire(e.vip)}))).then((function n(){if(0<t.onReadyBeingFired.length){var r=t.onReadyBeingFired.reduce(re,X);return t.onReadyBeingFired=[],ke.resolve(gn((function(){return r(e.vip)}))).then(n)}}))})).finally((function(){t.openCanceller===r&&(t.onReadyBeingFired=null,t.isBeingOpened=!1)})).catch((function(n){t.dbOpenError=n;try{d&&d.abort()}catch(n){}return r===t.openCanceller&&e._close(),Qe(n)})).finally((function(){t.openComplete=!0,l()})).then((function(){var t;return h&&(t={},e.tables.forEach((function(n){n.schema.indexes.forEach((function(r){r.name&&(t["idb://".concat(e.name,"/").concat(n.name,"/").concat(r.name)]=new wn(-1/0,[[[]]]))})),t["idb://".concat(e.name,"/").concat(n.name,"/")]=t["idb://".concat(e.name,"/").concat(n.name,"/:dels")]=new wn(-1/0,[[[]]])})),Kt(Bt).fire(t),Nn(t,!0)),e}))}function Pn(e){function t(t){return e.next(t)}var n=i(t),r=i((function(t){return e.throw(t)}));function i(e){return function(t){var i=e(t);return t=i.value,i.done?t:t&&"function"==typeof t.then?t.then(n,r):a(t)?Promise.all(t).then(n,r):n(t)}}return i(t)()}function Fn(e,t,n){for(var r=a(e)?e.slice():[e],i=0;i<n;++i)r.push(t);return r}var jn={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(e){return t(t({},e),{table:function(n){var r=e.table(n),i=r.schema,o={},a=[];function s(e,n,r){var i=Qt(e),u=o[i]=o[i]||[],c=null==e?0:"string"==typeof e?1:e.length,l=0<n;return l=t(t({},r),{name:l?"".concat(i,"(virtual-from:").concat(r.name,")"):r.name,lowLevelIndex:r,isVirtual:l,keyTail:n,keyLength:c,extractKey:Gt(e),unique:!l&&r.unique}),u.push(l),l.isPrimaryKey||a.push(l),1<c&&s(2===c?e[0]:e.slice(0,c-1),n+1,r),u.sort((function(e,t){return e.keyTail-t.keyTail})),l}n=s(i.primaryKey.keyPath,0,i.primaryKey),o[":id"]=[n];for(var u=0,c=i.indexes;u<c.length;u++){var l=c[u];s(l.keyPath,0,l)}function d(n){var r,i=n.query.index;return i.isVirtual?t(t({},n),{query:{index:i.lowLevelIndex,range:(r=n.query.range,i=i.keyTail,{type:1===r.type?2:r.type,lower:Fn(r.lower,r.lowerOpen?e.MAX_KEY:e.MIN_KEY,i),lowerOpen:!0,upper:Fn(r.upper,r.upperOpen?e.MIN_KEY:e.MAX_KEY,i),upperOpen:!0})}}):n}return t(t({},r),{schema:t(t({},i),{primaryKey:n,indexes:a,getIndexByKeyPath:function(e){return(e=o[Qt(e)])&&e[0]}}),count:function(e){return r.count(d(e))},query:function(e){return r.query(d(e))},openCursor:function(t){var n=t.query.index,i=n.keyTail,o=n.isVirtual,a=n.keyLength;return o?r.openCursor(d(t)).then((function(e){return e&&s(e)})):r.openCursor(t);function s(n){return Object.create(n,{continue:{value:function(r){null!=r?n.continue(Fn(r,t.reverse?e.MAX_KEY:e.MIN_KEY,i)):t.unique?n.continue(n.key.slice(0,a).concat(t.reverse?e.MIN_KEY:e.MAX_KEY,i)):n.continue()}},continuePrimaryKey:{value:function(t,r){n.continuePrimaryKey(Fn(t,e.MAX_KEY,i),r)}},primaryKey:{get:function(){return n.primaryKey}},key:{get:function(){var e=n.key;return 1===a?e[0]:e.slice(0,a)}},value:{get:function(){return n.value}}})}}})}})}};function Bn(e,t,n,r){return n=n||{},r=r||"",o(e).forEach((function(i){var o,a,s;l(t,i)?(o=e[i],a=t[i],"object"==typeof o&&"object"==typeof a&&o&&a?(s=R(o))!==R(a)?n[r+i]=t[i]:"Object"===s?Bn(o,a,n,r+i+"."):o!==a&&(n[r+i]=t[i]):o!==a&&(n[r+i]=t[i])):n[r+i]=void 0})),o(t).forEach((function(i){l(e,i)||(n[r+i]=t[i])})),n}function qn(e,t){return"delete"===t.type?t.keys:t.keys||t.values.map(e.extractKey)}var Kn={stack:"dbcore",name:"HooksMiddleware",level:2,create:function(e){return t(t({},e),{table:function(n){var i=e.table(n),o=i.schema.primaryKey;return t(t({},i),{mutate:function(e){var a=ge.trans,s=a.table(n).hook,u=s.deleting,c=s.creating,d=s.updating;switch(e.type){case"add":if(c.fire===X)break;return a._promise("readwrite",(function(){return h(e)}),!0);case"put":if(c.fire===X&&d.fire===X)break;return a._promise("readwrite",(function(){return h(e)}),!0);case"delete":if(u.fire===X)break;return a._promise("readwrite",(function(){return h(e)}),!0);case"deleteRange":if(u.fire===X)break;return a._promise("readwrite",(function(){return function e(n,r,a){return i.query({trans:n,values:!1,query:{index:o,range:r},limit:a}).then((function(i){var o=i.result;return h({type:"delete",keys:o,trans:n}).then((function(i){return 0<i.numFailures?Promise.reject(i.failures[0]):o.length<a?{failures:[],numFailures:0,lastResult:void 0}:e(n,t(t({},r),{lower:o[o.length-1],lowerOpen:!0}),a)}))}))}(e.trans,e.range,1e4)}),!0)}return i.mutate(e);function h(e){var n,a,s,h=ge.trans,f=e.keys||qn(o,e);if(!f)throw new Error("Keys missing");return"delete"!==(e="add"===e.type||"put"===e.type?t(t({},e),{keys:f}):t({},e)).type&&(e.values=r([],e.values,!0)),e.keys&&(e.keys=r([],e.keys,!0)),n=i,s=f,("add"===(a=e).type?Promise.resolve([]):n.getMany({trans:a.trans,keys:s,cache:"immutable"})).then((function(t){var n=f.map((function(n,r){var i,a,s,f=t[r],p={onerror:null,onsuccess:null};return"delete"===e.type?u.fire.call(p,n,f,h):"add"===e.type||void 0===f?(i=c.fire.call(p,n,e.values[r],h),null==n&&null!=i&&(e.keys[r]=n=i,o.outbound||k(e.values[r],o.keyPath,n))):(i=Bn(f,e.values[r]),(a=d.fire.call(p,i,n,f,h))&&(s=e.values[r],Object.keys(a).forEach((function(e){l(s,e)?s[e]=a[e]:k(s,e,a[e])})))),p}));return i.mutate(e).then((function(r){for(var i=r.failures,o=r.results,a=r.numFailures,s=(r=r.lastResult,0);s<f.length;++s){var u=(o||f)[s],c=n[s];null==u?c.onerror&&c.onerror(i[s]):c.onsuccess&&c.onsuccess("put"===e.type&&t[s]?e.values[s]:u)}return{failures:i,results:o,numFailures:a,lastResult:r}})).catch((function(e){return n.forEach((function(t){return t.onerror&&t.onerror(e)})),Promise.reject(e)}))}))}}})}})}};function zn(e,t,n){try{if(!t)return null;if(t.keys.length<e.length)return null;for(var r=[],i=0,o=0;i<t.keys.length&&o<e.length;++i)0===ct(t.keys[i],e[o])&&(r.push(n?M(t.values[i]):t.values[i]),++o);return r.length===e.length?r:null}catch(e){return null}}var Un={stack:"dbcore",level:-1,create:function(e){return{table:function(n){var r=e.table(n);return t(t({},r),{getMany:function(e){if(!e.cache)return r.getMany(e);var t=zn(e.keys,e.trans._cache,"clone"===e.cache);return t?ke.resolve(t):r.getMany(e).then((function(t){return e.trans._cache={keys:e.keys,values:"clone"===e.cache?M(t):t},t}))},mutate:function(e){return"add"!==e.type&&(e.trans._cache=null),r.mutate(e)}})}}}};function Wn(e,t){return"readonly"===e.trans.mode&&!!e.subscr&&!e.trans.explicit&&"disabled"!==e.trans.db._options.cache&&!t.schema.primaryKey.outbound}function Hn(e,t){switch(e){case"query":return t.values&&!t.unique;case"get":case"getMany":case"count":case"openCursor":return!1}}var Vn={stack:"dbcore",level:0,name:"Observability",create:function(e){var n=e.schema.name,r=new wn(e.MIN_KEY,e.MAX_KEY);return t(t({},e),{transaction:function(t,n,r){if(ge.subscr&&"readonly"!==n)throw new V.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(ge.querier));return e.transaction(t,n,r)},table:function(i){var s=e.table(i),u=s.schema,c=u.primaryKey,l=u.indexes,d=c.extractKey,h=c.outbound,f=c.autoIncrement&&l.filter((function(e){return e.compound&&e.keyPath.includes(c.keyPath)})),p=t(t({},s),{mutate:function(t){function o(e){return e="idb://".concat(n,"/").concat(i,"/").concat(e),m[e]||(m[e]=new wn)}var l,d,h,p=t.trans,m=t.mutatedParts||(t.mutatedParts={}),y=o(""),v=o(":dels"),g=t.type,b="deleteRange"===t.type?[t.range]:"delete"===t.type?[t.keys]:t.values.length<50?[qn(c,t).filter((function(e){return e})),t.values]:[],w=b[0],S=b[1];return b=t.trans._cache,a(w)?(y.addKeys(w),(b="delete"===g||w.length===S.length?zn(w,b):null)||v.addKeys(w),(b||S)&&(l=o,d=b,h=S,u.indexes.forEach((function(e){var t=l(e.name||"");function n(t){return null!=t?e.extractKey(t):null}function r(n){return e.multiEntry&&a(n)?n.forEach((function(e){return t.addKey(e)})):t.addKey(n)}(d||h).forEach((function(e,t){var i=d&&n(d[t]);0!==ct(i,t=h&&n(h[t]))&&(null!=i&&r(i),null!=t&&r(t))}))})))):w?(S={from:null!==(S=w.lower)&&void 0!==S?S:e.MIN_KEY,to:null!==(S=w.upper)&&void 0!==S?S:e.MAX_KEY},v.add(S),y.add(S)):(y.add(r),v.add(r),u.indexes.forEach((function(e){return o(e.name).add(r)}))),s.mutate(t).then((function(e){return!w||"add"!==t.type&&"put"!==t.type||(y.addKeys(e.results),f&&f.forEach((function(n){for(var r=t.values.map((function(e){return n.extractKey(e)})),i=n.keyPath.findIndex((function(e){return e===c.keyPath})),a=0,s=e.results.length;a<s;++a)r[a][i]=e.results[a];o(n.name).addKeys(r)}))),p.mutatedParts=En(p.mutatedParts||{},m),e}))}}),m=(l=function(t){t=(n=t.query).index;var n=n.range;return[t,new wn(null!==(t=n.lower)&&void 0!==t?t:e.MIN_KEY,null!==(n=n.upper)&&void 0!==n?n:e.MAX_KEY)]},{get:function(e){return[c,new wn(e.key)]},getMany:function(e){return[c,(new wn).addKeys(e.keys)]},count:l,query:l,openCursor:l});return o(m).forEach((function(e){p[e]=function(o){var a=!!(p=ge.subscr),u=Wn(ge,s)&&Hn(e,o)?o.obsSet={}:p;if(a){var c=function(e){return e="idb://".concat(n,"/").concat(i,"/").concat(e),u[e]||(u[e]=new wn)},l=c(""),f=c(":dels"),p=(a=(p=m[e](o))[0],p[1]);if(("query"===e&&a.isPrimaryKey&&!o.values?f:c(a.name||"")).add(p),!a.isPrimaryKey){if("count"!==e){var y="query"===e&&h&&o.values&&s.query(t(t({},o),{values:!1}));return s[e].apply(this,arguments).then((function(t){if("query"===e){if(h&&o.values)return y.then((function(e){return e=e.result,l.addKeys(e),t}));var n=o.values?t.result.map(d):t.result;(o.values?l:f).addKeys(n)}else if("openCursor"===e){var r=t,i=o.values;return r&&Object.create(r,{key:{get:function(){return f.addKey(r.primaryKey),r.key}},primaryKey:{get:function(){var e=r.primaryKey;return f.addKey(e),e}},value:{get:function(){return i&&l.addKey(r.primaryKey),r.value}}})}return t}))}f.add(r)}}return s[e].apply(this,arguments)}})),p}})}};function $n(e,n,r){if(0===r.numFailures)return n;if("deleteRange"===n.type)return null;var i=n.keys?n.keys.length:"values"in n&&n.values?n.values.length:1;return r.numFailures===i?null:(n=t({},n),a(n.keys)&&(n.keys=n.keys.filter((function(e,t){return!(t in r.failures)}))),"values"in n&&a(n.values)&&(n.values=n.values.filter((function(e,t){return!(t in r.failures)}))),n)}function Gn(e,t){return n=e,(void 0===(r=t).lower||(r.lowerOpen?0<ct(n,r.lower):0<=ct(n,r.lower)))&&(void 0===t.upper||(t.upperOpen?ct(e,t.upper)<0:ct(e,t.upper)<=0));var n,r}function Xn(e,t,n,r,i,o){if(!n||0===n.length)return e;var s=t.query.index,u=s.multiEntry,c=t.query.range,l=r.schema.primaryKey.extractKey,d=s.extractKey,h=(s.lowLevelIndex||s).extractKey;return n=n.reduce((function(e,n){var r=e,i=[];if("add"===n.type||"put"===n.type)for(var o=new wn,s=n.values.length-1;0<=s;--s){var h,f=n.values[s],p=l(f);o.hasKey(p)||(h=d(f),(u&&a(h)?h.some((function(e){return Gn(e,c)})):Gn(h,c))&&(o.addKey(p),i.push(f)))}switch(n.type){case"add":var m=(new wn).addKeys(t.values?e.map((function(e){return l(e)})):e);r=e.concat(t.values?i.filter((function(e){return e=l(e),!m.hasKey(e)&&(m.addKey(e),!0)})):i.map((function(e){return l(e)})).filter((function(e){return!m.hasKey(e)&&(m.addKey(e),!0)})));break;case"put":var y=(new wn).addKeys(n.values.map((function(e){return l(e)})));r=e.filter((function(e){return!y.hasKey(t.values?l(e):e)})).concat(t.values?i:i.map((function(e){return l(e)})));break;case"delete":var v=(new wn).addKeys(n.keys);r=e.filter((function(e){return!v.hasKey(t.values?l(e):e)}));break;case"deleteRange":var g=n.range;r=e.filter((function(e){return!Gn(l(e),g)}))}return r}),e),n===e?e:(n.sort((function(e,t){return ct(h(e),h(t))||ct(l(e),l(t))})),t.limit&&t.limit<1/0&&(n.length>t.limit?n.length=t.limit:e.length===t.limit&&n.length<t.limit&&(i.dirty=!0)),o?Object.freeze(n):n)}function Yn(e,t){return 0===ct(e.lower,t.lower)&&0===ct(e.upper,t.upper)&&!!e.lowerOpen==!!t.lowerOpen&&!!e.upperOpen==!!t.upperOpen}function Qn(e,t){return function(e,t,n,r){if(void 0===e)return void 0!==t?-1:0;if(void 0===t)return 1;if(0===(t=ct(e,t))){if(n&&r)return 0;if(n)return 1;if(r)return-1}return t}(e.lower,t.lower,e.lowerOpen,t.lowerOpen)<=0&&0<=function(e,t,n,r){if(void 0===e)return void 0!==t?1:0;if(void 0===t)return-1;if(0===(t=ct(e,t))){if(n&&r)return 0;if(n)return-1;if(r)return 1}return t}(e.upper,t.upper,e.upperOpen,t.upperOpen)}function Jn(e,t,n,r){e.subscribers.add(n),r.addEventListener("abort",(function(){var r,i;e.subscribers.delete(n),0===e.subscribers.size&&(r=e,i=t,setTimeout((function(){0===r.subscribers.size&&A(i,r)}),3e3))}))}var Zn={stack:"dbcore",level:0,name:"Cache",create:function(e){var n=e.schema.name;return t(t({},e),{transaction:function(t,r,i){var o,a,s=e.transaction(t,r,i);return"readwrite"===r&&(a=(o=new AbortController).signal,i=function(i){return function(){if(o.abort(),"readwrite"===r){for(var a=new Set,u=0,c=t;u<c.length;u++){var l=c[u],d=Mn["idb://".concat(n,"/").concat(l)];if(d){var h=e.table(l),f=d.optimisticOps.filter((function(e){return e.trans===s}));if(s._explicit&&i&&s.mutatedParts)for(var p=0,m=Object.values(d.queries.query);p<m.length;p++)for(var y=0,v=(w=m[p]).slice();y<v.length;y++)On((S=v[y]).obsSet,s.mutatedParts)&&(A(w,S),S.subscribers.forEach((function(e){return a.add(e)})));else if(0<f.length){d.optimisticOps=d.optimisticOps.filter((function(e){return e.trans!==s}));for(var g=0,b=Object.values(d.queries.query);g<b.length;g++)for(var w,S,k,I=0,x=(w=b[g]).slice();I<x.length;I++)null!=(S=x[I]).res&&s.mutatedParts&&(i&&!S.dirty?(k=Object.isFrozen(S.res),k=Xn(S.res,S.req,f,h,S,k),S.dirty?(A(w,S),S.subscribers.forEach((function(e){return a.add(e)}))):k!==S.res&&(S.res=k,S.promise=ke.resolve({result:k}))):(S.dirty&&A(w,S),S.subscribers.forEach((function(e){return a.add(e)}))))}}}a.forEach((function(e){return e()}))}}},s.addEventListener("abort",i(!1),{signal:a}),s.addEventListener("error",i(!1),{signal:a}),s.addEventListener("complete",i(!0),{signal:a})),s},table:function(r){var i=e.table(r),o=i.schema.primaryKey;return t(t({},i),{mutate:function(e){var a=ge.trans;if(o.outbound||"disabled"===a.db._options.cache||a.explicit||"readwrite"!==a.idbtrans.mode)return i.mutate(e);var s=Mn["idb://".concat(n,"/").concat(r)];return s?(a=i.mutate(e),"add"!==e.type&&"put"!==e.type||!(50<=e.values.length||qn(o,e).some((function(e){return null==e})))?(s.optimisticOps.push(e),e.mutatedParts&&Dn(e.mutatedParts),a.then((function(t){0<t.numFailures&&(A(s.optimisticOps,e),(t=$n(0,e,t))&&s.optimisticOps.push(t),e.mutatedParts&&Dn(e.mutatedParts))})),a.catch((function(){A(s.optimisticOps,e),e.mutatedParts&&Dn(e.mutatedParts)}))):a.then((function(n){var r=$n(0,t(t({},e),{values:e.values.map((function(e,r){var i;return n.failures[r]||k(e=null!==(i=o.keyPath)&&void 0!==i&&i.includes(".")?M(e):t({},e),o.keyPath,n.results[r]),e}))}),n);s.optimisticOps.push(r),queueMicrotask((function(){return e.mutatedParts&&Dn(e.mutatedParts)}))})),a):i.mutate(e)},query:function(e){if(!Wn(ge,i)||!Hn("query",e))return i.query(e);var t="immutable"===(null===(s=ge.trans)||void 0===s?void 0:s.db._options.cache),o=(c=ge).requery,a=c.signal,s=function(e,t,n,r){var i=Mn["idb://".concat(e,"/").concat(t)];if(!i)return[];if(!(t=i.queries[n]))return[null,!1,i,null];var o=t[(r.query?r.query.index.name:null)||""];if(!o)return[null,!1,i,null];switch(n){case"query":var a=o.find((function(e){return e.req.limit===r.limit&&e.req.values===r.values&&Yn(e.req.query.range,r.query.range)}));return a?[a,!0,i,o]:[o.find((function(e){return("limit"in e.req?e.req.limit:1/0)>=r.limit&&(!r.values||e.req.values)&&Qn(e.req.query.range,r.query.range)})),!1,i,o];case"count":return a=o.find((function(e){return Yn(e.req.query.range,r.query.range)})),[a,!!a,i,o]}}(n,r,"query",e),u=s[0],c=s[1],l=s[2],d=s[3];return u&&c?u.obsSet=e.obsSet:(c=i.query(e).then((function(e){var n=e.result;if(u&&(u.res=n),t){for(var r=0,i=n.length;r<i;++r)Object.freeze(n[r]);Object.freeze(n)}else e.result=M(n);return e})).catch((function(e){return d&&u&&A(d,u),Promise.reject(e)})),u={obsSet:e.obsSet,promise:c,subscribers:new Set,type:"query",req:e,dirty:!1},d?d.push(u):(d=[u],(l=l||(Mn["idb://".concat(n,"/").concat(r)]={queries:{query:{},count:{}},objs:new Map,optimisticOps:[],unsignaledParts:{}})).queries.query[e.query.index.name||""]=d)),Jn(u,d,o,a),u.promise.then((function(n){return{result:Xn(n.result,e,null==l?void 0:l.optimisticOps,i,u,t)}}))}})}})}};function er(e,t){return new Proxy(e,{get:function(e,n,r){return"db"===n?t:Reflect.get(e,n,r)}})}var tr=(nr.prototype.version=function(e){if(isNaN(e)||e<.1)throw new V.Type("Given version is not a positive number");if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new V.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,e);var t=this._versions,n=t.filter((function(t){return t._cfg.version===e}))[0];return n||(n=new this.Version(e),t.push(n),t.sort(rn),n.stores({}),this._state.autoSchema=!1,n)},nr.prototype._whenReady=function(e){var t=this;return this.idbdb&&(this._state.openComplete||ge.letThrough||this._vip)?e():new ke((function(e,n){if(t._state.openComplete)return n(new V.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._state.autoOpen)return void n(new V.DatabaseClosed);t.open().catch(X)}t._state.dbReadyPromise.then(e,n)})).then(e)},nr.prototype.use=function(e){var t=e.stack,n=e.create,r=e.level,i=e.name;return i&&this.unuse({stack:t,name:i}),(e=this._middlewares[t]||(this._middlewares[t]=[])).push({stack:t,create:n,level:null==r?10:r,name:i}),e.sort((function(e,t){return e.level-t.level})),this},nr.prototype.unuse=function(e){var t=e.stack,n=e.name,r=e.create;return t&&this._middlewares[t]&&(this._middlewares[t]=this._middlewares[t].filter((function(e){return r?e.create!==r:!!n&&e.name!==n}))),this},nr.prototype.open=function(){var e=this;return Ge(ve,(function(){return Ln(e)}))},nr.prototype._close=function(){var e=this._state,t=tt.indexOf(this);if(0<=t&&tt.splice(t,1),this.idbdb){try{this.idbdb.close()}catch(t){}this.idbdb=null}e.isBeingOpened||(e.dbReadyPromise=new ke((function(t){e.dbReadyResolve=t})),e.openCanceller=new ke((function(t,n){e.cancelOpen=n})))},nr.prototype.close=function(e){var t=(void 0===e?{disableAutoOpen:!0}:e).disableAutoOpen;e=this._state,t?(e.isBeingOpened&&e.cancelOpen(new V.DatabaseClosed),this._close(),e.autoOpen=!1,e.dbOpenError=new V.DatabaseClosed):(this._close(),e.autoOpen=this._options.autoOpen||e.isBeingOpened,e.openComplete=!1,e.dbOpenError=null)},nr.prototype.delete=function(e){var t=this;void 0===e&&(e={disableAutoOpen:!0});var n=0<arguments.length&&"object"!=typeof arguments[0],r=this._state;return new ke((function(i,o){function a(){t.close(e);var n=t._deps.indexedDB.deleteDatabase(t.name);n.onsuccess=Ae((function(){var e,n,r;e=t._deps,n=t.name,r=e.indexedDB,e=e.IDBKeyRange,vn(r)||n===nt||yn(r,e).delete(n).catch(X),i()})),n.onerror=Ft(o),n.onblocked=t._fireOnBlocked}if(n)throw new V.InvalidArgument("Invalid closeOptions argument to db.delete()");r.isBeingOpened?r.dbReadyPromise.then(a):a()}))},nr.prototype.backendDB=function(){return this.idbdb},nr.prototype.isOpen=function(){return null!==this.idbdb},nr.prototype.hasBeenClosed=function(){var e=this._state.dbOpenError;return e&&"DatabaseClosed"===e.name},nr.prototype.hasFailed=function(){return null!==this._state.dbOpenError},nr.prototype.dynamicallyOpened=function(){return this._state.autoSchema},Object.defineProperty(nr.prototype,"tables",{get:function(){var e=this;return o(this._allTables).map((function(t){return e._allTables[t]}))},enumerable:!1,configurable:!0}),nr.prototype.transaction=function(){var e=function(e,t,n){var r=arguments.length;if(r<2)throw new V.InvalidArgument("Too few arguments");for(var i=new Array(r-1);--r;)i[r-1]=arguments[r];return n=i.pop(),[e,_(i),n]}.apply(this,arguments);return this._transaction.apply(this,e)},nr.prototype._transaction=function(e,t,n){var r=this,i=ge.trans;i&&i.db===this&&-1===e.indexOf("!")||(i=null);var o,a,s=-1!==e.indexOf("?");e=e.replace("!","").replace("?","");try{if(a=t.map((function(e){if("string"!=typeof(e=e instanceof r.Table?e.name:e))throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return e})),"r"==e||e===rt)o=rt;else{if("rw"!=e&&e!=it)throw new V.InvalidArgument("Invalid transaction mode: "+e);o=it}if(i){if(i.mode===rt&&o===it){if(!s)throw new V.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");i=null}i&&a.forEach((function(e){if(i&&-1===i.storeNames.indexOf(e)){if(!s)throw new V.SubTransaction("Table "+e+" not included in parent transaction.");i=null}})),s&&i&&!i.active&&(i=null)}}catch(n){return i?i._promise(null,(function(e,t){t(n)})):Qe(n)}var u=function e(t,n,r,i,o){return ke.resolve().then((function(){var a=ge.transless||ge,s=t._createTransaction(n,r,t._dbSchema,i);if(s.explicit=!0,a={trans:s,transless:a},i)s.idbtrans=i.idbtrans;else try{s.create(),s.idbtrans._explicit=!0,t._state.PR1398_maxLoop=3}catch(a){return a.name===W.InvalidState&&t.isOpen()&&0<--t._state.PR1398_maxLoop?(t.close({disableAutoOpen:!1}),t.open().then((function(){return e(t,n,r,null,o)}))):Qe(a)}var u,c=F(o);return c&&ze(),a=ke.follow((function(){var e;(u=o.call(s,s))&&(c?(e=Ue.bind(null,null),u.then(e,e)):"function"==typeof u.next&&"function"==typeof u.throw&&(u=Pn(u)))}),a),(u&&"function"==typeof u.then?ke.resolve(u).then((function(e){return s.active?e:Qe(new V.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))})):a.then((function(){return u}))).then((function(e){return i&&s._resolve(),s._completion.then((function(){return e}))})).catch((function(e){return s._reject(e),Qe(e)}))}))}.bind(null,this,o,a,i,n);return i?i._promise(o,u,"lock"):ge.trans?Ge(ge.transless,(function(){return r._whenReady(u)})):this._whenReady(u)},nr.prototype.table=function(e){if(!l(this._allTables,e))throw new V.InvalidTable("Table ".concat(e," does not exist"));return this._allTables[e]},nr);function nr(e,n){var r=this;this._middlewares={},this.verno=0;var i=nr.dependencies;this._options=n=t({addons:nr.addons,autoOpen:!0,indexedDB:i.indexedDB,IDBKeyRange:i.IDBKeyRange,cache:"cloned"},n),this._deps={indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange},i=n.addons,this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;var o,a,s,u,c,l={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:X,dbReadyPromise:null,cancelOpen:X,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3,autoOpen:n.autoOpen};l.dbReadyPromise=new ke((function(e){l.dbReadyResolve=e})),l.openCanceller=new ke((function(e,t){l.cancelOpen=t})),this._state=l,this.name=e,this.on=pt(this,"populate","blocked","versionchange","close",{ready:[re,X]}),this.on.ready.subscribe=g(this.on.ready.subscribe,(function(e){return function(t,n){nr.vip((function(){var i,o=r._state;o.openComplete?(o.dbOpenError||ke.resolve().then(t),n&&e(t)):o.onReadyBeingFired?(o.onReadyBeingFired.push(t),n&&e(t)):(e(t),i=r,n||e((function e(){i.on.ready.unsubscribe(t),i.on.ready.unsubscribe(e)})))}))}})),this.Collection=(o=this,mt(_t.prototype,(function(e,t){this.db=o;var n=at,r=null;if(t)try{n=t()}catch(e){r=e}var i=e._ctx;e=(t=i.table).hook.reading.fire,this._ctx={table:t,index:i.index,isPrimKey:!i.index||t.schema.primKey.keyPath&&i.index===t.schema.primKey.name,range:n,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:r,or:i.or,valueMapper:e!==Y?e:null}}))),this.Table=(a=this,mt(ht.prototype,(function(e,t,n){this.db=a,this._tx=n,this.name=e,this.schema=t,this.hook=a._allTables[e]?a._allTables[e].hook:pt(null,{creating:[Z,X],reading:[Q,Y],updating:[te,X],deleting:[ee,X]})}))),this.Transaction=(s=this,mt(zt.prototype,(function(e,t,n,r,i){var o=this;this.db=s,this.mode=e,this.storeNames=t,this.schema=n,this.chromeTransactionDurability=r,this.idbtrans=null,this.on=pt(this,"complete","error","abort"),this.parent=i||null,this.active=!0,this._reculock=0,this._blockedFuncs=[],this._resolve=null,this._reject=null,this._waitingFor=null,this._waitingQueue=null,this._spinCount=0,this._completion=new ke((function(e,t){o._resolve=e,o._reject=t})),this._completion.then((function(){o.active=!1,o.on.complete.fire()}),(function(e){var t=o.active;return o.active=!1,o.on.error.fire(e),o.parent?o.parent._reject(e):t&&o.idbtrans&&o.idbtrans.abort(),Qe(e)}))}))),this.Version=(u=this,mt(pn.prototype,(function(e){this.db=u,this._cfg={version:e,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}}))),this.WhereClause=(c=this,mt(Lt.prototype,(function(e,t,n){if(this.db=c,this._ctx={table:e,index:":id"===t?null:t,or:n},this._cmp=this._ascending=ct,this._descending=function(e,t){return ct(t,e)},this._max=function(e,t){return 0<ct(e,t)?e:t},this._min=function(e,t){return ct(e,t)<0?e:t},this._IDBKeyRange=c._deps.IDBKeyRange,!this._IDBKeyRange)throw new V.MissingAPI}))),this.on("versionchange",(function(e){e.newVersion,r.close({disableAutoOpen:!1})})),this.on("blocked",(function(e){!e.newVersion||(e.newVersion,e.oldVersion)})),this._maxKey=$t(n.IDBKeyRange),this._createTransaction=function(e,t,n,i){return new r.Transaction(e,t,n,r._options.chromeTransactionDurability,i)},this._fireOnBlocked=function(e){r.on("blocked").fire(e),tt.filter((function(e){return e.name===r.name&&e!==r&&!e._state.vcFired})).map((function(t){return t.on("versionchange").fire(e)}))},this.use(Un),this.use(Zn),this.use(Vn),this.use(jn),this.use(Kn);var d=new Proxy(this,{get:function(e,t,n){if("_vip"===t)return!0;if("table"===t)return function(e){return er(r.table(e),d)};var i=Reflect.get(e,t,n);return i instanceof ht?er(i,d):"tables"===t?i.map((function(e){return er(e,d)})):"_createTransaction"===t?function(){return er(i.apply(this,arguments),d)}:i}});this.vip=d,i.forEach((function(e){return e(r)}))}j="undefined"!=typeof Symbol&&"observable"in Symbol?Symbol.observable:"@@observable";var rr,ir=(or.prototype.subscribe=function(e,t,n){return this._subscribe(e&&"function"!=typeof e?e:{next:e,error:t,complete:n})},or.prototype[j]=function(){return this},or);function or(e){this._subscribe=e}try{rr={indexedDB:i.indexedDB||i.mozIndexedDB||i.webkitIndexedDB||i.msIndexedDB,IDBKeyRange:i.IDBKeyRange||i.webkitIDBKeyRange}}catch(C){rr={indexedDB:null,IDBKeyRange:null}}function ar(e){var t,n=!1,r=new ir((function(r){var i,o=F(e),a=!1,s={},u={},c={get closed(){return a},unsubscribe:function(){a||(a=!0,i&&i.abort(),d&&Kt.storagemutated.unsubscribe(f))}};r.start&&r.start(c);var d=!1,h=function(){return Ye(p)},f=function(e){En(s,e),On(u,s)&&h()},p=function(){var c,p,m;!a&&rr.indexedDB&&(s={},c={},i&&i.abort(),i=new AbortController,m=function(t){var n=Te();try{o&&ze();var r=Ke(e,t);return r=o?r.finally(Ue):r}finally{n&&Re()}}(p={subscr:c,signal:i.signal,requery:h,querier:e,trans:null}),Promise.resolve(m).then((function(e){n=!0,t=e,a||p.signal.aborted||(s={},function(e){for(var t in e)if(l(e,t))return;return 1}(u=c)||d||(Kt(Bt,f),d=!0),Ye((function(){return!a&&r.next&&r.next(e)})))}),(function(e){n=!1,["DatabaseClosedError","AbortError"].includes(null==e?void 0:e.name)||a||Ye((function(){a||r.error&&r.error(e)}))})))};return setTimeout(h,0),c}));return r.hasValue=function(){return n},r.getValue=function(){return t},r}var sr=tr;function ur(e){var t=lr;try{lr=!0,Kt.storagemutated.fire(e),Nn(e,!0)}finally{lr=t}}d(sr,t(t({},G),{delete:function(e){return new sr(e,{addons:[]}).delete()},exists:function(e){return new sr(e,{addons:[]}).open().then((function(e){return e.close(),!0})).catch("NoSuchDatabaseError",(function(){return!1}))},getDatabaseNames:function(e){try{return n=(t=sr.dependencies).indexedDB,t=t.IDBKeyRange,(vn(n)?Promise.resolve(n.databases()).then((function(e){return e.map((function(e){return e.name})).filter((function(e){return e!==nt}))})):yn(n,t).toCollection().primaryKeys()).then(e)}catch(e){return Qe(new V.MissingAPI)}var t,n},defineClass:function(){return function(e){s(this,e)}},ignoreTransaction:function(e){return ge.trans?Ge(ge.transless,e):e()},vip:gn,async:function(e){return function(){try{var t=Pn(e.apply(this,arguments));return t&&"function"==typeof t.then?t:ke.resolve(t)}catch(t){return Qe(t)}}},spawn:function(e,t,n){try{var r=Pn(e.apply(n,t||[]));return r&&"function"==typeof r.then?r:ke.resolve(r)}catch(e){return Qe(e)}},currentTransaction:{get:function(){return ge.trans||null}},waitFor:function(e,t){return t=ke.resolve("function"==typeof e?sr.ignoreTransaction(e):e).timeout(t||6e4),ge.trans?ge.trans.waitFor(t):t},Promise:ke,debug:{get:function(){return ie},set:function(e){oe(e)}},derive:p,extend:s,props:d,override:g,Events:pt,on:Kt,liveQuery:ar,extendObservabilitySet:En,getByKeyPath:S,setByKeyPath:k,delByKeyPath:function(e,t){"string"==typeof t?k(e,t,void 0):"length"in t&&[].map.call(t,(function(t){k(e,t,void 0)}))},shallowClone:I,deepClone:M,getObjectDiff:Bn,cmp:ct,asap:w,minKey:-1/0,addons:[],connections:tt,errnames:W,dependencies:rr,cache:Mn,semVer:"4.0.11",version:"4.0.11".split(".").map((function(e){return parseInt(e)})).reduce((function(e,t,n){return e+t/Math.pow(10,2*n)}))})),sr.maxKey=$t(sr.dependencies.IDBKeyRange),"undefined"!=typeof dispatchEvent&&"undefined"!=typeof addEventListener&&(Kt(Bt,(function(e){lr||(e=new CustomEvent(qt,{detail:e}),lr=!0,dispatchEvent(e),lr=!1)})),addEventListener(qt,(function(e){e=e.detail,lr||ur(e)})));var cr,lr=!1,dr=function(){};return"undefined"!=typeof BroadcastChannel&&((dr=function(){(cr=new BroadcastChannel(qt)).onmessage=function(e){return e.data&&ur(e.data)}})(),"function"==typeof cr.unref&&cr.unref(),Kt(Bt,(function(e){lr||cr.postMessage(e)}))),"undefined"!=typeof addEventListener&&(addEventListener("pagehide",(function(e){if(!tr.disableBfCache&&e.persisted){null!=cr&&cr.close();for(var t=0,n=tt;t<n.length;t++)n[t].close({disableAutoOpen:!1})}})),addEventListener("pageshow",(function(e){!tr.disableBfCache&&e.persisted&&(dr(),ur({all:new wn(-1/0,[[]])}))}))),ke.rejectionMapper=function(e,t){return!e||e instanceof q||e instanceof TypeError||e instanceof SyntaxError||!e.name||!$[e.name]?e:(t=new $[e.name](t||e.message,e),"stack"in e&&f(t,"stack",{get:function(){return this.inner.stack}}),t)},oe(ie),t(tr,Object.freeze({__proto__:null,Dexie:tr,liveQuery:ar,Entity:ut,cmp:ct,PropModification:It,replacePrefix:function(e,t){return new It({replacePrefix:[e,t]})},add:function(e){return new It({add:e})},remove:function(e){return new It({remove:e})},default:tr,RangeSet:wn,mergeRanges:kn,rangesOverlap:In}),{default:tr}),tr}()}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r].call(o.exports,o,o.exports,n),o.exports}n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}();var r={};return function(){"use strict";const e="betterbugs-sdk-main",t="betterbugs-message-listener",r="STEPS_FEATURE_CLICK_EVENT",i="STEPS_FEATURE_NAVIGATE_EVENT",o="STEPS_FEATURE_TYPED_EVENT",a="STEPS_FEATURE_PRESSED_EVENT";let s=!1;function u(e){s=e}function c(){return s}try{window.setBetterBugsLogging=u}catch(e){globalThis.setBetterBugsLogging=u}try{window.getBetterBugsLogging=c}catch(e){globalThis.getBetterBugsLogging=c}const l={sample(e,t,...n){if(d(n)){}},log:(...e)=>{d(e)},warn:(...e)=>{if(d(e)){}},error:(...e)=>{if(d(e)){}},info:(...e)=>{if(d(e)){}},debug:(...e)=>{d(e)},group:(...e)=>{d(e)},groupCollapsed:(...e)=>{d(e)},groupEnd:(...e)=>{d(e)}};function d(e){return s&&function(e){try{if(!("localStorage"in globalThis)||!globalThis.localStorage.debug)return!0}catch(e){return!0}if("string"!=typeof e[0]||"string"!=typeof globalThis.localStorage.debug)return!0;const t=e[0],n=globalThis.localStorage.debug.replace("*",".*");return new RegExp("^"+n).test(t)}(e)}var h,f="user-agent",p="",m="function",y="undefined",v="object",g="string",b="browser",w="cpu",S="device",k="engine",I="os",x="result",_="name",C="type",E="vendor",O="version",M="architecture",T="major",R="model",D="console",N="mobile",A="tablet",L="smarttv",P="wearable",F="xr",j="embedded",B="inapp",q="brands",K="formFactors",z="fullVersionList",U="platform",W="platformVersion",H="bitness",V="sec-ch-ua",$=V+"-full-version-list",G=V+"-arch",X=V+"-"+H,Y=V+"-form-factors",Q=V+"-"+N,J=V+"-"+R,Z=V+"-"+U,ee=Z+"-version",te=[q,z,N,R,U,W,M,K,H],ne="Amazon",re="Apple",ie="ASUS",oe="BlackBerry",ae="Google",se="Huawei",ue="Lenovo",ce="Honor",le="LG",de="Microsoft",he="Motorola",fe="Nvidia",pe="OnePlus",me="OPPO",ye="Samsung",ve="Sharp",ge="Sony",be="Xiaomi",we="Zebra",Se="Chrome",ke="Chromium",Ie="Chromecast",xe="Firefox",_e="Opera",Ce="Facebook",Ee="Sogou",Oe="Mobile ",Me=" Browser",Te="Windows",Re=typeof window!==y&&window.navigator?window.navigator:void 0,De=Re&&Re.userAgentData?Re.userAgentData:void 0,Ne=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},Ae=function(e,t){if(typeof e===v&&e.length>0){for(var n in e)if(je(e[n])==je(t))return!0;return!1}return!!Pe(e)&&-1!==je(t).indexOf(je(e))},Le=function(e,t){for(var n in e)return/^(browser|cpu|device|engine|os)$/.test(n)||!!t&&Le(e[n])},Pe=function(e){return typeof e===g},Fe=function(e){if(e){for(var t=[],n=Ke(/\\?\"/g,e).split(","),r=0;r<n.length;r++)if(n[r].indexOf(";")>-1){var i=Ue(n[r]).split(";v=");t[r]={brand:i[0],version:i[1]}}else t[r]=Ue(n[r]);return t}},je=function(e){return Pe(e)?e.toLowerCase():e},Be=function(e){return Pe(e)?Ke(/[^\d\.]/g,e).split(".")[0]:void 0},qe=function(e){for(var t in e){var n=e[t];typeof n==v&&2==n.length?this[n[0]]=n[1]:this[n]=void 0}return this},Ke=function(e,t){return Pe(t)?t.replace(e,p):t},ze=function(e){return Ke(/\\?\"/g,e)},Ue=function(e,t){if(Pe(e))return e=Ke(/^\s\s*/,e),typeof t===y?e:e.substring(0,500)},We=function(e,t){if(e&&t)for(var n,r,i,o,a,s,u=0;u<t.length&&!a;){var c=t[u],l=t[u+1];for(n=r=0;n<c.length&&!a&&c[n];)if(a=c[n++].exec(e))for(i=0;i<l.length;i++)s=a[++r],typeof(o=l[i])===v&&o.length>0?2===o.length?typeof o[1]==m?this[o[0]]=o[1].call(this,s):this[o[0]]=o[1]:3===o.length?typeof o[1]!==m||o[1].exec&&o[1].test?this[o[0]]=s?s.replace(o[1],o[2]):void 0:this[o[0]]=s?o[1].call(this,s,o[2]):void 0:4===o.length&&(this[o[0]]=s?o[3].call(this,s.replace(o[1],o[2])):void 0):this[o]=s||void 0;u+=2}},He=function(e,t){for(var n in t)if(typeof t[n]===v&&t[n].length>0){for(var r=0;r<t[n].length;r++)if(Ae(t[n][r],e))return"?"===n?void 0:n}else if(Ae(t[n],e))return"?"===n?void 0:n;return t.hasOwnProperty("*")?t["*"]:e},Ve={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},$e={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},Ge={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[O,[_,Oe+"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[O,[_,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[_,O],[/opios[\/ ]+([\w\.]+)/i],[O,[_,_e+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[O,[_,_e+" GX"]],[/\bopr\/([\w\.]+)/i],[O,[_,_e]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[O,[_,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[O,[_,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon|otter|dooble|(?:lg |qute)browser)\/([-\w\.]+)/i,/(heytap|ovi|115|surf)browser\/([\d\.]+)/i,/(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i],[_,O],[/quark(?:pc)?\/([-\w\.]+)/i],[O,[_,"Quark"]],[/\bddg\/([\w\.]+)/i],[O,[_,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[O,[_,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[O,[_,"WeChat"]],[/konqueror\/([\w\.]+)/i],[O,[_,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[O,[_,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[O,[_,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[O,[_,"Smart "+ue+Me]],[/(avast|avg)\/([\w\.]+)/i],[[_,/(.+)/,"$1 Secure"+Me],O],[/\bfocus\/([\w\.]+)/i],[O,[_,xe+" Focus"]],[/\bopt\/([\w\.]+)/i],[O,[_,_e+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[O,[_,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[O,[_,"Dolphin"]],[/coast\/([\w\.]+)/i],[O,[_,_e+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[O,[_,"MIUI"+Me]],[/fxios\/([\w\.-]+)/i],[O,[_,Oe+xe]],[/\bqihoobrowser\/?([\w\.]*)/i],[O,[_,"360"]],[/\b(qq)\/([\w\.]+)/i],[[_,/(.+)/,"$1Browser"],O],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[_,/(.+)/,"$1"+Me],O],[/samsungbrowser\/([\w\.]+)/i],[O,[_,ye+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[O,[_,Ee+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[_,Ee+" Mobile"],O],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[_,O],[/(lbbrowser|rekonq)/i],[_],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[O,_],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[_,Ce],O,[C,B]],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(instagram|snapchat)[\/ ]([-\w\.]+)/i],[_,O,[C,B]],[/\bgsa\/([\w\.]+) .*safari\//i],[O,[_,"GSA"],[C,B]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[O,[_,"TikTok"],[C,B]],[/\[(linkedin)app\]/i],[_,[C,B]],[/(chromium)[\/ ]([-\w\.]+)/i],[_,O],[/headlesschrome(?:\/([\w\.]+)| )/i],[O,[_,Se+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[_,Se+" WebView"],O],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[O,[_,"Android"+Me]],[/chrome\/([\w\.]+) mobile/i],[O,[_,Oe+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[_,O],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[O,[_,Oe+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[_,Oe+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[O,_],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[_,[O,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[_,O],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[_,Oe+xe],O],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[_,"Netscape"],O],[/(wolvic|librewolf)\/([\w\.]+)/i],[_,O],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[O,[_,xe+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[_,[O,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[_,[O,/[^\d\.]+./,p]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[M,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[M,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[M,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[M,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[M,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[M,/ower/,p,je]],[/ sun4\w[;\)]/i],[[M,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[M,je]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[R,[E,ye],[C,A]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[R,[E,ye],[C,N]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[R,[E,re],[C,N]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[R,[E,re],[C,A]],[/(macintosh);/i],[R,[E,re]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[R,[E,ve],[C,N]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[R,[E,ce],[C,A]],[/honor([-\w ]+)[;\)]/i],[R,[E,ce],[C,N]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[R,[E,se],[C,A]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[R,[E,se],[C,N]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[R,/_/g," "],[E,be],[C,A]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[R,/_/g," "],[E,be],[C,N]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[R,[E,me],[C,N]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[R,[E,He,{OnePlus:["304","403","203"],"*":me}],[C,A]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[R,[E,"BLU"],[C,N]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[R,[E,"Vivo"],[C,N]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[R,[E,"Realme"],[C,N]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto(?! 360)[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[R,[E,he],[C,N]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[R,[E,he],[C,A]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[R,[E,le],[C,A]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch))(\w+)/i,/\blg-?([\d\w]+) bui/i],[R,[E,le],[C,N]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[R,[E,ue],[C,A]],[/(nokia) (t[12][01])/i],[E,R,[C,A]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[R,/_/g," "],[C,N],[E,"Nokia"]],[/(pixel (c|tablet))\b/i],[R,[E,ae],[C,A]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[R,[E,ae],[C,N]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[R,[E,ge],[C,N]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[R,"Xperia Tablet"],[E,ge],[C,A]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[R,[E,pe],[C,N]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[R,[E,ne],[C,A]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[R,/(.+)/g,"Fire Phone $1"],[E,ne],[C,N]],[/(playbook);[-\w\),; ]+(rim)/i],[R,E,[C,A]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[R,[E,oe],[C,N]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[R,[E,ie],[C,A]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[R,[E,ie],[C,N]],[/(nexus 9)/i],[R,[E,"HTC"],[C,A]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[E,[R,/_/g," "],[C,N]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[R,[E,"TCL"],[C,A]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[R,[E,"TCL"],[C,N]],[/(itel) ((\w+))/i],[[E,je],R,[C,He,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[R,[E,"Acer"],[C,A]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[R,[E,"Meizu"],[C,N]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[R,[E,"Ulefone"],[C,N]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[R,[E,"Energizer"],[C,N]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[R,[E,"Cat"],[C,N]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[R,[E,"Smartfren"],[C,N]],[/droid.+; (a(?:015|06[35]|142p?))/i],[R,[E,"Nothing"],[C,N]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[R,[E,"Archos"],[C,A]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[R,[E,"Archos"],[C,N]],[/(imo) (tab \w+)/i,/(infinix) (x1101b?)/i],[E,R,[C,A]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (blu|hmd|imo|tcl)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i,/(oppo) ?([\w ]+) bui/i],[E,R,[C,N]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[E,R,[C,A]],[/(surface duo)/i],[R,[E,de],[C,A]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[R,[E,"Fairphone"],[C,N]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[R,[E,fe],[C,A]],[/(sprint) (\w+)/i],[E,R,[C,N]],[/(kin\.[onetw]{3})/i],[[R,/\./g," "],[E,de],[C,N]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[R,[E,we],[C,A]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[R,[E,we],[C,N]],[/smart-tv.+(samsung)/i],[E,[C,L]],[/hbbtv.+maple;(\d+)/i],[[R,/^/,"SmartTV"],[E,ye],[C,L]],[/tcast.+(lg)e?. ([-\w]+)/i],[E,R,[C,L]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[E,le],[C,L]],[/(apple) ?tv/i],[E,[R,re+" TV"],[C,L]],[/crkey.*devicetype\/chromecast/i],[[R,Ie+" Third Generation"],[E,ae],[C,L]],[/crkey.*devicetype\/([^/]*)/i],[[R,/^/,"Chromecast "],[E,ae],[C,L]],[/fuchsia.*crkey/i],[[R,Ie+" Nest Hub"],[E,ae],[C,L]],[/crkey/i],[[R,Ie],[E,ae],[C,L]],[/(portaltv)/i],[R,[E,Ce],[C,L]],[/droid.+aft(\w+)( bui|\))/i],[R,[E,ne],[C,L]],[/(shield \w+ tv)/i],[R,[E,fe],[C,L]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[R,[E,ve],[C,L]],[/(bravia[\w ]+)( bui|\))/i],[R,[E,ge],[C,L]],[/(mi(tv|box)-?\w+) bui/i],[R,[E,be],[C,L]],[/Hbbtv.*(technisat) (.*);/i],[E,R,[C,L]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[E,Ue],[R,Ue],[C,L]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[R,[C,L]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[C,L]],[/(ouya)/i,/(nintendo) (\w+)/i],[E,R,[C,D]],[/droid.+; (shield)( bui|\))/i],[R,[E,fe],[C,D]],[/(playstation \w+)/i],[R,[E,ge],[C,D]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[R,[E,de],[C,D]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[R,[E,ye],[C,P]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[E,R,[C,P]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[R,[E,me],[C,P]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[R,[E,re],[C,P]],[/(opwwe\d{3})/i],[R,[E,pe],[C,P]],[/(moto 360)/i],[R,[E,he],[C,P]],[/(smartwatch 3)/i],[R,[E,ge],[C,P]],[/(g watch r)/i],[R,[E,le],[C,P]],[/droid.+; (wt63?0{2,3})\)/i],[R,[E,we],[C,P]],[/droid.+; (glass) \d/i],[R,[E,ae],[C,F]],[/(pico) (4|neo3(?: link|pro)?)/i],[E,R,[C,F]],[/(quest( \d| pro)?s?).+vr/i],[R,[E,Ce],[C,F]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[E,[C,j]],[/(aeobc)\b/i],[R,[E,ne],[C,j]],[/(homepod).+mac os/i],[R,[E,re],[C,j]],[/windows iot/i],[[C,j]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i],[R,[C,He,{mobile:"Mobile",xr:"VR","*":A}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[C,A]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[C,N]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[R,[E,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[O,[_,"EdgeHTML"]],[/(arkweb)\/([\w\.]+)/i],[_,O],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[O,[_,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[_,O],[/ladybird\//i],[[_,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[O,_]],os:[[/microsoft (windows) (vista|xp)/i],[_,O],[/(windows (?:phone(?: os)?|mobile|iot))[\/ ]?([\d\.\w ]*)/i],[_,[O,He,Ve]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[O,He,Ve],[_,Te]],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[O,/_/g,"."],[_,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[_,"macOS"],[O,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[O,[_,Ie+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[O,[_,Ie+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[O,[_,Ie+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[O,[_,Ie+" Linux"]],[/crkey\/([\d\.]+)/i],[O,[_,Ie]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[O,_],[/(ubuntu) ([\w\.]+) like android/i],[[_,/(.+)/,"$1 Touch"],O],[/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen|webos)\w*[-\/\.; ]?([\d\.]*)/i],[_,O],[/\(bb(10);/i],[O,[_,oe]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[O,[_,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[O,[_,xe+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[O,[_,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[O,[_,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[_,"Chrome OS"],O],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux)(?: arm\w*| x86\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[_,O],[/(sunos) ?([\w\.\d]*)/i],[[_,"Solaris"],O],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[_,O]]},Xe=(qe.call((h={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}}).init,[[b,[_,O,T,C]],[w,[M]],[S,[C,R,E]],[k,[_,O]],[I,[_,O]]]),qe.call(h.isIgnore,[[b,[O,T]],[k,[O]],[I,[O]]]),qe.call(h.isIgnoreRgx,[[b,/ ?browser$/i],[I,/ ?os$/i]]),qe.call(h.toString,[[b,[_,O]],[w,[M]],[S,[E,R]],[k,[_,O]],[I,[_,O]]]),h),Ye=function(e,t){var n=Xe.init[t],r=Xe.isIgnore[t]||0,i=Xe.isIgnoreRgx[t]||0,o=Xe.toString[t]||0;function a(){qe.call(this,n)}return a.prototype.getItem=function(){return e},a.prototype.withClientHints=function(){return De?De.getHighEntropyValues(te).then((function(t){return e.setCH(new Qe(t,!1)).parseCH().get()})):e.parseCH().get()},a.prototype.withFeatureCheck=function(){return e.detectFeature().get()},t!=x&&(a.prototype.is=function(e){var t=!1;for(var n in this)if(this.hasOwnProperty(n)&&!Ae(r,n)&&je(i?Ke(i,this[n]):this[n])==je(i?Ke(i,e):e)){if(t=!0,e!=y)break}else if(e==y&&t){t=!t;break}return t},a.prototype.toString=function(){var e=p;for(var t in o)typeof this[o[t]]!==y&&(e+=(e?" ":p)+this[o[t]]);return e||y}),De||(a.prototype.then=function(e){var t=this,n=function(){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e])};n.prototype={is:a.prototype.is,toString:a.prototype.toString};var r=new n;return e(r),r}),new a};function Qe(e,t){if(e=e||{},qe.call(this,te),t)qe.call(this,[[q,Fe(e[V])],[z,Fe(e[$])],[N,/\?1/.test(e[Q])],[R,ze(e[J])],[U,ze(e[Z])],[W,ze(e[ee])],[M,ze(e[G])],[K,Fe(e[Y])],[H,ze(e[X])]]);else for(var n in e)this.hasOwnProperty(n)&&typeof e[n]!==y&&(this[n]=e[n])}function Je(e,t,n,r){return this.get=function(e){return e?this.data.hasOwnProperty(e)?this.data[e]:void 0:this.data},this.set=function(e,t){return this.data[e]=t,this},this.setCH=function(e){return this.uaCH=e,this},this.detectFeature=function(){if(Re&&Re.userAgent==this.ua)switch(this.itemType){case b:Re.brave&&typeof Re.brave.isBrave==m&&this.set(_,"Brave");break;case S:!this.get(C)&&De&&De[N]&&this.set(C,N),"Macintosh"==this.get(R)&&Re&&typeof Re.standalone!==y&&Re.maxTouchPoints&&Re.maxTouchPoints>2&&this.set(R,"iPad").set(C,A);break;case I:!this.get(_)&&De&&De[U]&&this.set(_,De[U]);break;case x:var e=this.data,t=function(t){return e[t].getItem().detectFeature().get()};this.set(b,t(b)).set(w,t(w)).set(S,t(S)).set(k,t(k)).set(I,t(I))}return this},this.parseUA=function(){return this.itemType!=x&&We.call(this.data,this.ua,this.rgxMap),this.itemType==b&&this.set(T,Be(this.get(O))),this},this.parseCH=function(){var e=this.uaCH,t=this.rgxMap;switch(this.itemType){case b:case k:var n,r=e[z]||e[q];if(r)for(var i in r){var o=r[i].brand||r[i],a=r[i].version;this.itemType!=b||/not.a.brand/i.test(o)||n&&(!/chrom/i.test(n)||o==ke)||(o=He(o,{Chrome:"Google Chrome",Edge:"Microsoft Edge","Chrome WebView":"Android WebView","Chrome Headless":"HeadlessChrome","Huawei Browser":"HuaweiBrowser","MIUI Browser":"Miui Browser","Opera Mobi":"OperaMobile",Yandex:"YaBrowser"}),this.set(_,o).set(O,a).set(T,Be(a)),n=o),this.itemType==k&&o==ke&&this.set(O,a)}break;case w:var s=e[M];s&&(s&&"64"==e[H]&&(s+="64"),We.call(this.data,s+";",t));break;case S:if(e[N]&&this.set(C,N),e[R]&&(this.set(R,e[R]),!this.get(C)||!this.get(E))){var u={};We.call(u,"droid 9; "+e[R]+")",t),!this.get(C)&&u.type&&this.set(C,u.type),!this.get(E)&&u.vendor&&this.set(E,u.vendor)}if(e[K]){var c;if("string"!=typeof e[K])for(var l=0;!c&&l<e[K].length;)c=He(e[K][l++],$e);else c=He(e[K],$e);this.set(C,c)}break;case I:var d=e[U];if(d){var h=e[W];d==Te&&(h=parseInt(Be(h),10)>=13?"11":"10"),this.set(_,d).set(O,h)}this.get(_)==Te&&"Xbox"==e[R]&&this.set(_,"Xbox").set(O,void 0);break;case x:var f=this.data,p=function(t){return f[t].getItem().setCH(e).parseCH().get()};this.set(b,p(b)).set(w,p(w)).set(S,p(S)).set(k,p(k)).set(I,p(I))}return this},qe.call(this,[["itemType",e],["ua",t],["uaCH",r],["rgxMap",n],["data",Ye(this,e)]]),this}function Ze(e,t,n){if(typeof e===v?(Le(e,!0)?(typeof t===v&&(n=t),t=e):(n=e,t=void 0),e=void 0):typeof e!==g||Le(t,!0)||(n=t,t=void 0),n&&typeof n.append===m){var r={};n.forEach((function(e,t){r[t]=e})),n=r}if(!(this instanceof Ze))return new Ze(e,t,n).getResult();var i=typeof e===g?e:n&&n[f]?n[f]:Re&&Re.userAgent?Re.userAgent:p,o=new Qe(n,!0),a=t?function(e,t){var n={},r=t;if(!Le(t))for(var i in r={},t)for(var o in t[i])r[o]=t[i][o].concat(r[o]?r[o]:[]);for(var a in e)n[a]=r[a]&&r[a].length%2==0?r[a].concat(e[a]):e[a];return n}(Ge,t):Ge,s=function(e){return e==x?function(){return new Je(e,i,a,o).set("ua",i).set(b,this.getBrowser()).set(w,this.getCPU()).set(S,this.getDevice()).set(k,this.getEngine()).set(I,this.getOS()).get()}:function(){return new Je(e,i,a[e],o).parseUA().get()}};return qe.call(this,[["getBrowser",s(b)],["getCPU",s(w)],["getDevice",s(S)],["getEngine",s(k)],["getOS",s(I)],["getResult",s(x)],["getUA",function(){return i}],["setUA",function(e){return Pe(e)&&(i=e.length>500?Ue(e,500):e),this}]]).setUA(i),this}Ze.VERSION="2.0.3",Ze.BROWSER=Ne([_,O,T,C]),Ze.CPU=Ne([M]),Ze.DEVICE=Ne([R,E,C,D,N,L,A,P,j]),Ze.ENGINE=Ze.OS=Ne([_,O]);const et=e=>{try{return JSON.parse(JSON.stringify(e))}catch(t){return e}},tt=()=>((new Date).getTime()/1e3|0).toString(16)+Math.floor(16777216*Math.random()).toString(16).padStart(6,"0")+Math.floor(65536*Math.random()).toString(16).padStart(4,"0")+Math.floor(16777216*Math.random()).toString(16).padStart(6,"0"),nt=(e,t=60)=>e&&e.length>t?`${e.substring(0,t-1)}...`:e;const rt=()=>(sessionStorage.getItem("tabId")||sessionStorage.setItem("tabId",tt()),sessionStorage.getItem("tabId")||"");var it;function ot(e){return e.nodeType===e.ELEMENT_NODE}function at(e){const t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}function st(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function ut(e){try{const n=e.rules||e.cssRules;return n?((t=Array.from(n,ct).join("")).includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),t):null}catch(e){return null}var t}function ct(e){let t;if(function(e){return"styleSheet"in e}(e))try{t=ut(e.styleSheet)||function(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const n=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?n.push("layer"):e.layerName&&n.push(`layer(${e.layerName})`),e.supportsText&&n.push(`supports(${e.supportsText})`),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}(e)}catch(e){}else if(function(e){return"selectorText"in e}(e)&&e.selectorText.includes(":"))return function(e){const t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}(e.cssText);return t||e.cssText}!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"}(it||(it={}));class lt{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var t;if(!e)return-1;const n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e)))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function dt({element:e,maskInputOptions:t,tagName:n,type:r,value:i,maskInputFn:o}){let a=i||"";const s=r&&ht(r);return(t[n.toLowerCase()]||s&&t[s])&&(a=o?o(a,e):"*".repeat(a.length)),a}function ht(e){return e.toLowerCase()}const ft="__rrweb_original__";function pt(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?ht(t):null}function mt(e,t){var n;let r;try{r=new URL(e,null!=t?t:window.location.href)}catch(e){return null}const i=r.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(n=null==i?void 0:i[1])&&void 0!==n?n:null}let yt=1;const vt=new RegExp("[^a-z0-9-_:]");function gt(){return yt++}let bt,wt;const St=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,kt=/^(?:[a-z+]+:)?\/\//i,It=/^www\..*/i,xt=/^(data:)([^,]*),(.*)/i;function _t(e,t){return(e||"").replace(St,((e,n,r,i,o,a)=>{const s=r||o||a,u=n||i||"";if(!s)return e;if(kt.test(s)||It.test(s))return`url(${u}${s}${u})`;if(xt.test(s))return`url(${u}${s}${u})`;if("/"===s[0])return`url(${u}${function(e){let t="";return t=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],t=t.split("?")[0],t}(t)+s}${u})`;const c=t.split("/"),l=s.split("/");c.pop();for(const e of l)"."!==e&&(".."===e?c.pop():c.push(e));return`url(${u}${c.join("/")}${u})`}))}const Ct=/^[^ \t\n\r\u000c]+/,Et=/^[, \t\n\r\u000c]+/;function Ot(e,t){if(!t||""===t.trim())return t;const n=e.createElement("a");return n.href=t,n.href}function Mt(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function Tt(){const e=document.createElement("a");return e.href="",e.href}function Rt(e,t,n,r){return r?"src"===n||"href"===n&&("use"!==t||"#"!==r[0])||"xlink:href"===n&&"#"!==r[0]?Ot(e,r):"background"!==n||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n?function(e,t){if(""===t.trim())return t;let n=0;function r(e){let r;const i=e.exec(t.substring(n));return i?(r=i[0],n+=r.length,r):""}const i=[];for(;r(Et),!(n>=t.length);){let o=r(Ct);if(","===o.slice(-1))o=Ot(e,o.substring(0,o.length-1)),i.push(o);else{let r="";o=Ot(e,o);let a=!1;for(;;){const e=t.charAt(n);if(""===e){i.push((o+r).trim());break}if(a)")"===e&&(a=!1);else{if(","===e){n+=1,i.push((o+r).trim());break}"("===e&&(a=!0)}r+=e,n+=1}}}return i.join(", ")}(e,r):"style"===n?_t(r,Tt()):"object"===t&&"data"===n?Ot(e,r):r:Ot(e,r):r}function Dt(e,t,n){return("video"===e||"audio"===e)&&"autoplay"===t}function Nt(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&Nt(e.parentNode,t,n);for(let n=e.classList.length;n--;){const r=e.classList[n];if(t.test(r))return!0}return!!n&&Nt(e.parentNode,t,n)}function At(e,t,n,r){try{const i=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===i)return!1;if("string"==typeof t){if(r){if(i.closest(`.${t}`))return!0}else if(i.classList.contains(t))return!0}else if(Nt(i,t,r))return!0;if(n)if(r){if(i.closest(n))return!0}else if(i.matches(n))return!0}catch(e){}return!1}function Lt(e,t){const{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:a,inlineStylesheet:s,maskInputOptions:u={},maskTextFn:c,maskInputFn:l,dataURLOptions:d={},inlineImages:h,recordCanvas:f,keepIframeSrcFn:p,newlyAddedElement:m=!1}=t,y=function(e,t){if(!t.hasNode(e))return;const n=t.getId(e);return 1===n?void 0:n}(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:it.Document,childNodes:[],compatMode:e.compatMode}:{type:it.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:it.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:y};case e.ELEMENT_NODE:return function(e,t){const{doc:n,blockClass:r,blockSelector:i,inlineStylesheet:o,maskInputOptions:a={},maskInputFn:s,dataURLOptions:u={},inlineImages:c,recordCanvas:l,keepIframeSrcFn:d,newlyAddedElement:h=!1,rootId:f}=t,p=function(e,t,n){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){const r=e.classList[n];if(t.test(r))return!0}if(n)return e.matches(n)}catch(e){}return!1}(e,r,i),m=function(e){if(e instanceof HTMLFormElement)return"form";const t=ht(e.tagName);return vt.test(t)?"div":t}(e);let y={};const v=e.attributes.length;for(let t=0;t<v;t++){const r=e.attributes[t];Dt(m,r.name,r.value)||(y[r.name]=Rt(n,m,ht(r.name),r.value))}if("link"===m&&o){const t=Array.from(n.styleSheets).find((t=>t.href===e.href));let r=null;t&&(r=ut(t)),r&&(delete y.rel,delete y.href,y._cssText=_t(r,t.href))}if("style"===m&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){const t=ut(e.sheet);t&&(y._cssText=_t(t,Tt()))}if("input"===m||"textarea"===m||"select"===m){const t=e.value,n=e.checked;"radio"!==y.type&&"checkbox"!==y.type&&"submit"!==y.type&&"button"!==y.type&&t?y.value=dt({element:e,type:pt(e),tagName:m,value:t,maskInputOptions:a,maskInputFn:s}):n&&(y.checked=n)}"option"===m&&(e.selected&&!a.select?y.selected=!0:delete y.selected);if("canvas"===m&&l)if("2d"===e.__context)(function(e){const t=e.getContext("2d");if(!t)return!0;for(let n=0;n<e.width;n+=50)for(let r=0;r<e.height;r+=50){const i=t.getImageData,o=ft in i?i[ft]:i;if(new Uint32Array(o.call(t,n,r,Math.min(50,e.width-n),Math.min(50,e.height-r)).data.buffer).some((e=>0!==e)))return!1}return!0})(e)||(y.rr_dataURL=e.toDataURL(u.type,u.quality));else if(!("__context"in e)){const t=e.toDataURL(u.type,u.quality),n=document.createElement("canvas");n.width=e.width,n.height=e.height;t!==n.toDataURL(u.type,u.quality)&&(y.rr_dataURL=t)}if("img"===m&&c){bt||(bt=n.createElement("canvas"),wt=bt.getContext("2d"));const t=e,r=t.crossOrigin;t.crossOrigin="anonymous";const i=()=>{t.removeEventListener("load",i);try{bt.width=t.naturalWidth,bt.height=t.naturalHeight,wt.drawImage(t,0,0),y.rr_dataURL=bt.toDataURL(u.type,u.quality)}catch(e){}r?y.crossOrigin=r:t.removeAttribute("crossorigin")};t.complete&&0!==t.naturalWidth?i():t.addEventListener("load",i)}"audio"!==m&&"video"!==m||(y.rr_mediaState=e.paused?"paused":"played",y.rr_mediaCurrentTime=e.currentTime);h||(e.scrollLeft&&(y.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(y.rr_scrollTop=e.scrollTop));if(p){const{width:t,height:n}=e.getBoundingClientRect();y={class:y.class,rr_width:`${t}px`,rr_height:`${n}px`}}"iframe"!==m||d(y.src)||(e.test||(y.rr_src=y.src),delete y.src);let g;try{customElements.get(m)&&(g=!0)}catch(e){}return{type:it.Element,tagName:m,attributes:y,childNodes:[],isSVG:Mt(e)||void 0,needBlock:p,rootId:f,isCustom:g}}(e,{doc:n,blockClass:i,blockSelector:o,inlineStylesheet:s,maskInputOptions:u,maskInputFn:l,dataURLOptions:d,inlineImages:h,recordCanvas:f,keepIframeSrcFn:p,newlyAddedElement:m,rootId:y});case e.TEXT_NODE:return function(e,t){var n;const{needsMask:r,maskTextFn:i,rootId:o}=t,a=e.parentNode&&e.parentNode.tagName;let s=e.textContent;const u="STYLE"===a||void 0,c="SCRIPT"===a||void 0;if(u&&s){try{e.nextSibling||e.previousSibling||(null===(n=e.parentNode.sheet)||void 0===n?void 0:n.cssRules)&&(s=ut(e.parentNode.sheet))}catch(e){}s=_t(s,Tt())}c&&(s="SCRIPT_PLACEHOLDER");!u&&!c&&s&&r&&(s=i?i(s,e.parentElement):s.replace(/[\S]/g,"*"));return{type:it.Text,textContent:s||"",isStyle:u,rootId:o}}(e,{needsMask:a,maskTextFn:c,rootId:y});case e.CDATA_SECTION_NODE:return{type:it.CDATA,textContent:"",rootId:y};case e.COMMENT_NODE:return{type:it.Comment,textContent:e.textContent||"",rootId:y};default:return!1}}function Pt(e){return null==e?"":e.toLowerCase()}function Ft(e,t){const{doc:n,mirror:r,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:s,skipChild:u=!1,inlineStylesheet:c=!0,maskInputOptions:l={},maskTextFn:d,maskInputFn:h,slimDOMOptions:f,dataURLOptions:p={},inlineImages:m=!1,recordCanvas:y=!1,onSerialize:v,onIframeLoad:g,iframeLoadTimeout:b=5e3,onStylesheetLoad:w,stylesheetLoadTimeout:S=5e3,keepIframeSrcFn:k=()=>!1,newlyAddedElement:I=!1}=t;let{needsMask:x}=t,{preserveWhiteSpace:_=!0}=t;if(!x&&e.childNodes){x=At(e,a,s,void 0===x)}const C=Lt(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:x,inlineStylesheet:c,maskInputOptions:l,maskTextFn:d,maskInputFn:h,dataURLOptions:p,inlineImages:m,recordCanvas:y,keepIframeSrcFn:k,newlyAddedElement:I});if(!C)return null;let E;E=r.hasNode(e)?r.getId(e):!function(e,t){if(t.comment&&e.type===it.Comment)return!0;if(e.type===it.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel||"modulepreload"===e.attributes.rel)&&"script"===e.attributes.as||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&"js"===mt(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(Pt(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===Pt(e.attributes.name)||"icon"===Pt(e.attributes.rel)||"apple-touch-icon"===Pt(e.attributes.rel)||"shortcut icon"===Pt(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&Pt(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(Pt(e.attributes.property).match(/^(og|twitter|fb):/)||Pt(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===Pt(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===Pt(e.attributes.name)||"googlebot"===Pt(e.attributes.name)||"bingbot"===Pt(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===Pt(e.attributes.name)||"generator"===Pt(e.attributes.name)||"framework"===Pt(e.attributes.name)||"publisher"===Pt(e.attributes.name)||"progid"===Pt(e.attributes.name)||Pt(e.attributes.property).match(/^article:/)||Pt(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===Pt(e.attributes.name)||"yandex-verification"===Pt(e.attributes.name)||"csrf-token"===Pt(e.attributes.name)||"p:domain_verify"===Pt(e.attributes.name)||"verify-v1"===Pt(e.attributes.name)||"verification"===Pt(e.attributes.name)||"shopify-checkout-api-token"===Pt(e.attributes.name)))return!0}}return!1}(C,f)&&(_||C.type!==it.Text||C.isStyle||C.textContent.replace(/^\s+|\s+$/gm,"").length)?gt():-2;const O=Object.assign(C,{id:E});if(r.add(e,O),-2===E)return null;v&&v(e);let M=!u;if(O.type===it.Element){M=M&&!O.needBlock,delete O.needBlock;const t=e.shadowRoot;t&&st(t)&&(O.isShadowHost=!0)}if((O.type===it.Document||O.type===it.Element)&&M){f.headWhitespace&&O.type===it.Element&&"head"===O.tagName&&(_=!1);const t={doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:x,maskTextClass:a,maskTextSelector:s,skipChild:u,inlineStylesheet:c,maskInputOptions:l,maskTextFn:d,maskInputFn:h,slimDOMOptions:f,dataURLOptions:p,inlineImages:m,recordCanvas:y,preserveWhiteSpace:_,onSerialize:v,onIframeLoad:g,iframeLoadTimeout:b,onStylesheetLoad:w,stylesheetLoadTimeout:S,keepIframeSrcFn:k};if(O.type===it.Element&&"textarea"===O.tagName&&void 0!==O.attributes.value);else for(const n of Array.from(e.childNodes)){const e=Ft(n,t);e&&O.childNodes.push(e)}if(ot(e)&&e.shadowRoot)for(const n of Array.from(e.shadowRoot.childNodes)){const r=Ft(n,t);r&&(st(e.shadowRoot)&&(r.isShadow=!0),O.childNodes.push(r))}}return e.parentNode&&at(e.parentNode)&&st(e.parentNode)&&(O.isShadow=!0),O.type===it.Element&&"iframe"===O.tagName&&function(e,t,n){const r=e.contentWindow;if(!r)return;let i,o=!1;try{i=r.document.readyState}catch(e){return}if("complete"!==i){const r=setTimeout((()=>{o||(t(),o=!0)}),n);return void e.addEventListener("load",(()=>{clearTimeout(r),o=!0,t()}))}const a="about:blank";if(r.location.href!==a||e.src===a||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}(e,(()=>{const t=e.test;if(t&&g){const n=Ft(t,{doc:t,mirror:r,blockClass:i,blockSelector:o,needsMask:x,maskTextClass:a,maskTextSelector:s,skipChild:!1,inlineStylesheet:c,maskInputOptions:l,maskTextFn:d,maskInputFn:h,slimDOMOptions:f,dataURLOptions:p,inlineImages:m,recordCanvas:y,preserveWhiteSpace:_,onSerialize:v,onIframeLoad:g,iframeLoadTimeout:b,onStylesheetLoad:w,stylesheetLoadTimeout:S,keepIframeSrcFn:k});n&&g(e,n)}}),b),O.type===it.Element&&"link"===O.tagName&&"string"==typeof O.attributes.rel&&("stylesheet"===O.attributes.rel||"preload"===O.attributes.rel&&"string"==typeof O.attributes.href&&"css"===mt(O.attributes.href))&&function(e,t,n){let r,i=!1;try{r=e.sheet}catch(e){return}if(r)return;const o=setTimeout((()=>{i||(t(),i=!0)}),n);e.addEventListener("load",(()=>{clearTimeout(o),i=!0,t()}))}(e,(()=>{if(w){const t=Ft(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:x,maskTextClass:a,maskTextSelector:s,skipChild:!1,inlineStylesheet:c,maskInputOptions:l,maskTextFn:d,maskInputFn:h,slimDOMOptions:f,dataURLOptions:p,inlineImages:m,recordCanvas:y,preserveWhiteSpace:_,onSerialize:v,onIframeLoad:g,iframeLoadTimeout:b,onStylesheetLoad:w,stylesheetLoadTimeout:S,keepIframeSrcFn:k});t&&w(e,t)}}),S),O}const jt=/(max|min)-device-(width|height)/,Bt=(new RegExp(jt.source,"g"),/([^\\]):hover/);new RegExp(Bt.source,"g");function qt(e,t,n=document){const r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}let Kt={map:{},getId(){return-1},getNode(){return null},removeNodeFromMap(){},has(){return!1},reset(){}};function zt(e,t,n={}){let r=null,i=0;return function(...o){const a=Date.now();i||!1!==n.leading||(i=a);const s=t-(a-i),u=this;s<=0||s>t?(r&&(clearTimeout(r),r=null),i=a,e.apply(u,o)):r||!1===n.trailing||(r=setTimeout((()=>{i=!1===n.leading?0:Date.now(),r=null,e.apply(u,o)}),s))}}function Ut(e,t,n,r,i=window){const o=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,r?n:{set(e){setTimeout((()=>{n.set.call(this,e)}),0),o&&o.set&&o.set.call(this,e)}}),()=>Ut(e,t,o||{},!0)}function Wt(e,t,n){try{if(!(t in e))return()=>{};const r=e[t],i=n(r);return"function"==typeof i&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,()=>{e[t]=r}}catch(e){return()=>{}}}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Kt=new Proxy(Kt,{get(e,t,n){return Reflect.get(e,t,n)}}));let Ht=Date.now;function Vt(e){var t,n,r,i,o,a;const s=e.document;return{left:s.scrollingElement?s.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:(null==s?void 0:s.documentElement.scrollLeft)||(null===(n=null===(t=null==s?void 0:s.body)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===(r=null==s?void 0:s.body)||void 0===r?void 0:r.scrollLeft)||0,top:s.scrollingElement?s.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==s?void 0:s.documentElement.scrollTop)||(null===(o=null===(i=null==s?void 0:s.body)||void 0===i?void 0:i.parentElement)||void 0===o?void 0:o.scrollTop)||(null===(a=null==s?void 0:s.body)||void 0===a?void 0:a.scrollTop)||0}}function $t(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Gt(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Xt(e){if(!e)return null;return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}function Yt(e,t,n,r){if(!e)return!1;const i=Xt(e);if(!i)return!1;try{if("string"==typeof t){if(i.classList.contains(t))return!0;if(r&&null!==i.closest("."+t))return!0}else if(Nt(i,t,r))return!0}catch(e){}if(n){if(i.matches(n))return!0;if(r&&null!==i.closest(n))return!0}return!1}function Qt(e,t){return-2===t.getId(e)}function Jt(e,t){if(at(e))return!1;const n=t.getId(e);return!t.has(n)||(!e.parentNode||e.parentNode.nodeType!==e.DOCUMENT_NODE)&&(!e.parentNode||Jt(e.parentNode,t))}function Zt(e){return Boolean(e.changedTouches)}function en(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function tn(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function nn(e){return Boolean(null==e?void 0:e.shadowRoot)}/[1-9][0-9]{12}/.test(Date.now().toString())||(Ht=()=>(new Date).getTime());class rn{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let n;return n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function on(e){var t,n;let r=null;return(null===(n=null===(t=e.getRootNode)||void 0===t?void 0:t.call(e))||void 0===n?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(r=e.getRootNode().host),r}function an(e){const t=e.ownerDocument;if(!t)return!1;const n=function(e){let t,n=e;for(;t=on(n);)n=t;return n}(e);return t.contains(n)}function sn(e){const t=e.ownerDocument;return!!t&&(t.contains(e)||an(e))}var un=(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))(un||{}),cn=(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[e.CustomElement=16]="CustomElement",e))(cn||{}),ln=(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))(ln||{}),dn=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(dn||{}),hn=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(hn||{});function fn(e){return"__ln"in e}class pn{constructor(){this.length=0,this.head=null,this.tail=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let n=0;n<e;n++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&fn(e.previousSibling)){const n=e.previousSibling.__ln.next;t.next=n,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,n&&(n.previous=t)}else if(e.nextSibling&&fn(e.nextSibling)&&e.nextSibling.__ln.previous){const n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;null===t.next&&(this.tail=t),this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const mn=(e,t)=>`${e}@${t}`;class yn{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,n=new pn,r=e=>{let t=e,n=-2;for(;-2===n;)t=t&&t.nextSibling,n=t&&this.mirror.getId(t);return n},i=i=>{if(!i.parentNode||!sn(i)||"TEXTAREA"===i.parentNode.tagName)return;const o=at(i.parentNode)?this.mirror.getId(on(i)):this.mirror.getId(i.parentNode),a=r(i);if(-1===o||-1===a)return n.addNode(i);const s=Ft(i,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,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:e=>{en(e,this.mirror)&&this.iframeManager.addIframe(e),tn(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),nn(i)&&this.shadowDomManager.addShadowRoot(i.shadowRoot,this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});s&&(e.push({parentId:o,nextId:a,node:s}),t.add(s.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const e of this.movedSet)gn(this.removes,e,this.mirror)&&!this.movedSet.has(e.parentNode)||i(e);for(const e of this.addedSet)wn(this.droppedSet,e)||gn(this.removes,e,this.mirror)?wn(this.movedSet,e)?i(e):this.droppedSet.add(e):i(e);let o=null;for(;n.length;){let e=null;if(o){const t=this.mirror.getId(o.value.parentNode),n=r(o.value);-1!==t&&-1!==n&&(e=o)}if(!e){let t=n.tail;for(;t;){const n=t;if(t=t.previous,n){const t=this.mirror.getId(n.value.parentNode);if(-1===r(n.value))continue;if(-1!==t){e=n;break}{const t=n.value;if(t.parentNode&&t.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const r=t.parentNode.host;if(-1!==this.mirror.getId(r)){e=n;break}}}}}}if(!e){for(;n.head;)n.removeNode(n.head.value);break}o=e.previous,n.removeNode(e.value),i(e.value)}const a={texts:this.texts.map((e=>{const t=e.node;return"TEXTAREA"===t.parentNode.tagName&&this.genTextAreaValueMutation(t.parentNode),{id:this.mirror.getId(t),value:e.value}})).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),attributes:this.attributes.map((e=>{const{attributes:t}=e;if("string"==typeof t.style){const n=JSON.stringify(e.styleDiff),r=JSON.stringify(e._unchangedStyles);n.length<t.style.length&&(n+r).split("var(").length===t.style.split("var(").length&&(t.style=e.styleDiff)}return{id:this.mirror.getId(e.node),attributes:t}})).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),removes:this.removes,adds:e};(a.texts.length||a.attributes.length||a.removes.length||a.adds.length)&&(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(a))},this.genTextAreaValueMutation=e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t)),t.attributes.value=Array.from(e.childNodes,(e=>e.textContent||"")).join("")},this.processMutation=e=>{if(!Qt(e.target,this.mirror))switch(e.type){case"characterData":{const t=e.target.textContent;Yt(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:At(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,Xt(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let n=e.attributeName,r=e.target.getAttribute(n);if("value"===n){const e=pt(t);r=dt({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:e,value:r,maskInputFn:this.maskInputFn})}if(Yt(e.target,this.blockClass,this.blockSelector,!1)||r===e.oldValue)return;let i=this.attributeMap.get(e.target);if("IFRAME"===t.tagName&&"src"===n&&!this.keepIframeSrcFn(r)){if(t.test)return;n="rr_src"}if(i||(i={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(e.target,i)),"type"===n&&"INPUT"===t.tagName&&"password"===(e.oldValue||"").toLowerCase()&&t.setAttribute("data-rr-is-password","true"),!Dt(t.tagName,n)&&(i.attributes[n]=Rt(this.doc,ht(t.tagName),ht(n),r),"style"===n)){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(e){this.unattachedDoc=this.doc}const n=this.unattachedDoc.createElement("span");e.oldValue&&n.setAttribute("style",e.oldValue);for(const e of Array.from(t.style)){const r=t.style.getPropertyValue(e),o=t.style.getPropertyPriority(e);r!==n.style.getPropertyValue(e)||o!==n.style.getPropertyPriority(e)?i.styleDiff[e]=""===o?r:[r,o]:i._unchangedStyles[e]=[r,o]}for(const e of Array.from(n.style))""===t.style.getPropertyValue(e)&&(i.styleDiff[e]=!1)}break}case"childList":if(Yt(e.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===e.target.tagName)return void this.genTextAreaValueMutation(e.target);e.addedNodes.forEach((t=>this.genAdds(t,e.target))),e.removedNodes.forEach((t=>{const n=this.mirror.getId(t),r=at(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);Yt(e.target,this.blockClass,this.blockSelector,!1)||Qt(t,this.mirror)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(vn(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||Jt(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[mn(n,r)]?vn(this.movedSet,t):this.removes.push({parentId:r,id:n,isShadow:!(!at(e.target)||!st(e.target))||void 0})),this.mapRemoves.push(t))}))}},this.genAdds=(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(Qt(e,this.mirror))return;this.movedSet.add(e);let n=null;t&&this.mirror.hasNode(t)&&(n=this.mirror.getId(t)),n&&-1!==n&&(this.movedMap[mn(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);Yt(e,this.blockClass,this.blockSelector,!1)||(e.childNodes.forEach((e=>this.genAdds(e))),nn(e)&&e.shadowRoot.childNodes.forEach((t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)})))}}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach((t=>{this[t]=e[t]}))}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function vn(e,t){e.delete(t),t.childNodes.forEach((t=>vn(e,t)))}function gn(e,t,n){return 0!==e.length&&bn(e,t,n)}function bn(e,t,n){const{parentNode:r}=t;if(!r)return!1;const i=n.getId(r);return!!e.some((e=>e.id===i))||bn(e,r,n)}function wn(e,t){return 0!==e.size&&Sn(e,t)}function Sn(e,t){const{parentNode:n}=t;return!!n&&(!!e.has(n)||Sn(e,n))}let kn;function In(e){kn=e}function xn(){kn=void 0}const _n=e=>{if(!kn)return e;return(...t)=>{try{return e(...t)}catch(e){if(kn&&!0===kn(e))return;throw e}}},Cn=[];function En(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch(e){}return e&&e.target}function On(e,t){var n,r;const i=new yn;Cn.push(i),i.init(e);let o=window.MutationObserver||window.__rrMutationObserver;const a=null===(r=null===(n=null===window||void 0===window?void 0:window.Zone)||void 0===n?void 0:n.__symbol__)||void 0===r?void 0:r.call(n,"MutationObserver");a&&window[a]&&(o=window[a]);const s=new o(_n(i.processMutations.bind(i)));return s.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),s}function Mn({mouseInteractionCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:o}){if(!1===o.mouseInteraction)return()=>{};const a=!0===o.mouseInteraction||void 0===o.mouseInteraction?{}:o.mouseInteraction,s=[];let u=null;return Object.keys(ln).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==a[e])).forEach((o=>{let a=ht(o);const c=(t=>o=>{const a=En(o);if(Yt(a,r,i,!0))return;let s=null,c=t;if("pointerType"in o){switch(o.pointerType){case"mouse":s=dn.Mouse;break;case"touch":s=dn.Touch;break;case"pen":s=dn.Pen}s===dn.Touch?ln[t]===ln.MouseDown?c="TouchStart":ln[t]===ln.MouseUp&&(c="TouchEnd"):dn.Pen}else Zt(o)&&(s=dn.Touch);null!==s?(u=s,(c.startsWith("Touch")&&s===dn.Touch||c.startsWith("Mouse")&&s===dn.Mouse)&&(s=null)):ln[t]===ln.Click&&(s=u,u=null);const l=Zt(o)?o.changedTouches[0]:o;if(!l)return;const d=n.getId(a),{clientX:h,clientY:f}=l;_n(e)(Object.assign({type:ln[c],id:d,x:h,y:f},null!==s&&{pointerType:s}))})(o);if(window.PointerEvent)switch(ln[o]){case ln.MouseDown:case ln.MouseUp:a=a.replace("mouse","pointer");break;case ln.TouchStart:case ln.TouchEnd:return}s.push(qt(a,c,t))})),_n((()=>{s.forEach((e=>e()))}))}function Tn({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:o}){return qt("scroll",_n(zt(_n((o=>{const a=En(o);if(!a||Yt(a,r,i,!0))return;const s=n.getId(a);if(a===t&&t.defaultView){const n=Vt(t.defaultView);e({id:s,x:n.left,y:n.top})}else e({id:s,x:a.scrollLeft,y:a.scrollTop})})),o.scroll||100)),t)}const Rn=["INPUT","TEXTAREA","SELECT"],Dn=new WeakMap;function Nn(e){return function(e,t){if(Fn("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||Fn("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||Fn("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||Fn("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){const n=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(n)}else if(e.parentStyleSheet){const n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(n)}return t}(e,[])}function An(e,t,n){let r,i;return e?(e.ownerNode?r=t.getId(e.ownerNode):i=n.getId(e),{styleId:i,id:r}):{}}function Ln({mirror:e,stylesheetManager:t},n){var r,i,o;let a=null;a="#document"===n.nodeName?e.getId(n):e.getId(n.host);const s="#document"===n.nodeName?null===(r=n.defaultView)||void 0===r?void 0:r.Document:null===(o=null===(i=n.ownerDocument)||void 0===i?void 0:i.defaultView)||void 0===o?void 0:o.ShadowRoot,u=(null==s?void 0:s.prototype)?Object.getOwnPropertyDescriptor(null==s?void 0:s.prototype,"adoptedStyleSheets"):void 0;return null!==a&&-1!==a&&s&&u?(Object.defineProperty(n,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get(){var e;return null===(e=u.get)||void 0===e?void 0:e.call(this)},set(e){var n;const r=null===(n=u.set)||void 0===n?void 0:n.call(this,e);if(null!==a&&-1!==a)try{t.adoptStyleSheets(e,a)}catch(e){}return r}}),_n((()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get:u.get,set:u.set})}))):()=>{}}function Pn(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};let r;!function(e,t){const{mutationCb:n,mousemoveCb:r,mouseInteractionCb:i,scrollCb:o,viewportResizeCb:a,inputCb:s,mediaInteractionCb:u,styleSheetRuleCb:c,styleDeclarationCb:l,canvasMutationCb:d,fontCb:h,selectionCb:f,customElementCb:p}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),n(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),r(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),i(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),o(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),a(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),s(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),u(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),c(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),l(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),d(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),h(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),f(...e)},e.customElementCb=(...e)=>{t.customElement&&t.customElement(...e),p(...e)}}(e,t),e.recordDOM&&(r=On(e,e.doc));const i=function({mousemoveCb:e,sampling:t,doc:n,mirror:r}){if(!1===t.mousemove)return()=>{};const i="number"==typeof t.mousemove?t.mousemove:50,o="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let a,s=[];const u=zt(_n((t=>{const n=Date.now()-a;e(s.map((e=>(e.timeOffset-=n,e))),t),s=[],a=null})),o),c=_n(zt(_n((e=>{const t=En(e),{clientX:n,clientY:i}=Zt(e)?e.changedTouches[0]:e;a||(a=Ht()),s.push({x:n,y:i,id:r.getId(t),timeOffset:Ht()-a}),u("undefined"!=typeof DragEvent&&e instanceof DragEvent?cn.Drag:e instanceof MouseEvent?cn.MouseMove:cn.TouchMove)})),i,{trailing:!1})),l=[qt("mousemove",c,n),qt("touchmove",c,n),qt("drag",c,n)];return _n((()=>{l.forEach((e=>e()))}))}(e),o=Mn(e),a=Tn(e),s=function({viewportResizeCb:e},{win:t}){let n=-1,r=-1;return qt("resize",_n(zt(_n((()=>{const t=$t(),i=Gt();n===t&&r===i||(e({width:Number(i),height:Number(t)}),n=t,r=i)})),200)),t)}(e,{win:n}),u=function({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,ignoreClass:o,ignoreSelector:a,maskInputOptions:s,maskInputFn:u,sampling:c,userTriggeredOnInput:l}){function d(e){let n=En(e);const c=e.isTrusted,d=n&&n.tagName;if(n&&"OPTION"===d&&(n=n.parentElement),!n||!d||Rn.indexOf(d)<0||Yt(n,r,i,!0))return;if(n.classList.contains(o)||a&&n.matches(a))return;let f=n.value,p=!1;const m=pt(n)||"";"radio"===m||"checkbox"===m?p=n.checked:(s[d.toLowerCase()]||s[m])&&(f=dt({element:n,maskInputOptions:s,tagName:d,type:m,value:f,maskInputFn:u})),h(n,l?{text:f,isChecked:p,userTriggered:c}:{text:f,isChecked:p});const y=n.name;"radio"===m&&y&&p&&t.querySelectorAll(`input[type="radio"][name="${y}"]`).forEach((e=>{if(e!==n){const t=e.value;h(e,l?{text:t,isChecked:!p,userTriggered:!1}:{text:t,isChecked:!p})}}))}function h(t,r){const i=Dn.get(t);if(!i||i.text!==r.text||i.isChecked!==r.isChecked){Dn.set(t,r);const i=n.getId(t);_n(e)(Object.assign(Object.assign({},r),{id:i}))}}const f=("last"===c.input?["change"]:["input","change"]).map((e=>qt(e,_n(d),t))),p=t.defaultView;if(!p)return()=>{f.forEach((e=>e()))};const m=p.Object.getOwnPropertyDescriptor(p.HTMLInputElement.prototype,"value"),y=[[p.HTMLInputElement.prototype,"value"],[p.HTMLInputElement.prototype,"checked"],[p.HTMLSelectElement.prototype,"value"],[p.HTMLTextAreaElement.prototype,"value"],[p.HTMLSelectElement.prototype,"selectedIndex"],[p.HTMLOptionElement.prototype,"selected"]];return m&&m.set&&f.push(...y.map((e=>Ut(e[0],e[1],{set(){_n(d)({target:this,isTrusted:!1})}},!1,p)))),_n((()=>{f.forEach((e=>e()))}))}(e),c=function({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:i,doc:o}){const a=_n((o=>zt(_n((i=>{const a=En(i);if(!a||Yt(a,t,n,!0))return;const{currentTime:s,volume:u,muted:c,playbackRate:l}=a;e({type:o,id:r.getId(a),currentTime:s,volume:u,muted:c,playbackRate:l})})),i.media||500))),s=[qt("play",a(0),o),qt("pause",a(1),o),qt("seeked",a(2),o),qt("volumechange",a(3),o),qt("ratechange",a(4),o)];return _n((()=>{s.forEach((e=>e()))}))}(e);let l=()=>{},d=()=>{},h=()=>{},f=()=>{};e.recordDOM&&(l=function({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};const i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:_n(((r,i,o)=>{const[a,s]=o,{id:u,styleId:c}=An(i,t,n.styleMirror);return(u&&-1!==u||c&&-1!==c)&&e({id:u,styleId:c,adds:[{rule:a,index:s}]}),r.apply(i,o)}))});const o=r.CSSStyleSheet.prototype.deleteRule;let a,s;r.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:_n(((r,i,o)=>{const[a]=o,{id:s,styleId:u}=An(i,t,n.styleMirror);return(s&&-1!==s||u&&-1!==u)&&e({id:s,styleId:u,removes:[{index:a}]}),r.apply(i,o)}))}),r.CSSStyleSheet.prototype.replace&&(a=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:_n(((r,i,o)=>{const[a]=o,{id:s,styleId:u}=An(i,t,n.styleMirror);return(s&&-1!==s||u&&-1!==u)&&e({id:s,styleId:u,replace:a}),r.apply(i,o)}))})),r.CSSStyleSheet.prototype.replaceSync&&(s=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(s,{apply:_n(((r,i,o)=>{const[a]=o,{id:s,styleId:u}=An(i,t,n.styleMirror);return(s&&-1!==s||u&&-1!==u)&&e({id:s,styleId:u,replaceSync:a}),r.apply(i,o)}))}));const u={};jn("CSSGroupingRule")?u.CSSGroupingRule=r.CSSGroupingRule:(jn("CSSMediaRule")&&(u.CSSMediaRule=r.CSSMediaRule),jn("CSSConditionRule")&&(u.CSSConditionRule=r.CSSConditionRule),jn("CSSSupportsRule")&&(u.CSSSupportsRule=r.CSSSupportsRule));const c={};return Object.entries(u).forEach((([r,i])=>{c[r]={insertRule:i.prototype.insertRule,deleteRule:i.prototype.deleteRule},i.prototype.insertRule=new Proxy(c[r].insertRule,{apply:_n(((r,i,o)=>{const[a,s]=o,{id:u,styleId:c}=An(i.parentStyleSheet,t,n.styleMirror);return(u&&-1!==u||c&&-1!==c)&&e({id:u,styleId:c,adds:[{rule:a,index:[...Nn(i),s||0]}]}),r.apply(i,o)}))}),i.prototype.deleteRule=new Proxy(c[r].deleteRule,{apply:_n(((r,i,o)=>{const[a]=o,{id:s,styleId:u}=An(i.parentStyleSheet,t,n.styleMirror);return(s&&-1!==s||u&&-1!==u)&&e({id:s,styleId:u,removes:[{index:[...Nn(i),a]}]}),r.apply(i,o)}))})})),_n((()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=o,a&&(r.CSSStyleSheet.prototype.replace=a),s&&(r.CSSStyleSheet.prototype.replaceSync=s),Object.entries(u).forEach((([e,t])=>{t.prototype.insertRule=c[e].insertRule,t.prototype.deleteRule=c[e].deleteRule}))}))}(e,{win:n}),d=Ln(e,e.doc),h=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:i}){const o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:_n(((i,a,s)=>{var u;const[c,l,d]=s;if(n.has(c))return o.apply(a,[c,l,d]);const{id:h,styleId:f}=An(null===(u=a.parentRule)||void 0===u?void 0:u.parentStyleSheet,t,r.styleMirror);return(h&&-1!==h||f&&-1!==f)&&e({id:h,styleId:f,set:{property:c,value:l,priority:d},index:Nn(a.parentRule)}),i.apply(a,s)}))});const a=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:_n(((i,o,s)=>{var u;const[c]=s;if(n.has(c))return a.apply(o,[c]);const{id:l,styleId:d}=An(null===(u=o.parentRule)||void 0===u?void 0:u.parentStyleSheet,t,r.styleMirror);return(l&&-1!==l||d&&-1!==d)&&e({id:l,styleId:d,remove:{property:c},index:Nn(o.parentRule)}),i.apply(o,s)}))}),_n((()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=a}))}(e,{win:n}),e.collectFonts&&(f=function({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const r=[],i=new WeakMap,o=n.FontFace;n.FontFace=function(e,t,n){const r=new o(e,t,n);return i.set(r,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),r};const a=Wt(t.fonts,"add",(function(t){return function(n){return setTimeout(_n((()=>{const t=i.get(n);t&&(e(t),i.delete(n))})),0),t.apply(this,[n])}}));return r.push((()=>{n.FontFace=o})),r.push(a),_n((()=>{r.forEach((e=>e()))}))}(e)));const p=function(e){const{doc:t,mirror:n,blockClass:r,blockSelector:i,selectionCb:o}=e;let a=!0;const s=_n((()=>{const e=t.getSelection();if(!e||a&&(null==e?void 0:e.isCollapsed))return;a=e.isCollapsed||!1;const s=[],u=e.rangeCount||0;for(let t=0;t<u;t++){const o=e.getRangeAt(t),{startContainer:a,startOffset:u,endContainer:c,endOffset:l}=o;Yt(a,r,i,!0)||Yt(c,r,i,!0)||s.push({start:n.getId(a),startOffset:u,end:n.getId(c),endOffset:l})}o({ranges:s})}));return s(),qt("selectionchange",s)}(e),m=function({doc:e,customElementCb:t}){const n=e.defaultView;return n&&n.customElements?Wt(n.customElements,"define",(function(e){return function(n,r,i){try{t({define:{name:n}})}catch(e){}return e.apply(this,[n,r,i])}})):()=>{}}(e),y=[];for(const t of e.plugins)y.push(t.observer(t.callback,n,t.options));return _n((()=>{Cn.forEach((e=>e.reset())),null==r||r.disconnect(),i(),o(),a(),s(),u(),c(),l(),d(),h(),f(),p(),m(),y.forEach((e=>e()))}))}function Fn(e){return void 0!==window[e]}function jn(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class Bn{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,t,n,r){const i=n||this.getIdToRemoteIdMap(e),o=r||this.getRemoteIdToIdMap(e);let a=i.get(t);return a||(a=this.generateIdFn(),i.set(t,a),o.set(a,t)),a}getIds(e,t){const n=this.getIdToRemoteIdMap(e),r=this.getRemoteIdToIdMap(e);return t.map((t=>this.getId(e,t,n,r)))}getRemoteId(e,t,n){const r=n||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;const i=r.get(t);return i||-1}getRemoteIds(e,t){const n=this.getRemoteIdToIdMap(e);return t.map((t=>this.getRemoteId(e,t,n)))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class qn{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Bn(gt),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Bn(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null===(n=this.loadListener)||void 0===n||n.call(this,e),e.test&&e.test.adoptedStyleSheets&&e.test.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.test.adoptedStyleSheets,this.mirror.getId(e.test))}handleMessage(e){const t=e;if("rrweb"!==t.data.type||t.origin!==t.data.origin)return;if(!e.source)return;const n=this.crossOriginIframeMap.get(e.source);if(!n)return;const r=this.transformCrossOriginEvent(n,t.data.event);r&&this.wrappedEmit(r,t.data.isCheckout)}transformCrossOriginEvent(e,t){var n;switch(t.type){case un.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const n=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,n),this.patchRootIdOnNode(t.data.node,n),{timestamp:t.timestamp,type:un.IncrementalSnapshot,data:{source:cn.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case un.Meta:case un.Load:case un.DomContentLoaded:return!1;case un.Plugin:return t;case un.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case un.IncrementalSnapshot:switch(t.data.source){case cn.Mutation:return t.data.adds.forEach((t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);const n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(t.node,n)})),t.data.removes.forEach((t=>{this.replaceIds(t,e,["parentId","id"])})),t.data.attributes.forEach((t=>{this.replaceIds(t,e,["id"])})),t.data.texts.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case cn.Drag:case cn.TouchMove:case cn.MouseMove:return t.data.positions.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case cn.ViewportResize:return!1;case cn.MediaInteraction:case cn.MouseInteraction:case cn.Scroll:case cn.CanvasMutation:case cn.Input:return this.replaceIds(t.data,e,["id"]),t;case cn.StyleSheetRule:case cn.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case cn.Font:return t;case cn.Selection:return t.data.ranges.forEach((t=>{this.replaceIds(t,e,["start","end"])})),t;case cn.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null===(n=t.data.styles)||void 0===n||n.forEach((t=>{this.replaceStyleIds(t,e,["styleId"])})),t}}return!1}replace(e,t,n,r){for(const i of r)(Array.isArray(t[i])||"number"==typeof t[i])&&(Array.isArray(t[i])?t[i]=e.getIds(n,t[i]):t[i]=e.getId(n,t[i]));return t}replaceIds(e,t,n){return this.replace(this.crossOriginIframeMirror,e,t,n)}replaceStyleIds(e,t,n){return this.replace(this.crossOriginIframeStyleMirror,e,t,n)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach((e=>{this.replaceIdOnNode(e,t)}))}patchRootIdOnNode(e,t){e.type===it.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach((e=>{this.patchRootIdOnNode(e,t)}))}}class Kn{constructor(e){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!st(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const n=On(Object.assign(Object.assign({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push((()=>n.disconnect())),this.restoreHandlers.push(Tn(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))),setTimeout((()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),this.restoreHandlers.push(Ln({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))}),0)}observeAttachShadow(e){e.contentWindow&&e.test&&this.patchAttachShadow(e.contentWindow.Element,e.test)}patchAttachShadow(e,t){const n=this;this.restoreHandlers.push(Wt(e.prototype,"attachShadow",(function(e){return function(r){const i=e.call(this,r);return this.shadowRoot&&sn(this)&&n.addShadowRoot(this.shadowRoot,t),i}})))}reset(){this.restoreHandlers.forEach((e=>{try{e()}catch(e){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}function zn(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}for(var Un="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Wn="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Hn=0;Hn<64;Hn++)Wn[Un.charCodeAt(Hn)]=Hn;const Vn=new Map;const $n=(e,t,n)=>{if(!e||!Yn(e,t)&&"object"!=typeof e)return;const r=function(e,t){let n=Vn.get(e);return n||(n=new Map,Vn.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}(n,e.constructor.name);let i=r.indexOf(e);return-1===i&&(i=r.length,r.push(e)),i};function Gn(e,t,n){if(e instanceof Array)return e.map((e=>Gn(e,t,n)));if(null===e)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){const t=e.constructor.name,n=function(e){var t,n=new Uint8Array(e),r=n.length,i="";for(t=0;t<r;t+=3)i+=Un[n[t]>>2],i+=Un[(3&n[t])<<4|n[t+1]>>4],i+=Un[(15&n[t+1])<<2|n[t+2]>>6],i+=Un[63&n[t+2]];return r%3==2?i=i.substring(0,i.length-1)+"=":r%3==1&&(i=i.substring(0,i.length-2)+"=="),i}(e);return{rr_type:t,base64:n}}if(e instanceof DataView){return{rr_type:e.constructor.name,args:[Gn(e.buffer,t,n),e.byteOffset,e.byteLength]}}if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:n}=e;return{rr_type:t,src:n}}if(e instanceof HTMLCanvasElement){return{rr_type:"HTMLImageElement",src:e.toDataURL()}}if(e instanceof ImageData){return{rr_type:e.constructor.name,args:[Gn(e.data,t,n),e.width,e.height]}}if(Yn(e,t)||"object"==typeof e){return{rr_type:e.constructor.name,index:$n(e,t,n)}}return e}const Xn=(e,t,n)=>e.map((e=>Gn(e,t,n))),Yn=(e,t)=>{const n=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter((e=>"function"==typeof t[e]));return Boolean(n.find((n=>e instanceof t[n])))};function Qn(e,t,n,r){const i=[];try{const o=Wt(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(i,...o){if(!Yt(this,t,n,!0)){const e=function(e){return"experimental-webgl"===e?"webgl":e}(i);if("__context"in this||(this.__context=e),r&&["webgl","webgl2"].includes(e))if(o[0]&&"object"==typeof o[0]){const e=o[0];e.preserveDrawingBuffer||(e.preserveDrawingBuffer=!0)}else o.splice(0,1,{preserveDrawingBuffer:!0})}return e.apply(this,[i,...o])}}));i.push(o)}catch(e){}return()=>{i.forEach((e=>e()))}}function Jn(e,t,n,r,i,o,a){const s=[],u=Object.getOwnPropertyNames(e);for(const o of u)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(o))try{if("function"!=typeof e[o])continue;const u=Wt(e,o,(function(e){return function(...s){const u=e.apply(this,s);if($n(u,a,this),"tagName"in this.canvas&&!Yt(this.canvas,r,i,!0)){const e=Xn(s,a,this),r={type:t,property:o,args:e};n(this.canvas,r)}return u}}));s.push(u)}catch(r){const i=Ut(e,o,{set(e){n(this.canvas,{type:t,property:o,args:[e],setter:!0})}});s.push(i)}return s}var Zn,er,tr,nr=(Zn=function(){!function(){function e(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n="undefined"==typeof Uint8Array?[]:new Uint8Array(256),r=0;r<64;r++)n[t.charCodeAt(r)]=r;var i=function(e){var n,r=new Uint8Array(e),i=r.length,o="";for(n=0;n<i;n+=3)o+=t[r[n]>>2],o+=t[(3&r[n])<<4|r[n+1]>>4],o+=t[(15&r[n+1])<<2|r[n+2]>>6],o+=t[63&r[n+2]];return i%3==2?o=o.substring(0,o.length-1)+"=":i%3==1&&(o=o.substring(0,o.length-2)+"=="),o};const o=new Map,a=new Map,s=self;s.onmessage=function(t){return e(this,void 0,void 0,(function*(){if(!("OffscreenCanvas"in globalThis))return s.postMessage({id:t.data.id});{const{id:n,bitmap:r,width:u,height:c,dataURLOptions:l}=t.data,d=function(t,n,r){return e(this,void 0,void 0,(function*(){const e=`${t}-${n}`;if("OffscreenCanvas"in globalThis){if(a.has(e))return a.get(e);const o=new OffscreenCanvas(t,n);o.getContext("2d");const s=yield o.convertToBlob(r),u=yield s.arrayBuffer(),c=i(u);return a.set(e,c),c}return""}))}(u,c,l),h=new OffscreenCanvas(u,c);h.getContext("2d").drawImage(r,0,0),r.close();const f=yield h.convertToBlob(l),p=f.type,m=yield f.arrayBuffer(),y=i(m);if(!o.has(n)&&(yield d)===y)return o.set(n,y),s.postMessage({id:n});if(o.get(n)===y)return s.postMessage({id:n});s.postMessage({id:n,type:p,base64:y,width:u,height:c}),o.set(n,y)}}))}}()},er=null,function(e){return tr=tr||function(e,t){var n=function(e,t){var n=void 0===t?null:t,r=e.toString().split("\n");r.pop(),r.shift();for(var i=r[0].search(/\S/),o=/(['"])__worker_loader_strict__(['"])/g,a=0,s=r.length;a<s;++a)r[a]=r[a].substring(i).replace(o,"$1use strict$2")+"\n";return n&&r.push("//# sourceMappingURL="+n+"\n"),r}(e,t),r=new Blob(n,{type:"application/javascript"});return URL.createObjectURL(r)}(Zn,er),new Worker(tr,e)});class rr{reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(e,t)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)};const{sampling:t="all",win:n,blockClass:r,blockSelector:i,recordCanvas:o,dataURLOptions:a}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&"all"===t&&this.initCanvasMutationObserver(n,r,i),o&&"number"==typeof t&&this.initCanvasFPSObserver(t,n,r,i,{dataURLOptions:a})}initCanvasFPSObserver(e,t,n,r,i){const o=Qn(t,n,r,!0),a=new Map,s=new nr;s.onmessage=e=>{const{id:t}=e.data;if(a.set(t,!1),!("base64"in e.data))return;const{base64:n,type:r,width:i,height:o}=e.data;this.mutationCb({id:t,type:hn["2D"],commands:[{property:"clearRect",args:[0,0,i,o]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:r}]},0,0]}]})};const u=1e3/e;let c,l=0;const d=e=>{l&&e-l<u||(l=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach((t=>{Yt(t,n,r,!0)||e.push(t)})),e})().forEach((e=>zn(this,void 0,void 0,(function*(){var t;const n=this.mirror.getId(e);if(a.get(n))return;if(a.set(n,!0),["webgl","webgl2"].includes(e.__context)){const n=e.getContext(e.__context);!1===(null===(t=null==n?void 0:n.getContextAttributes())||void 0===t?void 0:t.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}const r=yield createImageBitmap(e);s.postMessage({id:n,bitmap:r,width:e.width,height:e.height,dataURLOptions:i.dataURLOptions},[r])}))))),c=requestAnimationFrame(d)};c=requestAnimationFrame(d),this.resetObservers=()=>{o(),cancelAnimationFrame(c)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const r=Qn(e,t,n,!1),i=function(e,t,n,r){const i=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const a of o)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[a])continue;const o=Wt(t.CanvasRenderingContext2D.prototype,a,(function(i){return function(...o){return Yt(this.canvas,n,r,!0)||setTimeout((()=>{const n=Xn(o,t,this);e(this.canvas,{type:hn["2D"],property:a,args:n})}),0),i.apply(this,o)}}));i.push(o)}catch(n){const r=Ut(t.CanvasRenderingContext2D.prototype,a,{set(t){e(this.canvas,{type:hn["2D"],property:a,args:[t],setter:!0})}});i.push(r)}return()=>{i.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n),o=function(e,t,n,r){const i=[];return i.push(...Jn(t.WebGLRenderingContext.prototype,hn.WebGL,e,n,r,0,t)),void 0!==t.WebGL2RenderingContext&&i.push(...Jn(t.WebGL2RenderingContext.prototype,hn.WebGL2,e,n,r,0,t)),()=>{i.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n,this.mirror);this.resetObservers=()=>{r(),i(),o()}}startPendingCanvasMutationFlusher(){requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((e,t)=>{const n=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,n)})),requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(e);if(!n||-1===t)return;const r=n.map((e=>{const t=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["type"]);return t})),{type:i}=n[0];this.mutationCb({id:t,type:i,commands:r}),this.pendingCanvasMutations.delete(e)}}class ir{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new rn,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const n={id:t,styleIds:[]},r=[];for(const t of e){let e;this.styleMirror.has(t)?e=this.styleMirror.getId(t):(e=this.styleMirror.add(t),r.push({styleId:e,rules:Array.from(t.rules||CSSRule,((e,t)=>({rule:ct(e),index:t})))})),n.styleIds.push(e)}r.length>0&&(n.styles=r),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class or{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame((()=>{this.clear(),this.loop&&this.periodicallyClear()}))}inOtherBuffer(e,t){const n=this.nodeMap.get(e);return n&&Array.from(n).some((e=>e!==t))}add(e,t){this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}function ar(e){return Object.assign(Object.assign({},e),{timestamp:Ht()})}let sr,ur,cr,lr=!1;const dr=new lt;function hr(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:i="rr-block",blockSelector:o=null,ignoreClass:a="rr-ignore",ignoreSelector:s=null,maskTextClass:u="rr-mask",maskTextSelector:c=null,inlineStylesheet:l=!0,maskAllInputs:d,maskInputOptions:h,slimDOMOptions:f,maskInputFn:p,maskTextFn:m,hooks:y,packFn:v,sampling:g={},dataURLOptions:b={},mousemoveWait:w,recordDOM:S=!0,recordCanvas:k=!1,recordCrossOriginIframes:I=!1,recordAfter:x=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:_=!1,collectFonts:C=!1,inlineImages:E=!1,plugins:O,keepIframeSrcFn:M=()=>!1,ignoreCSSAttributes:T=new Set([]),errorHandler:R}=e;In(R);const D=!I||window.parent===window;let N=!1;if(!D)try{window.parent.document&&(N=!1)}catch(e){N=!0}if(D&&!t)throw new Error("emit function is required");void 0!==w&&void 0===g.mousemove&&(g.mousemove=w),dr.reset();const A=!0===d?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==h?h:{password:!0},L=!0===f||"all"===f?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===f,headMetaDescKeywords:"all"===f}:f||{};let P;!function(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=(...e)=>{let t=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do{if(this===t)return!0}while(t=t&&t.parentNode);return!1})}();let F=0;const j=e=>{for(const t of O||[])t.eventProcessor&&(e=t.eventProcessor(e));return v&&!N&&(e=v(e)),e};sr=(e,i)=>{var o;if(!(null===(o=Cn[0])||void 0===o?void 0:o.isFrozen())||e.type===un.FullSnapshot||e.type===un.IncrementalSnapshot&&e.data.source===cn.Mutation||Cn.forEach((e=>e.unfreeze())),D)null==t||t(j(e),i);else if(N){const t={type:"rrweb",event:j(e),origin:window.location.origin,isCheckout:i};window.parent.postMessage(t,"*")}if(e.type===un.FullSnapshot)P=e,F=0;else if(e.type===un.IncrementalSnapshot){if(e.data.source===cn.Mutation&&e.data.isAttachIframe)return;F++;const t=r&&F>=r,i=n&&e.timestamp-P.timestamp>n;(t||i)&&ur(!0)}};const B=e=>{sr(ar({type:un.IncrementalSnapshot,data:Object.assign({source:cn.Mutation},e)}))},q=e=>sr(ar({type:un.IncrementalSnapshot,data:Object.assign({source:cn.Scroll},e)})),K=e=>sr(ar({type:un.IncrementalSnapshot,data:Object.assign({source:cn.CanvasMutation},e)})),z=new ir({mutationCb:B,adoptedStyleSheetCb:e=>sr(ar({type:un.IncrementalSnapshot,data:Object.assign({source:cn.AdoptedStyleSheet},e)}))}),U=new qn({mirror:dr,mutationCb:B,stylesheetManager:z,recordCrossOriginIframes:I,wrappedEmit:sr});for(const e of O||[])e.getMirror&&e.getMirror({nodeMirror:dr,crossOriginIframeMirror:U.crossOriginIframeMirror,crossOriginIframeStyleMirror:U.crossOriginIframeStyleMirror});const W=new or;cr=new rr({recordCanvas:k,mutationCb:K,win:window,blockClass:i,blockSelector:o,mirror:dr,sampling:g.canvas,dataURLOptions:b});const H=new Kn({mutationCb:B,scrollCb:q,bypassOptions:{blockClass:i,blockSelector:o,maskTextClass:u,maskTextSelector:c,inlineStylesheet:l,maskInputOptions:A,dataURLOptions:b,maskTextFn:m,maskInputFn:p,recordCanvas:k,inlineImages:E,sampling:g,slimDOMOptions:L,iframeManager:U,stylesheetManager:z,canvasManager:cr,keepIframeSrcFn:M,processedNodeManager:W},mirror:dr});ur=(e=!1)=>{if(!S)return;sr(ar({type:un.Meta,data:{href:window.location.href,width:Gt(),height:$t()}}),e),z.reset(),H.init(),Cn.forEach((e=>e.lock()));const t=function(e,t){const{mirror:n=new lt,blockClass:r="rr-block",blockSelector:i=null,maskTextClass:o="rr-mask",maskTextSelector:a=null,inlineStylesheet:s=!0,inlineImages:u=!1,recordCanvas:c=!1,maskAllInputs:l=!1,maskTextFn:d,maskInputFn:h,slimDOM:f=!1,dataURLOptions:p,preserveWhiteSpace:m,onSerialize:y,onIframeLoad:v,iframeLoadTimeout:g,onStylesheetLoad:b,stylesheetLoadTimeout:w,keepIframeSrcFn:S=()=>!1}=t||{};return Ft(e,{doc:e,mirror:n,blockClass:r,blockSelector:i,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:s,maskInputOptions:!0===l?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===l?{password:!0}:l,maskTextFn:d,maskInputFn:h,slimDOMOptions:!0===f||"all"===f?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===f,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===f?{}:f,dataURLOptions:p,inlineImages:u,recordCanvas:c,preserveWhiteSpace:m,onSerialize:y,onIframeLoad:v,iframeLoadTimeout:g,onStylesheetLoad:b,stylesheetLoadTimeout:w,keepIframeSrcFn:S,newlyAddedElement:!1})}(document,{mirror:dr,blockClass:i,blockSelector:o,maskTextClass:u,maskTextSelector:c,inlineStylesheet:l,maskAllInputs:A,maskTextFn:m,slimDOM:L,dataURLOptions:b,recordCanvas:k,inlineImages:E,onSerialize:e=>{en(e,dr)&&U.addIframe(e),tn(e,dr)&&z.trackLinkElement(e),nn(e)&&H.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,t)=>{U.attachIframe(e,t),H.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{z.attachLinkElement(e,t)},keepIframeSrcFn:M});t&&(sr(ar({type:un.FullSnapshot,data:{node:t,initialOffset:Vt(window)}}),e),Cn.forEach((e=>e.unlock())),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&z.adoptStyleSheets(document.adoptedStyleSheets,dr.getId(document)))};try{const e=[],t=e=>{var t;return _n(Pn)({mutationCb:B,mousemoveCb:(e,t)=>sr(ar({type:un.IncrementalSnapshot,data:{source:t,positions:e}})),mouseInteractionCb:e=>sr(ar({type:un.IncrementalSnapshot,data:Object.assign({source:cn.MouseInteraction},e)})),scrollCb:q,viewportResizeCb:e=>sr(ar({type:un.IncrementalSnapshot,data:Object.assign({source:cn.ViewportResize},e)})),inputCb:e=>sr(ar({type:un.IncrementalSnapshot,data:Object.assign({source:cn.Input},e)})),mediaInteractionCb:e=>sr(ar({type:un.IncrementalSnapshot,data:Object.assign({source:cn.MediaInteraction},e)})),styleSheetRuleCb:e=>sr(ar({type:un.IncrementalSnapshot,data:Object.assign({source:cn.StyleSheetRule},e)})),styleDeclarationCb:e=>sr(ar({type:un.IncrementalSnapshot,data:Object.assign({source:cn.StyleDeclaration},e)})),canvasMutationCb:K,fontCb:e=>sr(ar({type:un.IncrementalSnapshot,data:Object.assign({source:cn.Font},e)})),selectionCb:e=>{sr(ar({type:un.IncrementalSnapshot,data:Object.assign({source:cn.Selection},e)}))},customElementCb:e=>{sr(ar({type:un.IncrementalSnapshot,data:Object.assign({source:cn.CustomElement},e)}))},blockClass:i,ignoreClass:a,ignoreSelector:s,maskTextClass:u,maskTextSelector:c,maskInputOptions:A,inlineStylesheet:l,sampling:g,recordDOM:S,recordCanvas:k,inlineImages:E,userTriggeredOnInput:_,collectFonts:C,doc:e,maskInputFn:p,maskTextFn:m,keepIframeSrcFn:M,blockSelector:o,slimDOMOptions:L,dataURLOptions:b,mirror:dr,iframeManager:U,stylesheetManager:z,shadowDomManager:H,processedNodeManager:W,canvasManager:cr,ignoreCSSAttributes:T,plugins:(null===(t=null==O?void 0:O.filter((e=>e.observer)))||void 0===t?void 0:t.map((e=>({observer:e.observer,options:e.options,callback:t=>sr(ar({type:un.Plugin,data:{plugin:e.name,payload:t}}))}))))||[]},y)};U.addLoadListener((n=>{try{e.push(t(n.test))}catch(e){}}));const n=()=>{ur(),e.push(t(document)),lr=!0};return"interactive"===document.readyState||"complete"===document.readyState?n():(e.push(qt("DOMContentLoaded",(()=>{sr(ar({type:un.DomContentLoaded,data:{}})),"DOMContentLoaded"===x&&n()}))),e.push(qt("load",(()=>{sr(ar({type:un.Load,data:{}})),"load"===x&&n()}),window))),()=>{e.forEach((e=>e())),W.destroy(),lr=!1,xn()}}catch(e){}}hr.addCustomEvent=(e,t)=>{if(!lr)throw new Error("please add custom event after start recording");sr(ar({type:un.Custom,data:{tag:e,payload:t}}))},hr.freezePage=()=>{Cn.forEach((e=>e.freeze()))},hr.takeFullSnapshot=e=>{if(!lr)throw new Error("please take full snapshot after start recording");ur(e)},hr.mirror=dr;var fr=n(7753);const pr=Symbol.for("Dexie"),mr=globalThis[pr]||(globalThis[pr]=fr);if(fr.semVer!==mr.semVer)throw new Error(`Two different versions of Dexie loaded in the same app: ${fr.semVer} and ${mr.semVer}`);const{liveQuery:yr,mergeRanges:vr,rangesOverlap:gr,RangeSet:br,cmp:wr,Entity:Sr,PropModification:kr,replacePrefix:Ir,add:xr,remove:_r}=mr;var Cr=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))};class Er{constructor(e){this.batchQueue=[],this.rewindBatchQueue=[],this.processingBatch=!1,this.processingRewindBatch=!1,this.BATCH_SIZE=15,this.BATCH_INTERVAL=2e3,this.lastBatch=0,this.requests=new Map,this.CLEAN_UP_INTERVAL=3e4,this.lastCleanup=0,this.isDestroyed=!1,this.minutesToKeepData=15,this.dbInitialized=!1,this.dbInitPromise=null,this.isInitializedForRecordingLink=!1,this.__init(e)}__init(e){if(Er._instance)return Er._instance;Er._instance=this,this.isDestroyed=!1,this.initDB().catch((e=>{})),this.isInitializedForRecordingLink=e.isInitializedForRecordingLink||!1,this.batchQueue=[],this.rewindBatchQueue=[],this.processingBatch=!1,this.processingRewindBatch=!1,this.BATCH_SIZE=15,this.BATCH_INTERVAL=2e3,this.CLEAN_UP_INTERVAL=3e4,this.startPeriodicBatchProcess(),this.minutesToKeepData=e.maxRecordingMinutes||15,window.addEventListener("load",(()=>{this.createIframe()}))}createIframe(){var e;if(this.iframeRef=null===document||void 0===document?void 0:document.getElementById(t),!this.iframeRef){this.iframeRef=document.createElement("iframe");const n="https://recording.betterbugs.io/message-listener";if(!n)return void l.error("MESSAGE_LISTENER_URL is not defined");try{const e=new URL(n);e.searchParams.set("targetURL",window.location.origin),this.iframeRef.src=e.toString()}catch(e){l.error("Invalid MESSAGE_LISTENER_URL:",e),this.iframeRef.src=n}this.iframeRef.classList.add(t),this.iframeRef.id=t,this.iframeRef.hidden=!0,null===(e=null===document||void 0===document?void 0:document.body)||void 0===e||e.append(this.iframeRef)}}sendMessageToIframe(e){var n,r;return Cr(this,void 0,void 0,(function*(){if("hidden"===document.visibilityState)return;const i="https://recording.betterbugs.io/message-listener";let o;try{o=new URL(i).origin}catch(e){return void l.error("Invalid MESSAGE_LISTENER_URL:",e)}if(document.getElementById(t))try{null===(n=this.iframeRef)||void 0===n||n.contentWindow.postMessage({type:"application",data:e,timestamp:Date.now()},o),null===(r=this.iframeRef)||void 0===r||r.contentWindow.postMessage({type:"urlInfo",domain:window.location.hostname,pageTitle:document.title,url:window.location.href},o)}catch(e){l.log(e)}}))}cleanUpdata(){return Cr(this,void 0,void 0,(function*(){const e=Date.now();if(e-parseInt(localStorage.getItem("lastCleanup")||"0")>=this.CLEAN_UP_INTERVAL){const t=60*this.minutesToKeepData*1e3;this.deleteRewindDataOnTabReload(t),yield this.db.logs.where("timestamp").between(0,Date.now()-t,!0,!0).delete(),localStorage.setItem("lastCleanup",e.toString())}}))}deleteRewindDataOnTabReload(e){return Cr(this,void 0,void 0,(function*(){try{return yield this.db.rewind.where("timestamp").between(0,Date.now()-e,!0,!0).delete(),!0}catch(e){return l.log("🚀 ~ deleteRewindDataOnTabReload ~ error:",e),!1}}))}startPeriodicBatchProcess(){this.interval=setInterval((()=>{var e;this.batchQueue.length>0&&this.processBatch(),(null===(e=this.rewindBatchQueue)||void 0===e?void 0:e.length)>0&&this.processRewindBatch(),this.cleanUpdata()}),this.BATCH_INTERVAL)}initDB(){return Cr(this,void 0,void 0,(function*(){return this.dbInitPromise||(this.dbInitPromise=new Promise(((e,t)=>{try{const n=parseInt("1");this.db=new mr("logger-DB"),this.db.version(n).stores({logs:"++id,tabId,timestamp,type,recordingIds,[tabId+timestamp]",rewind:"++id,tabId,timestamp,[tabId+timestamp]"}),this.db.open().then((()=>{this.dbInitialized=!0,l.log("Database initialized successfully"),e()})).catch((e=>{t(e)}))}catch(e){t(e)}}))),this.dbInitPromise}))}addToBatch(e){var n;return Cr(this,void 0,void 0,(function*(){try{this.iframeRef||this.createIframe();const r="https://recording.betterbugs.io/message-listener";if(!r)return void l.error("MESSAGE_LISTENER_URL is not defined");let i;try{i=new URL(r).origin}catch(e){return void l.error("Invalid MESSAGE_LISTENER_URL:",e)}if(this.iframeRef&&document.getElementById(t)&&"visible"===document.visibilityState&&(null===(n=this.iframeRef)||void 0===n?void 0:n.contentWindow))try{this.iframeRef.contentWindow.postMessage(e,i)}catch(e){l.log(e)}this.batchQueue.push(Object.assign({},e)),this.batchQueue.length>=this.BATCH_SIZE&&(yield this.processBatch())}catch(e){l.error("Error in addToBatch:",e)}}))}addRewindDataToBatch(e){return Cr(this,void 0,void 0,(function*(){this.rewindBatchQueue.push(e),this.rewindBatchQueue.length>=this.BATCH_SIZE&&(yield this.processRewindBatch())}))}processRewindBatch(){var e,t,n,r,i,o;return Cr(this,void 0,void 0,(function*(){if(this.processingRewindBatch||0===this.rewindBatchQueue.length)return;let a=[];try{this.processingRewindBatch=!0,a=this.rewindBatchQueue.splice(0,this.BATCH_SIZE);const n=a.filter((e=>!!e)).map((e=>Object.assign(Object.assign({},e),{event:this.sanitizeForIndexedDB(e.event),events:Array.isArray(e.events)?e.events.map((e=>this.sanitizeForIndexedDB(e))):e.events})));yield null===(t=null===(e=null==this?void 0:this.db)||void 0===e?void 0:e.rewind)||void 0===t?void 0:t.bulkAdd(n)}catch(e){l.error("Error processing rewind batch:",e);for(const e of a)try{const t=Object.assign(Object.assign({},e),{event:this.sanitizeForIndexedDB(e.event),events:Array.isArray(e.events)?e.events.map((e=>this.sanitizeForIndexedDB(e))):e.events});yield null===(r=null===(n=null==this?void 0:this.db)||void 0===n?void 0:n.rewind)||void 0===r?void 0:r.put(t)}catch(t){l.error("Failed to save individual rewind log:",t,e);const n=t;if("DataCloneError"===n.name||"ConstraintError"===n.name)try{const t={id:e.id||Date.now().toString(),type:"rewind",timestamp:e.timestamp||Date.now(),tabId:e.tabId||rt(),createdAt:e.createdAt||(new Date).toISOString(),event:{error:"Original rewind data could not be stored",errorType:n.name,originalEventType:typeof e.event}};yield null===(o=null===(i=null==this?void 0:this.db)||void 0===i?void 0:i.rewind)||void 0===o?void 0:o.put(t)}catch(e){l.error("Failed to save even minimal rewind log version:",e)}}}finally{this.processingRewindBatch=!1}}))}sanitizeForIndexedDB(e){try{return JSON.parse(JSON.stringify(e))}catch(t){return l.error("Failed to sanitize data for IndexedDB:",t),{error:"Data sanitization failed",originalType:typeof e,timestamp:Date.now()}}}processBatch(){var e,t,n,r,i,o;return Cr(this,void 0,void 0,(function*(){if(this.processingBatch||0===this.batchQueue.length)return;let a=[];try{this.processingBatch=!0,a=this.batchQueue.splice(0,this.BATCH_SIZE);const n=a.filter((e=>!!e)).map((e=>Object.assign(Object.assign({},e),{data:this.sanitizeForIndexedDB(e.data)})));yield null===(t=null===(e=null==this?void 0:this.db)||void 0===e?void 0:e.logs)||void 0===t?void 0:t.bulkAdd(n)}catch(e){l.error("Error processing batch:",e);for(const e of a)try{const t=Object.assign(Object.assign({},e),{data:this.sanitizeForIndexedDB(e.data)});yield null===(r=null===(n=null==this?void 0:this.db)||void 0===n?void 0:n.logs)||void 0===r?void 0:r.put(t)}catch(t){l.error("Failed to save individual log:",t,e);const n=t;if("DataCloneError"===n.name||"ConstraintError"===n.name)try{const t={type:e.type||"unknown",timestamp:e.timestamp||0,tabId:e.tabId||rt(),data:{error:"Original data could not be stored",errorType:n.name,originalDataType:typeof e.data}};yield null===(o=null===(i=null==this?void 0:this.db)||void 0===i?void 0:i.logs)||void 0===o?void 0:o.put(t)}catch(e){l.error("Failed to save even minimal log version:",e)}}}finally{this.processingBatch=!1}}))}saveNetworkRequest(e){var t;return Cr(this,void 0,void 0,(function*(){if(!e)return;const n=JSON.parse(localStorage.getItem("recordingStatuses")||"[]")||[],r=null===(t=null==n?void 0:n.filter((e=>e.currentlyRecording)))||void 0===t?void 0:t.map((e=>e.id));if(!this.isInitializedForRecordingLink||(null==r?void 0:r.length))try{yield this.addToBatch({type:"network",timestamp:e.timestamp||Date.now(),data:e,recordingIds:r,tabId:rt()})}catch(e){l.error("Error handling network response:",e)}}))}saveConsoleLog(e){var t;return Cr(this,void 0,void 0,(function*(){if(e)try{const n=JSON.parse(localStorage.getItem("recordingStatuses")||"[]")||[],r=null===(t=null==n?void 0:n.filter((e=>e.currentlyRecording)))||void 0===t?void 0:t.map((e=>e.id));if(this.isInitializedForRecordingLink&&!(null==r?void 0:r.length))return;yield this.addToBatch({type:"console",timestamp:e.timestamp||0,data:e,recordingIds:r,tabId:rt()})}catch(e){l.error("Error handling console logs",e)}}))}saveSteps(e){var t;return Cr(this,void 0,void 0,(function*(){if(e)try{const n=JSON.parse(localStorage.getItem("recordingStatuses")||"[]")||[],r=null===(t=null==n?void 0:n.filter((e=>e.currentlyRecording)))||void 0===t?void 0:t.map((e=>e.id));if(this.isInitializedForRecordingLink&&!(null==r?void 0:r.length))return;yield this.addToBatch({type:"step",timestamp:e.timestamp?Number(e.timestamp):0,data:e,tabId:rt(),recordingIds:r})}catch(e){l.error("Error handling steps data",e)}}))}saveApplicationData(e){var t;return Cr(this,void 0,void 0,(function*(){if(e)try{const n=JSON.parse(localStorage.getItem("recordingStatuses")||"[]")||[],r=null===(t=null==n?void 0:n.filter((e=>e.currentlyRecording)))||void 0===t?void 0:t.map((e=>e.id));if(this.isInitializedForRecordingLink&&!(null==r?void 0:r.length))return;yield this.addToBatch({type:"application",timestamp:e.timestamp||Date.now(),data:e.data,tabId:rt(),recordingIds:r})}catch(e){l.error("Error handling steps data",e)}}))}saveRewindData(e){return Cr(this,void 0,void 0,(function*(){if(e)try{yield this.addRewindDataToBatch(Object.assign(Object.assign({},e),{type:"rewind",tabId:rt()}))}catch(e){l.error("Error handling rewind data",e)}}))}handleSuspend(){return Cr(this,void 0,void 0,(function*(){l.log("Extension suspending, performing cleanup..."),yield this.destroy()}))}destroy(){var e;return Cr(this,void 0,void 0,(function*(){this.isDestroyed||(this.isDestroyed=!0,clearInterval(this.interval),yield this.processBatch(),yield this.processRewindBatch(),yield null===(e=null==this?void 0:this.db)||void 0===e?void 0:e.close())}))}getLogsByStackTrace(e,t=!1,n=!1){return Cr(this,void 0,void 0,(function*(){const r=this.batchQueue,i=yield this.queryLogs(e,!1,t,n);l.log("logs",i);const o=e.reduce(((e,t)=>({startTime:Math.min(e.startTime,t.startTime||0),endTime:Math.max(e.endTime,t.endTime||Date.now())})),{startTime:1/0,endTime:-1/0});return[...i,...(null==r?void 0:r.filter((e=>e.timestamp>o.startTime&&e.timestamp<o.endTime)))||[]]}))}queryLogs(e,t=!1,n=!1,r=!1){var i,o,a,s,u,c,d,h,f;return Cr(this,void 0,void 0,(function*(){if(this.dbInitialized||(yield this.initDB()),!e||0===e.length)return[];l.log("Database state:",{dbExists:!!this.db,isDestroyed:this.isDestroyed,dbVersion:null===(i=this.db)||void 0===i?void 0:i.verno,hasLogsTable:!!(null===(o=this.db)||void 0===o?void 0:o.logs),isInitialized:this.dbInitialized}),l.log("stackTrace",e,t,n);const p=e.reduce(((e,t)=>({startTime:Math.min(e.startTime,t.startTime||0),endTime:Math.max(e.endTime,t.endTime||Date.now())})),{startTime:1/0,endTime:-1/0});l.log("timeRange",p,r,t),n&&(p.startTime-=12e4);try{if(t)return yield null===(a=null==this?void 0:this.db)||void 0===a?void 0:a.rewind.where(["tabId","timestamp"]).between([rt(),p.startTime],[rt(),p.endTime],!0,!0).toArray();if(r){l.log("isFromRecordingLink",r),l.log("this?.db?.logs",null===(s=null==this?void 0:this.db)||void 0===s?void 0:s.logs,this.db);let t=null===(u=null==this?void 0:this.db)||void 0===u?void 0:u.logs.where("timestamp").between(p.startTime,p.endTime,!0,!0);l.log("isFromRecordingLink2",r),(null===(c=e[0])||void 0===c?void 0:c.type)&&(t=t.filter((t=>t.type===e[0].type))),l.log("isFromRecordingLink3",r),(null===(d=e[0])||void 0===d?void 0:d.recordingId)&&(t=t.filter((t=>{var n;return!!(null===(n=t.recordingIds)||void 0===n?void 0:n.length)&&t.recordingIds.includes(e[0].recordingId||"")}))),l.log("isFromRecordingLink4",r),l.log("datdshgdjh dayusgd uasygada");const n=yield t.reverse().toArray();return l.log("datdshgdjhada",n),n}{const t=(null===(h=e[0])||void 0===h?void 0:h.type)?t=>t.type===e[0].type:()=>!0;return yield null===(f=null==this?void 0:this.db)||void 0===f?void 0:f.logs.where(["tabId","timestamp"]).between([rt(),p.startTime],[rt(),p.endTime],!0,!0).filter(t).reverse().toArray()}}catch(e){return l.log(e),l.error("Error querying logs:",e),[]}}))}}Er._instance=null;var Or=Er,Mr=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))};const Tr=[8,9,13,16,17,18,19,20,27,33,32,34,35,36,37,38,39,40,45,46],Rr=/(^|@)\S+:\d+/,Dr=/^\s*at .*(\S+:\d+|\(native\))/m,Nr=/^(eval@)?(\[native code])?$/;class Ar{constructor(e){this.fileName=e.fileName||"",this.functionName=e.functionName||"",this.lineNumber=e.lineNumber,this.columnNumber=e.columnNumber}toString(){const e=this.lineNumber||"",t=this.columnNumber||"";return this.functionName?this.functionName+" ("+this.fileName+":"+e+":"+t+")":this.fileName+":"+e+":"+t}}const Lr={parse:function(e){if(!e)return[];if(void 0!==e.stacktrace||void 0!==e["opera#sourceloc"])return this.parseOpera(e);if(e.stack&&e.stack.match(Dr))return this.parseV8OrIE(e);if(e.stack)return this.parseFFOrSafari(e);throw new Error("Cannot parse given Error object")},extractLocation:function(e){if(-1===e.indexOf(":"))return[e,void 0,void 0];const t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!t)throw new Error(`Cannot parse given url: ${e}`);return[t[1],t[2]?parseInt(t[2]):void 0,t[3]?parseInt(t[3]):void 0]},parseV8OrIE:function(e){return e.stack.split("\n").filter((function(e){return!!e.match(Dr)}),this).map((function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let t=e.replace(/^\s+/,"").replace(/\(eval code/g,"(");const n=t.match(/ (\((.+):(\d+):(\d+)\)$)/);t=n?t.replace(n[0],""):t;const r=t.split(/\s+/).slice(1),i=this.extractLocation(n?n[1]:r.pop()),o=r.join(" ")||void 0,a=["eval","<anonymous>"].indexOf(i[0])>-1?void 0:i[0];return new Ar({functionName:o,fileName:a,lineNumber:i[1],columnNumber:i[2]})}),this)},parseFFOrSafari:function(e){return e.stack.split("\n").filter((function(e){return!e.match(Nr)}),this).map((function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new Ar({functionName:e});{const t=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(t),r=n&&n[1]?n[1]:void 0,i=this.extractLocation(e.replace(t,""));return new Ar({functionName:r,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})}}),this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){const t=/Line (\d+).*script (?:in )?(\S+)/i,n=e.message.split("\n"),r=[];for(let e=2,i=n.length;e<i;e+=2){const i=t.exec(n[e]);i&&r.push(new Ar({fileName:i[2],lineNumber:parseFloat(i[1])}))}return r},parseOpera10:function(e){const t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=e.stacktrace.split("\n"),r=[];for(let e=0,i=n.length;e<i;e+=2){const i=t.exec(n[e]);i&&r.push(new Ar({functionName:i[3]||void 0,fileName:i[2],lineNumber:parseFloat(i[1])}))}return r},parseOpera11:function(e){return e.stack.split("\n").filter((function(e){return!!e.match(Rr)&&!e.match(/^Error created at/)}),this).map((function(e){const t=e.split("@"),n=this.extractLocation(t.pop()),r=(t.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new Ar({functionName:r,fileName:n[0],lineNumber:n[1],columnNumber:n[2]})}),this)}};class Pr{constructor(t){this.handleKeyUpEvent=t=>{var n,r;(null===document||void 0===document?void 0:document.getElementById(e))&&(null===(n=null===document||void 0===document?void 0:document.getElementById(e))||void 0===n?void 0:n.contains(document.activeElement))||(null==Tr?void 0:Tr.includes(t.keyCode))&&this.onSteps({id:tt(),eventType:a,eventData:32!==t.keyCode?t.key:t.keyCode.toString(),count:0,eventElement:nt((null===(r=document.activeElement)||void 0===r?void 0:r.outerHTML)||"",200),url:window.location.href,timestamp:Date.now(),createdAt:(new Date).toDateString()})},window.stopRRweb=void 0,this.dbLogger=new Or({maxRecordingMinutes:t.maxRecordingMinutes,isInitializedForRecordingLink:t.isInitializedForRecordingLink}),this.isInitializedForRecordingLink=t.isInitializedForRecordingLink,this.maxRecordingMinutes=t.maxRecordingMinutes,window.addEventListener("visibilitychange",(()=>Mr(this,void 0,void 0,(function*(){var e;if("visible"===document.visibilityState){const t=yield this.getApplicationData();this.isInitializedForRecordingLink&&this.updateRecordingStatuses(),null===(e=this.dbLogger)||void 0===e||e.sendMessageToIframe(t)}})))),(()=>{Mr(this,void 0,void 0,(function*(){var e;const t=yield this.getApplicationData();null===(e=this.dbLogger)||void 0===e||e.sendMessageToIframe(t),this.isInitializedForRecordingLink&&this.updateRecordingStatuses()}))})()}localStorageListener(){window.addEventListener("storage",(e=>{"recordingStatuses"===e.key&&this.updateRecordingStatuses()}))}updateRecordingStatuses(){var e;return Mr(this,void 0,void 0,(function*(){if(window.isRecordingTab)return;let t=JSON.parse(localStorage.getItem("recordingStatuses")||"[]")||[];t=et(t);const n=t.map((e=>((e=et(e)).currentlyRecording&&(e.domain=window.location.hostname,e.pageTitle=document.title,e.url=window.location.href),e)));localStorage.setItem("recordingStatuses",JSON.stringify(n));const r=yield this.getApplicationData();null===(e=this.dbLogger)||void 0===e||e.saveApplicationData({type:"application",data:r,timestamp:Date.now()})}))}static getInstance(e){return Pr.instance||(Pr.instance=new Pr({maxRecordingMinutes:e.maxRecordingMinutes,isInitializedForRecordingLink:e.isInitializedForRecordingLink})),Pr.instance}listenConsoleEvents(){if(window.location.href.includes("https://challenges.cloudflare.com"))return;let e;const t={},n=[],r=function(){},i=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"];e=[];const o={};let a;const s=new Set,u=function(){let t,i;try{i=function(){return r},window.console?(window.console.isToastLogConsole?(a=Object.assign({},window.console.toastLogOldConsole),delete window.console.toastLogOldConsole,delete window.console.isToastLogConsole,window.console=a):a=Object.assign({},window.console),t=function(t){let a;return t in console&&(a=console[t])&&(console[t]=function(...i){var u,c,l,d;let h,f,p;const m=null===(u=null==n?void 0:n.slice)||void 0===u?void 0:u.call(i,0);for(f=0,p=Math.min(o[t].handlers.length,10);f<p;f++)s.has(o[t].handlers[f])&&(null===(c=null==r?void 0:r.apply)||void 0===c||c.call(o[t].handlers[f],console,m));for(f=0,p=Math.min(e.length,10);f<p;f++)s.has(e[f])&&(h=[t],n.push.apply(h,m),null===(l=null==r?void 0:r.apply)||void 0===l||l.call(e[f],console,h));null===(d=null==r?void 0:r.apply)||void 0===d||d.call(a,console,m)}),console[t]||i}):t=i}catch(e){l.error(e)}return t}();!function(){let e,t,n;for(e=0,t=i.length;e<t;e++)n=i[e],o[n]={handlers:[]},"function"==typeof u&&u(n)}();const c=function(){e=[];for(const e in o)o[e].handlers=[];s.clear(),window.console=a};window.realConsoleListener=window.console,window.ConsoleListener={on:function(n,r){var i;try{let a,u;if("[object Object]"===(null===(i=t.toString)||void 0===i?void 0:i.call(n)))for(a in n)u=n[a],"all"===a?e.length<10&&(e.push(u),s.add(u)):a in o&&o[a].handlers.length<10&&(o[a].handlers.push(u),s.add(u));else"function"==typeof n?e.length<10&&(e.push(n),s.add(n)):n in o&&o[n].handlers.length<10&&(o[n].handlers.push(r),s.add(r))}catch(e){l.error(e)}},close:c};const d={};i.forEach((e=>{d[e]=(t,...n)=>{const r=Lr.parse(new Error(void 0));this.onConsoleEvent("custom",{type:e,extra:void 0,fileUrl:r,e:t,more:n})}})),window.ConsoleListener.on(d),window.addEventListener("unload",c),window.onerror=(e,t="",n,r,i)=>{const o={msg:e,url:t,lineNo:n,columnNo:r,error:i},a=new Ar({columnNumber:r,fileName:t,lineNumber:n});this.onConsoleEvent("custom",{type:"error",extra:o,e:o.msg,fileUrl:a})};const h=e=>{const t=Lr.parse(new Error("0"));let n,r;try{n=null==e?void 0:e.reason}catch(e){n=void 0}try{r=null==e?void 0:e.detail,!n&&r&&(n=null==r?void 0:r.reason)}catch(e){}n||(n="[unhandledrejection] error getting `reason` from event"),this.onConsoleEvent("custom",{type:"error",e:`Uncaught (in promise) ${n}`,fileUrl:t,extra:void 0})};window.addEventListener("unhandledrejection",h),window.addEventListener("unload",(()=>{window.removeEventListener("unhandledrejection",h)}))}ListenNetworkEvents(){const e=window.fetch,t=this,n=e=>{if(!e)return!1;const t=e.toLowerCase();return t.includes("application/json")||t.includes("text/")||t.includes("application/xml")||t.includes("application/x-www-form-urlencoded")};window.fetch=function(...r){var i;return Mr(this,void 0,void 0,(function*(){const o=Date.now(),a=r[0]instanceof Request?r[0]:new Request(r[0].toString(),r[1]),s=a.url;let u;try{if(!(null===(i=a.signal)||void 0===i?void 0:i.aborted)){const e=a.headers.get("content-type");n(e)&&(u=yield a.clone().text())}}catch(e){l.error("Error reading request body:",e)}return new Promise(((i,c)=>{e.apply(window,r).then((e=>Mr(this,void 0,void 0,(function*(){var r,c;try{if(e&&!(null===(r=a.signal)||void 0===r?void 0:r.aborted)){const r=e.clone(),i=e.headers.get("content-type"),d=a.method,h=Object.fromEntries(a.headers),f=Object.fromEntries(e.headers),p=Date.now();let m;try{n(i)&&(m=(null==i?void 0:i.toLowerCase().includes("json"))?JSON.stringify(yield r.json()):yield r.text())}catch(e){if(l.error("Error parsing response:",e),n(i))try{m=yield r.text()}catch(e){l.error("Error parsing response as text:",e)}}"true"===h["ignore-bb-capture"]||window.isRecordingTab||null===(c=t.dbLogger)||void 0===c||c.saveNetworkRequest({id:tt(),method:d,response:m,requestBody:u,requestHeaders:Object.entries(h).map((([e,t])=>({name:e,value:t}))),responseHeaders:Object.entries(f).map((([e,t])=>({name:e,value:t}))),url:s||e.url,statusCode:e.status,isError:e.status>=400,type:"xmlhttprequest",createdAt:(new Date).toDateString(),timestamp:Date.now(),startTime:o,endTime:p,initiator:window.location.origin})}}catch(e){l.error("Error processing fetch response:",e)}i(e)})))).catch((e=>{l.error("Fetch request failed:",e),c(e)}))}))}))},function(){const e=XMLHttpRequest.prototype,r=e.open,i=e.send,o=e.setRequestHeader;e.open=function(e,t){try{this._startTime=Date.now(),this._method=e,this._url=(e=>{try{return new URL(e,window.location.origin).toString()}catch(t){return l.error("Error getting absolute URL:",t),e}})(t),this._requestHeaders={}}catch(e){l.error("Error in XHR open:",e)}return r.apply(this,[e,t,!0,null,null])},e.setRequestHeader=function(e,t){try{this._requestHeaders&&(this._requestHeaders[e]=t)}catch(e){l.error("Error in XHR setRequestHeader:",e)}return o.apply(this,[e,t])},e.send=function(e){var r,o;try{const i=(null===(r=this._requestHeaders)||void 0===r?void 0:r["content-type"])||(null===(o=this._requestHeaders)||void 0===o?void 0:o["Content-Type"]);n(i||null)&&(this._requestBody=e),this.addEventListener("load",(function(){var e;try{const r=this._method||"GET",i=this._requestHeaders||{},o=this._url||this.responseURL,a=this.status,s=this._startTime||Date.now(),u=this.getAllResponseHeaders().split("\r\n").reduce(((e,t)=>{const[n,r]=t.split(": ");return n&&r&&(e[n]=r),e}),{}),c=Date.now(),l=this.getResponseHeader("content-type");let d;n(l)&&(d=this.response),"true"===i["ignore-bb-capture"]||window.isRecordingTab||null===(e=t.dbLogger)||void 0===e||e.saveNetworkRequest({id:tt(),method:r,response:d,requestBody:this._requestBody,requestHeaders:Object.entries(i).map((([e,t])=>({name:e,value:t}))),responseHeaders:Object.entries(u).map((([e,t])=>({name:e,value:t}))),url:o,isError:a>=400,statusCode:a,type:"xmlhttprequest",createdAt:(new Date).toDateString(),timestamp:Date.now(),startTime:s,endTime:c,initiator:window.location.origin})}catch(e){l.error("Error processing XHR response:",e)}}))}catch(e){l.error("Error in XHR send:",e)}return i.apply(this,[e])}}()}initializeRecording(t){try{window.stopRRweb&&window.stopRRweb(),window.stopRRweb=hr({emit:(e,n)=>{const r=et(e);switch(r.isCheckout=n,t&&this.onRRwebEvent(r),r.type){case un.IncrementalSnapshot:r.data.source===cn.MouseInteraction&&r.data.type===ln.Click?((e,t)=>{let n=null;return(...r)=>{n&&clearTimeout(n),n=setTimeout((()=>{e(...r)}),t)}})((e=>this.handleClickEvent(e)),100)(r):r.data.source===cn.Input&&this.handleInputEvent(r);break;case un.Meta&&!n:this.handleNavigationEvent(r)}},errorHandler:e=>(l.log("🚀 ~ error:",e),!0),recordCrossOriginIframes:!1,inlineStylesheet:!0,maskInputOptions:{email:!0,password:!0,number:!0,tel:!0},blockSelector:`#${e}`,maskTextSelector:'[data-betterbugs="ignore"]',slimDOMOptions:{comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0},checkoutEveryNms:2e3})}catch(e){l.log("error: ",e)}window.addEventListener("keyup",this.handleKeyUpEvent)}handleNavigationEvent(e){this.onSteps({id:tt(),eventType:i,eventData:e.data.href,eventElement:null,url:window.location.href,timestamp:Date.now(),createdAt:(new Date).toDateString()})}handleInputEvent(t){var n,r,i;(null===document||void 0===document?void 0:document.getElementById(e))&&(null===(n=null===document||void 0===document?void 0:document.getElementById(e))||void 0===n?void 0:n.contains(document.activeElement))||"BODY"===(null===(r=document.activeElement)||void 0===r?void 0:r.tagName)||this.onSteps({id:tt(),eventType:o,eventData:t.data.text,eventElement:nt((null===(i=null===document||void 0===document?void 0:document.activeElement)||void 0===i?void 0:i.outerHTML)||"",200),url:window.location.href,timestamp:Date.now(),createdAt:(new Date).toDateString()})}handleClickEvent(t){var n,i,o,a,s,u;(null===document||void 0===document?void 0:document.getElementById(e))&&(null===(n=null===document||void 0===document?void 0:document.getElementById(e))||void 0===n?void 0:n.contains(document.elementFromPoint(null===(i=null==t?void 0:t.data)||void 0===i?void 0:i.x,null===(o=null==t?void 0:t.data)||void 0===o?void 0:o.y)))||this.onSteps({id:tt(),eventType:r,eventData:(null===(a=document.elementFromPoint(t.data.x,t.data.y))||void 0===a?void 0:a.innerText)?null===(s=document.elementFromPoint(t.data.x,t.data.y))||void 0===s?void 0:s.innerText:"",eventElement:nt((null===(u=null===document||void 0===document?void 0:document.elementFromPoint(t.data.x,t.data.y))||void 0===u?void 0:u.outerHTML)||"",200),url:window.location.href,timestamp:Date.now(),createdAt:(new Date).toDateString()})}onConsoleEvent(e,t){var n,r,i;window.isRecordingTab||("rrweb"===e&&"data"in t?null===(n=this.dbLogger)||void 0===n||n.saveConsoleLog({id:tt(),args:null===(r=t.data.payload.payload)||void 0===r?void 0:r.map((e=>{try{return JSON.parse(e)}catch(t){return e}})),file:t.data.payload.trace,timestamp:Date.now(),url:window.location.href,type:t.data.payload.level,createdAt:(new Date).toDateString()}):"type"in t&&(null===(i=this.dbLogger)||void 0===i||i.saveConsoleLog({type:t.type,args:[t.e,...(null==t?void 0:t.more)||[]],timestamp:Date.now(),url:window.location.href,file:t.fileUrl,id:tt(),createdAt:(new Date).toDateString()})))}onRRwebEvent(e){var t;return Mr(this,void 0,void 0,(function*(){window.isRecordingTab||null===(t=this.dbLogger)||void 0===t||t.saveRewindData({id:tt(),event:e,createdAt:(new Date).toDateString(),timestamp:Date.now(),url:window.location.href})}))}onSteps(e){var t;return Mr(this,void 0,void 0,(function*(){window.isRecordingTab||null===(t=this.dbLogger)||void 0===t||t.saveSteps(e)}))}getApplicationData(){var e,t;return Mr(this,void 0,void 0,(function*(){if(window.isRecordingTab)return[];const n=[],r=null===window||void 0===window?void 0:window.localStorage,i=null===window||void 0===window?void 0:window.sessionStorage,o=document.cookie.split(";").map((e=>{const[t,n]=e.trim().split("=");return{args:{name:t,value:decodeURIComponent(n),domain:window.location.hostname,path:"/",secure:"https:"===window.location.protocol,httpOnly:!1,sameSite:"lax",hostOnly:!1,session:!0,storeId:"0",expirationDate:null},type:"cookie",url:window.location.href,timestamp:Date.now()}}));if(n.push(...o),r)for(const t in r)if(null===(e=Object.prototype.hasOwnProperty)||void 0===e?void 0:e.call(r,t)){const e=r[t];if("function"==typeof e)continue;const i={args:{key:t,value:e},type:"local",url:window.location.href,timestamp:Date.now()};n.push(i)}for(const e in i)if(null===(t=Object.prototype.hasOwnProperty)||void 0===t?void 0:t.call(i,e)){const t=i[e];if("function"==typeof t)continue;const r={args:{key:e,value:t},type:"session",url:window.location.href,timestamp:Date.now()};n.push(r)}return n}))}startRecording({captureRewindEvents:e=!0}){return Mr(this,void 0,void 0,(function*(){Pr.getInstance({maxRecordingMinutes:this.maxRecordingMinutes,isInitializedForRecordingLink:this.isInitializedForRecordingLink}).ListenNetworkEvents(),Pr.getInstance({maxRecordingMinutes:this.maxRecordingMinutes,isInitializedForRecordingLink:this.isInitializedForRecordingLink}).listenConsoleEvents(),Pr.getInstance({maxRecordingMinutes:this.maxRecordingMinutes,isInitializedForRecordingLink:this.isInitializedForRecordingLink}).initializeRecording(e),window.isBetterbugsLogsCaptureInitialized=!0}))}getAllData(e,t=!1){var n,r;return Mr(this,void 0,void 0,(function*(){const[i,o]=yield Promise.all([t?null===(n=this.dbLogger)||void 0===n?void 0:n.queryLogs(e,!0):Promise.resolve([]),null===(r=this.dbLogger)||void 0===r?void 0:r.queryLogs(e,!1,!0)]);return{rewindData:i,logsData:o}}))}captureScreenshot(){return Mr(this,void 0,void 0,(function*(){const e=new CustomEvent("betterbugs:captureScreenshot");document.dispatchEvent(e)}))}submitBug(e){return Mr(this,void 0,void 0,(function*(){const t=new CustomEvent("betterbugs:submitBug",{detail:e});document.dispatchEvent(t)}))}stopRecording(){var e;return Mr(this,void 0,void 0,(function*(){window.stopRRweb&&window.stopRRweb(),this.dbLogger&&(null===(e=this.dbLogger)||void 0===e||e.destroy(),this.dbLogger=void 0),Pr.instance=void 0}))}}window.isBetterbugsLogsCaptureInitialized||Pr.getInstance({maxRecordingMinutes:15,isInitializedForRecordingLink:!0}).startRecording({captureRewindEvents:!1})}(),r=r.default}()}));
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Betterbugs=t():e.Betterbugs=t()}(this,(function(){return function(){var e={7753:function(e,t,n){e.exports=function(){"use strict";var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)},t=function(){return(t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function r(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||((r=r||Array.prototype.slice.call(t,0,i))[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,o=Object.keys,a=Array.isArray;function s(e,t){return"object"!=typeof t||o(t).forEach((function(n){e[n]=t[n]})),e}"undefined"==typeof Promise||i.Promise||(i.Promise=Promise);var u=Object.getPrototypeOf,c={}.hasOwnProperty;function l(e,t){return c.call(e,t)}function d(e,t){"function"==typeof t&&(t=t(u(e))),("undefined"==typeof Reflect?o:Reflect.ownKeys)(t).forEach((function(n){f(e,n,t[n])}))}var h=Object.defineProperty;function f(e,t,n,r){h(e,t,s(n&&l(n,"get")&&"function"==typeof n.get?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function p(e){return{from:function(t){return e.prototype=Object.create(t.prototype),f(e.prototype,"constructor",e),{extend:d.bind(null,e.prototype)}}}}var m=Object.getOwnPropertyDescriptor,y=[].slice;function v(e,t,n){return y.call(e,t,n)}function g(e,t){return t(e)}function b(e){if(!e)throw new Error("Assertion Failed")}function w(e){i.setImmediate?setImmediate(e):setTimeout(e,0)}function S(e,t){if("string"==typeof t&&l(e,t))return e[t];if(!t)return e;if("string"!=typeof t){for(var n=[],r=0,i=t.length;r<i;++r){var o=S(e,t[r]);n.push(o)}return n}var a=t.indexOf(".");if(-1!==a){var s=e[t.substr(0,a)];return null==s?void 0:S(s,t.substr(a+1))}}function k(e,t,n){if(e&&void 0!==t&&(!("isFrozen"in Object)||!Object.isFrozen(e)))if("string"!=typeof t&&"length"in t){b("string"!=typeof n&&"length"in n);for(var r=0,i=t.length;r<i;++r)k(e,t[r],n[r])}else{var o,s,u=t.indexOf(".");-1!==u?(o=t.substr(0,u),""===(s=t.substr(u+1))?void 0===n?a(e)&&!isNaN(parseInt(o))?e.splice(o,1):delete e[o]:e[o]=n:k(u=(u=e[o])&&l(e,o)?u:e[o]={},s,n)):void 0===n?a(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=n}}function I(e){var t,n={};for(t in e)l(e,t)&&(n[t]=e[t]);return n}var x=[].concat;function _(e){return x.apply([],e)}var C="BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(_([8,16,32,64].map((function(e){return["Int","Uint","Float"].map((function(t){return t+e+"Array"}))})))).filter((function(e){return i[e]})),E=new Set(C.map((function(e){return i[e]}))),O=null;function M(e){return O=new WeakMap,e=function e(t){if(!t||"object"!=typeof t)return t;var n=O.get(t);if(n)return n;if(a(t)){n=[],O.set(t,n);for(var r=0,i=t.length;r<i;++r)n.push(e(t[r]))}else if(E.has(t.constructor))n=t;else{var o,s=u(t);for(o in n=s===Object.prototype?{}:Object.create(s),O.set(t,n),t)l(t,o)&&(n[o]=e(t[o]))}return n}(e),O=null,e}var T={}.toString;function R(e){return T.call(e).slice(8,-1)}var D="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator",N="symbol"==typeof D?function(e){var t;return null!=e&&(t=e[D])&&t.apply(e)}:function(){return null};function A(e,t){return 0<=(t=e.indexOf(t))&&e.splice(t,1),0<=t}var L={};function P(e){var t,n,r,i;if(1===arguments.length){if(a(e))return e.slice();if(this===L&&"string"==typeof e)return[e];if(i=N(e)){for(n=[];!(r=i.next()).done;)n.push(r.value);return n}if(null==e)return[e];if("number"!=typeof(t=e.length))return[e];for(n=new Array(t);t--;)n[t]=e[t];return n}for(t=arguments.length,n=new Array(t);t--;)n[t]=arguments[t];return n}var F="undefined"!=typeof Symbol?function(e){return"AsyncFunction"===e[Symbol.toStringTag]}:function(){return!1},j=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(ue=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"]),B={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};function q(e,t){this.name=e,this.message=t}function K(e,t){return e+". Errors: "+Object.keys(t).map((function(e){return t[e].toString()})).filter((function(e,t,n){return n.indexOf(e)===t})).join("\n")}function U(e,t,n,r){this.failures=t,this.failedKeys=r,this.successCount=n,this.message=K(e,t)}function z(e,t){this.name="BulkError",this.failures=Object.keys(t).map((function(e){return t[e]})),this.failuresByPos=t,this.message=K(e,this.failures)}p(q).from(Error).extend({toString:function(){return this.name+": "+this.message}}),p(U).from(q),p(z).from(q);var W=j.reduce((function(e,t){return e[t]=t+"Error",e}),{}),H=q,V=j.reduce((function(e,t){var n=t+"Error";function r(e,r){this.name=n,e?"string"==typeof e?(this.message="".concat(e).concat(r?"\n "+r:""),this.inner=r||null):"object"==typeof e&&(this.message="".concat(e.name," ").concat(e.message),this.inner=e):(this.message=B[t]||n,this.inner=null)}return p(r).from(H),e[t]=r,e}),{});V.Syntax=SyntaxError,V.Type=TypeError,V.Range=RangeError;var $=ue.reduce((function(e,t){return e[t+"Error"]=V[t],e}),{}),G=j.reduce((function(e,t){return-1===["Syntax","Type","Range"].indexOf(t)&&(e[t+"Error"]=V[t]),e}),{});function X(){}function Y(e){return e}function Q(e,t){return null==e||e===Y?t:function(n){return t(e(n))}}function J(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function Z(e,t){return e===X?t:function(){var n=e.apply(this,arguments);void 0!==n&&(arguments[0]=n);var r=this.onsuccess,i=this.onerror;this.onsuccess=null,this.onerror=null;var o=t.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?J(r,this.onsuccess):r),i&&(this.onerror=this.onerror?J(i,this.onerror):i),void 0!==o?o:n}}function ee(e,t){return e===X?t:function(){e.apply(this,arguments);var n=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,t.apply(this,arguments),n&&(this.onsuccess=this.onsuccess?J(n,this.onsuccess):n),r&&(this.onerror=this.onerror?J(r,this.onerror):r)}}function te(e,t){return e===X?t:function(n){var r=e.apply(this,arguments);s(n,r);var i=this.onsuccess,o=this.onerror;return this.onsuccess=null,this.onerror=null,n=t.apply(this,arguments),i&&(this.onsuccess=this.onsuccess?J(i,this.onsuccess):i),o&&(this.onerror=this.onerror?J(o,this.onerror):o),void 0===r?void 0===n?void 0:n:s(r,n)}}function ne(e,t){return e===X?t:function(){return!1!==t.apply(this,arguments)&&e.apply(this,arguments)}}function re(e,t){return e===X?t:function(){var n=e.apply(this,arguments);if(n&&"function"==typeof n.then){for(var r=this,i=arguments.length,o=new Array(i);i--;)o[i]=arguments[i];return n.then((function(){return t.apply(r,o)}))}return t.apply(this,arguments)}}G.ModifyError=U,G.DexieError=q,G.BulkError=z;var ie="undefined"!=typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function oe(e){ie=e}var ae={},se=100,ue=(C="undefined"==typeof Promise?[]:function(){var e=Promise.resolve();if("undefined"==typeof crypto||!crypto.subtle)return[e,u(e),e];var t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,u(t),e]}(),C[0]),ce=(j=C[1],C=C[2],j=j&&j.then,ue&&ue.constructor),le=!!C,de=function(e,t){be.push([e,t]),fe&&(queueMicrotask(Me),fe=!1)},he=!0,fe=!0,pe=[],me=[],ye=Y,ve={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:X,pgp:!1,env:{},finalize:X},ge=ve,be=[],we=0,Se=[];function ke(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");this._listeners=[],this._lib=!1;var t=this._PSD=ge;if("function"!=typeof e){if(e!==ae)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&_e(this,this._value))}this._state=null,this._value=null,++t.ref,function e(t,n){try{n((function(n){if(null===t._state){if(n===t)throw new TypeError("A promise cannot be resolved with itself.");var r=t._lib&&Te();n&&"function"==typeof n.then?e(t,(function(e,t){n instanceof ke?n._then(e,t):n.then(e,t)})):(t._state=!0,t._value=n,Ce(t)),r&&Re()}}),_e.bind(null,t))}catch(n){_e(t,n)}}(this,e)}var Ie={get:function(){var e=ge,t=Be;function n(n,r){var i=this,o=!e.global&&(e!==ge||t!==Be),a=o&&!ze(),s=new ke((function(t,s){Ee(i,new xe(Xe(n,e,o,a),Xe(r,e,o,a),t,s,e))}));return this._consoleTask&&(s._consoleTask=this._consoleTask),s}return n.prototype=ae,n},set:function(e){f(this,"then",e&&e.prototype===ae?Ie:{get:function(){return e},set:Ie.set})}};function xe(e,t,n,r,i){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.resolve=n,this.reject=r,this.psd=i}function _e(e,t){var n,r;me.push(t),null===e._state&&(n=e._lib&&Te(),t=ye(t),e._state=!1,e._value=t,r=e,pe.some((function(e){return e._value===r._value}))||pe.push(r),Ce(e),n&&Re())}function Ce(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)Ee(e,t[n]);var i=e._PSD;--i.ref||i.finalize(),0===we&&(++we,de((function(){0==--we&&De()}),[]))}function Ee(e,t){if(null!==e._state){var n=e._state?t.onFulfilled:t.onRejected;if(null===n)return(e._state?t.resolve:t.reject)(e._value);++t.psd.ref,++we,de(Oe,[n,e,t])}else e._listeners.push(t)}function Oe(e,t,n){try{var r,i=t._value;!t._state&&me.length&&(me=[]),r=ie&&t._consoleTask?t._consoleTask.run((function(){return e(i)})):e(i),t._state||-1!==me.indexOf(i)||function(e){for(var t=pe.length;t;)if(pe[--t]._value===e._value)return pe.splice(t,1)}(t),n.resolve(r)}catch(e){n.reject(e)}finally{0==--we&&De(),--n.psd.ref||n.psd.finalize()}}function Me(){Ge(ve,(function(){Te()&&Re()}))}function Te(){var e=he;return fe=he=!1,e}function Re(){var e,t,n;do{for(;0<be.length;)for(e=be,be=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}}while(0<be.length);fe=he=!0}function De(){var e=pe;pe=[],e.forEach((function(e){e._PSD.onunhandled.call(null,e._value,e)}));for(var t=Se.slice(0),n=t.length;n;)t[--n]()}function Ne(e){return new ke(ae,!1,e)}function Ae(e,t){var n=ge;return function(){var r=Te(),i=ge;try{return Ve(n,!0),e.apply(this,arguments)}catch(r){t&&t(r)}finally{Ve(i,!1),r&&Re()}}}d(ke.prototype,{then:Ie,_then:function(e,t){Ee(this,new xe(null,null,e,t,ge))},catch:function(e){if(1===arguments.length)return this.then(null,e);var t=e,n=arguments[1];return"function"==typeof t?this.then(null,(function(e){return(e instanceof t?n:Ne)(e)})):this.then(null,(function(e){return(e&&e.name===t?n:Ne)(e)}))},finally:function(e){return this.then((function(t){return ke.resolve(e()).then((function(){return t}))}),(function(t){return ke.resolve(e()).then((function(){return Ne(t)}))}))},timeout:function(e,t){var n=this;return e<1/0?new ke((function(r,i){var o=setTimeout((function(){return i(new V.Timeout(t))}),e);n.then(r,i).finally(clearTimeout.bind(null,o))})):this}}),"undefined"!=typeof Symbol&&Symbol.toStringTag&&f(ke.prototype,Symbol.toStringTag,"Dexie.Promise"),ve.env=$e(),d(ke,{all:function(){var e=P.apply(null,arguments).map(We);return new ke((function(t,n){0===e.length&&t([]);var r=e.length;e.forEach((function(i,o){return ke.resolve(i).then((function(n){e[o]=n,--r||t(e)}),n)}))}))},resolve:function(e){return e instanceof ke?e:e&&"function"==typeof e.then?new ke((function(t,n){e.then(t,n)})):new ke(ae,!0,e)},reject:Ne,race:function(){var e=P.apply(null,arguments).map(We);return new ke((function(t,n){e.map((function(e){return ke.resolve(e).then(t,n)}))}))},PSD:{get:function(){return ge},set:function(e){return ge=e}},totalEchoes:{get:function(){return Be}},newPSD:Ke,usePSD:Ge,scheduler:{get:function(){return de},set:function(e){de=e}},rejectionMapper:{get:function(){return ye},set:function(e){ye=e}},follow:function(e,t){return new ke((function(n,r){return Ke((function(t,n){var r=ge;r.unhandleds=[],r.onunhandled=n,r.finalize=J((function(){var e,r=this;e=function(){0===r.unhandleds.length?t():n(r.unhandleds[0])},Se.push((function t(){e(),Se.splice(Se.indexOf(t),1)})),++we,de((function(){0==--we&&De()}),[])}),r.finalize),e()}),t,n,r)}))}}),ce&&(ce.allSettled&&f(ke,"allSettled",(function(){var e=P.apply(null,arguments).map(We);return new ke((function(t){0===e.length&&t([]);var n=e.length,r=new Array(n);e.forEach((function(e,i){return ke.resolve(e).then((function(e){return r[i]={status:"fulfilled",value:e}}),(function(e){return r[i]={status:"rejected",reason:e}})).then((function(){return--n||t(r)}))}))}))})),ce.any&&"undefined"!=typeof AggregateError&&f(ke,"any",(function(){var e=P.apply(null,arguments).map(We);return new ke((function(t,n){0===e.length&&n(new AggregateError([]));var r=e.length,i=new Array(r);e.forEach((function(e,o){return ke.resolve(e).then((function(e){return t(e)}),(function(e){i[o]=e,--r||n(new AggregateError(i))}))}))}))})),ce.withResolvers&&(ke.withResolvers=ce.withResolvers));var Le={awaits:0,echoes:0,id:0},Pe=0,Fe=[],je=0,Be=0,qe=0;function Ke(e,t,n,r){var i=ge,o=Object.create(i);return o.parent=i,o.ref=0,o.global=!1,o.id=++qe,ve.env,o.env=le?{Promise:ke,PromiseProp:{value:ke,configurable:!0,writable:!0},all:ke.all,race:ke.race,allSettled:ke.allSettled,any:ke.any,resolve:ke.resolve,reject:ke.reject}:{},t&&s(o,t),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()},r=Ge(o,e,n,r),0===o.ref&&o.finalize(),r}function Ue(){return Le.id||(Le.id=++Pe),++Le.awaits,Le.echoes+=se,Le.id}function ze(){return!!Le.awaits&&(0==--Le.awaits&&(Le.id=0),Le.echoes=Le.awaits*se,!0)}function We(e){return Le.echoes&&e&&e.constructor===ce?(Ue(),e.then((function(e){return ze(),e}),(function(e){return ze(),Qe(e)}))):e}function He(){var e=Fe[Fe.length-1];Fe.pop(),Ve(e,!1)}function Ve(e,t){var n,r=ge;(t?!Le.echoes||je++&&e===ge:!je||--je&&e===ge)||queueMicrotask(t?function(e){++Be,Le.echoes&&0!=--Le.echoes||(Le.echoes=Le.awaits=Le.id=0),Fe.push(ge),Ve(e,!0)}.bind(null,e):He),e!==ge&&(ge=e,r===ve&&(ve.env=$e()),le&&(n=ve.env.Promise,t=e.env,(r.global||e.global)&&(Object.defineProperty(i,"Promise",t.PromiseProp),n.all=t.all,n.race=t.race,n.resolve=t.resolve,n.reject=t.reject,t.allSettled&&(n.allSettled=t.allSettled),t.any&&(n.any=t.any))))}function $e(){var e=i.Promise;return le?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(i,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject}:{}}function Ge(e,t,n,r,i){var o=ge;try{return Ve(e,!0),t(n,r,i)}finally{Ve(o,!1)}}function Xe(e,t,n,r){return"function"!=typeof e?e:function(){var i=ge;n&&Ue(),Ve(t,!0);try{return e.apply(this,arguments)}finally{Ve(i,!1),r&&queueMicrotask(ze)}}}function Ye(e){Promise===ce&&0===Le.echoes?0===je?e():enqueueNativeMicroTask(e):setTimeout(e,0)}-1===(""+j).indexOf("[native code]")&&(Ue=ze=X);var Qe=ke.reject,Je=String.fromCharCode(65535),Ze="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",et="String expected.",tt=[],nt="__dbnames",rt="readonly",it="readwrite";function ot(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}var at={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function st(e){return"string"!=typeof e||/\./.test(e)?function(e){return e}:function(t){return void 0===t[e]&&e in t&&delete(t=M(t))[e],t}}function ut(){throw V.Type()}function ct(e,t){try{var n=lt(e),r=lt(t);if(n!==r)return"Array"===n?1:"Array"===r?-1:"binary"===n?1:"binary"===r?-1:"string"===n?1:"string"===r?-1:"Date"===n?1:"Date"!==r?NaN:-1;switch(n){case"number":case"Date":case"string":return t<e?1:e<t?-1:0;case"binary":return function(e,t){for(var n=e.length,r=t.length,i=n<r?n:r,o=0;o<i;++o)if(e[o]!==t[o])return e[o]<t[o]?-1:1;return n===r?0:n<r?-1:1}(dt(e),dt(t));case"Array":return function(e,t){for(var n=e.length,r=t.length,i=n<r?n:r,o=0;o<i;++o){var a=ct(e[o],t[o]);if(0!==a)return a}return n===r?0:n<r?-1:1}(e,t)}}catch(e){}return NaN}function lt(e){var t=typeof e;return"object"!=t?t:ArrayBuffer.isView(e)||"ArrayBuffer"===(e=R(e))?"binary":e}function dt(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}var ht=(ft.prototype._trans=function(e,t,n){var r=this._tx||ge.trans,i=this.name,o=ie&&"undefined"!=typeof console&&console.createTask&&void 0;function a(e,n,r){if(!r.schema[i])throw new V.NotFound("Table "+i+" not part of transaction");return t(r.idbtrans,r)}var s=Te();try{var u=r&&r.db._novip===this.db._novip?r===ge.trans?r._promise(e,a,n):Ke((function(){return r._promise(e,a,n)}),{trans:r,transless:ge.transless||ge}):function e(t,n,r,i){if(t.idbdb&&(t._state.openComplete||ge.letThrough||t._vip)){var o=t._createTransaction(n,r,t._dbSchema);try{o.create(),t._state.PR1398_maxLoop=3}catch(o){return o.name===W.InvalidState&&t.isOpen()&&0<--t._state.PR1398_maxLoop?(t.close({disableAutoOpen:!1}),t.open().then((function(){return e(t,n,r,i)}))):Qe(o)}return o._promise(n,(function(e,t){return Ke((function(){return ge.trans=o,i(e,t,o)}))})).then((function(e){if("readwrite"===n)try{o.idbtrans.commit()}catch(e){}return"readonly"===n?e:o._completion.then((function(){return e}))}))}if(t._state.openComplete)return Qe(new V.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._state.autoOpen)return Qe(new V.DatabaseClosed);t.open().catch(X)}return t._state.dbReadyPromise.then((function(){return e(t,n,r,i)}))}(this.db,e,[this.name],a);return o&&(u._consoleTask=o,u=u.catch((function(e){return Qe(e)}))),u}finally{s&&Re()}},ft.prototype.get=function(e,t){var n=this;return e&&e.constructor===Object?this.where(e).first(t):null==e?Qe(new V.Type("Invalid argument to Table.get()")):this._trans("readonly",(function(t){return n.core.get({trans:t,key:e}).then((function(e){return n.hook.reading.fire(e)}))})).then(t)},ft.prototype.where=function(e){if("string"==typeof e)return new this.db.WhereClause(this,e);if(a(e))return new this.db.WhereClause(this,"[".concat(e.join("+"),"]"));var t=o(e);if(1===t.length)return this.where(t[0]).equals(e[t[0]]);var n=this.schema.indexes.concat(this.schema.primKey).filter((function(e){if(e.compound&&t.every((function(t){return 0<=e.keyPath.indexOf(t)}))){for(var n=0;n<t.length;++n)if(-1===t.indexOf(e.keyPath[n]))return!1;return!0}return!1})).sort((function(e,t){return e.keyPath.length-t.keyPath.length}))[0];if(n&&this.db._maxKey!==Je){var r=n.keyPath.slice(0,t.length);return this.where(r).equals(r.map((function(t){return e[t]})))}var i=this.schema.idxByName;function s(e,t){return 0===ct(e,t)}var u=t.reduce((function(t,n){var r=t[0],o=t[1],u=(t=i[n],e[n]);return[r||t,r||!t?ot(o,t&&t.multi?function(e){return e=S(e,n),a(e)&&e.some((function(e){return s(u,e)}))}:function(e){return s(u,S(e,n))}):o]}),[null,null]);return r=u[0],u=u[1],r?this.where(r.name).equals(e[r.keyPath]).filter(u):n?this.filter(u):this.where(t).equals("")},ft.prototype.filter=function(e){return this.toCollection().and(e)},ft.prototype.count=function(e){return this.toCollection().count(e)},ft.prototype.offset=function(e){return this.toCollection().offset(e)},ft.prototype.limit=function(e){return this.toCollection().limit(e)},ft.prototype.each=function(e){return this.toCollection().each(e)},ft.prototype.toArray=function(e){return this.toCollection().toArray(e)},ft.prototype.toCollection=function(){return new this.db.Collection(new this.db.WhereClause(this))},ft.prototype.orderBy=function(e){return new this.db.Collection(new this.db.WhereClause(this,a(e)?"[".concat(e.join("+"),"]"):e))},ft.prototype.reverse=function(){return this.toCollection().reverse()},ft.prototype.mapToClass=function(t){var n,r=this.db,i=this.name;function o(){return null!==n&&n.apply(this,arguments)||this}(this.schema.mappedClass=t).prototype instanceof ut&&(function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}(o,n=t),Object.defineProperty(o.prototype,"db",{get:function(){return r},enumerable:!1,configurable:!0}),o.prototype.table=function(){return i},t=o);for(var a=new Set,s=t.prototype;s;s=u(s))Object.getOwnPropertyNames(s).forEach((function(e){return a.add(e)}));function c(e){if(!e)return e;var n,r=Object.create(t.prototype);for(n in e)if(!a.has(n))try{r[n]=e[n]}catch(e){}return r}return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=c,this.hook("reading",c),t},ft.prototype.defineClass=function(){return this.mapToClass((function(e){s(this,e)}))},ft.prototype.add=function(e,t){var n=this,r=this.schema.primKey,i=r.auto,o=r.keyPath,a=e;return o&&i&&(a=st(o)(e)),this._trans("readwrite",(function(e){return n.core.mutate({trans:e,type:"add",keys:null!=t?[t]:null,values:[a]})})).then((function(e){return e.numFailures?ke.reject(e.failures[0]):e.lastResult})).then((function(t){if(o)try{k(e,o,t)}catch(t){}return t}))},ft.prototype.update=function(e,t){return"object"!=typeof e||a(e)?this.where(":id").equals(e).modify(t):void 0===(e=S(e,this.schema.primKey.keyPath))?Qe(new V.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(e).modify(t)},ft.prototype.put=function(e,t){var n=this,r=this.schema.primKey,i=r.auto,o=r.keyPath,a=e;return o&&i&&(a=st(o)(e)),this._trans("readwrite",(function(e){return n.core.mutate({trans:e,type:"put",values:[a],keys:null!=t?[t]:null})})).then((function(e){return e.numFailures?ke.reject(e.failures[0]):e.lastResult})).then((function(t){if(o)try{k(e,o,t)}catch(t){}return t}))},ft.prototype.delete=function(e){var t=this;return this._trans("readwrite",(function(n){return t.core.mutate({trans:n,type:"delete",keys:[e]})})).then((function(e){return e.numFailures?ke.reject(e.failures[0]):void 0}))},ft.prototype.clear=function(){var e=this;return this._trans("readwrite",(function(t){return e.core.mutate({trans:t,type:"deleteRange",range:at})})).then((function(e){return e.numFailures?ke.reject(e.failures[0]):void 0}))},ft.prototype.bulkGet=function(e){var t=this;return this._trans("readonly",(function(n){return t.core.getMany({keys:e,trans:n}).then((function(e){return e.map((function(e){return t.hook.reading.fire(e)}))}))}))},ft.prototype.bulkAdd=function(e,t,n){var r=this,i=Array.isArray(t)?t:void 0,o=(n=n||(i?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",(function(t){var n=(s=r.schema.primKey).auto;if((s=s.keyPath)&&i)throw new V.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(i&&i.length!==e.length)throw new V.InvalidArgument("Arguments objects and keys must have the same length");var a=e.length,s=s&&n?e.map(st(s)):e;return r.core.mutate({trans:t,type:"add",keys:i,values:s,wantResults:o}).then((function(e){var t=e.numFailures,n=e.results,i=e.lastResult;if(e=e.failures,0===t)return o?n:i;throw new z("".concat(r.name,".bulkAdd(): ").concat(t," of ").concat(a," operations failed"),e)}))}))},ft.prototype.bulkPut=function(e,t,n){var r=this,i=Array.isArray(t)?t:void 0,o=(n=n||(i?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",(function(t){var n=(s=r.schema.primKey).auto;if((s=s.keyPath)&&i)throw new V.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(i&&i.length!==e.length)throw new V.InvalidArgument("Arguments objects and keys must have the same length");var a=e.length,s=s&&n?e.map(st(s)):e;return r.core.mutate({trans:t,type:"put",keys:i,values:s,wantResults:o}).then((function(e){var t=e.numFailures,n=e.results,i=e.lastResult;if(e=e.failures,0===t)return o?n:i;throw new z("".concat(r.name,".bulkPut(): ").concat(t," of ").concat(a," operations failed"),e)}))}))},ft.prototype.bulkUpdate=function(e){var t=this,n=this.core,r=e.map((function(e){return e.key})),i=e.map((function(e){return e.changes})),o=[];return this._trans("readwrite",(function(a){return n.getMany({trans:a,keys:r,cache:"clone"}).then((function(s){var u=[],c=[];e.forEach((function(e,n){var r=e.key,i=e.changes,a=s[n];if(a){for(var l=0,d=Object.keys(i);l<d.length;l++){var h=d[l],f=i[h];if(h===t.schema.primKey.keyPath){if(0!==ct(f,r))throw new V.Constraint("Cannot update primary key in bulkUpdate()")}else k(a,h,f)}o.push(n),u.push(r),c.push(a)}}));var l=u.length;return n.mutate({trans:a,type:"put",keys:u,values:c,updates:{keys:r,changeSpecs:i}}).then((function(e){var n=e.numFailures,r=e.failures;if(0===n)return l;for(var i=0,a=Object.keys(r);i<a.length;i++){var s,u=a[i],c=o[Number(u)];null!=c&&(s=r[u],delete r[u],r[c]=s)}throw new z("".concat(t.name,".bulkUpdate(): ").concat(n," of ").concat(l," operations failed"),r)}))}))}))},ft.prototype.bulkDelete=function(e){var t=this,n=e.length;return this._trans("readwrite",(function(n){return t.core.mutate({trans:n,type:"delete",keys:e})})).then((function(e){var r=e.numFailures,i=e.lastResult;if(e=e.failures,0===r)return i;throw new z("".concat(t.name,".bulkDelete(): ").concat(r," of ").concat(n," operations failed"),e)}))},ft);function ft(){}function pt(e){function t(t,r){if(r){for(var i=arguments.length,o=new Array(i-1);--i;)o[i-1]=arguments[i];return n[t].subscribe.apply(null,o),e}if("string"==typeof t)return n[t]}var n={};t.addEventType=s;for(var r=1,i=arguments.length;r<i;++r)s(arguments[r]);return t;function s(e,r,i){if("object"!=typeof e){var u;r=r||ne;var c={subscribers:[],fire:i=i||X,subscribe:function(e){-1===c.subscribers.indexOf(e)&&(c.subscribers.push(e),c.fire=r(c.fire,e))},unsubscribe:function(e){c.subscribers=c.subscribers.filter((function(t){return t!==e})),c.fire=c.subscribers.reduce(r,i)}};return n[e]=t[e]=c}o(u=e).forEach((function(e){var t=u[e];if(a(t))s(e,u[e][0],u[e][1]);else{if("asap"!==t)throw new V.InvalidArgument("Invalid event config");var n=s(e,Y,(function(){for(var e=arguments.length,t=new Array(e);e--;)t[e]=arguments[e];n.subscribers.forEach((function(e){w((function(){e.apply(null,t)}))}))}))}}))}}function mt(e,t){return p(t).from({prototype:e}),t}function yt(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function vt(e,t){e.filter=ot(e.filter,t)}function gt(e,t,n){var r=e.replayFilter;e.replayFilter=r?function(){return ot(r(),t())}:t,e.justLimit=n&&!r}function bt(e,t){if(e.isPrimKey)return t.primaryKey;var n=t.getIndexByKeyPath(e.index);if(!n)throw new V.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed");return n}function wt(e,t,n){var r=bt(e,t.schema);return t.openCursor({trans:n,values:!e.keysOnly,reverse:"prev"===e.dir,unique:!!e.unique,query:{index:r,range:e.range}})}function St(e,t,n,r){var i=e.replayFilter?ot(e.filter,e.replayFilter()):e.filter;if(e.or){var o={},a=function(e,n,r){var a,s;i&&!i(n,r,(function(e){return n.stop(e)}),(function(e){return n.fail(e)}))||("[object ArrayBuffer]"==(s=""+(a=n.primaryKey))&&(s=""+new Uint8Array(a)),l(o,s)||(o[s]=!0,t(e,n,r)))};return Promise.all([e.or._iterate(a,n),kt(wt(e,r,n),e.algorithm,a,!e.keysOnly&&e.valueMapper)])}return kt(wt(e,r,n),ot(e.algorithm,i),t,!e.keysOnly&&e.valueMapper)}function kt(e,t,n,r){var i=Ae(r?function(e,t,i){return n(r(e),t,i)}:n);return e.then((function(e){if(e)return e.start((function(){var n=function(){return e.continue()};t&&!t(e,(function(e){return n=e}),(function(t){e.stop(t),n=X}),(function(t){e.fail(t),n=X}))||i(e.value,e,(function(e){return n=e})),n()}))}))}var It=(xt.prototype.execute=function(e){var t=this["@@propmod"];if(void 0!==t.add){var n=t.add;if(a(n))return r(r([],a(e)?e:[],!0),n,!0).sort();if("number"==typeof n)return(Number(e)||0)+n;if("bigint"==typeof n)try{return BigInt(e)+n}catch(e){return BigInt(0)+n}throw new TypeError("Invalid term ".concat(n))}if(void 0!==t.remove){var i=t.remove;if(a(i))return a(e)?e.filter((function(e){return!i.includes(e)})).sort():[];if("number"==typeof i)return Number(e)-i;if("bigint"==typeof i)try{return BigInt(e)-i}catch(e){return BigInt(0)-i}throw new TypeError("Invalid subtrahend ".concat(i))}return(n=null===(n=t.replacePrefix)||void 0===n?void 0:n[0])&&"string"==typeof e&&e.startsWith(n)?t.replacePrefix[1]+e.substring(n.length):e},xt);function xt(e){this["@@propmod"]=e}var _t=(Ct.prototype._read=function(e,t){var n=this._ctx;return n.error?n.table._trans(null,Qe.bind(null,n.error)):n.table._trans("readonly",e).then(t)},Ct.prototype._write=function(e){var t=this._ctx;return t.error?t.table._trans(null,Qe.bind(null,t.error)):t.table._trans("readwrite",e,"locked")},Ct.prototype._addAlgorithm=function(e){var t=this._ctx;t.algorithm=ot(t.algorithm,e)},Ct.prototype._iterate=function(e,t){return St(this._ctx,e,t,this._ctx.table.core)},Ct.prototype.clone=function(e){var t=Object.create(this.constructor.prototype),n=Object.create(this._ctx);return e&&s(n,e),t._ctx=n,t},Ct.prototype.raw=function(){return this._ctx.valueMapper=null,this},Ct.prototype.each=function(e){var t=this._ctx;return this._read((function(n){return St(t,e,n,t.table.core)}))},Ct.prototype.count=function(e){var t=this;return this._read((function(e){var n=t._ctx,r=n.table.core;if(yt(n,!0))return r.count({trans:e,query:{index:bt(n,r.schema),range:n.range}}).then((function(e){return Math.min(e,n.limit)}));var i=0;return St(n,(function(){return++i,!1}),e,r).then((function(){return i}))})).then(e)},Ct.prototype.sortBy=function(e,t){var n=e.split(".").reverse(),r=n[0],i=n.length-1;function o(e,t){return t?o(e[n[t]],t-1):e[r]}var a="next"===this._ctx.dir?1:-1;function s(e,t){return ct(o(e,i),o(t,i))*a}return this.toArray((function(e){return e.sort(s)})).then(t)},Ct.prototype.toArray=function(e){var t=this;return this._read((function(e){var n=t._ctx;if("next"===n.dir&&yt(n,!0)&&0<n.limit){var r=n.valueMapper,i=bt(n,n.table.core.schema);return n.table.core.query({trans:e,limit:n.limit,values:!0,query:{index:i,range:n.range}}).then((function(e){return e=e.result,r?e.map(r):e}))}var o=[];return St(n,(function(e){return o.push(e)}),e,n.table.core).then((function(){return o}))}),e)},Ct.prototype.offset=function(e){var t=this._ctx;return e<=0||(t.offset+=e,yt(t)?gt(t,(function(){var t=e;return function(e,n){return 0===t||(1===t?--t:n((function(){e.advance(t),t=0})),!1)}})):gt(t,(function(){var t=e;return function(){return--t<0}}))),this},Ct.prototype.limit=function(e){return this._ctx.limit=Math.min(this._ctx.limit,e),gt(this._ctx,(function(){var t=e;return function(e,n,r){return--t<=0&&n(r),0<=t}}),!0),this},Ct.prototype.until=function(e,t){return vt(this._ctx,(function(n,r,i){return!e(n.value)||(r(i),t)})),this},Ct.prototype.first=function(e){return this.limit(1).toArray((function(e){return e[0]})).then(e)},Ct.prototype.last=function(e){return this.reverse().first(e)},Ct.prototype.filter=function(e){var t;return vt(this._ctx,(function(t){return e(t.value)})),(t=this._ctx).isMatch=ot(t.isMatch,e),this},Ct.prototype.and=function(e){return this.filter(e)},Ct.prototype.or=function(e){return new this.db.WhereClause(this._ctx.table,e,this)},Ct.prototype.reverse=function(){return this._ctx.dir="prev"===this._ctx.dir?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},Ct.prototype.desc=function(){return this.reverse()},Ct.prototype.eachKey=function(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,n){e(n.key,n)}))},Ct.prototype.eachUniqueKey=function(e){return this._ctx.unique="unique",this.eachKey(e)},Ct.prototype.eachPrimaryKey=function(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,n){e(n.primaryKey,n)}))},Ct.prototype.keys=function(e){var t=this._ctx;t.keysOnly=!t.isMatch;var n=[];return this.each((function(e,t){n.push(t.key)})).then((function(){return n})).then(e)},Ct.prototype.primaryKeys=function(e){var t=this._ctx;if("next"===t.dir&&yt(t,!0)&&0<t.limit)return this._read((function(e){var n=bt(t,t.table.core.schema);return t.table.core.query({trans:e,values:!1,limit:t.limit,query:{index:n,range:t.range}})})).then((function(e){return e.result})).then(e);t.keysOnly=!t.isMatch;var n=[];return this.each((function(e,t){n.push(t.primaryKey)})).then((function(){return n})).then(e)},Ct.prototype.uniqueKeys=function(e){return this._ctx.unique="unique",this.keys(e)},Ct.prototype.firstKey=function(e){return this.limit(1).keys((function(e){return e[0]})).then(e)},Ct.prototype.lastKey=function(e){return this.reverse().firstKey(e)},Ct.prototype.distinct=function(){var e;if(!(e=(e=this._ctx).index&&e.table.schema.idxByName[e.index])||!e.multi)return this;var t={};return vt(this._ctx,(function(e){var n=e.primaryKey.toString();return e=l(t,n),t[n]=!0,!e})),this},Ct.prototype.modify=function(e){var t=this,n=this._ctx;return this._write((function(r){var i,a,s;s="function"==typeof e?e:(i=o(e),a=i.length,function(t){for(var n=!1,r=0;r<a;++r){var o=i[r],s=e[o],u=S(t,o);s instanceof It?(k(t,o,s.execute(u)),n=!0):u!==s&&(k(t,o,s),n=!0)}return n});var u,c=n.table.core,l=(u=c.schema.primaryKey).outbound,d=u.extractKey,h=200;function f(e,t){var n=t.failures;t=t.numFailures,m+=e-t;for(var r=0,i=o(n);r<i.length;r++){var a=i[r];p.push(n[a])}}(u=t.db._options.modifyChunkSize)&&(h="object"==typeof u?u[c.name]||u["*"]||200:u);var p=[],m=0,y=[];return t.clone().primaryKeys().then((function(t){function i(n){var a=Math.min(h,t.length-n);return c.getMany({trans:r,keys:t.slice(n,n+a),cache:"immutable"}).then((function(u){for(var p=[],m=[],y=l?[]:null,v=[],g=0;g<a;++g){var b=u[g],w={value:M(b),primKey:t[n+g]};!1!==s.call(w,w.value,w)&&(null==w.value?v.push(t[n+g]):l||0===ct(d(b),d(w.value))?(m.push(w.value),l&&y.push(t[n+g])):(v.push(t[n+g]),p.push(w.value)))}return Promise.resolve(0<p.length&&c.mutate({trans:r,type:"add",values:p}).then((function(e){for(var t in e.failures)v.splice(parseInt(t),1);f(p.length,e)}))).then((function(){return(0<m.length||o&&"object"==typeof e)&&c.mutate({trans:r,type:"put",keys:y,values:m,criteria:o,changeSpec:"function"!=typeof e&&e,isAdditionalChunk:0<n}).then((function(e){return f(m.length,e)}))})).then((function(){return(0<v.length||o&&e===Et)&&c.mutate({trans:r,type:"delete",keys:v,criteria:o,isAdditionalChunk:0<n}).then((function(e){return f(v.length,e)}))})).then((function(){return t.length>n+a&&i(n+h)}))}))}var o=yt(n)&&n.limit===1/0&&("function"!=typeof e||e===Et)&&{index:n.index,range:n.range};return i(0).then((function(){if(0<p.length)throw new U("Error modifying one or more objects",p,m,y);return t.length}))}))}))},Ct.prototype.delete=function(){var e=this._ctx,t=e.range;return yt(e)&&(e.isPrimKey||3===t.type)?this._write((function(n){var r=e.table.core.schema.primaryKey,i=t;return e.table.core.count({trans:n,query:{index:r,range:i}}).then((function(t){return e.table.core.mutate({trans:n,type:"deleteRange",range:i}).then((function(e){var n=e.failures;if(e.lastResult,e.results,e=e.numFailures)throw new U("Could not delete some values",Object.keys(n).map((function(e){return n[e]})),t-e);return t-e}))}))})):this.modify(Et)},Ct);function Ct(){}var Et=function(e,t){return t.value=null};function Ot(e,t){return e<t?-1:e===t?0:1}function Mt(e,t){return t<e?-1:e===t?0:1}function Tt(e,t,n){return(e=e instanceof Lt?new e.Collection(e):e)._ctx.error=new(n||TypeError)(t),e}function Rt(e){return new e.Collection(e,(function(){return At("")})).limit(0)}function Dt(e,t,n,r){var i,o,a,s,u,c,l,d=n.length;if(!n.every((function(e){return"string"==typeof e})))return Tt(e,et);function h(e){i="next"===e?function(e){return e.toUpperCase()}:function(e){return e.toLowerCase()},o="next"===e?function(e){return e.toLowerCase()}:function(e){return e.toUpperCase()},a="next"===e?Ot:Mt;var t=n.map((function(e){return{lower:o(e),upper:i(e)}})).sort((function(e,t){return a(e.lower,t.lower)}));s=t.map((function(e){return e.upper})),u=t.map((function(e){return e.lower})),l="next"===(c=e)?"":r}h("next"),(e=new e.Collection(e,(function(){return Nt(s[0],u[d-1]+r)})))._ondirectionchange=function(e){h(e)};var f=0;return e._addAlgorithm((function(e,n,r){var i=e.key;if("string"!=typeof i)return!1;var h=o(i);if(t(h,u,f))return!0;for(var p=null,m=f;m<d;++m){var y=function(e,t,n,r,i,o){for(var a=Math.min(e.length,r.length),s=-1,u=0;u<a;++u){var c=t[u];if(c!==r[u])return i(e[u],n[u])<0?e.substr(0,u)+n[u]+n.substr(u+1):i(e[u],r[u])<0?e.substr(0,u)+r[u]+n.substr(u+1):0<=s?e.substr(0,s)+t[s]+n.substr(s+1):null;i(e[u],c)<0&&(s=u)}return a<r.length&&"next"===o?e+n.substr(e.length):a<e.length&&"prev"===o?e.substr(0,n.length):s<0?null:e.substr(0,s)+r[s]+n.substr(s+1)}(i,h,s[m],u[m],a,c);null===y&&null===p?f=m+1:(null===p||0<a(p,y))&&(p=y)}return n(null!==p?function(){e.continue(p+l)}:r),!1})),e}function Nt(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function At(e){return{type:1,lower:e,upper:e}}var Lt=(Object.defineProperty(Pt.prototype,"Collection",{get:function(){return this._ctx.table.db.Collection},enumerable:!1,configurable:!0}),Pt.prototype.between=function(e,t,n,r){n=!1!==n,r=!0===r;try{return 0<this._cmp(e,t)||0===this._cmp(e,t)&&(n||r)&&(!n||!r)?Rt(this):new this.Collection(this,(function(){return Nt(e,t,!n,!r)}))}catch(e){return Tt(this,Ze)}},Pt.prototype.equals=function(e){return null==e?Tt(this,Ze):new this.Collection(this,(function(){return At(e)}))},Pt.prototype.above=function(e){return null==e?Tt(this,Ze):new this.Collection(this,(function(){return Nt(e,void 0,!0)}))},Pt.prototype.aboveOrEqual=function(e){return null==e?Tt(this,Ze):new this.Collection(this,(function(){return Nt(e,void 0,!1)}))},Pt.prototype.below=function(e){return null==e?Tt(this,Ze):new this.Collection(this,(function(){return Nt(void 0,e,!1,!0)}))},Pt.prototype.belowOrEqual=function(e){return null==e?Tt(this,Ze):new this.Collection(this,(function(){return Nt(void 0,e)}))},Pt.prototype.startsWith=function(e){return"string"!=typeof e?Tt(this,et):this.between(e,e+Je,!0,!0)},Pt.prototype.startsWithIgnoreCase=function(e){return""===e?this.startsWith(e):Dt(this,(function(e,t){return 0===e.indexOf(t[0])}),[e],Je)},Pt.prototype.equalsIgnoreCase=function(e){return Dt(this,(function(e,t){return e===t[0]}),[e],"")},Pt.prototype.anyOfIgnoreCase=function(){var e=P.apply(L,arguments);return 0===e.length?Rt(this):Dt(this,(function(e,t){return-1!==t.indexOf(e)}),e,"")},Pt.prototype.startsWithAnyOfIgnoreCase=function(){var e=P.apply(L,arguments);return 0===e.length?Rt(this):Dt(this,(function(e,t){return t.some((function(t){return 0===e.indexOf(t)}))}),e,Je)},Pt.prototype.anyOf=function(){var e=this,t=P.apply(L,arguments),n=this._cmp;try{t.sort(n)}catch(r){return Tt(this,Ze)}if(0===t.length)return Rt(this);var r=new this.Collection(this,(function(){return Nt(t[0],t[t.length-1])}));r._ondirectionchange=function(r){n="next"===r?e._ascending:e._descending,t.sort(n)};var i=0;return r._addAlgorithm((function(e,r,o){for(var a=e.key;0<n(a,t[i]);)if(++i===t.length)return r(o),!1;return 0===n(a,t[i])||(r((function(){e.continue(t[i])})),!1)})),r},Pt.prototype.notEqual=function(e){return this.inAnyRange([[-1/0,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},Pt.prototype.noneOf=function(){var e=P.apply(L,arguments);if(0===e.length)return new this.Collection(this);try{e.sort(this._ascending)}catch(e){return Tt(this,Ze)}var t=e.reduce((function(e,t){return e?e.concat([[e[e.length-1][1],t]]):[[-1/0,t]]}),null);return t.push([e[e.length-1],this.db._maxKey]),this.inAnyRange(t,{includeLowers:!1,includeUppers:!1})},Pt.prototype.inAnyRange=function(e,t){var n=this,r=this._cmp,i=this._ascending,o=this._descending,a=this._min,s=this._max;if(0===e.length)return Rt(this);if(!e.every((function(e){return void 0!==e[0]&&void 0!==e[1]&&i(e[0],e[1])<=0})))return Tt(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",V.InvalidArgument);var u,c=!t||!1!==t.includeLowers,l=t&&!0===t.includeUppers,d=i;function h(e,t){return d(e[0],t[0])}try{(u=e.reduce((function(e,t){for(var n=0,i=e.length;n<i;++n){var o=e[n];if(r(t[0],o[1])<0&&0<r(t[1],o[0])){o[0]=a(o[0],t[0]),o[1]=s(o[1],t[1]);break}}return n===i&&e.push(t),e}),[])).sort(h)}catch(e){return Tt(this,Ze)}var f=0,p=l?function(e){return 0<i(e,u[f][1])}:function(e){return 0<=i(e,u[f][1])},m=c?function(e){return 0<o(e,u[f][0])}:function(e){return 0<=o(e,u[f][0])},y=p;return(e=new this.Collection(this,(function(){return Nt(u[0][0],u[u.length-1][1],!c,!l)})))._ondirectionchange=function(e){d="next"===e?(y=p,i):(y=m,o),u.sort(h)},e._addAlgorithm((function(e,t,r){for(var o,a=e.key;y(a);)if(++f===u.length)return t(r),!1;return!p(o=a)&&!m(o)||(0===n._cmp(a,u[f][1])||0===n._cmp(a,u[f][0])||t((function(){d===i?e.continue(u[f][0]):e.continue(u[f][1])})),!1)})),e},Pt.prototype.startsWithAnyOf=function(){var e=P.apply(L,arguments);return e.every((function(e){return"string"==typeof e}))?0===e.length?Rt(this):this.inAnyRange(e.map((function(e){return[e,e+Je]}))):Tt(this,"startsWithAnyOf() only works with strings")},Pt);function Pt(){}function Ft(e){return Ae((function(t){return jt(t),e(t.target.error),!1}))}function jt(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}var Bt="storagemutated",qt="x-storagemutated-1",Kt=pt(null,Bt),Ut=(zt.prototype._lock=function(){return b(!ge.global),++this._reculock,1!==this._reculock||ge.global||(ge.lockOwnerFor=this),this},zt.prototype._unlock=function(){if(b(!ge.global),0==--this._reculock)for(ge.global||(ge.lockOwnerFor=null);0<this._blockedFuncs.length&&!this._locked();){var e=this._blockedFuncs.shift();try{Ge(e[1],e[0])}catch(e){}}return this},zt.prototype._locked=function(){return this._reculock&&ge.lockOwnerFor!==this},zt.prototype.create=function(e){var t=this;if(!this.mode)return this;var n=this.db.idbdb,r=this.db._state.dbOpenError;if(b(!this.idbtrans),!e&&!n)switch(r&&r.name){case"DatabaseClosedError":throw new V.DatabaseClosed(r);case"MissingAPIError":throw new V.MissingAPI(r.message,r);default:throw new V.OpenFailed(r)}if(!this.active)throw new V.TransactionInactive;return b(null===this._completion._state),(e=this.idbtrans=e||(this.db.core||n).transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability})).onerror=Ae((function(n){jt(n),t._reject(e.error)})),e.onabort=Ae((function(n){jt(n),t.active&&t._reject(new V.Abort(e.error)),t.active=!1,t.on("abort").fire(n)})),e.oncomplete=Ae((function(){t.active=!1,t._resolve(),"mutatedParts"in e&&Kt.storagemutated.fire(e.mutatedParts)})),this},zt.prototype._promise=function(e,t,n){var r=this;if("readwrite"===e&&"readwrite"!==this.mode)return Qe(new V.ReadOnly("Transaction is readonly"));if(!this.active)return Qe(new V.TransactionInactive);if(this._locked())return new ke((function(i,o){r._blockedFuncs.push([function(){r._promise(e,t,n).then(i,o)},ge])}));if(n)return Ke((function(){var e=new ke((function(e,n){r._lock();var i=t(e,n,r);i&&i.then&&i.then(e,n)}));return e.finally((function(){return r._unlock()})),e._lib=!0,e}));var i=new ke((function(e,n){var i=t(e,n,r);i&&i.then&&i.then(e,n)}));return i._lib=!0,i},zt.prototype._root=function(){return this.parent?this.parent._root():this},zt.prototype.waitFor=function(e){var t,n=this._root(),r=ke.resolve(e);n._waitingFor?n._waitingFor=n._waitingFor.then((function(){return r})):(n._waitingFor=r,n._waitingQueue=[],t=n.idbtrans.objectStore(n.storeNames[0]),function e(){for(++n._spinCount;n._waitingQueue.length;)n._waitingQueue.shift()();n._waitingFor&&(t.get(-1/0).onsuccess=e)}());var i=n._waitingFor;return new ke((function(e,t){r.then((function(t){return n._waitingQueue.push(Ae(e.bind(null,t)))}),(function(e){return n._waitingQueue.push(Ae(t.bind(null,e)))})).finally((function(){n._waitingFor===i&&(n._waitingFor=null)}))}))},zt.prototype.abort=function(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new V.Abort))},zt.prototype.table=function(e){var t=this._memoizedTables||(this._memoizedTables={});if(l(t,e))return t[e];var n=this.schema[e];if(!n)throw new V.NotFound("Table "+e+" not part of transaction");return(n=new this.db.Table(e,n,this)).core=this.db.core.table(e),t[e]=n},zt);function zt(){}function Wt(e,t,n,r,i,o,a){return{name:e,keyPath:t,unique:n,multi:r,auto:i,compound:o,src:(n&&!a?"&":"")+(r?"*":"")+(i?"++":"")+Ht(t)}}function Ht(e){return"string"==typeof e?e:e?"["+[].join.call(e,"+")+"]":""}function Vt(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:(r=function(e){return[e.name,e]},n.reduce((function(e,t,n){return(n=r(t,n))&&(e[n[0]]=n[1]),e}),{}))};var r}var $t=function(e){try{return e.only([[]]),$t=function(){return[[]]},[[]]}catch(e){return $t=function(){return Je},Je}};function Gt(e){return null==e?function(){}:"string"==typeof e?1===(t=e).split(".").length?function(e){return e[t]}:function(e){return S(e,t)}:function(t){return S(t,e)};var t}function Xt(e){return[].slice.call(e)}var Yt=0;function Qt(e){return null==e?":id":"string"==typeof e?e:"[".concat(e.join("+"),"]")}function Jt(e,t,n){function r(e){if(3===e.type)return null;if(4===e.type)throw new Error("Cannot convert never type to IDBKeyRange");var n=e.lower,r=e.upper,i=e.lowerOpen;return e=e.upperOpen,void 0===n?void 0===r?null:t.upperBound(r,!!e):void 0===r?t.lowerBound(n,!!i):t.bound(n,r,!!i,!!e)}function i(e){var t,n=e.name;return{name:n,schema:e,mutate:function(e){var t=e.trans,i=e.type,o=e.keys,a=e.values,s=e.range;return new Promise((function(e,u){e=Ae(e);var c=t.objectStore(n),l=null==c.keyPath,d="put"===i||"add"===i;if(!d&&"delete"!==i&&"deleteRange"!==i)throw new Error("Invalid operation type: "+i);var h,f=(o||a||{length:1}).length;if(o&&a&&o.length!==a.length)throw new Error("Given keys array must have same length as given values array.");if(0===f)return e({numFailures:0,failures:{},results:[],lastResult:void 0});function p(e){++v,jt(e)}var m=[],y=[],v=0;if("deleteRange"===i){if(4===s.type)return e({numFailures:v,failures:y,results:[],lastResult:void 0});3===s.type?m.push(h=c.clear()):m.push(h=c.delete(r(s)))}else{var g=(l=d?l?[a,o]:[a,null]:[o,null])[0],b=l[1];if(d)for(var w=0;w<f;++w)m.push(h=b&&void 0!==b[w]?c[i](g[w],b[w]):c[i](g[w])),h.onerror=p;else for(w=0;w<f;++w)m.push(h=c[i](g[w])),h.onerror=p}function S(t){t=t.target.result,m.forEach((function(e,t){return null!=e.error&&(y[t]=e.error)})),e({numFailures:v,failures:y,results:"delete"===i?o:m.map((function(e){return e.result})),lastResult:t})}h.onerror=function(e){p(e),S(e)},h.onsuccess=S}))},getMany:function(e){var t=e.trans,r=e.keys;return new Promise((function(e,i){e=Ae(e);for(var o,a=t.objectStore(n),s=r.length,u=new Array(s),c=0,l=0,d=function(t){t=t.target,u[t._pos]=t.result,++l===c&&e(u)},h=Ft(i),f=0;f<s;++f)null!=r[f]&&((o=a.get(r[f]))._pos=f,o.onsuccess=d,o.onerror=h,++c);0===c&&e(u)}))},get:function(e){var t=e.trans,r=e.key;return new Promise((function(e,i){e=Ae(e);var o=t.objectStore(n).get(r);o.onsuccess=function(t){return e(t.target.result)},o.onerror=Ft(i)}))},query:(t=l,function(e){return new Promise((function(i,o){i=Ae(i);var a,s,u,c=e.trans,l=e.values,d=e.limit,h=e.query,f=d===1/0?void 0:d,p=h.index;if(h=h.range,c=c.objectStore(n),p=p.isPrimaryKey?c:c.index(p.name),h=r(h),0===d)return i({result:[]});t?((f=l?p.getAll(h,f):p.getAllKeys(h,f)).onsuccess=function(e){return i({result:e.target.result})},f.onerror=Ft(o)):(a=0,s=!l&&"openKeyCursor"in p?p.openKeyCursor(h):p.openCursor(h),u=[],s.onsuccess=function(e){var t=s.result;return t?(u.push(l?t.value:t.primaryKey),++a===d?i({result:u}):void t.continue()):i({result:u})},s.onerror=Ft(o))}))}),openCursor:function(e){var t=e.trans,i=e.values,o=e.query,a=e.reverse,s=e.unique;return new Promise((function(e,u){e=Ae(e);var c=o.index,l=o.range,d=t.objectStore(n),h=(d=c.isPrimaryKey?d:d.index(c.name),c=a?s?"prevunique":"prev":s?"nextunique":"next",!i&&"openKeyCursor"in d?d.openKeyCursor(r(l),c):d.openCursor(r(l),c));h.onerror=Ft(u),h.onsuccess=Ae((function(n){var r,i,o,a,s=h.result;s?(s.___id=++Yt,s.done=!1,r=s.continue.bind(s),i=(i=s.continuePrimaryKey)&&i.bind(s),o=s.advance.bind(s),a=function(){throw new Error("Cursor not stopped")},s.trans=t,s.stop=s.continue=s.continuePrimaryKey=s.advance=function(){throw new Error("Cursor not started")},s.fail=Ae(u),s.next=function(){var e=this,t=1;return this.start((function(){return t--?e.continue():e.stop()})).then((function(){return e}))},s.start=function(e){function t(){if(h.result)try{e()}catch(e){s.fail(e)}else s.done=!0,s.start=function(){throw new Error("Cursor behind last entry")},s.stop()}var n=new Promise((function(e,t){e=Ae(e),h.onerror=Ft(t),s.fail=t,s.stop=function(t){s.stop=s.continue=s.continuePrimaryKey=s.advance=a,e(t)}}));return h.onsuccess=Ae((function(e){h.onsuccess=t,t()})),s.continue=r,s.continuePrimaryKey=i,s.advance=o,t(),n},e(s)):e(null)}),u)}))},count:function(e){var t=e.query,i=e.trans,o=t.index,a=t.range;return new Promise((function(e,t){var s=i.objectStore(n),u=o.isPrimaryKey?s:s.index(o.name);(u=(s=r(a))?u.count(s):u.count()).onsuccess=Ae((function(t){return e(t.target.result)})),u.onerror=Ft(t)}))}}}var o,s,u,c=(s=n,u=Xt((o=e).objectStoreNames),{schema:{name:o.name,tables:u.map((function(e){return s.objectStore(e)})).map((function(e){var t=e.keyPath,n=e.autoIncrement,r=a(t),i={};return n={name:e.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:null==t,compound:r,keyPath:t,autoIncrement:n,unique:!0,extractKey:Gt(t)},indexes:Xt(e.indexNames).map((function(t){return e.index(t)})).map((function(e){var t=e.name,n=e.unique,r=e.multiEntry;return e=e.keyPath,r={name:t,compound:a(e),keyPath:e,unique:n,multiEntry:r,extractKey:Gt(e)},i[Qt(e)]=r})),getIndexByKeyPath:function(e){return i[Qt(e)]}},i[":id"]=n.primaryKey,null!=t&&(i[Qt(t)]=n.primaryKey),n}))},hasGetAll:0<u.length&&"getAll"in s.objectStore(u[0])&&!("undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}),l=(n=c.schema,c.hasGetAll),d=(c=n.tables.map(i),{});return c.forEach((function(e){return d[e.name]=e})),{stack:"dbcore",transaction:e.transaction.bind(e),table:function(e){if(!d[e])throw new Error("Table '".concat(e,"' not found"));return d[e]},MIN_KEY:-1/0,MAX_KEY:$t(t),schema:n}}function Zt(e,n,r,i){var o=r.IDBKeyRange;return r.indexedDB,{dbcore:(i=Jt(n,o,i),e.dbcore.reduce((function(e,n){return n=n.create,t(t({},e),n(e))}),i))}}function en(e,t){var n=t.db;t=Zt(e._middlewares,n,e._deps,t),e.core=t.dbcore,e.tables.forEach((function(t){var n=t.name;e.core.schema.tables.some((function(e){return e.name===n}))&&(t.core=e.core.table(n),e[n]instanceof e.Table&&(e[n].core=t.core))}))}function tn(e,t,n,r){n.forEach((function(n){var i=r[n];t.forEach((function(t){var r=function e(t,n){return m(t,n)||(t=u(t))&&e(t,n)}(t,n);(!r||"value"in r&&void 0===r.value)&&(t===e.Transaction.prototype||t instanceof e.Transaction?f(t,n,{get:function(){return this.table(n)},set:function(e){h(this,n,{value:e,writable:!0,configurable:!0,enumerable:!0})}}):t[n]=new e.Table(n,i))}))}))}function nn(e,t){t.forEach((function(t){for(var n in t)t[n]instanceof e.Table&&delete t[n]}))}function rn(e,t){return e._cfg.version-t._cfg.version}function on(e,t,n,r){var i=e._dbSchema;n.objectStoreNames.contains("$meta")&&!i.$meta&&(i.$meta=Vt("$meta",fn("")[0],[]),e._storeNames.push("$meta"));var a=e._createTransaction("readwrite",e._storeNames,i);a.create(n),a._completion.catch(r);var s=a._reject.bind(a),u=ge.transless||ge;Ke((function(){return ge.trans=a,ge.transless=u,0!==t?(en(e,n),c=t,((r=a).storeNames.includes("$meta")?r.table("$meta").get("version").then((function(e){return null!=e?e:c})):ke.resolve(c)).then((function(t){return i=t,s=a,u=n,c=[],t=(r=e)._versions,l=r._dbSchema=dn(0,r.idbdb,u),0!==(t=t.filter((function(e){return e._cfg.version>=i}))).length?(t.forEach((function(e){c.push((function(){var t=l,n=e._cfg.dbschema;hn(r,t,u),hn(r,n,u),l=r._dbSchema=n;var a=sn(t,n);a.add.forEach((function(e){un(u,e[0],e[1].primKey,e[1].indexes)})),a.change.forEach((function(e){if(e.recreate)throw new V.Upgrade("Not yet support for changing primary key");var t=u.objectStore(e.name);e.add.forEach((function(e){return ln(t,e)})),e.change.forEach((function(e){t.deleteIndex(e.name),ln(t,e)})),e.del.forEach((function(e){return t.deleteIndex(e)}))}));var c=e._cfg.contentUpgrade;if(c&&e._cfg.version>i){en(r,u),s._memoizedTables={};var d=I(n);a.del.forEach((function(e){d[e]=t[e]})),nn(r,[r.Transaction.prototype]),tn(r,[r.Transaction.prototype],o(d),d),s.schema=d;var h,f=F(c);return f&&Ue(),a=ke.follow((function(){var e;(h=c(s))&&f&&(e=ze.bind(null,null),h.then(e,e))})),h&&"function"==typeof h.then?ke.resolve(h):a.then((function(){return h}))}})),c.push((function(t){var n,i,o=e._cfg.dbschema;n=o,i=t,[].slice.call(i.db.objectStoreNames).forEach((function(e){return null==n[e]&&i.db.deleteObjectStore(e)})),nn(r,[r.Transaction.prototype]),tn(r,[r.Transaction.prototype],r._storeNames,r._dbSchema),s.schema=r._dbSchema})),c.push((function(t){r.idbdb.objectStoreNames.contains("$meta")&&(Math.ceil(r.idbdb.version/10)===e._cfg.version?(r.idbdb.deleteObjectStore("$meta"),delete r._dbSchema.$meta,r._storeNames=r._storeNames.filter((function(e){return"$meta"!==e}))):t.objectStore("$meta").put(e._cfg.version,"version"))}))})),function e(){return c.length?ke.resolve(c.shift()(s.idbtrans)).then(e):ke.resolve()}().then((function(){cn(l,u)}))):ke.resolve();var r,i,s,u,c,l})).catch(s)):(o(i).forEach((function(e){un(n,e,i[e].primKey,i[e].indexes)})),en(e,n),void ke.follow((function(){return e.on.populate.fire(a)})).catch(s));var r,c}))}function an(e,t){cn(e._dbSchema,t),t.db.version%10!=0||t.objectStoreNames.contains("$meta")||t.db.createObjectStore("$meta").add(Math.ceil(t.db.version/10-1),"version");var n=dn(0,e.idbdb,t);hn(e,e._dbSchema,t);for(var r=0,i=sn(n,e._dbSchema).change;r<i.length;r++){var o=function(e){if(e.change.length||e.recreate)return{value:void 0};var n=t.objectStore(e.name);e.add.forEach((function(e){ln(n,e)}))}(i[r]);if("object"==typeof o)return o.value}}function sn(e,t){var n,r={del:[],add:[],change:[]};for(n in e)t[n]||r.del.push(n);for(n in t){var i=e[n],o=t[n];if(i){var a={name:n,def:o,recreate:!1,del:[],add:[],change:[]};if(""+(i.primKey.keyPath||"")!=""+(o.primKey.keyPath||"")||i.primKey.auto!==o.primKey.auto)a.recreate=!0,r.change.push(a);else{var s=i.idxByName,u=o.idxByName,c=void 0;for(c in s)u[c]||a.del.push(c);for(c in u){var l=s[c],d=u[c];l?l.src!==d.src&&a.change.push(d):a.add.push(d)}(0<a.del.length||0<a.add.length||0<a.change.length)&&r.change.push(a)}}else r.add.push([n,o])}return r}function un(e,t,n,r){var i=e.db.createObjectStore(t,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return r.forEach((function(e){return ln(i,e)})),i}function cn(e,t){o(e).forEach((function(n){t.db.objectStoreNames.contains(n)||un(t,n,e[n].primKey,e[n].indexes)}))}function ln(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function dn(e,t,n){var r={};return v(t.objectStoreNames,0).forEach((function(e){for(var t=n.objectStore(e),i=Wt(Ht(s=t.keyPath),s||"",!0,!1,!!t.autoIncrement,s&&"string"!=typeof s,!0),o=[],a=0;a<t.indexNames.length;++a){var s=(u=t.index(t.indexNames[a])).keyPath,u=Wt(u.name,s,!!u.unique,!!u.multiEntry,!1,s&&"string"!=typeof s,!1);o.push(u)}r[e]=Vt(e,i,o)})),r}function hn(e,t,n){for(var r=n.db.objectStoreNames,o=0;o<r.length;++o){var a=r[o],s=n.objectStore(a);e._hasGetAll="getAll"in s;for(var u=0;u<s.indexNames.length;++u){var c=s.indexNames[u],l=s.index(c).keyPath,d="string"==typeof l?l:"["+v(l).join("+")+"]";!t[a]||(l=t[a].idxByName[d])&&(l.name=c,delete t[a].idxByName[d],t[a].idxByName[c]=l)}}"undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&i.WorkerGlobalScope&&i instanceof i.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}function fn(e){return e.split(",").map((function(e,t){var n=(e=e.trim()).replace(/([&*]|\+\+)/g,""),r=/^\[/.test(n)?n.match(/^\[(.*)\]$/)[1].split("+"):n;return Wt(n,r||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),a(r),0===t)}))}var pn=(mn.prototype._parseStoresSpec=function(e,t){o(e).forEach((function(n){if(null!==e[n]){var r=fn(e[n]),i=r.shift();if(i.unique=!0,i.multi)throw new V.Schema("Primary key cannot be multi-valued");r.forEach((function(e){if(e.auto)throw new V.Schema("Only primary key can be marked as autoIncrement (++)");if(!e.keyPath)throw new V.Schema("Index must have a name and cannot be an empty string")})),t[n]=Vt(n,i,r)}}))},mn.prototype.stores=function(e){var t=this.db;this._cfg.storesSource=this._cfg.storesSource?s(this._cfg.storesSource,e):e,e=t._versions;var n={},r={};return e.forEach((function(e){s(n,e._cfg.storesSource),r=e._cfg.dbschema={},e._parseStoresSpec(n,r)})),t._dbSchema=r,nn(t,[t._allTables,t,t.Transaction.prototype]),tn(t,[t._allTables,t,t.Transaction.prototype,this._cfg.tables],o(r),r),t._storeNames=o(r),this},mn.prototype.upgrade=function(e){return this._cfg.contentUpgrade=re(this._cfg.contentUpgrade||X,e),this},mn);function mn(){}function yn(e,t){var n=e._dbNamesDB;return n||(n=e._dbNamesDB=new tr(nt,{addons:[],indexedDB:e,IDBKeyRange:t})).version(1).stores({dbnames:"name"}),n.table("dbnames")}function vn(e){return e&&"function"==typeof e.databases}function gn(e){return Ke((function(){return ge.letThrough=!0,e()}))}function bn(e){return!("from"in e)}var wn=function(e,t){if(!this){var n=new wn;return e&&"d"in e&&s(n,e),n}s(this,arguments.length?{d:1,from:e,to:1<arguments.length?t:e}:{d:0})};function Sn(e,t,n){var r=ct(t,n);if(!isNaN(r)){if(0<r)throw RangeError();if(bn(e))return s(e,{from:t,to:n,d:1});var i=e.l;if(r=e.r,ct(n,e.from)<0)return i?Sn(i,t,n):e.l={from:t,to:n,d:1,l:null,r:null},_n(e);if(0<ct(t,e.to))return r?Sn(r,t,n):e.r={from:t,to:n,d:1,l:null,r:null},_n(e);ct(t,e.from)<0&&(e.from=t,e.l=null,e.d=r?r.d+1:1),0<ct(n,e.to)&&(e.to=n,e.r=null,e.d=e.l?e.l.d+1:1),n=!e.r,i&&!e.l&&kn(e,i),r&&n&&kn(e,r)}}function kn(e,t){bn(t)||function e(t,n){var r=n.from,i=n.to,o=n.l;n=n.r,Sn(t,r,i),o&&e(t,o),n&&e(t,n)}(e,t)}function In(e,t){var n=xn(t),r=n.next();if(r.done)return!1;for(var i=r.value,o=xn(e),a=o.next(i.from),s=a.value;!r.done&&!a.done;){if(ct(s.from,i.to)<=0&&0<=ct(s.to,i.from))return!0;ct(i.from,s.from)<0?i=(r=n.next(s.from)).value:s=(a=o.next(i.from)).value}return!1}function xn(e){var t=bn(e)?null:{s:0,n:e};return{next:function(e){for(var n=0<arguments.length;t;)switch(t.s){case 0:if(t.s=1,n)for(;t.n.l&&ct(e,t.n.from)<0;)t={up:t,n:t.n.l,s:1};else for(;t.n.l;)t={up:t,n:t.n.l,s:1};case 1:if(t.s=2,!n||ct(e,t.n.to)<=0)return{value:t.n,done:!1};case 2:if(t.n.r){t.s=3,t={up:t,n:t.n.r,s:0};continue}case 3:t=t.up}return{done:!0}}}}function _n(e){var n,r,i=((null===(n=e.r)||void 0===n?void 0:n.d)||0)-((null===(r=e.l)||void 0===r?void 0:r.d)||0),o=1<i?"r":i<-1?"l":"";o&&(n="r"==o?"l":"r",r=t({},e),i=e[o],e.from=i.from,e.to=i.to,e[o]=i[o],r[o]=i[n],(e[n]=r).d=Cn(r)),e.d=Cn(e)}function Cn(e){var t=e.r;return e=e.l,(t?e?Math.max(t.d,e.d):t.d:e?e.d:0)+1}function En(e,t){return o(t).forEach((function(n){e[n]?kn(e[n],t[n]):e[n]=function e(t){var n,r,i={};for(n in t)l(t,n)&&(r=t[n],i[n]=!r||"object"!=typeof r||E.has(r.constructor)?r:e(r));return i}(t[n])})),e}function On(e,t){return e.all||t.all||Object.keys(e).some((function(n){return t[n]&&In(t[n],e[n])}))}d(wn.prototype,((j={add:function(e){return kn(this,e),this},addKey:function(e){return Sn(this,e,e),this},addKeys:function(e){var t=this;return e.forEach((function(e){return Sn(t,e,e)})),this},hasKey:function(e){var t=xn(this).next(e).value;return t&&ct(t.from,e)<=0&&0<=ct(t.to,e)}})[D]=function(){return xn(this)},j));var Mn={},Tn={},Rn=!1;function Dn(e){En(Tn,e),Rn||(Rn=!0,setTimeout((function(){Rn=!1,Nn(Tn,!(Tn={}))}),0))}function Nn(e,t){void 0===t&&(t=!1);var n=new Set;if(e.all)for(var r=0,i=Object.values(Mn);r<i.length;r++)An(a=i[r],e,n,t);else for(var o in e){var a,s=/^idb\:\/\/(.*)\/(.*)\//.exec(o);s&&(o=s[1],s=s[2],(a=Mn["idb://".concat(o,"/").concat(s)])&&An(a,e,n,t))}n.forEach((function(e){return e()}))}function An(e,t,n,r){for(var i=[],o=0,a=Object.entries(e.queries.query);o<a.length;o++){for(var s=a[o],u=s[0],c=[],l=0,d=s[1];l<d.length;l++){var h=d[l];On(t,h.obsSet)?h.subscribers.forEach((function(e){return n.add(e)})):r&&c.push(h)}r&&i.push([u,c])}if(r)for(var f=0,p=i;f<p.length;f++){var m=p[f];u=m[0],c=m[1],e.queries.query[u]=c}}function Ln(e){var t=e._state,n=e._deps.indexedDB;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then((function(){return t.dbOpenError?Qe(t.dbOpenError):e}));t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;var r=t.openCanceller,i=Math.round(10*e.verno),a=!1;function s(){if(t.openCanceller!==r)throw new V.DatabaseClosed("db.open() was cancelled")}function u(){return new ke((function(r,c){if(s(),!n)throw new V.MissingAPI;var l=e.name,f=t.autoSchema||!i?n.open(l):n.open(l,i);if(!f)throw new V.MissingAPI;f.onerror=Ft(c),f.onblocked=Ae(e._fireOnBlocked),f.onupgradeneeded=Ae((function(r){var i;d=f.transaction,t.autoSchema&&!e._options.allowEmptyDB?(f.onerror=jt,d.abort(),f.result.close(),(i=n.deleteDatabase(l)).onsuccess=i.onerror=Ae((function(){c(new V.NoSuchDatabase("Database ".concat(l," doesnt exist")))}))):(d.onerror=Ft(c),r=r.oldVersion>Math.pow(2,62)?0:r.oldVersion,h=r<1,e.idbdb=f.result,a&&an(e,d),on(e,r/10,d,c))}),c),f.onsuccess=Ae((function(){d=null;var n,s,c,p,m,y=e.idbdb=f.result,g=v(y.objectStoreNames);if(0<g.length)try{var b=y.transaction(1===(p=g).length?p[0]:p,"readonly");if(t.autoSchema)s=y,c=b,(n=e).verno=s.version/10,c=n._dbSchema=dn(0,s,c),n._storeNames=v(s.objectStoreNames,0),tn(n,[n._allTables],o(c),c);else if(hn(e,e._dbSchema,b),((m=sn(dn(0,(m=e).idbdb,b),m._dbSchema)).add.length||m.change.some((function(e){return e.add.length||e.change.length})))&&!a)return y.close(),i=y.version+1,a=!0,r(u());en(e,b)}catch(n){}tt.push(e),y.onversionchange=Ae((function(n){t.vcFired=!0,e.on("versionchange").fire(n)})),y.onclose=Ae((function(t){e.on("close").fire(t)})),h&&(m=e._deps,b=l,y=m.indexedDB,m=m.IDBKeyRange,vn(y)||b===nt||yn(y,m).put({name:b}).catch(X)),r()}),c)})).catch((function(e){switch(null==e?void 0:e.name){case"UnknownError":if(0<t.PR1398_maxLoop)return t.PR1398_maxLoop--,u();break;case"VersionError":if(0<i)return i=0,u()}return ke.reject(e)}))}var c,l=t.dbReadyResolve,d=null,h=!1;return ke.race([r,("undefined"==typeof navigator?ke.resolve():!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise((function(e){function t(){return indexedDB.databases().finally(e)}c=setInterval(t,100),t()})).finally((function(){return clearInterval(c)})):Promise.resolve()).then(u)]).then((function(){return s(),t.onReadyBeingFired=[],ke.resolve(gn((function(){return e.on.ready.fire(e.vip)}))).then((function n(){if(0<t.onReadyBeingFired.length){var r=t.onReadyBeingFired.reduce(re,X);return t.onReadyBeingFired=[],ke.resolve(gn((function(){return r(e.vip)}))).then(n)}}))})).finally((function(){t.openCanceller===r&&(t.onReadyBeingFired=null,t.isBeingOpened=!1)})).catch((function(n){t.dbOpenError=n;try{d&&d.abort()}catch(n){}return r===t.openCanceller&&e._close(),Qe(n)})).finally((function(){t.openComplete=!0,l()})).then((function(){var t;return h&&(t={},e.tables.forEach((function(n){n.schema.indexes.forEach((function(r){r.name&&(t["idb://".concat(e.name,"/").concat(n.name,"/").concat(r.name)]=new wn(-1/0,[[[]]]))})),t["idb://".concat(e.name,"/").concat(n.name,"/")]=t["idb://".concat(e.name,"/").concat(n.name,"/:dels")]=new wn(-1/0,[[[]]])})),Kt(Bt).fire(t),Nn(t,!0)),e}))}function Pn(e){function t(t){return e.next(t)}var n=i(t),r=i((function(t){return e.throw(t)}));function i(e){return function(t){var i=e(t);return t=i.value,i.done?t:t&&"function"==typeof t.then?t.then(n,r):a(t)?Promise.all(t).then(n,r):n(t)}}return i(t)()}function Fn(e,t,n){for(var r=a(e)?e.slice():[e],i=0;i<n;++i)r.push(t);return r}var jn={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(e){return t(t({},e),{table:function(n){var r=e.table(n),i=r.schema,o={},a=[];function s(e,n,r){var i=Qt(e),u=o[i]=o[i]||[],c=null==e?0:"string"==typeof e?1:e.length,l=0<n;return l=t(t({},r),{name:l?"".concat(i,"(virtual-from:").concat(r.name,")"):r.name,lowLevelIndex:r,isVirtual:l,keyTail:n,keyLength:c,extractKey:Gt(e),unique:!l&&r.unique}),u.push(l),l.isPrimaryKey||a.push(l),1<c&&s(2===c?e[0]:e.slice(0,c-1),n+1,r),u.sort((function(e,t){return e.keyTail-t.keyTail})),l}n=s(i.primaryKey.keyPath,0,i.primaryKey),o[":id"]=[n];for(var u=0,c=i.indexes;u<c.length;u++){var l=c[u];s(l.keyPath,0,l)}function d(n){var r,i=n.query.index;return i.isVirtual?t(t({},n),{query:{index:i.lowLevelIndex,range:(r=n.query.range,i=i.keyTail,{type:1===r.type?2:r.type,lower:Fn(r.lower,r.lowerOpen?e.MAX_KEY:e.MIN_KEY,i),lowerOpen:!0,upper:Fn(r.upper,r.upperOpen?e.MIN_KEY:e.MAX_KEY,i),upperOpen:!0})}}):n}return t(t({},r),{schema:t(t({},i),{primaryKey:n,indexes:a,getIndexByKeyPath:function(e){return(e=o[Qt(e)])&&e[0]}}),count:function(e){return r.count(d(e))},query:function(e){return r.query(d(e))},openCursor:function(t){var n=t.query.index,i=n.keyTail,o=n.isVirtual,a=n.keyLength;return o?r.openCursor(d(t)).then((function(e){return e&&s(e)})):r.openCursor(t);function s(n){return Object.create(n,{continue:{value:function(r){null!=r?n.continue(Fn(r,t.reverse?e.MAX_KEY:e.MIN_KEY,i)):t.unique?n.continue(n.key.slice(0,a).concat(t.reverse?e.MIN_KEY:e.MAX_KEY,i)):n.continue()}},continuePrimaryKey:{value:function(t,r){n.continuePrimaryKey(Fn(t,e.MAX_KEY,i),r)}},primaryKey:{get:function(){return n.primaryKey}},key:{get:function(){var e=n.key;return 1===a?e[0]:e.slice(0,a)}},value:{get:function(){return n.value}}})}}})}})}};function Bn(e,t,n,r){return n=n||{},r=r||"",o(e).forEach((function(i){var o,a,s;l(t,i)?(o=e[i],a=t[i],"object"==typeof o&&"object"==typeof a&&o&&a?(s=R(o))!==R(a)?n[r+i]=t[i]:"Object"===s?Bn(o,a,n,r+i+"."):o!==a&&(n[r+i]=t[i]):o!==a&&(n[r+i]=t[i])):n[r+i]=void 0})),o(t).forEach((function(i){l(e,i)||(n[r+i]=t[i])})),n}function qn(e,t){return"delete"===t.type?t.keys:t.keys||t.values.map(e.extractKey)}var Kn={stack:"dbcore",name:"HooksMiddleware",level:2,create:function(e){return t(t({},e),{table:function(n){var i=e.table(n),o=i.schema.primaryKey;return t(t({},i),{mutate:function(e){var a=ge.trans,s=a.table(n).hook,u=s.deleting,c=s.creating,d=s.updating;switch(e.type){case"add":if(c.fire===X)break;return a._promise("readwrite",(function(){return h(e)}),!0);case"put":if(c.fire===X&&d.fire===X)break;return a._promise("readwrite",(function(){return h(e)}),!0);case"delete":if(u.fire===X)break;return a._promise("readwrite",(function(){return h(e)}),!0);case"deleteRange":if(u.fire===X)break;return a._promise("readwrite",(function(){return function e(n,r,a){return i.query({trans:n,values:!1,query:{index:o,range:r},limit:a}).then((function(i){var o=i.result;return h({type:"delete",keys:o,trans:n}).then((function(i){return 0<i.numFailures?Promise.reject(i.failures[0]):o.length<a?{failures:[],numFailures:0,lastResult:void 0}:e(n,t(t({},r),{lower:o[o.length-1],lowerOpen:!0}),a)}))}))}(e.trans,e.range,1e4)}),!0)}return i.mutate(e);function h(e){var n,a,s,h=ge.trans,f=e.keys||qn(o,e);if(!f)throw new Error("Keys missing");return"delete"!==(e="add"===e.type||"put"===e.type?t(t({},e),{keys:f}):t({},e)).type&&(e.values=r([],e.values,!0)),e.keys&&(e.keys=r([],e.keys,!0)),n=i,s=f,("add"===(a=e).type?Promise.resolve([]):n.getMany({trans:a.trans,keys:s,cache:"immutable"})).then((function(t){var n=f.map((function(n,r){var i,a,s,f=t[r],p={onerror:null,onsuccess:null};return"delete"===e.type?u.fire.call(p,n,f,h):"add"===e.type||void 0===f?(i=c.fire.call(p,n,e.values[r],h),null==n&&null!=i&&(e.keys[r]=n=i,o.outbound||k(e.values[r],o.keyPath,n))):(i=Bn(f,e.values[r]),(a=d.fire.call(p,i,n,f,h))&&(s=e.values[r],Object.keys(a).forEach((function(e){l(s,e)?s[e]=a[e]:k(s,e,a[e])})))),p}));return i.mutate(e).then((function(r){for(var i=r.failures,o=r.results,a=r.numFailures,s=(r=r.lastResult,0);s<f.length;++s){var u=(o||f)[s],c=n[s];null==u?c.onerror&&c.onerror(i[s]):c.onsuccess&&c.onsuccess("put"===e.type&&t[s]?e.values[s]:u)}return{failures:i,results:o,numFailures:a,lastResult:r}})).catch((function(e){return n.forEach((function(t){return t.onerror&&t.onerror(e)})),Promise.reject(e)}))}))}}})}})}};function Un(e,t,n){try{if(!t)return null;if(t.keys.length<e.length)return null;for(var r=[],i=0,o=0;i<t.keys.length&&o<e.length;++i)0===ct(t.keys[i],e[o])&&(r.push(n?M(t.values[i]):t.values[i]),++o);return r.length===e.length?r:null}catch(e){return null}}var zn={stack:"dbcore",level:-1,create:function(e){return{table:function(n){var r=e.table(n);return t(t({},r),{getMany:function(e){if(!e.cache)return r.getMany(e);var t=Un(e.keys,e.trans._cache,"clone"===e.cache);return t?ke.resolve(t):r.getMany(e).then((function(t){return e.trans._cache={keys:e.keys,values:"clone"===e.cache?M(t):t},t}))},mutate:function(e){return"add"!==e.type&&(e.trans._cache=null),r.mutate(e)}})}}}};function Wn(e,t){return"readonly"===e.trans.mode&&!!e.subscr&&!e.trans.explicit&&"disabled"!==e.trans.db._options.cache&&!t.schema.primaryKey.outbound}function Hn(e,t){switch(e){case"query":return t.values&&!t.unique;case"get":case"getMany":case"count":case"openCursor":return!1}}var Vn={stack:"dbcore",level:0,name:"Observability",create:function(e){var n=e.schema.name,r=new wn(e.MIN_KEY,e.MAX_KEY);return t(t({},e),{transaction:function(t,n,r){if(ge.subscr&&"readonly"!==n)throw new V.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(ge.querier));return e.transaction(t,n,r)},table:function(i){var s=e.table(i),u=s.schema,c=u.primaryKey,l=u.indexes,d=c.extractKey,h=c.outbound,f=c.autoIncrement&&l.filter((function(e){return e.compound&&e.keyPath.includes(c.keyPath)})),p=t(t({},s),{mutate:function(t){function o(e){return e="idb://".concat(n,"/").concat(i,"/").concat(e),m[e]||(m[e]=new wn)}var l,d,h,p=t.trans,m=t.mutatedParts||(t.mutatedParts={}),y=o(""),v=o(":dels"),g=t.type,b="deleteRange"===t.type?[t.range]:"delete"===t.type?[t.keys]:t.values.length<50?[qn(c,t).filter((function(e){return e})),t.values]:[],w=b[0],S=b[1];return b=t.trans._cache,a(w)?(y.addKeys(w),(b="delete"===g||w.length===S.length?Un(w,b):null)||v.addKeys(w),(b||S)&&(l=o,d=b,h=S,u.indexes.forEach((function(e){var t=l(e.name||"");function n(t){return null!=t?e.extractKey(t):null}function r(n){return e.multiEntry&&a(n)?n.forEach((function(e){return t.addKey(e)})):t.addKey(n)}(d||h).forEach((function(e,t){var i=d&&n(d[t]);0!==ct(i,t=h&&n(h[t]))&&(null!=i&&r(i),null!=t&&r(t))}))})))):w?(S={from:null!==(S=w.lower)&&void 0!==S?S:e.MIN_KEY,to:null!==(S=w.upper)&&void 0!==S?S:e.MAX_KEY},v.add(S),y.add(S)):(y.add(r),v.add(r),u.indexes.forEach((function(e){return o(e.name).add(r)}))),s.mutate(t).then((function(e){return!w||"add"!==t.type&&"put"!==t.type||(y.addKeys(e.results),f&&f.forEach((function(n){for(var r=t.values.map((function(e){return n.extractKey(e)})),i=n.keyPath.findIndex((function(e){return e===c.keyPath})),a=0,s=e.results.length;a<s;++a)r[a][i]=e.results[a];o(n.name).addKeys(r)}))),p.mutatedParts=En(p.mutatedParts||{},m),e}))}}),m=(l=function(t){t=(n=t.query).index;var n=n.range;return[t,new wn(null!==(t=n.lower)&&void 0!==t?t:e.MIN_KEY,null!==(n=n.upper)&&void 0!==n?n:e.MAX_KEY)]},{get:function(e){return[c,new wn(e.key)]},getMany:function(e){return[c,(new wn).addKeys(e.keys)]},count:l,query:l,openCursor:l});return o(m).forEach((function(e){p[e]=function(o){var a=!!(p=ge.subscr),u=Wn(ge,s)&&Hn(e,o)?o.obsSet={}:p;if(a){var c=function(e){return e="idb://".concat(n,"/").concat(i,"/").concat(e),u[e]||(u[e]=new wn)},l=c(""),f=c(":dels"),p=(a=(p=m[e](o))[0],p[1]);if(("query"===e&&a.isPrimaryKey&&!o.values?f:c(a.name||"")).add(p),!a.isPrimaryKey){if("count"!==e){var y="query"===e&&h&&o.values&&s.query(t(t({},o),{values:!1}));return s[e].apply(this,arguments).then((function(t){if("query"===e){if(h&&o.values)return y.then((function(e){return e=e.result,l.addKeys(e),t}));var n=o.values?t.result.map(d):t.result;(o.values?l:f).addKeys(n)}else if("openCursor"===e){var r=t,i=o.values;return r&&Object.create(r,{key:{get:function(){return f.addKey(r.primaryKey),r.key}},primaryKey:{get:function(){var e=r.primaryKey;return f.addKey(e),e}},value:{get:function(){return i&&l.addKey(r.primaryKey),r.value}}})}return t}))}f.add(r)}}return s[e].apply(this,arguments)}})),p}})}};function $n(e,n,r){if(0===r.numFailures)return n;if("deleteRange"===n.type)return null;var i=n.keys?n.keys.length:"values"in n&&n.values?n.values.length:1;return r.numFailures===i?null:(n=t({},n),a(n.keys)&&(n.keys=n.keys.filter((function(e,t){return!(t in r.failures)}))),"values"in n&&a(n.values)&&(n.values=n.values.filter((function(e,t){return!(t in r.failures)}))),n)}function Gn(e,t){return n=e,(void 0===(r=t).lower||(r.lowerOpen?0<ct(n,r.lower):0<=ct(n,r.lower)))&&(void 0===t.upper||(t.upperOpen?ct(e,t.upper)<0:ct(e,t.upper)<=0));var n,r}function Xn(e,t,n,r,i,o){if(!n||0===n.length)return e;var s=t.query.index,u=s.multiEntry,c=t.query.range,l=r.schema.primaryKey.extractKey,d=s.extractKey,h=(s.lowLevelIndex||s).extractKey;return n=n.reduce((function(e,n){var r=e,i=[];if("add"===n.type||"put"===n.type)for(var o=new wn,s=n.values.length-1;0<=s;--s){var h,f=n.values[s],p=l(f);o.hasKey(p)||(h=d(f),(u&&a(h)?h.some((function(e){return Gn(e,c)})):Gn(h,c))&&(o.addKey(p),i.push(f)))}switch(n.type){case"add":var m=(new wn).addKeys(t.values?e.map((function(e){return l(e)})):e);r=e.concat(t.values?i.filter((function(e){return e=l(e),!m.hasKey(e)&&(m.addKey(e),!0)})):i.map((function(e){return l(e)})).filter((function(e){return!m.hasKey(e)&&(m.addKey(e),!0)})));break;case"put":var y=(new wn).addKeys(n.values.map((function(e){return l(e)})));r=e.filter((function(e){return!y.hasKey(t.values?l(e):e)})).concat(t.values?i:i.map((function(e){return l(e)})));break;case"delete":var v=(new wn).addKeys(n.keys);r=e.filter((function(e){return!v.hasKey(t.values?l(e):e)}));break;case"deleteRange":var g=n.range;r=e.filter((function(e){return!Gn(l(e),g)}))}return r}),e),n===e?e:(n.sort((function(e,t){return ct(h(e),h(t))||ct(l(e),l(t))})),t.limit&&t.limit<1/0&&(n.length>t.limit?n.length=t.limit:e.length===t.limit&&n.length<t.limit&&(i.dirty=!0)),o?Object.freeze(n):n)}function Yn(e,t){return 0===ct(e.lower,t.lower)&&0===ct(e.upper,t.upper)&&!!e.lowerOpen==!!t.lowerOpen&&!!e.upperOpen==!!t.upperOpen}function Qn(e,t){return function(e,t,n,r){if(void 0===e)return void 0!==t?-1:0;if(void 0===t)return 1;if(0===(t=ct(e,t))){if(n&&r)return 0;if(n)return 1;if(r)return-1}return t}(e.lower,t.lower,e.lowerOpen,t.lowerOpen)<=0&&0<=function(e,t,n,r){if(void 0===e)return void 0!==t?1:0;if(void 0===t)return-1;if(0===(t=ct(e,t))){if(n&&r)return 0;if(n)return-1;if(r)return 1}return t}(e.upper,t.upper,e.upperOpen,t.upperOpen)}function Jn(e,t,n,r){e.subscribers.add(n),r.addEventListener("abort",(function(){var r,i;e.subscribers.delete(n),0===e.subscribers.size&&(r=e,i=t,setTimeout((function(){0===r.subscribers.size&&A(i,r)}),3e3))}))}var Zn={stack:"dbcore",level:0,name:"Cache",create:function(e){var n=e.schema.name;return t(t({},e),{transaction:function(t,r,i){var o,a,s=e.transaction(t,r,i);return"readwrite"===r&&(a=(o=new AbortController).signal,i=function(i){return function(){if(o.abort(),"readwrite"===r){for(var a=new Set,u=0,c=t;u<c.length;u++){var l=c[u],d=Mn["idb://".concat(n,"/").concat(l)];if(d){var h=e.table(l),f=d.optimisticOps.filter((function(e){return e.trans===s}));if(s._explicit&&i&&s.mutatedParts)for(var p=0,m=Object.values(d.queries.query);p<m.length;p++)for(var y=0,v=(w=m[p]).slice();y<v.length;y++)On((S=v[y]).obsSet,s.mutatedParts)&&(A(w,S),S.subscribers.forEach((function(e){return a.add(e)})));else if(0<f.length){d.optimisticOps=d.optimisticOps.filter((function(e){return e.trans!==s}));for(var g=0,b=Object.values(d.queries.query);g<b.length;g++)for(var w,S,k,I=0,x=(w=b[g]).slice();I<x.length;I++)null!=(S=x[I]).res&&s.mutatedParts&&(i&&!S.dirty?(k=Object.isFrozen(S.res),k=Xn(S.res,S.req,f,h,S,k),S.dirty?(A(w,S),S.subscribers.forEach((function(e){return a.add(e)}))):k!==S.res&&(S.res=k,S.promise=ke.resolve({result:k}))):(S.dirty&&A(w,S),S.subscribers.forEach((function(e){return a.add(e)}))))}}}a.forEach((function(e){return e()}))}}},s.addEventListener("abort",i(!1),{signal:a}),s.addEventListener("error",i(!1),{signal:a}),s.addEventListener("complete",i(!0),{signal:a})),s},table:function(r){var i=e.table(r),o=i.schema.primaryKey;return t(t({},i),{mutate:function(e){var a=ge.trans;if(o.outbound||"disabled"===a.db._options.cache||a.explicit||"readwrite"!==a.idbtrans.mode)return i.mutate(e);var s=Mn["idb://".concat(n,"/").concat(r)];return s?(a=i.mutate(e),"add"!==e.type&&"put"!==e.type||!(50<=e.values.length||qn(o,e).some((function(e){return null==e})))?(s.optimisticOps.push(e),e.mutatedParts&&Dn(e.mutatedParts),a.then((function(t){0<t.numFailures&&(A(s.optimisticOps,e),(t=$n(0,e,t))&&s.optimisticOps.push(t),e.mutatedParts&&Dn(e.mutatedParts))})),a.catch((function(){A(s.optimisticOps,e),e.mutatedParts&&Dn(e.mutatedParts)}))):a.then((function(n){var r=$n(0,t(t({},e),{values:e.values.map((function(e,r){var i;return n.failures[r]||k(e=null!==(i=o.keyPath)&&void 0!==i&&i.includes(".")?M(e):t({},e),o.keyPath,n.results[r]),e}))}),n);s.optimisticOps.push(r),queueMicrotask((function(){return e.mutatedParts&&Dn(e.mutatedParts)}))})),a):i.mutate(e)},query:function(e){if(!Wn(ge,i)||!Hn("query",e))return i.query(e);var t="immutable"===(null===(s=ge.trans)||void 0===s?void 0:s.db._options.cache),o=(c=ge).requery,a=c.signal,s=function(e,t,n,r){var i=Mn["idb://".concat(e,"/").concat(t)];if(!i)return[];if(!(t=i.queries[n]))return[null,!1,i,null];var o=t[(r.query?r.query.index.name:null)||""];if(!o)return[null,!1,i,null];switch(n){case"query":var a=o.find((function(e){return e.req.limit===r.limit&&e.req.values===r.values&&Yn(e.req.query.range,r.query.range)}));return a?[a,!0,i,o]:[o.find((function(e){return("limit"in e.req?e.req.limit:1/0)>=r.limit&&(!r.values||e.req.values)&&Qn(e.req.query.range,r.query.range)})),!1,i,o];case"count":return a=o.find((function(e){return Yn(e.req.query.range,r.query.range)})),[a,!!a,i,o]}}(n,r,"query",e),u=s[0],c=s[1],l=s[2],d=s[3];return u&&c?u.obsSet=e.obsSet:(c=i.query(e).then((function(e){var n=e.result;if(u&&(u.res=n),t){for(var r=0,i=n.length;r<i;++r)Object.freeze(n[r]);Object.freeze(n)}else e.result=M(n);return e})).catch((function(e){return d&&u&&A(d,u),Promise.reject(e)})),u={obsSet:e.obsSet,promise:c,subscribers:new Set,type:"query",req:e,dirty:!1},d?d.push(u):(d=[u],(l=l||(Mn["idb://".concat(n,"/").concat(r)]={queries:{query:{},count:{}},objs:new Map,optimisticOps:[],unsignaledParts:{}})).queries.query[e.query.index.name||""]=d)),Jn(u,d,o,a),u.promise.then((function(n){return{result:Xn(n.result,e,null==l?void 0:l.optimisticOps,i,u,t)}}))}})}})}};function er(e,t){return new Proxy(e,{get:function(e,n,r){return"db"===n?t:Reflect.get(e,n,r)}})}var tr=(nr.prototype.version=function(e){if(isNaN(e)||e<.1)throw new V.Type("Given version is not a positive number");if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new V.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,e);var t=this._versions,n=t.filter((function(t){return t._cfg.version===e}))[0];return n||(n=new this.Version(e),t.push(n),t.sort(rn),n.stores({}),this._state.autoSchema=!1,n)},nr.prototype._whenReady=function(e){var t=this;return this.idbdb&&(this._state.openComplete||ge.letThrough||this._vip)?e():new ke((function(e,n){if(t._state.openComplete)return n(new V.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._state.autoOpen)return void n(new V.DatabaseClosed);t.open().catch(X)}t._state.dbReadyPromise.then(e,n)})).then(e)},nr.prototype.use=function(e){var t=e.stack,n=e.create,r=e.level,i=e.name;return i&&this.unuse({stack:t,name:i}),(e=this._middlewares[t]||(this._middlewares[t]=[])).push({stack:t,create:n,level:null==r?10:r,name:i}),e.sort((function(e,t){return e.level-t.level})),this},nr.prototype.unuse=function(e){var t=e.stack,n=e.name,r=e.create;return t&&this._middlewares[t]&&(this._middlewares[t]=this._middlewares[t].filter((function(e){return r?e.create!==r:!!n&&e.name!==n}))),this},nr.prototype.open=function(){var e=this;return Ge(ve,(function(){return Ln(e)}))},nr.prototype._close=function(){var e=this._state,t=tt.indexOf(this);if(0<=t&&tt.splice(t,1),this.idbdb){try{this.idbdb.close()}catch(t){}this.idbdb=null}e.isBeingOpened||(e.dbReadyPromise=new ke((function(t){e.dbReadyResolve=t})),e.openCanceller=new ke((function(t,n){e.cancelOpen=n})))},nr.prototype.close=function(e){var t=(void 0===e?{disableAutoOpen:!0}:e).disableAutoOpen;e=this._state,t?(e.isBeingOpened&&e.cancelOpen(new V.DatabaseClosed),this._close(),e.autoOpen=!1,e.dbOpenError=new V.DatabaseClosed):(this._close(),e.autoOpen=this._options.autoOpen||e.isBeingOpened,e.openComplete=!1,e.dbOpenError=null)},nr.prototype.delete=function(e){var t=this;void 0===e&&(e={disableAutoOpen:!0});var n=0<arguments.length&&"object"!=typeof arguments[0],r=this._state;return new ke((function(i,o){function a(){t.close(e);var n=t._deps.indexedDB.deleteDatabase(t.name);n.onsuccess=Ae((function(){var e,n,r;e=t._deps,n=t.name,r=e.indexedDB,e=e.IDBKeyRange,vn(r)||n===nt||yn(r,e).delete(n).catch(X),i()})),n.onerror=Ft(o),n.onblocked=t._fireOnBlocked}if(n)throw new V.InvalidArgument("Invalid closeOptions argument to db.delete()");r.isBeingOpened?r.dbReadyPromise.then(a):a()}))},nr.prototype.backendDB=function(){return this.idbdb},nr.prototype.isOpen=function(){return null!==this.idbdb},nr.prototype.hasBeenClosed=function(){var e=this._state.dbOpenError;return e&&"DatabaseClosed"===e.name},nr.prototype.hasFailed=function(){return null!==this._state.dbOpenError},nr.prototype.dynamicallyOpened=function(){return this._state.autoSchema},Object.defineProperty(nr.prototype,"tables",{get:function(){var e=this;return o(this._allTables).map((function(t){return e._allTables[t]}))},enumerable:!1,configurable:!0}),nr.prototype.transaction=function(){var e=function(e,t,n){var r=arguments.length;if(r<2)throw new V.InvalidArgument("Too few arguments");for(var i=new Array(r-1);--r;)i[r-1]=arguments[r];return n=i.pop(),[e,_(i),n]}.apply(this,arguments);return this._transaction.apply(this,e)},nr.prototype._transaction=function(e,t,n){var r=this,i=ge.trans;i&&i.db===this&&-1===e.indexOf("!")||(i=null);var o,a,s=-1!==e.indexOf("?");e=e.replace("!","").replace("?","");try{if(a=t.map((function(e){if("string"!=typeof(e=e instanceof r.Table?e.name:e))throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return e})),"r"==e||e===rt)o=rt;else{if("rw"!=e&&e!=it)throw new V.InvalidArgument("Invalid transaction mode: "+e);o=it}if(i){if(i.mode===rt&&o===it){if(!s)throw new V.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");i=null}i&&a.forEach((function(e){if(i&&-1===i.storeNames.indexOf(e)){if(!s)throw new V.SubTransaction("Table "+e+" not included in parent transaction.");i=null}})),s&&i&&!i.active&&(i=null)}}catch(n){return i?i._promise(null,(function(e,t){t(n)})):Qe(n)}var u=function e(t,n,r,i,o){return ke.resolve().then((function(){var a=ge.transless||ge,s=t._createTransaction(n,r,t._dbSchema,i);if(s.explicit=!0,a={trans:s,transless:a},i)s.idbtrans=i.idbtrans;else try{s.create(),s.idbtrans._explicit=!0,t._state.PR1398_maxLoop=3}catch(a){return a.name===W.InvalidState&&t.isOpen()&&0<--t._state.PR1398_maxLoop?(t.close({disableAutoOpen:!1}),t.open().then((function(){return e(t,n,r,null,o)}))):Qe(a)}var u,c=F(o);return c&&Ue(),a=ke.follow((function(){var e;(u=o.call(s,s))&&(c?(e=ze.bind(null,null),u.then(e,e)):"function"==typeof u.next&&"function"==typeof u.throw&&(u=Pn(u)))}),a),(u&&"function"==typeof u.then?ke.resolve(u).then((function(e){return s.active?e:Qe(new V.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))})):a.then((function(){return u}))).then((function(e){return i&&s._resolve(),s._completion.then((function(){return e}))})).catch((function(e){return s._reject(e),Qe(e)}))}))}.bind(null,this,o,a,i,n);return i?i._promise(o,u,"lock"):ge.trans?Ge(ge.transless,(function(){return r._whenReady(u)})):this._whenReady(u)},nr.prototype.table=function(e){if(!l(this._allTables,e))throw new V.InvalidTable("Table ".concat(e," does not exist"));return this._allTables[e]},nr);function nr(e,n){var r=this;this._middlewares={},this.verno=0;var i=nr.dependencies;this._options=n=t({addons:nr.addons,autoOpen:!0,indexedDB:i.indexedDB,IDBKeyRange:i.IDBKeyRange,cache:"cloned"},n),this._deps={indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange},i=n.addons,this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;var o,a,s,u,c,l={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:X,dbReadyPromise:null,cancelOpen:X,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3,autoOpen:n.autoOpen};l.dbReadyPromise=new ke((function(e){l.dbReadyResolve=e})),l.openCanceller=new ke((function(e,t){l.cancelOpen=t})),this._state=l,this.name=e,this.on=pt(this,"populate","blocked","versionchange","close",{ready:[re,X]}),this.on.ready.subscribe=g(this.on.ready.subscribe,(function(e){return function(t,n){nr.vip((function(){var i,o=r._state;o.openComplete?(o.dbOpenError||ke.resolve().then(t),n&&e(t)):o.onReadyBeingFired?(o.onReadyBeingFired.push(t),n&&e(t)):(e(t),i=r,n||e((function e(){i.on.ready.unsubscribe(t),i.on.ready.unsubscribe(e)})))}))}})),this.Collection=(o=this,mt(_t.prototype,(function(e,t){this.db=o;var n=at,r=null;if(t)try{n=t()}catch(e){r=e}var i=e._ctx;e=(t=i.table).hook.reading.fire,this._ctx={table:t,index:i.index,isPrimKey:!i.index||t.schema.primKey.keyPath&&i.index===t.schema.primKey.name,range:n,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:r,or:i.or,valueMapper:e!==Y?e:null}}))),this.Table=(a=this,mt(ht.prototype,(function(e,t,n){this.db=a,this._tx=n,this.name=e,this.schema=t,this.hook=a._allTables[e]?a._allTables[e].hook:pt(null,{creating:[Z,X],reading:[Q,Y],updating:[te,X],deleting:[ee,X]})}))),this.Transaction=(s=this,mt(Ut.prototype,(function(e,t,n,r,i){var o=this;this.db=s,this.mode=e,this.storeNames=t,this.schema=n,this.chromeTransactionDurability=r,this.idbtrans=null,this.on=pt(this,"complete","error","abort"),this.parent=i||null,this.active=!0,this._reculock=0,this._blockedFuncs=[],this._resolve=null,this._reject=null,this._waitingFor=null,this._waitingQueue=null,this._spinCount=0,this._completion=new ke((function(e,t){o._resolve=e,o._reject=t})),this._completion.then((function(){o.active=!1,o.on.complete.fire()}),(function(e){var t=o.active;return o.active=!1,o.on.error.fire(e),o.parent?o.parent._reject(e):t&&o.idbtrans&&o.idbtrans.abort(),Qe(e)}))}))),this.Version=(u=this,mt(pn.prototype,(function(e){this.db=u,this._cfg={version:e,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}}))),this.WhereClause=(c=this,mt(Lt.prototype,(function(e,t,n){if(this.db=c,this._ctx={table:e,index:":id"===t?null:t,or:n},this._cmp=this._ascending=ct,this._descending=function(e,t){return ct(t,e)},this._max=function(e,t){return 0<ct(e,t)?e:t},this._min=function(e,t){return ct(e,t)<0?e:t},this._IDBKeyRange=c._deps.IDBKeyRange,!this._IDBKeyRange)throw new V.MissingAPI}))),this.on("versionchange",(function(e){e.newVersion,r.close({disableAutoOpen:!1})})),this.on("blocked",(function(e){!e.newVersion||(e.newVersion,e.oldVersion)})),this._maxKey=$t(n.IDBKeyRange),this._createTransaction=function(e,t,n,i){return new r.Transaction(e,t,n,r._options.chromeTransactionDurability,i)},this._fireOnBlocked=function(e){r.on("blocked").fire(e),tt.filter((function(e){return e.name===r.name&&e!==r&&!e._state.vcFired})).map((function(t){return t.on("versionchange").fire(e)}))},this.use(zn),this.use(Zn),this.use(Vn),this.use(jn),this.use(Kn);var d=new Proxy(this,{get:function(e,t,n){if("_vip"===t)return!0;if("table"===t)return function(e){return er(r.table(e),d)};var i=Reflect.get(e,t,n);return i instanceof ht?er(i,d):"tables"===t?i.map((function(e){return er(e,d)})):"_createTransaction"===t?function(){return er(i.apply(this,arguments),d)}:i}});this.vip=d,i.forEach((function(e){return e(r)}))}j="undefined"!=typeof Symbol&&"observable"in Symbol?Symbol.observable:"@@observable";var rr,ir=(or.prototype.subscribe=function(e,t,n){return this._subscribe(e&&"function"!=typeof e?e:{next:e,error:t,complete:n})},or.prototype[j]=function(){return this},or);function or(e){this._subscribe=e}try{rr={indexedDB:i.indexedDB||i.mozIndexedDB||i.webkitIndexedDB||i.msIndexedDB,IDBKeyRange:i.IDBKeyRange||i.webkitIDBKeyRange}}catch(C){rr={indexedDB:null,IDBKeyRange:null}}function ar(e){var t,n=!1,r=new ir((function(r){var i,o=F(e),a=!1,s={},u={},c={get closed(){return a},unsubscribe:function(){a||(a=!0,i&&i.abort(),d&&Kt.storagemutated.unsubscribe(f))}};r.start&&r.start(c);var d=!1,h=function(){return Ye(p)},f=function(e){En(s,e),On(u,s)&&h()},p=function(){var c,p,m;!a&&rr.indexedDB&&(s={},c={},i&&i.abort(),i=new AbortController,m=function(t){var n=Te();try{o&&Ue();var r=Ke(e,t);return r=o?r.finally(ze):r}finally{n&&Re()}}(p={subscr:c,signal:i.signal,requery:h,querier:e,trans:null}),Promise.resolve(m).then((function(e){n=!0,t=e,a||p.signal.aborted||(s={},function(e){for(var t in e)if(l(e,t))return;return 1}(u=c)||d||(Kt(Bt,f),d=!0),Ye((function(){return!a&&r.next&&r.next(e)})))}),(function(e){n=!1,["DatabaseClosedError","AbortError"].includes(null==e?void 0:e.name)||a||Ye((function(){a||r.error&&r.error(e)}))})))};return setTimeout(h,0),c}));return r.hasValue=function(){return n},r.getValue=function(){return t},r}var sr=tr;function ur(e){var t=lr;try{lr=!0,Kt.storagemutated.fire(e),Nn(e,!0)}finally{lr=t}}d(sr,t(t({},G),{delete:function(e){return new sr(e,{addons:[]}).delete()},exists:function(e){return new sr(e,{addons:[]}).open().then((function(e){return e.close(),!0})).catch("NoSuchDatabaseError",(function(){return!1}))},getDatabaseNames:function(e){try{return n=(t=sr.dependencies).indexedDB,t=t.IDBKeyRange,(vn(n)?Promise.resolve(n.databases()).then((function(e){return e.map((function(e){return e.name})).filter((function(e){return e!==nt}))})):yn(n,t).toCollection().primaryKeys()).then(e)}catch(e){return Qe(new V.MissingAPI)}var t,n},defineClass:function(){return function(e){s(this,e)}},ignoreTransaction:function(e){return ge.trans?Ge(ge.transless,e):e()},vip:gn,async:function(e){return function(){try{var t=Pn(e.apply(this,arguments));return t&&"function"==typeof t.then?t:ke.resolve(t)}catch(t){return Qe(t)}}},spawn:function(e,t,n){try{var r=Pn(e.apply(n,t||[]));return r&&"function"==typeof r.then?r:ke.resolve(r)}catch(e){return Qe(e)}},currentTransaction:{get:function(){return ge.trans||null}},waitFor:function(e,t){return t=ke.resolve("function"==typeof e?sr.ignoreTransaction(e):e).timeout(t||6e4),ge.trans?ge.trans.waitFor(t):t},Promise:ke,debug:{get:function(){return ie},set:function(e){oe(e)}},derive:p,extend:s,props:d,override:g,Events:pt,on:Kt,liveQuery:ar,extendObservabilitySet:En,getByKeyPath:S,setByKeyPath:k,delByKeyPath:function(e,t){"string"==typeof t?k(e,t,void 0):"length"in t&&[].map.call(t,(function(t){k(e,t,void 0)}))},shallowClone:I,deepClone:M,getObjectDiff:Bn,cmp:ct,asap:w,minKey:-1/0,addons:[],connections:tt,errnames:W,dependencies:rr,cache:Mn,semVer:"4.0.11",version:"4.0.11".split(".").map((function(e){return parseInt(e)})).reduce((function(e,t,n){return e+t/Math.pow(10,2*n)}))})),sr.maxKey=$t(sr.dependencies.IDBKeyRange),"undefined"!=typeof dispatchEvent&&"undefined"!=typeof addEventListener&&(Kt(Bt,(function(e){lr||(e=new CustomEvent(qt,{detail:e}),lr=!0,dispatchEvent(e),lr=!1)})),addEventListener(qt,(function(e){e=e.detail,lr||ur(e)})));var cr,lr=!1,dr=function(){};return"undefined"!=typeof BroadcastChannel&&((dr=function(){(cr=new BroadcastChannel(qt)).onmessage=function(e){return e.data&&ur(e.data)}})(),"function"==typeof cr.unref&&cr.unref(),Kt(Bt,(function(e){lr||cr.postMessage(e)}))),"undefined"!=typeof addEventListener&&(addEventListener("pagehide",(function(e){if(!tr.disableBfCache&&e.persisted){null!=cr&&cr.close();for(var t=0,n=tt;t<n.length;t++)n[t].close({disableAutoOpen:!1})}})),addEventListener("pageshow",(function(e){!tr.disableBfCache&&e.persisted&&(dr(),ur({all:new wn(-1/0,[[]])}))}))),ke.rejectionMapper=function(e,t){return!e||e instanceof q||e instanceof TypeError||e instanceof SyntaxError||!e.name||!$[e.name]?e:(t=new $[e.name](t||e.message,e),"stack"in e&&f(t,"stack",{get:function(){return this.inner.stack}}),t)},oe(ie),t(tr,Object.freeze({__proto__:null,Dexie:tr,liveQuery:ar,Entity:ut,cmp:ct,PropModification:It,replacePrefix:function(e,t){return new It({replacePrefix:[e,t]})},add:function(e){return new It({add:e})},remove:function(e){return new It({remove:e})},default:tr,RangeSet:wn,mergeRanges:kn,rangesOverlap:In}),{default:tr}),tr}()}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r].call(o.exports,o,o.exports,n),o.exports}n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}();var r={};return function(){"use strict";const e="betterbugs-sdk-main",t="betterbugs-message-listener",r="STEPS_FEATURE_CLICK_EVENT",i="STEPS_FEATURE_NAVIGATE_EVENT",o="STEPS_FEATURE_TYPED_EVENT",a="STEPS_FEATURE_PRESSED_EVENT";let s=!1;function u(e){s=e}function c(){return s}try{window.setBetterBugsLogging=u}catch(e){globalThis.setBetterBugsLogging=u}try{window.getBetterBugsLogging=c}catch(e){globalThis.getBetterBugsLogging=c}const l={sample(e,t,...n){if(d(n)){}},log:(...e)=>{d(e)},warn:(...e)=>{if(d(e)){}},error:(...e)=>{if(d(e)){}},info:(...e)=>{if(d(e)){}},debug:(...e)=>{d(e)},group:(...e)=>{d(e)},groupCollapsed:(...e)=>{d(e)},groupEnd:(...e)=>{d(e)}};function d(e){return s&&function(e){try{if(!("localStorage"in globalThis)||!globalThis.localStorage.debug)return!0}catch(e){return!0}if("string"!=typeof e[0]||"string"!=typeof globalThis.localStorage.debug)return!0;const t=e[0],n=globalThis.localStorage.debug.replace("*",".*");return new RegExp("^"+n).test(t)}(e)}var h,f="user-agent",p="",m="function",y="undefined",v="object",g="string",b="browser",w="cpu",S="device",k="engine",I="os",x="result",_="name",C="type",E="vendor",O="version",M="architecture",T="major",R="model",D="console",N="mobile",A="tablet",L="smarttv",P="wearable",F="xr",j="embedded",B="inapp",q="brands",K="formFactors",U="fullVersionList",z="platform",W="platformVersion",H="bitness",V="sec-ch-ua",$=V+"-full-version-list",G=V+"-arch",X=V+"-"+H,Y=V+"-form-factors",Q=V+"-"+N,J=V+"-"+R,Z=V+"-"+z,ee=Z+"-version",te=[q,U,N,R,z,W,M,K,H],ne="Amazon",re="Apple",ie="ASUS",oe="BlackBerry",ae="Google",se="Huawei",ue="Lenovo",ce="Honor",le="LG",de="Microsoft",he="Motorola",fe="Nvidia",pe="OnePlus",me="OPPO",ye="Samsung",ve="Sharp",ge="Sony",be="Xiaomi",we="Zebra",Se="Chrome",ke="Chromium",Ie="Chromecast",xe="Firefox",_e="Opera",Ce="Facebook",Ee="Sogou",Oe="Mobile ",Me=" Browser",Te="Windows",Re=typeof window!==y&&window.navigator?window.navigator:void 0,De=Re&&Re.userAgentData?Re.userAgentData:void 0,Ne=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},Ae=function(e,t){if(typeof e===v&&e.length>0){for(var n in e)if(je(e[n])==je(t))return!0;return!1}return!!Pe(e)&&-1!==je(t).indexOf(je(e))},Le=function(e,t){for(var n in e)return/^(browser|cpu|device|engine|os)$/.test(n)||!!t&&Le(e[n])},Pe=function(e){return typeof e===g},Fe=function(e){if(e){for(var t=[],n=Ke(/\\?\"/g,e).split(","),r=0;r<n.length;r++)if(n[r].indexOf(";")>-1){var i=ze(n[r]).split(";v=");t[r]={brand:i[0],version:i[1]}}else t[r]=ze(n[r]);return t}},je=function(e){return Pe(e)?e.toLowerCase():e},Be=function(e){return Pe(e)?Ke(/[^\d\.]/g,e).split(".")[0]:void 0},qe=function(e){for(var t in e){var n=e[t];typeof n==v&&2==n.length?this[n[0]]=n[1]:this[n]=void 0}return this},Ke=function(e,t){return Pe(t)?t.replace(e,p):t},Ue=function(e){return Ke(/\\?\"/g,e)},ze=function(e,t){if(Pe(e))return e=Ke(/^\s\s*/,e),typeof t===y?e:e.substring(0,500)},We=function(e,t){if(e&&t)for(var n,r,i,o,a,s,u=0;u<t.length&&!a;){var c=t[u],l=t[u+1];for(n=r=0;n<c.length&&!a&&c[n];)if(a=c[n++].exec(e))for(i=0;i<l.length;i++)s=a[++r],typeof(o=l[i])===v&&o.length>0?2===o.length?typeof o[1]==m?this[o[0]]=o[1].call(this,s):this[o[0]]=o[1]:3===o.length?typeof o[1]!==m||o[1].exec&&o[1].test?this[o[0]]=s?s.replace(o[1],o[2]):void 0:this[o[0]]=s?o[1].call(this,s,o[2]):void 0:4===o.length&&(this[o[0]]=s?o[3].call(this,s.replace(o[1],o[2])):void 0):this[o]=s||void 0;u+=2}},He=function(e,t){for(var n in t)if(typeof t[n]===v&&t[n].length>0){for(var r=0;r<t[n].length;r++)if(Ae(t[n][r],e))return"?"===n?void 0:n}else if(Ae(t[n],e))return"?"===n?void 0:n;return t.hasOwnProperty("*")?t["*"]:e},Ve={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},$e={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},Ge={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[O,[_,Oe+"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[O,[_,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[_,O],[/opios[\/ ]+([\w\.]+)/i],[O,[_,_e+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[O,[_,_e+" GX"]],[/\bopr\/([\w\.]+)/i],[O,[_,_e]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[O,[_,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[O,[_,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon|otter|dooble|(?:lg |qute)browser)\/([-\w\.]+)/i,/(heytap|ovi|115|surf)browser\/([\d\.]+)/i,/(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i],[_,O],[/quark(?:pc)?\/([-\w\.]+)/i],[O,[_,"Quark"]],[/\bddg\/([\w\.]+)/i],[O,[_,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[O,[_,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[O,[_,"WeChat"]],[/konqueror\/([\w\.]+)/i],[O,[_,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[O,[_,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[O,[_,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[O,[_,"Smart "+ue+Me]],[/(avast|avg)\/([\w\.]+)/i],[[_,/(.+)/,"$1 Secure"+Me],O],[/\bfocus\/([\w\.]+)/i],[O,[_,xe+" Focus"]],[/\bopt\/([\w\.]+)/i],[O,[_,_e+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[O,[_,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[O,[_,"Dolphin"]],[/coast\/([\w\.]+)/i],[O,[_,_e+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[O,[_,"MIUI"+Me]],[/fxios\/([\w\.-]+)/i],[O,[_,Oe+xe]],[/\bqihoobrowser\/?([\w\.]*)/i],[O,[_,"360"]],[/\b(qq)\/([\w\.]+)/i],[[_,/(.+)/,"$1Browser"],O],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[_,/(.+)/,"$1"+Me],O],[/samsungbrowser\/([\w\.]+)/i],[O,[_,ye+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[O,[_,Ee+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[_,Ee+" Mobile"],O],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[_,O],[/(lbbrowser|rekonq)/i],[_],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[O,_],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[_,Ce],O,[C,B]],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(instagram|snapchat)[\/ ]([-\w\.]+)/i],[_,O,[C,B]],[/\bgsa\/([\w\.]+) .*safari\//i],[O,[_,"GSA"],[C,B]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[O,[_,"TikTok"],[C,B]],[/\[(linkedin)app\]/i],[_,[C,B]],[/(chromium)[\/ ]([-\w\.]+)/i],[_,O],[/headlesschrome(?:\/([\w\.]+)| )/i],[O,[_,Se+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[_,Se+" WebView"],O],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[O,[_,"Android"+Me]],[/chrome\/([\w\.]+) mobile/i],[O,[_,Oe+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[_,O],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[O,[_,Oe+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[_,Oe+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[O,_],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[_,[O,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[_,O],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[_,Oe+xe],O],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[_,"Netscape"],O],[/(wolvic|librewolf)\/([\w\.]+)/i],[_,O],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[O,[_,xe+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[_,[O,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[_,[O,/[^\d\.]+./,p]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[M,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[M,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[M,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[M,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[M,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[M,/ower/,p,je]],[/ sun4\w[;\)]/i],[[M,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[M,je]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[R,[E,ye],[C,A]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[R,[E,ye],[C,N]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[R,[E,re],[C,N]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[R,[E,re],[C,A]],[/(macintosh);/i],[R,[E,re]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[R,[E,ve],[C,N]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[R,[E,ce],[C,A]],[/honor([-\w ]+)[;\)]/i],[R,[E,ce],[C,N]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[R,[E,se],[C,A]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[R,[E,se],[C,N]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[R,/_/g," "],[E,be],[C,A]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[R,/_/g," "],[E,be],[C,N]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[R,[E,me],[C,N]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[R,[E,He,{OnePlus:["304","403","203"],"*":me}],[C,A]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[R,[E,"BLU"],[C,N]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[R,[E,"Vivo"],[C,N]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[R,[E,"Realme"],[C,N]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto(?! 360)[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[R,[E,he],[C,N]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[R,[E,he],[C,A]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[R,[E,le],[C,A]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch))(\w+)/i,/\blg-?([\d\w]+) bui/i],[R,[E,le],[C,N]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[R,[E,ue],[C,A]],[/(nokia) (t[12][01])/i],[E,R,[C,A]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[R,/_/g," "],[C,N],[E,"Nokia"]],[/(pixel (c|tablet))\b/i],[R,[E,ae],[C,A]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[R,[E,ae],[C,N]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[R,[E,ge],[C,N]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[R,"Xperia Tablet"],[E,ge],[C,A]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[R,[E,pe],[C,N]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[R,[E,ne],[C,A]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[R,/(.+)/g,"Fire Phone $1"],[E,ne],[C,N]],[/(playbook);[-\w\),; ]+(rim)/i],[R,E,[C,A]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[R,[E,oe],[C,N]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[R,[E,ie],[C,A]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[R,[E,ie],[C,N]],[/(nexus 9)/i],[R,[E,"HTC"],[C,A]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[E,[R,/_/g," "],[C,N]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[R,[E,"TCL"],[C,A]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[R,[E,"TCL"],[C,N]],[/(itel) ((\w+))/i],[[E,je],R,[C,He,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[R,[E,"Acer"],[C,A]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[R,[E,"Meizu"],[C,N]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[R,[E,"Ulefone"],[C,N]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[R,[E,"Energizer"],[C,N]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[R,[E,"Cat"],[C,N]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[R,[E,"Smartfren"],[C,N]],[/droid.+; (a(?:015|06[35]|142p?))/i],[R,[E,"Nothing"],[C,N]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[R,[E,"Archos"],[C,A]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[R,[E,"Archos"],[C,N]],[/(imo) (tab \w+)/i,/(infinix) (x1101b?)/i],[E,R,[C,A]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (blu|hmd|imo|tcl)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i,/(oppo) ?([\w ]+) bui/i],[E,R,[C,N]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[E,R,[C,A]],[/(surface duo)/i],[R,[E,de],[C,A]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[R,[E,"Fairphone"],[C,N]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[R,[E,fe],[C,A]],[/(sprint) (\w+)/i],[E,R,[C,N]],[/(kin\.[onetw]{3})/i],[[R,/\./g," "],[E,de],[C,N]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[R,[E,we],[C,A]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[R,[E,we],[C,N]],[/smart-tv.+(samsung)/i],[E,[C,L]],[/hbbtv.+maple;(\d+)/i],[[R,/^/,"SmartTV"],[E,ye],[C,L]],[/tcast.+(lg)e?. ([-\w]+)/i],[E,R,[C,L]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[E,le],[C,L]],[/(apple) ?tv/i],[E,[R,re+" TV"],[C,L]],[/crkey.*devicetype\/chromecast/i],[[R,Ie+" Third Generation"],[E,ae],[C,L]],[/crkey.*devicetype\/([^/]*)/i],[[R,/^/,"Chromecast "],[E,ae],[C,L]],[/fuchsia.*crkey/i],[[R,Ie+" Nest Hub"],[E,ae],[C,L]],[/crkey/i],[[R,Ie],[E,ae],[C,L]],[/(portaltv)/i],[R,[E,Ce],[C,L]],[/droid.+aft(\w+)( bui|\))/i],[R,[E,ne],[C,L]],[/(shield \w+ tv)/i],[R,[E,fe],[C,L]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[R,[E,ve],[C,L]],[/(bravia[\w ]+)( bui|\))/i],[R,[E,ge],[C,L]],[/(mi(tv|box)-?\w+) bui/i],[R,[E,be],[C,L]],[/Hbbtv.*(technisat) (.*);/i],[E,R,[C,L]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[E,ze],[R,ze],[C,L]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[R,[C,L]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[C,L]],[/(ouya)/i,/(nintendo) (\w+)/i],[E,R,[C,D]],[/droid.+; (shield)( bui|\))/i],[R,[E,fe],[C,D]],[/(playstation \w+)/i],[R,[E,ge],[C,D]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[R,[E,de],[C,D]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[R,[E,ye],[C,P]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[E,R,[C,P]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[R,[E,me],[C,P]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[R,[E,re],[C,P]],[/(opwwe\d{3})/i],[R,[E,pe],[C,P]],[/(moto 360)/i],[R,[E,he],[C,P]],[/(smartwatch 3)/i],[R,[E,ge],[C,P]],[/(g watch r)/i],[R,[E,le],[C,P]],[/droid.+; (wt63?0{2,3})\)/i],[R,[E,we],[C,P]],[/droid.+; (glass) \d/i],[R,[E,ae],[C,F]],[/(pico) (4|neo3(?: link|pro)?)/i],[E,R,[C,F]],[/(quest( \d| pro)?s?).+vr/i],[R,[E,Ce],[C,F]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[E,[C,j]],[/(aeobc)\b/i],[R,[E,ne],[C,j]],[/(homepod).+mac os/i],[R,[E,re],[C,j]],[/windows iot/i],[[C,j]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i],[R,[C,He,{mobile:"Mobile",xr:"VR","*":A}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[C,A]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[C,N]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[R,[E,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[O,[_,"EdgeHTML"]],[/(arkweb)\/([\w\.]+)/i],[_,O],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[O,[_,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[_,O],[/ladybird\//i],[[_,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[O,_]],os:[[/microsoft (windows) (vista|xp)/i],[_,O],[/(windows (?:phone(?: os)?|mobile|iot))[\/ ]?([\d\.\w ]*)/i],[_,[O,He,Ve]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[O,He,Ve],[_,Te]],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[O,/_/g,"."],[_,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[_,"macOS"],[O,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[O,[_,Ie+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[O,[_,Ie+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[O,[_,Ie+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[O,[_,Ie+" Linux"]],[/crkey\/([\d\.]+)/i],[O,[_,Ie]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[O,_],[/(ubuntu) ([\w\.]+) like android/i],[[_,/(.+)/,"$1 Touch"],O],[/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen|webos)\w*[-\/\.; ]?([\d\.]*)/i],[_,O],[/\(bb(10);/i],[O,[_,oe]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[O,[_,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[O,[_,xe+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[O,[_,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[O,[_,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[_,"Chrome OS"],O],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux)(?: arm\w*| x86\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[_,O],[/(sunos) ?([\w\.\d]*)/i],[[_,"Solaris"],O],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[_,O]]},Xe=(qe.call((h={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}}).init,[[b,[_,O,T,C]],[w,[M]],[S,[C,R,E]],[k,[_,O]],[I,[_,O]]]),qe.call(h.isIgnore,[[b,[O,T]],[k,[O]],[I,[O]]]),qe.call(h.isIgnoreRgx,[[b,/ ?browser$/i],[I,/ ?os$/i]]),qe.call(h.toString,[[b,[_,O]],[w,[M]],[S,[E,R]],[k,[_,O]],[I,[_,O]]]),h),Ye=function(e,t){var n=Xe.init[t],r=Xe.isIgnore[t]||0,i=Xe.isIgnoreRgx[t]||0,o=Xe.toString[t]||0;function a(){qe.call(this,n)}return a.prototype.getItem=function(){return e},a.prototype.withClientHints=function(){return De?De.getHighEntropyValues(te).then((function(t){return e.setCH(new Qe(t,!1)).parseCH().get()})):e.parseCH().get()},a.prototype.withFeatureCheck=function(){return e.detectFeature().get()},t!=x&&(a.prototype.is=function(e){var t=!1;for(var n in this)if(this.hasOwnProperty(n)&&!Ae(r,n)&&je(i?Ke(i,this[n]):this[n])==je(i?Ke(i,e):e)){if(t=!0,e!=y)break}else if(e==y&&t){t=!t;break}return t},a.prototype.toString=function(){var e=p;for(var t in o)typeof this[o[t]]!==y&&(e+=(e?" ":p)+this[o[t]]);return e||y}),De||(a.prototype.then=function(e){var t=this,n=function(){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e])};n.prototype={is:a.prototype.is,toString:a.prototype.toString};var r=new n;return e(r),r}),new a};function Qe(e,t){if(e=e||{},qe.call(this,te),t)qe.call(this,[[q,Fe(e[V])],[U,Fe(e[$])],[N,/\?1/.test(e[Q])],[R,Ue(e[J])],[z,Ue(e[Z])],[W,Ue(e[ee])],[M,Ue(e[G])],[K,Fe(e[Y])],[H,Ue(e[X])]]);else for(var n in e)this.hasOwnProperty(n)&&typeof e[n]!==y&&(this[n]=e[n])}function Je(e,t,n,r){return this.get=function(e){return e?this.data.hasOwnProperty(e)?this.data[e]:void 0:this.data},this.set=function(e,t){return this.data[e]=t,this},this.setCH=function(e){return this.uaCH=e,this},this.detectFeature=function(){if(Re&&Re.userAgent==this.ua)switch(this.itemType){case b:Re.brave&&typeof Re.brave.isBrave==m&&this.set(_,"Brave");break;case S:!this.get(C)&&De&&De[N]&&this.set(C,N),"Macintosh"==this.get(R)&&Re&&typeof Re.standalone!==y&&Re.maxTouchPoints&&Re.maxTouchPoints>2&&this.set(R,"iPad").set(C,A);break;case I:!this.get(_)&&De&&De[z]&&this.set(_,De[z]);break;case x:var e=this.data,t=function(t){return e[t].getItem().detectFeature().get()};this.set(b,t(b)).set(w,t(w)).set(S,t(S)).set(k,t(k)).set(I,t(I))}return this},this.parseUA=function(){return this.itemType!=x&&We.call(this.data,this.ua,this.rgxMap),this.itemType==b&&this.set(T,Be(this.get(O))),this},this.parseCH=function(){var e=this.uaCH,t=this.rgxMap;switch(this.itemType){case b:case k:var n,r=e[U]||e[q];if(r)for(var i in r){var o=r[i].brand||r[i],a=r[i].version;this.itemType!=b||/not.a.brand/i.test(o)||n&&(!/chrom/i.test(n)||o==ke)||(o=He(o,{Chrome:"Google Chrome",Edge:"Microsoft Edge","Chrome WebView":"Android WebView","Chrome Headless":"HeadlessChrome","Huawei Browser":"HuaweiBrowser","MIUI Browser":"Miui Browser","Opera Mobi":"OperaMobile",Yandex:"YaBrowser"}),this.set(_,o).set(O,a).set(T,Be(a)),n=o),this.itemType==k&&o==ke&&this.set(O,a)}break;case w:var s=e[M];s&&(s&&"64"==e[H]&&(s+="64"),We.call(this.data,s+";",t));break;case S:if(e[N]&&this.set(C,N),e[R]&&(this.set(R,e[R]),!this.get(C)||!this.get(E))){var u={};We.call(u,"droid 9; "+e[R]+")",t),!this.get(C)&&u.type&&this.set(C,u.type),!this.get(E)&&u.vendor&&this.set(E,u.vendor)}if(e[K]){var c;if("string"!=typeof e[K])for(var l=0;!c&&l<e[K].length;)c=He(e[K][l++],$e);else c=He(e[K],$e);this.set(C,c)}break;case I:var d=e[z];if(d){var h=e[W];d==Te&&(h=parseInt(Be(h),10)>=13?"11":"10"),this.set(_,d).set(O,h)}this.get(_)==Te&&"Xbox"==e[R]&&this.set(_,"Xbox").set(O,void 0);break;case x:var f=this.data,p=function(t){return f[t].getItem().setCH(e).parseCH().get()};this.set(b,p(b)).set(w,p(w)).set(S,p(S)).set(k,p(k)).set(I,p(I))}return this},qe.call(this,[["itemType",e],["ua",t],["uaCH",r],["rgxMap",n],["data",Ye(this,e)]]),this}function Ze(e,t,n){if(typeof e===v?(Le(e,!0)?(typeof t===v&&(n=t),t=e):(n=e,t=void 0),e=void 0):typeof e!==g||Le(t,!0)||(n=t,t=void 0),n&&typeof n.append===m){var r={};n.forEach((function(e,t){r[t]=e})),n=r}if(!(this instanceof Ze))return new Ze(e,t,n).getResult();var i=typeof e===g?e:n&&n[f]?n[f]:Re&&Re.userAgent?Re.userAgent:p,o=new Qe(n,!0),a=t?function(e,t){var n={},r=t;if(!Le(t))for(var i in r={},t)for(var o in t[i])r[o]=t[i][o].concat(r[o]?r[o]:[]);for(var a in e)n[a]=r[a]&&r[a].length%2==0?r[a].concat(e[a]):e[a];return n}(Ge,t):Ge,s=function(e){return e==x?function(){return new Je(e,i,a,o).set("ua",i).set(b,this.getBrowser()).set(w,this.getCPU()).set(S,this.getDevice()).set(k,this.getEngine()).set(I,this.getOS()).get()}:function(){return new Je(e,i,a[e],o).parseUA().get()}};return qe.call(this,[["getBrowser",s(b)],["getCPU",s(w)],["getDevice",s(S)],["getEngine",s(k)],["getOS",s(I)],["getResult",s(x)],["getUA",function(){return i}],["setUA",function(e){return Pe(e)&&(i=e.length>500?ze(e,500):e),this}]]).setUA(i),this}Ze.VERSION="2.0.3",Ze.BROWSER=Ne([_,O,T,C]),Ze.CPU=Ne([M]),Ze.DEVICE=Ne([R,E,C,D,N,L,A,P,j]),Ze.ENGINE=Ze.OS=Ne([_,O]);const et=e=>{try{return JSON.parse(JSON.stringify(e))}catch(t){return e}},tt=()=>((new Date).getTime()/1e3|0).toString(16)+Math.floor(16777216*Math.random()).toString(16).padStart(6,"0")+Math.floor(65536*Math.random()).toString(16).padStart(4,"0")+Math.floor(16777216*Math.random()).toString(16).padStart(6,"0"),nt=(e,t=60)=>e&&e.length>t?`${e.substring(0,t-1)}...`:e;const rt=()=>(sessionStorage.getItem("tabId")||sessionStorage.setItem("tabId",tt()),sessionStorage.getItem("tabId")||"");var it;function ot(e){return e.nodeType===e.ELEMENT_NODE}function at(e){const t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}function st(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function ut(e){try{const n=e.rules||e.cssRules;return n?((t=Array.from(n,ct).join("")).includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),t):null}catch(e){return null}var t}function ct(e){let t;if(function(e){return"styleSheet"in e}(e))try{t=ut(e.styleSheet)||function(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const n=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?n.push("layer"):e.layerName&&n.push(`layer(${e.layerName})`),e.supportsText&&n.push(`supports(${e.supportsText})`),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}(e)}catch(e){}else if(function(e){return"selectorText"in e}(e)&&e.selectorText.includes(":"))return function(e){const t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}(e.cssText);return t||e.cssText}!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"}(it||(it={}));class lt{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var t;if(!e)return-1;const n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e)))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function dt({element:e,maskInputOptions:t,tagName:n,type:r,value:i,maskInputFn:o}){let a=i||"";const s=r&&ht(r);return(t[n.toLowerCase()]||s&&t[s])&&(a=o?o(a,e):"*".repeat(a.length)),a}function ht(e){return e.toLowerCase()}const ft="__rrweb_original__";function pt(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?ht(t):null}function mt(e,t){var n;let r;try{r=new URL(e,null!=t?t:window.location.href)}catch(e){return null}const i=r.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(n=null==i?void 0:i[1])&&void 0!==n?n:null}let yt=1;const vt=new RegExp("[^a-z0-9-_:]");function gt(){return yt++}let bt,wt;const St=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,kt=/^(?:[a-z+]+:)?\/\//i,It=/^www\..*/i,xt=/^(data:)([^,]*),(.*)/i;function _t(e,t){return(e||"").replace(St,((e,n,r,i,o,a)=>{const s=r||o||a,u=n||i||"";if(!s)return e;if(kt.test(s)||It.test(s))return`url(${u}${s}${u})`;if(xt.test(s))return`url(${u}${s}${u})`;if("/"===s[0])return`url(${u}${function(e){let t="";return t=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],t=t.split("?")[0],t}(t)+s}${u})`;const c=t.split("/"),l=s.split("/");c.pop();for(const e of l)"."!==e&&(".."===e?c.pop():c.push(e));return`url(${u}${c.join("/")}${u})`}))}const Ct=/^[^ \t\n\r\u000c]+/,Et=/^[, \t\n\r\u000c]+/;function Ot(e,t){if(!t||""===t.trim())return t;const n=e.createElement("a");return n.href=t,n.href}function Mt(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function Tt(){const e=document.createElement("a");return e.href="",e.href}function Rt(e,t,n,r){return r?"src"===n||"href"===n&&("use"!==t||"#"!==r[0])||"xlink:href"===n&&"#"!==r[0]?Ot(e,r):"background"!==n||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n?function(e,t){if(""===t.trim())return t;let n=0;function r(e){let r;const i=e.exec(t.substring(n));return i?(r=i[0],n+=r.length,r):""}const i=[];for(;r(Et),!(n>=t.length);){let o=r(Ct);if(","===o.slice(-1))o=Ot(e,o.substring(0,o.length-1)),i.push(o);else{let r="";o=Ot(e,o);let a=!1;for(;;){const e=t.charAt(n);if(""===e){i.push((o+r).trim());break}if(a)")"===e&&(a=!1);else{if(","===e){n+=1,i.push((o+r).trim());break}"("===e&&(a=!0)}r+=e,n+=1}}}return i.join(", ")}(e,r):"style"===n?_t(r,Tt()):"object"===t&&"data"===n?Ot(e,r):r:Ot(e,r):r}function Dt(e,t,n){return("video"===e||"audio"===e)&&"autoplay"===t}function Nt(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&Nt(e.parentNode,t,n);for(let n=e.classList.length;n--;){const r=e.classList[n];if(t.test(r))return!0}return!!n&&Nt(e.parentNode,t,n)}function At(e,t,n,r){try{const i=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===i)return!1;if("string"==typeof t){if(r){if(i.closest(`.${t}`))return!0}else if(i.classList.contains(t))return!0}else if(Nt(i,t,r))return!0;if(n)if(r){if(i.closest(n))return!0}else if(i.matches(n))return!0}catch(e){}return!1}function Lt(e,t){const{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:a,inlineStylesheet:s,maskInputOptions:u={},maskTextFn:c,maskInputFn:l,dataURLOptions:d={},inlineImages:h,recordCanvas:f,keepIframeSrcFn:p,newlyAddedElement:m=!1}=t,y=function(e,t){if(!t.hasNode(e))return;const n=t.getId(e);return 1===n?void 0:n}(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:it.Document,childNodes:[],compatMode:e.compatMode}:{type:it.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:it.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:y};case e.ELEMENT_NODE:return function(e,t){const{doc:n,blockClass:r,blockSelector:i,inlineStylesheet:o,maskInputOptions:a={},maskInputFn:s,dataURLOptions:u={},inlineImages:c,recordCanvas:l,keepIframeSrcFn:d,newlyAddedElement:h=!1,rootId:f}=t,p=function(e,t,n){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){const r=e.classList[n];if(t.test(r))return!0}if(n)return e.matches(n)}catch(e){}return!1}(e,r,i),m=function(e){if(e instanceof HTMLFormElement)return"form";const t=ht(e.tagName);return vt.test(t)?"div":t}(e);let y={};const v=e.attributes.length;for(let t=0;t<v;t++){const r=e.attributes[t];Dt(m,r.name,r.value)||(y[r.name]=Rt(n,m,ht(r.name),r.value))}if("link"===m&&o){const t=Array.from(n.styleSheets).find((t=>t.href===e.href));let r=null;t&&(r=ut(t)),r&&(delete y.rel,delete y.href,y._cssText=_t(r,t.href))}if("style"===m&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){const t=ut(e.sheet);t&&(y._cssText=_t(t,Tt()))}if("input"===m||"textarea"===m||"select"===m){const t=e.value,n=e.checked;"radio"!==y.type&&"checkbox"!==y.type&&"submit"!==y.type&&"button"!==y.type&&t?y.value=dt({element:e,type:pt(e),tagName:m,value:t,maskInputOptions:a,maskInputFn:s}):n&&(y.checked=n)}"option"===m&&(e.selected&&!a.select?y.selected=!0:delete y.selected);if("canvas"===m&&l)if("2d"===e.__context)(function(e){const t=e.getContext("2d");if(!t)return!0;for(let n=0;n<e.width;n+=50)for(let r=0;r<e.height;r+=50){const i=t.getImageData,o=ft in i?i[ft]:i;if(new Uint32Array(o.call(t,n,r,Math.min(50,e.width-n),Math.min(50,e.height-r)).data.buffer).some((e=>0!==e)))return!1}return!0})(e)||(y.rr_dataURL=e.toDataURL(u.type,u.quality));else if(!("__context"in e)){const t=e.toDataURL(u.type,u.quality),n=document.createElement("canvas");n.width=e.width,n.height=e.height;t!==n.toDataURL(u.type,u.quality)&&(y.rr_dataURL=t)}if("img"===m&&c){bt||(bt=n.createElement("canvas"),wt=bt.getContext("2d"));const t=e,r=t.crossOrigin;t.crossOrigin="anonymous";const i=()=>{t.removeEventListener("load",i);try{bt.width=t.naturalWidth,bt.height=t.naturalHeight,wt.drawImage(t,0,0),y.rr_dataURL=bt.toDataURL(u.type,u.quality)}catch(e){}r?y.crossOrigin=r:t.removeAttribute("crossorigin")};t.complete&&0!==t.naturalWidth?i():t.addEventListener("load",i)}"audio"!==m&&"video"!==m||(y.rr_mediaState=e.paused?"paused":"played",y.rr_mediaCurrentTime=e.currentTime);h||(e.scrollLeft&&(y.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(y.rr_scrollTop=e.scrollTop));if(p){const{width:t,height:n}=e.getBoundingClientRect();y={class:y.class,rr_width:`${t}px`,rr_height:`${n}px`}}"iframe"!==m||d(y.src)||(e.test||(y.rr_src=y.src),delete y.src);let g;try{customElements.get(m)&&(g=!0)}catch(e){}return{type:it.Element,tagName:m,attributes:y,childNodes:[],isSVG:Mt(e)||void 0,needBlock:p,rootId:f,isCustom:g}}(e,{doc:n,blockClass:i,blockSelector:o,inlineStylesheet:s,maskInputOptions:u,maskInputFn:l,dataURLOptions:d,inlineImages:h,recordCanvas:f,keepIframeSrcFn:p,newlyAddedElement:m,rootId:y});case e.TEXT_NODE:return function(e,t){var n;const{needsMask:r,maskTextFn:i,rootId:o}=t,a=e.parentNode&&e.parentNode.tagName;let s=e.textContent;const u="STYLE"===a||void 0,c="SCRIPT"===a||void 0;if(u&&s){try{e.nextSibling||e.previousSibling||(null===(n=e.parentNode.sheet)||void 0===n?void 0:n.cssRules)&&(s=ut(e.parentNode.sheet))}catch(e){}s=_t(s,Tt())}c&&(s="SCRIPT_PLACEHOLDER");!u&&!c&&s&&r&&(s=i?i(s,e.parentElement):s.replace(/[\S]/g,"*"));return{type:it.Text,textContent:s||"",isStyle:u,rootId:o}}(e,{needsMask:a,maskTextFn:c,rootId:y});case e.CDATA_SECTION_NODE:return{type:it.CDATA,textContent:"",rootId:y};case e.COMMENT_NODE:return{type:it.Comment,textContent:e.textContent||"",rootId:y};default:return!1}}function Pt(e){return null==e?"":e.toLowerCase()}function Ft(e,t){const{doc:n,mirror:r,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:s,skipChild:u=!1,inlineStylesheet:c=!0,maskInputOptions:l={},maskTextFn:d,maskInputFn:h,slimDOMOptions:f,dataURLOptions:p={},inlineImages:m=!1,recordCanvas:y=!1,onSerialize:v,onIframeLoad:g,iframeLoadTimeout:b=5e3,onStylesheetLoad:w,stylesheetLoadTimeout:S=5e3,keepIframeSrcFn:k=()=>!1,newlyAddedElement:I=!1}=t;let{needsMask:x}=t,{preserveWhiteSpace:_=!0}=t;if(!x&&e.childNodes){x=At(e,a,s,void 0===x)}const C=Lt(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:x,inlineStylesheet:c,maskInputOptions:l,maskTextFn:d,maskInputFn:h,dataURLOptions:p,inlineImages:m,recordCanvas:y,keepIframeSrcFn:k,newlyAddedElement:I});if(!C)return null;let E;E=r.hasNode(e)?r.getId(e):!function(e,t){if(t.comment&&e.type===it.Comment)return!0;if(e.type===it.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel||"modulepreload"===e.attributes.rel)&&"script"===e.attributes.as||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&"js"===mt(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(Pt(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===Pt(e.attributes.name)||"icon"===Pt(e.attributes.rel)||"apple-touch-icon"===Pt(e.attributes.rel)||"shortcut icon"===Pt(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&Pt(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(Pt(e.attributes.property).match(/^(og|twitter|fb):/)||Pt(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===Pt(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===Pt(e.attributes.name)||"googlebot"===Pt(e.attributes.name)||"bingbot"===Pt(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===Pt(e.attributes.name)||"generator"===Pt(e.attributes.name)||"framework"===Pt(e.attributes.name)||"publisher"===Pt(e.attributes.name)||"progid"===Pt(e.attributes.name)||Pt(e.attributes.property).match(/^article:/)||Pt(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===Pt(e.attributes.name)||"yandex-verification"===Pt(e.attributes.name)||"csrf-token"===Pt(e.attributes.name)||"p:domain_verify"===Pt(e.attributes.name)||"verify-v1"===Pt(e.attributes.name)||"verification"===Pt(e.attributes.name)||"shopify-checkout-api-token"===Pt(e.attributes.name)))return!0}}return!1}(C,f)&&(_||C.type!==it.Text||C.isStyle||C.textContent.replace(/^\s+|\s+$/gm,"").length)?gt():-2;const O=Object.assign(C,{id:E});if(r.add(e,O),-2===E)return null;v&&v(e);let M=!u;if(O.type===it.Element){M=M&&!O.needBlock,delete O.needBlock;const t=e.shadowRoot;t&&st(t)&&(O.isShadowHost=!0)}if((O.type===it.Document||O.type===it.Element)&&M){f.headWhitespace&&O.type===it.Element&&"head"===O.tagName&&(_=!1);const t={doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:x,maskTextClass:a,maskTextSelector:s,skipChild:u,inlineStylesheet:c,maskInputOptions:l,maskTextFn:d,maskInputFn:h,slimDOMOptions:f,dataURLOptions:p,inlineImages:m,recordCanvas:y,preserveWhiteSpace:_,onSerialize:v,onIframeLoad:g,iframeLoadTimeout:b,onStylesheetLoad:w,stylesheetLoadTimeout:S,keepIframeSrcFn:k};if(O.type===it.Element&&"textarea"===O.tagName&&void 0!==O.attributes.value);else for(const n of Array.from(e.childNodes)){const e=Ft(n,t);e&&O.childNodes.push(e)}if(ot(e)&&e.shadowRoot)for(const n of Array.from(e.shadowRoot.childNodes)){const r=Ft(n,t);r&&(st(e.shadowRoot)&&(r.isShadow=!0),O.childNodes.push(r))}}return e.parentNode&&at(e.parentNode)&&st(e.parentNode)&&(O.isShadow=!0),O.type===it.Element&&"iframe"===O.tagName&&function(e,t,n){const r=e.contentWindow;if(!r)return;let i,o=!1;try{i=r.document.readyState}catch(e){return}if("complete"!==i){const r=setTimeout((()=>{o||(t(),o=!0)}),n);return void e.addEventListener("load",(()=>{clearTimeout(r),o=!0,t()}))}const a="about:blank";if(r.location.href!==a||e.src===a||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}(e,(()=>{const t=e.test;if(t&&g){const n=Ft(t,{doc:t,mirror:r,blockClass:i,blockSelector:o,needsMask:x,maskTextClass:a,maskTextSelector:s,skipChild:!1,inlineStylesheet:c,maskInputOptions:l,maskTextFn:d,maskInputFn:h,slimDOMOptions:f,dataURLOptions:p,inlineImages:m,recordCanvas:y,preserveWhiteSpace:_,onSerialize:v,onIframeLoad:g,iframeLoadTimeout:b,onStylesheetLoad:w,stylesheetLoadTimeout:S,keepIframeSrcFn:k});n&&g(e,n)}}),b),O.type===it.Element&&"link"===O.tagName&&"string"==typeof O.attributes.rel&&("stylesheet"===O.attributes.rel||"preload"===O.attributes.rel&&"string"==typeof O.attributes.href&&"css"===mt(O.attributes.href))&&function(e,t,n){let r,i=!1;try{r=e.sheet}catch(e){return}if(r)return;const o=setTimeout((()=>{i||(t(),i=!0)}),n);e.addEventListener("load",(()=>{clearTimeout(o),i=!0,t()}))}(e,(()=>{if(w){const t=Ft(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:x,maskTextClass:a,maskTextSelector:s,skipChild:!1,inlineStylesheet:c,maskInputOptions:l,maskTextFn:d,maskInputFn:h,slimDOMOptions:f,dataURLOptions:p,inlineImages:m,recordCanvas:y,preserveWhiteSpace:_,onSerialize:v,onIframeLoad:g,iframeLoadTimeout:b,onStylesheetLoad:w,stylesheetLoadTimeout:S,keepIframeSrcFn:k});t&&w(e,t)}}),S),O}const jt=/(max|min)-device-(width|height)/,Bt=(new RegExp(jt.source,"g"),/([^\\]):hover/);new RegExp(Bt.source,"g");function qt(e,t,n=document){const r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}let Kt={map:{},getId(){return-1},getNode(){return null},removeNodeFromMap(){},has(){return!1},reset(){}};function Ut(e,t,n={}){let r=null,i=0;return function(...o){const a=Date.now();i||!1!==n.leading||(i=a);const s=t-(a-i),u=this;s<=0||s>t?(r&&(clearTimeout(r),r=null),i=a,e.apply(u,o)):r||!1===n.trailing||(r=setTimeout((()=>{i=!1===n.leading?0:Date.now(),r=null,e.apply(u,o)}),s))}}function zt(e,t,n,r,i=window){const o=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,r?n:{set(e){setTimeout((()=>{n.set.call(this,e)}),0),o&&o.set&&o.set.call(this,e)}}),()=>zt(e,t,o||{},!0)}function Wt(e,t,n){try{if(!(t in e))return()=>{};const r=e[t],i=n(r);return"function"==typeof i&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,()=>{e[t]=r}}catch(e){return()=>{}}}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Kt=new Proxy(Kt,{get(e,t,n){return Reflect.get(e,t,n)}}));let Ht=Date.now;function Vt(e){var t,n,r,i,o,a;const s=e.document;return{left:s.scrollingElement?s.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:(null==s?void 0:s.documentElement.scrollLeft)||(null===(n=null===(t=null==s?void 0:s.body)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===(r=null==s?void 0:s.body)||void 0===r?void 0:r.scrollLeft)||0,top:s.scrollingElement?s.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==s?void 0:s.documentElement.scrollTop)||(null===(o=null===(i=null==s?void 0:s.body)||void 0===i?void 0:i.parentElement)||void 0===o?void 0:o.scrollTop)||(null===(a=null==s?void 0:s.body)||void 0===a?void 0:a.scrollTop)||0}}function $t(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Gt(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Xt(e){if(!e)return null;return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}function Yt(e,t,n,r){if(!e)return!1;const i=Xt(e);if(!i)return!1;try{if("string"==typeof t){if(i.classList.contains(t))return!0;if(r&&null!==i.closest("."+t))return!0}else if(Nt(i,t,r))return!0}catch(e){}if(n){if(i.matches(n))return!0;if(r&&null!==i.closest(n))return!0}return!1}function Qt(e,t){return-2===t.getId(e)}function Jt(e,t){if(at(e))return!1;const n=t.getId(e);return!t.has(n)||(!e.parentNode||e.parentNode.nodeType!==e.DOCUMENT_NODE)&&(!e.parentNode||Jt(e.parentNode,t))}function Zt(e){return Boolean(e.changedTouches)}function en(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function tn(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function nn(e){return Boolean(null==e?void 0:e.shadowRoot)}/[1-9][0-9]{12}/.test(Date.now().toString())||(Ht=()=>(new Date).getTime());class rn{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let n;return n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function on(e){var t,n;let r=null;return(null===(n=null===(t=e.getRootNode)||void 0===t?void 0:t.call(e))||void 0===n?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(r=e.getRootNode().host),r}function an(e){const t=e.ownerDocument;if(!t)return!1;const n=function(e){let t,n=e;for(;t=on(n);)n=t;return n}(e);return t.contains(n)}function sn(e){const t=e.ownerDocument;return!!t&&(t.contains(e)||an(e))}var un=(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))(un||{}),cn=(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[e.CustomElement=16]="CustomElement",e))(cn||{}),ln=(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))(ln||{}),dn=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(dn||{}),hn=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(hn||{});function fn(e){return"__ln"in e}class pn{constructor(){this.length=0,this.head=null,this.tail=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let n=0;n<e;n++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&fn(e.previousSibling)){const n=e.previousSibling.__ln.next;t.next=n,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,n&&(n.previous=t)}else if(e.nextSibling&&fn(e.nextSibling)&&e.nextSibling.__ln.previous){const n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;null===t.next&&(this.tail=t),this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const mn=(e,t)=>`${e}@${t}`;class yn{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,n=new pn,r=e=>{let t=e,n=-2;for(;-2===n;)t=t&&t.nextSibling,n=t&&this.mirror.getId(t);return n},i=i=>{if(!i.parentNode||!sn(i)||"TEXTAREA"===i.parentNode.tagName)return;const o=at(i.parentNode)?this.mirror.getId(on(i)):this.mirror.getId(i.parentNode),a=r(i);if(-1===o||-1===a)return n.addNode(i);const s=Ft(i,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,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:e=>{en(e,this.mirror)&&this.iframeManager.addIframe(e),tn(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),nn(i)&&this.shadowDomManager.addShadowRoot(i.shadowRoot,this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});s&&(e.push({parentId:o,nextId:a,node:s}),t.add(s.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const e of this.movedSet)gn(this.removes,e,this.mirror)&&!this.movedSet.has(e.parentNode)||i(e);for(const e of this.addedSet)wn(this.droppedSet,e)||gn(this.removes,e,this.mirror)?wn(this.movedSet,e)?i(e):this.droppedSet.add(e):i(e);let o=null;for(;n.length;){let e=null;if(o){const t=this.mirror.getId(o.value.parentNode),n=r(o.value);-1!==t&&-1!==n&&(e=o)}if(!e){let t=n.tail;for(;t;){const n=t;if(t=t.previous,n){const t=this.mirror.getId(n.value.parentNode);if(-1===r(n.value))continue;if(-1!==t){e=n;break}{const t=n.value;if(t.parentNode&&t.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const r=t.parentNode.host;if(-1!==this.mirror.getId(r)){e=n;break}}}}}}if(!e){for(;n.head;)n.removeNode(n.head.value);break}o=e.previous,n.removeNode(e.value),i(e.value)}const a={texts:this.texts.map((e=>{const t=e.node;return"TEXTAREA"===t.parentNode.tagName&&this.genTextAreaValueMutation(t.parentNode),{id:this.mirror.getId(t),value:e.value}})).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),attributes:this.attributes.map((e=>{const{attributes:t}=e;if("string"==typeof t.style){const n=JSON.stringify(e.styleDiff),r=JSON.stringify(e._unchangedStyles);n.length<t.style.length&&(n+r).split("var(").length===t.style.split("var(").length&&(t.style=e.styleDiff)}return{id:this.mirror.getId(e.node),attributes:t}})).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),removes:this.removes,adds:e};(a.texts.length||a.attributes.length||a.removes.length||a.adds.length)&&(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(a))},this.genTextAreaValueMutation=e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t)),t.attributes.value=Array.from(e.childNodes,(e=>e.textContent||"")).join("")},this.processMutation=e=>{if(!Qt(e.target,this.mirror))switch(e.type){case"characterData":{const t=e.target.textContent;Yt(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:At(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,Xt(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let n=e.attributeName,r=e.target.getAttribute(n);if("value"===n){const e=pt(t);r=dt({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:e,value:r,maskInputFn:this.maskInputFn})}if(Yt(e.target,this.blockClass,this.blockSelector,!1)||r===e.oldValue)return;let i=this.attributeMap.get(e.target);if("IFRAME"===t.tagName&&"src"===n&&!this.keepIframeSrcFn(r)){if(t.test)return;n="rr_src"}if(i||(i={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(e.target,i)),"type"===n&&"INPUT"===t.tagName&&"password"===(e.oldValue||"").toLowerCase()&&t.setAttribute("data-rr-is-password","true"),!Dt(t.tagName,n)&&(i.attributes[n]=Rt(this.doc,ht(t.tagName),ht(n),r),"style"===n)){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(e){this.unattachedDoc=this.doc}const n=this.unattachedDoc.createElement("span");e.oldValue&&n.setAttribute("style",e.oldValue);for(const e of Array.from(t.style)){const r=t.style.getPropertyValue(e),o=t.style.getPropertyPriority(e);r!==n.style.getPropertyValue(e)||o!==n.style.getPropertyPriority(e)?i.styleDiff[e]=""===o?r:[r,o]:i._unchangedStyles[e]=[r,o]}for(const e of Array.from(n.style))""===t.style.getPropertyValue(e)&&(i.styleDiff[e]=!1)}break}case"childList":if(Yt(e.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===e.target.tagName)return void this.genTextAreaValueMutation(e.target);e.addedNodes.forEach((t=>this.genAdds(t,e.target))),e.removedNodes.forEach((t=>{const n=this.mirror.getId(t),r=at(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);Yt(e.target,this.blockClass,this.blockSelector,!1)||Qt(t,this.mirror)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(vn(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||Jt(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[mn(n,r)]?vn(this.movedSet,t):this.removes.push({parentId:r,id:n,isShadow:!(!at(e.target)||!st(e.target))||void 0})),this.mapRemoves.push(t))}))}},this.genAdds=(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(Qt(e,this.mirror))return;this.movedSet.add(e);let n=null;t&&this.mirror.hasNode(t)&&(n=this.mirror.getId(t)),n&&-1!==n&&(this.movedMap[mn(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);Yt(e,this.blockClass,this.blockSelector,!1)||(e.childNodes.forEach((e=>this.genAdds(e))),nn(e)&&e.shadowRoot.childNodes.forEach((t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)})))}}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach((t=>{this[t]=e[t]}))}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function vn(e,t){e.delete(t),t.childNodes.forEach((t=>vn(e,t)))}function gn(e,t,n){return 0!==e.length&&bn(e,t,n)}function bn(e,t,n){const{parentNode:r}=t;if(!r)return!1;const i=n.getId(r);return!!e.some((e=>e.id===i))||bn(e,r,n)}function wn(e,t){return 0!==e.size&&Sn(e,t)}function Sn(e,t){const{parentNode:n}=t;return!!n&&(!!e.has(n)||Sn(e,n))}let kn;function In(e){kn=e}function xn(){kn=void 0}const _n=e=>{if(!kn)return e;return(...t)=>{try{return e(...t)}catch(e){if(kn&&!0===kn(e))return;throw e}}},Cn=[];function En(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch(e){}return e&&e.target}function On(e,t){var n,r;const i=new yn;Cn.push(i),i.init(e);let o=window.MutationObserver||window.__rrMutationObserver;const a=null===(r=null===(n=null===window||void 0===window?void 0:window.Zone)||void 0===n?void 0:n.__symbol__)||void 0===r?void 0:r.call(n,"MutationObserver");a&&window[a]&&(o=window[a]);const s=new o(_n(i.processMutations.bind(i)));return s.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),s}function Mn({mouseInteractionCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:o}){if(!1===o.mouseInteraction)return()=>{};const a=!0===o.mouseInteraction||void 0===o.mouseInteraction?{}:o.mouseInteraction,s=[];let u=null;return Object.keys(ln).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==a[e])).forEach((o=>{let a=ht(o);const c=(t=>o=>{const a=En(o);if(Yt(a,r,i,!0))return;let s=null,c=t;if("pointerType"in o){switch(o.pointerType){case"mouse":s=dn.Mouse;break;case"touch":s=dn.Touch;break;case"pen":s=dn.Pen}s===dn.Touch?ln[t]===ln.MouseDown?c="TouchStart":ln[t]===ln.MouseUp&&(c="TouchEnd"):dn.Pen}else Zt(o)&&(s=dn.Touch);null!==s?(u=s,(c.startsWith("Touch")&&s===dn.Touch||c.startsWith("Mouse")&&s===dn.Mouse)&&(s=null)):ln[t]===ln.Click&&(s=u,u=null);const l=Zt(o)?o.changedTouches[0]:o;if(!l)return;const d=n.getId(a),{clientX:h,clientY:f}=l;_n(e)(Object.assign({type:ln[c],id:d,x:h,y:f},null!==s&&{pointerType:s}))})(o);if(window.PointerEvent)switch(ln[o]){case ln.MouseDown:case ln.MouseUp:a=a.replace("mouse","pointer");break;case ln.TouchStart:case ln.TouchEnd:return}s.push(qt(a,c,t))})),_n((()=>{s.forEach((e=>e()))}))}function Tn({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:o}){return qt("scroll",_n(Ut(_n((o=>{const a=En(o);if(!a||Yt(a,r,i,!0))return;const s=n.getId(a);if(a===t&&t.defaultView){const n=Vt(t.defaultView);e({id:s,x:n.left,y:n.top})}else e({id:s,x:a.scrollLeft,y:a.scrollTop})})),o.scroll||100)),t)}const Rn=["INPUT","TEXTAREA","SELECT"],Dn=new WeakMap;function Nn(e){return function(e,t){if(Fn("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||Fn("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||Fn("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||Fn("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){const n=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(n)}else if(e.parentStyleSheet){const n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(n)}return t}(e,[])}function An(e,t,n){let r,i;return e?(e.ownerNode?r=t.getId(e.ownerNode):i=n.getId(e),{styleId:i,id:r}):{}}function Ln({mirror:e,stylesheetManager:t},n){var r,i,o;let a=null;a="#document"===n.nodeName?e.getId(n):e.getId(n.host);const s="#document"===n.nodeName?null===(r=n.defaultView)||void 0===r?void 0:r.Document:null===(o=null===(i=n.ownerDocument)||void 0===i?void 0:i.defaultView)||void 0===o?void 0:o.ShadowRoot,u=(null==s?void 0:s.prototype)?Object.getOwnPropertyDescriptor(null==s?void 0:s.prototype,"adoptedStyleSheets"):void 0;return null!==a&&-1!==a&&s&&u?(Object.defineProperty(n,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get(){var e;return null===(e=u.get)||void 0===e?void 0:e.call(this)},set(e){var n;const r=null===(n=u.set)||void 0===n?void 0:n.call(this,e);if(null!==a&&-1!==a)try{t.adoptStyleSheets(e,a)}catch(e){}return r}}),_n((()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get:u.get,set:u.set})}))):()=>{}}function Pn(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};let r;!function(e,t){const{mutationCb:n,mousemoveCb:r,mouseInteractionCb:i,scrollCb:o,viewportResizeCb:a,inputCb:s,mediaInteractionCb:u,styleSheetRuleCb:c,styleDeclarationCb:l,canvasMutationCb:d,fontCb:h,selectionCb:f,customElementCb:p}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),n(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),r(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),i(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),o(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),a(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),s(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),u(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),c(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),l(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),d(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),h(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),f(...e)},e.customElementCb=(...e)=>{t.customElement&&t.customElement(...e),p(...e)}}(e,t),e.recordDOM&&(r=On(e,e.doc));const i=function({mousemoveCb:e,sampling:t,doc:n,mirror:r}){if(!1===t.mousemove)return()=>{};const i="number"==typeof t.mousemove?t.mousemove:50,o="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let a,s=[];const u=Ut(_n((t=>{const n=Date.now()-a;e(s.map((e=>(e.timeOffset-=n,e))),t),s=[],a=null})),o),c=_n(Ut(_n((e=>{const t=En(e),{clientX:n,clientY:i}=Zt(e)?e.changedTouches[0]:e;a||(a=Ht()),s.push({x:n,y:i,id:r.getId(t),timeOffset:Ht()-a}),u("undefined"!=typeof DragEvent&&e instanceof DragEvent?cn.Drag:e instanceof MouseEvent?cn.MouseMove:cn.TouchMove)})),i,{trailing:!1})),l=[qt("mousemove",c,n),qt("touchmove",c,n),qt("drag",c,n)];return _n((()=>{l.forEach((e=>e()))}))}(e),o=Mn(e),a=Tn(e),s=function({viewportResizeCb:e},{win:t}){let n=-1,r=-1;return qt("resize",_n(Ut(_n((()=>{const t=$t(),i=Gt();n===t&&r===i||(e({width:Number(i),height:Number(t)}),n=t,r=i)})),200)),t)}(e,{win:n}),u=function({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,ignoreClass:o,ignoreSelector:a,maskInputOptions:s,maskInputFn:u,sampling:c,userTriggeredOnInput:l}){function d(e){let n=En(e);const c=e.isTrusted,d=n&&n.tagName;if(n&&"OPTION"===d&&(n=n.parentElement),!n||!d||Rn.indexOf(d)<0||Yt(n,r,i,!0))return;if(n.classList.contains(o)||a&&n.matches(a))return;let f=n.value,p=!1;const m=pt(n)||"";"radio"===m||"checkbox"===m?p=n.checked:(s[d.toLowerCase()]||s[m])&&(f=dt({element:n,maskInputOptions:s,tagName:d,type:m,value:f,maskInputFn:u})),h(n,l?{text:f,isChecked:p,userTriggered:c}:{text:f,isChecked:p});const y=n.name;"radio"===m&&y&&p&&t.querySelectorAll(`input[type="radio"][name="${y}"]`).forEach((e=>{if(e!==n){const t=e.value;h(e,l?{text:t,isChecked:!p,userTriggered:!1}:{text:t,isChecked:!p})}}))}function h(t,r){const i=Dn.get(t);if(!i||i.text!==r.text||i.isChecked!==r.isChecked){Dn.set(t,r);const i=n.getId(t);_n(e)(Object.assign(Object.assign({},r),{id:i}))}}const f=("last"===c.input?["change"]:["input","change"]).map((e=>qt(e,_n(d),t))),p=t.defaultView;if(!p)return()=>{f.forEach((e=>e()))};const m=p.Object.getOwnPropertyDescriptor(p.HTMLInputElement.prototype,"value"),y=[[p.HTMLInputElement.prototype,"value"],[p.HTMLInputElement.prototype,"checked"],[p.HTMLSelectElement.prototype,"value"],[p.HTMLTextAreaElement.prototype,"value"],[p.HTMLSelectElement.prototype,"selectedIndex"],[p.HTMLOptionElement.prototype,"selected"]];return m&&m.set&&f.push(...y.map((e=>zt(e[0],e[1],{set(){_n(d)({target:this,isTrusted:!1})}},!1,p)))),_n((()=>{f.forEach((e=>e()))}))}(e),c=function({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:i,doc:o}){const a=_n((o=>Ut(_n((i=>{const a=En(i);if(!a||Yt(a,t,n,!0))return;const{currentTime:s,volume:u,muted:c,playbackRate:l}=a;e({type:o,id:r.getId(a),currentTime:s,volume:u,muted:c,playbackRate:l})})),i.media||500))),s=[qt("play",a(0),o),qt("pause",a(1),o),qt("seeked",a(2),o),qt("volumechange",a(3),o),qt("ratechange",a(4),o)];return _n((()=>{s.forEach((e=>e()))}))}(e);let l=()=>{},d=()=>{},h=()=>{},f=()=>{};e.recordDOM&&(l=function({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};const i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:_n(((r,i,o)=>{const[a,s]=o,{id:u,styleId:c}=An(i,t,n.styleMirror);return(u&&-1!==u||c&&-1!==c)&&e({id:u,styleId:c,adds:[{rule:a,index:s}]}),r.apply(i,o)}))});const o=r.CSSStyleSheet.prototype.deleteRule;let a,s;r.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:_n(((r,i,o)=>{const[a]=o,{id:s,styleId:u}=An(i,t,n.styleMirror);return(s&&-1!==s||u&&-1!==u)&&e({id:s,styleId:u,removes:[{index:a}]}),r.apply(i,o)}))}),r.CSSStyleSheet.prototype.replace&&(a=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:_n(((r,i,o)=>{const[a]=o,{id:s,styleId:u}=An(i,t,n.styleMirror);return(s&&-1!==s||u&&-1!==u)&&e({id:s,styleId:u,replace:a}),r.apply(i,o)}))})),r.CSSStyleSheet.prototype.replaceSync&&(s=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(s,{apply:_n(((r,i,o)=>{const[a]=o,{id:s,styleId:u}=An(i,t,n.styleMirror);return(s&&-1!==s||u&&-1!==u)&&e({id:s,styleId:u,replaceSync:a}),r.apply(i,o)}))}));const u={};jn("CSSGroupingRule")?u.CSSGroupingRule=r.CSSGroupingRule:(jn("CSSMediaRule")&&(u.CSSMediaRule=r.CSSMediaRule),jn("CSSConditionRule")&&(u.CSSConditionRule=r.CSSConditionRule),jn("CSSSupportsRule")&&(u.CSSSupportsRule=r.CSSSupportsRule));const c={};return Object.entries(u).forEach((([r,i])=>{c[r]={insertRule:i.prototype.insertRule,deleteRule:i.prototype.deleteRule},i.prototype.insertRule=new Proxy(c[r].insertRule,{apply:_n(((r,i,o)=>{const[a,s]=o,{id:u,styleId:c}=An(i.parentStyleSheet,t,n.styleMirror);return(u&&-1!==u||c&&-1!==c)&&e({id:u,styleId:c,adds:[{rule:a,index:[...Nn(i),s||0]}]}),r.apply(i,o)}))}),i.prototype.deleteRule=new Proxy(c[r].deleteRule,{apply:_n(((r,i,o)=>{const[a]=o,{id:s,styleId:u}=An(i.parentStyleSheet,t,n.styleMirror);return(s&&-1!==s||u&&-1!==u)&&e({id:s,styleId:u,removes:[{index:[...Nn(i),a]}]}),r.apply(i,o)}))})})),_n((()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=o,a&&(r.CSSStyleSheet.prototype.replace=a),s&&(r.CSSStyleSheet.prototype.replaceSync=s),Object.entries(u).forEach((([e,t])=>{t.prototype.insertRule=c[e].insertRule,t.prototype.deleteRule=c[e].deleteRule}))}))}(e,{win:n}),d=Ln(e,e.doc),h=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:i}){const o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:_n(((i,a,s)=>{var u;const[c,l,d]=s;if(n.has(c))return o.apply(a,[c,l,d]);const{id:h,styleId:f}=An(null===(u=a.parentRule)||void 0===u?void 0:u.parentStyleSheet,t,r.styleMirror);return(h&&-1!==h||f&&-1!==f)&&e({id:h,styleId:f,set:{property:c,value:l,priority:d},index:Nn(a.parentRule)}),i.apply(a,s)}))});const a=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:_n(((i,o,s)=>{var u;const[c]=s;if(n.has(c))return a.apply(o,[c]);const{id:l,styleId:d}=An(null===(u=o.parentRule)||void 0===u?void 0:u.parentStyleSheet,t,r.styleMirror);return(l&&-1!==l||d&&-1!==d)&&e({id:l,styleId:d,remove:{property:c},index:Nn(o.parentRule)}),i.apply(o,s)}))}),_n((()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=a}))}(e,{win:n}),e.collectFonts&&(f=function({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const r=[],i=new WeakMap,o=n.FontFace;n.FontFace=function(e,t,n){const r=new o(e,t,n);return i.set(r,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),r};const a=Wt(t.fonts,"add",(function(t){return function(n){return setTimeout(_n((()=>{const t=i.get(n);t&&(e(t),i.delete(n))})),0),t.apply(this,[n])}}));return r.push((()=>{n.FontFace=o})),r.push(a),_n((()=>{r.forEach((e=>e()))}))}(e)));const p=function(e){const{doc:t,mirror:n,blockClass:r,blockSelector:i,selectionCb:o}=e;let a=!0;const s=_n((()=>{const e=t.getSelection();if(!e||a&&(null==e?void 0:e.isCollapsed))return;a=e.isCollapsed||!1;const s=[],u=e.rangeCount||0;for(let t=0;t<u;t++){const o=e.getRangeAt(t),{startContainer:a,startOffset:u,endContainer:c,endOffset:l}=o;Yt(a,r,i,!0)||Yt(c,r,i,!0)||s.push({start:n.getId(a),startOffset:u,end:n.getId(c),endOffset:l})}o({ranges:s})}));return s(),qt("selectionchange",s)}(e),m=function({doc:e,customElementCb:t}){const n=e.defaultView;return n&&n.customElements?Wt(n.customElements,"define",(function(e){return function(n,r,i){try{t({define:{name:n}})}catch(e){}return e.apply(this,[n,r,i])}})):()=>{}}(e),y=[];for(const t of e.plugins)y.push(t.observer(t.callback,n,t.options));return _n((()=>{Cn.forEach((e=>e.reset())),null==r||r.disconnect(),i(),o(),a(),s(),u(),c(),l(),d(),h(),f(),p(),m(),y.forEach((e=>e()))}))}function Fn(e){return void 0!==window[e]}function jn(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class Bn{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,t,n,r){const i=n||this.getIdToRemoteIdMap(e),o=r||this.getRemoteIdToIdMap(e);let a=i.get(t);return a||(a=this.generateIdFn(),i.set(t,a),o.set(a,t)),a}getIds(e,t){const n=this.getIdToRemoteIdMap(e),r=this.getRemoteIdToIdMap(e);return t.map((t=>this.getId(e,t,n,r)))}getRemoteId(e,t,n){const r=n||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;const i=r.get(t);return i||-1}getRemoteIds(e,t){const n=this.getRemoteIdToIdMap(e);return t.map((t=>this.getRemoteId(e,t,n)))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class qn{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Bn(gt),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Bn(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null===(n=this.loadListener)||void 0===n||n.call(this,e),e.test&&e.test.adoptedStyleSheets&&e.test.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.test.adoptedStyleSheets,this.mirror.getId(e.test))}handleMessage(e){const t=e;if("rrweb"!==t.data.type||t.origin!==t.data.origin)return;if(!e.source)return;const n=this.crossOriginIframeMap.get(e.source);if(!n)return;const r=this.transformCrossOriginEvent(n,t.data.event);r&&this.wrappedEmit(r,t.data.isCheckout)}transformCrossOriginEvent(e,t){var n;switch(t.type){case un.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const n=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,n),this.patchRootIdOnNode(t.data.node,n),{timestamp:t.timestamp,type:un.IncrementalSnapshot,data:{source:cn.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case un.Meta:case un.Load:case un.DomContentLoaded:return!1;case un.Plugin:return t;case un.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case un.IncrementalSnapshot:switch(t.data.source){case cn.Mutation:return t.data.adds.forEach((t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);const n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(t.node,n)})),t.data.removes.forEach((t=>{this.replaceIds(t,e,["parentId","id"])})),t.data.attributes.forEach((t=>{this.replaceIds(t,e,["id"])})),t.data.texts.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case cn.Drag:case cn.TouchMove:case cn.MouseMove:return t.data.positions.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case cn.ViewportResize:return!1;case cn.MediaInteraction:case cn.MouseInteraction:case cn.Scroll:case cn.CanvasMutation:case cn.Input:return this.replaceIds(t.data,e,["id"]),t;case cn.StyleSheetRule:case cn.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case cn.Font:return t;case cn.Selection:return t.data.ranges.forEach((t=>{this.replaceIds(t,e,["start","end"])})),t;case cn.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null===(n=t.data.styles)||void 0===n||n.forEach((t=>{this.replaceStyleIds(t,e,["styleId"])})),t}}return!1}replace(e,t,n,r){for(const i of r)(Array.isArray(t[i])||"number"==typeof t[i])&&(Array.isArray(t[i])?t[i]=e.getIds(n,t[i]):t[i]=e.getId(n,t[i]));return t}replaceIds(e,t,n){return this.replace(this.crossOriginIframeMirror,e,t,n)}replaceStyleIds(e,t,n){return this.replace(this.crossOriginIframeStyleMirror,e,t,n)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach((e=>{this.replaceIdOnNode(e,t)}))}patchRootIdOnNode(e,t){e.type===it.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach((e=>{this.patchRootIdOnNode(e,t)}))}}class Kn{constructor(e){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!st(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const n=On(Object.assign(Object.assign({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push((()=>n.disconnect())),this.restoreHandlers.push(Tn(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))),setTimeout((()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),this.restoreHandlers.push(Ln({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))}),0)}observeAttachShadow(e){e.contentWindow&&e.test&&this.patchAttachShadow(e.contentWindow.Element,e.test)}patchAttachShadow(e,t){const n=this;this.restoreHandlers.push(Wt(e.prototype,"attachShadow",(function(e){return function(r){const i=e.call(this,r);return this.shadowRoot&&sn(this)&&n.addShadowRoot(this.shadowRoot,t),i}})))}reset(){this.restoreHandlers.forEach((e=>{try{e()}catch(e){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}function Un(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}for(var zn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Wn="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Hn=0;Hn<64;Hn++)Wn[zn.charCodeAt(Hn)]=Hn;const Vn=new Map;const $n=(e,t,n)=>{if(!e||!Yn(e,t)&&"object"!=typeof e)return;const r=function(e,t){let n=Vn.get(e);return n||(n=new Map,Vn.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}(n,e.constructor.name);let i=r.indexOf(e);return-1===i&&(i=r.length,r.push(e)),i};function Gn(e,t,n){if(e instanceof Array)return e.map((e=>Gn(e,t,n)));if(null===e)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){const t=e.constructor.name,n=function(e){var t,n=new Uint8Array(e),r=n.length,i="";for(t=0;t<r;t+=3)i+=zn[n[t]>>2],i+=zn[(3&n[t])<<4|n[t+1]>>4],i+=zn[(15&n[t+1])<<2|n[t+2]>>6],i+=zn[63&n[t+2]];return r%3==2?i=i.substring(0,i.length-1)+"=":r%3==1&&(i=i.substring(0,i.length-2)+"=="),i}(e);return{rr_type:t,base64:n}}if(e instanceof DataView){return{rr_type:e.constructor.name,args:[Gn(e.buffer,t,n),e.byteOffset,e.byteLength]}}if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:n}=e;return{rr_type:t,src:n}}if(e instanceof HTMLCanvasElement){return{rr_type:"HTMLImageElement",src:e.toDataURL()}}if(e instanceof ImageData){return{rr_type:e.constructor.name,args:[Gn(e.data,t,n),e.width,e.height]}}if(Yn(e,t)||"object"==typeof e){return{rr_type:e.constructor.name,index:$n(e,t,n)}}return e}const Xn=(e,t,n)=>e.map((e=>Gn(e,t,n))),Yn=(e,t)=>{const n=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter((e=>"function"==typeof t[e]));return Boolean(n.find((n=>e instanceof t[n])))};function Qn(e,t,n,r){const i=[];try{const o=Wt(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(i,...o){if(!Yt(this,t,n,!0)){const e=function(e){return"experimental-webgl"===e?"webgl":e}(i);if("__context"in this||(this.__context=e),r&&["webgl","webgl2"].includes(e))if(o[0]&&"object"==typeof o[0]){const e=o[0];e.preserveDrawingBuffer||(e.preserveDrawingBuffer=!0)}else o.splice(0,1,{preserveDrawingBuffer:!0})}return e.apply(this,[i,...o])}}));i.push(o)}catch(e){}return()=>{i.forEach((e=>e()))}}function Jn(e,t,n,r,i,o,a){const s=[],u=Object.getOwnPropertyNames(e);for(const o of u)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(o))try{if("function"!=typeof e[o])continue;const u=Wt(e,o,(function(e){return function(...s){const u=e.apply(this,s);if($n(u,a,this),"tagName"in this.canvas&&!Yt(this.canvas,r,i,!0)){const e=Xn(s,a,this),r={type:t,property:o,args:e};n(this.canvas,r)}return u}}));s.push(u)}catch(r){const i=zt(e,o,{set(e){n(this.canvas,{type:t,property:o,args:[e],setter:!0})}});s.push(i)}return s}var Zn,er,tr,nr=(Zn=function(){!function(){function e(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n="undefined"==typeof Uint8Array?[]:new Uint8Array(256),r=0;r<64;r++)n[t.charCodeAt(r)]=r;var i=function(e){var n,r=new Uint8Array(e),i=r.length,o="";for(n=0;n<i;n+=3)o+=t[r[n]>>2],o+=t[(3&r[n])<<4|r[n+1]>>4],o+=t[(15&r[n+1])<<2|r[n+2]>>6],o+=t[63&r[n+2]];return i%3==2?o=o.substring(0,o.length-1)+"=":i%3==1&&(o=o.substring(0,o.length-2)+"=="),o};const o=new Map,a=new Map,s=self;s.onmessage=function(t){return e(this,void 0,void 0,(function*(){if(!("OffscreenCanvas"in globalThis))return s.postMessage({id:t.data.id});{const{id:n,bitmap:r,width:u,height:c,dataURLOptions:l}=t.data,d=function(t,n,r){return e(this,void 0,void 0,(function*(){const e=`${t}-${n}`;if("OffscreenCanvas"in globalThis){if(a.has(e))return a.get(e);const o=new OffscreenCanvas(t,n);o.getContext("2d");const s=yield o.convertToBlob(r),u=yield s.arrayBuffer(),c=i(u);return a.set(e,c),c}return""}))}(u,c,l),h=new OffscreenCanvas(u,c);h.getContext("2d").drawImage(r,0,0),r.close();const f=yield h.convertToBlob(l),p=f.type,m=yield f.arrayBuffer(),y=i(m);if(!o.has(n)&&(yield d)===y)return o.set(n,y),s.postMessage({id:n});if(o.get(n)===y)return s.postMessage({id:n});s.postMessage({id:n,type:p,base64:y,width:u,height:c}),o.set(n,y)}}))}}()},er=null,function(e){return tr=tr||function(e,t){var n=function(e,t){var n=void 0===t?null:t,r=e.toString().split("\n");r.pop(),r.shift();for(var i=r[0].search(/\S/),o=/(['"])__worker_loader_strict__(['"])/g,a=0,s=r.length;a<s;++a)r[a]=r[a].substring(i).replace(o,"$1use strict$2")+"\n";return n&&r.push("//# sourceMappingURL="+n+"\n"),r}(e,t),r=new Blob(n,{type:"application/javascript"});return URL.createObjectURL(r)}(Zn,er),new Worker(tr,e)});class rr{reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(e,t)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)};const{sampling:t="all",win:n,blockClass:r,blockSelector:i,recordCanvas:o,dataURLOptions:a}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&"all"===t&&this.initCanvasMutationObserver(n,r,i),o&&"number"==typeof t&&this.initCanvasFPSObserver(t,n,r,i,{dataURLOptions:a})}initCanvasFPSObserver(e,t,n,r,i){const o=Qn(t,n,r,!0),a=new Map,s=new nr;s.onmessage=e=>{const{id:t}=e.data;if(a.set(t,!1),!("base64"in e.data))return;const{base64:n,type:r,width:i,height:o}=e.data;this.mutationCb({id:t,type:hn["2D"],commands:[{property:"clearRect",args:[0,0,i,o]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:r}]},0,0]}]})};const u=1e3/e;let c,l=0;const d=e=>{l&&e-l<u||(l=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach((t=>{Yt(t,n,r,!0)||e.push(t)})),e})().forEach((e=>Un(this,void 0,void 0,(function*(){var t;const n=this.mirror.getId(e);if(a.get(n))return;if(a.set(n,!0),["webgl","webgl2"].includes(e.__context)){const n=e.getContext(e.__context);!1===(null===(t=null==n?void 0:n.getContextAttributes())||void 0===t?void 0:t.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}const r=yield createImageBitmap(e);s.postMessage({id:n,bitmap:r,width:e.width,height:e.height,dataURLOptions:i.dataURLOptions},[r])}))))),c=requestAnimationFrame(d)};c=requestAnimationFrame(d),this.resetObservers=()=>{o(),cancelAnimationFrame(c)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const r=Qn(e,t,n,!1),i=function(e,t,n,r){const i=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const a of o)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[a])continue;const o=Wt(t.CanvasRenderingContext2D.prototype,a,(function(i){return function(...o){return Yt(this.canvas,n,r,!0)||setTimeout((()=>{const n=Xn(o,t,this);e(this.canvas,{type:hn["2D"],property:a,args:n})}),0),i.apply(this,o)}}));i.push(o)}catch(n){const r=zt(t.CanvasRenderingContext2D.prototype,a,{set(t){e(this.canvas,{type:hn["2D"],property:a,args:[t],setter:!0})}});i.push(r)}return()=>{i.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n),o=function(e,t,n,r){const i=[];return i.push(...Jn(t.WebGLRenderingContext.prototype,hn.WebGL,e,n,r,0,t)),void 0!==t.WebGL2RenderingContext&&i.push(...Jn(t.WebGL2RenderingContext.prototype,hn.WebGL2,e,n,r,0,t)),()=>{i.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n,this.mirror);this.resetObservers=()=>{r(),i(),o()}}startPendingCanvasMutationFlusher(){requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((e,t)=>{const n=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,n)})),requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(e);if(!n||-1===t)return;const r=n.map((e=>{const t=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["type"]);return t})),{type:i}=n[0];this.mutationCb({id:t,type:i,commands:r}),this.pendingCanvasMutations.delete(e)}}class ir{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new rn,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const n={id:t,styleIds:[]},r=[];for(const t of e){let e;this.styleMirror.has(t)?e=this.styleMirror.getId(t):(e=this.styleMirror.add(t),r.push({styleId:e,rules:Array.from(t.rules||CSSRule,((e,t)=>({rule:ct(e),index:t})))})),n.styleIds.push(e)}r.length>0&&(n.styles=r),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class or{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame((()=>{this.clear(),this.loop&&this.periodicallyClear()}))}inOtherBuffer(e,t){const n=this.nodeMap.get(e);return n&&Array.from(n).some((e=>e!==t))}add(e,t){this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}function ar(e){return Object.assign(Object.assign({},e),{timestamp:Ht()})}let sr,ur,cr,lr=!1;const dr=new lt;function hr(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:i="rr-block",blockSelector:o=null,ignoreClass:a="rr-ignore",ignoreSelector:s=null,maskTextClass:u="rr-mask",maskTextSelector:c=null,inlineStylesheet:l=!0,maskAllInputs:d,maskInputOptions:h,slimDOMOptions:f,maskInputFn:p,maskTextFn:m,hooks:y,packFn:v,sampling:g={},dataURLOptions:b={},mousemoveWait:w,recordDOM:S=!0,recordCanvas:k=!1,recordCrossOriginIframes:I=!1,recordAfter:x=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:_=!1,collectFonts:C=!1,inlineImages:E=!1,plugins:O,keepIframeSrcFn:M=()=>!1,ignoreCSSAttributes:T=new Set([]),errorHandler:R}=e;In(R);const D=!I||window.parent===window;let N=!1;if(!D)try{window.parent.document&&(N=!1)}catch(e){N=!0}if(D&&!t)throw new Error("emit function is required");void 0!==w&&void 0===g.mousemove&&(g.mousemove=w),dr.reset();const A=!0===d?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==h?h:{password:!0},L=!0===f||"all"===f?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===f,headMetaDescKeywords:"all"===f}:f||{};let P;!function(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=(...e)=>{let t=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do{if(this===t)return!0}while(t=t&&t.parentNode);return!1})}();let F=0;const j=e=>{for(const t of O||[])t.eventProcessor&&(e=t.eventProcessor(e));return v&&!N&&(e=v(e)),e};sr=(e,i)=>{var o;if(!(null===(o=Cn[0])||void 0===o?void 0:o.isFrozen())||e.type===un.FullSnapshot||e.type===un.IncrementalSnapshot&&e.data.source===cn.Mutation||Cn.forEach((e=>e.unfreeze())),D)null==t||t(j(e),i);else if(N){const t={type:"rrweb",event:j(e),origin:window.location.origin,isCheckout:i};window.parent.postMessage(t,"*")}if(e.type===un.FullSnapshot)P=e,F=0;else if(e.type===un.IncrementalSnapshot){if(e.data.source===cn.Mutation&&e.data.isAttachIframe)return;F++;const t=r&&F>=r,i=n&&e.timestamp-P.timestamp>n;(t||i)&&ur(!0)}};const B=e=>{sr(ar({type:un.IncrementalSnapshot,data:Object.assign({source:cn.Mutation},e)}))},q=e=>sr(ar({type:un.IncrementalSnapshot,data:Object.assign({source:cn.Scroll},e)})),K=e=>sr(ar({type:un.IncrementalSnapshot,data:Object.assign({source:cn.CanvasMutation},e)})),U=new ir({mutationCb:B,adoptedStyleSheetCb:e=>sr(ar({type:un.IncrementalSnapshot,data:Object.assign({source:cn.AdoptedStyleSheet},e)}))}),z=new qn({mirror:dr,mutationCb:B,stylesheetManager:U,recordCrossOriginIframes:I,wrappedEmit:sr});for(const e of O||[])e.getMirror&&e.getMirror({nodeMirror:dr,crossOriginIframeMirror:z.crossOriginIframeMirror,crossOriginIframeStyleMirror:z.crossOriginIframeStyleMirror});const W=new or;cr=new rr({recordCanvas:k,mutationCb:K,win:window,blockClass:i,blockSelector:o,mirror:dr,sampling:g.canvas,dataURLOptions:b});const H=new Kn({mutationCb:B,scrollCb:q,bypassOptions:{blockClass:i,blockSelector:o,maskTextClass:u,maskTextSelector:c,inlineStylesheet:l,maskInputOptions:A,dataURLOptions:b,maskTextFn:m,maskInputFn:p,recordCanvas:k,inlineImages:E,sampling:g,slimDOMOptions:L,iframeManager:z,stylesheetManager:U,canvasManager:cr,keepIframeSrcFn:M,processedNodeManager:W},mirror:dr});ur=(e=!1)=>{if(!S)return;sr(ar({type:un.Meta,data:{href:window.location.href,width:Gt(),height:$t()}}),e),U.reset(),H.init(),Cn.forEach((e=>e.lock()));const t=function(e,t){const{mirror:n=new lt,blockClass:r="rr-block",blockSelector:i=null,maskTextClass:o="rr-mask",maskTextSelector:a=null,inlineStylesheet:s=!0,inlineImages:u=!1,recordCanvas:c=!1,maskAllInputs:l=!1,maskTextFn:d,maskInputFn:h,slimDOM:f=!1,dataURLOptions:p,preserveWhiteSpace:m,onSerialize:y,onIframeLoad:v,iframeLoadTimeout:g,onStylesheetLoad:b,stylesheetLoadTimeout:w,keepIframeSrcFn:S=()=>!1}=t||{};return Ft(e,{doc:e,mirror:n,blockClass:r,blockSelector:i,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:s,maskInputOptions:!0===l?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===l?{password:!0}:l,maskTextFn:d,maskInputFn:h,slimDOMOptions:!0===f||"all"===f?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===f,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===f?{}:f,dataURLOptions:p,inlineImages:u,recordCanvas:c,preserveWhiteSpace:m,onSerialize:y,onIframeLoad:v,iframeLoadTimeout:g,onStylesheetLoad:b,stylesheetLoadTimeout:w,keepIframeSrcFn:S,newlyAddedElement:!1})}(document,{mirror:dr,blockClass:i,blockSelector:o,maskTextClass:u,maskTextSelector:c,inlineStylesheet:l,maskAllInputs:A,maskTextFn:m,slimDOM:L,dataURLOptions:b,recordCanvas:k,inlineImages:E,onSerialize:e=>{en(e,dr)&&z.addIframe(e),tn(e,dr)&&U.trackLinkElement(e),nn(e)&&H.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,t)=>{z.attachIframe(e,t),H.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{U.attachLinkElement(e,t)},keepIframeSrcFn:M});t&&(sr(ar({type:un.FullSnapshot,data:{node:t,initialOffset:Vt(window)}}),e),Cn.forEach((e=>e.unlock())),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&U.adoptStyleSheets(document.adoptedStyleSheets,dr.getId(document)))};try{const e=[],t=e=>{var t;return _n(Pn)({mutationCb:B,mousemoveCb:(e,t)=>sr(ar({type:un.IncrementalSnapshot,data:{source:t,positions:e}})),mouseInteractionCb:e=>sr(ar({type:un.IncrementalSnapshot,data:Object.assign({source:cn.MouseInteraction},e)})),scrollCb:q,viewportResizeCb:e=>sr(ar({type:un.IncrementalSnapshot,data:Object.assign({source:cn.ViewportResize},e)})),inputCb:e=>sr(ar({type:un.IncrementalSnapshot,data:Object.assign({source:cn.Input},e)})),mediaInteractionCb:e=>sr(ar({type:un.IncrementalSnapshot,data:Object.assign({source:cn.MediaInteraction},e)})),styleSheetRuleCb:e=>sr(ar({type:un.IncrementalSnapshot,data:Object.assign({source:cn.StyleSheetRule},e)})),styleDeclarationCb:e=>sr(ar({type:un.IncrementalSnapshot,data:Object.assign({source:cn.StyleDeclaration},e)})),canvasMutationCb:K,fontCb:e=>sr(ar({type:un.IncrementalSnapshot,data:Object.assign({source:cn.Font},e)})),selectionCb:e=>{sr(ar({type:un.IncrementalSnapshot,data:Object.assign({source:cn.Selection},e)}))},customElementCb:e=>{sr(ar({type:un.IncrementalSnapshot,data:Object.assign({source:cn.CustomElement},e)}))},blockClass:i,ignoreClass:a,ignoreSelector:s,maskTextClass:u,maskTextSelector:c,maskInputOptions:A,inlineStylesheet:l,sampling:g,recordDOM:S,recordCanvas:k,inlineImages:E,userTriggeredOnInput:_,collectFonts:C,doc:e,maskInputFn:p,maskTextFn:m,keepIframeSrcFn:M,blockSelector:o,slimDOMOptions:L,dataURLOptions:b,mirror:dr,iframeManager:z,stylesheetManager:U,shadowDomManager:H,processedNodeManager:W,canvasManager:cr,ignoreCSSAttributes:T,plugins:(null===(t=null==O?void 0:O.filter((e=>e.observer)))||void 0===t?void 0:t.map((e=>({observer:e.observer,options:e.options,callback:t=>sr(ar({type:un.Plugin,data:{plugin:e.name,payload:t}}))}))))||[]},y)};z.addLoadListener((n=>{try{e.push(t(n.test))}catch(e){}}));const n=()=>{ur(),e.push(t(document)),lr=!0};return"interactive"===document.readyState||"complete"===document.readyState?n():(e.push(qt("DOMContentLoaded",(()=>{sr(ar({type:un.DomContentLoaded,data:{}})),"DOMContentLoaded"===x&&n()}))),e.push(qt("load",(()=>{sr(ar({type:un.Load,data:{}})),"load"===x&&n()}),window))),()=>{e.forEach((e=>e())),W.destroy(),lr=!1,xn()}}catch(e){}}hr.addCustomEvent=(e,t)=>{if(!lr)throw new Error("please add custom event after start recording");sr(ar({type:un.Custom,data:{tag:e,payload:t}}))},hr.freezePage=()=>{Cn.forEach((e=>e.freeze()))},hr.takeFullSnapshot=e=>{if(!lr)throw new Error("please take full snapshot after start recording");ur(e)},hr.mirror=dr;var fr=n(7753);const pr=Symbol.for("Dexie"),mr=globalThis[pr]||(globalThis[pr]=fr);if(fr.semVer!==mr.semVer)throw new Error(`Two different versions of Dexie loaded in the same app: ${fr.semVer} and ${mr.semVer}`);const{liveQuery:yr,mergeRanges:vr,rangesOverlap:gr,RangeSet:br,cmp:wr,Entity:Sr,PropModification:kr,replacePrefix:Ir,add:xr,remove:_r}=mr;var Cr=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))};class Er{constructor(e){this.batchQueue=[],this.rewindBatchQueue=[],this.processingBatch=!1,this.processingRewindBatch=!1,this.BATCH_SIZE=15,this.BATCH_INTERVAL=2e3,this.lastBatch=0,this.requests=new Map,this.CLEAN_UP_INTERVAL=3e4,this.lastCleanup=0,this.isDestroyed=!1,this.minutesToKeepData=15,this.dbInitialized=!1,this.dbInitPromise=null,this.isInitializedForRecordingLink=!1,this.__init(e)}__init(e){if(Er._instance)return Er._instance;Er._instance=this,this.isDestroyed=!1,this.initDB().catch((e=>{})),this.isInitializedForRecordingLink=e.isInitializedForRecordingLink||!1,this.batchQueue=[],this.rewindBatchQueue=[],this.processingBatch=!1,this.processingRewindBatch=!1,this.BATCH_SIZE=15,this.BATCH_INTERVAL=2e3,this.CLEAN_UP_INTERVAL=3e4,this.startPeriodicBatchProcess(),this.minutesToKeepData=e.maxRecordingMinutes||15,window.addEventListener("load",(()=>{this.createIframe()}))}createIframe(){var e;if(this.iframeRef=null===document||void 0===document?void 0:document.getElementById(t),!this.iframeRef){this.iframeRef=document.createElement("iframe");const n="https://recording.betterbugs.io/message-listener";if(!n)return void l.error("MESSAGE_LISTENER_URL is not defined");try{const e=new URL(n);e.searchParams.set("targetURL",window.location.origin),this.iframeRef.src=e.toString()}catch(e){l.error("Invalid MESSAGE_LISTENER_URL:",e),this.iframeRef.src=n}this.iframeRef.classList.add(t),this.iframeRef.id=t,this.iframeRef.hidden=!0,null===(e=null===document||void 0===document?void 0:document.body)||void 0===e||e.append(this.iframeRef)}}sendMessageToIframe(e){var n,r;return Cr(this,void 0,void 0,(function*(){if("hidden"===document.visibilityState)return;const i="https://recording.betterbugs.io/message-listener";let o;try{o=new URL(i).origin}catch(e){return void l.error("Invalid MESSAGE_LISTENER_URL:",e)}if(document.getElementById(t))try{null===(n=this.iframeRef)||void 0===n||n.contentWindow.postMessage({type:"application",data:e,timestamp:Date.now()},o),null===(r=this.iframeRef)||void 0===r||r.contentWindow.postMessage({type:"urlInfo",domain:window.location.hostname,pageTitle:document.title,url:window.location.href},o)}catch(e){l.log(e)}}))}cleanUpdata(){return Cr(this,void 0,void 0,(function*(){const e=Date.now();if(e-parseInt(localStorage.getItem("lastCleanup")||"0")>=this.CLEAN_UP_INTERVAL){const t=60*this.minutesToKeepData*1e3;this.deleteRewindDataOnTabReload(t),yield this.db.logs.where("timestamp").between(0,Date.now()-t,!0,!0).delete(),localStorage.setItem("lastCleanup",e.toString())}}))}deleteRewindDataOnTabReload(e){return Cr(this,void 0,void 0,(function*(){try{return yield this.db.rewind.where("timestamp").between(0,Date.now()-e,!0,!0).delete(),!0}catch(e){return l.log("🚀 ~ deleteRewindDataOnTabReload ~ error:",e),!1}}))}startPeriodicBatchProcess(){this.interval=setInterval((()=>{var e;this.batchQueue.length>0&&this.processBatch(),(null===(e=this.rewindBatchQueue)||void 0===e?void 0:e.length)>0&&this.processRewindBatch(),this.cleanUpdata()}),this.BATCH_INTERVAL)}initDB(){return Cr(this,void 0,void 0,(function*(){return this.dbInitPromise||(this.dbInitPromise=new Promise(((e,t)=>{try{const n=parseInt("1");this.db=new mr("logger-DB"),this.db.version(n).stores({logs:"++id,tabId,timestamp,type,recordingIds,[tabId+timestamp]",rewind:"++id,tabId,timestamp,[tabId+timestamp]"}),this.db.open().then((()=>{this.dbInitialized=!0,l.log("Database initialized successfully"),e()})).catch((e=>{t(e)}))}catch(e){t(e)}}))),this.dbInitPromise}))}addToBatch(e){var n;return Cr(this,void 0,void 0,(function*(){try{this.iframeRef||this.createIframe();const r="https://recording.betterbugs.io/message-listener";if(!r)return void l.error("MESSAGE_LISTENER_URL is not defined");let i;try{i=new URL(r).origin}catch(e){return void l.error("Invalid MESSAGE_LISTENER_URL:",e)}if(this.iframeRef&&document.getElementById(t)&&"visible"===document.visibilityState&&(null===(n=this.iframeRef)||void 0===n?void 0:n.contentWindow))try{this.iframeRef.contentWindow.postMessage(e,i)}catch(e){l.log(e)}this.batchQueue.push(Object.assign({},e)),this.batchQueue.length>=this.BATCH_SIZE&&(yield this.processBatch())}catch(e){l.error("Error in addToBatch:",e)}}))}addRewindDataToBatch(e){return Cr(this,void 0,void 0,(function*(){this.rewindBatchQueue.push(e),this.rewindBatchQueue.length>=this.BATCH_SIZE&&(yield this.processRewindBatch())}))}processRewindBatch(){var e,t,n,r,i,o;return Cr(this,void 0,void 0,(function*(){if(this.processingRewindBatch||0===this.rewindBatchQueue.length)return;let a=[];try{this.processingRewindBatch=!0,a=this.rewindBatchQueue.splice(0,this.BATCH_SIZE);const n=a.filter((e=>!!e)).map((e=>Object.assign(Object.assign({},e),{event:this.sanitizeForIndexedDB(e.event),events:Array.isArray(e.events)?e.events.map((e=>this.sanitizeForIndexedDB(e))):e.events})));yield null===(t=null===(e=null==this?void 0:this.db)||void 0===e?void 0:e.rewind)||void 0===t?void 0:t.bulkAdd(n)}catch(e){l.error("Error processing rewind batch:",e);for(const e of a)try{const t=Object.assign(Object.assign({},e),{event:this.sanitizeForIndexedDB(e.event),events:Array.isArray(e.events)?e.events.map((e=>this.sanitizeForIndexedDB(e))):e.events});yield null===(r=null===(n=null==this?void 0:this.db)||void 0===n?void 0:n.rewind)||void 0===r?void 0:r.put(t)}catch(t){l.error("Failed to save individual rewind log:",t,e);const n=t;if("DataCloneError"===n.name||"ConstraintError"===n.name)try{const t={id:e.id||Date.now().toString(),type:"rewind",timestamp:e.timestamp||Date.now(),tabId:e.tabId||rt(),createdAt:e.createdAt||(new Date).toISOString(),event:{error:"Original rewind data could not be stored",errorType:n.name,originalEventType:typeof e.event}};yield null===(o=null===(i=null==this?void 0:this.db)||void 0===i?void 0:i.rewind)||void 0===o?void 0:o.put(t)}catch(e){l.error("Failed to save even minimal rewind log version:",e)}}}finally{this.processingRewindBatch=!1}}))}sanitizeForIndexedDB(e){try{return JSON.parse(JSON.stringify(e))}catch(t){return l.error("Failed to sanitize data for IndexedDB:",t),{error:"Data sanitization failed",originalType:typeof e,timestamp:Date.now()}}}processBatch(){var e,t,n,r,i,o;return Cr(this,void 0,void 0,(function*(){if(this.processingBatch||0===this.batchQueue.length)return;let a=[];try{this.processingBatch=!0,a=this.batchQueue.splice(0,this.BATCH_SIZE);const n=a.filter((e=>!!e)).map((e=>Object.assign(Object.assign({},e),{data:this.sanitizeForIndexedDB(e.data)})));yield null===(t=null===(e=null==this?void 0:this.db)||void 0===e?void 0:e.logs)||void 0===t?void 0:t.bulkAdd(n)}catch(e){l.error("Error processing batch:",e);for(const e of a)try{const t=Object.assign(Object.assign({},e),{data:this.sanitizeForIndexedDB(e.data)});yield null===(r=null===(n=null==this?void 0:this.db)||void 0===n?void 0:n.logs)||void 0===r?void 0:r.put(t)}catch(t){l.error("Failed to save individual log:",t,e);const n=t;if("DataCloneError"===n.name||"ConstraintError"===n.name)try{const t={type:e.type||"unknown",timestamp:e.timestamp||0,tabId:e.tabId||rt(),data:{error:"Original data could not be stored",errorType:n.name,originalDataType:typeof e.data}};yield null===(o=null===(i=null==this?void 0:this.db)||void 0===i?void 0:i.logs)||void 0===o?void 0:o.put(t)}catch(e){l.error("Failed to save even minimal log version:",e)}}}finally{this.processingBatch=!1}}))}saveNetworkRequest(e){var t;return Cr(this,void 0,void 0,(function*(){if(!e)return;const n=JSON.parse(localStorage.getItem("recordingStatuses")||"[]")||[],r=null===(t=null==n?void 0:n.filter((e=>e.currentlyRecording)))||void 0===t?void 0:t.map((e=>e.id));if(!this.isInitializedForRecordingLink||(null==r?void 0:r.length))try{yield this.addToBatch({type:"network",timestamp:e.timestamp||Date.now(),data:e,recordingIds:r,tabId:rt()})}catch(e){l.error("Error handling network response:",e)}}))}saveConsoleLog(e){var t;return Cr(this,void 0,void 0,(function*(){if(e)try{const n=JSON.parse(localStorage.getItem("recordingStatuses")||"[]")||[],r=null===(t=null==n?void 0:n.filter((e=>e.currentlyRecording)))||void 0===t?void 0:t.map((e=>e.id));if(this.isInitializedForRecordingLink&&!(null==r?void 0:r.length))return;yield this.addToBatch({type:"console",timestamp:e.timestamp||0,data:e,recordingIds:r,tabId:rt()})}catch(e){l.error("Error handling console logs",e)}}))}saveSteps(e){var t;return Cr(this,void 0,void 0,(function*(){if(e)try{const n=JSON.parse(localStorage.getItem("recordingStatuses")||"[]")||[],r=null===(t=null==n?void 0:n.filter((e=>e.currentlyRecording)))||void 0===t?void 0:t.map((e=>e.id));if(this.isInitializedForRecordingLink&&!(null==r?void 0:r.length))return;yield this.addToBatch({type:"step",timestamp:e.timestamp?Number(e.timestamp):0,data:e,tabId:rt(),recordingIds:r})}catch(e){l.error("Error handling steps data",e)}}))}saveApplicationData(e){var t;return Cr(this,void 0,void 0,(function*(){if(e)try{const n=JSON.parse(localStorage.getItem("recordingStatuses")||"[]")||[],r=null===(t=null==n?void 0:n.filter((e=>e.currentlyRecording)))||void 0===t?void 0:t.map((e=>e.id));if(this.isInitializedForRecordingLink&&!(null==r?void 0:r.length))return;yield this.addToBatch({type:"application",timestamp:e.timestamp||Date.now(),data:e.data,tabId:rt(),recordingIds:r})}catch(e){l.error("Error handling steps data",e)}}))}saveRewindData(e){return Cr(this,void 0,void 0,(function*(){if(e)try{yield this.addRewindDataToBatch(Object.assign(Object.assign({},e),{type:"rewind",tabId:rt()}))}catch(e){l.error("Error handling rewind data",e)}}))}handleSuspend(){return Cr(this,void 0,void 0,(function*(){l.log("Extension suspending, performing cleanup..."),yield this.destroy()}))}destroy(){var e;return Cr(this,void 0,void 0,(function*(){this.isDestroyed||(this.isDestroyed=!0,clearInterval(this.interval),yield this.processBatch(),yield this.processRewindBatch(),yield null===(e=null==this?void 0:this.db)||void 0===e?void 0:e.close())}))}getLogsByStackTrace(e,t=!1,n=!1){return Cr(this,void 0,void 0,(function*(){const r=this.batchQueue,i=yield this.queryLogs(e,!1,t,n);l.log("logs",i);const o=e.reduce(((e,t)=>({startTime:Math.min(e.startTime,t.startTime||0),endTime:Math.max(e.endTime,t.endTime||Date.now())})),{startTime:1/0,endTime:-1/0});return[...i,...(null==r?void 0:r.filter((e=>e.timestamp>o.startTime&&e.timestamp<o.endTime)))||[]]}))}queryLogs(e,t=!1,n=!1,r=!1){var i,o,a,s,u,c,d,h,f;return Cr(this,void 0,void 0,(function*(){if(this.dbInitialized||(yield this.initDB()),!e||0===e.length)return[];l.log("Database state:",{dbExists:!!this.db,isDestroyed:this.isDestroyed,dbVersion:null===(i=this.db)||void 0===i?void 0:i.verno,hasLogsTable:!!(null===(o=this.db)||void 0===o?void 0:o.logs),isInitialized:this.dbInitialized}),l.log("stackTrace",e,t,n);const p=e.reduce(((e,t)=>({startTime:Math.min(e.startTime,t.startTime||0),endTime:Math.max(e.endTime,t.endTime||Date.now())})),{startTime:1/0,endTime:-1/0});l.log("timeRange",p,r,t),n&&(p.startTime-=12e4);try{if(t)return yield null===(a=null==this?void 0:this.db)||void 0===a?void 0:a.rewind.where(["tabId","timestamp"]).between([rt(),p.startTime],[rt(),p.endTime],!0,!0).toArray();if(r){l.log("isFromRecordingLink",r),l.log("this?.db?.logs",null===(s=null==this?void 0:this.db)||void 0===s?void 0:s.logs,this.db);let t=null===(u=null==this?void 0:this.db)||void 0===u?void 0:u.logs.where("timestamp").between(p.startTime,p.endTime,!0,!0);l.log("isFromRecordingLink2",r),(null===(c=e[0])||void 0===c?void 0:c.type)&&(t=t.filter((t=>t.type===e[0].type))),l.log("isFromRecordingLink3",r),(null===(d=e[0])||void 0===d?void 0:d.recordingId)&&(t=t.filter((t=>{var n;return!!(null===(n=t.recordingIds)||void 0===n?void 0:n.length)&&t.recordingIds.includes(e[0].recordingId||"")}))),l.log("isFromRecordingLink4",r),l.log("datdshgdjh dayusgd uasygada");const n=yield t.reverse().toArray();return l.log("datdshgdjhada",n),n}{const t=(null===(h=e[0])||void 0===h?void 0:h.type)?t=>t.type===e[0].type:()=>!0;return yield null===(f=null==this?void 0:this.db)||void 0===f?void 0:f.logs.where(["tabId","timestamp"]).between([rt(),p.startTime],[rt(),p.endTime],!0,!0).filter(t).reverse().toArray()}}catch(e){return l.log(e),l.error("Error querying logs:",e),[]}}))}}Er._instance=null;var Or=Er,Mr=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))};const Tr=[8,9,13,16,17,18,19,20,27,33,32,34,35,36,37,38,39,40,45,46],Rr=/(^|@)\S+:\d+/,Dr=/^\s*at .*(\S+:\d+|\(native\))/m,Nr=/^(eval@)?(\[native code])?$/;class Ar{constructor(e){this.fileName=e.fileName||"",this.functionName=e.functionName||"",this.lineNumber=e.lineNumber,this.columnNumber=e.columnNumber}toString(){const e=this.lineNumber||"",t=this.columnNumber||"";return this.functionName?this.functionName+" ("+this.fileName+":"+e+":"+t+")":this.fileName+":"+e+":"+t}}const Lr={parse:function(e){if(!e)return[];if(void 0!==e.stacktrace||void 0!==e["opera#sourceloc"])return this.parseOpera(e);if(e.stack&&e.stack.match(Dr))return this.parseV8OrIE(e);if(e.stack)return this.parseFFOrSafari(e);throw new Error("Cannot parse given Error object")},extractLocation:function(e){if(-1===e.indexOf(":"))return[e,void 0,void 0];const t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!t)throw new Error(`Cannot parse given url: ${e}`);return[t[1],t[2]?parseInt(t[2]):void 0,t[3]?parseInt(t[3]):void 0]},parseV8OrIE:function(e){return e.stack.split("\n").filter((function(e){return!!e.match(Dr)}),this).map((function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let t=e.replace(/^\s+/,"").replace(/\(eval code/g,"(");const n=t.match(/ (\((.+):(\d+):(\d+)\)$)/);t=n?t.replace(n[0],""):t;const r=t.split(/\s+/).slice(1),i=this.extractLocation(n?n[1]:r.pop()),o=r.join(" ")||void 0,a=["eval","<anonymous>"].indexOf(i[0])>-1?void 0:i[0];return new Ar({functionName:o,fileName:a,lineNumber:i[1],columnNumber:i[2]})}),this)},parseFFOrSafari:function(e){return e.stack.split("\n").filter((function(e){return!e.match(Nr)}),this).map((function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new Ar({functionName:e});{const t=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(t),r=n&&n[1]?n[1]:void 0,i=this.extractLocation(e.replace(t,""));return new Ar({functionName:r,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})}}),this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){const t=/Line (\d+).*script (?:in )?(\S+)/i,n=e.message.split("\n"),r=[];for(let e=2,i=n.length;e<i;e+=2){const i=t.exec(n[e]);i&&r.push(new Ar({fileName:i[2],lineNumber:parseFloat(i[1])}))}return r},parseOpera10:function(e){const t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=e.stacktrace.split("\n"),r=[];for(let e=0,i=n.length;e<i;e+=2){const i=t.exec(n[e]);i&&r.push(new Ar({functionName:i[3]||void 0,fileName:i[2],lineNumber:parseFloat(i[1])}))}return r},parseOpera11:function(e){return e.stack.split("\n").filter((function(e){return!!e.match(Rr)&&!e.match(/^Error created at/)}),this).map((function(e){const t=e.split("@"),n=this.extractLocation(t.pop()),r=(t.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new Ar({functionName:r,fileName:n[0],lineNumber:n[1],columnNumber:n[2]})}),this)}};class Pr{constructor(t){this.handleKeyUpEvent=t=>{var n,r;(null===document||void 0===document?void 0:document.getElementById(e))&&(null===(n=null===document||void 0===document?void 0:document.getElementById(e))||void 0===n?void 0:n.contains(document.activeElement))||(null==Tr?void 0:Tr.includes(t.keyCode))&&this.onSteps({id:tt(),eventType:a,eventData:32!==t.keyCode?t.key:t.keyCode.toString(),count:0,eventElement:nt((null===(r=document.activeElement)||void 0===r?void 0:r.outerHTML)||"",200),url:window.location.href,timestamp:Date.now(),createdAt:(new Date).toDateString()})},window.stopRRweb=void 0,this.dbLogger=new Or({maxRecordingMinutes:t.maxRecordingMinutes,isInitializedForRecordingLink:t.isInitializedForRecordingLink}),this.isInitializedForRecordingLink=t.isInitializedForRecordingLink,this.maxRecordingMinutes=t.maxRecordingMinutes,window.addEventListener("visibilitychange",(()=>Mr(this,void 0,void 0,(function*(){var e;if("visible"===document.visibilityState){const t=yield this.getApplicationData();this.updateRecordingStatuses(),null===(e=this.dbLogger)||void 0===e||e.sendMessageToIframe(t)}})))),(()=>{Mr(this,void 0,void 0,(function*(){var e;const t=yield this.getApplicationData();null===(e=this.dbLogger)||void 0===e||e.sendMessageToIframe(t),this.updateRecordingStatuses()}))})()}localStorageListener(){window.addEventListener("storage",(e=>{"recordingStatuses"===e.key&&this.updateRecordingStatuses()}))}updateRecordingStatuses(){var e;return Mr(this,void 0,void 0,(function*(){if(window.isRecordingTab)return;let t=JSON.parse(localStorage.getItem("recordingStatuses")||"[]")||[];t=et(t);const n=t.map((e=>((e=et(e)).currentlyRecording&&(e.domain=window.location.hostname,e.pageTitle=document.title,e.url=window.location.href),e)));localStorage.setItem("recordingStatuses",JSON.stringify(n));const r=yield this.getApplicationData();null===(e=this.dbLogger)||void 0===e||e.saveApplicationData({type:"application",data:r,timestamp:Date.now()})}))}static getInstance(e){return Pr.instance||(Pr.instance=new Pr({maxRecordingMinutes:e.maxRecordingMinutes,isInitializedForRecordingLink:e.isInitializedForRecordingLink})),Pr.instance}listenConsoleEvents(){if(window.location.href.includes("https://challenges.cloudflare.com"))return;let e;const t={},n=[],r=function(){},i=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"];e=[];const o={};let a;const s=new Set,u=function(){let t,i;try{i=function(){return r},window.console?(window.console.isToastLogConsole?(a=Object.assign({},window.console.toastLogOldConsole),delete window.console.toastLogOldConsole,delete window.console.isToastLogConsole,window.console=a):a=Object.assign({},window.console),t=function(t){let a;return t in console&&(a=console[t])&&(console[t]=function(...i){var u,c,l,d;let h,f,p;const m=null===(u=null==n?void 0:n.slice)||void 0===u?void 0:u.call(i,0);for(f=0,p=Math.min(o[t].handlers.length,10);f<p;f++)s.has(o[t].handlers[f])&&(null===(c=null==r?void 0:r.apply)||void 0===c||c.call(o[t].handlers[f],console,m));for(f=0,p=Math.min(e.length,10);f<p;f++)s.has(e[f])&&(h=[t],n.push.apply(h,m),null===(l=null==r?void 0:r.apply)||void 0===l||l.call(e[f],console,h));null===(d=null==r?void 0:r.apply)||void 0===d||d.call(a,console,m)}),console[t]||i}):t=i}catch(e){l.error(e)}return t}();!function(){let e,t,n;for(e=0,t=i.length;e<t;e++)n=i[e],o[n]={handlers:[]},"function"==typeof u&&u(n)}();const c=function(){e=[];for(const e in o)o[e].handlers=[];s.clear(),window.console=a};window.realConsoleListener=window.console,window.ConsoleListener={on:function(n,r){var i;try{let a,u;if("[object Object]"===(null===(i=t.toString)||void 0===i?void 0:i.call(n)))for(a in n)u=n[a],"all"===a?e.length<10&&(e.push(u),s.add(u)):a in o&&o[a].handlers.length<10&&(o[a].handlers.push(u),s.add(u));else"function"==typeof n?e.length<10&&(e.push(n),s.add(n)):n in o&&o[n].handlers.length<10&&(o[n].handlers.push(r),s.add(r))}catch(e){l.error(e)}},close:c};const d={};i.forEach((e=>{d[e]=(t,...n)=>{const r=Lr.parse(new Error(void 0));this.onConsoleEvent("custom",{type:e,extra:void 0,fileUrl:r,e:t,more:n})}})),window.ConsoleListener.on(d),window.addEventListener("unload",c),window.onerror=(e,t="",n,r,i)=>{const o={msg:e,url:t,lineNo:n,columnNo:r,error:i},a=new Ar({columnNumber:r,fileName:t,lineNumber:n});this.onConsoleEvent("custom",{type:"error",extra:o,e:o.msg,fileUrl:a})};const h=e=>{const t=Lr.parse(new Error("0"));let n,r;try{n=null==e?void 0:e.reason}catch(e){n=void 0}try{r=null==e?void 0:e.detail,!n&&r&&(n=null==r?void 0:r.reason)}catch(e){}n||(n="[unhandledrejection] error getting `reason` from event"),this.onConsoleEvent("custom",{type:"error",e:`Uncaught (in promise) ${n}`,fileUrl:t,extra:void 0})};window.addEventListener("unhandledrejection",h),window.addEventListener("unload",(()=>{window.removeEventListener("unhandledrejection",h)}))}ListenNetworkEvents(){const e=window.fetch,t=this,n=e=>{if(!e)return!1;const t=e.toLowerCase();return t.includes("application/json")||t.includes("text/")||t.includes("application/xml")||t.includes("application/x-www-form-urlencoded")};window.fetch=function(...r){var i;return Mr(this,void 0,void 0,(function*(){const o=Date.now(),a=r[0]instanceof Request?r[0]:new Request(r[0].toString(),r[1]),s=a.url;let u;try{if(!(null===(i=a.signal)||void 0===i?void 0:i.aborted)){const e=a.headers.get("content-type");n(e)&&(u=yield a.clone().text())}}catch(e){l.error("Error reading request body:",e)}return new Promise(((i,c)=>{e.apply(window,r).then((e=>Mr(this,void 0,void 0,(function*(){var r,c;try{if(e&&!(null===(r=a.signal)||void 0===r?void 0:r.aborted)){const r=e.clone(),i=e.headers.get("content-type"),d=a.method,h=Object.fromEntries(a.headers),f=Object.fromEntries(e.headers),p=Date.now();let m;try{n(i)&&(m=(null==i?void 0:i.toLowerCase().includes("json"))?JSON.stringify(yield r.json()):yield r.text())}catch(e){if(l.error("Error parsing response:",e),n(i))try{m=yield r.text()}catch(e){l.error("Error parsing response as text:",e)}}"true"===h["ignore-bb-capture"]||window.isRecordingTab||null===(c=t.dbLogger)||void 0===c||c.saveNetworkRequest({id:tt(),method:d,response:m,requestBody:u,requestHeaders:Object.entries(h).map((([e,t])=>({name:e,value:t}))),responseHeaders:Object.entries(f).map((([e,t])=>({name:e,value:t}))),url:s||e.url,statusCode:e.status,isError:e.status>=400,type:"xmlhttprequest",createdAt:(new Date).toDateString(),timestamp:Date.now(),startTime:o,endTime:p,initiator:window.location.origin})}}catch(e){l.error("Error processing fetch response:",e)}i(e)})))).catch((e=>{l.error("Fetch request failed:",e),c(e)}))}))}))},function(){const e=XMLHttpRequest.prototype,r=e.open,i=e.send,o=e.setRequestHeader;e.open=function(e,t){try{this._startTime=Date.now(),this._method=e,this._url=(e=>{try{return new URL(e,window.location.origin).toString()}catch(t){return l.error("Error getting absolute URL:",t),e}})(t),this._requestHeaders={}}catch(e){l.error("Error in XHR open:",e)}return r.apply(this,[e,t,!0,null,null])},e.setRequestHeader=function(e,t){try{this._requestHeaders&&(this._requestHeaders[e]=t)}catch(e){l.error("Error in XHR setRequestHeader:",e)}return o.apply(this,[e,t])},e.send=function(e){var r,o;try{const i=(null===(r=this._requestHeaders)||void 0===r?void 0:r["content-type"])||(null===(o=this._requestHeaders)||void 0===o?void 0:o["Content-Type"]);n(i||null)&&(this._requestBody=e),this.addEventListener("load",(function(){var e;try{const r=this._method||"GET",i=this._requestHeaders||{},o=this._url||this.responseURL,a=this.status,s=this._startTime||Date.now(),u=this.getAllResponseHeaders().split("\r\n").reduce(((e,t)=>{const[n,r]=t.split(": ");return n&&r&&(e[n]=r),e}),{}),c=Date.now(),l=this.getResponseHeader("content-type");let d;n(l)&&(d=this.response),"true"===i["ignore-bb-capture"]||window.isRecordingTab||null===(e=t.dbLogger)||void 0===e||e.saveNetworkRequest({id:tt(),method:r,response:d,requestBody:this._requestBody,requestHeaders:Object.entries(i).map((([e,t])=>({name:e,value:t}))),responseHeaders:Object.entries(u).map((([e,t])=>({name:e,value:t}))),url:o,isError:a>=400,statusCode:a,type:"xmlhttprequest",createdAt:(new Date).toDateString(),timestamp:Date.now(),startTime:s,endTime:c,initiator:window.location.origin})}catch(e){l.error("Error processing XHR response:",e)}}))}catch(e){l.error("Error in XHR send:",e)}return i.apply(this,[e])}}()}initializeRecording(t){try{window.stopRRweb&&window.stopRRweb(),window.stopRRweb=hr({emit:(e,n)=>{const r=et(e);switch(r.isCheckout=n,t&&this.onRRwebEvent(r),r.type){case un.IncrementalSnapshot:r.data.source===cn.MouseInteraction&&r.data.type===ln.Click?((e,t)=>{let n=null;return(...r)=>{n&&clearTimeout(n),n=setTimeout((()=>{e(...r)}),t)}})((e=>this.handleClickEvent(e)),100)(r):r.data.source===cn.Input&&this.handleInputEvent(r);break;case un.Meta&&!n:this.handleNavigationEvent(r)}},errorHandler:e=>(l.log("🚀 ~ error:",e),!0),recordCrossOriginIframes:!1,inlineStylesheet:!0,maskInputOptions:{email:!0,password:!0,number:!0,tel:!0},blockSelector:`#${e}`,maskTextSelector:'[data-betterbugs="ignore"]',slimDOMOptions:{comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0},checkoutEveryNms:2e3})}catch(e){l.log("error: ",e)}window.addEventListener("keyup",this.handleKeyUpEvent)}handleNavigationEvent(e){this.onSteps({id:tt(),eventType:i,eventData:e.data.href,eventElement:null,url:window.location.href,timestamp:Date.now(),createdAt:(new Date).toDateString()})}handleInputEvent(t){var n,r,i;(null===document||void 0===document?void 0:document.getElementById(e))&&(null===(n=null===document||void 0===document?void 0:document.getElementById(e))||void 0===n?void 0:n.contains(document.activeElement))||"BODY"===(null===(r=document.activeElement)||void 0===r?void 0:r.tagName)||this.onSteps({id:tt(),eventType:o,eventData:t.data.text,eventElement:nt((null===(i=null===document||void 0===document?void 0:document.activeElement)||void 0===i?void 0:i.outerHTML)||"",200),url:window.location.href,timestamp:Date.now(),createdAt:(new Date).toDateString()})}handleClickEvent(t){var n,i,o,a,s,u;(null===document||void 0===document?void 0:document.getElementById(e))&&(null===(n=null===document||void 0===document?void 0:document.getElementById(e))||void 0===n?void 0:n.contains(document.elementFromPoint(null===(i=null==t?void 0:t.data)||void 0===i?void 0:i.x,null===(o=null==t?void 0:t.data)||void 0===o?void 0:o.y)))||this.onSteps({id:tt(),eventType:r,eventData:(null===(a=document.elementFromPoint(t.data.x,t.data.y))||void 0===a?void 0:a.innerText)?null===(s=document.elementFromPoint(t.data.x,t.data.y))||void 0===s?void 0:s.innerText:"",eventElement:nt((null===(u=null===document||void 0===document?void 0:document.elementFromPoint(t.data.x,t.data.y))||void 0===u?void 0:u.outerHTML)||"",200),url:window.location.href,timestamp:Date.now(),createdAt:(new Date).toDateString()})}onConsoleEvent(e,t){var n,r,i;window.isRecordingTab||("rrweb"===e&&"data"in t?null===(n=this.dbLogger)||void 0===n||n.saveConsoleLog({id:tt(),args:null===(r=t.data.payload.payload)||void 0===r?void 0:r.map((e=>{try{return JSON.parse(e)}catch(t){return e}})),file:t.data.payload.trace,timestamp:Date.now(),url:window.location.href,type:t.data.payload.level,createdAt:(new Date).toDateString()}):"type"in t&&(null===(i=this.dbLogger)||void 0===i||i.saveConsoleLog({type:t.type,args:[t.e,...(null==t?void 0:t.more)||[]],timestamp:Date.now(),url:window.location.href,file:t.fileUrl,id:tt(),createdAt:(new Date).toDateString()})))}onRRwebEvent(e){var t;return Mr(this,void 0,void 0,(function*(){window.isRecordingTab||null===(t=this.dbLogger)||void 0===t||t.saveRewindData({id:tt(),event:e,createdAt:(new Date).toDateString(),timestamp:Date.now(),url:window.location.href})}))}onSteps(e){var t;return Mr(this,void 0,void 0,(function*(){window.isRecordingTab||null===(t=this.dbLogger)||void 0===t||t.saveSteps(e)}))}getApplicationData(){var e,t;return Mr(this,void 0,void 0,(function*(){if(window.isRecordingTab)return[];const n=[],r=null===window||void 0===window?void 0:window.localStorage,i=null===window||void 0===window?void 0:window.sessionStorage,o=document.cookie.split(";").map((e=>{const[t,n]=e.trim().split("=");return{args:{name:t,value:decodeURIComponent(n),domain:window.location.hostname,path:"/",secure:"https:"===window.location.protocol,httpOnly:!1,sameSite:"lax",hostOnly:!1,session:!0,storeId:"0",expirationDate:null},type:"cookie",url:window.location.href,timestamp:Date.now()}}));if(n.push(...o),r)for(const t in r)if(null===(e=Object.prototype.hasOwnProperty)||void 0===e?void 0:e.call(r,t)){const e=r[t];if("function"==typeof e)continue;const i={args:{key:t,value:e},type:"local",url:window.location.href,timestamp:Date.now()};n.push(i)}for(const e in i)if(null===(t=Object.prototype.hasOwnProperty)||void 0===t?void 0:t.call(i,e)){const t=i[e];if("function"==typeof t)continue;const r={args:{key:e,value:t},type:"session",url:window.location.href,timestamp:Date.now()};n.push(r)}return n}))}startRecording({captureRewindEvents:e=!0}){return Mr(this,void 0,void 0,(function*(){Pr.getInstance({maxRecordingMinutes:this.maxRecordingMinutes,isInitializedForRecordingLink:this.isInitializedForRecordingLink}).ListenNetworkEvents(),Pr.getInstance({maxRecordingMinutes:this.maxRecordingMinutes,isInitializedForRecordingLink:this.isInitializedForRecordingLink}).listenConsoleEvents(),Pr.getInstance({maxRecordingMinutes:this.maxRecordingMinutes,isInitializedForRecordingLink:this.isInitializedForRecordingLink}).initializeRecording(e),window.isBetterbugsLogsCaptureInitialized=!0}))}getAllData(e,t=!1){var n,r;return Mr(this,void 0,void 0,(function*(){const[i,o]=yield Promise.all([t?null===(n=this.dbLogger)||void 0===n?void 0:n.queryLogs(e,!0):Promise.resolve([]),null===(r=this.dbLogger)||void 0===r?void 0:r.queryLogs(e,!1,!0)]);return{rewindData:i,logsData:o}}))}captureScreenshot(){return Mr(this,void 0,void 0,(function*(){const e=new CustomEvent("betterbugs:captureScreenshot");document.dispatchEvent(e)}))}submitBug(e){return Mr(this,void 0,void 0,(function*(){const t=new CustomEvent("betterbugs:submitBug",{detail:e});document.dispatchEvent(t)}))}stopRecording(){var e;return Mr(this,void 0,void 0,(function*(){window.stopRRweb&&window.stopRRweb(),this.dbLogger&&(null===(e=this.dbLogger)||void 0===e||e.destroy(),this.dbLogger=void 0),Pr.instance=void 0}))}}window.isBetterbugsLogsCaptureInitialized||Pr.getInstance({maxRecordingMinutes:15,isInitializedForRecordingLink:!0}).startRecording({captureRewindEvents:!1})}(),r=r.default}()}));