!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Adjust=t():e.Adjust=t()}(self,()=>(()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function r(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:t+""}function o(e,t,n){return(t=r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function a(e){for(var t=1;tir});var u=1e3,s=36e5,c=24*s,l=function(e){return e.REASON_GENERAL="general",e.REASON_GDPR="gdpr",e}({}),d={TRANSACTION_ERROR:"XHR transaction failed due to an error",SERVER_MALFORMED_RESPONSE:"Response from server is malformed",SERVER_INTERNAL_ERROR:"Internal error occurred on the server",SERVER_CANNOT_PROCESS:"Server was not able to process the request, probably due to error coming from the client",NO_CONNECTION:"No internet connectivity",SKIP:"Skipping slower attempt",MISSING_URL:"Url is not provided"},f=function(e){return e.NO_STORAGE="noStorage",e.INDEXED_DB="indexedDB",e.LOCAL_STORAGE="localStorage",e}({}),m={default:"adjust.com",india:"adjust.net.in",china:"adjust.world",world:"adjust.world",EU:"eu.adjust.com",TR:"tr.adjust.com",US:"us.adjust.com"},p="https://",v="activity:web_uuid",h="activity:attribution";function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&void 0!==arguments[0]?arguments[0]:[]).reduce(function(e,t){return a(a({},e),{},o({},t.key,t.value))},{})}function N(){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter(function(t){return-1!==e.indexOf(t)})}function O(e,t){return new RegExp("\\/".concat(t,"(\\/.*|\\?.*){0,1}$")).test(e)}function I(e,t){var n=b(t,2),r=n[0],i=n[1];return a(a({},e),{},o({},r,i))}function x(e){return Object.keys(e).map(function(t){return[t,e[t]]})}function A(e){return Object.keys(e).map(function(t){return e[t]})}function R(e){return S(e)?!k(e):!!e||0===e}function E(){try{var e=(new Date).toString(),t=window.localStorage;t.setItem(e,e);var n=t.getItem(e)===e;return t.removeItem(e),!(!n||!t)}catch(e){return!1}}const j={namespace:"adjust-sdk",version:"5.8.2",env:"production"};var C="error",_="warning",T="info",B="verbose",L=o(o(o(o(o({},"none",-1),C,0),_,1),T,2),B,3),U={log:" ",info:" ",warn:" ",error:""},K={development:B,production:C,test:B},q=M(),G="";function M(){return K[j.env]||C}function F(e,t){var n;if(!(L[q]2?u-2:0),c=2;c2&&void 0!==arguments[2]?arguments[2]:[]).map(function(n){return we(e,t,n)})}function De(e,t,n){var r=he[t][Oe(e,ke.right)],o=r.fields[r.keyPath],i=n instanceof Array?n.slice():[n],a=(ie(o)?o.composite:[r.keyPath]).map(function(e,t){var n=r.fields[e];return Se(re(n)?n.values:null,i[t])});return 1===a.length?a[0]:a}function Ne(e){return he.values[e]||e}function Oe(e,t){return(he.storeNames[t][e]||{}).name||e}function Ie(e,t){return{name:t.name,message:t.message.replace('"'.concat(e,'"'),Oe(e,ke.right))}}function xe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ae(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:1,n=e+"",r=1;r<=t;r+=1)e0?"-":"+")+Ee(Math.floor(Math.abs(t)/60))+Ee(Math.abs(t)%60)}(t);return"".concat(n,"T").concat(r,"Z").concat(o)}function Ce(e,t){return isNaN(e)||isNaN(t)?0:Math.abs(t-e)}var _e={},Te=[];function Be(e,t){var n="id"+Math.random().toString(36).substring(2,16),r={id:n,cb:t};return _e[e]||(_e[e]=[]),_e[e].push(r),n}function Le(e,t){_e[e]&&_e[e].forEach(function(n){"function"==typeof n.cb&&Te.push(setTimeout(function(){return n.cb(e,t)}))})}var Ue={},Ke=!1,qe=!1;function Ge(){Ue=Ke?a({},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}):{}}function Me(){Ke&&(Ue.lastInterval=function(){var e=Ue.lastActive;if(e)return Math.round(Ce(e,Date.now())/u);return-1}(),Ue.lastActive=Date.now())}function Fe(e){Ue=a(a({},Ue),e)}function We(){qe=!0}function Ve(){var e=Ue.lastActive;return Math.round(Ce(e,Date.now())/u)}function He(){return(Ue.timeSpent||0)+(qe?Ve():0)}function Ye(){var e=Ce(Ue.lastActive,Date.now())=0?Ue.lastInterval:0,n={timeSpent:Ue.timeSpent||0,sessionLength:Ue.sessionLength||0,sessionCount:Ue.sessionCount||1,lastInterval:t||0};return e&&O(e,"event")&&(n.eventCount=Ue.eventCount),n},updateParams:function(e,t){if(Ke){var n={};n.timeSpent=He(),n.sessionLength=Ye(),O(e,"session")&&(n.sessionCount=(Ue.sessionCount||0)+1),O(e,"event")&&(n.eventCount=(Ue.eventCount||0)+1),Fe(n),t||Me()}},updateInstalled:function(){Ke&&(Ue.installed||Fe({installed:!0}))},updateSessionOffset:ze,updateSessionLength:function(){Ke&&(Fe({sessionLength:Ye()}),Me())},resetSessionOffset:function(){Ke&&Fe({timeSpent:0,sessionLength:0})},updateLastActive:Me,destroy:function(){Ue={},Ke=!1,qe=!1},getAttribution:function(){return Ke?Ue.attribution?Ue.attribution:(V.log("No attribution data yet"),null):null},getWebUUID:function(){return Ke?Ue.uuid:null},waitForAttribution:function(){return Ue.attribution?Promise.resolve(Ue.attribution):new Promise(function(e){return Be(h,function(t,n){return e(n)})})},waitForWebUUID:function(){return Ue.uuid?Promise.resolve(Ue.uuid):new Promise(function(e){return Be(v,function(t,n){return e(n)})})}};var Qe=function(){return Re(function e(){xe(this,e),o(this,"items",{})},[{key:"getItem",value:function(e){return Object.prototype.hasOwnProperty.call(this.items,e)?this.items[e]:null}},{key:"removeItem",value:function(e){delete this.items[e]}},{key:"setItem",value:function(e,t){this.items[e]=t}}])}();const Xe=new(function(){return Re(function e(){var t=this;xe(this,e),o(this,"defaultName",j.namespace),o(this,"storageName",this.defaultName),o(this,"storeNames",he.storeNames.left),this.storesMap={},E()?this.storage=window.localStorage:this.storage=new Qe;var n=this.read.bind(this),r=this.write.bind(this);A(this.storeNames).forEach(function(e){var o=e.name;Object.defineProperty(t.storesMap,o,{get:function(){return n(o)},set:function(e){r(o,e)}})}),Object.freeze(this.storesMap)},[{key:"read",value:function(e){var t=this.storage.getItem("".concat(this.storageName,".").concat(e)),n=t?JSON.parse(t):null;return e===te.Preferences&&n?we(te.Preferences,ke.right,n):n}},{key:"write",value:function(e,t){t?this.storage.setItem("".concat(this.storageName,".").concat(e),JSON.stringify(t instanceof Array?t:we(te.Preferences,ke.left,t))):this.storage.removeItem("".concat(this.storageName,".").concat(e))}},{key:"clear",value:function(){this.deleteData()}},{key:"deleteData",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];A(this.storeNames).forEach(function(n){!t&&n.permanent||e.storage.removeItem("".concat(e.storageName,".").concat(n.name))})}},{key:"setCustomName",value:function(e){var t=this;if(e&&e.length){var n="".concat(j.namespace,"-").concat(e);A(this.storeNames).forEach(function(e){var r=e.name,o=t.storage.getItem("".concat(t.storageName,".").concat(r));o&&t.storage.setItem("".concat(n,".").concat(r),o)}),this.deleteData(!0),this.storageName=n}}},{key:"stores",get:function(){return this.storesMap}}])}());var Ze=ue.preferences.name,$e=null;function et(){return $e||tt(),$e?a({},$e):null}function tt(){$e=Xe.stores[Ze]}function nt(){var e=et();return e&&e.sdkDisabled||null}function rt(e){var t=e?a({},e):null;Xe.stores[Ze]=a(a({},et()),{},{sdkDisabled:t}),tt()}function ot(){var e=Xe.stores[Ze]||{},t=($e||{}).sdkDisabled||null;e.sdkDisabled&&!t&&Le("sdk:shutdown"),tt()}function it(){Xe.stores[Ze]||(Xe.stores[Ze]=a({},$e))}$e=et();var at=function(e){return e.add="add",e.put="put",e.get="get",e.list="list",e.clear="clear",e.delete="delete",e}(at||{}),ut=function(e){return e.readonly="readonly",e.readwrite="readwrite",e}(ut||{}),st=function(){function e(){xe(this,e),o(this,"dbDefaultName",j.namespace),o(this,"dbName",this.dbDefaultName),o(this,"dbVersion",1),o(this,"indexedDbConnection",null),o(this,"notSupportedError",{name:"IDBNotSupported",message:"IndexedDB is not supported"}),o(this,"databaseOpenError",{name:"CannotOpenDatabaseError",message:"Cannot open a database"}),o(this,"noConnectionError",{name:"NoDatabaseConnection",message:"Cannot open a transaction"});var t=e.getIndexedDB();if(!t)throw this.notSupportedError;this.idbFactory=t}return Re(e,[{key:"setCustomName",value:function(e){return e&&e.length>0?(this.dbName="".concat(j.namespace,"-").concat(e),this.migrateDb(this.dbDefaultName,this.dbName)):Promise.resolve()}},{key:"openDatabase",value:function(t,n,r){var o=this;return e.isSupported().then(function(e){return e?new Promise(function(e,i){var a=o.idbFactory.open(t,r);n&&(a.onupgradeneeded=function(e){return n(e,i)}),a.onsuccess=function(t){var n=t.target.result;n?e(n):i(o.databaseOpenError)},a.onerror=i}):Promise.reject(o.notSupportedError)})}},{key:"databaseExists",value:function(e){var t=this;return new Promise(function(n){var r=!0;t.openDatabase(e,function(){r=!1}).then(function(n){if(n.close(),!r)return t.deleteDatabaseByName(e)}).then(function(){return n(r)})})}},{key:"cloneData",value:function(e,t){var n=this;return A(he.storeNames.left).map(function(e){return e.name}).filter(function(e){return"p"!==e}).map(function(r){return function(){return o=r,i=n.indexedDbConnection,n.indexedDbConnection=e,n.getAll(o).then(function(e){if(n.indexedDbConnection=t,!(e.length<1))return n.addBulk(o,e,!0)}).then(function(){n.indexedDbConnection=i});var o,i}}).reduce(function(e,t){return e.then(t)},Promise.resolve())}},{key:"migrateDb",value:function(e,t){var n=this;return this.databaseExists(e).then(function(r){return r?Promise.all([n.openDatabase(e,n.handleUpgradeNeeded,n.dbVersion),n.openDatabase(t,n.handleUpgradeNeeded,n.dbVersion)]).then(function(t){var r=b(t,2),o=r[0],i=r[1];return n.cloneData(o,i).then(function(){return n.indexedDbConnection=i,o.close(),n.deleteDatabaseByName(e)})}).then(function(){return V.info("Database migration finished")}):n.openDatabase(t,n.handleUpgradeNeeded,n.dbVersion).then(function(e){n.indexedDbConnection=e})})}},{key:"handleUpgradeNeeded",value:function(e,t){var n=e.target.result;e.target.transaction.onerror=t,e.target.transaction.onabort=t;var r=he.storeNames.left,o=Je.current||{},i=o&&!k(o);x(r).filter(function(e){return!b(e,2)[1].permanent}).forEach(function(e){var t=b(e,2),r=t[0],a=t[1].name,u=he.right[r],s=n.createObjectStore(a,{keyPath:u.keyPath,autoIncrement:u.autoIncrement||!1});if(u.index&&s.createIndex("".concat(u.index,"Index"),u.index),a===ee.ActivityState&&i)return s.add(we(r,ke.left,o)),void V.info("Activity state has been recovered");var c=Xe.stores[a];c&&(c.forEach(function(e){return s.add(e)}),V.info("Migration from localStorage done for ".concat(r," store")))}),it(),Xe.clear()}},{key:"open",value:function(){var e=this;return this.indexedDbConnection?Promise.resolve({success:!0}):this.openDatabase(this.dbName,this.handleUpgradeNeeded,this.dbVersion).then(function(t){return e.indexedDbConnection=t,e.indexedDbConnection.onclose=function(){return e.destroy},{success:!0}})}},{key:"getTransactionStore",value:function(e,t,n){var r,o=e.storeName,i=e.mode,a=n.transaction([o],i),u=a.objectStore(o),s=he.right[Oe(o,ke.right)];return s.index&&(r=u.index("".concat(s.index,"Index"))),a.onerror=t,a.onabort=t,{transaction:a,store:u,index:r,options:s}}},{key:"overrideError",value:function(e,t){var n=t.target.error;return e({name:n.name,message:n.message})}},{key:"getCompositeKeys",value:function(e){var t=e.fields[e.keyPath];return ie(t)?t.composite:null}},{key:"targetIsObject",value:function(e){return S(e)}},{key:"prepareTarget",value:function(e,t,n){if(n===at.clear||!t)return null;var r=this.getCompositeKeys(e);return-1!==[at.add,at.put].indexOf(n)?this.targetIsObject(t)?r?a(o({},e.keyPath,r.map(function(e){return t[e]}).join("")),t):t:null:t instanceof Array?t.join(""):t}},{key:"prepareResult",value:function(e,t){var n=this.getCompositeKeys(e);return n&&this.targetIsObject(t)?n.map(function(e){return t[e]}):null}},{key:"initRequest",value:function(e){var t=this,n=e.storeName,r=e.target,o=void 0===r?null:r,i=e.action,a=e.mode,u=void 0===a?ut.readonly:a;return this.open().then(function(){return new Promise(function(e,r){if(t.indexedDbConnection){var a=t.getTransactionStore({storeName:n,mode:u},r,t.indexedDbConnection),s=a.store,c=a.options,l=s[i](t.prepareTarget(c,o,i)),d=t.prepareResult(c,o);l.onsuccess=function(){i!==at.get||l.result?e(d||l.result||o):r({name:"NotRecordFoundError",message:'Requested record not found in "'.concat(n,'" store')})},l.onerror=function(e){return t.overrideError(r,e)}}else r(t.noConnectionError)})})}},{key:"initBulkRequest",value:function(e){var t=this,n=e.storeName,r=e.target,o=e.action,i=e.mode,a=void 0===i?ut.readwrite:i;return!r||r&&!r.length?Promise.reject({name:"NoTargetDefined",message:"No array provided to perform ".concat(o,' bulk operation into "').concat(n,'" store')}):this.open().then(function(){return new Promise(function(e,i){if(t.indexedDbConnection){var u=t.getTransactionStore({storeName:n,mode:a},i,t.indexedDbConnection),s=u.transaction,c=u.store,l=u.options,d=new Array,f=r[0];s.oncomplete=function(){return e(d)};!function e(n){n.onerror=function(e){return t.overrideError(i,e)},n.onsuccess=function(){d.push(t.prepareResult(l,f)||n.result),f=r[d.length],d.length1&&void 0!==arguments[1]&&arguments[1];return this.openCursor({storeName:e,action:at.list,firstOnly:t})}},{key:"getFirst",value:function(e){return this.getAll(e,!0).then(function(e){return e.length?e[0]:void 0})}},{key:"getItem",value:function(e,t){return this.initRequest({storeName:e,target:t,action:at.get})}},{key:"filterBy",value:function(e,t){var n=IDBKeyRange.only(t);return this.openCursor({storeName:e,action:at.list,range:n})}},{key:"addItem",value:function(e,t){return this.initRequest({storeName:e,target:t,action:at.add,mode:ut.readwrite})}},{key:"addBulk",value:function(e,t,n){return this.initBulkRequest({storeName:e,target:t,action:n?at.put:at.add,mode:ut.readwrite})}},{key:"updateItem",value:function(e,t){return this.initRequest({storeName:e,target:t,action:at.put,mode:ut.readwrite})}},{key:"deleteItem",value:function(e,t){return this.initRequest({storeName:e,target:t,action:at.delete,mode:ut.readwrite})}},{key:"deleteBulk",value:function(e,t,n){var r=n?IDBKeyRange[n](t):IDBKeyRange.only(t);return this.openCursor({storeName:e,action:at.delete,range:r,mode:ut.readwrite})}},{key:"trimItems",value:function(e,t){var n=this,r=he.right[Oe(e,ke.right)];return this.getAll(e).then(function(e){return e.length?e[t-1]:null}).then(function(t){return t?n.deleteBulk(e,t[r.keyPath],ye.UpperBound):[]})}},{key:"count",value:function(e){var t=this;return this.open().then(function(){return new Promise(function(n,r){if(t.indexedDbConnection){var o=t.getTransactionStore({storeName:e,mode:ut.readonly},r,t.indexedDbConnection).store.count();o.onsuccess=function(){return n(o.result)},o.onerror=function(e){return t.overrideError(r,e)}}else r(t.noConnectionError)})})}},{key:"clear",value:function(e){return this.initRequest({storeName:e,action:at.clear,mode:ut.readwrite})}},{key:"destroy",value:function(){this.indexedDbConnection&&this.indexedDbConnection.close(),this.indexedDbConnection=null}},{key:"deleteDatabase",value:function(){return this.destroy(),this.deleteDatabaseByName(this.dbName)}}],[{key:"tryOpen",value:function(t){return new Promise(function(n){try{var r=t.open(e.dbValidationName);r.onsuccess=function(){r.result.close(),t.deleteDatabase(e.dbValidationName),n(!0)},r.onerror=function(){return n(!1)}}catch(e){n(!1)}})}},{key:"isSupported",value:function(){if(e.isSupportedPromise)return e.isSupportedPromise;var t="IndexedDB is not supported in this browser";return e.isSupportedPromise=new Promise(function(n){var r=e.getIndexedDB(),o=!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform);!r||o?(V.warn(t),n(!1)):n(e.tryOpen(r).then(function(e){return e||V.warn(t),e}))}),e.isSupportedPromise}},{key:"getIndexedDB",value:function(){return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB}}])}();function ct(e){return function(e){if(Array.isArray(e))return g(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||y(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}o(st,"dbValidationName","validate-db-openable"),o(st,"isSupportedPromise",null);var lt=function(){function e(){xe(this,e)}return Re(e,[{key:"open",value:function(){return e.isSupported().then(function(e){if(!e)return{status:"error",error:{name:"LSNotSupported",message:"LocalStorage is not supported"}};var t=he.storeNames.left,n=Je.current||{},r=n&&!k(n);return x(t).filter(function(e){return!b(e,2)[1].permanent}).forEach(function(e){var t=b(e,2),o=t[0],i=t[1].name;i!==ee.ActivityState||Xe.stores[i]?Xe.stores[i]||(Xe.stores[i]=[]):Xe.stores[i]=r?[we(o,ke.left,n)]:[]}),it(),{status:"success"}})}},{key:"getCompositeKeys",value:function(e){var t=e.fields[e.keyPath];return ie(t)?t.composite:null}},{key:"getKeys",value:function(e){var t=Oe(e,ke.right),n=he.right[t];return this.getCompositeKeys(n)||[n.keyPath]}},{key:"nextIndex",value:function(e){return"number"==typeof e?e+1:void 0}},{key:"initRequest",value:function(e,t){var n=this,r=e.storeName,o=e.id,i=e.item,u=he.right[Oe(r,ke.right)];return this.open().then(function(e){return"error"===e.status?Promise.reject(e.error):new Promise(function(e,s){var c,l=Xe.stores[r],d=n.getKeys(r),f=(l[l.length-1]||{})[u.keyPath]||0;if(o){var m=Array.isArray(o)?o.slice():[o];c=d.map(function(e,t){return[e,m[t]]}).reduce(I,{})}else c=a({},i);var p=c?P(l,d,c):0;return t(e,s,{keys:d,items:l,index:p,options:u,lastId:f})})})}},{key:"sort",value:function(e,t,n){var r=ct(e),o=t.slice().reverse();return r.sort(function(e,t){return o.reduce(function(r,o){return r||function(e,t,r){var o=n?n===e[r]:e[r]e[r]:e[r]>t[r];return o?-1:i?1:0}(e,t,o)},0)})}},{key:"prepareTarget",value:function(e,t,n){var r=this.getCompositeKeys(e);return r?a(o({},e.keyPath,r.map(function(e){return t[e]}).join("")),t):e.autoIncrement&&n?a(o({},e.keyPath,n),t):a({},t)}},{key:"prepareResult",value:function(e,t){var n=this.getCompositeKeys(e);return n?n.map(function(e){return t[e]}).filter(function(e){return!be(e)}):t[e.keyPath]}},{key:"getAll",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.open().then(function(r){return"error"===r.status?Promise.reject(r.error):new Promise(function(r,o){var i=Xe.stores[e];i instanceof Array?r(n?[i[0]]:t.sort(i,t.getKeys(e))):o({name:"NotFoundError",message:"No objectStore named ".concat(e," in this database")})})})}},{key:"getFirst",value:function(e){return this.getAll(e,!0).then(function(e){return e.length?e[0]:void 0})}},{key:"getItem",value:function(e,t){var n=this;return this.initRequest({storeName:e,id:t},function(t,r,o){var i=o.items,a=o.index,u=o.options;-1===a?r({name:"NotRecordFoundError",message:'Requested record not found in "'.concat(e,'" store')}):t(n.prepareTarget(u,i[a]))})}},{key:"filterBy",value:function(e,t){return this.getAll(e).then(function(n){return n.filter(function(n){var r=he.right[Oe(e,ke.right)];return(r.index&&n[r.index])===t})})}},{key:"addItem",value:function(e,t){var n=this;return this.initRequest({storeName:e,item:t},function(r,o,i){var a=i.items,u=i.index,s=i.options,c=i.lastId;-1!==u?o({name:"ConstraintError",message:'Constraint was not satisfied, trying to add existing item into "'.concat(e,'" store')}):(a.push(n.prepareTarget(s,t,n.nextIndex(c))),Xe.stores[e]=a,r(n.prepareResult(s,t)))})}},{key:"addBulk",value:function(e,t,n){var r=this;return this.initRequest({storeName:e},function(o,i,a){var u=a.keys,s=a.items,c=a.options,l=a.lastId;if(!t||t&&!t.length)i({name:"NoTargetDefined",message:'No array provided to perform add bulk operation into "'.concat(e,'" store')});else{var d=l,f=t.map(function(e){return r.prepareTarget(c,e,d=r.nextIndex(d))}),m=f.filter(function(e){return-1!==P(s,u,e)}).map(function(e){return e[c.keyPath]}),p=n?s.filter(function(e){return-1===m.indexOf(e[c.keyPath])}):ct(s);if(m.length&&!n)i({name:"ConstraintError",message:'Constraint was not satisfied, trying to add existing items into "'.concat(e,'" store')});else Xe.stores[e]=r.sort([].concat(ct(p),ct(f)),u),o(t.map(function(e){return r.prepareResult(c,e)}))}})}},{key:"updateItem",value:function(e,t){var n=this;return this.initRequest({storeName:e,item:t},function(r,o,i){var a=i.items,u=i.index,s=i.options,c=i.lastId,l=-1===u?n.nextIndex(c):void 0,d=n.prepareTarget(s,t,l);-1===u?a.push(d):a.splice(u,1,d),Xe.stores[e]=a,r(n.prepareResult(s,t))})}},{key:"deleteItem",value:function(e,t){return this.initRequest({storeName:e,id:t},function(n,r,o){var i=o.items,a=o.index;-1!==a&&(i.splice(a,1),Xe.stores[e]=i),n(t)})}},{key:"findMax",value:function(e,t,n){if(!e.length)return-1;for(var r={index:-1,value:"string"==typeof n?"":0},o=0;o=r.value&&(r={value:e[o][t],index:o})}return r.index}},{key:"deleteBulk",value:function(e,t,n){var r=this;return this.getAll(e).then(function(o){var i=r.getKeys(e),a=he.right[Oe(e,ke.right)].index||i[0],u=n?null:t,s=r.sort(o,i,u),c=r.findMax(s,a,t);if(-1===c)return[];var l=n===ye.LowerBound?c:0,d=n&&n!==ye.UpperBound?s.length:c+1,f=s.splice(l,d).map(function(e){return 1===i.length?e[a]:i.map(function(t){return e[t]})});return Xe.stores[e]=s,f})}},{key:"trimItems",value:function(e,t){var n=this,r=Oe(e,ke.right),o=he.right[r];return this.getAll(e).then(function(e){return e.length?e[t-1]:null}).then(function(t){return t?n.deleteBulk(e,t[o.keyPath],ye.UpperBound):[]})}},{key:"count",value:function(e){return this.open().then(function(t){if("error"===t.status)return Promise.reject(t.error);var n=Xe.stores[e];return Promise.resolve(n instanceof Array?n.length:1)})}},{key:"clear",value:function(e){return this.open().then(function(t){return"error"===t.status?Promise.reject(t.error):new Promise(function(t){Xe.stores[e]=[],t()})})}},{key:"destroy",value:function(){}},{key:"deleteDatabase",value:function(){}}],[{key:"isSupported",value:function(){return e.isSupportedPromise||(e.isSupportedPromise=new Promise(function(e){var t=E();t||V.warn("LocalStorage is not supported in this browser"),e(t)})),e.isSupportedPromise}}])}();o(lt,"isSupportedPromise",null);var dt,ft=function(e){return e[e.noStorage=f.NO_STORAGE]="noStorage",e[e.indexedDB=f.INDEXED_DB]="indexedDB",e[e.localStorage=f.LOCAL_STORAGE]="localStorage",e}(ft||{}),mt={getAll:function(e,t,n){return e.getAll(t,n).then(function(e){return Pe(t,ke.right,e)})},getFirst:function(e,t){return e.getFirst(t).then(function(e){return we(t,ke.right,e)})},getItem:function(e,t,n){return e.getItem(t,De(t,ke.left,n)).then(function(e){return we(t,ke.right,e)}).catch(function(e){return Promise.reject(Ie(t,e))})},filterBy:function(e,t,n){return e.filterBy(t,Ne(n)).then(function(e){return Pe(t,ke.right,e)})},addItem:function(e,t,n){var r=we(t,ke.left,n);return e.addItem(t,r).then(function(e){return De(t,ke.right,e)}).catch(function(e){return Promise.reject(Ie(t,e))})},addBulk:function(e,t,n,r){var o=Pe(t,ke.left,n);return e.addBulk(t,o,r).then(function(e){return e.map(function(e){return De(t,ke.right,e)})}).catch(function(e){return Promise.reject(Ie(t,e))})},updateItem:function(e,t,n){var r=we(t,ke.left,n);return e.updateItem(t,r).then(function(e){return De(t,ke.right,e)})},deleteItem:function(e,t,n){return e.deleteItem(t,De(t,ke.left,n)).then(function(e){return De(t,ke.right,e)})},deleteBulk:function(e,t,n,r){return e.deleteBulk(t,Ne(n),r).then(function(e){return e.map(function(e){return De(t,ke.right,e)})})},trimItems:function(e,t,n){return e.trimItems(t,n)},count:function(e,t){return e.count(t)},clear:function(e,t){return e.clear(t)},destroy:function(e){return e.destroy()},deleteDatabase:function(e){return e.deleteDatabase()}};var pt=null;function vt(e){var t=null;return null!==pt?pt:pt=Promise.all([st.isSupported(),lt.isSupported()]).then(function(n){var r=b(n,2),o=r[0],i=r[1];if(Xe.setCustomName(e),o){dt=ft.indexedDB;var a=new st;return a.setCustomName(e).then(function(){return t=a})}return i?(dt=ft.localStorage,t=new lt,Promise.resolve(t)):(V.error("There is no storage available, app will run with minimum set of features"),dt=ft.noStorage,t=null,Promise.resolve(t))}).then(function(){return{type:dt,storage:t}})}const ht=a({init:vt,getType:function(){return dt}},(gt=x(mt).map(function(e){var t=b(e,2),n=t[0],r=t[1];return[n,function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o2&&void 0!==arguments[2]&&arguments[2]?"CONTINUE":"RETRY",response:w(e.responseText)?JSON.parse(e.responseText):e.responseText,message:d[t],code:t}}function kt(e,t){var n=e.length-t.length-1,r=e.slice(0,n>0?n:0).split("").reduce(function(e){return e.concat(" ")},"");return"".concat(t).concat(r,":")}function St(e,t){var n="REQUEST PARAMETERS:",r=function(e){return e.replace(/([A-Z])/g,function(e){return"_".concat(e.toLowerCase())})},o=[];return x(a(a(a({},Z.getBaseParams()),t),e)).forEach(function(e){var t=b(e,2),n=t[0],i=t[1];"storeInfo"===n?S(i)&&(o.push(["store_name_from_client",i.storeName]),o.push(["store_app_id_from_client",i.storeAppId])):o.push([r(n),i])}),V.log(n),o.filter(function(e){return R(b(e,2)[1])}).map(function(e){var t=b(e,2),r=t[0],o=t[1];return V.log(kt(n,r),o),function(e){var t=b(e,2),n=t[0],r=t[1],o=encodeURIComponent(n),i=r;return"string"==typeof r&&(i=encodeURIComponent(r)),S(r)&&(i=encodeURIComponent(JSON.stringify(r)||"")),[o,i].join("granular_third_party_sharing_options"===n||"partner_sharing_settings"===n?encodeURIComponent("="):"=")}([r,o])}).join("&")}function wt(e,t,n){var r=n.xhr,o=n.url;if(4===r.readyState){var i=r.status>=200&&r.status<300,a=w(r.responseText);if(0!==r.status)return a?t(i?function(e,t){var n=JSON.parse(e.responseText),r={status:"success",adid:n.adid,timestamp:n.timestamp,ask_in:n.ask_in,retry_in:n.retry_in,continue_in:n.continue_in,tracking_state:n.tracking_state,attribution:void 0,message:void 0};return O(t,"attribution")&&(r.attribution=n.attribution,r.message=n.message),x(r).filter(function(e){return!!b(e,2)[1]}).reduce(I,{})}(r,o):bt(r,"SERVER_CANNOT_PROCESS",!0)):e(bt(r,i?"SERVER_MALFORMED_RESPONSE":"SERVER_INTERNAL_ERROR"));e(bt(r,"NO_CONNECTION"))}}function Pt(e,t){var n=e.endpoint,r=e.url,o=e.method,i=void 0===o?"GET":o,a=e.params,u=function(e,t){var n=e.endpoint,r=e.url,o=e.method,i=St(e.params,t);return{fullUrl:n+r+("GET"===o?"?".concat(i):""),encodedParams:i}}({endpoint:n,url:r,method:i,params:void 0===a?{}:a},t),s=u.fullUrl,c=u.encodedParams;return new Promise(function(e,t){var n=new XMLHttpRequest;n.open(i,s,!0),function(e,t){var n="REQUEST HEADERS:",r=[["Client-SDK","js".concat(j.version)],["Content-Type","POST"===t?"application/x-www-form-urlencoded":"application/json"]];V.log(n),r.forEach(function(t){var r=b(t,2),o=r[0],i=r[1];e.setRequestHeader(o,i),V.log(kt(n,o),i)})}(n,i),n.onreadystatechange=function(){return wt(t,e,{xhr:n,url:r})},n.onerror=function(){return t(bt(n,"TRANSACTION_ERROR"))},n.send("GET"===i?void 0:c)})}function Dt(e,t){return"success"===e.status?function(e,t){var n=O(t,"gdpr_forget_device"),r=O(t,"attribution"),o=O(t,"session"),i="opted_out"===e.tracking_state;if(!n&&i)return Le("sdk:gdpr-forget-me"),e;r||n||i||!e.ask_in||Le("attribution:check",e);o&&Le("session:finished",e);return e}(e,t):e}var Nt={long:{delay:12e4,maxDelay:c,minRange:.5,maxRange:1},short:{delay:200,maxDelay:s,minRange:.5,maxRange:1},test:{delay:100,maxDelay:300}};function Ot(e,t){var n,r,o=Nt[t=t||"long"],i=o.delay*Math.pow(2,e-1);return i=Math.min(i,o.maxDelay),o.minRange&&o.maxRange&&(i*=(n=o.minRange,r=o.maxRange,Math.random()*(r-n)+n)),Math.round(i)}var It=navigator.onLine;function xt(){It=!0}function At(){It=!1}function Rt(e,t,n){e.addEventListener&&e.addEventListener(t,n,!1)}function Et(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}function jt(e){return{domains:[e.default,e.world],useSubdomains:!0,isDataResidency:!1}}var Ct=function(e){return e.Default="default",e.India="india",e.China="china",e}(Ct||{});function _t(e,t){V.warn("Both ".concat(e," and ").concat(t," are set in config, ").concat(t," will be ignored"))}function Tt(e){return function(e){var t=Z.getCustomConfig(),n=t.customUrl,r=t.urlStrategy,o=t.dataResidency;if(n)return V.warn("customUrl is deprecated, use urlStrategy instead"),(o||r)&&_t("customUrl",o?"dataResidency":"urlStrategy"),{domains:[n],useSubdomains:!1,isDataResidency:!1};if(o&&r&&_t("dataResidency","urlStrategy"),o)return V.warn("dataResidency is deprecated, use urlStrategy instead"),{domains:[e[o]],useSubdomains:!0,isDataResidency:!0};if("string"==typeof r){if(V.warn("urlStrategy string literals ('china' and 'india') are deprected, use UrlStartegyConfig instead"),r===Ct.India)return{domains:[e.india,e.default],useSubdomains:!0,isDataResidency:!1};if(r===Ct.China)return{domains:[e.china,e.default],useSubdomains:!0,isDataResidency:!1}}return r?null:jt(e)}(e)||function(e){var t=Z.getCustomConfig().urlStrategy;if(t&&"object"===n(t)){var r=t;return!r.domains||!Array.isArray(r.domains)||r.domains.length<1?(V.warn("Invalid urlStartegy: `domains` should be a non-empty array"),jt(e)):{domains:r.domains,useSubdomains:!!r.useSubdomains,isDataResidency:!!r.isDataResidency}}return jt(e)}(e)}function Bt(e){var t,n=Tt(e),r=[],o=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=y(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(n.domains);try{for(o.s();!(t=o.n()).done;){var i=t.value,a=n.useSubdomains?{app:"".concat("https://app.").concat(i),gdpr:"".concat("https://gdpr.").concat(i)}:{app:"".concat(p).concat(i),gdpr:"".concat(p).concat(i)};r.push(a)}}catch(e){o.e(e)}finally{o.f()}return r}var Lt=150,Ut=2147483647,Kt=6e4;const qt=function(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.url,o=n.method,i=void 0===o?"GET":o,u=n.params,s=void 0===u?{}:u,c=n.continueCb,l=n.strategy,f=n.wait,p={url:r,method:i,params:s,continueCb:c},v=r,h=i,g=a({},s),y=c,S=l,w=function(){e.reset(),t=e.next()},P=function(e,t){return e["/gdpr_forget_device"===t?"gdpr":"app"]},D=null,N={request:0,connection:0},O=E(f),A=null;function E(e){return(e=e||Lt)>Ut?Ut:e}function j(n){var r=n.wait,o=n.retrying;return e||(e=function(){var e=Bt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:m),t=0;return{next:function(){return t0&&void 0!==arguments[0]?arguments[0]:{},t=e.url,n=e.method,r=e.params,o=void 0===r?{}:r,i=e.continueCb,u=e.wait;return function(e){var t=e.url,n=e.method,r=e.params,o=e.continueCb;t&&(v=t),n&&(h=n),k(r)||(g=a({},r)),g=a({createdAt:je()},g),"function"==typeof o&&(y=o)}({url:t,method:n,params:o,continueCb:i}),j({wait:u})},isRunning:function(){return!!D},clear:U}};var Gt=function(e){return e===l.REASON_GDPR?"GDPR disable":"disable"},Mt=function(e){return{start:{inProgress:"Adjust SDK ".concat(Gt(e)," process has already started"),done:"Adjust SDK ".concat(Gt(e)," process is now started")},finish:{inProgress:"Adjust SDK ".concat(Gt(e)," process has already finished"),done:"Adjust SDK ".concat(Gt(e)," process is now finished")}}};function Ft(e,t){var n=e.reason,r=e.pending,o=nt()||{},i=o.reason,a=o.pending,u="start"===t&&a?"start":"finish";return"start"===t&&i||"finish"===t&&i&&!a?(V.log(Mt(i)[u].inProgress),!1):(V.log(Mt(n)[u].done),rt({reason:n||l.REASON_GENERAL,pending:r}),!0)}function Wt(e){return Ft({reason:e,pending:arguments.length>1&&void 0!==arguments[1]&&arguments[1]},"start")}function Vt(){var e=nt()||{},t=e.reason,n=e.pending;return t===l.REASON_GENERAL||t===l.REASON_GDPR&&!n?"off":t===l.REASON_GDPR&&n?"paused":"on"}var Ht=$.ActivityState,Yt=!1;function zt(e){return e?"unknown"===e.uuid?(Wt(l.REASON_GDPR),Je.destroy(),{exists:!0,stored:null}):(Je.init(e),{exists:!0,stored:e}):{exists:!1}}function Jt(){return"off"!==Vt()&&Je.isStarted()}function Qt(){if(!Jt())return Promise.resolve(null);var e=a(a({},Je.current),{},{lastActive:Date.now()});return ht.updateItem(Ht,e).then(function(){return Je.current=e})}var Xt=qt({strategy:"long",continueCb:function(e,t){var n=e&&e.continue_in||null;return en.pause=n?{timestamp:Date.now(),wait:n}:null,ht.getFirst($t).then(function(e){return e?ht.deleteItem($t,e.timestamp):null}).then(function(){var r,o="error"===e.status||(null===(r=e.response)||void 0===r?void 0:r.error);return t(o),en.running=!1,on({wait:n})})}}),Zt=!1,$t="queue",en={running:!1,timestamp:null,pause:null};function tn(){var e=Date.now();return en.timestamp&&e<=en.timestamp&&(e=en.timestamp+1),en.timestamp=e,e}function nn(e){var t=e.url,n=e.method,r=e.params,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=o.auto,u=o.timestamp;Je.updateParams(t,i);var s=x(r||{}).filter(function(e){return R(b(e,2)[1])}).reduce(I,{}),c={timestamp:tn(),url:t,method:n,params:a(a({},Je.getParams(t)),s)};return u&&(c.createdAt=u),ht.addItem($t,c).then(function(){return function(e){return O(e,"session")&&Je.resetSessionOffset(),Je.updateLastActive(),Qt()}(t)}).then(function(){return en.running?{}:on()})}function rn(){var e=en.pause||{},t=e.timestamp,n=e.wait,r=Date.now()-(t||0);return r0&&void 0!==arguments[0]?arguments[0]:{},t=e.cleanUp,n=e.wait;if(en.running)return Promise.resolve({});en.running=!0;var r=Promise.resolve({});return t&&(r=r.then(un)),r.then(function(){return ht.getFirst($t)}).then(function(e){return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.timestamp,n=e.createdAt,r=e.url,o=e.method,i=e.params,u=arguments.length>1?arguments[1]:void 0,s=Je.current||{},c="/session"===r&&!s.installed;return Zt&&!c||!r&&!o&&!i?(en.running=!1,Promise.resolve({})):Xt.send({url:r,method:o,params:a(a({},i),{},{createdAt:je(n||t)}),wait:u||rn()})}(e,n)})}function an(e){if(void 0!==e)if(e!==Zt){var t=Zt;Zt=e,!e&&t&&on(),V.info("The app is now in ".concat(e?"offline":"online"," mode"))}else V.error("The app is already in ".concat(e?"offline":"online"," mode"));else V.error("State not provided, true or false has to be defined")}function un(){var e=Date.now()-Z.requestValidityWindow;return ht.deleteBulk($t,e,"upperBound")}var sn="globalParams",cn="No type provided",ln="Global parameter type not provided, `callback` or `partner` types are available";function dn(e){return(e||[]).map(function(e){return{key:e.key,value:e.value}})}function fn(){return Promise.all([ht.filterBy(sn,"callback"),ht.filterBy(sn,"partner")]).then(function(e){var t=b(e,2),n=t[0],r=t[1];return{callbackParams:dn(n),partnerParams:dn(r)}})}function mn(e,t){if(void 0===t)return V.error(ln),Promise.reject({message:cn});var n=D(e),r=Object.keys(n).map(function(e){return{key:e,value:n[e],type:t}});return Promise.all([ht.filterBy(sn,t),ht.addBulk(sn,r,!0)]).then(function(e){var n=b(e,2),o=n[0],i=n[1],a=N(o.map(function(e){return e.key}),i.map(function(e){return e[0]}));return V.log("Following ".concat(t," parameters have been saved: ").concat(r.map(function(e){return"".concat(e.key,":").concat(e.value)}).join(", "))),a.length&&V.log("Keys: ".concat(a.join(", ")," already existed so their values have been updated")),i})}function pn(e,t){return void 0===t?(V.error(ln),Promise.reject({message:cn})):ht.deleteItem(sn,[e,t]).then(function(n){return V.log("".concat(e," ").concat(t," parameter has been deleted")),n})}function vn(e){return void 0===e?(V.error(ln),Promise.reject({message:cn})):ht.deleteBulk(sn,e).then(function(t){return V.log("All ".concat(e," parameters have been deleted")),t})}var hn,gn,yn,bn=!1,kn=document;function Sn(){return yn=function(){var e=document;if(void 0!==e.hidden)return{hidden:"hidden",visibilityChange:"visibilitychange"};for(var t=x({mozHidden:"mozvisibilitychange",msHidden:"msvisibilitychange",oHidden:"ovisibilitychange",webkitHidden:"webkitvisibilitychange"}),n=0;n0;return!n||n&&t*u>=Z.sessionWindow?fn().then(function(e){var t,n,r;nn({url:"/session",method:"POST",params:(t=e,n=t.callbackParams,r=t.partnerParams,{callbackParams:n.length?D(n):null,partnerParams:r.length?D(r):null})},{auto:!0})}):(Le("attribution:check"),Qt())}var An=qt({url:"/attribution",strategy:"short",continueCb:function(e,t,n){if(!e||e&&"error"===e.status)return t(),Promise.resolve({state:"unknown"});if(!e.ask_in)return t(),function(e){if(k(e)||!function(e){var t=e.adid,n=void 0===t?"":t,r=e.attribution,o=void 0===r?{}:r;return!!n&&!!N(Rn,Object.keys(o)).length}(e)||function(e){var t=e.adid,n=e.attribution,r=Je.current.attribution||{},o=n&&Rn.some(function(e){return r[e]!==n[e]});return!o&&t===r.adid}(e))return Promise.resolve({state:"same"});var t=x(e.attribution).filter(function(e){var t=b(e,1)[0];return-1!==Rn.indexOf(t)}).reduce(I,{adid:e.adid});return Je.current=a(a({},Je.current),{},{attribution:t}),Qt().then(function(){return Le("attribution:change",t),Le(h,t),V.info("Attribution has been updated"),{state:"changed"}})}(e);return n(e.ask_in)}}),Rn=["tracker_token","tracker_name","network","campaign","adgroup","creative","click_label","state"];var En=qt({url:"/gdpr_forget_device",method:"POST",strategy:"short"}),jn={running:"Adjust SDK is running pending GDPR Forget Me request",pending:"Adjust SDK will run GDPR Forget Me request after initialisation",paused:"Adjust SDK is already prepared to send GDPR Forget Me request",off:"Adjust SDK is already disabled"};function Cn(e){var t=Vt();return e||"on"===t?Z.isInitialised()?(En.send({params:a({},Je.getParams())}).then(function(){Le("sdk:gdpr-forget-me")}),!0):(V.log(jn.pending),!0):(V.log(jn[t]),!1)}function _n(){return Ft({reason:l.REASON_GDPR,pending:!1},"finish")}var Tn=[];function Bn(e,t){Tn.push({method:e,description:t,timestamp:Date.now()})}var Ln="eventDeduplication";function Un(e,t){var n,r,o=t.callbackParams,i=t.partnerParams,u={},s=a({eventToken:e.eventToken,deduplicationId:e.deduplicationId},(n=e.revenue,r=e.currency,isNaN(n)||(n=parseFloat(n))<0||!r?{}:{revenue:n.toFixed(5),currency:r})),c=a(a({},D(o)),D(e.callbackParams)),l=a(a({},D(i)),D(e.partnerParams));return k(c)||(u.callbackParams=c),k(l)||(u.partnerParams=l),a(a({},s),u)}function Kn(e){return e?ht.getAll(Ln).then(function(e){return e.map(function(e){return e.id})}).then(function(t){return-1===t.indexOf(e)?function(e){var t=Z.getCustomConfig().eventDeduplicationListLimit,n=t>0?t:10;return ht.count(Ln).then(function(e){var t=Promise.resolve();if(e>=n){var r=e-n+1;V.log("Event deduplication list limit has been reached. Oldest ids are about to be removed (".concat(r," of them)")),t=ht.trimItems(Ln,r)}return t}).then(function(){return V.info("New event deduplication id is added to the list: ".concat(e)),ht.addItem(Ln,{id:e})})}(e):Promise.reject({message:"Event won't be tracked, since it was previously tracked with the same deduplication id ".concat(e)})}):Promise.resolve()}function qn(e){return{clickTime:je(),source:"web_referrer",referrer:decodeURIComponent(e)}}function Gn(e,t){var n;(n=e||window.location.search.substring(1).split("&").map(function(e){return e.split("=")}).reduce(I,{}).adjust_referrer)&&nn({url:"/sdk_click",method:"POST",params:qn(n)},{timestamp:t})}var Mn=["logLevel","logOutput"],Fn=null,Wn=!1,Vn=!1,Hn=!1,Yn=null;function zn(e){or("third-party sharing",function(){return Je.waitForWebUUID().then(function(){return function(e){e&&void 0!==e.isEnabled?nn({url:"/third_party_sharing",method:"POST",params:{sharing:e.isEnabled?"enable":"disable",granularThirdPartySharingOptions:e.granularOptions,partnerSharingSettings:e.partnerSharingSettings}}):V.error("Can not track third-party sharing without parameters")}(e)})},{schedule:!1,optionalInit:!0})}function Jn(){var e;"paused"===Vt()&&(_n(),Promise.all([(e={uuid:"unknown"},Je.current=e,ht.clear(Ht).then(function(){return ht.addItem(Ht,e)})),ht.clear(sn),ht.clear($t)]).then($n))}function Qn(){return Wn||Z.isInitialised()}function Xn(){Wn=!1,Vn=!1,Tn=[],Xt.clear(),en.running=!1,en.timestamp=null,en.pause=null,bn=!1,Je.toBackground(),In(),yn&&(clearTimeout(gn),Et(kn,yn.visibilityChange,Dn),Rt(kn,yn.visibilityChange,Nn)),An.clear()}function Zn(e){e&&V.log("Adjust SDK has been shutdown due to asynchronous disable"),Xn(),Te.forEach(clearTimeout),Te=[],_e={},Je.destroy(),Et(window,"online",xt),Et(window,"offline",At),ht.destroy(),Z.destroy()}function $n(){Hn=!1,Zn(),En.clear(),Fn=null,V.log("Adjust SDK instance has been destroyed")}function er(e){V.log("Adjust SDK is starting with web_uuid set to ".concat(e.uuid));var t=Je.current.installed;"paused"===Vt()&&(V.log(jn.running),Cn(!0));var n=Vt(),r=function(e){return"Adjust SDK start has been interrupted ".concat(e)};return"off"===n?(Zn(),Promise.reject({interrupted:!0,message:r("due to complete async disable")})):"paused"===n?(Xn(),Promise.reject({interrupted:!0,message:r("due to partial async disable")})):Vn?Promise.reject({interrupted:!0,message:r("due to multiple synchronous start attempt")}):(on({cleanUp:!0}),Sn().then(function(){Wn=!1,Vn=!0,t&&tr()}))}function tr(){var e;Hn=!0,Tn.forEach(function(e){"function"==typeof e.method&&(V.log("Delayed ".concat(e.description," task is running now")),e.method(e.timestamp))}),Tn=[],(e=Yn)&&x(_e).some(function(t){var n=b(t,2)[1];return n.some(function(t,r){t.id===e&&n.splice(r,1)})})}function nr(e){if(e.interrupted)V.log(e.message);else if(Zn(),V.error("Adjust SDK start has been canceled due to an error",e),e.stack)throw e}function rr(e){"off"!==Vt()?(Z.set(e),Rt(window,"online",xt),Rt(window,"offline",At),Yn=Be("sdk:installed",tr),Be("sdk:shutdown",function(){return Zn(!0)}),Be("sdk:gdpr-forget-me",Jn),Be("attribution:check",function(e,t){return n=t,r=Je.current,(o=(n||{}).ask_in)||!r.attribution&&r.installed?(An.send({params:a({initiatedBy:n?"backend":"sdk"},Je.getParams()),wait:o}),Je.updateSessionOffset(),Qt()):Promise.resolve(r);var n,r,o}),"function"==typeof e.attributionCallback&&Be("attribution:change",e.attributionCallback),(Yt?Promise.reject({interrupted:!0,message:"Adjust SDK start already in progress"}):(Yt=!0,ht.getFirst(Ht).then(zt).then(function(e){if(e.exists)return Yt=!1,e.stored;var t,n=k(Je.current)?{uuid:(t=Date.now(),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?n:11&n).toString(16)}))}:Je.current;return ht.addItem(Ht,n).then(function(){return Je.init(n),ot(),Yt=!1,n})}).then(function(e){return Le(v,e?e.uuid:"gdpr_forgotten"),e}))).then(er).then(Gn).catch(nr)):V.log("Adjust SDK is disabled, can not start the sdk")}function or(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.schedule,o=n.waitForInitFinished,i=n.optionalInit;if(ht.getType()!==f.NO_STORAGE)if("on"===Vt())if(i||Qn()||!o){if("function"==typeof t){if(!r||Hn&&Vn||!i&&!Qn())return t();Bn(t,e),V.log("Running ".concat(e," is delayed until Adjust SDK is up"))}}else V.error("Adjust SDK can not ".concat(e,", sdk instance is not initialized"));else V.log("Adjust SDK is disabled, can not ".concat(e));else V.log("Adjust SDK can not ".concat(e,", no storage available"))}const ir={initSdk:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.logLevel,n=e.logOutput,r=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r