UNPKG

@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.43 MB
import{css as e,LitElement as t,adoptStyles as n,html as i,unsafeCSS as a,svg as r}from"lit";const o=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(){}},s=new WeakMap,d=e=>{let t=s.get(e);return void 0===t&&s.set(e,t=new Map),t},l=class{constructor(){this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(d(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){d(this).set(e,String(t))}removeAttribute(e){d(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 d(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 o(this);return this.__internals=e,e}getAttribute(e){return d(this).get(e)??null}},u=class extends l{};function c(e,t,n,i){var a,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(o=(r<3?a(o):r>3?a(t,n,o):a(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o}function h(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}"undefined"==typeof HTMLElement&&(globalThis.HTMLElement=u),"function"==typeof SuppressedError&&SuppressedError;var m;!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"}(m||(m={}));const{NAMI_SDK_VERSION:f="3.3.1",PRODUCTION:p="production",DEVELOPMENT:g="development",PLATFORM_ID_REQUIRED:v="Platform ID is required",DEVICE_ID_REQUIRED:y="Device ID is required",EXTERNAL_ID_REQUIRED:w="External ID is required",SDK_NOT_INITIALIZED:b="SDK has not been initialized. Make sure to call Nami.configure() first!",CAMPAIGN_NOT_AVAILABLE:k="Campaign is not available",FLOW_SCREENS_NOT_AVAILABLE:S="Flow screens not available",UNABLE_TO_UPDATE_CDP_ID:M="Unable to update CDP id in anonymous mode",ANONYMOUS_MODE_ALREADY_ON:E="Anonymous mode is already turned on.",ANONYMOUS_MODE_ALREADY_OFF:T="Anonymous mode is already turned off.",ANONYMOUS_MODE_LOGIN_NOT_ALLOWED:P="Login/logout are not available in anonymous mode",SESSION_REQUIRED:A="Session is required",DEVICE_ID_NOT_SET:x="Nami Device ID is not set",AUTH_DEVICE:_="nami_auth_device",NAMI_CONFIGURATION:C="nami_configuration",NAMI_PROFILE:L="nami_profile",API_CONFIG:I="api_config",API_CAMPAIGN_RULES:D="api_campaign_rules",API_PAYWALLS:R="api_paywalls",API_PRODUCTS:W="api_products",API_ACTIVE_ENTITLEMENTS:N="api_active_entitlements",SERVER_NAMI_ENTITLEMENTS:O="server_active_entitlements",INITIAL_APP_CONFIG:F="initial_app_config",INITIAL_CAMPAIGN_RULES:j="initial_campaign_rules",INITIAL_PAYWALLS:z="initial_paywalls",INITIAL_PRODUCTS:$="initial_products",LOCAL_NAMI_ENTITLEMENTS:U="local_active_entitlements",CUSTOMER_ATTRIBUTES_KEY_PREFIX:H="nami_cmr_attributes_",NAMI_CUSTOMER_JOURNEY_STATE:B="nami_customer_journey_state",ANONYMOUS_MODE:G="nami_anonymous_mode",ANONYMOUS_UUID:X="nami_anonymous_uuid",KEY_SESSION_COUNTER:Y="nami_session_counter",INITIAL_SESSION_COUNTER_VALUE:K=1,NAMI_LAST_IMPRESSION_ID:V="nami_last_impression_id",NAMI_PURCHASE_IMPRESSION_ID:q="nami_purchase_impression_id",NAMI_SESSION_ID:J="nami_session_id",NAMI_LANGUAGE_CODE:Q="nami_language_code",NAMI_PURCHASE_CHANNEL:Z="nami_purchase_channel",API_VERSION:ee="v3",BASE_URL_PATH:te=`sdk/${ee}/platform`,BASE_URL:ne="https://app.namiml.com",BASE_STAGING_URL:ie="https://app-staging.namiml.com",CUSTOM_HOST_PREFIX:ae="namiAPIHost=",USE_STAGING_API:re="useStagingAPI",EXTENDED_CLIENT_INFO_PREFIX:oe="extendedClientInfo",EXTENDED_CLIENT_INFO_DELIMITER:se=":",VALIDATE_PRODUCT_GROUPS:de="validateProductGroups",EXTENDED_PLATFORM:le="extended-platform",EXTENDED_PLATFORM_VERSION:ue="extended-platform-version",API_MAX_CALLS_LIMIT:ce=2,API_RETRY_DELAY_SEC:he=2,API_TIMEOUT_LIMIT:me=2e4,DEVICE_API_TIMEOUT_LIMIT:fe=3e3,STATUS_SUCCESS:pe=200,STATUS_BAD_REQUEST:ge=400,STATUS_NOT_FOUND:ve=404,STATUS_CONFLICT:ye=409,STATUS_INTERNAL_SERVER_ERROR:we=500,INITIAL_SUCCESS:be="Initial success",RECONFIG_SUCCESS:ke="Reconfig success",ALREADY_CONFIGURED:Se="Already configured",AVAILABLE_CAMPAIGNS_CHANGED:Me="AvailableCampaignsChanged",PAYWALL_ACTION_EVENT:Ee="PaywallActionEvent",AVAILABLE_ACTIVE_ENTITLEMENTS_CHANGED:Te="AvailableActiveEntitlementsChanged",CUSTOMER_JOURNEY_STATE_CHANGED:Pe="CustomerJourneyStateChanged",SKU_TEXT_REGEX:Ae=/\$\{sku\.(\w+)(:\d+)?\}/g,VAR_REGEX:xe=/\$\{\s*(\w+(\.[a-zA-Z\d_:${}-]{0,99})*?)\s*}/g,HTML_REGEX:_e=/<\/?[a-z][\s\S]*>/i,SMART_TEXT_PATTERN:Ce="${",CORS_PROXY_URL:Le="https://hosted-content-staging.namiml.com",CORS_PROXY_URL_LOCAL:Ie="http://localhost:8001"}={};var De;!function(e){e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR"}(De||(De={}));const Re={debug:De.DEBUG,info:De.INFO,warn:De.WARN,error:De.ERROR};const We=new class{constructor(){this.currentLogLevel=De.DEBUG,this.setLogger=e=>{this.currentLogLevel=e?Re[e]:De.WARN}}debug(e,...t){this.shouldLog(De.DEBUG)&&console.debug(this.formatMessage(De.DEBUG,e,...t))}info(e,...t){this.shouldLog(De.INFO)&&console.info(this.formatMessage(De.INFO,e,...t))}warn(e,...t){this.shouldLog(De.WARN)&&console.warn(this.formatMessage(De.WARN,e,...t))}error(e,...t){this.shouldLog(De.ERROR)&&console.error(this.formatMessage(De.ERROR,e,...t))}shouldLog(e){return e>=this.currentLogLevel}formatMessage(e,t,...n){const i=De[e];return`[${(new Date).toISOString()}] [${i}] ${t} ${n=n.map((e=>"object"==typeof e?JSON.stringify(e):e))}`}};function Ne(e){for(var t=-1,n=null==e?0:e.length,i=0,a=[];++t<n;){var r=e[t];r&&(a[i++]=r)}return a}function Oe(e,t){return e===t||e!=e&&t!=t}function Fe(e,t){for(var n=e.length;n--;)if(Oe(e[n][0],t))return n;return-1}var je=Array.prototype.splice;function ze(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}ze.prototype.clear=function(){this.__data__=[],this.size=0},ze.prototype.delete=function(e){var t=this.__data__,n=Fe(t,e);return!(n<0)&&(n==t.length-1?t.pop():je.call(t,n,1),--this.size,!0)},ze.prototype.get=function(e){var t=this.__data__,n=Fe(t,e);return n<0?void 0:t[n][1]},ze.prototype.has=function(e){return Fe(this.__data__,e)>-1},ze.prototype.set=function(e,t){var n=this.__data__,i=Fe(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};var $e="object"==typeof global&&global&&global.Object===Object&&global,Ue="object"==typeof self&&self&&self.Object===Object&&self,He=$e||Ue||Function("return this")(),Be=He.Symbol,Ge=Object.prototype,Xe=Ge.hasOwnProperty,Ye=Ge.toString,Ke=Be?Be.toStringTag:void 0;var Ve=Object.prototype.toString;var qe="[object Null]",Je="[object Undefined]",Qe=Be?Be.toStringTag:void 0;function Ze(e){return null==e?void 0===e?Je:qe:Qe&&Qe in Object(e)?function(e){var t=Xe.call(e,Ke),n=e[Ke];try{e[Ke]=void 0;var i=!0}catch(e){}var a=Ye.call(e);return i&&(t?e[Ke]=n:delete e[Ke]),a}(e):function(e){return Ve.call(e)}(e)}function et(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var tt="[object AsyncFunction]",nt="[object Function]",it="[object GeneratorFunction]",at="[object Proxy]";function rt(e){if(!et(e))return!1;var t=Ze(e);return t==nt||t==it||t==tt||t==at}var ot,st=He["__core-js_shared__"],dt=(ot=/[^.]+$/.exec(st&&st.keys&&st.keys.IE_PROTO||""))?"Symbol(src)_1."+ot:"";var lt=Function.prototype.toString;function ut(e){if(null!=e){try{return lt.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var ct=/^\[object .+?Constructor\]$/,ht=Function.prototype,mt=Object.prototype,ft=ht.toString,pt=mt.hasOwnProperty,gt=RegExp("^"+ft.call(pt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function vt(e){return!(!et(e)||(t=e,dt&&dt in t))&&(rt(e)?gt:ct).test(ut(e));var t}function yt(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return vt(n)?n:void 0}var wt=yt(He,"Map"),bt=yt(Object,"create");var kt=Object.prototype.hasOwnProperty;var St=Object.prototype.hasOwnProperty;function Mt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function Et(e,t){var n,i,a=e.__data__;return("string"==(i=typeof(n=t))||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==n:null===n)?a["string"==typeof t?"string":"hash"]:a.map}function Tt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}Mt.prototype.clear=function(){this.__data__=bt?bt(null):{},this.size=0},Mt.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Mt.prototype.get=function(e){var t=this.__data__;if(bt){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return kt.call(t,e)?t[e]:void 0},Mt.prototype.has=function(e){var t=this.__data__;return bt?void 0!==t[e]:St.call(t,e)},Mt.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=bt&&void 0===t?"__lodash_hash_undefined__":t,this},Tt.prototype.clear=function(){this.size=0,this.__data__={hash:new Mt,map:new(wt||ze),string:new Mt}},Tt.prototype.delete=function(e){var t=Et(this,e).delete(e);return this.size-=t?1:0,t},Tt.prototype.get=function(e){return Et(this,e).get(e)},Tt.prototype.has=function(e){return Et(this,e).has(e)},Tt.prototype.set=function(e,t){var n=Et(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this};function Pt(e){var t=this.__data__=new ze(e);this.size=t.size}Pt.prototype.clear=function(){this.__data__=new ze,this.size=0},Pt.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Pt.prototype.get=function(e){return this.__data__.get(e)},Pt.prototype.has=function(e){return this.__data__.has(e)},Pt.prototype.set=function(e,t){var n=this.__data__;if(n instanceof ze){var i=n.__data__;if(!wt||i.length<199)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new Tt(i)}return n.set(e,t),this.size=n.size,this};function At(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Tt;++t<n;)this.add(e[t])}function xt(e,t){for(var n=-1,i=null==e?0:e.length;++n<i;)if(t(e[n],n,e))return!0;return!1}function _t(e,t){return e.has(t)}At.prototype.add=At.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},At.prototype.has=function(e){return this.__data__.has(e)};var Ct=1,Lt=2;function It(e,t,n,i,a,r){var o=n&Ct,s=e.length,d=t.length;if(s!=d&&!(o&&d>s))return!1;var l=r.get(e),u=r.get(t);if(l&&u)return l==t&&u==e;var c=-1,h=!0,m=n&Lt?new At:void 0;for(r.set(e,t),r.set(t,e);++c<s;){var f=e[c],p=t[c];if(i)var g=o?i(p,f,c,t,e,r):i(f,p,c,e,t,r);if(void 0!==g){if(g)continue;h=!1;break}if(m){if(!xt(t,(function(e,t){if(!_t(m,t)&&(f===e||a(f,e,n,i,r)))return m.push(t)}))){h=!1;break}}else if(f!==p&&!a(f,p,n,i,r)){h=!1;break}}return r.delete(e),r.delete(t),h}var Dt=He.Uint8Array;function Rt(e){var t=-1,n=Array(e.size);return e.forEach((function(e,i){n[++t]=[i,e]})),n}function Wt(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var Nt=1,Ot=2,Ft="[object Boolean]",jt="[object Date]",zt="[object Error]",$t="[object Map]",Ut="[object Number]",Ht="[object RegExp]",Bt="[object Set]",Gt="[object String]",Xt="[object Symbol]",Yt="[object ArrayBuffer]",Kt="[object DataView]",Vt=Be?Be.prototype:void 0,qt=Vt?Vt.valueOf:void 0;var Jt=Array.isArray;var Qt=Object.prototype.propertyIsEnumerable,Zt=Object.getOwnPropertySymbols,en=Zt?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,i=null==e?0:e.length,a=0,r=[];++n<i;){var o=e[n];t(o,n,e)&&(r[a++]=o)}return r}(Zt(e),(function(t){return Qt.call(e,t)})))}:function(){return[]};function tn(e){return null!=e&&"object"==typeof e}function nn(e){return tn(e)&&"[object Arguments]"==Ze(e)}var an=Object.prototype,rn=an.hasOwnProperty,on=an.propertyIsEnumerable,sn=nn(function(){return arguments}())?nn:function(e){return tn(e)&&rn.call(e,"callee")&&!on.call(e,"callee")};var dn="object"==typeof exports&&exports&&!exports.nodeType&&exports,ln=dn&&"object"==typeof module&&module&&!module.nodeType&&module,un=ln&&ln.exports===dn?He.Buffer:void 0,cn=(un?un.isBuffer:void 0)||function(){return!1},hn=9007199254740991,mn=/^(?:0|[1-9]\d*)$/;function fn(e,t){var n=typeof e;return!!(t=null==t?hn:t)&&("number"==n||"symbol"!=n&&mn.test(e))&&e>-1&&e%1==0&&e<t}var pn=9007199254740991;function gn(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=pn}var vn={};vn["[object Float32Array]"]=vn["[object Float64Array]"]=vn["[object Int8Array]"]=vn["[object Int16Array]"]=vn["[object Int32Array]"]=vn["[object Uint8Array]"]=vn["[object Uint8ClampedArray]"]=vn["[object Uint16Array]"]=vn["[object Uint32Array]"]=!0,vn["[object Arguments]"]=vn["[object Array]"]=vn["[object ArrayBuffer]"]=vn["[object Boolean]"]=vn["[object DataView]"]=vn["[object Date]"]=vn["[object Error]"]=vn["[object Function]"]=vn["[object Map]"]=vn["[object Number]"]=vn["[object Object]"]=vn["[object RegExp]"]=vn["[object Set]"]=vn["[object String]"]=vn["[object WeakMap]"]=!1;var yn,wn="object"==typeof exports&&exports&&!exports.nodeType&&exports,bn=wn&&"object"==typeof module&&module&&!module.nodeType&&module,kn=bn&&bn.exports===wn&&$e.process,Sn=function(){try{var e=bn&&bn.require&&bn.require("util").types;return e||kn&&kn.binding&&kn.binding("util")}catch(e){}}(),Mn=Sn&&Sn.isTypedArray,En=Mn?(yn=Mn,function(e){return yn(e)}):function(e){return tn(e)&&gn(e.length)&&!!vn[Ze(e)]},Tn=Object.prototype.hasOwnProperty;function Pn(e,t){var n=Jt(e),i=!n&&sn(e),a=!n&&!i&&cn(e),r=!n&&!i&&!a&&En(e),o=n||i||a||r,s=o?function(e,t){for(var n=-1,i=Array(e);++n<e;)i[n]=t(n);return i}(e.length,String):[],d=s.length;for(var l in e)!Tn.call(e,l)||o&&("length"==l||a&&("offset"==l||"parent"==l)||r&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||fn(l,d))||s.push(l);return s}var An=Object.prototype;var xn=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object),_n=Object.prototype.hasOwnProperty;function Cn(e){if(n=(t=e)&&t.constructor,t!==("function"==typeof n&&n.prototype||An))return xn(e);var t,n,i=[];for(var a in Object(e))_n.call(e,a)&&"constructor"!=a&&i.push(a);return i}function Ln(e){return null!=(t=e)&&gn(t.length)&&!rt(t)?Pn(e):Cn(e);var t}function In(e){return function(e,t,n){var i=t(e);return Jt(e)?i:function(e,t){for(var n=-1,i=t.length,a=e.length;++n<i;)e[a+n]=t[n];return e}(i,n(e))}(e,Ln,en)}var Dn=1,Rn=Object.prototype.hasOwnProperty;var Wn=yt(He,"DataView"),Nn=yt(He,"Promise"),On=yt(He,"Set"),Fn=yt(He,"WeakMap"),jn="[object Map]",zn="[object Promise]",$n="[object Set]",Un="[object WeakMap]",Hn="[object DataView]",Bn=ut(Wn),Gn=ut(wt),Xn=ut(Nn),Yn=ut(On),Kn=ut(Fn),Vn=Ze;(Wn&&Vn(new Wn(new ArrayBuffer(1)))!=Hn||wt&&Vn(new wt)!=jn||Nn&&Vn(Nn.resolve())!=zn||On&&Vn(new On)!=$n||Fn&&Vn(new Fn)!=Un)&&(Vn=function(e){var t=Ze(e),n="[object Object]"==t?e.constructor:void 0,i=n?ut(n):"";if(i)switch(i){case Bn:return Hn;case Gn:return jn;case Xn:return zn;case Yn:return $n;case Kn:return Un}return t});var qn=1,Jn="[object Arguments]",Qn="[object Array]",Zn="[object Object]",ei=Object.prototype.hasOwnProperty;function ti(e,t,n,i,a,r){var o=Jt(e),s=Jt(t),d=o?Qn:Vn(e),l=s?Qn:Vn(t),u=(d=d==Jn?Zn:d)==Zn,c=(l=l==Jn?Zn:l)==Zn,h=d==l;if(h&&cn(e)){if(!cn(t))return!1;o=!0,u=!1}if(h&&!u)return r||(r=new Pt),o||En(e)?It(e,t,n,i,a,r):function(e,t,n,i,a,r,o){switch(n){case Kt:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Yt:return!(e.byteLength!=t.byteLength||!r(new Dt(e),new Dt(t)));case Ft:case jt:case Ut:return Oe(+e,+t);case zt:return e.name==t.name&&e.message==t.message;case Ht:case Gt:return e==t+"";case $t:var s=Rt;case Bt:var d=i&Nt;if(s||(s=Wt),e.size!=t.size&&!d)return!1;var l=o.get(e);if(l)return l==t;i|=Ot,o.set(e,t);var u=It(s(e),s(t),i,a,r,o);return o.delete(e),u;case Xt:if(qt)return qt.call(e)==qt.call(t)}return!1}(e,t,d,n,i,a,r);if(!(n&qn)){var m=u&&ei.call(e,"__wrapped__"),f=c&&ei.call(t,"__wrapped__");if(m||f){var p=m?e.value():e,g=f?t.value():t;return r||(r=new Pt),a(p,g,n,i,r)}}return!!h&&(r||(r=new Pt),function(e,t,n,i,a,r){var o=n&Dn,s=In(e),d=s.length;if(d!=In(t).length&&!o)return!1;for(var l=d;l--;){var u=s[l];if(!(o?u in t:Rn.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=o;++l<d;){var p=e[u=s[l]],g=t[u];if(i)var v=o?i(g,p,u,t,e,r):i(p,g,u,e,t,r);if(!(void 0===v?p===g||a(p,g,n,i,r):v)){m=!1;break}f||(f="constructor"==u)}if(m&&!f){var y=e.constructor,w=t.constructor;y==w||!("constructor"in e)||!("constructor"in t)||"function"==typeof y&&y instanceof y&&"function"==typeof w&&w instanceof w||(m=!1)}return r.delete(e),r.delete(t),m}(e,t,n,i,a,r))}function ni(e,t,n,i,a){return e===t||(null==e||null==t||!tn(e)&&!tn(t)?e!=e&&t!=t:ti(e,t,n,i,ni,a))}var ii=1,ai=2;function ri(e){return e==e&&!et(e)}function oi(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}function si(e){var t=function(e){for(var t=Ln(e),n=t.length;n--;){var i=t[n],a=e[i];t[n]=[i,a,ri(a)]}return t}(e);return 1==t.length&&t[0][2]?oi(t[0][0],t[0][1]):function(n){return n===e||function(e,t,n,i){var a=n.length,r=a;if(null==e)return!r;for(e=Object(e);a--;){var o=n[a];if(o[2]?o[1]!==e[o[0]]:!(o[0]in e))return!1}for(;++a<r;){var s=(o=n[a])[0],d=e[s],l=o[1];if(o[2]){if(void 0===d&&!(s in e))return!1}else{var u=new Pt;if(!ni(l,d,ii|ai,i,u))return!1}}return!0}(n,0,t)}}var di="[object Symbol]";function li(e){return"symbol"==typeof e||tn(e)&&Ze(e)==di}var ui=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ci=/^\w*$/;function hi(e,t){if(Jt(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!li(e))||(ci.test(e)||!ui.test(e)||null!=t&&e in Object(t))}var mi="Expected a function";function fi(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(mi);var n=function(){var i=arguments,a=t?t.apply(this,i):i[0],r=n.cache;if(r.has(a))return r.get(a);var o=e.apply(this,i);return n.cache=r.set(a,o)||r,o};return n.cache=new(fi.Cache||Tt),n}fi.Cache=Tt;var pi=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,gi=/\\(\\)?/g,vi=function(e){var t=fi(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(pi,(function(e,n,i,a){t.push(i?a.replace(gi,"$1"):n||e)})),t}));var yi=1/0,wi=Be?Be.prototype:void 0,bi=wi?wi.toString:void 0;function ki(e){if("string"==typeof e)return e;if(Jt(e))return function(e,t){for(var n=-1,i=null==e?0:e.length,a=Array(i);++n<i;)a[n]=t(e[n],n,e);return a}(e,ki)+"";if(li(e))return bi?bi.call(e):"";var t=e+"";return"0"==t&&1/e==-yi?"-0":t}function Si(e){return null==e?"":ki(e)}function Mi(e,t){return Jt(e)?e:hi(e,t)?[e]:vi(Si(e))}var Ei=1/0;function Ti(e){if("string"==typeof e||li(e))return e;var t=e+"";return"0"==t&&1/e==-Ei?"-0":t}function Pi(e,t){for(var n=0,i=(t=Mi(t,e)).length;null!=e&&n<i;)e=e[Ti(t[n++])];return n&&n==i?e:void 0}function Ai(e,t){return null!=e&&t in Object(e)}function xi(e,t){return null!=e&&function(e,t,n){for(var i=-1,a=(t=Mi(t,e)).length,r=!1;++i<a;){var o=Ti(t[i]);if(!(r=null!=e&&n(e,o)))break;e=e[o]}return r||++i!=a?r:!!(a=null==e?0:e.length)&&gn(a)&&fn(o,a)&&(Jt(e)||sn(e))}(e,t,Ai)}var _i=1,Ci=2;function Li(e,t){return hi(e)&&ri(t)?oi(Ti(e),t):function(n){var i=function(e,t,n){var i=null==e?void 0:Pi(e,t);return void 0===i?n:i}(n,e);return void 0===i&&i===t?xi(n,e):ni(t,i,_i|Ci)}}function Ii(e){return e}function Di(e){return hi(e)?(t=Ti(e),function(e){return null==e?void 0:e[t]}):function(e){return function(t){return Pi(t,e)}}(e);var t}function Ri(e){return e!=e}function Wi(e,t){return!!(null==e?0:e.length)&&function(e,t,n){return t==t?function(e,t,n){for(var i=n-1,a=e.length;++i<a;)if(e[i]===t)return i;return-1}(e,t,n):function(e,t,n){for(var i=e.length,a=n+-1;++a<i;)if(t(e[a],a,e))return a;return-1}(e,Ri,n)}(e,t,0)>-1}var Ni=On&&1/Wt(new On([,-0]))[1]==1/0?function(e){return new On(e)}:function(){},Oi=200;function Fi(e,t){return e&&e.length?function(e,t,n){var i=-1,a=Wi,r=e.length,o=!0,s=[],d=s;if(r>=Oi){var l=t?null:Ni(e);if(l)return Wt(l);o=!1,a=_t,d=new At}else d=t?[]:s;e:for(;++i<r;){var u=e[i],c=t?t(u):u;if(u=0!==u?u:0,o&&c==c){for(var h=d.length;h--;)if(d[h]===c)continue e;t&&d.push(c),s.push(u)}else a(d,c,n)||(d!==s&&d.push(c),s.push(u))}return s}(e,"function"==typeof(n=t)?n:null==n?Ii:"object"==typeof n?Jt(n)?Li(n[0],n[1]):si(n):Di(n)):[];var n}const ji=new class{constructor(){this.memoryStore={}}setDevice(e){this.setItem(_,e)}getDevice(){return this.getItem(_)}resetDevice(){this.resetItem(_)}getAnonymousMode(){return this.getItem(G)||!1}setAnonymousMode(e){this.setItem(G,e)}clearAnonymousMode(){this.resetItem(G)}setAppConfig(e,t){this.setItem(e,t)}getAppConfig(e){return this.getItem(e)}setLanguageCode(e){this.setItem(Q,e||"en")}getLanguageCode(){return this.getItem(Q)||"en"}setCampaignRules(e,t){this.setItem(e,t)}getCampaignRules(e){return this.getItem(e)}setPaywalls(e,t){this.setItem(e,t)}getPaywalls(e){return 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(W)??[];return Fi(Ne([...this.getItem($)??[],...e]),"sku_ref_id")}setNamiConfig(e){this.setItem(C,e)}getNamiConfig(){return this.getItem(C)}setCustomerAttribute(e,t){this.setItem(H+e,t)}getCustomerAttribute(e){return this.getItem(H+e)}getAllCustomerAttributes(){return Object.entries(localStorage).filter((([e])=>e.includes(H))).map((([e,t])=>e.replace(H,"")+":"+t))}getAllCustomerAttributesKeys(){return Object.keys(localStorage).filter((e=>e.includes(H))).map((e=>e.replace(H,"")))}clearCustomerAttribute(e){const t=H+e,n=this.getItem(t);return n&&this.resetItem(t),!!n}clearAllCustomerAttributes(){Object.keys(localStorage).filter((e=>e.includes(H))).map((e=>this.resetItem(e)))}setNamiProfile(e){this.setItem(L,e)}getNamiProfile(){return this.getItem(L)}removeNamiProfile(){this.resetItem(L)}setCustomerJourneyState(e){this.setItem(B,e)}getCustomerJourneyState(){return this.getItem(B)}setSessionCounter(){const e=this.getItem(Y),t=e?parseInt(e):K||K;this.setItem(Y,t+1)}getSessionCounter(){const e=this.getItem(Y);return e?parseInt(e):K}setLastImpressionId(e){this.setItem(V,e)}getLastImpressionId(){return this.getItem(V)??""}setPurchaseImpression(){const e=this.getLastImpressionId()??"";this.setItem(q,e)}getPurchaseImpression(){return this.getItem(q)??""}setSessionId(e){e&&this.setItem(J,e)}getSessionId(){return this.getItem(J)??""}clearSessionId(){this.resetItem(J)}setPurchaseChannel(e){e&&this.setItem(Z,e)}getPurchaseChannel(){return this.getItem(Z)}getAnonymousUUID(){return this.getItem(X)}setAnonymousUUID(e){this.setItem(X,e)}clearAnonymousUUID(){this.resetItem(X)}setItem(e,t){let n;try{n=JSON.stringify(t)}catch(t){return void We.error(`Serialization failed for ${e}`,t)}try{localStorage.setItem(e,n)}catch(t){We.error("Error setting item in localStorage:",t),this.resetItem(e),this.memoryStore[e]=n}}getItem(e){try{const t=localStorage.getItem(e);if(null!==t)return JSON.parse(t)}catch(t){We.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(e){We.error("Error removing item from localStorage:",e)}delete this.memoryStore[e]}clear(){try{localStorage.clear()}catch(e){We.error("Error clearing localStorage:",e)}this.memoryStore={}}};class zi extends Error{constructor(e,t){super(t),this.statusCode=e,this.status=e,this.message=`RetryLimitExceededError: ${this.message}`}}class $i extends Error{}class Ui extends $i{constructor(){super(),this.status=409,this.name="ConflictError",this.message="ConflictError: Server responded with conflict"}}class Hi extends Error{constructor(){super(b)}}class Bi extends Error{constructor(){super(v)}}class Gi extends Error{constructor(){super(y)}}class Xi extends Error{constructor(){super(w)}}class Yi extends Error{constructor(){super(k)}}class Ki extends Error{constructor(){super(S)}}class Vi extends Error{constructor(){super(E)}}class qi extends Error{constructor(){super(T)}}class Ji extends Error{constructor(){super(T)}}class Qi extends Error{constructor(){super(M)}}class Zi extends $i{constructor(e){super(e),this.message=`BadRequestError: ${this.message}`}}class ea extends $i{constructor(e){super(e),this.message=`NotFoundError: ${this.message}`}}class ta extends $i{constructor(e,t){super(t),this.statusCode=e,this.message=`ClientError: ${this.message}`}}class na extends $i{constructor(e){super(e),this.message=`ServerError: ${this.message}`}}const ia=(e,t)=>{if(e==ge)throw new Zi(t);if(e==ve)throw new ea(t);if(e==ye)throw new Ui;if(e>ge&&e<we)throw new ta(e,t);if(e>=we)throw new na(t)};async function aa(e,t,n=me,i=ce){let a=0;const r=async()=>{const o=await async function(e,t={},n){const i=new AbortController,a=setTimeout((()=>i.abort()),n);t.signal=i.signal;const r=await fetch(e,t);return clearTimeout(a),r}(e,t,n);if(!o.ok){if(o.status==ye)throw new Ui;if(a++,a<=i){const e=1e3*(a+he);return await new Promise((t=>setTimeout(t,e))),r()}throw new zi(o.status,`Request failed after ${i} retries`)}return o};return(await r()).json()}function ra(e){let t=e.length;for(;--t>=0;)e[t]=0}const oa=256,sa=286,da=30,la=15,ua=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),ca=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),ha=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),ma=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),fa=new Array(576);ra(fa);const pa=new Array(60);ra(pa);const ga=new Array(512);ra(ga);const va=new Array(256);ra(va);const ya=new Array(29);ra(ya);const wa=new Array(da);function ba(e,t,n,i,a){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=i,this.max_length=a,this.has_stree=e&&e.length}let ka,Sa,Ma;function Ea(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}ra(wa);const Ta=e=>e<256?ga[e]:ga[256+(e>>>7)],Pa=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},Aa=(e,t,n)=>{e.bi_valid>16-n?(e.bi_buf|=t<<e.bi_valid&65535,Pa(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=n-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)},xa=(e,t,n)=>{Aa(e,n[2*t],n[2*t+1])},_a=(e,t)=>{let n=0;do{n|=1&e,e>>>=1,n<<=1}while(--t>0);return n>>>1},Ca=(e,t,n)=>{const i=new Array(16);let a,r,o=0;for(a=1;a<=la;a++)o=o+n[a-1]<<1,i[a]=o;for(r=0;r<=t;r++){let t=e[2*r+1];0!==t&&(e[2*r]=_a(i[t]++,t))}},La=e=>{let t;for(t=0;t<sa;t++)e.dyn_ltree[2*t]=0;for(t=0;t<da;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},Ia=e=>{e.bi_valid>8?Pa(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},Da=(e,t,n,i)=>{const a=2*t,r=2*n;return e[a]<e[r]||e[a]===e[r]&&i[t]<=i[n]},Ra=(e,t,n)=>{const i=e.heap[n];let a=n<<1;for(;a<=e.heap_len&&(a<e.heap_len&&Da(t,e.heap[a+1],e.heap[a],e.depth)&&a++,!Da(t,i,e.heap[a],e.depth));)e.heap[n]=e.heap[a],n=a,a<<=1;e.heap[n]=i},Wa=(e,t,n)=>{let i,a,r,o,s=0;if(0!==e.sym_next)do{i=255&e.pending_buf[e.sym_buf+s++],i+=(255&e.pending_buf[e.sym_buf+s++])<<8,a=e.pending_buf[e.sym_buf+s++],0===i?xa(e,a,t):(r=va[a],xa(e,r+oa+1,t),o=ua[r],0!==o&&(a-=ya[r],Aa(e,a,o)),i--,r=Ta(i),xa(e,r,n),o=ca[r],0!==o&&(i-=wa[r],Aa(e,i,o)))}while(s<e.sym_next);xa(e,256,t)},Na=(e,t)=>{const n=t.dyn_tree,i=t.stat_desc.static_tree,a=t.stat_desc.has_stree,r=t.stat_desc.elems;let o,s,d,l=-1;for(e.heap_len=0,e.heap_max=573,o=0;o<r;o++)0!==n[2*o]?(e.heap[++e.heap_len]=l=o,e.depth[o]=0):n[2*o+1]=0;for(;e.heap_len<2;)d=e.heap[++e.heap_len]=l<2?++l:0,n[2*d]=1,e.depth[d]=0,e.opt_len--,a&&(e.static_len-=i[2*d+1]);for(t.max_code=l,o=e.heap_len>>1;o>=1;o--)Ra(e,n,o);d=r;do{o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Ra(e,n,1),s=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=s,n[2*d]=n[2*o]+n[2*s],e.depth[d]=(e.depth[o]>=e.depth[s]?e.depth[o]:e.depth[s])+1,n[2*o+1]=n[2*s+1]=d,e.heap[1]=d++,Ra(e,n,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const n=t.dyn_tree,i=t.max_code,a=t.stat_desc.static_tree,r=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,d=t.stat_desc.max_length;let l,u,c,h,m,f,p=0;for(h=0;h<=la;h++)e.bl_count[h]=0;for(n[2*e.heap[e.heap_max]+1]=0,l=e.heap_max+1;l<573;l++)u=e.heap[l],h=n[2*n[2*u+1]+1]+1,h>d&&(h=d,p++),n[2*u+1]=h,u>i||(e.bl_count[h]++,m=0,u>=s&&(m=o[u-s]),f=n[2*u],e.opt_len+=f*(h+m),r&&(e.static_len+=f*(a[2*u+1]+m)));if(0!==p){do{for(h=d-1;0===e.bl_count[h];)h--;e.bl_count[h]--,e.bl_count[h+1]+=2,e.bl_count[d]--,p-=2}while(p>0);for(h=d;0!==h;h--)for(u=e.bl_count[h];0!==u;)c=e.heap[--l],c>i||(n[2*c+1]!==h&&(e.opt_len+=(h-n[2*c+1])*n[2*c],n[2*c+1]=h),u--)}})(e,t),Ca(n,l,e.bl_count)},Oa=(e,t,n)=>{let i,a,r=-1,o=t[1],s=0,d=7,l=4;for(0===o&&(d=138,l=3),t[2*(n+1)+1]=65535,i=0;i<=n;i++)a=o,o=t[2*(i+1)+1],++s<d&&a===o||(s<l?e.bl_tree[2*a]+=s:0!==a?(a!==r&&e.bl_tree[2*a]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,r=a,0===o?(d=138,l=3):a===o?(d=6,l=3):(d=7,l=4))},Fa=(e,t,n)=>{let i,a,r=-1,o=t[1],s=0,d=7,l=4;for(0===o&&(d=138,l=3),i=0;i<=n;i++)if(a=o,o=t[2*(i+1)+1],!(++s<d&&a===o)){if(s<l)do{xa(e,a,e.bl_tree)}while(0!=--s);else 0!==a?(a!==r&&(xa(e,a,e.bl_tree),s--),xa(e,16,e.bl_tree),Aa(e,s-3,2)):s<=10?(xa(e,17,e.bl_tree),Aa(e,s-3,3)):(xa(e,18,e.bl_tree),Aa(e,s-11,7));s=0,r=a,0===o?(d=138,l=3):a===o?(d=6,l=3):(d=7,l=4)}};let ja=!1;const za=(e,t,n,i)=>{Aa(e,0+(i?1:0),3),Ia(e),Pa(e,n),Pa(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n};var $a=e=>{ja||((()=>{let e,t,n,i,a;const r=new Array(16);for(n=0,i=0;i<28;i++)for(ya[i]=n,e=0;e<1<<ua[i];e++)va[n++]=i;for(va[n-1]=i,a=0,i=0;i<16;i++)for(wa[i]=a,e=0;e<1<<ca[i];e++)ga[a++]=i;for(a>>=7;i<da;i++)for(wa[i]=a<<7,e=0;e<1<<ca[i]-7;e++)ga[256+a++]=i;for(t=0;t<=la;t++)r[t]=0;for(e=0;e<=143;)fa[2*e+1]=8,e++,r[8]++;for(;e<=255;)fa[2*e+1]=9,e++,r[9]++;for(;e<=279;)fa[2*e+1]=7,e++,r[7]++;for(;e<=287;)fa[2*e+1]=8,e++,r[8]++;for(Ca(fa,287,r),e=0;e<da;e++)pa[2*e+1]=5,pa[2*e]=_a(e,5);ka=new ba(fa,ua,257,sa,la),Sa=new ba(pa,ca,0,da,la),Ma=new ba(new Array(0),ha,0,19,7)})(),ja=!0),e.l_desc=new Ea(e.dyn_ltree,ka),e.d_desc=new Ea(e.dyn_dtree,Sa),e.bl_desc=new Ea(e.bl_tree,Ma),e.bi_buf=0,e.bi_valid=0,La(e)},Ua=(e,t,n,i)=>{let a,r,o=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<oa;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),Na(e,e.l_desc),Na(e,e.d_desc),o=(e=>{let t;for(Oa(e,e.dyn_ltree,e.l_desc.max_code),Oa(e,e.dyn_dtree,e.d_desc.max_code),Na(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*ma[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),a=e.opt_len+3+7>>>3,r=e.static_len+3+7>>>3,r<=a&&(a=r)):a=r=n+5,n+4<=a&&-1!==t?za(e,t,n,i):4===e.strategy||r===a?(Aa(e,2+(i?1:0),3),Wa(e,fa,pa)):(Aa(e,4+(i?1:0),3),((e,t,n,i)=>{let a;for(Aa(e,t-257,5),Aa(e,n-1,5),Aa(e,i-4,4),a=0;a<i;a++)Aa(e,e.bl_tree[2*ma[a]+1],3);Fa(e,e.dyn_ltree,t-1),Fa(e,e.dyn_dtree,n-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),Wa(e,e.dyn_ltree,e.dyn_dtree)),La(e),i&&Ia(e)},Ha=(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(va[n]+oa+1)]++,e.dyn_dtree[2*Ta(t)]++),e.sym_next===e.sym_end),Ba=e=>{Aa(e,2,3),xa(e,256,fa),(e=>{16===e.bi_valid?(Pa(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)},Ga={_tr_init:$a,_tr_stored_block:za,_tr_flush_block:Ua,_tr_tally:Ha,_tr_align:Ba};var Xa=(e,t,n,i)=>{let a=65535&e,r=e>>>16&65535,o=0;for(;0!==n;){o=n>2e3?2e3:n,n-=o;do{a=a+t[i++]|0,r=r+a|0}while(--o);a%=65521,r%=65521}return a|r<<16};const Ya=new Uint32Array((()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t})());var Ka=(e,t,n,i)=>{const a=Ya,r=i+n;e^=-1;for(let n=i;n<r;n++)e=e>>>8^a[255&(e^t[n])];return~e},Va={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"},qa={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:Ja,_tr_stored_block:Qa,_tr_flush_block:Za,_tr_tally:er,_tr_align:tr}=Ga,{Z_NO_FLUSH:nr,Z_PARTIAL_FLUSH:ir,Z_FULL_FLUSH:ar,Z_FINISH:rr,Z_BLOCK:or,Z_OK:sr,Z_STREAM_END:dr,Z_STREAM_ERROR:lr,Z_DATA_ERROR:ur,Z_BUF_ERROR:cr,Z_DEFAULT_COMPRESSION:hr,Z_FILTERED:mr,Z_HUFFMAN_ONLY:fr,Z_RLE:pr,Z_FIXED:gr,Z_DEFAULT_STRATEGY:vr,Z_UNKNOWN:yr,Z_DEFLATED:wr}=qa,br=258,kr=262,Sr=42,Mr=113,Er=666,Tr=(e,t)=>(e.msg=Va[t],t),Pr=e=>2*e-(e>4?9:0),Ar=e=>{let t=e.length;for(;--t>=0;)e[t]=0},xr=e=>{let t,n,i,a=e.w_size;t=e.hash_size,i=t;do{n=e.head[--i],e.head[i]=n>=a?n-a:0}while(--t);t=a,i=t;do{n=e.prev[--i],e.prev[i]=n>=a?n-a:0}while(--t)};let _r=(e,t,n)=>(t<<e.hash_shift^n)&e.hash_mask;const Cr=e=>{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))},Lr=(e,t)=>{Za(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Cr(e.strm)},Ir=(e,t)=>{e.pending_buf[e.pending++]=t},Dr=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},Rr=(e,t,n,i)=>{let a=e.avail_in;return a>i&&(a=i),0===a?0:(e.avail_in-=a,t.set(e.input.subarray(e.next_in,e.next_in+a),n),1===e.state.wrap?e.adler=Xa(e.adler,t,a,n):2===e.state.wrap&&(e.adler=Ka(e.adler,t,a,n)),e.next_in+=a,e.total_in+=a,a)},Wr=(e,t)=>{let n,i,a=e.max_chain_length,r=e.strstart,o=e.prev_length,s=e.nice_match;const d=e.strstart>e.w_size-kr?e.strstart-(e.w_size-kr):0,l=e.window,u=e.w_mask,c=e.prev,h=e.strstart+br;let m=l[r+o-1],f=l[r+o];e.prev_length>=e.good_match&&(a>>=2),s>e.lookahead&&(s=e.lookahead);do{if(n=t,l[n+o]===f&&l[n+o-1]===m&&l[n]===l[r]&&l[++n]===l[r+1]){r+=2,n++;do{}while(l[++r]===l[++n]&&l[++r]===l[++n]&&l[++r]===l[++n]&&l[++r]===l[++n]&&l[++r]===l[++n]&&l[++r]===l[++n]&&l[++r]===l[++n]&&l[++r]===l[++n]&&r<h);if(i=br-(h-r),r=h-br,i>o){if(e.match_start=t,o=i,i>=s)break;m=l[r+o-1],f=l[r+o]}}}while((t=c[t&u])>d&&0!=--a);return o<=e.lookahead?o:e.lookahead},Nr=e=>{const t=e.w_size;let n,i,a;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-kr)&&(e.window.set(e.window.subarray(t,t+t-i),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),xr(e),i+=t),0===e.strm.avail_in)break;if(n=Rr(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=n,e.lookahead+e.insert>=3)for(a=e.strstart-e.insert,e.ins_h=e.window[a],e.ins_h=_r(e,e.ins_h,e.window[a+1]);e.insert&&(e.ins_h=_r(e,e.ins_h,e.window[a+3-1]),e.prev[a&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=a,a++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<kr&&0!==e.strm.avail_in)},Or=(e,t)=>{let n,i,a,r=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,o=0,s=e.strm.avail_in;do{if(n=65535,a=e.bi_valid+42>>3,e.strm.avail_out<a)break;if(a=e.strm.avail_out-a,i=e.strstart-e.block_start,n>i+e.strm.avail_in&&(n=i+e.strm.avail_in),n>a&&(n=a),n<r&&(0===n&&t!==rr||t===nr||n!==i+e.strm.avail_in))break;o=t===rr&&n===i+e.strm.avail_in?1:0,Qa(e,0,0,o),e.pending_buf[e.pending-4]=n,e.pending_buf[e.pending-3]=n>>8,e.pending_buf[e.pending-2]=~n,e.pending_buf[e.pending-1]=~n>>8,Cr(e.strm),i&&(i>n&&(i=n),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,n-=i),n&&(Rr(e.strm,e.strm.output,e.strm.next_out,n),e.strm.next_out+=n,e.strm.avail_out-=n,e.strm.total_out+=n)}while(0===o);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),o?4:t!==nr&&t!==rr&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(a=e.window_size-e.strstart,e.strm.avail_in>a&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,a+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),a>e.strm.avail_in&&(a=e.strm.avail_in),a&&(Rr(e.strm,e.window,e.strstart,a),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.high_water<e.strstart&&(e.high_water=e.strstart),a=e.bi_valid+42>>3,a=e.pending_buf_size-a>65535?65535:e.pending_buf_size-a,r=a>e.w_size?e.w_size:a,i=e.strstart-e.block_start,(i>=r||(i||t===rr)&&t!==nr&&0===e.strm.avail_in&&i<=a)&&(n=i>a?a:i,o=t===rr&&0===e.strm.avail_in&&n===i?1:0,Qa(e,e.block_start,n,o),e.block_start+=n,Cr(e.strm)),o?3:1)},Fr=(e,t)=>{let n,i;for(;;){if(e.lookahead<kr){if(Nr(e),e.lookahead<kr&&t===nr)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=_r(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==n&&e.strstart-n<=e.w_size-kr&&(e.match_length=Wr(e,n)),e.match_length>=3)if(i=er(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=_r(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=_r(e,e.ins_h,e.window[e.strstart+1]);else i=er(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(Lr(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===rr?(Lr(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Lr(e,!1),0===e.strm.avail_out)?1:2},jr=(e,t)=>{let n,i,a;for(;;){if(e.lookahead<kr){if(Nr(e),e.lookahead<kr&&t===nr)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=_r(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==n&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-kr&&(e.match_length=Wr(e,n),e.match_length<=5&&(e.strategy===mr||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){a=e.strstart+e.lookahead-3,i=er(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=a&&(e.ins_h=_r(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,i&&(Lr(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(i=er(e,0,e.window[e.strstart-1]),i&&Lr(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(i=er(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===rr?(Lr(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Lr(e,!1),0===e.strm.avail_out)?1:2};function zr(e,t,n,i,a){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=i,this.func=a}const $r=[new zr(0,0,0,0,Or),new zr(4,4,8,4,Fr),new zr(4,5,16,8,Fr),new zr(4,6,32,32,Fr),new zr(4,4,16,16,jr),new zr(8,16,32,32,jr),new zr(8,16,128,128,jr),new zr(8,32,128,256,jr),new zr(32,128,258,1024,jr),new zr(32,258,258,4096,jr)];function Ur(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=wr,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Ar(this.dyn_ltree),Ar(this.dyn_dtree),Ar(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Ar(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Ar(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Hr=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==Sr&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==Mr&&t.status!==Er?1:0},Br=e=>{if(Hr(e))return Tr(e,lr);e.total_in=e.total_out=0,e.data_type=yr;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?Sr:Mr,e.adler=2===t.wrap?0:1,t.last_flush=-2,Ja(t),sr},Gr=e=>{const t=Br(e);return t===sr&&(e=>{e.window_size=2*e.w_size,Ar(e.head),e.max_lazy_match=$r[e.level].max_lazy,e.good_match=$r[e.level].good_length,e.nice_match=$r[e.level].nice_length,e.max_chain_length=$r[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=2,e.match_available=0,e.ins_h=0})(e.state),t},Xr=(e,t,n,i,a,r)=>{if(!e)return lr;let o=1;if(t===hr&&(t=6),i<0?(o=0,i=-i):i>15&&(o=2,i-=16),a<1||a>9||n!==wr||i<8||i>15||t<0||t>9||r<0||r>gr||8===i&&1!==o)return Tr(e,lr);8===i&&(i=9);const s=new Ur;return e.state=s,s.strm=e,s.status=Sr,s.wrap=o,s.gzhead=null,s.w_bits=i,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=a+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new Uint8Array(2*s.w_size),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<a+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=3*(s.lit_bufsize-1),s.level=t,s.strategy=r,s.method=n,Gr(e)};var Yr=(e,t)=>{if(Hr(e)||t>or||t<0)return e?Tr(e,lr):lr;const n=e.state;if(!e.output||0!==e.avail_in&&!e.input||n.status===Er&&t!==rr)return Tr(e,0===e.avail_out?cr:lr);const i=n.last_flush;if(n.last_flush=t,0!==n.pending){if(Cr(e),0===e.avail_out)return n.last_flush=-1,sr}else if(0===e.avail_in&&Pr(t)<=Pr(i)&&t!==rr)return Tr(e,cr);if(n.status===Er&&0!==e.avail_in)return Tr(e,cr);if(n.status===Sr&&0===n.wrap&&(n.status=Mr),n.status===Sr){let t=wr+(n.w_bits-8<<4)<<8,i=-1;if(i=n.strategy>=fr||n.level<2?0:n.level<6?1:6===n.level?2:3,t|=i<<6,0!==n.strstart&&(t|=32),t+=31-t%31,Dr(n,t),0!==n.strstart&&(Dr(n,e.adler>>>16),Dr(n,65535&e.adler)),e.adler=1,n.status=Mr,Cr(e),0!==n.pending)return n.last_flush=-1,sr}if(57===n.status)if(e.adler=0,Ir(n,31),Ir(n,139),Ir(n,8),n.gzhead)Ir(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),Ir(n,255&n.gzhead.time),Ir(n,n.gzhead.time>>8&255),Ir(n,n.gzhead.time>>16&255),Ir(n,n.gzhead.time>>24&255),Ir(n,9===n.level?2:n.strategy>=fr||n.level<2?4:0),Ir(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(Ir(n,255&n.gzhead.extra.length),Ir(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=Ka(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69;else if(Ir(n,0),Ir(n,0),Ir(n,0),Ir(n,0),Ir(n,0),Ir(n,9===n.level?2:n.strategy>=fr||n.level<2?4:0),Ir(n,3),n.status=Mr,Cr(e),0!==n.pending)return n.last_flush=-1,sr;if(69===n.status){if(n.gzhead.extra){let t=n.pending,i=(65535&n.gzhead.extra.length)-n.gzindex;for(;n.pending+i>n.pending_buf_size;){let a=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+a),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>t&&(e.adler=Ka(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex+=a,Cr(e),0!==n.pending)return n.last_flush=-1,sr;t=0,i-=a}let a=new Uint8Array(n.gzhead.extra);n.pending_buf.set(a.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending+=i,n.gzhead.hcrc&&n.pending>t&&(e.adler=Ka(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=73}if(73===n.status){if(n.gzhead.name){let t,i=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=Ka(e.adler,n.pending_buf,n.pending-i,i)),Cr(e),0!==n.pending)return n.last_flush=-1,sr;i=0}t=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,Ir(n,t)}while(0!==t);n.gzhead.hcrc&&n.pending>i&&(e.adler=Ka(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=91}if(91===n.status){if(n.gzhead.comment){let t,i=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=Ka(e.adler,n.pending_buf,n.pending-i,i)),Cr(e),0!==n.pending)return n.last_flush=-1,sr;i=0}t=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,Ir(n,t)}while(0!==t);n.gzhead.hcrc&&n.pending>i&&(e.adler=Ka(e.adler,n.pending_buf,n.pending-i,i))}n.status=103}if(103===n.status){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Cr(e),0!==n.pending))return n.last_flush=-1,sr;Ir(n,255&e.adler),Ir(n,e.adler>>8&255),e.adler=0}if(n.status=Mr,Cr(e),0!==n.pending)return n.last_flush=-1,sr}if(0!==e.avail_in||0!==n.lookahead||t!==nr&&n.status!==Er){let i=0===n.level?Or(n,t):n.strategy===fr?((e,t)=>{let n;for(;;){if(0===e.lookahead&&(Nr(e),0===e.lookahead)){if(t===nr)return 1;break}if(e.match_length=0,n=er(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(Lr(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===rr?(Lr(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Lr(e,!1),0===e.strm.avail_out)?1:2})(n,t):n.strategy===pr?((e,t)=>{let n,i,a,r;const o=e.window;for(;;){if(e.lookahead<=br){if(Nr(e),e.lookahead<=br&&t===nr)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(a=e.strstart-1,i=o[a],i===o[++a]&&i===o[++a]&&i===o[++a])){r=e.strstart+br;do{}while(i===o[++a]&&i===o[++a]&&i===o[++a]&&i===o[++a]&&i===o[++a]&&i===o[++a]&&i===o[++a]&&i===o[++a]&&a<r);e.match_length=br-(r-a),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(n=er(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=er(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(Lr(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===rr?(Lr(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Lr(e,!1),0===e.strm.avail_out)?1:2})(n,t):$r[n.level].func(n,t);if(3!==i&&4!==i||(n.status=Er),1===i||3===i)return 0===e.avail_out&&(n.last_flush=-1),sr;if(2===i&&(t===ir?tr(n):t!==or&&(Qa(n,0,0,!1),t===ar&&(Ar(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),Cr(e),0===e.avail_out))return n.last_flush=-1,sr}return t!==rr?sr:n.wrap<=0?dr:(2===