@namiml/web-sdk
Version:
Nami Web SDK makes subscriptions & in-app purchases easy, with powerful built-in paywalls and A/B testing
1 lines • 1.59 MB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).NamiWebSdk={})}(this,function(e){"use strict";(()=>{if("undefined"!=typeof globalThis)return;const e="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:Function("return this")();Object.defineProperty(e,"globalThis",{value:e,writable:!0,enumerable:!1,configurable:!0})})(),"undefined"!=typeof Element&&"function"!=typeof Element.prototype.getAttributeNames&&(Element.prototype.getAttributeNames=function(){const e=this.attributes,t=new Array(e.length);for(let i=0;i<e.length;i+=1)t[i]=e[i].name;return t});const t=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(e){this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColSpan="",this.ariaCurrent="",this.ariaDescription="",this.ariaDisabled="",this.ariaExpanded="",this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=e}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var i,n,a,r,s,o,l,d,u,c,h,m,f=function(e,t,i,n,a){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,i):a?a.value=i:t.set(e,i),i},p=function(e,t,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(e):n?n.value:t.get(e)};const g=e=>"boolean"==typeof e?e:e?.capture??!1;const v=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(e,t,i){if(null==t)return;const n=g(i)?this.__captureEventListeners:this.__eventListeners;let a=n.get(e);if(void 0===a)a=new Map,n.set(e,a);else if(a.has(t))return;const r="object"==typeof i&&i?i:{};r.signal?.addEventListener("abort",()=>this.removeEventListener(e,t,i)),a.set(t,r??{})}removeEventListener(e,t,i){if(null==t)return;const n=g(i)?this.__captureEventListeners:this.__eventListeners,a=n.get(e);void 0!==a&&(a.delete(t),a.size||n.delete(e))}dispatchEvent(e){const t=[this];let i=this.__eventTargetParent;if(e.composed)for(;i;)t.push(i),i=i.__eventTargetParent;else for(;i&&i!==this.__host;)t.push(i),i=i.__eventTargetParent;let n=!1,a=!1,r=0,s=null,o=null,l=null;const d=e.stopPropagation,u=e.stopImmediatePropagation;Object.defineProperties(e,{target:{get:()=>s??o,...y},srcElement:{get:()=>e.target,...y},currentTarget:{get:()=>l,...y},eventPhase:{get:()=>r,...y},composedPath:{value:()=>t,...y},stopPropagation:{value:()=>{n=!0,d.call(e)},...y},stopImmediatePropagation:{value:()=>{a=!0,u.call(e)},...y}});const c=(t,i,n)=>{"function"==typeof t?t(e):"function"==typeof t?.handleEvent&&t.handleEvent(e),i.once&&n.delete(t)},h=()=>(l=null,r=0,!e.defaultPrevented),m=t.slice().reverse();s=this.__host&&e.composed?null:this;const f=e=>{for(o=this;o.__host&&e.includes(o.__host);)o=o.__host};for(const t of m){s||o&&o!==t.__host||f(m.slice(m.indexOf(t))),l=t,r=t===e.target?2:1;const i=t.__captureEventListeners.get(e.type);if(i)for(const[e,t]of i)if(c(e,t,i),a)return h();if(n)return h()}const p=e.bubbles?t:[this];o=null;for(const t of p){s||o&&t!==o.__host||f(p.slice(0,p.indexOf(t)+1)),l=t,r=t===e.target?2:3;const i=t.__eventListeners.get(e.type);if(i)for(const[e,t]of i)if(c(e,t,i),a)return h();if(n)return h()}return h()}},y={__proto__:null,enumerable:!0};Object.freeze(y);const b=(c=class{constructor(e,t={}){if(i.set(this,!1),n.set(this,!1),a.set(this,!1),r.set(this,!1),s.set(this,Date.now()),o.set(this,!1),l.set(this,void 0),d.set(this,void 0),u.set(this,void 0),this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,0===arguments.length)throw new Error("The type argument must be specified");if("object"!=typeof t||!t)throw new Error('The "options" argument must be an object');const{bubbles:c,cancelable:h,composed:m}=t;f(this,i,!!h,"f"),f(this,n,!!c,"f"),f(this,a,!!m,"f"),f(this,l,`${e}`,"f"),f(this,d,null,"f"),f(this,u,!1,"f")}initEvent(e,t,i){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){f(this,r,!0,"f")}get target(){return p(this,d,"f")}get currentTarget(){return p(this,d,"f")}get srcElement(){return p(this,d,"f")}get type(){return p(this,l,"f")}get cancelable(){return p(this,i,"f")}get defaultPrevented(){return p(this,i,"f")&&p(this,r,"f")}get timeStamp(){return p(this,s,"f")}composedPath(){return p(this,u,"f")?[p(this,d,"f")]:[]}get returnValue(){return!p(this,i,"f")||!p(this,r,"f")}get bubbles(){return p(this,n,"f")}get composed(){return p(this,a,"f")}get eventPhase(){return p(this,u,"f")?c.AT_TARGET:c.NONE}get cancelBubble(){return p(this,o,"f")}set cancelBubble(e){e&&f(this,o,!0,"f")}stopPropagation(){f(this,o,!0,"f")}get isTrusted(){return!1}},i=new WeakMap,n=new WeakMap,a=new WeakMap,r=new WeakMap,s=new WeakMap,o=new WeakMap,l=new WeakMap,d=new WeakMap,u=new WeakMap,c.NONE=0,c.CAPTURING_PHASE=1,c.AT_TARGET=2,c.BUBBLING_PHASE=3,c);Object.defineProperties(b.prototype,{initEvent:y,stopImmediatePropagation:y,preventDefault:y,target:y,currentTarget:y,srcElement:y,type:y,cancelable:y,defaultPrevented:y,timeStamp:y,composedPath:y,returnValue:y,bubbles:y,composed:y,eventPhase:y,cancelBubble:y,stopPropagation:y,isTrusted:y});const w=(m=class extends b{constructor(e,t={}){super(e,t),h.set(this,void 0),f(this,h,t?.detail??null,"f")}initCustomEvent(e,t,i,n){throw new Error("Method not implemented.")}get detail(){return p(this,h,"f")}},h=new WeakMap,m);Object.defineProperties(w.prototype,{detail:y});const k=b,S=w;globalThis.Event??=k,globalThis.CustomEvent??=S;const E=new WeakMap,P=e=>{let t=E.get(e);return void 0===t&&E.set(e,t=new Map),t},M=class extends v{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(P(this)).map(([e,t])=>({name:e,value:t}))}get shadowRoot(){return"closed"===this.__shadowRootMode?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(e,t){P(this).set(e,String(t))}removeAttribute(e){P(this).delete(e)}toggleAttribute(e,t){return this.hasAttribute(e)?!(void 0===t||!t)||(this.removeAttribute(e),!1):!(void 0!==t&&!t)&&(this.setAttribute(e,""),!0)}hasAttribute(e){return P(this).has(e)}attachShadow(e){const t={host:this};return this.__shadowRootMode=e.mode,e&&"open"===e.mode&&(this.__shadowRoot=t),t}attachInternals(){if(null!==this.__internals)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");const e=new t(this);return this.__internals=e,e}getAttribute(e){return P(this).get(e)??null}},T=class extends M{};function A(e,t,i,n){var a,r=arguments.length,s=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,n);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(r<3?a(s):r>3?a(t,i,s):a(t,i))||s);return r>3&&s&&Object.defineProperty(t,i,s),s}function x(e,t,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(e):n?n.value:t.get(e)}globalThis.litServerRoot??=Object.defineProperty(new T,"localName",{get:()=>"lit-server-root"}),"undefined"==typeof HTMLElement&&(globalThis.HTMLElement=T),"function"==typeof SuppressedError&&SuppressedError;var I;!function(e){e.SDK="sdk",e.ML="ml",e.THIRD_PARTY_ANALYTICS="third_party_analytics",e.THIRD_PARTY_TRANSACTIONS="third_party_transactions",e.PAYWALL_PERSONALIZATION="paywall_personalization",e.ANONYMOUS_MODE_CAPABILITY="anonymous_allowed",e.LANGUAGE_MANAGEMENT="language_management",e.ENTITLEMENT_MANAGEMENT="entitlement_management"}(I||(I={}));const{NAMI_SDK_VERSION:C="3.3.2",PLATFORM_ID_REQUIRED:L="Platform ID is required",DEVICE_ID_REQUIRED:_="Device ID is required",EXTERNAL_ID_REQUIRED:D="External ID is required",SDK_NOT_INITIALIZED:R="SDK has not been initialized. Make sure to call Nami.configure() first!",CAMPAIGN_NOT_AVAILABLE:O="Campaign is not available",FLOW_SCREENS_NOT_AVAILABLE:N="Flow screens not available",UNABLE_TO_UPDATE_CDP_ID:W="Unable to update CDP id in anonymous mode",ANONYMOUS_MODE_ALREADY_ON:F="Anonymous mode is already turned on.",ANONYMOUS_MODE_ALREADY_OFF:$="Anonymous mode is already turned off.",DEVICE_ID_NOT_SET:j="Nami Device ID is not set",AUTH_DEVICE:z="nami_auth_device",NAMI_CONFIGURATION:B="nami_configuration",NAMI_PROFILE:U="nami_profile",API_CONFIG:H="api_config",API_CAMPAIGN_RULES:G="api_campaign_rules",API_PAYWALLS:V="api_paywalls",API_PRODUCTS:K="api_products",API_ACTIVE_ENTITLEMENTS:X="api_active_entitlements",SERVER_NAMI_ENTITLEMENTS:Y="server_active_entitlements",INITIAL_APP_CONFIG:q="initial_app_config",INITIAL_CAMPAIGN_RULES:J="initial_campaign_rules",INITIAL_PAYWALLS:Q="initial_paywalls",INITIAL_PRODUCTS:Z="initial_products",LOCAL_NAMI_ENTITLEMENTS:ee="local_active_entitlements",CUSTOMER_ATTRIBUTES_KEY_PREFIX:te="nami_cmr_attributes_",NAMI_CUSTOMER_JOURNEY_STATE:ie="nami_customer_journey_state",ANONYMOUS_MODE:ne="nami_anonymous_mode",ANONYMOUS_UUID:ae="nami_anonymous_uuid",KEY_SESSION_COUNTER:re="nami_session_counter",INITIAL_SESSION_COUNTER_VALUE:se=1,NAMI_LAST_IMPRESSION_ID:oe="nami_last_impression_id",NAMI_PURCHASE_IMPRESSION_ID:le="nami_purchase_impression_id",NAMI_LAUNCH_ID:de="nami_launch_id",NAMI_SESSION_ID:ue="nami_session_id",NAMI_LANGUAGE_CODE:ce="nami_language_code",NAMI_PURCHASE_CHANNEL:he="nami_purchase_channel",API_VERSION:me="v3",BASE_URL_PATH:fe=`sdk/${me}/platform`,BASE_URL:pe="https://app.namiml.com",BASE_STAGING_URL:ge="https://app-staging.namiml.com",CUSTOM_HOST_PREFIX:ve="namiAPIHost=",USE_STAGING_API:ye="useStagingAPI",EXTENDED_CLIENT_INFO_PREFIX:be="extendedClientInfo",EXTENDED_CLIENT_INFO_DELIMITER:we=":",VALIDATE_PRODUCT_GROUPS:ke="validateProductGroups",API_MAX_CALLS_LIMIT:Se=2,API_RETRY_DELAY_SEC:Ee=2,API_TIMEOUT_LIMIT:Pe=2e4,DEVICE_API_TIMEOUT_LIMIT:Me=3e3,STATUS_BAD_REQUEST:Te=400,STATUS_NOT_FOUND:Ae=404,STATUS_CONFLICT:xe=409,STATUS_INTERNAL_SERVER_ERROR:Ie=500,INITIAL_SUCCESS:Ce="Initial success",RECONFIG_SUCCESS:Le="Reconfig success",ALREADY_CONFIGURED:_e="Already configured",AVAILABLE_CAMPAIGNS_CHANGED:De="AvailableCampaignsChanged",PAYWALL_ACTION_EVENT:Re="PaywallActionEvent",AVAILABLE_ACTIVE_ENTITLEMENTS_CHANGED:Oe="AvailableActiveEntitlementsChanged",CUSTOMER_JOURNEY_STATE_CHANGED:Ne="CustomerJourneyStateChanged",SKU_TEXT_REGEX:We=/\$\{sku\.(\w+)(:\d+)?\}/g,VAR_REGEX:Fe=/\$\{\s*(\w+(\.[a-zA-Z\d_:${}-]{0,99})*?)\s*}/g,SMART_TEXT_PATTERN:$e="${"}={};var je;e.LogLevel=void 0,(je=e.LogLevel||(e.LogLevel={}))[je.DEBUG=1]="DEBUG",je[je.INFO=2]="INFO",je[je.WARN=3]="WARN",je[je.ERROR=4]="ERROR";const ze={debug:e.LogLevel.DEBUG,info:e.LogLevel.INFO,warn:e.LogLevel.WARN,error:e.LogLevel.ERROR};const Be=new class{constructor(){this.currentLogLevel=e.LogLevel.DEBUG,this.setLogger=t=>{this.currentLogLevel=t?ze[t]:e.LogLevel.WARN}}debug(t,...i){this.shouldLog(e.LogLevel.DEBUG)&&console.debug(this.formatMessage(e.LogLevel.DEBUG,t,...i))}info(t,...i){this.shouldLog(e.LogLevel.INFO)&&console.info(this.formatMessage(e.LogLevel.INFO,t,...i))}warn(t,...i){this.shouldLog(e.LogLevel.WARN)&&console.warn(this.formatMessage(e.LogLevel.WARN,t,...i))}error(t,...i){this.shouldLog(e.LogLevel.ERROR)&&console.error(this.formatMessage(e.LogLevel.ERROR,t,...i))}shouldLog(e){return e>=this.currentLogLevel}formatMessage(t,i,...n){const a=e.LogLevel[t];return`[${(new Date).toISOString()}] [${a}] ${i} ${n=n.map(e=>"object"==typeof e?JSON.stringify(e):e)}`}};function Ue(e){for(var t=-1,i=null==e?0:e.length,n=0,a=[];++t<i;){var r=e[t];r&&(a[n++]=r)}return a}function He(e,t){return e===t||e!=e&&t!=t}function Ge(e,t){for(var i=e.length;i--;)if(He(e[i][0],t))return i;return-1}var Ve=Array.prototype.splice;function Ke(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}Ke.prototype.clear=function(){this.__data__=[],this.size=0},Ke.prototype.delete=function(e){var t=this.__data__,i=Ge(t,e);return!(i<0)&&(i==t.length-1?t.pop():Ve.call(t,i,1),--this.size,!0)},Ke.prototype.get=function(e){var t=this.__data__,i=Ge(t,e);return i<0?void 0:t[i][1]},Ke.prototype.has=function(e){return Ge(this.__data__,e)>-1},Ke.prototype.set=function(e,t){var i=this.__data__,n=Ge(i,e);return n<0?(++this.size,i.push([e,t])):i[n][1]=t,this};var Xe="object"==typeof global&&global&&global.Object===Object&&global,Ye="object"==typeof self&&self&&self.Object===Object&&self,qe=Xe||Ye||Function("return this")(),Je=qe.Symbol,Qe=Object.prototype,Ze=Qe.hasOwnProperty,et=Qe.toString,tt=Je?Je.toStringTag:void 0;var it=Object.prototype.toString;var nt=Je?Je.toStringTag:void 0;function at(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":nt&&nt in Object(e)?function(e){var t=Ze.call(e,tt),i=e[tt];try{e[tt]=void 0;var n=!0}catch(e){}var a=et.call(e);return n&&(t?e[tt]=i:delete e[tt]),a}(e):function(e){return it.call(e)}(e)}function rt(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function st(e){if(!rt(e))return!1;var t=at(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var ot,lt=qe["__core-js_shared__"],dt=(ot=/[^.]+$/.exec(lt&<.keys&<.keys.IE_PROTO||""))?"Symbol(src)_1."+ot:"";var ut=Function.prototype.toString;function ct(e){if(null!=e){try{return ut.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var ht=/^\[object .+?Constructor\]$/,mt=Function.prototype,ft=Object.prototype,pt=mt.toString,gt=ft.hasOwnProperty,vt=RegExp("^"+pt.call(gt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function yt(e){return!(!rt(e)||(t=e,dt&&dt in t))&&(st(e)?vt:ht).test(ct(e));var t}function bt(e,t){var i=function(e,t){return null==e?void 0:e[t]}(e,t);return yt(i)?i:void 0}var wt=bt(qe,"Map"),kt=bt(Object,"create");var St=Object.prototype.hasOwnProperty;var Et=Object.prototype.hasOwnProperty;function Pt(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}function Mt(e,t){var i,n,a=e.__data__;return("string"==(n=typeof(i=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==i:null===i)?a["string"==typeof t?"string":"hash"]:a.map}function Tt(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}Pt.prototype.clear=function(){this.__data__=kt?kt(null):{},this.size=0},Pt.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Pt.prototype.get=function(e){var t=this.__data__;if(kt){var i=t[e];return"__lodash_hash_undefined__"===i?void 0:i}return St.call(t,e)?t[e]:void 0},Pt.prototype.has=function(e){var t=this.__data__;return kt?void 0!==t[e]:Et.call(t,e)},Pt.prototype.set=function(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=kt&&void 0===t?"__lodash_hash_undefined__":t,this},Tt.prototype.clear=function(){this.size=0,this.__data__={hash:new Pt,map:new(wt||Ke),string:new Pt}},Tt.prototype.delete=function(e){var t=Mt(this,e).delete(e);return this.size-=t?1:0,t},Tt.prototype.get=function(e){return Mt(this,e).get(e)},Tt.prototype.has=function(e){return Mt(this,e).has(e)},Tt.prototype.set=function(e,t){var i=Mt(this,e),n=i.size;return i.set(e,t),this.size+=i.size==n?0:1,this};function At(e){var t=this.__data__=new Ke(e);this.size=t.size}At.prototype.clear=function(){this.__data__=new Ke,this.size=0},At.prototype.delete=function(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i},At.prototype.get=function(e){return this.__data__.get(e)},At.prototype.has=function(e){return this.__data__.has(e)},At.prototype.set=function(e,t){var i=this.__data__;if(i instanceof Ke){var n=i.__data__;if(!wt||n.length<199)return n.push([e,t]),this.size=++i.size,this;i=this.__data__=new Tt(n)}return i.set(e,t),this.size=i.size,this};function xt(e){var t=-1,i=null==e?0:e.length;for(this.__data__=new Tt;++t<i;)this.add(e[t])}function It(e,t){for(var i=-1,n=null==e?0:e.length;++i<n;)if(t(e[i],i,e))return!0;return!1}function Ct(e,t){return e.has(t)}xt.prototype.add=xt.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},xt.prototype.has=function(e){return this.__data__.has(e)};function Lt(e,t,i,n,a,r){var s=1&i,o=e.length,l=t.length;if(o!=l&&!(s&&l>o))return!1;var d=r.get(e),u=r.get(t);if(d&&u)return d==t&&u==e;var c=-1,h=!0,m=2&i?new xt:void 0;for(r.set(e,t),r.set(t,e);++c<o;){var f=e[c],p=t[c];if(n)var g=s?n(p,f,c,t,e,r):n(f,p,c,e,t,r);if(void 0!==g){if(g)continue;h=!1;break}if(m){if(!It(t,function(e,t){if(!Ct(m,t)&&(f===e||a(f,e,i,n,r)))return m.push(t)})){h=!1;break}}else if(f!==p&&!a(f,p,i,n,r)){h=!1;break}}return r.delete(e),r.delete(t),h}var _t=qe.Uint8Array;function Dt(e){var t=-1,i=Array(e.size);return e.forEach(function(e,n){i[++t]=[n,e]}),i}function Rt(e){var t=-1,i=Array(e.size);return e.forEach(function(e){i[++t]=e}),i}var Ot=Je?Je.prototype:void 0,Nt=Ot?Ot.valueOf:void 0;var Wt=Array.isArray;var Ft=Object.prototype.propertyIsEnumerable,$t=Object.getOwnPropertySymbols,jt=$t?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var i=-1,n=null==e?0:e.length,a=0,r=[];++i<n;){var s=e[i];t(s,i,e)&&(r[a++]=s)}return r}($t(e),function(t){return Ft.call(e,t)}))}:function(){return[]};function zt(e){return null!=e&&"object"==typeof e}function Bt(e){return zt(e)&&"[object Arguments]"==at(e)}var Ut=Object.prototype,Ht=Ut.hasOwnProperty,Gt=Ut.propertyIsEnumerable,Vt=Bt(function(){return arguments}())?Bt:function(e){return zt(e)&&Ht.call(e,"callee")&&!Gt.call(e,"callee")};var Kt="object"==typeof e&&e&&!e.nodeType&&e,Xt=Kt&&"object"==typeof module&&module&&!module.nodeType&&module,Yt=Xt&&Xt.exports===Kt?qe.Buffer:void 0,qt=(Yt?Yt.isBuffer:void 0)||function(){return!1},Jt=/^(?:0|[1-9]\d*)$/;function Qt(e,t){var i=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==i||"symbol"!=i&&Jt.test(e))&&e>-1&&e%1==0&&e<t}function Zt(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}var ei={};function ti(e){return function(t){return e(t)}}ei["[object Float32Array]"]=ei["[object Float64Array]"]=ei["[object Int8Array]"]=ei["[object Int16Array]"]=ei["[object Int32Array]"]=ei["[object Uint8Array]"]=ei["[object Uint8ClampedArray]"]=ei["[object Uint16Array]"]=ei["[object Uint32Array]"]=!0,ei["[object Arguments]"]=ei["[object Array]"]=ei["[object ArrayBuffer]"]=ei["[object Boolean]"]=ei["[object DataView]"]=ei["[object Date]"]=ei["[object Error]"]=ei["[object Function]"]=ei["[object Map]"]=ei["[object Number]"]=ei["[object Object]"]=ei["[object RegExp]"]=ei["[object Set]"]=ei["[object String]"]=ei["[object WeakMap]"]=!1;var ii="object"==typeof e&&e&&!e.nodeType&&e,ni=ii&&"object"==typeof module&&module&&!module.nodeType&&module,ai=ni&&ni.exports===ii&&Xe.process,ri=function(){try{var e=ni&&ni.require&&ni.require("util").types;return e||ai&&ai.binding&&ai.binding("util")}catch(e){}}(),si=ri&&ri.isTypedArray,oi=si?ti(si):function(e){return zt(e)&&Zt(e.length)&&!!ei[at(e)]},li=Object.prototype.hasOwnProperty;function di(e,t){var i=Wt(e),n=!i&&Vt(e),a=!i&&!n&&qt(e),r=!i&&!n&&!a&&oi(e),s=i||n||a||r,o=s?function(e,t){for(var i=-1,n=Array(e);++i<e;)n[i]=t(i);return n}(e.length,String):[],l=o.length;for(var d in e)!li.call(e,d)||s&&("length"==d||a&&("offset"==d||"parent"==d)||r&&("buffer"==d||"byteLength"==d||"byteOffset"==d)||Qt(d,l))||o.push(d);return o}var ui=Object.prototype;function ci(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ui)}function hi(e,t){return function(i){return e(t(i))}}var mi=hi(Object.keys,Object),fi=Object.prototype.hasOwnProperty;function pi(e){return null!=(t=e)&&Zt(t.length)&&!st(t)?di(e):function(e){if(!ci(e))return mi(e);var t=[];for(var i in Object(e))fi.call(e,i)&&"constructor"!=i&&t.push(i);return t}(e);var t}function gi(e){return function(e,t,i){var n=t(e);return Wt(e)?n:function(e,t){for(var i=-1,n=t.length,a=e.length;++i<n;)e[a+i]=t[i];return e}(n,i(e))}(e,pi,jt)}var vi=Object.prototype.hasOwnProperty;var yi=bt(qe,"DataView"),bi=bt(qe,"Promise"),wi=bt(qe,"Set"),ki=bt(qe,"WeakMap"),Si="[object Map]",Ei="[object Promise]",Pi="[object Set]",Mi="[object WeakMap]",Ti="[object DataView]",Ai=ct(yi),xi=ct(wt),Ii=ct(bi),Ci=ct(wi),Li=ct(ki),_i=at;(yi&&_i(new yi(new ArrayBuffer(1)))!=Ti||wt&&_i(new wt)!=Si||bi&&_i(bi.resolve())!=Ei||wi&&_i(new wi)!=Pi||ki&&_i(new ki)!=Mi)&&(_i=function(e){var t=at(e),i="[object Object]"==t?e.constructor:void 0,n=i?ct(i):"";if(n)switch(n){case Ai:return Ti;case xi:return Si;case Ii:return Ei;case Ci:return Pi;case Li:return Mi}return t});var Di="[object Arguments]",Ri="[object Array]",Oi="[object Object]",Ni=Object.prototype.hasOwnProperty;function Wi(e,t,i,n,a,r){var s=Wt(e),o=Wt(t),l=s?Ri:_i(e),d=o?Ri:_i(t),u=(l=l==Di?Oi:l)==Oi,c=(d=d==Di?Oi:d)==Oi,h=l==d;if(h&&qt(e)){if(!qt(t))return!1;s=!0,u=!1}if(h&&!u)return r||(r=new At),s||oi(e)?Lt(e,t,i,n,a,r):function(e,t,i,n,a,r,s){switch(i){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!r(new _t(e),new _t(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return He(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var o=Dt;case"[object Set]":var l=1&n;if(o||(o=Rt),e.size!=t.size&&!l)return!1;var d=s.get(e);if(d)return d==t;n|=2,s.set(e,t);var u=Lt(o(e),o(t),n,a,r,s);return s.delete(e),u;case"[object Symbol]":if(Nt)return Nt.call(e)==Nt.call(t)}return!1}(e,t,l,i,n,a,r);if(!(1&i)){var m=u&&Ni.call(e,"__wrapped__"),f=c&&Ni.call(t,"__wrapped__");if(m||f){var p=m?e.value():e,g=f?t.value():t;return r||(r=new At),a(p,g,i,n,r)}}return!!h&&(r||(r=new At),function(e,t,i,n,a,r){var s=1&i,o=gi(e),l=o.length;if(l!=gi(t).length&&!s)return!1;for(var d=l;d--;){var u=o[d];if(!(s?u in t:vi.call(t,u)))return!1}var c=r.get(e),h=r.get(t);if(c&&h)return c==t&&h==e;var m=!0;r.set(e,t),r.set(t,e);for(var f=s;++d<l;){var p=e[u=o[d]],g=t[u];if(n)var v=s?n(g,p,u,t,e,r):n(p,g,u,e,t,r);if(!(void 0===v?p===g||a(p,g,i,n,r):v)){m=!1;break}f||(f="constructor"==u)}if(m&&!f){var y=e.constructor,b=t.constructor;y==b||!("constructor"in e)||!("constructor"in t)||"function"==typeof y&&y instanceof y&&"function"==typeof b&&b instanceof b||(m=!1)}return r.delete(e),r.delete(t),m}(e,t,i,n,a,r))}function Fi(e,t,i,n,a){return e===t||(null==e||null==t||!zt(e)&&!zt(t)?e!=e&&t!=t:Wi(e,t,i,n,Fi,a))}function $i(e){return e==e&&!rt(e)}function ji(e,t){return function(i){return null!=i&&(i[e]===t&&(void 0!==t||e in Object(i)))}}function zi(e){var t=function(e){for(var t=pi(e),i=t.length;i--;){var n=t[i],a=e[n];t[i]=[n,a,$i(a)]}return t}(e);return 1==t.length&&t[0][2]?ji(t[0][0],t[0][1]):function(i){return i===e||function(e,t,i,n){var a=i.length,r=a;if(null==e)return!r;for(e=Object(e);a--;){var s=i[a];if(s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++a<r;){var o=(s=i[a])[0],l=e[o],d=s[1];if(s[2]){if(void 0===l&&!(o in e))return!1}else if(!Fi(d,l,3,n,new At))return!1}return!0}(i,0,t)}}function Bi(e){return"symbol"==typeof e||zt(e)&&"[object Symbol]"==at(e)}var Ui=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Hi=/^\w*$/;function Gi(e,t){if(Wt(e))return!1;var i=typeof e;return!("number"!=i&&"symbol"!=i&&"boolean"!=i&&null!=e&&!Bi(e))||(Hi.test(e)||!Ui.test(e)||null!=t&&e in Object(t))}function Vi(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var i=function(){var n=arguments,a=t?t.apply(this,n):n[0],r=i.cache;if(r.has(a))return r.get(a);var s=e.apply(this,n);return i.cache=r.set(a,s)||r,s};return i.cache=new(Vi.Cache||Tt),i}Vi.Cache=Tt;var Ki,Xi,Yi,qi=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ji=/\\(\\)?/g,Qi=(Ki=function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(qi,function(e,i,n,a){t.push(n?a.replace(Ji,"$1"):i||e)}),t},Xi=Vi(Ki,function(e){return 500===Yi.size&&Yi.clear(),e}),Yi=Xi.cache,Xi);var Zi=Je?Je.prototype:void 0,en=Zi?Zi.toString:void 0;function tn(e){if("string"==typeof e)return e;if(Wt(e))return function(e,t){for(var i=-1,n=null==e?0:e.length,a=Array(n);++i<n;)a[i]=t(e[i],i,e);return a}(e,tn)+"";if(Bi(e))return en?en.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function nn(e){return null==e?"":tn(e)}function an(e,t){return Wt(e)?e:Gi(e,t)?[e]:Qi(nn(e))}function rn(e){if("string"==typeof e||Bi(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function sn(e,t){for(var i=0,n=(t=an(t,e)).length;null!=e&&i<n;)e=e[rn(t[i++])];return i&&i==n?e:void 0}function on(e,t){return null!=e&&t in Object(e)}function ln(e,t){return null!=e&&function(e,t,i){for(var n=-1,a=(t=an(t,e)).length,r=!1;++n<a;){var s=rn(t[n]);if(!(r=null!=e&&i(e,s)))break;e=e[s]}return r||++n!=a?r:!!(a=null==e?0:e.length)&&Zt(a)&&Qt(s,a)&&(Wt(e)||Vt(e))}(e,t,on)}function dn(e,t){return Gi(e)&&$i(t)?ji(rn(e),t):function(i){var n=function(e,t,i){var n=null==e?void 0:sn(e,t);return void 0===n?i:n}(i,e);return void 0===n&&n===t?ln(i,e):Fi(t,n,3)}}function un(e){return e}function cn(e){return Gi(e)?(t=rn(e),function(e){return null==e?void 0:e[t]}):function(e){return function(t){return sn(t,e)}}(e);var t}function hn(e){return e!=e}function mn(e,t){return!!(null==e?0:e.length)&&function(e,t,i){return t==t?function(e,t,i){for(var n=i-1,a=e.length;++n<a;)if(e[n]===t)return n;return-1}(e,t,i):function(e,t,i){for(var n=e.length,a=i+-1;++a<n;)if(t(e[a],a,e))return a;return-1}(e,hn,i)}(e,t,0)>-1}var fn=wi&&1/Rt(new wi([,-0]))[1]==1/0?function(e){return new wi(e)}:function(){};function pn(e,t){return e&&e.length?function(e,t,i){var n=-1,a=mn,r=e.length,s=!0,o=[],l=o;if(r>=200){var d=t?null:fn(e);if(d)return Rt(d);s=!1,a=Ct,l=new xt}else l=t?[]:o;e:for(;++n<r;){var u=e[n],c=t?t(u):u;if(u=0!==u?u:0,s&&c==c){for(var h=l.length;h--;)if(l[h]===c)continue e;t&&l.push(c),o.push(u)}else a(l,c,i)||(l!==o&&l.push(c),o.push(u))}return o}(e,"function"==typeof(i=t)?i:null==i?un:"object"==typeof i?Wt(i)?dn(i[0],i[1]):zi(i):cn(i)):[];var i}const gn=new class{constructor(){this.memoryStore={}}setDevice(e){this.setItem(z,e)}getDevice(){return this.getItem(z)}resetDevice(){this.resetItem(z)}getAnonymousMode(){return this.getItem(ne)||!1}setAnonymousMode(e){this.setItem(ne,e)}clearAnonymousMode(){this.resetItem(ne)}setAppConfig(e,t){this.setItem(e,t)}getAppConfig(e){return this.getItem(e)}setLanguageCode(e){this.setItem(ce,e||"en")}getLanguageCode(){return this.getItem(ce)||"en"}setCampaignRules(e,t){e!==J?this.setItem(e,t):this.memoryStore[J]=JSON.stringify(t)}getCampaignRules(e){return e===J?this.memoryStore[J]?JSON.parse(this.memoryStore[J]):null:this.getItem(e)}setPaywalls(e,t){e!==Q?this.setItem(e,t):this.memoryStore[Q]=JSON.stringify(t)}getPaywalls(e){return e===Q?this.memoryStore[Q]?JSON.parse(this.memoryStore[Q]):null:this.getItem(e)}setActiveEntitlements(e,t){this.setItem(e,t)}getActiveEntitlements(e){return this.getItem(e)||[]}setNamiEntitlements(e,t){this.setItem(e,t)}getNamiEntitlements(e){return this.getItem(e)||[]}setProducts(e,t){this.setItem(e,t)}getProducts(e){return this.getItem(e)}getCachedProducts(){const e=this.getItem(K)??[];return pn(Ue([...this.getItem(Z)??[],...e]),"sku_ref_id")}setNamiConfig(e){this.setItem(B,e)}getNamiConfig(){return this.getItem(B)}setCustomerAttribute(e,t){this.setItem(te+e,t)}getCustomerAttribute(e){return this.getItem(te+e)}getAllCustomerAttributes(){return Object.entries(localStorage).filter(([e])=>e.includes(te)).map(([e,t])=>e.replace(te,"")+":"+t)}getAllCustomerAttributesKeys(){return Object.keys(localStorage).filter(e=>e.includes(te)).map(e=>e.replace(te,""))}clearCustomerAttribute(e){const t=te+e,i=this.getItem(t);return i&&this.resetItem(t),!!i}clearAllCustomerAttributes(){Object.keys(localStorage).filter(e=>e.includes(te)).map(e=>this.resetItem(e))}setNamiProfile(e){this.setItem(U,e)}getNamiProfile(){return this.getItem(U)}removeNamiProfile(){this.resetItem(U)}setCustomerJourneyState(e){this.setItem(ie,e)}getCustomerJourneyState(){return this.getItem(ie)}setSessionCounter(){const e=this.getItem(re),t=e?parseInt(e):se||se;this.setItem(re,t+1)}getSessionCounter(){const e=this.getItem(re);return e?parseInt(e):se}setLastImpressionId(e){this.setItem(oe,e)}getLastImpressionId(){return this.getItem(oe)??""}setPurchaseImpression(){const e=this.getLastImpressionId()??"";this.setItem(le,e)}getPurchaseImpression(){return this.getItem(le)??""}setSessionId(e){e&&this.setItem(ue,e)}getSessionId(){return this.getItem(ue)??""}clearSessionId(){this.resetItem(ue)}setLaunchId(e){e&&this.setItem(de,e)}getLaunchId(){return this.getItem(de)??""}clearLaunchId(){this.resetItem(de)}setPurchaseChannel(e){e&&this.setItem(he,e)}getPurchaseChannel(){return this.getItem(he)}getAnonymousUUID(){return this.getItem(ae)}setAnonymousUUID(e){this.setItem(ae,e)}clearAnonymousUUID(){this.resetItem(ae)}setItem(e,t){let i;try{i=JSON.stringify(t)}catch(t){return void Be.error(`Serialization failed for ${e}`,t)}try{localStorage.setItem(e,i)}catch(t){Be.error("Error setting item in localStorage:",t),this.resetItem(e),this.memoryStore[e]=i}}getItem(e){try{const t=localStorage.getItem(e);if(null!==t)return JSON.parse(t)}catch(t){"undefined"!=typeof window&&Be.error("Error getting item from localStorage:",e,": ",t)}const t=this.memoryStore[e];return null!=t?JSON.parse(t):null}resetItem(e){try{localStorage.removeItem(e)}catch(t){"undefined"!=typeof window&&Be.error("Error removing item from localStorage:",e,": ",t)}delete this.memoryStore[e]}clear(){try{localStorage.clear()}catch(e){Be.error("Error clearing localStorage:",e)}this.memoryStore={}}};class vn extends Error{constructor(e,t){super(t),this.statusCode=e,this.status=e,this.message=`RetryLimitExceededError: ${this.message}`}}class yn extends Error{}class bn extends yn{constructor(){super(),this.status=409,this.name="ConflictError",this.message="ConflictError: Server responded with conflict"}}class wn extends Error{constructor(){super(R)}}class kn extends Error{constructor(){super(L)}}class Sn extends Error{constructor(){super(_)}}class En extends Error{constructor(){super(D)}}class Pn extends Error{constructor(){super(O)}}class Mn extends Error{constructor(){super(N)}}class Tn extends Error{constructor(){super(F)}}class An extends Error{constructor(){super($)}}class xn extends Error{constructor(){super($)}}class In extends Error{constructor(){super(W)}}class Cn extends yn{constructor(e){super(e),this.message=`BadRequestError: ${this.message}`}}class Ln extends yn{constructor(e){super(e),this.message=`NotFoundError: ${this.message}`}}class _n extends yn{constructor(e,t){super(t),this.statusCode=e,this.message=`ClientError: ${this.message}`}}class Dn extends yn{constructor(e){super(e),this.message=`ServerError: ${this.message}`}}const Rn=(e,t)=>{if(e==Te)throw new Cn(t);if(e==Ae)throw new Ln(t);if(e==xe)throw new bn;if(e>Te&&e<Ie)throw new _n(e,t);if(e>=Ie)throw new Dn(t)};async function On(e,t,i=Pe,n=Se){let a=0;const r=async()=>{const s=await async function(e,t={},i){const n=new AbortController,a=setTimeout(()=>n.abort(),i);t.signal=n.signal;const r=await fetch(e,t);return clearTimeout(a),r}(e,t,i);if(!s.ok){if(s.status==xe)throw new bn;if(a++,a<=n){const e=1e3*(a+Ee);return await new Promise(t=>setTimeout(t,e)),r()}throw new vn(s.status,`Request failed after ${n} retries`)}return s};return(await r()).json()}function Nn(e){let t=e.length;for(;--t>=0;)e[t]=0}Nn(new Array(576));Nn(new Array(60));Nn(new Array(512));Nn(new Array(256));Nn(new Array(29));Nn(new Array(30));var Wn=(e,t,i,n)=>{let a=65535&e,r=e>>>16&65535,s=0;for(;0!==i;){s=i>2e3?2e3:i,i-=s;do{a=a+t[n++]|0,r=r+a|0}while(--s);a%=65521,r%=65521}return a|r<<16};const Fn=new Uint32Array((()=>{let e,t=[];for(var i=0;i<256;i++){e=i;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t})());var $n=(e,t,i,n)=>{const a=Fn,r=n+i;e^=-1;for(let i=n;i<r;i++)e=e>>>8^a[255&(e^t[i])];return-1^e},jn={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},zn={Z_NO_FLUSH:0,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_DEFLATED:8};const Bn=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Un=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const i=t.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const t in i)Bn(i,t)&&(e[t]=i[t])}}return e},Hn=e=>{let t=0;for(let i=0,n=e.length;i<n;i++)t+=e[i].length;const i=new Uint8Array(t);for(let t=0,n=0,a=e.length;t<a;t++){let a=e[t];i.set(a,n),n+=a.length}return i};let Gn=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){Gn=!1}const Vn=new Uint8Array(256);for(let e=0;e<256;e++)Vn[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Vn[254]=Vn[254]=1;var Kn=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,i,n,a,r,s=e.length,o=0;for(a=0;a<s;a++)i=e.charCodeAt(a),55296==(64512&i)&&a+1<s&&(n=e.charCodeAt(a+1),56320==(64512&n)&&(i=65536+(i-55296<<10)+(n-56320),a++)),o+=i<128?1:i<2048?2:i<65536?3:4;for(t=new Uint8Array(o),r=0,a=0;r<o;a++)i=e.charCodeAt(a),55296==(64512&i)&&a+1<s&&(n=e.charCodeAt(a+1),56320==(64512&n)&&(i=65536+(i-55296<<10)+(n-56320),a++)),i<128?t[r++]=i:i<2048?(t[r++]=192|i>>>6,t[r++]=128|63&i):i<65536?(t[r++]=224|i>>>12,t[r++]=128|i>>>6&63,t[r++]=128|63&i):(t[r++]=240|i>>>18,t[r++]=128|i>>>12&63,t[r++]=128|i>>>6&63,t[r++]=128|63&i);return t},Xn=(e,t)=>{const i=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let n,a;const r=new Array(2*i);for(a=0,n=0;n<i;){let t=e[n++];if(t<128){r[a++]=t;continue}let s=Vn[t];if(s>4)r[a++]=65533,n+=s-1;else{for(t&=2===s?31:3===s?15:7;s>1&&n<i;)t=t<<6|63&e[n++],s--;s>1?r[a++]=65533:t<65536?r[a++]=t:(t-=65536,r[a++]=55296|t>>10&1023,r[a++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&Gn)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let i="";for(let n=0;n<t;n++)i+=String.fromCharCode(e[n]);return i})(r,a)},Yn=(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let i=t-1;for(;i>=0&&128==(192&e[i]);)i--;return i<0||0===i?t:i+Vn[e[i]]>t?i:t};var qn=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const Jn=16209;var Qn=function(e,t){let i,n,a,r,s,o,l,d,u,c,h,m,f,p,g,v,y,b,w,k,S,E,P,M;const T=e.state;i=e.next_in,P=e.input,n=i+(e.avail_in-5),a=e.next_out,M=e.output,r=a-(t-e.avail_out),s=a+(e.avail_out-257),o=T.dmax,l=T.wsize,d=T.whave,u=T.wnext,c=T.window,h=T.hold,m=T.bits,f=T.lencode,p=T.distcode,g=(1<<T.lenbits)-1,v=(1<<T.distbits)-1;e:do{m<15&&(h+=P[i++]<<m,m+=8,h+=P[i++]<<m,m+=8),y=f[h&g];t:for(;;){if(b=y>>>24,h>>>=b,m-=b,b=y>>>16&255,0===b)M[a++]=65535&y;else{if(!(16&b)){if(64&b){if(32&b){T.mode=16191;break e}e.msg="invalid literal/length code",T.mode=Jn;break e}y=f[(65535&y)+(h&(1<<b)-1)];continue t}for(w=65535&y,b&=15,b&&(m<b&&(h+=P[i++]<<m,m+=8),w+=h&(1<<b)-1,h>>>=b,m-=b),m<15&&(h+=P[i++]<<m,m+=8,h+=P[i++]<<m,m+=8),y=p[h&v];;){if(b=y>>>24,h>>>=b,m-=b,b=y>>>16&255,16&b){if(k=65535&y,b&=15,m<b&&(h+=P[i++]<<m,m+=8,m<b&&(h+=P[i++]<<m,m+=8)),k+=h&(1<<b)-1,k>o){e.msg="invalid distance too far back",T.mode=Jn;break e}if(h>>>=b,m-=b,b=a-r,k>b){if(b=k-b,b>d&&T.sane){e.msg="invalid distance too far back",T.mode=Jn;break e}if(S=0,E=c,0===u){if(S+=l-b,b<w){w-=b;do{M[a++]=c[S++]}while(--b);S=a-k,E=M}}else if(u<b){if(S+=l+u-b,b-=u,b<w){w-=b;do{M[a++]=c[S++]}while(--b);if(S=0,u<w){b=u,w-=b;do{M[a++]=c[S++]}while(--b);S=a-k,E=M}}}else if(S+=u-b,b<w){w-=b;do{M[a++]=c[S++]}while(--b);S=a-k,E=M}for(;w>2;)M[a++]=E[S++],M[a++]=E[S++],M[a++]=E[S++],w-=3;w&&(M[a++]=E[S++],w>1&&(M[a++]=E[S++]))}else{S=a-k;do{M[a++]=M[S++],M[a++]=M[S++],M[a++]=M[S++],w-=3}while(w>2);w&&(M[a++]=M[S++],w>1&&(M[a++]=M[S++]))}break}if(64&b){e.msg="invalid distance code",T.mode=Jn;break e}y=p[(65535&y)+(h&(1<<b)-1)]}}break}}while(i<n&&a<s);w=m>>3,i-=w,m-=w<<3,h&=(1<<m)-1,e.next_in=i,e.next_out=a,e.avail_in=i<n?n-i+5:5-(i-n),e.avail_out=a<s?s-a+257:257-(a-s),T.hold=h,T.bits=m};const Zn=15,ea=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),ta=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),ia=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),na=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var aa=(e,t,i,n,a,r,s,o)=>{const l=o.bits;let d,u,c,h,m,f,p=0,g=0,v=0,y=0,b=0,w=0,k=0,S=0,E=0,P=0,M=null;const T=new Uint16Array(16),A=new Uint16Array(16);let x,I,C,L=null;for(p=0;p<=Zn;p++)T[p]=0;for(g=0;g<n;g++)T[t[i+g]]++;for(b=l,y=Zn;y>=1&&0===T[y];y--);if(b>y&&(b=y),0===y)return a[r++]=20971520,a[r++]=20971520,o.bits=1,0;for(v=1;v<y&&0===T[v];v++);for(b<v&&(b=v),S=1,p=1;p<=Zn;p++)if(S<<=1,S-=T[p],S<0)return-1;if(S>0&&(0===e||1!==y))return-1;for(A[1]=0,p=1;p<Zn;p++)A[p+1]=A[p]+T[p];for(g=0;g<n;g++)0!==t[i+g]&&(s[A[t[i+g]]++]=g);if(0===e?(M=L=s,f=20):1===e?(M=ea,L=ta,f=257):(M=ia,L=na,f=0),P=0,g=0,p=v,m=r,w=b,k=0,c=-1,E=1<<b,h=E-1,1===e&&E>852||2===e&&E>592)return 1;for(;;){x=p-k,s[g]+1<f?(I=0,C=s[g]):s[g]>=f?(I=L[s[g]-f],C=M[s[g]-f]):(I=96,C=0),d=1<<p-k,u=1<<w,v=u;do{u-=d,a[m+(P>>k)+u]=x<<24|I<<16|C}while(0!==u);for(d=1<<p-1;P&d;)d>>=1;if(0!==d?(P&=d-1,P+=d):P=0,g++,0===--T[p]){if(p===y)break;p=t[i+s[g]]}if(p>b&&(P&h)!==c){for(0===k&&(k=b),m+=v,w=p-k,S=1<<w;w+k<y&&(S-=T[w+k],!(S<=0));)w++,S<<=1;if(E+=1<<w,1===e&&E>852||2===e&&E>592)return 1;c=P&h,a[c]=b<<24|w<<16|m-r}}return 0!==P&&(a[m+P]=p-k<<24|64<<16),o.bits=b,0};const{Z_FINISH:ra,Z_BLOCK:sa,Z_TREES:oa,Z_OK:la,Z_STREAM_END:da,Z_NEED_DICT:ua,Z_STREAM_ERROR:ca,Z_DATA_ERROR:ha,Z_MEM_ERROR:ma,Z_BUF_ERROR:fa,Z_DEFLATED:pa}=zn,ga=16180,va=16190,ya=16191,ba=16192,wa=16194,ka=16199,Sa=16200,Ea=16206,Pa=16209,Ma=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function Ta(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Aa=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<ga||t.mode>16211?1:0},xa=e=>{if(Aa(e))return ca;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=ga,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,la},Ia=e=>{if(Aa(e))return ca;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,xa(e)},Ca=(e,t)=>{let i;if(Aa(e))return ca;const n=e.state;return t<0?(i=0,t=-t):(i=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?ca:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=i,n.wbits=t,Ia(e))},La=(e,t)=>{if(!e)return ca;const i=new Ta;e.state=i,i.strm=e,i.window=null,i.mode=ga;const n=Ca(e,t);return n!==la&&(e.state=null),n};let _a,Da,Ra=!0;const Oa=e=>{if(Ra){_a=new Int32Array(512),Da=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(aa(1,e.lens,0,288,_a,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;aa(2,e.lens,0,32,Da,0,e.work,{bits:5}),Ra=!1}e.lencode=_a,e.lenbits=9,e.distcode=Da,e.distbits=5},Na=(e,t,i,n)=>{let a;const r=e.state;return null===r.window&&(r.wsize=1<<r.wbits,r.wnext=0,r.whave=0,r.window=new Uint8Array(r.wsize)),n>=r.wsize?(r.window.set(t.subarray(i-r.wsize,i),0),r.wnext=0,r.whave=r.wsize):(a=r.wsize-r.wnext,a>n&&(a=n),r.window.set(t.subarray(i-n,i-n+a),r.wnext),(n-=a)?(r.window.set(t.subarray(i-n,i),0),r.wnext=n,r.whave=r.wsize):(r.wnext+=a,r.wnext===r.wsize&&(r.wnext=0),r.whave<r.wsize&&(r.whave+=a))),0};var Wa=(e,t)=>{let i,n,a,r,s,o,l,d,u,c,h,m,f,p,g,v,y,b,w,k,S,E,P=0;const M=new Uint8Array(4);let T,A;const x=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Aa(e)||!e.output||!e.input&&0!==e.avail_in)return ca;i=e.state,i.mode===ya&&(i.mode=ba),s=e.next_out,a=e.output,l=e.avail_out,r=e.next_in,n=e.input,o=e.avail_in,d=i.hold,u=i.bits,c=o,h=l,E=la;e:for(;;)switch(i.mode){case ga:if(0===i.wrap){i.mode=ba;break}for(;u<16;){if(0===o)break e;o--,d+=n[r++]<<u,u+=8}if(2&i.wrap&&35615===d){0===i.wbits&&(i.wbits=15),i.check=0,M[0]=255&d,M[1]=d>>>8&255,i.check=$n(i.check,M,2,0),d=0,u=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&d)<<8)+(d>>8))%31){e.msg="incorrect header check",i.mode=Pa;break}if((15&d)!==pa){e.msg="unknown compression method",i.mode=Pa;break}if(d>>>=4,u-=4,S=8+(15&d),0===i.wbits&&(i.wbits=S),S>15||S>i.wbits){e.msg="invalid window size",i.mode=Pa;break}i.dmax=1<<i.wbits,i.flags=0,e.adler=i.check=1,i.mode=512&d?16189:ya,d=0,u=0;break;case 16181:for(;u<16;){if(0===o)break e;o--,d+=n[r++]<<u,u+=8}if(i.flags=d,(255&i.flags)!==pa){e.msg="unknown compression method",i.mode=Pa;break}if(57344&i.flags){e.msg="unknown header flags set",i.mode=Pa;break}i.head&&(i.head.text=d>>8&1),512&i.flags&&4&i.wrap&&(M[0]=255&d,M[1]=d>>>8&255,i.check=$n(i.check,M,2,0)),d=0,u=0,i.mode=16182;case 16182:for(;u<32;){if(0===o)break e;o--,d+=n[r++]<<u,u+=8}i.head&&(i.head.time=d),512&i.flags&&4&i.wrap&&(M[0]=255&d,M[1]=d>>>8&255,M[2]=d>>>16&255,M[3]=d>>>24&255,i.check=$n(i.check,M,4,0)),d=0,u=0,i.mode=16183;case 16183:for(;u<16;){if(0===o)break e;o--,d+=n[r++]<<u,u+=8}i.head&&(i.head.xflags=255&d,i.head.os=d>>8),512&i.flags&&4&i.wrap&&(M[0]=255&d,M[1]=d>>>8&255,i.check=$n(i.check,M,2,0)),d=0,u=0,i.mode=16184;case 16184:if(1024&i.flags){for(;u<16;){if(0===o)break e;o--,d+=n[r++]<<u,u+=8}i.length=d,i.head&&(i.head.extra_len=d),512&i.flags&&4&i.wrap&&(M[0]=255&d,M[1]=d>>>8&255,i.check=$n(i.check,M,2,0)),d=0,u=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(m=i.length,m>o&&(m=o),m&&(i.head&&(S=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(n.subarray(r,r+m),S)),512&i.flags&&4&i.wrap&&(i.check=$n(i.check,n,m,r)),o-=m,r+=m,i.length-=m),i.length))break e;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===o)break e;m=0;do{S=n[r+m++],i.head&&S&&i.length<65536&&(i.head.name+=String.fromCharCode(S))}while(S&&m<o);if(512&i.flags&&4&i.wrap&&(i.check=$n(i.check,n,m,r)),o-=m,r+=m,S)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=16187;case 16187:if(4096&i.flags){if(0===o)break e;m=0;do{S=n[r+m++],i.head&&S&&i.length<65536&&(i.head.comment+=String.fromCharCode(S))}while(S&&m<o);if(512&i.flags&&4&i.wrap&&(i.check=$n(i.check,n,m,r)),o-=m,r+=m,S)break e}else i.head&&(i.head.comment=null);i.mode=16188;case 16188:if(512&i.flags){for(;u<16;){if(0===o)break e;o--,d+=n[r++]<<u,u+=8}if(4&i.wrap&&d!==(65535&i.check)){e.msg="header crc mismatch",i.mode=Pa;break}d=0,u=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=ya;break;case 16189:for(;u<32;){if(0===o)break e;o--,d+=n[r++]<<u,u+=8}e.adler=i.check=Ma(d),d=0,u=0,i.mode=va;case va:if(0===i.havedict)return e.next_out=s,e.avail_out=l,e.next_in=r,e.avail_in=o,i.hold=d,i.bits=u,ua;e.adler=i.check=1,i.mode=ya;case ya:if(t===sa||t===oa)break e;case ba:if(i.last){d>>>=7&u,u-=7&u,i.mode=Ea;break}for(;u<3;){if(0===o)break e;o--,d+=n[r++]<<u,u+=8}switch(i.last=1&d,d>>>=1,u-=1,3&d){case 0:i.mode=16193;break;case 1:if(Oa(i),i.mode=ka,t===oa){d>>>=2,u-=2;break e}break;case 2:i.mode=16196;break;case 3:e.msg="invalid block type",i.mode=Pa}d>>>=2,u-=2;break;case 16193:for(d>>>=7&u,u-=7&u;u<32;){if(0===o)break e;o--,d+=n[r++]<<u,u+=8}if((65535&d)!=(d>>>16^65535)){e.msg="invalid stored block lengths",i.mode=Pa;break}if(i.length=65535&d,d=0,u=0,i.mode=wa,t===oa)break e;case wa:i.mode=16195;case 16195:if(m=i.length,m){if(m>o&&(m=o),m>l&&(m=l),0===m)break e;a.set(n.subarray(r,r+m),s),o-=m,r+=m,l-=m,s+=m,i.length-=m;break}i.mode=ya;break;case 16196:for(;u<14;){if(0===o)break e;o--,d+=n[r++]<<u,u+=8}if(i.nlen=257+(31&d),d>>>=5,u-=5,i.ndist=1+(31&d),d>>>=5,u-=5,i.ncode=4+(15&d),d>>>=4,u-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=Pa;break}i.have=0,i.mode=16197;case 16197:for(;i.have<i.ncode;){for(;u<3;){if(0===o)break e;o--,d+=n[r++]<<u,u+=8}i.lens[x[i.have++]]=7&d,d>>>=3,u-=3}for(;i.have<19;)i.lens[x[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,T={bits:i.lenbits},E=aa(0,i.lens,0,19,i.lencode,0,i.work,T),i.lenbits=T.bits,E){e.msg="invalid code lengths set",i.mode=Pa;break}i.have=0,i.mode=16198;case 16198:for(;i.have<i.nlen+i.ndist;){for(;P=i.lencode[d&(1<<i.lenbits)-1],g=P>>>24,v=P>>>16&255,y=65535&P,!(g<=u);){if(0===o)break e;o--,d+=n[r++]<<u,u+=8}if(y<16)d>>>=g,u-=g,i.lens[i.have++]=y;else{if(16===y){for(A=g+2;u<A;){if(0===o)break e;o--,d+=n[r++]<<u,u+=8}if(d>>>=g,u-=g,0===i.have){e.msg="invalid bit length repeat",i.mode=Pa;break}S=i.lens[i.have-1],m=3+(3&d),d>>>=2,u-=2}else if(17===y){for(A=g+3;u<A;){if(0===o)break e;o--,d+=n[r++]<<u,u+=8}d>>>=g,u-=g,S=0,m=3+(7&d),d>>>=3,u-=3}else{for(A=g+7;u<A;){if(0===o)break e;o--,d+=n[r++]<<u,u+=8}d>>>=g,u-=g,S=0,m=11+(127&d),d>>>=7,u-=7}if(i.have+m>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=Pa;break}for(;m--;)i.lens[i.have++]=S}}if(i.mode===Pa)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=Pa;break}if(i.lenbits=9,T={bits:i.lenbits},E=aa(1,i.lens,0,i.nlen,i.lencode,0,i.work,T),i.lenbits=T.bits,E){e.msg="invalid literal/lengths set",i.mode=Pa;break}if(i.distbits=6,i.distcode=i.distdyn,T={bits:i.distbits},E=aa(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,T),i.distbits=T.bits,E){e.msg="invalid distances set",i.mode=Pa;break}if(i.mode=ka,t===oa)break e;case ka:i.mode=Sa;case Sa:if(o>=6&&l>=258){e.next_out=s,e.avail_out=l,e.next_in=r,e.avail_in=o,i.hold=d,i.bits=u,Qn(e,h),s=e.next_out,a=e.output,l=e.avail_out,r=e.next_in,n=e.input,o=e.avail_in,d=i.hold,u=i.bits,i.mode===ya&&(i.back=-1);break}for(i.back=0;P=i.lencode[d&(1<<i.lenbits)-1],g=P>>>24,v=P>>>16&255,y=65535&P,!(g<=u);){if(0===o)break e;o--,d+=n[r++]<<u,u+=8}if(v&&!(240&v)){for(b=g,w=v,k=y;P=i.lencode[k+((d&(1<<b+w)-1)>>b)],g=P>>>24,v=P>>>16&255,y=65535&P,!(b+g<=u);){if(0===o)break e;o--,d+=n[r++]<<u,u+=8}d>>>=b,u-=b,i.back+=b}if(d>>>=g,u-=g,i.back+=g,i.length=y,0===v){i.mode=16205;break}if(32&v){i.back=-1,i.mode=ya;break}if(64&v){e.msg="invalid literal/length code",i.mode=Pa;break}i.extra=15&v,i.mode=16201;case 16201:if(i.extra){for(A=i.extra;u<A;){if(0===o)break e;o--,d+=n[r++]<<u,u+=8}i.length+=d&(1<<i.extra)-1,d>>>=i.extra,u-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;P=i.distcode[d&(1<<i.distbits)-1],g=P>>>24,v=P>>>16&255,y=65535&P,!(g<=u);){if(0===o)break e;o--,d+=n[r++]<<u,u+=8}if(!(240&v)){for(b=g,w=v,k=y;P=i.distcode[k+((d&(1<<b+w)-1)>>b)],g=P>>>24,v=P>>>16&255,y=65535&P,!(b+g<=u);){if(0===o)break e;o--,d+=n[r++]<<u,u+=8}d>>>=b,u-=b,i.back+=b}if(d>>>=g,u-=g,i.back+=g,64&v){e.msg="invalid distance code",i.mode=Pa;break}i.offset=y,i.extra=15&v,i.mode=16203;case 16203:if(i.extra){for(A=i.extra;u<A;){if(0===o)break e;o--,d+=n[r++]<<u,u+=8}i.offset+=d&(1<<i.extra)-1,d>>>=i.extra,u-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=Pa;break}i.mode=16204;case 16204:if(0===l)break e;if(m=h-l,i.offset>m){if(m=i.offset-m,m>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=Pa;break}m>i.wnext?(m-=i.wnext,f=i.wsize-m):f=i.wnext-m,m>i.length&&(m=i.length),p=i.window}else p=a,f=s-i.offset,m=i.length;m>l&&(m=l),l-=m,i.length-=m;do{a[s++]=p[f++]}while(--m);0===i.length&&(i.mode=Sa);break;case 16205:if(0===l)break e;a[s++]=i.length,l--,i.mode=Sa;break;case Ea:if(i.wrap){for(;u<32;){if(0===o)break e;o--,d|=n[r++]<<u,u+=8}if(h-=l,e.total_out+=h,i.total+=h,4&i.wrap&&h&&(e.adler=i.check=i.flags?$n(i.check,a,h,s-h):Wn(i.check,a,h,s-h)),h=l,4&i.wrap&&(i.flags?d:Ma(d))!==i.check){e.msg="incorrect data check",i.mode=Pa;b