gio-miniprogram-sdk 4.6.0 → 4.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/wechat.js CHANGED
@@ -1 +1 @@
1
- var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)},t=function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;r>n;n++)for(var i in t=arguments[n])({}).hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},t.apply(this,arguments)};function n(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;o>i;i++)!r&&i in t||(r||(r=[].slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||[].slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var r=/^[a-zA-Z_][0-9a-zA-Z_]{0,100}$/,i=function(e){return["undefined","null"].includes(x(e))},o=function(e){return"string"===x(e)},a=function(e){return"number"===x(e)},u=function(e){return"boolean"===x(e)},s=function(e){return"[object Object]"==={}.toString.call(e)&&!i(e)},c=function(e){return["function","asyncfunction"].includes(x(e))},l=function(e){return Array.isArray(e)&&"array"===x(e)},g=function(e){return"date"===x(e)},d=function(e){try{return Array.from(e)[0]}catch(e){return}},f=function(e){try{var t=Array.from(e);return t[t.length-1]}catch(e){return}},p=function(e,t){return void 0===t&&(t=1),l(e)&&a(t)?e.slice(t>0?t:1,e.length):e},v=function(e,t){if(void 0===t&&(t=!1),l(e)){for(var n=0,r=[],i=0,o=e;i<o.length;i++){var a=o[i];a&&!C(a)&&(r[n++]=a),t&&0===a&&(r[n++]=a)}return r}return e},h=function(e,t){if(l(e)){var n=e.findIndex(t);return 0>n?void 0:e[n]}},m=function(e){return i(e)?"":"".concat(e)},I=function(e,t){return"string"===x(e)?e.split(t):e},y=function(e){if(o(e)){var t=I(e,"");return"".concat(d(t).toLowerCase()).concat(p(t).join(""))}return e},S=function(e,t){return o(e)||(e=m(e)),e.slice(0,t.length)===t},w={}.hasOwnProperty,_=function(e,t){return null!=e&&("object"==typeof e||"function"==typeof e)&&w.call(e,t)},O=function(e){return s(e)?Object.keys(e):[]},P=function(e,t){O(e).forEach(function(n){return t(e[n],n)})},k=function(e,t){var n=O(e);return!(!s(e)||!s(t)||n.length!==O(t).length||n.map(function(n,r){return s(e[n])?k(e[n],t[n]):e[n]===t[n]}).includes(!1))},b=function(e,t,n){var r=e;return s(e)?(t.split(".").forEach(function(e){r=r?r[e]:n}),r):n},T=function(e,t){if(!s(e))return!1;try{if("string"===x(t))return delete e[t];if("array"===x(t))return t.map(function(t){return delete e[t]});"object"===x(t)&&t.constructor===RegExp&&O(e).forEach(function(n){t.test(n)&&T(e,n)})}catch(e){return!1}},E=function(e,t,n,r){var i;void 0===t&&(t=250);var o=0;return"boolean"!==x(n)&&(r=e,e=n,n=void 0),function(){for(var a=[],u=0;arguments.length>u;u++)a[u]=arguments[u];var s=this,c=Date.now()-o;function l(){o=Date.now(),e.apply(s,a)}r&&!i&&l(),i&&clearTimeout(i),void 0===r&&c>t?l():!0!==n&&(i=setTimeout(r?function(){i=void 0}:l,void 0===r?t-c:t))}},C=function(e){return l(e)?0===e.length:s(e)?0===O(e).length:!e},x=function(e){return{}.toString.call(e).slice(8,-1).toLowerCase()},A=function(e){function t(e){return 10>e?"0"+e:e}return e.getFullYear()+"-"+t(e.getMonth()+1)+"-"+t(e.getDate())+" "+t(e.getHours())+":"+t(e.getMinutes())+":"+t(e.getSeconds())+"."+t(e.getMilliseconds())},q=Object.freeze({__proto__:null,isNil:i,isString:o,isNaN:function(e){return"NaN"===m(Number(e))},isNumber:a,isBoolean:u,isObject:s,isRegExp:function(e){return"[object RegExp]"==={}.toString.call(e)},isFunction:c,isArray:l,isDate:g,fixed:function(e,t){return a(e)?Number(e.toFixed(a(t)?t:2)):o(e)&&"NaN"!==m(Number(e))?Number(Number(e).toFixed(a(t)?t:2)):e},head:d,last:f,drop:p,dropWhile:function(e,t){return l(e)?e.filter(function(e){return!t(e)}):e},compact:v,find:h,isEqualArray:function(e,t){return!(!l(e)||!l(t)||e.length!==t.length)&&e.every(function(e,n){return e===t[n]})},toString:m,split:I,lowerFirst:y,upperFirst:function(e){if(o(e)){var t=I(e,"");return"".concat(d(t).toUpperCase()).concat(p(t).join(""))}return e},startsWith:S,endsWith:function(e,t){var n=e.length,r=n;r>n&&(r=n);var i=r;return(r-=t.length)>=0&&e.slice(r,i)===t},hasOwnProperty:w,has:_,keys:O,forEach:P,isEqual:k,get:b,unset:T,throttle:E,isEmpty:C,typeOf:x,formatDate:A}),N=function(e,t){console.log("%c[GrowingIO]:".concat(e),{info:"color: #3B82F6;",error:"color: #EF4444",warn:"color: #F59E0B",success:"color: #10B981"}[t]||"")},U=function(e,t,n){return void 0===t&&(t=!0),void 0===n&&(n="参数不合法"),N("".concat(t?"调用":"设置"," ").concat(e," 失败,").concat(n,"!"),"warn")},L=function(e){try{return e()}catch(e){return}},D=function(e,t){if(c(e))try{e(t)}catch(e){N("回调执行失败!".concat(e),"error")}},B=function(e){return o(e)?e.trim().substring(0,100):e},K=function(e,t){return o(e)&&!C(e)&&e.match(r)?t():(N("事件名格式不正确,只能包含数字、字母和下划线,且不能以数字开头,字符总长度不能超过100!","error"),!1)},H=function(e){return i(e)||O(e).forEach(function(t){c(e[t])?e[t]=L(function(){return e[t]()}):s(e[t])?T(e,t):l(e[t])||(e[t]=m(e[t]))}),e},F=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},R=function(e){return e.pixelRatio?Math.round(e.screenHeight*e.pixelRatio):e.screenHeight},j=function(e){return e.pixelRatio?Math.round(e.screenWidth*e.pixelRatio):e.screenWidth},M=function(e,t){if(e){var n=e.toLowerCase();return-1!==n.indexOf("android")?"".concat(t,"-Android"):-1!==n.indexOf("ios")?"".concat(t,"-iOS"):-1!==n.indexOf("harmonyos")||-1!==n.indexOf("ohos")?"".concat(t,"-HarmonyOS"):"".concat(t,"-").concat(e)}},V=function(e){if(o(e)){var t=e.indexOf("?");return-1!==t?[e.substring(0,t),e.substring(t+1)]:[e,""]}return["",""]},G=function(e){return o(e)?e.startsWith("/")?e:"/".concat(e):""},Q=function(e){return L(function(){switch(e){case"wx":return wx;case"my":case"tb":return my;case"swan":return swan;case"tt":return tt;case"qq":return qq;case"ks":return ks;case"jd":return jd;case"xhs":return xhs;default:var t=void 0;return t||(t=L(function(){return xhs})),t||(t=L(function(){return swan})),t||(t=L(function(){return my})),t||(t=L(function(){return tt})),t||(t=L(function(){return qq})),t||(t=L(function(){return ks})),t||(t=L(function(){return jd})),t||(t=L(function(){return wx})),t}})},$=function(e){return L(function(){switch(e){case"wx":return __wxConfig;case"swan":return appConfig;case"tt":return L(function(){return __ttConfig})||(null===global||void 0===global?void 0:global.TMAConfig)||(null===globalThis||void 0===globalThis?void 0:globalThis.TMAConfig);case"qq":return __qqConfig;case"ks":return __ksConfig;case"jd":return __jdConfig;case"xhs":return null!==__MP_APP_JSON_MIGRATION__&&void 0!==__MP_APP_JSON_MIGRATION__?__MP_APP_JSON_MIGRATION__:__MP_APP_JSON__;default:return}})},z=function(e){return L(function(){switch(e){case"wx":case"qq":return __wxAppCode__;case"tt":return __allConfig__;case"ks":return __module__;case"jd":return __jdAppCode__;default:return}})},W=function(){var e;return!e&&L(function(){return xhs})&&(e="xhs"),!e&&L(function(){return swan})&&(e="swan"),!e&&L(function(){return tt})&&(e="tt"),!e&&L(function(){return qq})&&(e="qq"),!e&&L(function(){return my.tb})&&(e="tb"),!e&&L(function(){return my})&&(e="my"),!e&&L(function(){return ks})&&(e="ks"),!e&&L(function(){return jd})&&(e="jd"),!e&&L(function(){return wx})&&(e="wx"),e||h(O(global),function(e){return m(e).toLowerCase().includes("quickapp")})&&(e="quickapp"),e},J=function(){var e;return null!==(e=L(function(){var e;return null!==(e=L(function(){var e;return null!==(e=L(function(){return $global}))&&void 0!==e?e:global}))&&void 0!==e?e:window}))&&void 0!==e?e:globalThis},Y=function(e){var t={};return s(e)&&(T(e,"&&sendTo"),P(e,function(e,n){var r=m(n).slice(0,100);s(e)?t[r]=Y(e):l(e)?(t[r]=v(e.slice(0,100),!0),t[r]=t[r].join("||").slice(0,1e3)):g(e)?t[r]=A(e):t[r]=i(e)?"":m(e).slice(0,1e3)})),t},Z=function(e,t){var n=function(){return t.map(function(t){return e.getStorageSync(t)})};try{return e.minip.canIUse("batchGetStorageSync")?e.minip.batchGetStorageSync(t):n()}catch(e){return n()}},X=function(e,t){var n=function(){return t.map(function(t){var n=t.key,r=t.value;return e.setStorageSync(n,r)})};try{return e.minip.canIUse("batchSetStorageSync")?e.minip.batchSetStorageSync(t):n()}catch(e){return n()}},ee=function(e){return O(e||{}).map(function(t){return t?"".concat(t,"=").concat(i(e[t])?"":e[t]):""}).join("&")},te=function(e){(S(e,"?")||S(e,"&"))&&(e=e.slice(1,e.length));var t={};return e.split("&").forEach(function(e){var n=e.split("=");n[0]&&(t[n[0]]=n[1])}),t},ne=["wxShoppingListScene","$taroTimestamp","gdpCircleRoomCollectUrl"],re=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n="string"==typeof e?te(e):e||{};function r(e,t){if("object"!=typeof e||null===e||Array.isArray(e))return e;var r={};return O(e).forEach(function(i){var o=ne.some(function(e){return i.includes(e)}),a=_(n,i);if(!(o||t&&a)){var u=e[i];"string"==typeof u?ne.some(function(e){return u.includes(e)})||(r[i]=u):"number"!=typeof u&&"boolean"!=typeof u||(r[i]=u)}}),r}return Object.assign({},r(n,!1),r(t,!0))},ie=Object.freeze({__proto__:null,consoleText:N,callError:U,niceTry:L,niceCallback:D,limitString:B,eventNameValidate:K,getDynamicAttributes:H,guid:F,getScreenHeight:R,getScreenWidth:j,getOS:M,compareVersion:function(e,t){void 0===e&&(e=""),void 0===t&&(t="");for(var n=function(e){return e.replace(/\s+/g,"")},r=function(e){return e.replace(/[vV]/g,"")},i=n(r(e)),o=n(r(t)),a=i.split("."),u=o.split("."),s=0;3>s;s++){var c=Number(a[s]),l=Number(u[s]);if(c>l)return 1;if(l>c)return-1;if(!isNaN(c)&&isNaN(l))return 1;if(isNaN(c)&&!isNaN(l))return-1}return 0},getVueVersion:function(e){if(e){var t=Number(d(I(e.version,".")));return Number.isNaN(t)?0:t}return 0},splitPath:V,normalizePath:function(e){var t=V(e)[0];return((null==t?void 0:t.replace(/^\/+/,""))||"").replace(/\.html$/,"")},normalPath:G,getSafeDuration:function(e,t,n){if("number"==typeof e)return"number"!=typeof t||t>e?"number"!=typeof n||n>e?0:e-n:e-t},isTaro3:function(e){var t=e.Current,n=e.createComponent;return!(!e||!t||n)},getPlainMinip:Q,getPlainConfig:$,getPlainAppCode:z,getPlainPlatform:W,getSubKeys:function(e){return O(e).filter(function(e){return e.indexOf("__sub")>-1&&e.indexOf("gio__")>-1}).sort()},getAppInst:function(){var e=L(function(){return getApp({allowDefault:!0})});return e||(e=J()),e},getGlobal:J,limitObject:Y,batchGetStorageSync:Z,batchSetStorageSync:X,qsStringify:ee,qsParse:te,hashCode:function(e,t){void 0===t&&(t=!1);var n=0;if(C(e)||"boolean"==typeof e)return n;for(var r=0;r<e.length;)n=(n<<5)-n+e.charCodeAt(r),n&=n,r++;return t?Math.abs(n):n},getExtraData:function(e){var t;return o(e)?null!==(t=L(function(){return JSON.parse(e)}))&&void 0!==t?t:{}:null!=e?e:{}},getPureParams:re}),oe=function(e){return(o(e)&&e.length>0||a(e)&&e>0)&&!["-","null","undefined"].includes(e)},ae={autotrack:{type:"boolean",default:!0},compress:{type:"boolean",default:!0},dataCollect:{type:"boolean",default:!0},debug:{type:"boolean",default:!1},idMapping:{type:"boolean",default:!1},enableIdMapping:{type:"boolean",default:!1},extraParams:{type:"array",default:[]},followShare:{type:"boolean",default:!0},forceLogin:{type:"boolean",default:!1},ignoreFields:{type:"array",default:[]},impressionScale:{type:"number",default:0},pluginMode:{type:"boolean",default:!1},originalSource:{type:"boolean",default:!0},keepAlive:{type:"number",default:5},performance:{type:"object",default:{monitor:!0,exception:!0}},serverUrl:{type:"string",default:"https://napi.growingio.com"},sessionExpires:{type:"number",default:-1},requestTimeout:{type:"number",default:5e3},taro:{type:["object","module"],default:!1},taroVue:{type:["object","function"],default:!1},mpvue:{type:["object","function"],default:!1},mpx:{type:["module","function"],default:!1},tbConfig:{type:"object",default:{cloud:void 0,cloudFuncSend:!1,cloudFuncName:"httpTunnel",cloudFuncHandler:"main",cloudAppId:void 0,path:void 0}},trackPage:{type:"boolean",default:!0},uniVue:{type:["object","function"],default:!1},uploadInterval:{type:"number",default:1e3},version:{type:"string",default:"1.0.0"}},ue=["clearGeneralProps","clearPageAttributes","clearLocation","clearTrackTimer","clearUserId","getABTest","getGioInfo","getOption","identify","removeTimer","sendPage","sendVisit","setGeneralProps","setLocation","setOption","setPageAttributes","setUserAttributes","setUserId","track","trackTimerEnd","trackTimerPause","trackTimerResume","trackTimerStart"],se=n(n(["init","registerPlugins"],["getPlugins","getDeviceId","updateImpression"],!0),ue,!0),ce={autotrack:"无埋点",dataCollect:"数据采集",debug:"调试模式",serverUrl:"数据上报服务地址",ignoreFields:"忽略上报字段"},le=["enableDebug","setAutotrack","setDataCollect","setTrackerHost","setTrackerScheme","setConfig","collectImp","setPlatformProfile","getLocation"],ge=["deviceBrand","deviceModel","deviceType","networkState","screenHeight","screenWidth","operatingSystem"],de=n(n([],ge,!0),["appChannel","language","platformVersion"],!1),fe={gsid:"_growing_gsid_",originalSource:"_gdp_original_source_",userId:"_growing_userId_",userKey:"_growing_userKey_",gioId:"_growing_gioId_",plugin_gsid:"_growing_plugin_gsid_",plugin_originalSource:"_gdp_plugin_original_source_",plugin_userId:"_growing_plugin_userId_",plugin_userKey:"_growing_plugin_userKey_",plugin_gioId:"_growing_plugin_gioId_"},pe="MINIP_LIFECYCLE",ve="ON_COMMIT_REQUEST",he="ON_COMPOSE_AFTER",me="ON_COMPOSE_BEFORE",Ie="ON_ERROR",ye="ON_INSTALL",Se="ON_SEND_AFTER",we="ON_SEND_BEFORE",_e="OPTION_CHANGE",Oe="OPTION_INITIALIZED",Pe="SDK_INITIALIZED",ke="SESSIONID_UPDATE",be=function(e){var n=this;this.growingIO=e,this.main=function(e,r,i){var o;void 0===i&&(i=!0),e||(e=n.growingIO.trackingId);var a=n.growingIO,u=a.sdkVersion,s=a.platformConfig,c=a.minipInstance,l=a.userStore,g=a.dataStore,d=a.dataStore,f=d.scene,p=d.eventHooks.currentPage,v=d.generalProps,h=g.getTrackerVds(e),m=h.version,I=h.dataSourceId,y=h.appId,S=h.idMapping,w=h.ignoreFields,_=g.locationData[e],O=c.systemInfo,P=void 0===O?{}:O,k=c.network,b=void 0===k?{}:k,E=P.brand,x=P.model,A=P.platform,q=P.language,N=p.getPagePath(),U={appChannel:"scn:".concat(f||"NA"),appVersion:m,dataSourceId:I,deviceBrand:E,deviceId:l.getUid(),deviceModel:x,deviceType:M(A,s.name),domain:y,language:q,latitude:null==_?void 0:_.latitude,longitude:null==_?void 0:_.longitude,networkState:(null===(o=null==b?void 0:b.networkType)||void 0===o?void 0:o.result)||(null==b?void 0:b.networkType)||(null==b?void 0:b.type)||(null==b?void 0:b.subtype),operatingSystem:M(A,s.name),path:N,platform:s.platform,platformVersion:s.name+(P.version?" ".concat(P.version):""),query:N?p.getPageQuery():"",screenHeight:R(P),screenWidth:j(P),sdkVersion:u,sessionId:l.getSessionId(e),title:p.getPageTitle(),timestamp:Date.now(),timezoneOffset:(new Date).getTimezoneOffset(),userId:l.getUserId(e)};return S&&(U.userKey=l.getUserKey(e)),i&&!C(v[e])&&(U.attributes=t({},v[e])),C(U.attributes)||(U.attributes=Y(H(t({},U.attributes)))),C(w)||w.forEach(function(e){T(U,e)}),C(r)?t(t({},U),{trackingId:e}):t(t(t({},U),r),{trackingId:e})}},Te=function(e){var n=this;this.growingIO=e,this.enterParams={},this.main=function(e,r){var i,o,a=Date.now(),u=n.growingIO,s=u.emitter,c=u.userStore,l=u.vdsConfig,g=u.platformConfig,d=u.uploader,f=u.dataStore,p=u.minipInstance,v=u.dataStore,h=v.trackersExecute,m=v.shareOut,I=v.lastCloseTime,y=v.saveStorageInfo,S=v.setOriginalSource;s.emit(pe,{event:"App ".concat(e),timestamp:a,params:null!==(i=r[0])&&void 0!==i?i:{}}),l.debug&&console.log("App:",e,a);var w=g.listeners.app;switch(s.emit(me,{event:"App ".concat(e),params:null!==(o=r[0])&&void 0!==o?o:{}}),e){case w.appLaunch:n.enterParams=t({},r[0]);break;case w.appCreate:case w.appShow:var _=n.enterParamsParse(r[0]),O=_.path,P=_.query,k=_.referralPage;!m&&l.originalSource&&O&&h(function(e){S(e,{path:O,query:P,referralPage:k})}),I?(Date.now()-I>60*l.keepAlive*1e3||f.lastScene&&f.scene!==f.lastScene)&&h(function(e){c.setSessionId(e)}):h(function(e){f.lastVisitEvent[e]={path:O,query:P,referralPage:k},n.buildVisitEvent(e,{path:O,query:P,referralPage:k})}),p.setNetworkStatusListener();break;case w.appClose:f.lastScene=f.scene,f.lastCloseTime=Date.now(),y(),c.saveUserInfo(),h(function(e){n.buildCloseEvent(e),l.forceLogin||d.initiateRequest(e,!0)})}},this.enterParamsParse=function(e){var t;void 0===e&&(e={});var r=n.growingIO,i=r.gioPlatform,o=r.minipInstance,a=r.dataStore,u="",s="",c="";if("quickapp"!==i&&o.minip.canIUse("getEnterOptionsSync")){var l=o.minip.getEnterOptionsSync()||{},g=l.path,d=l.query,f=l.scene,p=l.referrerInfo||l.refererInfo;u=g||e.path,s=d||e.query,c=(null==p?void 0:p.appId)||(null===(t=null==e?void 0:e.referrerInfo)||void 0===t?void 0:t.appId)||"",a.scene=f||e.scene,T(d,"gdpCircleRoomCollectUrl"),s=ee(re(s,(null==p?void 0:p.extraData)||{}))}else g=e.path,d=e.query,p=e.referrerInfo,u=g,s=ee(d),c=(null==p?void 0:p.appId)||"",n.parseScene(e);return{path:u,query:s,referralPage:c}},this.parseScene=function(e){var t,r,i=n.growingIO,o=i.minipInstance,a=i.gioPlatform,u=i.dataStore;if("quickapp"===a){var s=o.getAppSource(),c=s.extra,l=s.type;r=(null==c?void 0:c.scene)||l}else C(e)||((null===(t=null==e?void 0:e.query)||void 0===t?void 0:t.wxShoppingListScene)?r=e.query.wxShoppingListScene:(null==e?void 0:e.scene)?r=e.scene:u.scene="NA");u.scene=r},this.buildVisitEvent=function(e,r){var i=n.growingIO,o=i.dataStore,a=o.getOriginalSource,u=o.eventContextBuilder,s=o.eventInterceptor,c=i.vdsConfig,l=a(e),g=(null==r?void 0:r.query)||"",d=t({eventType:"VISIT"},u(e,{}));!C(r)&&r.path&&(d.path=r.path||"",d.query="string"===x(g)?g:ee(g),r.referralPage&&(d.referralPage=r.referralPage)),c.originalSource&&!C(l)&&(d=t(t({},d),l)),s(d)},this.buildCloseEvent=function(e){var r=n.growingIO.dataStore,i=r.eventContextBuilder;(0,r.eventInterceptor)(t({eventType:"APP_CLOSED"},i(e)))}},Ee=function(){function e(e){var n=this;this.growingIO=e,this.lifeBeforeShow=!0,this.getPagePath=function(){var e,t,r,i=n.growingIO,o=i.minipInstance,a=i.inPlugin,u=i.dataStore,s=i.trackingId,c=o.getCurrentPath();if(a){var l=u.getTrackerVds(s);return c||"/插件".concat(l.appId)}return c||(null===(e=u.eventHooks.appEffects.enterParams)||void 0===e?void 0:e.path)||(null===(t=u.lastPageEvent[s])||void 0===t?void 0:t.path)||(null===(r=u.lastVisitEvent[s])||void 0===r?void 0:r.path)},this.getPageQuery=function(){var e,t,r,i,o,a,u=n.growingIO,s=u.minipInstance,c=u.dataStore,l=u.trackingId,g=s.getCurrentPage(),d=s.getCurrentPath(),f=c.eventHooks.appEffects.enterParams,p=void 0===f?{}:f;if(!d)return p.path?ee(re(null==p?void 0:p.query,null===(r=null==p?void 0:p.referrerInfo)||void 0===r?void 0:r.extraData)):(null===(i=c.lastPageEvent[l])||void 0===i?void 0:i.path)?null===(o=c.lastPageEvent[l])||void 0===o?void 0:o.query:null===(a=c.lastVisitEvent[l])||void 0===a?void 0:a.query;var v=null!==(e=g.options)&&void 0!==e?e:g.$taroParams;return C(v)?C(n.queryOptions[d])?d===p.path?ee(re(null==p?void 0:p.query,null===(t=null==p?void 0:p.referrerInfo)||void 0===t?void 0:t.extraData)):void 0:ee(re(n.queryOptions[d])):ee(re(v))},this.getPageTitle=function(e){var t=n.growingIO,r=t.minipInstance,i=t.inPlugin,o=t.dataStore,a=r.getCurrentPath(),u=n.configuredTitle[a]||r.getPageTitle(r.getCurrentPage());if(i){var s=o.getTrackerVds(e||n.growingIO.trackingId);return u||"/插件".concat(s.appId).concat(a?"_"+f(a.split("/")):"")}return u},this.getReferralPage=function(e){var t,r,i,o=n.growingIO,a=o.minipInstance,u=o.dataStore,s=u.lastPageEvent,c=u.scene,l=u.eventHooks;return(null===(t=s[e])||void 0===t?void 0:t.path)||(null===(i=null===(r=l.appEffects.enterParams)||void 0===r?void 0:r.referrerInfo)||void 0===i?void 0:i.appId)||(c?"scn:".concat(a.scnPrefix).concat(c):null)},this.updateShareResult=function(e,t){void 0===t&&(t=!0);var r=n.buildShareQuery(e),i=r[0],o=r[1];return(t||_(e,"path"))&&(e.path=G(i+(o?"?".concat(o):""))),(t||_(e,"query"))&&(e.query=o),e},this.eventSetPageProps=function(e,r){var i=L(function(){return n.pageProps[e][n.getPagePath()]});return C(i)?r.attributes:Y(H(t(t({},r.attributes),i)))},this.queryOptions={},this.configuredTitle={},this.pageProps={}}return e.prototype.buildShareQuery=function(e){var n,r,i=V(null!==(n=e.path)&&void 0!==n?n:""),o=e.path||this.getPagePath(),a={},u=_(e,"path");if(_(e,"query"))a=te(null!==(r=e.query)&&void 0!==r?r:"")||{};else if(u)a=te(f(i))||{};else{var s=this.growingIO.minipInstance.getCurrentPage();a=t({},s.options||this.queryOptions[s.route]||{}),v(O(a)).forEach(function(e){e.toLowerCase().startsWith("utm_")&&T(a,e)})}return[o,ee(a)]},e}(),Ce=function(e){var n=this;this.growingIO=e,this.getPrevEventBucket=function(e){if(!e||"object"!=typeof e)return null;var t=n.prevEventByPage.get(e);if(t)return t;var r={};return n.prevEventByPage.set(e,r),r},this.setPrevEventTime=function(e,t,r){var i,o=n.getPrevEventBucket(e);if(o)o[t]=r;else{var a=(null==e?void 0:e.route)||(null==e?void 0:e.uri)||(null==e?void 0:e.__route__)||(null===(i=null==e?void 0:e.$page)||void 0===i?void 0:i.fullPath)||"";n.prevEvent["".concat(t,":").concat(a)]=r}},this.main=function(e,r,i){var o,a,u=Date.now(),s=n.growingIO,l=s.emitter,g=s.minipInstance,d=s.plugins,f=s.vdsConfig,p=s.platformConfig,v=s.dataStore,h=v.getTrackerVds,m=v.getOriginalSource,I=v.setOriginalSource,y=v.trackersExecute,S=v.eventHooks,w=v.toggleShareOut,_=v.buildAppMessageEvent,O=v.buildTimelineEvent,P=v.buildAddFavorites,k=S.currentPage;e||(e=g.getCurrentPage()),e.route||(e.route=g.getCurrentPath(e));var E=e.route||e.uri||e.__route__||(null===(o=null==e?void 0:e.$page)||void 0===o?void 0:o.fullPath)||"",x="".concat(r,":").concat(E),A=n.getPrevEventBucket(e),q=A?A[r]:n.prevEvent[x];if(q&&50>u-Number(q))return!1;l.emit(pe,{event:"Page ".concat(r),timestamp:u,params:{page:e,args:i[0]}}),f.debug&&console.log("Page:",E,"#",r,u),n.setPrevEventTime(e,r,u);var N=p.listeners.page;switch(l.emit(me,{page:e,event:"Page ".concat(r),params:{page:e,args:i[0]}}),k.lastLifecycle=k.currentLifecycle,k.currentLifecycle=r,r){case N.pageLoad:k.queryOptions[E]=b(e,"options")||b(e,"__displayReporter.query")||b(e,"$page.query")||b(e,"$wx.__displayReporter.query")||b(e,"$taroParams")||i[0]||{},T(k.queryOptions[E],["$taroTimestamp","gdpCircleRoomCollectUrl"]);break;case N.pageShow:y(function(e){var r=m(e);C(r)||r.path!==E||I(e,t(t({},r),{title:k.getPageTitle()})),h(e).trackPage&&n.buildPageEvent(e)}),w(!1);break;case N.pageHide:case N.pageUnload:break;case N.shareChat:case N.shareApp:w(!0),y(function(e){h(e).followShare&&_(e,i)});break;case N.shareTime:"xhsp"===g.platform&&w(!0),y(function(e){h(e).followShare&&O(e,i)});break;case N.addFavorites:y(function(e){h(e).followShare&&P(e,i)});break;case N.tabTap:var U=null===(a=null==d?void 0:d.gioEventAutoTracking)||void 0===a?void 0:a.buildTabClickEvent;f.autotrack&&U&&c(U)&&U(n.growingIO.trackingId,i[0])}return k.lastLifecycle=k.currentLifecycle,k.currentLifecycle="".concat(r,"End"),["onHideEnd","onUnloadEnd"].includes(k.currentLifecycle)&&(k.lifeBeforeShow=!0),"onShowEnd"===k.currentLifecycle&&(k.lifeBeforeShow=!1),!0},this.buildPageEvent=function(e,r){var i=n.growingIO.dataStore,o=i.eventContextBuilder,a=i.eventInterceptor,u=i.eventHooks.currentPage,s=t({eventType:"PAGE",referralPage:u.getReferralPage(e)},o(e));s.attributes=u.eventSetPageProps(e,s),!C(r)&&r.title&&(s.title=r.title),a(s)},this.prevEvent={},this.prevEventByPage=new WeakMap},xe=function(e){var n,r=this;this.growingIO=e,this.isNormalFc=function(e,t){return c(t)&&"constructor"!==e},this.objectTraverse=function(e,t){Object.getOwnPropertyNames(e).forEach(function(n){return t(n,e)}),_(e,"methods")&&Object.getOwnPropertyNames(e.methods).forEach(function(n){e[n]||t(n,e.methods)}),_(e,"lifetimes")&&Object.getOwnPropertyNames(e.lifetimes).forEach(function(n){e[n]||t(n,e.lifetimes)}),_(e,"pageLifetimes")&&Object.getOwnPropertyNames(e.pageLifetimes).forEach(function(n){e[n]||t(n,e.pageLifetimes)})},this.supLifeFcs=function(e,t){l(r["".concat(t,"Handlers")])&&r["".concat(t,"Handlers")].forEach(function(t){c(e[t])||["onShareAppMessage","onShareTimeline"].includes(t)||(e[t]=function(){})})},this.lifeFcEffectsFn=function(e,t,n,i,o){void 0===o&&(o=void 0);var a=r.getLifeArgs(t,o);return r.runLifeEffects(e,a,n,i),r.emitLifeEnd(e,a,n,i),o},this.getLifeArgs=function(e,t){void 0===t&&(t=void 0);var n="array"===x(e)?[].slice.call(e):[];return C(t)||n.push(t),n},this.runLifeEffects=function(e,t,n,i){return r["def".concat(n,"Cbs")][i].apply(e,t)},this.emitLifeEnd=function(e,t,n,i){r.growingIO.emitter.emit(pe,{event:"".concat(n," ").concat(i,"End"),timestamp:Date.now(),params:{instance:e,arguments:Array.from(t)}})},this.lifeFcEffects=function(e,n,i){var o=r;return function(){for(var r,a,u,s=this,c=[],l=0;arguments.length>l;l++)c[l]=arguments[l];if(o.shareEventTypes.includes(e)){var g=null!==(r=n.apply(this,c))&&void 0!==r?r:{};if(!o.growingIO.vdsConfig.followShare)return g;var d="promise"===x(g),f="promise"===x(g.promise),p=_(g,"_result")&&_(g,"_state");if(d||f||p){var v=function(n){void 0===n&&(n={});try{var r=t(t({},g),n),a=o.currentPage.updateShareResult(r);o.lifeFcEffectsFn(s,c,i,e,a)}catch(e){N(e,"error")}};d&&Promise.race([g,new Promise(function(e){setTimeout(function(){e({})},3e3)})]).then(v).catch(function(e){return N(e,"error")}),f&&Promise.race([g.promise,new Promise(function(e){setTimeout(function(){e({})},3e3)})]).then(v).catch(function(e){return N(e,"error")}),p&&(null===(a=o.growingIO.minipInstance)||void 0===a||a.handleSharePromise(g,v)),u=o.currentPage.updateShareResult(g,!1)}else u=o.currentPage.updateShareResult(g),o.lifeFcEffectsFn(this,c,i,e,u)}else{var h=o.getLifeArgs(c);o.runLifeEffects(this,h,i,e),u=n.apply(this,c),o.emitLifeEnd(this,h,i,e)}return u}},this.customFcEffects=function(e,t){var n=r;return function(){for(var r,i,o=[],a=0;arguments.length>a;a++)o[a]=arguments[a];if(n.growingIO.vdsConfig.autotrack&&n.growingIO.plugins.gioEventAutoTracking)try{var u=o[0]||{};_(u,"type")&&((null==u?void 0:u.currentTarget)||(null==u?void 0:u.target))||(u=o[o.length-1]),((null==u?void 0:u.currentTarget)||(null==u?void 0:u.target))&&n.actionEventTypes.includes(u.type)&&(c(n.actionEffects)||(n.actionEffects=(null===(i=null===(r=n.growingIO.plugins)||void 0===r?void 0:r.gioEventAutoTracking)||void 0===i?void 0:i.main)||function(){}),null==n||n.actionEffects(u,e))}catch(e){N(e,"error")}return t.apply(this,o)}},this.appApplyProxy=function(e,t){return r.appHandlers.includes(e)?r.lifeFcEffects(e,t,"App"):r.customFcEffects(e,t)},this.pageApplyProxy=function(e,t){return r.pageHandlers.includes(e)?r.lifeFcEffects(e,t,"Page"):r.customFcEffects(e,t)},this.appOverriding=function(e){return r.setAppEffectCbs(),r.supLifeFcs(e,"app"),r.objectTraverse(e,function(e,t){r.isNormalFc(e,t[e])&&(t[e]=r.appApplyProxy(e,t[e]))}),e},this.pageOverriding=function(e){return r.setPageEffectCbs(),r.supLifeFcs(e,"page"),r.objectTraverse(e,function(e,t){r.isNormalFc(e,t[e])&&(t[e]=r.pageApplyProxy(e,t[e]))}),e},this.componentOverriding=function(e){return r.setPageEffectCbs(),e.methods||(e.methods={}),r.supLifeFcs(r.growingIO.inPlugin?e:e.methods,"page"),r.objectTraverse(r.growingIO.inPlugin?e:e.methods,function(e,t){r.isNormalFc(e,t[e])&&(t[e]=r.pageApplyProxy(e,t[e]))}),e},this.setAppEffectCbs=function(){var e=r;r.appHandlers.forEach(function(t){r.defAppCbs[t]=function(){for(var n=[],r=0;arguments.length>r;r++)n[r]=arguments[r];return e.appEffects.main(t,n)}})},this.setPageEffectCbs=function(){var e=r;r.pageHandlers.forEach(function(t){r.defPageCbs[t]=function(){for(var n=[],r=0;arguments.length>r;r++)n[r]=arguments[r];return e.pageEffects.main(this,t,n)}})},this.growingApp=function(e){return c(r.originalApp)?r.originalApp(r.appOverriding(e)):r.appOverriding(e)},this.growingPage=function(e){return c(r.originalPage)?r.originalPage(r.pageOverriding(e)):r.pageOverriding(e)},this.growingComponent=function(e){return c(r.originalComponent)?r.originalComponent(r.componentOverriding(e)):r.componentOverriding(e)},this.growingBehavior=function(e){return c(r.originalBehavior)?r.originalBehavior(r.componentOverriding(e)):r.componentOverriding(e)},this.nativeGrowing=function(e){void 0===e&&(e=["App","Page","Component","Behavior"]);var t=r,n=r.growingIO.platformConfig.hooks;if(e.includes("App"))try{n.App&&!r.appHooked&&(App=function(){for(var e=[],n=0;arguments.length>n;n++)e[n]=arguments[n];return t.originalApp(t.appOverriding(e[0]))},r.appHooked=!0)}catch(e){}if(e.includes("Page"))try{n.Page&&!r.pageHooked&&(Page=function(){for(var e=[],n=0;arguments.length>n;n++)e[n]=arguments[n];return t.originalPage(t.pageOverriding(e[0]))},r.pageHooked=!0)}catch(e){}if(e.includes("Component"))try{n.Component&&!r.componentHooked&&(Component=function(){for(var e=[],n=0;arguments.length>n;n++)e[n]=arguments[n];return t.originalComponent(t.componentOverriding(e[0]))},r.componentHooked=!0)}catch(e){}if(e.includes("Behavior"))try{n.Behavior&&!r.behaviorHooked&&(Behavior=function(){for(var e=[],n=0;arguments.length>n;n++)e[n]=arguments[n];return t.originalBehavior(t.componentOverriding(e[0]))},r.behaviorHooked=!0)}catch(e){}},this.initOriginalValue=function(){r.setAppEffectCbs(),r.setPageEffectCbs(),r.originalApp=L(function(){return App||global.App}),r.originalPage=L(function(){return Page||global.Page}),r.originalComponent=L(function(){return Component||global.Component}),r.originalBehavior=L(function(){return Behavior||global.Behavior})},this.initEventHooks=function(){var e=r,t=r.growingIO,n=t.platformConfig,i=t.gioPlatform;r.initOriginalValue(),n.canHook?(r.nativeGrowing(),J().GioApp=L(function(){return null!==App&&void 0!==App?App:r.originalApp}),J().GioPage=L(function(){return null!==Page&&void 0!==Page?Page:r.originalPage}),J().GioComponent=L(function(){return null!==Component&&void 0!==Component?Component:r.originalComponent}),J().GioBehavior=L(function(){return null!==Behavior&&void 0!==Behavior?Behavior:r.originalBehavior})):"quickapp"===i&&(J().GioApp=function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];return e.appOverriding(t[0])},J().GioPage=function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];return e.pageOverriding(t[0])},J().GioComponent=function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];return e.pageOverriding(t[0])})};var i=null===(n=this.growingIO)||void 0===n?void 0:n.platformConfig;this.defAppCbs={},this.defPageCbs={},this.appHandlers=i.appHandlers,this.pageHandlers=i.pageHandlers,this.shareEventTypes=i.shareEventTypes,this.actionEventTypes=i.actionEventTypes,this.appEffects=new Te(this.growingIO),this.pageEffects=new Ce(this.growingIO),this.currentPage=new Ee(this.growingIO)},Ae=function(){function e(e){var r,i,o=this;this.growingIO=e,this.ALLOW_SETTING_KEYS=O(ae),this.getStorageKey=function(e,t){var n=o.growingIO.inPlugin;return"".concat(e===o.growingIO.trackingId?"":e).concat(fe[n?"plugin_"+t:t])},this.getGsid=function(e){var t=Number(o._gsid[e]);return Number.isNaN(t)||t>=1e9||1>t?(o.setGsid(e,1),1):t},this.setGsid=function(e,t){var n=Number(t);(Number.isNaN(n)||n>=1e9||1>n)&&(n=1),o._gsid[e]=n,10>o._gsid[e]-o._stid[e]||o.saveStorageInfo()},this.initStorageInfo=function(e){var t=o.growingIO.minipInstance,n=t.getStorageSync(o.getStorageKey(e,"gsid")),r=Number(n);(Number.isNaN(r)||r>=1e9||1>r)&&(r=1),o._gsid[e]=r,o._stid[e]=r,r!==n&&t.setStorageSync(o.getStorageKey(e,"gsid"),r)},this.saveStorageInfo=function(){var e=o.growingIO.minipInstance;o._stid=t({},o._gsid),X(e,o.initializedTrackingIds.map(function(e){return{key:o.getStorageKey(e,"gsid"),value:o._gsid[e]}}))},this.setOriginalSource=function(e,t){o.growingIO.minipInstance.setStorageSync(o.getStorageKey(e,"originalSource"),JSON.stringify(t))},this.getOriginalSource=function(e){var t,n=o.growingIO.minipInstance;return null!==(t=L(function(){return JSON.parse(n.getStorageSync(o.getStorageKey(e,"originalSource")))}))&&void 0!==t?t:{}},this.getTrackerVds=function(e){return o.growingIO.trackingId===e?t({},o.growingIO.vdsConfig):void 0},this.initTrackerOptions=function(e){var t=o.initOptions(e);return t.trackingId=e.trackingId,o.growingIO.trackingId=e.trackingId,o.growingIO.vdsConfig=t,t},this.initTrackerHooker=function(e){var t,n,r,i,a=o.growingIO,u=a.platformConfig,s=a.inPlugin,c=a.minipInstance,l=a.plugins,g=e.uniVue,d=e.taro,f=e.mpx,p=e.mpvue;g||d||p||"quickapp"===c.platform||(u.canHook=!0),!s||["tbp","jdp"].includes(c.platform)?o.eventHooks.initEventHooks():o.eventHooks.initOriginalValue();try{g&&(null===(t=null==l?void 0:l.gioUniAppAdapter)||void 0===t||t.main()),d&&(null===(n=null==l?void 0:l.gioTaroAdapter)||void 0===n||n.main()),p&&(null===(r=null==l?void 0:l.gioMpvueAdapter)||void 0===r||r.main()),f&&(null===(i=null==l?void 0:l.gioMpxAdapter)||void 0===i||i.main())}catch(e){N(e,"error")}},this.initOptions=function(e){var n,r,i,a,u,s,c=e.projectId,g=e.dataSourceId,d=e.appId,f=e.trackingId,p={};return o.ALLOW_SETTING_KEYS.forEach(function(t){var n=ae[t].type;(l(n)?n.includes(x(e[t])):x(e[t])===ae[t].type)?"ignoreFields"===t?p.ignoreFields=e.ignoreFields.filter(function(e){return ge.includes(e)}):"extraParams"===t?p.extraParams=e.extraParams.filter(function(e){return de.includes(e)}):(p[t]=e[t],["dataCollect","autotrack"].includes(t)&&!p[t]&&N("已关闭".concat(ce[t]),"info")):p[t]=ae[t].default}),p.uploadInterval=Math.round(p.uploadInterval),(Number.isNaN(p.uploadInterval)||0>p.uploadInterval||p.uploadInterval>3e3)&&(p.uploadInterval=1e3),p.enableIdMapping&&!p.idMapping&&(p.idMapping=!0),p.idMapping||o.growingIO.userStore.setUserKey(f,""),T(p,"enableIdMapping"),p.pluginMode&&(o.growingIO.inPlugin=!0),!isNaN(Number(p.requestTimeout))&&p.requestTimeout>0||(p.requestTimeout=5e3),(0>p.impressionScale||p.impressionScale>1)&&(p.impressionScale=0),(0>p.keepAlive||p.keepAlive>1440)&&(p.keepAlive=5),(1>p.sessionExpires||p.sessionExpires>1440)&&(p.sessionExpires=-1),t(t({},p),{projectId:c,dataSourceId:g,appId:d,trackingId:f,performance:{monitor:null===(r=null===(n=p.performance)||void 0===n?void 0:n.monitor)||void 0===r||r,exception:null===(a=null===(i=p.performance)||void 0===i?void 0:i.exception)||void 0===a||a,network:null!==(s=null===(u=p.performance)||void 0===u?void 0:u.network)&&void 0!==s&&s}})},this.setOption=function(e,n,r){var i,a=o.growingIO,u=a.userStore,s=a.emitter,c=o.getTrackerVds(e),l=t({},c);return"ignoreFields"===n&&(r=r.filter(function(e){return ge.includes(e)})),o.updateVdsConfig(e,t(t({},c),((i={})[n]=r,i))),"dataCollect"===n&&l.dataCollect!==r&&r&&u.setSessionId(e),s.emit(_e,{optionName:n,optionValue:r}),!0},this.getOption=function(e,t){var n=o.getTrackerVds(e);return t&&_(o.growingIO.vdsConfig,t)?_(n,t)?n[t]:o.growingIO.vdsConfig[t]:C(t)?n:void U("getOption > ".concat(t))},this.updateVdsConfig=function(e,n){e===o.growingIO.trackingId?(o.growingIO.vdsConfig=t(t({},o.growingIO.vdsConfig),n),J().vdsConfig=o.growingIO.vdsConfig):(o.growingIO.subInstance[e]=t(t({},o.growingIO.subInstance[e]),n),J().vdsConfig.subInstance[e]=o.growingIO.subInstance[e])},this.toggleShareOut=function(e){u(e)?o.shareOut=e:o.shareOut=!o.shareOut},this.sendVisit=function(e,t){o.eventHooks.appEffects.buildVisitEvent(e,t)},this.sendPage=function(e,t){o.eventHooks.pageEffects.buildPageEvent(e,t)},this.eventConverter=function(e){var n=o.growingIO,r=n.dataStore,i=n.uploader;if(o.getTrackerVds(e.trackingId).dataCollect){["LOGIN_USER_ATTRIBUTES","APP_CLOSED"].includes(e.eventType)||(e.eventSequenceId=r.getGsid(e.trackingId),r.setGsid(e.trackingId,e.eventSequenceId+1));var a={};P(e,function(e,t){var n;if("element"===t){var r=null!==(n=d(e))&&void 0!==n?n:{};P(r,function(e,t){C(e)&&0!==e||(a[t]=e)})}else C(e)&&0!==e||(a[t]=e)}),o.growingIO.emitter.emit(he,{composedEvent:a}),i.commitRequest(t(t({},a),{requestId:F()}))}},this.eventRefactor=function(e){var n,r,i=t(t({},e),o.eventContextBuilder(e.trackingId,{path:e.path,query:e.query,timestamp:e.timestamp}));return i.attributes=t(t({},null!==(n=i.attributes)&&void 0!==n?n:{}),null!==(r=e.attributes)&&void 0!==r?r:{}),i},this.eventInterceptor=function(e){var t=o.growingIO.minipInstance,r=t.systemInfo,i=t.network;C(r)||C(i)?o.interceptEvents.push(e):C(o.interceptEvents)?o.eventConverter(e):(n(n([],o.interceptEvents,!0),[e],!1).forEach(function(e){o.eventConverter(o.eventRefactor(e))}),o.interceptEvents=[])},this.eventReleaseInspector=function(){var e=o.growingIO.minipInstance,t=e.systemInfo,r=e.network;t&&r&&!C(o.interceptEvents)&&(n([],o.interceptEvents,!0).forEach(function(e){o.eventConverter(o.eventRefactor(e))}),o.interceptEvents=[])},this.buildAppMessageEvent=function(e,n){var r,i,a,u=n[0];2>n.length?1===n.length&&(a=u):a=n[1];var s=o.growingIO.dataStore,c=s.eventContextBuilder,l=s.eventInterceptor,g=((null==a?void 0:a.path)||"").split("?"),f=t({eventType:"CUSTOM",eventName:"$mp_on_share"},c(e));f.attributes=Y(t(t(t({},null!==(r=f.attributes)&&void 0!==r?r:{}),{$from:null==u?void 0:u.from,$target:null===(i=null==u?void 0:u.target)||void 0===i?void 0:i.id,$share_title:null==a?void 0:a.title,$share_path:d(g),$share_query:g[1]}),null==a?void 0:a.attributes)),l(f)},this.buildTimelineEvent=function(e,n){var r,i,a,u=n[0];2>n.length?1===n.length&&(a=u):a=n[1];var s=o.growingIO.dataStore,c=s.eventContextBuilder,l=s.eventInterceptor,g=((null==a?void 0:a.path)||"").split("?"),f=t({eventType:"CUSTOM",eventName:"$mp_share_timeline"},c(e));f.attributes=Y(t(t(t({},null!==(r=f.attributes)&&void 0!==r?r:{}),{$target:null===(i=null==u?void 0:u.target)||void 0===i?void 0:i.id,$share_title:null==a?void 0:a.title,$share_path:d(g),$share_query:g[1]}),null==a?void 0:a.attributes)),l(f)},this.buildAddFavorites=function(e,n){var r,i,a=n[0];2>n.length?1===n.length&&(i=a):i=n[1];var u=o.growingIO.dataStore,s=u.eventContextBuilder,c=u.eventInterceptor,l=((null==i?void 0:i.path)||"").split("?"),g=t({eventType:"CUSTOM",eventName:"$mp_add_favorites"},s(e));g.attributes=Y(t(t({},null!==(r=g.attributes)&&void 0!==r?r:{}),{$share_title:null==i?void 0:i.title,$share_path:d(l),$share_query:l[1]})),c(g)},this.trackersExecute=function(e){o.initializedTrackingIds.forEach(function(t){"function"===x(e)&&e(t)})},this.initializedTrackingIds=[],this.eventContextBuilder=new be(this.growingIO).main,this.eventHooks=new xe(this.growingIO),this.shareOut=!1,this._gsid={},this._stid={},this.lastVisitEvent={},this.lastPageEvent={},this.locationData={},this.generalProps={},this.trackTimers={},this.interceptEvents=[];var a=this.growingIO,s=a.emitter,g=a.minipInstance;s.on(Pe,function(e){var t=e.trackingId;o.initializedTrackingIds.push(t),o.initStorageInfo(t)}),s.on(ve,function(e){var t=e.eventData,n=e.trackingId;"VISIT"===t.eventType&&(o.lastVisitEvent[n]=t),"PAGE"===t.eventType&&(o.lastPageEvent[n]=t)}),c(null===(r=g.minip)||void 0===r?void 0:r.onAppHide)&&g.minip.onAppHide(function(){o.trackersExecute(function(e){var t=o.trackTimers[e];P(t,function(e){e.start&&(e.leng=e.leng+(+Date.now()-e.start))})})}),c(null===(i=g.minip)||void 0===i?void 0:i.onAppShow)&&g.minip.onAppShow(function(){o.trackersExecute(function(e){var t=o.trackTimers[e];P(t,function(e){e.start&&(e.start=+Date.now())})})}),s.on(_e,function(e){var t=e.optionName,n=e.optionValue;"dataCollect"===t&&!1===n&&o.trackersExecute(function(e){o.growingIO.clearTrackTimer(e)})}),this.growingIO.emitter.on(ke,function(e){var t=e.oldSessionId,n=e.trackingId;if(t){var r=o.eventHooks.currentPage,i=r.getPagePath,a=r.getPageQuery,u=i(),s=a();if(u)o.sendVisit(n,{path:u,query:s});else{var c=o.lastPageEvent[n];o.sendVisit(n,{path:c.path,query:c.query})}o.eventHooks.currentPage.lifeBeforeShow||o.sendPage(n)}})}return Object.defineProperty(e.prototype,"scene",{get:function(){return this._scene},set:function(e){var t=this._scene;this._scene=e,t!==this._scene&&this.growingIO.emitter.emit("SCENE_UPDATE",{newScene:e,oldScene:t})},enumerable:!1,configurable:!0}),e}(),qe={scnPrefix:"",appHandlers:["onLaunch","onShow","onHide","onError","onPageNotFound","onUnhandledRejection","onThemeChange"],pageHandlers:["onLoad","onShow","onReady","onHide","onShareAppMessage","onTabItemTap","onUnload","onPullDownRefresh","onReachBottom","onResize"],shareEventTypes:["onShareAppMessage","onShareTimeline","onAddToFavorites"],actionEventTypes:["onclick","tap","onTap","longpress","longTap","blur","change","onChange","submit","confirm","getuserinfo","getphonenumber","contact","mouseup"],canHook:!0,hooks:{App:!0,Page:!0,Component:!0,Behavior:!0},listeners:{app:{appLaunch:"onLaunch",appShow:"onShow",appClose:"onHide"},page:{pageLoad:"onLoad",pageShow:"onShow",pageReady:"onReady",pageHide:"onHide",pageUnload:"onUnload",tabTap:"onTabItemTap",shareApp:"onShareAppMessage"},actions:{click:["onclick","tap","longpress","longTap","getuserinfo","getphonenumber","contact","mouseup"],change:["blur","change","confirm"],submit:["submit"]}}},Ne=t(t({},qe),{listeners:t({},qe.listeners),name:"Weixin",platform:"MinP"});Ne.pageHandlers=n(n([],qe.pageHandlers,!0),["onShareTimeline","onAddToFavorites"],!1),Ne.listeners.page=t(t({},qe.listeners.page),{shareTime:"onShareTimeline",addFavorites:"onAddToFavorites"});var Ue=function(n){function r(e){var r=n.call(this,e)||this;return r.growingIO=e,r.getSystemInfo=function(){return e=r,n=void 0,o=function(){var e,n,r,i=this;return function(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=u(0),a.throw=u(1),a.return=u(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(u){return function(s){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,r=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],r=0}finally{n=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}}(this,function(o){switch(o.label){case 0:return e=t(t(t({},L(function(){var e,t;return null===(t=null===(e=i.minip)||void 0===e?void 0:e.getDeviceInfo)||void 0===t?void 0:t.call(e)})||{}),L(function(){var e,t;return null===(t=null===(e=i.minip)||void 0===e?void 0:e.getWindowInfo)||void 0===t?void 0:t.call(e)})||{}),L(function(){var e,t;return null===(t=null===(e=i.minip)||void 0===e?void 0:e.getAppBaseInfo)||void 0===t?void 0:t.call(e)})||{}),n=L(function(){var e,t;return null===(t=null===(e=i.minip)||void 0===e?void 0:e.getSystemInfoSync)||void 0===t?void 0:t.call(e)})||{},r=t(t({},n),e),C(r)?[4,new Promise(function(e){var t,n={__gioFailed:!0};if(!(null===(t=i.minip)||void 0===t?void 0:t.getSystemInfo))return i.systemInfo=n,void e(n);try{i.minip.getSystemInfo({success:function(t){i.systemInfo=C(t)?n:t,e(i.systemInfo)},fail:function(){i.systemInfo=n,e(n)}})}catch(t){i.systemInfo=n,e(n)}})]:(this.systemInfo=r,[2,r]);case 1:return[2,o.sent()]}})},new((i=void 0)||(i=Promise))(function(t,r){function a(e){try{s(o.next(e))}catch(e){r(e)}}function u(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var n;e.done?t(e.value):(n=e.value,n instanceof i?n:new i(function(e){e(n)})).then(a,u)}s((o=o.apply(e,n||[])).next())});var e,n,i,o},r.hookSetTitle(),r}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+n+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}(r,n),r}(function(e){var t=this;this.growingIO=e,this.minip=Q("wx"),this.loadMetadata=function(e,n){new Promise(function(e,t){var r=setTimeout(function(){return e(void 0)},3e3);Promise.resolve(L(n)).then(function(t){clearTimeout(r),e(t)},function(e){clearTimeout(r),t(e)})}).then(function(n){var r;C(t[e])&&(t[e]=C(n)?{__gioFailed:!0}:n),null===(r=t.growingIO.dataStore)||void 0===r||r.eventReleaseInspector()},function(){var n;t[e]={__gioFailed:!0},null===(n=t.growingIO.dataStore)||void 0===n||n.eventReleaseInspector()})},this.hookSetTitle=function(){var e,n=null===(e=t.minip)||void 0===e?void 0:e.setNavigationBarTitle,r=t;n&&Object.defineProperty(t.minip,"setNavigationBarTitle",{writable:!0,enumerable:!0,configurable:!0,value:function(){if(r.growingIO.gioSDKInitialized){var e=r.getCurrentPath(),t=(arguments[0]||{}).title;r.growingIO.dataStore.eventHooks.currentPage.configuredTitle[e]=t}return n.apply(this,arguments)}})},this.initImpression=function(e){var n,r;null===(r=null===(n=t.growingIO.plugins)||void 0===n?void 0:n.gioImpressionTracking)||void 0===r||r.main(e,"observeAll")},this.getCurrentPage=function(){return L(function(){return f(getCurrentPages())})||{}},this.getCurrentPath=function(){var e=t.getCurrentPage();return(null==e?void 0:e.route)||(null==e?void 0:e.uri)||(null==e?void 0:e.__route__)||""},this.getPageTitle=function(e){var n,r,i,a,u,s,c,g,d=W(),f="",p=$(d);"string"===x(p)&&(p=null!==(n=L(function(){return JSON.parse(p)}))&&void 0!==n?n:{});var v,h=(null==e?void 0:e.data)||e.$data||{};if((f=o(null==h?void 0:h.gioPageTitle)?null==h?void 0:h.gioPageTitle:"")||L(function(){var t,n,r=z(d);r&&(v=r["".concat(e.route,".json")]||{},f=(null==v?void 0:v.navigationBarTitleText)||(null===(n=null===(t=null==v?void 0:v.mod)||void 0===t?void 0:t.exports)||void 0===n?void 0:n.navigationBarTitleText))}),!f&&p){var m=t.growingIO.dataStore.eventHooks.appEffects.enterParams;if(e.route||C(m)||(e.route=m.path||"",f=e.route?t._getTitleFromTabBar(p,e.route):""),!f&&(v=l(p.pages)?null!==(r=p.pages.find(function(t){return t.path===e.route}))&&void 0!==r?r:{}:p.page||{})){var I=v[e.route]||v["".concat(e.route,".html")]||v;f=(null==I?void 0:I.navigationBarTitleText)||(null===(i=null==I?void 0:I.window)||void 0===i?void 0:i.navigationBarTitleText)}f||(f=t._getTitleFromTabBar(p,e.route))}return f||(f=["wx","tt"].includes(d)?null===(s=null===(u=null===(a=p||global||$global)||void 0===a?void 0:a.global)||void 0===u?void 0:u.window)||void 0===s?void 0:s.navigationBarTitleText:null===(g=null===(c=p||global||$global)||void 0===c?void 0:c.window)||void 0===g?void 0:g.navigationBarTitleText),B(f)},this._getTitleFromTabBar=function(e,t){var n,r,i=null===(r=null===(n=null==e?void 0:e.tabBar)||void 0===n?void 0:n.list)||void 0===r?void 0:r.find(function(e){return e.pagePath===t||e.pagePath==="".concat(t,".html")});return(null==i?void 0:i.text)||""},this.getStorageSync=function(e){var n,r=null===(n=t.minip)||void 0===n?void 0:n.getStorageSync(e);return s(r)&&r.expiredAt?r.expiredAt<Date.now()?"":r.value:r},this.setStorageSync=function(e,n,r){var i;r&&(n={value:n,expiredAt:r}),null===(i=t.minip)||void 0===i||i.setStorageSync(e,n)},this.setStorage=function(e,n){var r;null===(r=t.minip)||void 0===r||r.setStorage({key:e,data:n})},this.removeStorageSync=function(e){var n;null===(n=t.minip)||void 0===n||n.removeStorageSync(e)},this.getNetworkType=function(){var e=t;return new Promise(function(n){var r;null===(r=t.minip)||void 0===r||r.getNetworkType({success:function(t){e.network=t,n(t)},fail:function(){e.network={__gioFailed:!0},n(e.network)}})})},this.request=function(e){var n,r=e.url,i=e.data,o=e.header,a=e.timeout,u=e.method,s=e.success,l=e.fail,g=e.complete,d=null===(n=t.minip)||void 0===n?void 0:n.request({url:r,data:i,header:o,timeout:a,method:u,success:s,fail:l,complete:g}),f=setTimeout(function(){(null==d?void 0:d.abort)&&c(null==d?void 0:d.abort)&&(null==d||d.abort()),clearTimeout(f),f=null},(a||1e4)+10);return d},this.getSystemInfo=function(){var e=t;return new Promise(function(n){var r;null===(r=t.minip)||void 0===r||r.getSystemInfo({success:function(t){e.systemInfo=t,n(t)},fail:function(){e.systemInfo={__gioFailed:!0},n(e.systemInfo)}})})},this.setNetworkStatusListener=function(){var e;null===(e=t.minip)||void 0===e||e.onNetworkStatusChange(function(e){var n=e.networkType;n&&(t.network&&s(t.network)||(t.network={}),t.network.networkType=n)})};var n=this.growingIO.platformConfig,r=n.platform,i=n.scnPrefix;this.platform=r,this.scnPrefix=i,this.growingIO.emitter.on(Oe,function(){t.loadMetadata("network",function(){return t.getNetworkType()}),t.loadMetadata("systemInfo",function(){return t.getSystemInfo()})})}),Le=["gioPerformance"],De=function(e){var t,r,i,o,a,u,s=this;this.growingIO=e,this.innerPluginInit=function(){var e;Le.forEach(function(e){var t;return T(null===(t=s.pluginsContext)||void 0===t?void 0:t.plugins,e)}),O(null===(e=s.pluginsContext)||void 0===e?void 0:e.plugins).forEach(function(e){var t,n,r=null!==(n=null===(t=s.pluginsContext)||void 0===t?void 0:t.plugins[e])&&void 0!==n?n:{},i=r.name,o=r.method;h(s.pluginItems,function(e){return e.name===i})||s.pluginItems.push({name:y(i||e),method:o||function(e){}})}),C(s.pluginItems)||s.installAll()},this.install=function(e,t,n){var r,i,o=s.growingIO.emitter,a=t||h(s.pluginItems,function(t){return t.name===e});if((null===(r=s.growingIO)||void 0===r?void 0:r.plugins)[e])return N("重复加载插件 ".concat(e," 或插件重名,已跳过加载!"),"warn"),!1;if(!a)return N("插件加载失败!不存在名为 ".concat(e," 的插件!"),"error"),!1;try{return(null===(i=s.growingIO)||void 0===i?void 0:i.plugins)[e]=new a.method(s.growingIO,n),t&&(o.emit(ye,e),N("加载插件 ".concat(e),"info")),!0}catch(n){return s.lifeError(t,n),N("插件【".concat(e,"】加载异常 ").concat(n),"error"),!1}},this.installAll=function(e){(e||s.pluginItems).forEach(function(t){s.install(t.name,e?t:void 0,e?null==t?void 0:t.options:void 0)&&!h(s.pluginItems,function(e){return e.name===t.name})&&s.pluginItems.push({name:y(t.name),method:t.method?t.method:function(){}})})},this.uninstall=function(e){var t,n=s.pluginItems.findIndex(function(t){return t.name===e});n>-1&&s.pluginItems.splice(n,1);var r=T(null===(t=s.growingIO)||void 0===t?void 0:t.plugins,e);return r||N("卸载插件 ".concat(e," 失败!"),"error"),r},this.uninstallAll=function(){n([],s.pluginItems,!0).forEach(function(e){return s.uninstall(e.name)})},this.lifeError=function(e,t){if(!s.handlingError){s.handlingError=!0;try{s.growingIO.emitter.emit(Ie,{plugin:e,error:t})}finally{s.handlingError=!1}}N("插件执行错误 ".concat((null==e?void 0:e.name)||"unknown"," ").concat(t),"error")},this.callLifeCycle=function(e,t){s.pluginItems.forEach(function(n){var r=s.growingIO.plugins[n.name]?s.growingIO.plugins[n.name][e]:void 0;if(r&&c(r))try{r(t)}catch(e){s.lifeError(n,e)}})},this.pluginsContext={plugins:{}},this.pluginItems=[],this.handlingError=!1,null===(t=this.growingIO.emitter)||void 0===t||t.on(ye,function(e){return s.callLifeCycle("onInstall",e)}),null===(r=this.growingIO.emitter)||void 0===r||r.on(Ie,function(e){return s.callLifeCycle("onError",e)}),null===(i=this.growingIO.emitter)||void 0===i||i.on(me,function(e){return s.callLifeCycle("onComposeBefore",e)}),null===(o=this.growingIO.emitter)||void 0===o||o.on(he,function(e){return s.callLifeCycle("onComposeAfter",e)}),null===(a=this.growingIO.emitter)||void 0===a||a.on(we,function(e){return s.callLifeCycle("onSendBefore",e)}),null===(u=this.growingIO.emitter)||void 0===u||u.on(Se,function(e){return s.callLifeCycle("onSendAfter",e)})},Be={},Ke={}.hasOwnProperty;function He(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function Fe(e){try{return encodeURIComponent(e)}catch(e){return null}}Be.stringify=function(e,t){t=t||"";var n,r,i=[];for(r in"string"!=typeof t&&(t="?"),e)if(Ke.call(e,r)){if((n=e[r])||null!=n&&!isNaN(n)||(n=""),r=Fe(r),n=Fe(n),null===r||null===n)continue;i.push(r+"="+n)}return i.length?t+i.join("&"):""},Be.parse=function(e){for(var t,n=/([^=?#&]+)=?([^&]*)/g,r={};t=n.exec(e);){var i=He(t[1]),o=He(t[2]);null===i||null===o||i in r||(r[i]=o)}return r};var Re=function(e){var r=this;this.growingIO=e,this.generateURL=function(e){var t=r.growingIO.dataStore.getTrackerVds(e),n=t.serverUrl,i=t.projectId;return S(n,"http")?"".concat(n,"/v3/projects/").concat(i,"/collect"):"https://".concat(n,"/v3/projects/").concat(i,"/collect")},this.getHoardingQueue=function(e){var t;return null!==(t=r.hoardingQueue[e])&&void 0!==t?t:[]},this.getRequestQueue=function(e){var t;return null!==(t=r.requestQueue[e])&&void 0!==t?t:[]},this.commitRequest=function(e){var n,o,a=t({},e),u=r.growingIO,s=u.vdsConfig;u.emitter.emit(ve,{eventData:e,trackingId:e.trackingId}),s.forceLogin?(i(r.hoardingQueue[e.trackingId])&&(r.hoardingQueue[e.trackingId]=[]),null===(n=r.hoardingQueue[e.trackingId])||void 0===n||n.push(a)):(i(r.requestQueue[e.trackingId])&&(r.requestQueue[e.trackingId]=[]),null===(o=r.requestQueue[e.trackingId])||void 0===o||o.push(a),r.initiateRequest(e.trackingId))},this.initiateRequest=function(e,t){var i=r.growingIO,o=i.plugins,a=i.vdsConfig,u=i.minipInstance,s=i.dataStore,c=r.getHoardingQueue(e),l=r.getRequestQueue(e),g=n(n([],c,!0),l,!0),d=function(e){var n,i;if(null===(n=null==a?void 0:a.tbConfig)||void 0===n?void 0:n.cloudFuncSend)null===(i=null==o?void 0:o.gioTaobaoAdapter)||void 0===i||i.singleInvoke(e);else if(t)r.batchInvoke(e);else{var c=r.growingIO.dataStore.getTrackerVds(e).uploadInterval;r.getThrottledBatchInvoke(e,c)(e)}g.some(function(e){return"VISIT"===e.eventType})&&u.removeStorageSync(s.getStorageKey(e,"originalSource"))};if(g.length>0)if(r.requestingNum<r.requestLimit)d(e);else var f=setInterval(function(){r.requestingNum<r.requestLimit&&(d(e),clearInterval(f),f=void 0)},500)},this.getThrottledBatchInvoke=function(e,t){var n=r.throttledBatchInvoke[e];return n&&n.uploadInterval===t||(r.throttledBatchInvoke[e]={uploadInterval:t,invoke:E(function(e){return r.batchInvoke(e)},t,!1,!1)}),r.throttledBatchInvoke[e].invoke},this.getHttpCode=function(e){var t,n;return Number(null!==(n=null!==(t=null==e?void 0:e.statusCode)&&void 0!==t?t:null==e?void 0:e.status)&&void 0!==n?n:null==e?void 0:e.code)},this.batchInvoke=function(e){var i=r.growingIO,o=i.vdsConfig,a=i.emitter,u=r.getHoardingQueue(e),s=r.getRequestQueue(e),c=n(n([],u,!0),s,!0);c.length>50?(c=c.slice(0,50),u.length>50?r.hoardingQueue[e]=u.slice(50):(r.requestQueue[e]=s.slice(50-u.length),r.hoardingQueue[e]=[])):(r.hoardingQueue[e]=[],r.requestQueue[e]=[]);var l=c.filter(function(e){return(r.retryIds[e.requestId]||0)<=r.retryLimit});if(!C(l)){var g=l.map(function(e){var n=t({},e);return T(n,["requestId","trackingId"]),n});o.debug&&console.log("[GrowingIO Debug]:",JSON.stringify(g,null,2)),a.emit(we,{eventsQueue:l,requestData:g,trackingId:e})}},this.sendEvent=function(e,t){var i,o=d(e).trackingId,a=r.growingIO,u=a.minipInstance,s=a.dataStore,c=a.emitter,l=a.plugins,g=s.getTrackerVds(o),f=g.compress,p=g.requestTimeout;r.requestingNum+=1;var v=function(n){e.forEach(function(e){r.requestFailFn(e)}),N("请求失败!".concat(JSON.stringify(n)),"error"),c.emit("ON_SEND_ERROR",{eventsQueue:e,requestData:t,trackingId:o})},h={"content-type":"jdp"===u.platform?"application/json":"application/json;charset=UTF-8"},m=n([],t,!0),I=!!f&&(null===(i=null==l?void 0:l.gioCompress)||void 0===i?void 0:i.compressToUTF16);I&&(m=l.gioCompress.compressToUTF16(JSON.stringify(t)),h["X-Compress-Codec"]="1");var y=r.generateURL(o);u.request({url:"".concat(y,"?stm=").concat(Date.now(),"&compress=").concat(I?"1":"0"),header:h,method:"POST",data:m,timeout:p,success:function(e){[200,204].includes(r.getHttpCode(e))||v(e)},fail:function(e){v(e)},complete:function(e){r.requestingNum-=1,c.emit(Se,{result:e,requestData:t,trackingId:o}),r.initiateRequest(o)}})},this.requestFailFn=function(e){var t;if(r.retryIds[e.requestId]||(r.retryIds[e.requestId]=0),r.retryIds[e.requestId]+=1,!(null!==(t=r.requestQueue[e.trackingId])&&void 0!==t?t:r.requestQueue[e.trackingId]=[]).some(function(t){return t.requestId===e.requestId}))var n=setTimeout(function(){var t,i=null!==(t=r.requestQueue[e.trackingId])&&void 0!==t?t:r.requestQueue[e.trackingId]=[];if(i.some(function(t){return t.requestId===e.requestId}))return clearTimeout(n),void(n=null);C(i)?(i.push(e),r.initiateRequest(e.trackingId)):i.push(e),clearTimeout(n),n=null},800)},this.hoardingQueue={},this.requestQueue={},this.requestLimit=3,this.retryLimit=2,this.retryIds={},this.requestingNum=0,this.throttledBatchInvoke={},this.growingIO.emitter.on(we,function(e){var t,n,i=e.eventsQueue,o=e.requestData,a=e.trackingId,u=r.growingIO,s=u.vdsConfig,c=u.plugins;a===r.growingIO.trackingId&&((null===(t=null==s?void 0:s.tbConfig)||void 0===t?void 0:t.cloudAppId)?null===(n=null==c?void 0:c.gioTaobaoAdapter)||void 0===n||n.tbCloudAppInvoke(i,o):r.sendEvent(i,o))})},je=function(e){var t=this;this.growingIO=e,this._getUidKey=function(){return t.growingIO.inPlugin?"_growing_plugin_uid_":"_growing_uid_"},this.getUid=function(){var e=t.growingIO.minipInstance;return"quickapp"===t.growingIO.gioPlatform&&!1===e.identityReady?"":(t._uid||(t._uid=e.getStorageSync(t._getUidKey())),t._uid||t.setUid(F()),t._uid)},this.setUid=function(e){var n=t._uid;t._uid=e,n!==t._uid&&(t.growingIO.minipInstance.setStorage(t._getUidKey(),t._uid),t.growingIO.emitter.emit("UID_UPDATE",{newUId:e,oldUId:n}))},this.getSessionId=function(e){var n=t.growingIO,r=n.vdsConfig.sessionExpires,i=n.dataStore.trackersExecute;return t._sessionId[e]||t.setSessionId(e),r>-1&&(Date.now()>t._sessionExpires&&i(function(e){t.setSessionId(e)}),t._sessionExpires=Date.now()+6e4*r),t._sessionId[e]},this.setSessionId=function(e,n){var r=t._sessionId[e];n||(n=F()),t._sessionId[e]=n;var i=t.growingIO.vdsConfig.sessionExpires;i>-1&&(t._sessionExpires=Date.now()+6e4*i),r!==n&&t.growingIO.emitter.emit(ke,{trackingId:e,newSessionId:n,oldSessionId:r})},this._getUserIdKey=function(e){return t.growingIO.dataStore.getStorageKey(e,"userId")},this.getUserId=function(e){var n=t.growingIO.minipInstance;return t._userId[e]||(t._userId[e]=n.getStorageSync(t._getUserIdKey(e))),t._userId[e]},this.setUserId=function(e,n){var r=t._userId[e];t._userId[e]=i(n)?"":n,r!==t._userId[e]&&(t.growingIO.minipInstance.setStorage(t._getUserIdKey(e),t._userId[e]),t.growingIO.emitter.emit("USERID_UPDATE",{newUserId:n,oldUserId:r})),n&&t.setGioId(e,n)},this._getUserKeyKey=function(e){return t.growingIO.dataStore.getStorageKey(e,"userKey")},this.getUserKey=function(e){var n=t.growingIO.minipInstance;return t._userKey[e]||(t._userKey[e]=n.getStorageSync(t._getUserKeyKey(e))),t._userKey[e]},this.setUserKey=function(e,n){var r=t._userKey[e];t._userKey[e]=i(n)?"":n,r!==t._userKey[e]&&(t.growingIO.minipInstance.setStorage(t._getUserKeyKey(e),t._userKey[e]),t.growingIO.emitter.emit("USERKEY_UPDATE",{newUserKey:n,oldUserKey:r}))},this._getGioIdKey=function(e){return t.growingIO.dataStore.getStorageKey(e,"gioId")},this.getGioId=function(e){var n=t.growingIO.minipInstance;return t._gioId[e]||(t._gioId[e]=n.getStorageSync(t._getGioIdKey(e))),t._gioId[e]},this.setGioId=function(e,n){var r=t._gioId[e];t._gioId[e]=i(n)?"":n,r!==t._gioId[e]&&(t.growingIO.minipInstance.setStorage(t._getGioIdKey(e),t._gioId[e]),t.growingIO.emitter.emit("GIOID_UPDATE",{newGioId:n,oldGioId:r}))},this.initUserInfo=function(e){var n,r=t.growingIO.minipInstance,i=[t._getUidKey(),t._getUserIdKey(e),t._getUserKeyKey(e),t._getGioIdKey(e)],o=null!==(n=Z(r,i))&&void 0!==n?n:[];["_uid","_userId","_userKey","_gioId"].forEach(function(n,r){"_uid"===n?t.getUid():t[n][e]=o[r]})},this.saveUserInfo=function(){var e=t.growingIO,n=e.minipInstance;(0,e.dataStore.trackersExecute)(function(e){X(n,[{key:t._getUidKey(),value:t._uid},{key:t._getUserIdKey(e),value:t._userId[e]},{key:t._getUserKeyKey(e),value:t._userKey[e]},{key:t._getGioIdKey(e),value:t._gioId[e]}])})},this._uid=void 0,this._sessionId={},this._userId={},this._userKey={},this._gioId={},this._sessionExpires=-1},Me=new function(){var e,r=this;this.init=function(e){var t,n;r.emitter.emit("ON_SDK_INITIALIZE_BEFORE",{options:e});try{if(N("Gio小程序SDK 初始化中...","info"),!1===(null===(t=r.platformConfig)||void 0===t?void 0:t.supported))throw Error("当前 ".concat(r.gioFramework," SDK 不支持 ").concat(r.gioPlatform||"未知"," 平台,已停止初始化!"));if(e.trackingId&&r.dataStore.initializedTrackingIds.includes(e.trackingId))throw Error("已存在实例 ".concat(e.trackingId,",请勿重复初始化!"));if(r.trackingId&&!r.plugins.gioMultipleInstances)throw Error("您正在尝试初始化另一个实例,请集成多实例插件后重试!");var i=r.dataStore.initTrackerOptions(e);return null===(n=r.emitter)||void 0===n||n.emit(Oe,i),r.gioSDKInitialized=!0,r.dataStore.initTrackerHooker(i),"quickapp"!==r.gioPlatform&&r.userStore.initUserInfo(e.trackingId),r.emitter.emit(Pe,i),r.trackingId&&r.trackingId!==e.trackingId||(J().__gio__=function(){return r}),N("Gio小程序SDK 初始化完成!","success"),r.inPlugin&&"tbp"!==r.minipInstance.platform&&r.dataStore.sendVisit(i.trackingId),r.vdsConfig.forceLogin&&N("forceLogin已开启,请调用 identify 方法设置 openId 以继续上报!","info"),!0}catch(e){return N(e,"error"),!1}},this.handlerDistribute=function(e,t,i){var o=r.dataStore,a=o.initializedTrackingIds;if((0,o.getTrackerVds)(e)&&a.includes(e))return r[t].apply(r,n([e],i,!1));N("不存在实例:".concat(e,",请检查!"),"warn")},this.registerPlugins=function(e){r.plugins.pluginItems=n(n([],r.plugins.pluginItems,!0),e,!0),r.plugins.installAll(e)},this.getPlugins=function(){return r.plugins.pluginItems},this.getDeviceId=function(){return r.userStore.getUid()},this.getOption=function(e,t){return r.dataStore.getOption(e,t)},this.setOption=function(e,t,n){var i;return O(ce).includes(t)?x(n)===(null===(i=ae[t])||void 0===i?void 0:i.type)?(r.dataStore.setOption(e,t,n),N("已修改".concat(ce[t],": ").concat(n),"info"),!0):(N("参数格式不正确:".concat(n,",请检查后重试!"),"error"),!1):(N("不存在可修改的配置项:".concat(t,",请检查后重试!"),"error"),!1)},this.setPageAttributes=function(e,t){if(s(t)&&!C(t)){var n=r.dataStore.eventHooks.currentPage,i=n.getPagePath();return C(n.pageProps[e])&&(n.pageProps[e]={}),C(n.pageProps[e][i])&&(n.pageProps[e][i]={}),C(t)||P(t,function(t,r){c(n.pageProps[e][i][r])&&!c(t)||(n.pageProps[e][i][r]=t)}),!0}return U("setPageAttributes"),!1},this.clearPageAttributes=function(e,t){try{if(!C(r.dataStore.eventHooks.currentPage.pageProps[e])){var n=r.dataStore.eventHooks.currentPage,i=n.getPagePath();l(t)&&!C(t)?t.forEach(function(t){T(n.pageProps[e][i],t)}):n.pageProps[e][i]={}}}catch(e){return U("clearPageAttributes"),!1}},this.sendPage=function(e,t){r.dataStore.getTrackerVds(e).trackPage?N("仅在关闭trackPage时允许调用sendPage,请确认后修改初始化配置项!","error"):r.dataStore.sendPage(e,t)},this.identify=function(e,t){if(e===r.trackingId)if(r.vdsConfig.forceLogin){if(!oe(t))return void U("identify");var n=m(t).slice(0,1e3);r.userStore.setUid(n),r.dataStore.setOption(r.trackingId,"forceLogin",!1),r._identified=!0,r.dataStore.trackersExecute(function(e){var t=r.uploader.getHoardingQueue(e);t.forEach(function(e,r){return t[r].deviceId=n}),r.uploader.initiateRequest(e,!0)})}else r._identified?U("identify",!1,"请勿重复调用"):U("identify",!1,"forceLogin未开启");else U("identify",!1,"子实例不允许调用identify")},this.setUserAttributes=function(e,n){var i,o,a,u;if(s(n)&&!C(n)){var c=r.dataStore,l=c.eventContextBuilder,g=c.eventInterceptor,d=c.lastVisitEvent,f=t({eventType:"LOGIN_USER_ATTRIBUTES"},l(e));f.attributes=Y(t(t({},null!==(i=f.attributes)&&void 0!==i?i:{}),H(n))),f.path||(f.path=null===(o=d[e])||void 0===o?void 0:o.path,f.query=null===(a=d[e])||void 0===a?void 0:a.query,f.title=null===(u=d[e])||void 0===u?void 0:u.title),g(f)}else U("setUserAttributes")},this.setUserId=function(e,t,n){if(oe(t)){var o=r.userStore.getGioId(e);t=m(t).slice(0,1e3),n=m(n).slice(0,1e3),r.userStore.setUserId(e,t);var a=!i(n)&&m(n).length>0?m(n).slice(0,1e3):"";!r.dataStore.getTrackerVds(e).idMapping&&a&&(N("您设置了 userKey ,请初始化开启 idMapping!","warn"),a=""),r.userStore.setUserKey(e,a),o&&o!==t&&r.userStore.setSessionId(e)}else U("setUserId")},this.clearUserId=function(e){r.userStore.setUserId(e,void 0),r.userStore.setUserKey(e,void 0)},this.setGeneralProps=function(e,t){return s(t)&&!C(t)?(C(r.dataStore.generalProps[e])&&(r.dataStore.generalProps[e]={}),P(t,function(t,n){c(r.dataStore.generalProps[e][n])&&!c(t)||(r.dataStore.generalProps[e][n]=t)}),!0):(U("setGeneralProps"),!1)},this.clearGeneralProps=function(e,t){try{C(r.dataStore.generalProps[e])||(l(t)&&!C(t)?t.forEach(function(t){T(r.dataStore.generalProps[e],t)}):r.dataStore.generalProps[e]={})}catch(e){return U("clearGeneralProps"),!1}},this.track=function(e,n,i){K(n,function(){var o,a=r.dataStore,u=a.eventContextBuilder,c=a.eventInterceptor,l=t({eventType:"CUSTOM",eventName:n},u(e));l.attributes=Y(t(t({},null!==(o=l.attributes)&&void 0!==o?o:{}),H(t({},s(i)&&!C(i)?i:{})))),r.plugins.gioMultipleInstances&&i&&i["&&sendTo"]&&(l["&&sendTo"]=i["&&sendTo"]),c(l)})},this.trackTimerStart=function(e,t){return r.dataStore.getTrackerVds(e).dataCollect?K(t,function(){var n=F();return r.dataStore.trackTimers[e]||(r.dataStore.trackTimers[e]={}),r.dataStore.trackTimers[e][n]={ended:!1,eventName:t,leng:0,start:+Date.now()},n}):(N("指定实例未开启数据采集,请检查!","error"),!1)},this.trackTimerPause=function(e,t){var n=r.dataStore.trackTimers[e];if(t&&n&&n[t]){var i=n[t];return!i.ended&&(i.start&&(i.leng=i.leng+(+Date.now()-i.start)),i.start=0,!0)}return!1},this.trackTimerResume=function(e,t){var n=r.dataStore.trackTimers[e];if(t&&n&&n[t]){var i=n[t];return!i.ended&&(0===i.start&&(i.start=+Date.now()),!0)}return!1},this.trackTimerEnd=function(e,n,i){var o,a=r.dataStore.getTrackerVds(e).dataCollect,u=r.dataStore.trackTimers[e];if(n&&u&&u[n]){var c=u[n];if(c.ended)return N("指定计时器已结束,请勿重复调用!","warn"),!1;if(a){if(0!==c.start){var l=+Date.now()-c.start;c.leng=l>0?c.leng+l:0}var g=r.dataStore,d=g.eventContextBuilder,f=g.eventInterceptor,p=t({eventType:"CUSTOM",eventName:c.eventName},d(e));return p.attributes=Y(t(t({},null!==(o=p.attributes)&&void 0!==o?o:{}),H(t(t({},s(i)&&!C(i)?i:{}),{event_duration:c.leng>864e5?0:c.leng/1e3})))),r.plugins.gioMultipleInstances&&i&&i["&&sendTo"]&&(p["&&sendTo"]=i["&&sendTo"]),f(p),c.ended=!0,c.start=0,!0}return N("指定实例未开启数据采集,计时器已停止,请检查!","error"),c.ended=!0,c.start=0,!1}return N("未查询到指定计时器,请检查!","error"),!1},this.removeTimer=function(e,t){var n=r.dataStore.trackTimers[e];return t&&n&&n[t]?(delete n[t],!0):(N("未查询到指定计时器,请检查!","error"),!1)},this.clearTrackTimer=function(e){r.dataStore.trackTimers[e]={}},this.setLocation=function(e,t,n){C(r.dataStore.locationData[e])&&(r.dataStore.locationData[e]={});var i,o=r.dataStore.locationData[e];-90>(i=t)||i>90||!function(e){return e>=-180&&180>=e}(n)||o.latitude===t&&o.longitude===n||(r.dataStore.locationData[e]={latitude:t,longitude:n})},this.clearLocation=function(e){r.dataStore.locationData[e]={}},this.updateImpression=function(){N("updateImpression 错误! 请集成半自动埋点浏览插件后重试!","error")},this.getABTest=function(e,t,n){N("获取ABTest数据错误! 请集成ABTest插件后重试!","error"),D(n,{})},this.getGioInfo=function(e){var t,n,i=r.userStore,o=i.getUid,a=i.getUserId,u=i.getUserKey,s=i.getSessionId,c=r.dataStore.getTrackerVds(e),l=c.projectId,g=c.appId,d=c.dataSourceId,f=c.dataCollect,p=c.idMapping,v=c.extraParams,h=c.ignoreFields,m={gioappid:g,giocs1:a(e)||"",gioplatform:r.platformConfig.platform,gioprojectid:l,gios:s(e),giou:o()};if(m.giodatacollect=f,m.giodatasourceid=d,p&&(m.giouserkey=u(e)),C(v)||v.forEach(function(t){var n;h.includes(t)||(m["gio".concat(t)]=(null!==(n=r.dataStore.lastVisitEvent[e])&&void 0!==n?n:{})[t])}),e===r.trackingId){var I=null!==(n=null===(t=r.plugins)||void 0===t?void 0:t.gioEventAutoTracking)&&void 0!==n?n:{},y=I.circleServerUrl,S=I.circleOpen;if(y&&S){var w=te(y.split("?")[1]);w.roomId&&(m.giocircleroomid=w.roomId)}}return Be.stringify(m)},this.utils=t(t(t({},q),ie),{qs:Be}),this.emitter={all:e=e||new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map(function(e){e(n)}),(r=e.get("*"))&&r.slice().map(function(e){e(t,n)})}},this.gioPlatform="wx",this.gioFramework="native",this.sdkVersion="4.6.0";try{"quickapp"===this.gioPlatform||c(getApp)&&c(App)?this.inPlugin=!1:this.inPlugin=!0}catch(e){this.inPlugin=!0}this.inPlugin&&N("未检测到小程序实例,自动切换为插件模式!","info"),this.platformConfig=Ne,this.minipInstance=new Ue(this),this.dataStore=new Ae(this),this.userStore=new je(this),this.uploader=new Re(this),this.plugins=new De(this),this.plugins.innerPluginInit()},Ve=function(){var e,n=arguments[0],r="g0",i=n;if(o(n)&&n.indexOf(".")>-1&&(r=null!==(e=n.split(".")[0])&&void 0!==e?e:"g0",i=n.split(".")[1]),o(i)&&se.includes(i)&&Me[i]){var a=p(Array.from(arguments));if("init"===i){var u=function(e,t){var n=m(t[0]),r=m(t[1]),i=o(t[2])?t[2].trim():t[2],a=oe(i)?m(i):"",u=t[3]||{};return n&&r&&a?e.dataStore.initializedTrackingIds.some(function(t,i){var o=0===i?e.vdsConfig:e.subInstance[t];return o.projectId===n&&o.dataSourceId===r})?(N("SDK初始化失败,重复初始化,请检查初始化参数!","error"),!1):{projectId:n,dataSourceId:r,appId:a,userOptions:u}:(N('SDK初始化失败,请使用 gdp("init", "您的GrowingIO项目 accountId", "您项目的 dataSourceId", "您的小程序 AppId", options: { serverUrl: "您的数据上报地址" }); 进行初始化!',"error"),!1)}(Me,a);if(u){var s=u.projectId,c=u.dataSourceId,l=u.appId,g=u.userOptions;return Me.init(t(t({},g),{projectId:s,dataSourceId:c,appId:l,trackingId:r}))}return!1}if("registerPlugins"===i)Me.registerPlugins(a[0]);else{if(Me.gioSDKInitialized&&Me.vdsConfig)return ue.includes(i)?L(function(){return Me.handlerDistribute(r,i,a)}):L(function(){return Me[i].apply(Me,a)});N("SDK未初始化!","error")}}else if(le.includes(i))N("方法 ".concat(m(i)," 已被弃用,请移除!"),"warn");else{if("canIUse"===i)return se.includes(arguments[1])&&!!Me[arguments[1]];N("不存在名为 ".concat(m(i)," 的方法调用!"),"error")}};J().gdp=Ve,J().gioSDKVersion=Me.sdkVersion;var Ge=Me.dataStore.eventHooks,Qe=Ge.growingApp,$e=Ge.growingPage,ze=Ge.growingComponent,We=Ge.growingBehavior;(0,Ge.initOriginalValue)();var Je=L(function(){return null!=Qe?Qe:App}),Ye=L(function(){return null!=$e?$e:Page}),Ze=L(function(){return null!=ze?ze:Component}),Xe=L(function(){return null!=We?We:Behavior});export{Je as GioApp,Xe as GioBehavior,Ze as GioComponent,Ye as GioPage,Ve as default};
1
+ var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)},t=function(){return t=Object.assign||function(e){for(var t,n=1,i=arguments.length;i>n;n++)for(var r in t=arguments[n])({}).hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},t.apply(this,arguments)};function n(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;o>r;r++)!i&&r in t||(i||(i=[].slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||[].slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var i=/^[a-zA-Z_][0-9a-zA-Z_]{0,100}$/,r=function(e){return["undefined","null"].includes(x(e))},o=function(e){return"string"===x(e)},a=function(e){return"number"===x(e)},u=function(e){return"boolean"===x(e)},s=function(e){return"[object Object]"==={}.toString.call(e)&&!r(e)},c=function(e){return["function","asyncfunction"].includes(x(e))},l=function(e){return Array.isArray(e)&&"array"===x(e)},g=function(e){return"date"===x(e)},d=function(e){try{return Array.from(e)[0]}catch(e){return}},f=function(e){try{var t=Array.from(e);return t[t.length-1]}catch(e){return}},p=function(e,t){return void 0===t&&(t=1),l(e)&&a(t)?e.slice(t>0?t:1,e.length):e},v=function(e,t){if(void 0===t&&(t=!1),l(e)){for(var n=0,i=[],r=0,o=e;r<o.length;r++){var a=o[r];a&&!C(a)&&(i[n++]=a),t&&0===a&&(i[n++]=a)}return i}return e},h=function(e,t){if(l(e)){var n=e.findIndex(t);return 0>n?void 0:e[n]}},I=function(e){return r(e)?"":"".concat(e)},m=function(e,t){return"string"===x(e)?e.split(t):e},y=function(e){if(o(e)){var t=m(e,"");return"".concat(d(t).toLowerCase()).concat(p(t).join(""))}return e},S=function(e,t){return o(e)||(e=I(e)),e.slice(0,t.length)===t},w={}.hasOwnProperty,P=function(e,t){return null!=e&&("object"==typeof e||"function"==typeof e)&&w.call(e,t)},O=function(e){return s(e)?Object.keys(e):[]},k=function(e,t){O(e).forEach(function(n){return t(e[n],n)})},_=function(e,t){var n=O(e);return!(!s(e)||!s(t)||n.length!==O(t).length||n.map(function(n,i){return s(e[n])?_(e[n],t[n]):e[n]===t[n]}).includes(!1))},b=function(e,t,n){var i=e;return s(e)?(t.split(".").forEach(function(e){i=i?i[e]:n}),i):n},T=function(e,t){if(!s(e))return!1;try{if("string"===x(t))return delete e[t];if("array"===x(t))return t.map(function(t){return delete e[t]});"object"===x(t)&&t.constructor===RegExp&&O(e).forEach(function(n){t.test(n)&&T(e,n)})}catch(e){return!1}},E=function(e,t,n,i){var r;void 0===t&&(t=250);var o=0;return"boolean"!==x(n)&&(i=e,e=n,n=void 0),function(){for(var a=[],u=0;arguments.length>u;u++)a[u]=arguments[u];var s=this,c=Date.now()-o;function l(){o=Date.now(),e.apply(s,a)}i&&!r&&l(),r&&clearTimeout(r),void 0===i&&c>t?l():!0!==n&&(r=setTimeout(i?function(){r=void 0}:l,void 0===i?t-c:t))}},C=function(e){return l(e)?0===e.length:s(e)?0===O(e).length:!e},x=function(e){return{}.toString.call(e).slice(8,-1).toLowerCase()},A=function(e){function t(e){return 10>e?"0"+e:e}return e.getFullYear()+"-"+t(e.getMonth()+1)+"-"+t(e.getDate())+" "+t(e.getHours())+":"+t(e.getMinutes())+":"+t(e.getSeconds())+"."+t(e.getMilliseconds())},q=Object.freeze({__proto__:null,isNil:r,isString:o,isNaN:function(e){return"NaN"===I(Number(e))},isNumber:a,isBoolean:u,isObject:s,isRegExp:function(e){return"[object RegExp]"==={}.toString.call(e)},isFunction:c,isArray:l,isDate:g,fixed:function(e,t){return a(e)?Number(e.toFixed(a(t)?t:2)):o(e)&&"NaN"!==I(Number(e))?Number(Number(e).toFixed(a(t)?t:2)):e},head:d,last:f,drop:p,dropWhile:function(e,t){return l(e)?e.filter(function(e){return!t(e)}):e},compact:v,find:h,isEqualArray:function(e,t){return!(!l(e)||!l(t)||e.length!==t.length)&&e.every(function(e,n){return e===t[n]})},toString:I,split:m,lowerFirst:y,upperFirst:function(e){if(o(e)){var t=m(e,"");return"".concat(d(t).toUpperCase()).concat(p(t).join(""))}return e},startsWith:S,endsWith:function(e,t){var n=e.length,i=n;i>n&&(i=n);var r=i;return(i-=t.length)>=0&&e.slice(i,r)===t},hasOwnProperty:w,has:P,keys:O,forEach:k,isEqual:_,get:b,unset:T,throttle:E,isEmpty:C,typeOf:x,formatDate:A}),N=function(e,t){console.log("%c[GrowingIO]:".concat(e),{info:"color: #3B82F6;",error:"color: #EF4444",warn:"color: #F59E0B",success:"color: #10B981"}[t]||"")},U=function(e,t,n){return void 0===t&&(t=!0),void 0===n&&(n="参数不合法"),N("".concat(t?"调用":"设置"," ").concat(e," 失败,").concat(n,"!"),"warn")},D=function(e){try{return e()}catch(e){return}},L=function(e,t){if(c(e))try{e(t)}catch(e){N("回调执行失败!".concat(e),"error")}},F=function(e){return o(e)?e.trim().substring(0,100):e},B=function(e,t){return o(e)&&!C(e)&&e.match(i)?t():(N("事件名格式不正确,只能包含数字、字母和下划线,且不能以数字开头,字符总长度不能超过100!","error"),!1)},K=function(e){return r(e)||O(e).forEach(function(t){c(e[t])?e[t]=D(function(){return e[t]()}):s(e[t])?T(e,t):l(e[t])||(e[t]=I(e[t]))}),e},H=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},R=function(e){return e.pixelRatio?Math.round(e.screenHeight*e.pixelRatio):e.screenHeight},j=function(e){return e.pixelRatio?Math.round(e.screenWidth*e.pixelRatio):e.screenWidth},M=function(e,t){if(e){var n=e.toLowerCase();return-1!==n.indexOf("android")?"".concat(t,"-Android"):-1!==n.indexOf("ios")?"".concat(t,"-iOS"):-1!==n.indexOf("harmonyos")||-1!==n.indexOf("ohos")?"".concat(t,"-HarmonyOS"):"".concat(t,"-").concat(e)}},V=function(e){if(o(e)){var t=e.indexOf("?");return-1!==t?[e.substring(0,t),e.substring(t+1)]:[e,""]}return["",""]},G=function(e){return o(e)?e.startsWith("/")?e:"/".concat(e):""},Q=function(e){return D(function(){switch(e){case"wx":return wx;case"my":case"tb":return my;case"swan":return swan;case"tt":return tt;case"qq":return qq;case"ks":return ks;case"jd":return jd;case"xhs":return xhs;default:var t=void 0;return t||(t=D(function(){return xhs})),t||(t=D(function(){return swan})),t||(t=D(function(){return my})),t||(t=D(function(){return tt})),t||(t=D(function(){return qq})),t||(t=D(function(){return ks})),t||(t=D(function(){return jd})),t||(t=D(function(){return wx})),t}})},z=function(e){return D(function(){switch(e){case"wx":return __wxConfig;case"swan":return appConfig;case"tt":return D(function(){return __ttConfig})||(null===global||void 0===global?void 0:global.TMAConfig)||(null===globalThis||void 0===globalThis?void 0:globalThis.TMAConfig);case"qq":return __qqConfig;case"ks":return __ksConfig;case"jd":return __jdConfig;case"xhs":return null!==__MP_APP_JSON_MIGRATION__&&void 0!==__MP_APP_JSON_MIGRATION__?__MP_APP_JSON_MIGRATION__:__MP_APP_JSON__;default:return}})},$=function(e){return D(function(){switch(e){case"wx":case"qq":return __wxAppCode__;case"tt":return __allConfig__;case"ks":return __module__;case"jd":return __jdAppCode__;default:return}})},W=function(){var e;return!e&&D(function(){return xhs})&&(e="xhs"),!e&&D(function(){return swan})&&(e="swan"),!e&&D(function(){return tt})&&(e="tt"),!e&&D(function(){return qq})&&(e="qq"),!e&&D(function(){return my.tb})&&(e="tb"),!e&&D(function(){return my})&&(e="my"),!e&&D(function(){return ks})&&(e="ks"),!e&&D(function(){return jd})&&(e="jd"),!e&&D(function(){return wx})&&(e="wx"),e||h(O(global),function(e){return I(e).toLowerCase().includes("quickapp")})&&(e="quickapp"),e},J=function(){var e;return null!==(e=D(function(){var e;return null!==(e=D(function(){var e;return null!==(e=D(function(){return $global}))&&void 0!==e?e:global}))&&void 0!==e?e:window}))&&void 0!==e?e:globalThis},Y=function(e){var t={};return s(e)&&(T(e,"&&sendTo"),k(e,function(e,n){var i=I(n).slice(0,100);s(e)?t[i]=Y(e):l(e)?(t[i]=v(e.slice(0,100),!0),t[i]=t[i].join("||").slice(0,1e3)):g(e)?t[i]=A(e):t[i]=r(e)?"":I(e).slice(0,1e3)})),t},Z=function(e,t){var n=function(){return t.map(function(t){return e.getStorageSync(t)})};try{return e.minip.canIUse("batchGetStorageSync")?e.minip.batchGetStorageSync(t):n()}catch(e){return n()}},X=function(e,t){var n=function(){return t.map(function(t){var n=t.key,i=t.value;return e.setStorageSync(n,i)})};try{return e.minip.canIUse("batchSetStorageSync")?e.minip.batchSetStorageSync(t):n()}catch(e){return n()}},ee=function(e){return O(e||{}).map(function(t){return t?"".concat(t,"=").concat(r(e[t])?"":e[t]):""}).join("&")},te=function(e){(S(e,"?")||S(e,"&"))&&(e=e.slice(1,e.length));var t={};return e.split("&").forEach(function(e){var n=e.indexOf("="),i=0>n?e:e.slice(0,n);i&&(t[i]=0>n?void 0:e.slice(n+1))}),t},ne=function(e){var t;return o(e)?null!==(t=D(function(){return JSON.parse(e)}))&&void 0!==t?t:{}:null!=e?e:{}},ie=["wxShoppingListScene","$taroTimestamp","gdpCircleRoomCollectUrl"],re=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n="string"==typeof e?te(e):e||{};function i(e,t){if("object"!=typeof e||null===e||Array.isArray(e))return{};var i={};return O(e).forEach(function(r){var o=ie.some(function(e){return r.includes(e)}),a=P(n,r);if(!(o||t&&a)){var u=e[r];"string"==typeof u?ie.some(function(e){return u.includes(e)})||(i[r]=u):"number"!=typeof u&&"boolean"!=typeof u||(i[r]=u)}}),i}return Object.assign({},i(n,!1),i(ne(t),!0))},oe=Object.freeze({__proto__:null,consoleText:N,callError:U,niceTry:D,niceCallback:L,limitString:F,eventNameValidate:B,getDynamicAttributes:K,guid:H,getScreenHeight:R,getScreenWidth:j,getOS:M,compareVersion:function(e,t){void 0===e&&(e=""),void 0===t&&(t="");for(var n=function(e){return e.replace(/\s+/g,"")},i=function(e){return e.replace(/[vV]/g,"")},r=n(i(e)),o=n(i(t)),a=r.split("."),u=o.split("."),s=0;3>s;s++){var c=Number(a[s]),l=Number(u[s]);if(c>l)return 1;if(l>c)return-1;if(!isNaN(c)&&isNaN(l))return 1;if(isNaN(c)&&!isNaN(l))return-1}return 0},getVueVersion:function(e){if(e){var t=Number(d(m(e.version,".")));return Number.isNaN(t)?0:t}return 0},splitPath:V,normalizePath:function(e){var t=V(e)[0];return((null==t?void 0:t.replace(/^\/+/,""))||"").replace(/\.html$/,"")},normalPath:G,getSafeDuration:function(e,t,n){if("number"==typeof e)return"number"!=typeof t||t>e?"number"!=typeof n||n>e?0:e-n:e-t},isTaro3:function(e){var t=e.Current,n=e.createComponent;return!(!e||!t||n)},getPlainMinip:Q,getPlainConfig:z,getPlainAppCode:$,getPlainPlatform:W,getSubKeys:function(e){return O(e).filter(function(e){return e.indexOf("__sub")>-1&&e.indexOf("gio__")>-1}).sort()},getAppInst:function(){var e=D(function(){return getApp({allowDefault:!0})});return e||(e=J()),e},getGlobal:J,limitObject:Y,batchGetStorageSync:Z,batchSetStorageSync:X,qsStringify:ee,qsParse:te,hashCode:function(e,t){void 0===t&&(t=!1);var n=0;if(C(e)||"boolean"==typeof e)return n;for(var i=0;i<e.length;)n=(n<<5)-n+e.charCodeAt(i),n&=n,i++;return t?Math.abs(n):n},getExtraData:ne,getPureParams:re}),ae=function(e){return(o(e)&&e.length>0||a(e)&&e>0)&&!["-","null","undefined"].includes(e)},ue={autotrack:{type:"boolean",default:!0},compress:{type:"boolean",default:!0},dataCollect:{type:"boolean",default:!0},debug:{type:"boolean",default:!1},idMapping:{type:"boolean",default:!1},enableIdMapping:{type:"boolean",default:!1},extraParams:{type:"array",default:[]},followShare:{type:"boolean",default:!0},forceLogin:{type:"boolean",default:!1},ignoreFields:{type:"array",default:[]},impressionScale:{type:"number",default:0},pluginMode:{type:"boolean",default:!1},originalSource:{type:"boolean",default:!0},keepAlive:{type:"number",default:5},performance:{type:"object",default:{monitor:!0,exception:!0}},serverUrl:{type:"string",default:"https://napi.growingio.com"},sessionExpires:{type:"number",default:-1},requestTimeout:{type:"number",default:5e3},taro:{type:["object","module"],default:!1},taroVue:{type:["object","function"],default:!1},mpvue:{type:["object","function"],default:!1},mpx:{type:["module","function"],default:!1},tbConfig:{type:"object",default:{cloud:void 0,cloudFuncSend:!1,cloudFuncName:"httpTunnel",cloudFuncHandler:"main",cloudAppId:void 0,path:void 0}},trackPage:{type:"boolean",default:!0},uniVue:{type:["object","function"],default:!1},uploadInterval:{type:"number",default:1e3},version:{type:"string",default:"1.0.0"}},se=["clearGeneralProps","clearPageAttributes","clearLocation","clearTrackTimer","clearUserId","getABTest","getGioInfo","getOption","identify","removeTimer","sendPage","sendVisit","setGeneralProps","setLocation","setOption","setPageAttributes","setUserAttributes","setUserId","track","trackTimerEnd","trackTimerPause","trackTimerResume","trackTimerStart"],ce=n(n(["init","registerPlugins"],["getPlugins","getDeviceId","updateImpression"],!0),se,!0),le={autotrack:"无埋点",dataCollect:"数据采集",debug:"调试模式",serverUrl:"数据上报服务地址",ignoreFields:"忽略上报字段"},ge=["enableDebug","setAutotrack","setDataCollect","setTrackerHost","setTrackerScheme","setConfig","collectImp","setPlatformProfile","getLocation"],de=["deviceBrand","deviceModel","deviceType","networkState","screenHeight","screenWidth","operatingSystem"],fe=n(n([],de,!0),["appChannel","language","platformVersion"],!1),pe={gsid:"_growing_gsid_",originalSource:"_gdp_original_source_",userId:"_growing_userId_",userKey:"_growing_userKey_",gioId:"_growing_gioId_",plugin_gsid:"_growing_plugin_gsid_",plugin_originalSource:"_gdp_plugin_original_source_",plugin_userId:"_growing_plugin_userId_",plugin_userKey:"_growing_plugin_userKey_",plugin_gioId:"_growing_plugin_gioId_"},ve=function(e,t,n){var i,r,o,a=function(e,i){void 0===i&&(i=!1);try{i?e(t,n):e(n)}catch(e){D(function(){return N("事件监听器执行失败 ".concat(t,": ").concat(e),"error")})}};(null===(i=null==e?void 0:e.all)||void 0===i?void 0:i.get)?(null===(r=e.all.get(t))||void 0===r||r.slice().forEach(function(e){return a(e)}),null===(o=e.all.get("*"))||void 0===o||o.slice().forEach(function(e){return a(e,!0)})):a(function(n){return null==e?void 0:e.emit(t,n)})},he="MINIP_LIFECYCLE",Ie="ON_COMPOSE_AFTER",me="ON_COMPOSE_BEFORE",ye="ON_ERROR",Se="ON_INSTALL",we="ON_SEND_AFTER",Pe="ON_SEND_BEFORE",Oe="ON_SEND_ERROR",ke="OPTION_CHANGE",_e="OPTION_INITIALIZED",be="SESSIONID_UPDATE",Te="UID_UPDATE",Ee=function(e){var n=this;this.growingIO=e,this.main=function(e,i,r,o){var a;void 0===r&&(r=!0),e||(e=n.growingIO.trackingId);var u=n.growingIO,s=u.sdkVersion,c=u.platformConfig,l=u.minipInstance,g=u.userStore,d=u.dataStore,f=u.dataStore,p=f.scene,v=f.eventHooks.currentPage,h=f.generalProps,I=d.getTrackerVds(e),m=I.version,y=I.dataSourceId,S=I.appId,w=I.idMapping,P=I.ignoreFields,O=d.locationData[e],k=l.systemInfo,_=void 0===k?{}:k,b=l.network,E=void 0===b?{}:b,x=_.brand,A=_.model,q=_.platform,N=_.language,U=o||v.getPageContext(e,{resolveTitle:!1}),D={appChannel:"scn:".concat(p||"NA"),appVersion:m,dataSourceId:y,deviceBrand:x,deviceId:g.getUid(),deviceModel:A,deviceType:M(q,c.name),domain:S,language:N,latitude:null==O?void 0:O.latitude,longitude:null==O?void 0:O.longitude,networkState:(null===(a=null==E?void 0:E.networkType)||void 0===a?void 0:a.result)||(null==E?void 0:E.networkType)||(null==E?void 0:E.type)||(null==E?void 0:E.subtype),operatingSystem:M(q,c.name),path:U.path,platform:c.platform,platformVersion:c.name+(_.version?" ".concat(_.version):""),query:U.path?U.query:"",screenHeight:R(_),screenWidth:j(_),sdkVersion:s,sessionId:g.getSessionId(e),title:v.getPageTitle(),timestamp:Date.now(),timezoneOffset:(new Date).getTimezoneOffset(),userId:g.getUserId(e)};return w&&(D.userKey=g.getUserKey(e)),r&&!C(h[e])&&(D.attributes=t({},h[e])),C(D.attributes)||(D.attributes=Y(K(t({},D.attributes)))),C(P)||P.forEach(function(e){T(D,e)}),C(i)?t(t({},D),{trackingId:e}):t(t(t({},D),i),{trackingId:e})}},Ce=function(e){var n=this;this.growingIO=e,this.enterParams={},this.entryExtraData={},this.parsedEntryExtraData={},this.main=function(e,i){var r,o,a=Date.now(),u=n.growingIO,s=u.emitter,c=u.userStore,l=u.vdsConfig,g=u.platformConfig,d=u.uploader,f=u.dataStore,p=u.minipInstance,v=u.dataStore,h=v.trackersExecute,I=v.shareOut,m=v.lastCloseTime,y=v.saveStorageInfo,S=v.setOriginalSource,w=v.removeOriginalSource;s.emit(he,{event:"App ".concat(e),timestamp:a,params:null!==(r=i[0])&&void 0!==r?r:{}}),l.debug&&console.log("App:",e,a);var P=g.listeners.app;switch(s.emit(me,{event:"App ".concat(e),params:null!==(o=i[0])&&void 0!==o?o:{}}),e){case P.appLaunch:n.enterParams=t({},i[0]);break;case P.appCreate:case P.appShow:var O=n.enterParamsParse(i[0]),k=O.path,_=O.query,b=O.referralPage;n.enterParams={path:k,query:_,scene:f.scene,referrerInfo:{appId:b}};var T=!m||a-m>60*l.keepAlive*1e3||!(!f.lastScene||f.scene===f.lastScene);if(T&&(n.entryExtraData=n.parsedEntryExtraData,h(function(e){!I&&l.originalSource&&k?S(e,{path:k,query:_,referralPage:b}):w(e)})),m){if(T){var E=n.sessionEntry;n.sessionEntry=k?O:void 0;try{h(function(e){c.setSessionId(e)})}finally{n.sessionEntry=E}}}else h(function(e){f.lastVisitEvent[e]={path:k,query:_,referralPage:b},n.buildVisitEvent(e,{path:k,query:_,referralPage:b})});p.setNetworkStatusListener();break;case P.appClose:f.lastScene=f.scene,f.lastCloseTime=Date.now(),y(),c.saveUserInfo(),h(function(e){n.buildCloseEvent(e),l.forceLogin||d.initiateRequest(e,!0)})}},this.enterParamsParse=function(e){var t,i,r;void 0===e&&(e={});var o=n.growingIO,a=o.gioPlatform,u=o.minipInstance,s=o.dataStore,c="",l="",g="",d=null===(t=u.minip)||void 0===t?void 0:t.canIUse,f=null===(i=u.minip)||void 0===i?void 0:i.getEnterOptionsSync;if("quickapp"!==a&&"function"==typeof d&&"function"==typeof f&&D(function(){return d.call(u.minip,"getEnterOptionsSync")})){var p=D(function(){return f.call(u.minip)})||{},v=p.path,h=p.query,I=p.scene,m=[p.referrerInfo,p.refererInfo,e.referrerInfo,e.refererInfo].find(function(e){return!C(e)});n.parsedEntryExtraData=re({},null==m?void 0:m.extraData),c=v||e.path,l=C(h)?e.query:h,g=(null==m?void 0:m.appId)||(null===(r=null==e?void 0:e.referrerInfo)||void 0===r?void 0:r.appId)||"",s.scene=I||e.scene,l=ee(re(l,(null==m?void 0:m.extraData)||{}))}else v=e.path,h=e.query,m=e.referrerInfo||e.refererInfo,n.parsedEntryExtraData=re({},null==m?void 0:m.extraData),c=v,l=ee(re(h,(null==m?void 0:m.extraData)||{})),g=(null==m?void 0:m.appId)||"",n.parseScene(e);return{path:c,query:l,referralPage:g}},this.parseScene=function(e){var t,i,r=n.growingIO,o=r.minipInstance,a=r.gioPlatform,u=r.dataStore;if("quickapp"===a){var s=o.getAppSource(),c=s.extra,l=s.type;i=(null==c?void 0:c.scene)||l}else C(e)||((null===(t=null==e?void 0:e.query)||void 0===t?void 0:t.wxShoppingListScene)?i=e.query.wxShoppingListScene:(null==e?void 0:e.scene)?i=e.scene:u.scene="NA");u.scene=i},this.buildVisitEvent=function(e,i){var r=n.growingIO,o=r.dataStore,a=o.getOriginalSource,u=o.eventContextBuilder,s=o.eventInterceptor,c=o.eventHooks.currentPage,l=r.vdsConfig,g=a(e),d=(null==i?void 0:i.query)||"",f=!C(i)&&i.path,p=c.getPageContext(e,f?{path:i.path,query:d,resolveTitle:!1}:{resolveTitle:!1}),v=t({eventType:"VISIT"},u(e,{},!0,p));f&&i.referralPage&&(v.referralPage=i.referralPage),l.originalSource&&!C(g)&&(v=t(t({},v),g)),s(v)},this.buildCloseEvent=function(e){var i=n.growingIO.dataStore,r=i.eventContextBuilder;(0,i.eventInterceptor)(t({eventType:"APP_CLOSED"},r(e)))}},xe=function(e){var t,n;return!!e&&!e.isComponent&&"component"!==e.mpType&&"component"!==(null===(t=e.$vm)||void 0===t?void 0:t.mpType)&&void 0===(null===(n=e.$page)||void 0===n?void 0:n.$id)&&!!Ae(e)},Ae=function(e){var t,n;return(null==e?void 0:e.route)||(null==e?void 0:e.uri)||(null==e?void 0:e.__route__)||(null===(t=null==e?void 0:e.$vm)||void 0===t?void 0:t.__route__)||V((null===(n=null==e?void 0:e.$page)||void 0===n?void 0:n.fullPath)||(null==e?void 0:e.$taroPath))[0]||""},qe=function(){function e(e){var n=this;this.growingIO=e,this.pageContextStack=[],this.queryByPage=new WeakMap,this.lifeBeforeShow=!0,this.withPageContext=function(e,t){n.pageContextStack.push(e);try{return t()}finally{n.pageContextStack.pop()}},this.getContextPage=function(){return f(n.pageContextStack)},this.isPageTarget=xe,this.getPageIdentityPath=Ae,this.getTargetPage=function(e){if(n.isPageTarget(e))return e;var t=n.getContextPage();return n.isPageTarget(t)?t:n.growingIO.minipInstance.getCurrentPage()},this.getPathFromPage=function(e){return n.getPageIdentityPath(e)||n.growingIO.minipInstance.getCurrentPath(e)||""},this.stringifyQuery=function(e){return"string"===x(e)?e:ee(e||{})},this.setPageQuery=function(e,t,i){void 0===i&&(i=n.getPagePath(e));var r=re(t);n.isPageTarget(e)&&n.queryByPage.set(e,r),n.queryOptions[i]=r},this.setConfiguredTitle=function(e){var t=n.growingIO.minipInstance.getCurrentPath();n.configuredTitle[t]=e},this.getQueryFromPage=function(e,t){var i,r,o,a=[null==e?void 0:e.options,null==e?void 0:e.$taroParams,null===(i=null==e?void 0:e.$page)||void 0===i?void 0:i.query].find(function(e){return!C(e)});if(!C(a))return n.stringifyQuery(re(a));if(e&&n.queryByPage.has(e))return n.stringifyQuery(n.queryByPage.get(e));var u=n.queryOptions[t];if(!C(u))return n.stringifyQuery(re(u));var s=(null===(r=null==e?void 0:e.$page)||void 0===r?void 0:r.fullPath)||(null==e?void 0:e.$taroPath),c=V(s)[1];if(c)return n.stringifyQuery(re(c));var l=n.growingIO.dataStore.eventHooks.appEffects.enterParams,g=void 0===l?{}:l;return t===g.path?n.stringifyQuery(re(g.query,null===(o=g.referrerInfo)||void 0===o?void 0:o.extraData)):""},this.getHistoryLocation=function(e){var t,i=n.growingIO.dataStore,r=i.eventHooks.appEffects.enterParams,o=void 0===r?{}:r;if(o.path)return{path:o.path,query:n.stringifyQuery(re(o.query,null===(t=o.referrerInfo)||void 0===t?void 0:t.extraData))};var a=i.lastPageEvent[e];if(null==a?void 0:a.path)return{path:a.path,query:n.stringifyQuery(a.query)};var u=i.lastVisitEvent[e];return{path:(null==u?void 0:u.path)||"",query:n.stringifyQuery(null==u?void 0:u.query)}},this.getPageLocation=function(e,i){var r=n.getTargetPage(i),o=n.getPathFromPage(r);if(o)return{page:r,path:o,query:n.getQueryFromPage(r,o)};if(n.growingIO.inPlugin){var a=n.growingIO.dataStore.getTrackerVds(e);return{page:r,path:"/插件".concat(a.appId),query:""}}return t({page:r},n.getHistoryLocation(e))},this.getPagePath=function(e){return n.getPageLocation(n.growingIO.trackingId,e).path},this.getPageQuery=function(e,t){var i=n.getPageLocation(n.growingIO.trackingId,e);return"string"==typeof t&&t!==i.path?"":i.query},this.getPageTitle=function(e){var t=n.growingIO,i=t.minipInstance,r=t.inPlugin,o=t.dataStore,a=i.getCurrentPath(),u=n.configuredTitle[a]||D(function(){return i.getPageTitle(i.getCurrentPage())})||"";if(r){var s=o.getTrackerVds(e||n.growingIO.trackingId);return u||"/插件".concat(s.appId).concat(a?"_"+f(a.split("/")):"")}return u},this.getPageContext=function(e,t){void 0===e&&(e=n.growingIO.trackingId),void 0===t&&(t={});var i=n.getPageLocation(e,t.page),r=P(t,"path"),o=r?t.path||"":i.path,a=i.query;P(t,"query")?a=n.stringifyQuery(t.query):r&&o!==i.path&&(a="");var u=P(t,"title")?t.title||"":!1===t.resolveTitle?"":n.getPageTitle();return{page:i.page,path:o,query:a,title:u}},this.getReferralPage=function(e){var t,i,r,o=n.growingIO,a=o.minipInstance,u=o.dataStore,s=u.lastPageEvent,c=u.scene,l=u.eventHooks;return(null===(t=s[e])||void 0===t?void 0:t.path)||(null===(r=null===(i=l.appEffects.enterParams)||void 0===i?void 0:i.referrerInfo)||void 0===r?void 0:r.appId)||(c?"scn:".concat(a.scnPrefix).concat(c):null)},this.updateShareResult=function(e,t,i){void 0===t&&(t=!0);var r=n.buildShareQuery(e,i),o=r[0],a=r[1];return(t||P(e,"path"))&&(e.path=G(o+(a?"?".concat(a):""))),(t||P(e,"query"))&&(e.query=a),e},this.eventSetPageProps=function(e,i){var r=D(function(){return n.pageProps[e][i.path||n.getPagePath()]});return C(r)?i.attributes:Y(K(t(t({},i.attributes),r)))},this.queryOptions={},this.configuredTitle={},this.pageProps={}}return e.prototype.buildShareQuery=function(e,t){var n,i,r=V(null!==(n=e.path)&&void 0!==n?n:""),o=t||this.getPageContext(),a=e.path||o.path,u={},s=P(e,"path");return P(e,"query")?u=te(null!==(i=e.query)&&void 0!==i?i:"")||{}:s?u=te(f(r))||{}:(u=te(o.query)||{},v(O(u)).forEach(function(e){e.toLowerCase().startsWith("utm_")&&T(u,e)})),[a,ee(u)]},e}(),Ne=function(e){var n=this;this.growingIO=e,this.getPrevEventBucket=function(e){if(!e||"object"!=typeof e)return null;var t=n.prevEventByPage.get(e);if(t)return t;var i={};return n.prevEventByPage.set(e,i),i},this.setPrevEventTime=function(e,t,i){var r,o=n.getPrevEventBucket(e);if(o)o[t]=i;else{var a=(null==e?void 0:e.route)||(null==e?void 0:e.uri)||(null==e?void 0:e.__route__)||(null===(r=null==e?void 0:e.$page)||void 0===r?void 0:r.fullPath)||"";n.prevEvent["".concat(t,":").concat(a)]=i}},this.main=function(e,t,i){var r,o=Date.now(),a=n.growingIO,u=a.emitter,s=a.minipInstance,l=a.plugins,g=a.vdsConfig,d=a.platformConfig,f=a.dataStore,p=f.getTrackerVds,v=f.getOriginalSource,h=f.updateOriginalSourceTitle,I=f.trackersExecute,m=f.eventHooks,y=f.toggleShareOut,S=f.buildAppMessageEvent,w=f.buildTimelineEvent,P=f.buildAddFavorites,O=m.currentPage;e||(e=s.getCurrentPage());var k=O.getPagePath(e),_="".concat(t,":").concat(k),T=n.getPrevEventBucket(e),E=T?T[t]:n.prevEvent[_];if(E&&50>o-Number(E))return!1;u.emit(he,{event:"Page ".concat(t),timestamp:o,params:{page:e,args:i[0]}}),g.debug&&console.log("Page:",k,"#",t,o),n.setPrevEventTime(e,t,o);var x=d.listeners.page;switch(u.emit(me,{page:e,event:"Page ".concat(t),params:{page:e,args:i[0]}}),O.lastLifecycle=O.currentLifecycle,O.currentLifecycle=t,t){case x.pageLoad:var A=[b(e,"options"),b(e,"__displayReporter.query"),b(e,"$page.query"),b(e,"$wx.__displayReporter.query"),b(e,"$taroParams"),i[0]].find(function(e){return!C(e)});O.setPageQuery(e,A||{},k);break;case x.pageShow:I(function(t){var i=v(t);C(i)||i.path!==k||h(t,k,O.getPageTitle()),p(t).trackPage&&n.buildPageEvent(t,void 0,e)}),y(!1);break;case x.pageHide:case x.pageUnload:break;case x.shareChat:case x.shareApp:y(!0),I(function(e){p(e).followShare&&S(e,i)});break;case x.shareTime:"xhsp"===s.platform&&y(!0),I(function(e){p(e).followShare&&w(e,i)});break;case x.addFavorites:I(function(e){p(e).followShare&&P(e,i)});break;case x.tabTap:var q=null===(r=null==l?void 0:l.gioEventAutoTracking)||void 0===r?void 0:r.buildTabClickEvent;g.autotrack&&q&&c(q)&&q(n.growingIO.trackingId,i[0])}return O.lastLifecycle=O.currentLifecycle,O.currentLifecycle="".concat(t,"End"),["onHideEnd","onUnloadEnd"].includes(O.currentLifecycle)&&(O.lifeBeforeShow=!0),"onShowEnd"===O.currentLifecycle&&(O.lifeBeforeShow=!1),!0},this.buildPageEvent=function(e,i,r){var o=n.growingIO.dataStore,a=o.eventContextBuilder,u=o.eventInterceptor,s=o.eventHooks.currentPage,c={page:r,resolveTitle:!1};C(i)||(P(i,"path")?(c.path=i.path,c.query=P(i,"query")?i.query:""):P(i,"query")&&(c.query=i.query));var l=s.getPageContext(e,c),g=t({eventType:"PAGE",referralPage:s.getReferralPage(e)},a(e,void 0,!0,l));g.attributes=s.eventSetPageProps(e,g),!C(i)&&i.title&&(g.title=i.title),u(g)},this.prevEvent={},this.prevEventByPage=new WeakMap},Ue=function(e){var n,i=this;this.growingIO=e,this.isNormalFc=function(e,t){return c(t)&&"constructor"!==e},this.objectTraverse=function(e,t){Object.getOwnPropertyNames(e).forEach(function(n){return t(n,e)}),P(e,"methods")&&Object.getOwnPropertyNames(e.methods).forEach(function(n){e[n]||t(n,e.methods)}),P(e,"lifetimes")&&Object.getOwnPropertyNames(e.lifetimes).forEach(function(n){e[n]||t(n,e.lifetimes)}),P(e,"pageLifetimes")&&Object.getOwnPropertyNames(e.pageLifetimes).forEach(function(n){e[n]||t(n,e.pageLifetimes)})},this.supLifeFcs=function(e,t){l(i["".concat(t,"Handlers")])&&i["".concat(t,"Handlers")].forEach(function(t){c(e[t])||["onShareAppMessage","onShareTimeline"].includes(t)||(e[t]=function(){})})},this.lifeFcEffectsFn=function(e,t,n,r,o){void 0===o&&(o=void 0);var a=i.getLifeArgs(t,o);return i.runLifeEffects(e,a,n,r),i.emitLifeEnd(e,a,n,r),o},this.getLifeArgs=function(e,t){void 0===t&&(t=void 0);var n="array"===x(e)?[].slice.call(e):[];return C(t)||n.push(t),n},this.runLifeEffects=function(e,t,n,r){return i["def".concat(n,"Cbs")][r].apply(e,t)},this.emitLifeEnd=function(e,t,n,r){i.growingIO.emitter.emit(he,{event:"".concat(n," ").concat(r,"End"),timestamp:Date.now(),params:{instance:e,arguments:Array.from(t)}})},this.lifeFcEffects=function(e,n,r){var o=i;return function(){for(var i,a,u,s=this,c=[],l=0;arguments.length>l;l++)c[l]=arguments[l];if(!o.growingIO.gioSDKInitialized)return n.apply(this,c);if(!o.shareEventTypes.includes(e)){var g=function(){var t=o.getLifeArgs(c);return D(function(){return o.runLifeEffects(s,t,r,e)}),u=n.apply(s,c),D(function(){return o.emitLifeEnd(s,t,r,e)}),u};return"Page"===r?o.currentPage.withPageContext(this,g):g()}var d=D(function(){return o.currentPage.getPageContext(o.growingIO.trackingId,{page:s})}),f=(null==d?void 0:d.page)||this,p=function(e){return o.currentPage.withPageContext(f,e)},v=null!==(i=p(function(){return n.apply(s,c)}))&&void 0!==i?i:{};if(!o.growingIO.vdsConfig.followShare)return v;var h="promise"===x(v),I="promise"===x(v.promise),m=P(v,"_result")&&P(v,"_state");if(h||I||m){var y=function(n){void 0===n&&(n={});try{var i=t(t({},v),n);p(function(){var t=o.currentPage.updateShareResult(i,!0,d);o.lifeFcEffectsFn(s,c,r,e,t)})}catch(e){N(e,"error")}};h&&Promise.race([v,new Promise(function(e){setTimeout(function(){e({})},3e3)})]).then(y).catch(function(e){return N(e,"error")}),I&&Promise.race([v.promise,new Promise(function(e){setTimeout(function(){e({})},3e3)})]).then(y).catch(function(e){return N(e,"error")}),m&&(null===(a=o.growingIO.minipInstance)||void 0===a||a.handleSharePromise(v,y)),u=p(function(){return o.currentPage.updateShareResult(v,!1,d)})}else u=p(function(){var t=o.currentPage.updateShareResult(v,!0,d);return o.lifeFcEffectsFn(s,c,r,e,t)});return u}},this.customFcEffects=function(e,t){var n=i;return function(){for(var i,r,o=[],a=0;arguments.length>a;a++)o[a]=arguments[a];if(!n.growingIO.gioSDKInitialized)return t.apply(this,o);if(n.growingIO.vdsConfig.autotrack&&n.growingIO.plugins.gioEventAutoTracking)try{var u=o[0]||{};P(u,"type")&&((null==u?void 0:u.currentTarget)||(null==u?void 0:u.target))||(u=o[o.length-1]),((null==u?void 0:u.currentTarget)||(null==u?void 0:u.target))&&n.actionEventTypes.includes(u.type)&&(c(n.actionEffects)||(n.actionEffects=(null===(r=null===(i=n.growingIO.plugins)||void 0===i?void 0:i.gioEventAutoTracking)||void 0===r?void 0:r.main)||function(){}),null==n||n.actionEffects(u,e))}catch(e){N(e,"error")}return t.apply(this,o)}},this.appApplyProxy=function(e,t){return i.appHandlers.includes(e)?i.lifeFcEffects(e,t,"App"):i.customFcEffects(e,t)},this.pageApplyProxy=function(e,t){return i.pageHandlers.includes(e)?i.lifeFcEffects(e,t,"Page"):i.customFcEffects(e,t)},this.appOverriding=function(e){return i.setAppEffectCbs(),i.supLifeFcs(e,"app"),i.objectTraverse(e,function(e,t){i.isNormalFc(e,t[e])&&(t[e]=i.appApplyProxy(e,t[e]))}),e},this.pageOverriding=function(e){return i.setPageEffectCbs(),i.supLifeFcs(e,"page"),i.objectTraverse(e,function(e,t){i.isNormalFc(e,t[e])&&(t[e]=i.pageApplyProxy(e,t[e]))}),e},this.componentOverriding=function(e){return i.setPageEffectCbs(),e.methods||(e.methods={}),i.supLifeFcs(i.growingIO.inPlugin?e:e.methods,"page"),i.objectTraverse(i.growingIO.inPlugin?e:e.methods,function(e,t){i.isNormalFc(e,t[e])&&(t[e]=i.pageApplyProxy(e,t[e]))}),e},this.setAppEffectCbs=function(){var e=i;i.appHandlers.forEach(function(t){i.defAppCbs[t]=function(){for(var n=[],i=0;arguments.length>i;i++)n[i]=arguments[i];return e.appEffects.main(t,n)}})},this.setPageEffectCbs=function(){var e=i;i.pageHandlers.forEach(function(t){i.defPageCbs[t]=function(){for(var n=[],i=0;arguments.length>i;i++)n[i]=arguments[i];return e.pageEffects.main(this,t,n)}})},this.growingApp=function(e){return c(i.originalApp)?i.originalApp(i.appOverriding(e)):i.appOverriding(e)},this.growingPage=function(e){return c(i.originalPage)?i.originalPage(i.pageOverriding(e)):i.pageOverriding(e)},this.growingComponent=function(e){return c(i.originalComponent)?i.originalComponent(i.componentOverriding(e)):i.componentOverriding(e)},this.growingBehavior=function(e){return c(i.originalBehavior)?i.originalBehavior(i.componentOverriding(e)):i.componentOverriding(e)},this.nativeGrowing=function(e){void 0===e&&(e=["App","Page","Component","Behavior"]);var t=i,n=i.growingIO.platformConfig.hooks;if(e.includes("App"))try{n.App&&!i.appHooked&&c(i.originalApp)&&(App=function(){for(var e=[],n=0;arguments.length>n;n++)e[n]=arguments[n];return t.originalApp(t.appOverriding(e[0]))},i.appHooked=!0)}catch(e){}if(e.includes("Page"))try{n.Page&&!i.pageHooked&&c(i.originalPage)&&(Page=function(){for(var e=[],n=0;arguments.length>n;n++)e[n]=arguments[n];return t.originalPage(t.pageOverriding(e[0]))},i.pageHooked=!0)}catch(e){}if(e.includes("Component"))try{n.Component&&!i.componentHooked&&c(i.originalComponent)&&(Component=function(){for(var e=[],n=0;arguments.length>n;n++)e[n]=arguments[n];return t.originalComponent(t.componentOverriding(e[0]))},i.componentHooked=!0)}catch(e){}if(e.includes("Behavior"))try{n.Behavior&&!i.behaviorHooked&&c(i.originalBehavior)&&(Behavior=function(){for(var e=[],n=0;arguments.length>n;n++)e[n]=arguments[n];return t.originalBehavior(t.componentOverriding(e[0]))},i.behaviorHooked=!0)}catch(e){}},this.initOriginalValue=function(){i.setAppEffectCbs(),i.setPageEffectCbs(),c(i.originalApp)||(i.originalApp=D(function(){return App||global.App})),c(i.originalPage)||(i.originalPage=D(function(){return Page||global.Page})),c(i.originalComponent)||(i.originalComponent=D(function(){return Component||global.Component})),c(i.originalBehavior)||(i.originalBehavior=D(function(){return Behavior||global.Behavior}))},this.initEventHooks=function(){var e=i,t=i.growingIO,n=t.platformConfig,r=t.gioPlatform;i.initOriginalValue(),n.canHook?(i.nativeGrowing(),J().GioApp=D(function(){return null!==App&&void 0!==App?App:i.originalApp}),J().GioPage=D(function(){return null!==Page&&void 0!==Page?Page:i.originalPage}),J().GioComponent=D(function(){return null!==Component&&void 0!==Component?Component:i.originalComponent}),J().GioBehavior=D(function(){return null!==Behavior&&void 0!==Behavior?Behavior:i.originalBehavior})):"quickapp"===r&&(J().GioApp=function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];return e.appOverriding(t[0])},J().GioPage=function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];return e.pageOverriding(t[0])},J().GioComponent=function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];return e.pageOverriding(t[0])})};var r=null===(n=this.growingIO)||void 0===n?void 0:n.platformConfig;this.defAppCbs={},this.defPageCbs={},this.appHandlers=r.appHandlers,this.pageHandlers=r.pageHandlers,this.shareEventTypes=r.shareEventTypes,this.actionEventTypes=r.actionEventTypes,this.appEffects=new Ce(this.growingIO),this.pageEffects=new Ne(this.growingIO),this.currentPage=new qe(this.growingIO)},De=function(){function e(e){var n,i,r=this;this.growingIO=e,this.ALLOW_SETTING_KEYS=O(ue),this.originalSources={},this.originalSourceGeneration=0,this.getStorageKey=function(e,t){var n=r.growingIO.inPlugin;return"".concat(e===r.growingIO.trackingId?"":e).concat(pe[n?"plugin_"+t:t])},this.getGsid=function(e){var t=Number(r._gsid[e]);return Number.isNaN(t)||t>=1e9||1>t?(r.setGsid(e,1),1):t},this.setGsid=function(e,t){var n=Number(t);(Number.isNaN(n)||n>=1e9||1>n)&&(n=1),r._gsid[e]=n,10>r._gsid[e]-r._stid[e]||r.saveStorageInfo()},this.initStorageInfo=function(e){var t=r.growingIO.minipInstance,n=t.getStorageSync(r.getStorageKey(e,"gsid")),i=Number(n);(Number.isNaN(i)||i>=1e9||1>i)&&(i=1),r._gsid[e]=i,r._stid[e]=i,i!==n&&t.setStorageSync(r.getStorageKey(e,"gsid"),i)},this.saveStorageInfo=function(){var e=r.growingIO.minipInstance;r._stid=t({},r._gsid),X(e,r.initializedTrackingIds.map(function(e){return{key:r.getStorageKey(e,"gsid"),value:r._gsid[e]}}))},this.normalizeOriginalSource=function(e){if(!s(e)||!o(e.path)||!e.path)return{};var t={path:e.path,query:o(e.query)?e.query:"",referralPage:o(e.referralPage)?e.referralPage:""};return o(e.title)&&(t.title=e.title),t},this.setOriginalSource=function(e,t){var n=r.growingIO.minipInstance,i=r.normalizeOriginalSource(t);if(C(i))r.removeOriginalSource(e);else{var o=r.getStorageKey(e,"originalSource");r.originalSources[e]={source:i,generation:++r.originalSourceGeneration},D(function(){return n.setStorageSync(o,JSON.stringify(i))})}},this.removeOriginalSource=function(e){var t=r.getStorageKey(e,"originalSource");r.originalSources[e]={source:{},generation:++r.originalSourceGeneration},D(function(){return r.growingIO.minipInstance.removeStorageSync(t)})},this.getOriginalSource=function(e){var n,i=r.growingIO.minipInstance,o=r.getStorageKey(e,"originalSource");if(P(r.originalSources,e))return t({},r.originalSources[e].source);try{n=i.getStorageSync(o)}catch(e){return{}}var a=r.normalizeOriginalSource(D(function(){return JSON.parse(n)}));return n&&C(a)?r.removeOriginalSource(e):r.originalSources[e]={source:a,generation:++r.originalSourceGeneration},t({},a)},this.bindOriginalSource=function(e){var t,n;if("VISIT"===e.eventType&&void 0===e.originalSourceId){var i=r.getOriginalSource(e.trackingId),o=null===(n=null===(t=r.growingIO.userStore)||void 0===t?void 0:t.getSessionSnapshot)||void 0===n?void 0:n.call(t,e.trackingId);!i.path||e.path!==i.path||(e.query||"")!==i.query||o&&e.sessionId!==o||(e.originalSourceId=r.originalSources[e.trackingId].generation)}},this.consumeOriginalSource=function(e,t){var n=r.originalSources[e];(null==n?void 0:n.source.path)&&t.some(function(e){return"VISIT"===e.eventType&&e.originalSourceId===n.generation})&&r.removeOriginalSource(e)},this.updateOriginalSourceTitle=function(e,n,i){var a=r.getOriginalSource(e);if(C(a)||a.path!==n||!o(i))return!1;var u=t(t({},a),{title:i});return r.originalSources[e].source=u,D(function(){return r.growingIO.minipInstance.setStorageSync(r.getStorageKey(e,"originalSource"),JSON.stringify(u))}),!0},this.getTrackerVds=function(e){return r.growingIO.trackingId===e?t({},r.growingIO.vdsConfig):void 0},this.initTrackerOptions=function(e){var t=r.initOptions(e);return t.trackingId=e.trackingId,r.growingIO.trackingId=e.trackingId,r.growingIO.vdsConfig=t,t},this.initTrackerHooker=function(e){var t=r.growingIO,n=t.platformConfig,i=t.inPlugin,o=t.minipInstance,a=t.plugins,u=e.uniVue,s=e.taro,l=e.mpx,g=e.mpvue;return r.validateTrackerFramework(e),u||s||g||"quickapp"===o.platform||(n.canHook=!0),!i||["tbp","jdp"].includes(o.platform)?r.eventHooks.initEventHooks():r.eventHooks.initOriginalValue(),u||s||g||l||i||D(function(){return c(getApp)&&!!getApp()})&&N("检测到 App 已创建:请将 gdp('init') 放在 App() 注册之前,否则自动事件可能缺失。","warn"),u&&a.gioUniAppAdapter.main(),s&&a.gioTaroAdapter.main(),g&&a.gioMpvueAdapter.main(),l&&a.gioMpxAdapter.main(),!0},this.validateTrackerFramework=function(e){var t,n,i,o,a=e.uniVue,u=e.taro,s=e.mpvue,l=e.mpx,g=r.growingIO.plugins;if(a){if(!a.version)throw Error("未获取到有效的 uni-app Vue 实例");if(!c(null===(t=null==g?void 0:g.gioUniAppAdapter)||void 0===t?void 0:t.main))throw Error("当前构建未包含 uni-app 框架适配器")}if(u){if(!u.Current&&!u.createComponent)throw Error("未获取到受支持的 Taro 实例");if(!c(null===(n=null==g?void 0:g.gioTaroAdapter)||void 0===n?void 0:n.main))throw Error("当前构建未包含 Taro 框架适配器")}if(s){if(!c(s.mixin))throw Error("未获取到支持 mixin 的 mpvue 实例");if(!c(null===(i=null==g?void 0:g.gioMpvueAdapter)||void 0===i?void 0:i.main))throw Error("当前构建未包含 mpvue 框架适配器")}if(l){if(!c(l.injectMixins))throw Error("未获取到支持 injectMixins 的 MPX 实例");if(!c(null===(o=null==g?void 0:g.gioMpxAdapter)||void 0===o?void 0:o.main))throw Error("当前构建未包含 MPX 框架适配器")}},this.initOptions=function(e){var n,i,o,a,u,s,c,g,d=e.projectId,f=e.dataSourceId,p=e.appId,v=e.trackingId,h={};r.ALLOW_SETTING_KEYS.forEach(function(t){var n=ue[t].type;(l(n)?n.includes(x(e[t])):x(e[t])===ue[t].type)?"ignoreFields"===t?h.ignoreFields=e.ignoreFields.filter(function(e){return de.includes(e)}):"extraParams"===t?h.extraParams=e.extraParams.filter(function(e){return fe.includes(e)}):(h[t]=e[t],["dataCollect","autotrack"].includes(t)&&!h[t]&&N("已关闭".concat(le[t]),"info")):h[t]=ue[t].default}),h.uploadInterval=Math.round(h.uploadInterval),(Number.isNaN(h.uploadInterval)||0>h.uploadInterval||h.uploadInterval>3e3)&&(h.uploadInterval=1e3),h.enableIdMapping&&!h.idMapping&&(h.idMapping=!0),T(h,"enableIdMapping"),!isNaN(Number(h.requestTimeout))&&h.requestTimeout>0||(h.requestTimeout=5e3);var I=r.normalizeServerUrl(h.serverUrl);if(!I)throw Error("serverUrl 必须是有效的 HTTP(S) 域名或基础地址");h.serverUrl=I;var m=!r.growingIO.trackingId||r.growingIO.trackingId===v;if(m&&((null===(n=h.tbConfig)||void 0===n?void 0:n.cloudFuncSend)||(null===(i=h.tbConfig)||void 0===i?void 0:i.cloudAppId))&&"tbp"!==r.growingIO.minipInstance.platform)throw Error("tbConfig 云转发仅支持淘宝小程序构建");return(0>h.impressionScale||h.impressionScale>1)&&(h.impressionScale=0),(0>h.keepAlive||h.keepAlive>1440)&&(h.keepAlive=5),(1>h.sessionExpires||h.sessionExpires>1440)&&(h.sessionExpires=-1),m&&(r.validateTrackerFramework(h),h.pluginMode&&(r.growingIO.inPlugin=!0)),h.idMapping||r.growingIO.userStore.setUserKey(v,""),t(t({},h),{projectId:d,dataSourceId:f,appId:p,trackingId:v,performance:{monitor:null===(a=null===(o=h.performance)||void 0===o?void 0:o.monitor)||void 0===a||a,exception:null===(s=null===(u=h.performance)||void 0===u?void 0:u.exception)||void 0===s||s,network:null!==(g=null===(c=h.performance)||void 0===c?void 0:c.network)&&void 0!==g&&g}})},this.setOption=function(e,n,i){var o,a=r.growingIO,u=a.userStore,s=a.emitter;if(!P(le,n))return U("setOption > ".concat(n)),!1;var c=r.getTrackerVds(e),l=t({},c);return"ignoreFields"===n&&(i=i.filter(function(e){return de.includes(e)})),"serverUrl"!==n||(i=r.normalizeServerUrl(i))?(r.updateVdsConfig(e,t(t({},c),((o={})[n]=i,o))),"dataCollect"===n&&l.dataCollect!==i&&i&&u.setSessionId(e),ve(s,ke,{trackingId:e,optionName:n,optionValue:i}),!0):(U("setOption > serverUrl"),!1)},this.setInternalOption=function(e,n,i){var o,a=r.getTrackerVds(e);return r.updateVdsConfig(e,t(t({},a),((o={})[n]=i,o))),ve(r.growingIO.emitter,ke,{trackingId:e,optionName:n,optionValue:i}),!0},this.normalizeServerUrl=function(e){if("string"!==x(e))return"";var t=e.trim();if(!t)return"";if(!/^https?:\/\//i.test(t)){if(/^[a-z][a-z\d+.-]*:\/\//i.test(t))return"";t="https://".concat(t)}return t=(t=t.replace(/^https?:\/\//i,function(e){return e.toLowerCase()})).replace(/\/+$/,""),/^https?:\/\/[^\s/?#]+(?:\/[^\s?#]*)?$/i.test(t)?t:""},this.getOption=function(e,t){var n=r.getTrackerVds(e);return t&&P(r.growingIO.vdsConfig,t)?P(n,t)?n[t]:r.growingIO.vdsConfig[t]:C(t)?n:void U("getOption > ".concat(t))},this.updateVdsConfig=function(e,n){e===r.growingIO.trackingId?(r.growingIO.vdsConfig=t(t({},r.growingIO.vdsConfig),n),J().vdsConfig=r.growingIO.vdsConfig):(r.growingIO.subInstance[e]=t(t({},r.growingIO.subInstance[e]),n),J().vdsConfig.subInstance[e]=r.growingIO.subInstance[e])},this.toggleShareOut=function(e){u(e)?r.shareOut=e:r.shareOut=!r.shareOut},this.sendVisit=function(e,t){r.eventHooks.appEffects.buildVisitEvent(e,t)},this.sendPage=function(e,t){r.eventHooks.pageEffects.buildPageEvent(e,t)},this.eventConverter=function(e){var n=r.growingIO,i=n.dataStore,o=n.uploader;if(r.getTrackerVds(e.trackingId).dataCollect){["LOGIN_USER_ATTRIBUTES","APP_CLOSED"].includes(e.eventType)||(e.eventSequenceId=i.getGsid(e.trackingId),i.setGsid(e.trackingId,e.eventSequenceId+1));var a={};k(e,function(e,t){var n;if("element"===t){var i=null!==(n=d(e))&&void 0!==n?n:{};k(i,function(e,t){C(e)&&0!==e||(a[t]=e)})}else C(e)&&0!==e||(a[t]=e)}),ve(r.growingIO.emitter,Ie,{composedEvent:a});var u=t(t({},a),{requestId:H()});o.commitRequest(u)}},this.eventRefactor=function(e){var n,i,o=t(t({},e),r.eventContextBuilder(e.trackingId,{path:e.path,query:e.query,timestamp:e.timestamp}));return o.attributes=t(t({},null!==(n=o.attributes)&&void 0!==n?n:{}),null!==(i=e.attributes)&&void 0!==i?i:{}),o},this.eventInterceptor=function(e){r.bindOriginalSource(e);var t=r.growingIO.minipInstance,n=t.systemInfo,i=t.network;C(n)||C(i)?r.interceptEvents.push(e):C(r.interceptEvents)?r.eventConverter(e):r.releaseInterceptedEvents(e)},this.releaseInterceptedEvents=function(e){var t=r.interceptEvents;r.interceptEvents=[],e&&t.push(e),t.forEach(function(e){r.eventConverter(r.eventRefactor(e))})},this.eventReleaseInspector=function(){var e=r.growingIO.minipInstance,t=e.systemInfo,n=e.network;C(t)||C(n)||C(r.interceptEvents)||r.releaseInterceptedEvents()},this.buildAppMessageEvent=function(e,n){var i,o,a,u=n[0];2>n.length?1===n.length&&(a=u):a=n[1];var s=r.growingIO.dataStore,c=s.eventContextBuilder,l=s.eventInterceptor,g=((null==a?void 0:a.path)||"").split("?"),f=t({eventType:"CUSTOM",eventName:"$mp_on_share"},c(e));f.attributes=Y(t(t(t({},null!==(i=f.attributes)&&void 0!==i?i:{}),{$from:null==u?void 0:u.from,$target:null===(o=null==u?void 0:u.target)||void 0===o?void 0:o.id,$share_title:null==a?void 0:a.title,$share_path:d(g),$share_query:g[1]}),null==a?void 0:a.attributes)),l(f)},this.buildTimelineEvent=function(e,n){var i,o,a,u=n[0];2>n.length?1===n.length&&(a=u):a=n[1];var s=r.growingIO.dataStore,c=s.eventContextBuilder,l=s.eventInterceptor,g=((null==a?void 0:a.path)||"").split("?"),f=t({eventType:"CUSTOM",eventName:"$mp_share_timeline"},c(e));f.attributes=Y(t(t(t({},null!==(i=f.attributes)&&void 0!==i?i:{}),{$target:null===(o=null==u?void 0:u.target)||void 0===o?void 0:o.id,$share_title:null==a?void 0:a.title,$share_path:d(g),$share_query:g[1]}),null==a?void 0:a.attributes)),l(f)},this.buildAddFavorites=function(e,n){var i,o,a=n[0];2>n.length?1===n.length&&(o=a):o=n[1];var u=r.growingIO.dataStore,s=u.eventContextBuilder,c=u.eventInterceptor,l=((null==o?void 0:o.path)||"").split("?"),g=t({eventType:"CUSTOM",eventName:"$mp_add_favorites"},s(e));g.attributes=Y(t(t({},null!==(i=g.attributes)&&void 0!==i?i:{}),{$share_title:null==o?void 0:o.title,$share_path:d(l),$share_query:l[1]})),c(g)},this.trackersExecute=function(e){r.initializedTrackingIds.forEach(function(t){"function"===x(e)&&e(t)})},this.initializedTrackingIds=[],this.eventContextBuilder=new Ee(this.growingIO).main,this.eventHooks=new Ue(this.growingIO),this.shareOut=!1,this._gsid={},this._stid={},this.lastVisitEvent={},this.lastPageEvent={},this.locationData={},this.generalProps={},this.trackTimers={},this.interceptEvents=[];var a=this.growingIO,g=a.emitter,f=a.minipInstance;c(null===(n=f.minip)||void 0===n?void 0:n.onAppHide)&&f.minip.onAppHide(function(){r.trackersExecute(function(e){var t=r.trackTimers[e];k(t,function(e){e.start&&(e.leng=e.leng+(+Date.now()-e.start))})})}),c(null===(i=f.minip)||void 0===i?void 0:i.onAppShow)&&f.minip.onAppShow(function(){r.trackersExecute(function(e){var t=r.trackTimers[e];k(t,function(e){e.start&&(e.start=+Date.now())})})}),g.on(ke,function(e){var t=e.optionName,n=e.optionValue;"dataCollect"===t&&!1===n&&r.trackersExecute(function(e){r.growingIO.clearTrackTimer(e)})}),this.growingIO.emitter.on(be,function(e){var t=e.oldSessionId,n=e.trackingId;if(t){var i=r.eventHooks.appEffects.sessionEntry,o=i||r.eventHooks.currentPage.getPageContext(n),a=o.path,u=o.query;if(a)r.sendVisit(n,i||{path:a,query:u});else{var s=r.lastPageEvent[n];r.sendVisit(n,{path:s.path,query:s.query})}r.eventHooks.currentPage.lifeBeforeShow||r.sendPage(n)}})}return Object.defineProperty(e.prototype,"scene",{get:function(){return this._scene},set:function(e){var t=this._scene;this._scene=e,t!==this._scene&&this.growingIO.emitter.emit("SCENE_UPDATE",{newScene:e,oldScene:t})},enumerable:!1,configurable:!0}),e}(),Le={scnPrefix:"",appHandlers:["onLaunch","onShow","onHide","onError","onPageNotFound","onUnhandledRejection","onThemeChange"],pageHandlers:["onLoad","onShow","onReady","onHide","onShareAppMessage","onTabItemTap","onUnload","onPullDownRefresh","onReachBottom","onResize"],shareEventTypes:["onShareAppMessage","onShareTimeline","onAddToFavorites"],actionEventTypes:["onclick","tap","onTap","longpress","longTap","blur","change","onChange","submit","confirm","getuserinfo","getphonenumber","contact","mouseup"],canHook:!0,hooks:{App:!0,Page:!0,Component:!0,Behavior:!0},listeners:{app:{appLaunch:"onLaunch",appShow:"onShow",appClose:"onHide"},page:{pageLoad:"onLoad",pageShow:"onShow",pageReady:"onReady",pageHide:"onHide",pageUnload:"onUnload",tabTap:"onTabItemTap",shareApp:"onShareAppMessage"},actions:{click:["onclick","tap","longpress","longTap","getuserinfo","getphonenumber","contact","mouseup"],change:["blur","change","confirm"],submit:["submit"]}}},Fe=t(t({},Le),{listeners:t({},Le.listeners),name:"Weixin",platform:"MinP"});Fe.pageHandlers=n(n([],Le.pageHandlers,!0),["onShareTimeline","onAddToFavorites"],!1),Fe.listeners.page=t(t({},Le.listeners.page),{shareTime:"onShareTimeline",addFavorites:"onAddToFavorites"});var Be=function(n){function i(e){var i=n.call(this,e)||this;return i.growingIO=e,i.getSystemInfo=function(){return e=i,n=void 0,o=function(){var e,n,i,r=this;return function(e,t){var n,i,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=u(0),a.throw=u(1),a.return=u(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(u){return function(s){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(o=0)),o;)try{if(n=1,i&&(r=2&u[0]?i.return:u[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,u[1])).done)return r;switch(i=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,i=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==u[0]&&2!==u[0])){o=0;continue}if(3===u[0]&&(!r||u[1]>r[0]&&u[1]<r[3])){o.label=u[1];break}if(6===u[0]&&o.label<r[1]){o.label=r[1],r=u;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(u);break}r[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],i=0}finally{n=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}}(this,function(o){switch(o.label){case 0:return e=t(t(t({},D(function(){var e,t;return null===(t=null===(e=r.minip)||void 0===e?void 0:e.getDeviceInfo)||void 0===t?void 0:t.call(e)})||{}),D(function(){var e,t;return null===(t=null===(e=r.minip)||void 0===e?void 0:e.getWindowInfo)||void 0===t?void 0:t.call(e)})||{}),D(function(){var e,t;return null===(t=null===(e=r.minip)||void 0===e?void 0:e.getAppBaseInfo)||void 0===t?void 0:t.call(e)})||{}),n=D(function(){var e,t;return null===(t=null===(e=r.minip)||void 0===e?void 0:e.getSystemInfoSync)||void 0===t?void 0:t.call(e)})||{},i=t(t({},n),e),C(i)?[4,new Promise(function(e){var t,n={__gioFailed:!0};if(!(null===(t=r.minip)||void 0===t?void 0:t.getSystemInfo))return r.systemInfo=n,void e(n);try{r.minip.getSystemInfo({success:function(t){r.systemInfo=C(t)?n:t,e(r.systemInfo)},fail:function(){r.systemInfo=n,e(n)}})}catch(t){r.systemInfo=n,e(n)}})]:(this.systemInfo=i,[2,i]);case 1:return[2,o.sent()]}})},new((r=void 0)||(r=Promise))(function(t,i){function a(e){try{s(o.next(e))}catch(e){i(e)}}function u(e){try{s(o.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):(n=e.value,n instanceof r?n:new r(function(e){e(n)})).then(a,u)}s((o=o.apply(e,n||[])).next())});var e,n,r,o},i.hookSetTitle(),i}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+n+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}(i,n),i}(function(e){var t=this;this.growingIO=e,this.minip=Q("wx"),this.networkStatusListenerRegistered=!1,this.loadMetadata=function(e,n){new Promise(function(e,t){var i=setTimeout(function(){return e(void 0)},3e3);Promise.resolve(D(n)).then(function(t){clearTimeout(i),e(t)},function(e){clearTimeout(i),t(e)})}).then(function(n){var i;C(t[e])&&(t[e]=C(n)?{__gioFailed:!0}:n),null===(i=t.growingIO.dataStore)||void 0===i||i.eventReleaseInspector()},function(){var n;t[e]={__gioFailed:!0},null===(n=t.growingIO.dataStore)||void 0===n||n.eventReleaseInspector()})},this.hookSetTitle=function(){var e,n=null===(e=t.minip)||void 0===e?void 0:e.setNavigationBarTitle,i=t;n&&Object.defineProperty(t.minip,"setNavigationBarTitle",{writable:!0,enumerable:!0,configurable:!0,value:function(){var e=(arguments[0]||{}).title;return i.growingIO.gioSDKInitialized&&D(function(){i.growingIO.dataStore.eventHooks.currentPage.setConfiguredTitle(e)}),n.apply(this,arguments)}})},this.initImpression=function(e){var n,i;null===(i=null===(n=t.growingIO.plugins)||void 0===n?void 0:n.gioImpressionTracking)||void 0===i||i.main(e,"observeAll")},this.getCurrentPage=function(){return D(function(){return f(getCurrentPages())})||{}},this.getCurrentPath=function(e){return Ae(e)||Ae(t.getCurrentPage())},this.getPageTitle=function(e){var n,i,r,a,u,s,c,g,d=Ae(e)||(null==e?void 0:e.route),f=W(),p="",v=z(f);"string"===x(v)&&(v=null!==(n=D(function(){return JSON.parse(v)}))&&void 0!==n?n:{});var h,I=(null==e?void 0:e.data)||(null==e?void 0:e.$data)||{};if((p=o(null==I?void 0:I.gioPageTitle)?null==I?void 0:I.gioPageTitle:"")||D(function(){var e,t,n=$(f);n&&(h=n["".concat(d,".json")]||{},p=(null==h?void 0:h.navigationBarTitleText)||(null===(t=null===(e=null==h?void 0:h.mod)||void 0===e?void 0:e.exports)||void 0===t?void 0:t.navigationBarTitleText))}),!p&&v){var m=t.growingIO.dataStore.eventHooks.appEffects.enterParams;if(d||C(m)||(d=m.path||"",p=d?t._getTitleFromTabBar(v,d):""),!p&&(h=l(v.pages)?null!==(i=v.pages.find(function(e){return e.path===d}))&&void 0!==i?i:{}:v.page||{})){var y=h[d]||h["".concat(d,".html")]||h;p=(null==y?void 0:y.navigationBarTitleText)||(null===(r=null==y?void 0:y.window)||void 0===r?void 0:r.navigationBarTitleText)}p||(p=t._getTitleFromTabBar(v,d))}return p||(p=["wx","tt"].includes(f)?null===(s=null===(u=null===(a=v||global||$global)||void 0===a?void 0:a.global)||void 0===u?void 0:u.window)||void 0===s?void 0:s.navigationBarTitleText:null===(g=null===(c=v||global||$global)||void 0===c?void 0:c.window)||void 0===g?void 0:g.navigationBarTitleText),F(p)},this._getTitleFromTabBar=function(e,t){var n,i,r=null===(i=null===(n=null==e?void 0:e.tabBar)||void 0===n?void 0:n.list)||void 0===i?void 0:i.find(function(e){return e.pagePath===t||e.pagePath==="".concat(t,".html")});return(null==r?void 0:r.text)||""},this.getStorageSync=function(e){var n,i=null===(n=t.minip)||void 0===n?void 0:n.getStorageSync(e);return s(i)&&i.expiredAt?i.expiredAt<Date.now()?(t.removeStorageSync(e),""):i.value:i},this.setStorageSync=function(e,n,i){var r;i&&(n={value:n,expiredAt:i}),null===(r=t.minip)||void 0===r||r.setStorageSync(e,n)},this.setStorage=function(e,n){var i;null===(i=t.minip)||void 0===i||i.setStorage({key:e,data:n})},this.removeStorageSync=function(e){var n;null===(n=t.minip)||void 0===n||n.removeStorageSync(e)},this.getNetworkType=function(){var e=t;return new Promise(function(n){var i;null===(i=t.minip)||void 0===i||i.getNetworkType({success:function(t){e.network=t,n(t)},fail:function(){e.network={__gioFailed:!0},n(e.network)}})})},this.request=function(e){var n,i=e.url,r=e.data,o=e.header,a=e.timeout,u=e.method,s=e.success,c=e.fail,l=e.complete;return null===(n=t.minip)||void 0===n?void 0:n.request({url:i,data:r,header:o,timeout:a,method:u,success:s,fail:c,complete:l})},this.getSystemInfo=function(){var e=t;return new Promise(function(n){var i;null===(i=t.minip)||void 0===i||i.getSystemInfo({success:function(t){e.systemInfo=t,n(t)},fail:function(){e.systemInfo={__gioFailed:!0},n(e.systemInfo)}})})},this.setNetworkStatusListener=function(){var e;if(!t.networkStatusListenerRegistered){var n=null===(e=t.minip)||void 0===e?void 0:e.onNetworkStatusChange;if(c(n))try{n.call(t.minip,function(e){var n=e.networkType;n&&(t.network&&s(t.network)||(t.network={}),t.network.networkType=n)}),t.networkStatusListenerRegistered=!0}catch(e){N(e,"warn")}}};var n=this.growingIO.platformConfig,i=n.platform,r=n.scnPrefix;this.platform=i,this.scnPrefix=r,this.growingIO.emitter.on(_e,function(){t.loadMetadata("network",function(){return t.getNetworkType()}),t.loadMetadata("systemInfo",function(){return t.getSystemInfo()})})}),Ke=["gioPerformance"],He=function(e){var t,i,r,o,a,u,s=this;this.growingIO=e,this.innerPluginInit=function(){var e;Ke.forEach(function(e){var t;return T(null===(t=s.pluginsContext)||void 0===t?void 0:t.plugins,e)}),O(null===(e=s.pluginsContext)||void 0===e?void 0:e.plugins).forEach(function(e){var t,n,i=null!==(n=null===(t=s.pluginsContext)||void 0===t?void 0:t.plugins[e])&&void 0!==n?n:{},r=i.name,o=i.method;h(s.pluginItems,function(e){return e.name===r})||s.pluginItems.push({name:y(r||e),method:o||function(e){}})}),C(s.pluginItems)||s.installAll()},this.install=function(e,t,n){var i,r,o=s.growingIO.emitter,a=t||h(s.pluginItems,function(t){return t.name===e});if((null===(i=s.growingIO)||void 0===i?void 0:i.plugins)[e])return N("重复加载插件 ".concat(e," 或插件重名,已跳过加载!"),"warn"),!1;if(!a)return N("插件加载失败!不存在名为 ".concat(e," 的插件!"),"error"),!1;try{return(null===(r=s.growingIO)||void 0===r?void 0:r.plugins)[e]=new a.method(s.growingIO,n),t&&(o.emit(Se,e),N("加载插件 ".concat(e),"info")),!0}catch(n){return s.lifeError(t,n),N("插件【".concat(e,"】加载异常 ").concat(n),"error"),!1}},this.installAll=function(e){(e||s.pluginItems).forEach(function(t){s.install(t.name,e?t:void 0,e?null==t?void 0:t.options:void 0)&&!h(s.pluginItems,function(e){return e.name===t.name})&&s.pluginItems.push({name:y(t.name),method:t.method?t.method:function(){}})})},this.uninstall=function(e){var t,n=s.pluginItems.findIndex(function(t){return t.name===e});n>-1&&s.pluginItems.splice(n,1);var i=T(null===(t=s.growingIO)||void 0===t?void 0:t.plugins,e);return i||N("卸载插件 ".concat(e," 失败!"),"error"),i},this.uninstallAll=function(){n([],s.pluginItems,!0).forEach(function(e){return s.uninstall(e.name)})},this.lifeError=function(e,t){if(!s.handlingError){s.handlingError=!0;try{s.growingIO.emitter.emit(ye,{plugin:e,error:t})}finally{s.handlingError=!1}}N("插件执行错误 ".concat((null==e?void 0:e.name)||"unknown"," ").concat(t),"error")},this.callLifeCycle=function(e,t){s.pluginItems.forEach(function(n){var i=s.growingIO.plugins[n.name]?s.growingIO.plugins[n.name][e]:void 0;if(i&&c(i))try{i(t)}catch(e){s.lifeError(n,e)}})},this.pluginsContext={plugins:{}},this.pluginItems=[],this.handlingError=!1,null===(t=this.growingIO.emitter)||void 0===t||t.on(Se,function(e){return s.callLifeCycle("onInstall",e)}),null===(i=this.growingIO.emitter)||void 0===i||i.on(ye,function(e){return s.callLifeCycle("onError",e)}),null===(r=this.growingIO.emitter)||void 0===r||r.on(me,function(e){return s.callLifeCycle("onComposeBefore",e)}),null===(o=this.growingIO.emitter)||void 0===o||o.on(Ie,function(e){return s.callLifeCycle("onComposeAfter",e)}),null===(a=this.growingIO.emitter)||void 0===a||a.on(Pe,function(e){return s.callLifeCycle("onSendBefore",e)}),null===(u=this.growingIO.emitter)||void 0===u||u.on(we,function(e){return s.callLifeCycle("onSendAfter",e)})},Re={},je={}.hasOwnProperty;function Me(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function Ve(e){try{return encodeURIComponent(e)}catch(e){return null}}Re.stringify=function(e,t){t=t||"";var n,i,r=[];for(i in"string"!=typeof t&&(t="?"),e)if(je.call(e,i)){if((n=e[i])||null!=n&&!isNaN(n)||(n=""),i=Ve(i),n=Ve(n),null===i||null===n)continue;r.push(i+"="+n)}return r.length?t+r.join("&"):""},Re.parse=function(e){for(var t,n=/([^=?#&]+)=?([^&]*)/g,i={};t=n.exec(e);){var r=Me(t[1]),o=Me(t[2]);null===r||null===o||r in i||(i[r]=o)}return i};var Ge=function(e){var i=this;this.growingIO=e,this.activeBatches=new WeakSet,this.generateURL=function(e){var t=i.growingIO.dataStore.getTrackerVds(e),n=t.serverUrl,r=t.projectId;return S(n,"http")?"".concat(n,"/v3/projects/").concat(r,"/collect"):"https://".concat(n,"/v3/projects/").concat(r,"/collect")},this.getHoardingQueue=function(e){var t;return null!==(t=i.hoardingQueue[e])&&void 0!==t?t:[]},this.getRequestQueue=function(e){var t;return null!==(t=i.requestQueue[e])&&void 0!==t?t:[]},this.emitUploadEvent=function(e,t){return ve(i.growingIO.emitter,e,t)},this.commitRequest=function(e){var n,o,a=t({},e),u=i.growingIO,s=u.vdsConfig,c=u.emitter,l=i.growingIO.dataStore;"VISIT"===e.eventType&&(l.lastVisitEvent[e.trackingId]=e),"PAGE"===e.eventType&&(l.lastPageEvent[e.trackingId]=e),ve(c,"ON_COMMIT_REQUEST",{eventData:e,trackingId:e.trackingId}),s.forceLogin?(r(i.hoardingQueue[e.trackingId])&&(i.hoardingQueue[e.trackingId]=[]),null===(n=i.hoardingQueue[e.trackingId])||void 0===n||n.push(a)):(r(i.requestQueue[e.trackingId])&&(i.requestQueue[e.trackingId]=[]),null===(o=i.requestQueue[e.trackingId])||void 0===o||o.push(a),i.initiateRequest(e.trackingId))},this.prepareBatch=function(e,t){i.growingIO.dataStore.consumeOriginalSource(e,t)},this.initiateRequest=function(e,t){var r=i.growingIO,o=r.plugins,a=r.vdsConfig,u=i.getHoardingQueue(e),s=i.getRequestQueue(e);n(n([],u,!0),s,!0).length>0&&(i.requestingNum<i.requestLimit?function(e){var n,r;if(e===i.growingIO.trackingId&&(null===(n=null==a?void 0:a.tbConfig)||void 0===n?void 0:n.cloudFuncSend))null===(r=null==o?void 0:o.gioTaobaoAdapter)||void 0===r||r.singleInvoke(e);else if(t)i.batchInvoke(e);else{var u=i.growingIO.dataStore.getTrackerVds(e).uploadInterval;i.getThrottledBatchInvoke(e,u)(e)}}(e):i.pendingInitiates[e]=i.pendingInitiates[e]||!!t)},this.flushPendingInitiates=function(){var e=i.pendingInitiates,t=Object.keys(e);i.pendingInitiates={},t.forEach(function(t){return i.initiateRequest(t,e[t])})},this.getThrottledBatchInvoke=function(e,t){var n=i.throttledBatchInvoke[e];return n&&n.uploadInterval===t||(i.throttledBatchInvoke[e]={uploadInterval:t,invoke:E(function(e){return i.batchInvoke(e)},t,!1,!1)}),i.throttledBatchInvoke[e].invoke},this.getHttpCode=function(e){var t,n;return Number(null!==(n=null!==(t=null==e?void 0:e.statusCode)&&void 0!==t?t:null==e?void 0:e.status)&&void 0!==n?n:null==e?void 0:e.code)},this.batchInvoke=function(e){var r;if(i.requestingNum<i.requestLimit){var o=i.growingIO.vdsConfig,a=i.getHoardingQueue(e),u=i.getRequestQueue(e),s=n(n([],a,!0),u,!0);s.length>50?(s=s.slice(0,50),a.length>50?i.hoardingQueue[e]=a.slice(50):(i.requestQueue[e]=u.slice(50-a.length),i.hoardingQueue[e]=[])):(i.hoardingQueue[e]=[],i.requestQueue[e]=[]);var c=s;if(C(c))i.initiateRequest(e);else{i.prepareBatch(e,c);var l=c.map(function(e){var n=t({},e);return T(n,["requestId","trackingId","originalSourceId"]),n});o.debug&&console.log("[GrowingIO Debug]:",JSON.stringify(l,null,2)),e===i.growingIO.trackingId&&(null===(r=null==o?void 0:o.tbConfig)||void 0===r?void 0:r.cloudAppId)?i.growingIO.plugins.gioTaobaoAdapter.tbCloudAppInvoke(c,l):i.sendEvent(c,l)}}else i.initiateRequest(e,!0)},this.createRequestFinalizer=function(e,r,o,a,u){if(!i.activeBatches.has(e)){var s=d(e).trackingId;i.activeBatches.add(e),i.requestingNum+=1;var c,l=function(t,o,u){void 0===o&&(o=!1),void 0===u&&(u=a);try{if(o){var c=Math.max.apply(Math,n([1],e.map(function(e){return(i.retryIds[e.requestId]||0)+1}),!1));e.forEach(function(e){return i.requestFailFn(e)}),N("请求失败!".concat(function(e){try{return JSON.stringify(e)}catch(t){return e+""}}(t)),"error"),i.emitUploadEvent(Oe,{eventsQueue:e,trackingId:s,result:t,failureStage:u,attempts:c})}else e.forEach(function(e){return delete i.retryIds[e.requestId]})}finally{i.activeBatches.delete(e),i.requestingNum=Math.max(0,i.requestingNum-1),i.emitUploadEvent(we,{result:t,requestData:r,trackingId:s,failed:o,failureStage:o?u:void 0}),i.flushPendingInitiates(),i.initiateRequest(s)}};i.emitUploadEvent(Pe,t({eventsQueue:e,requestData:r,trackingId:s},u?{externalTransport:u}:{}));try{c=o()}catch(e){return void l(e,!0,"configuration")}var g,f,p,v,h,I,m,y=(g=function(){return l({errMsg:"GrowingIO request watchdog timeout"},!0,"watchdog")},p=!1,v=!1,h=function(){return D(function(){var e;return null===(e=null==f?void 0:f.abort)||void 0===e?void 0:e.call(f)})},I=function(){return!p&&(p=!0,clearTimeout(m),!0)},m=setTimeout(function(){if(I()){v=!0;try{g()}finally{h()}}},c),{finish:I,cancel:function(){I()&&(v=!0,h())},setTask:function(e){f=e,v&&h()}});return Object.assign(function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=a),y.finish()&&l(e,t,n)},{setTask:y.setTask})}},this.sendEvent=function(e,t){var r,o,a=d(e).trackingId,u=i.growingIO,s=u.minipInstance,c=u.dataStore,l=u.plugins;try{var g;if(!(o=i.createRequestFinalizer(e,t,function(){return(g=c.getTrackerVds(a)).requestTimeout},"transport")))return;var f=g.compress,p=g.requestTimeout,v={"content-type":"jdp"===s.platform?"application/json":"application/json;charset=UTF-8"},h=n([],t,!0),I=!!f&&(null===(r=null==l?void 0:l.gioCompress)||void 0===r?void 0:r.compressToUTF16);I&&(h=l.gioCompress.compressToUTF16(JSON.stringify(t)),v["X-Compress-Codec"]="1");var m=i.generateURL(a),y=s.request({url:"".concat(m,"?stm=").concat(Date.now(),"&compress=").concat(I?"1":"0"),header:v,method:"POST",data:h,timeout:p,success:function(e){[200,204].includes(i.getHttpCode(e))?o(e):o(e,!0,"http")},fail:function(e){return o(e,!0,"transport")},complete:function(e){var t=![200,204].includes(i.getHttpCode(e));o(e,t,"http")}});o.setTask(y)}catch(t){o?o(t,!0,"sync"):(e.forEach(function(e){return i.requestFailFn(e)}),i.emitUploadEvent(Oe,{eventsQueue:e,trackingId:a,result:t,failureStage:"configuration",attempts:1}))}},this.sendExternalEvent=function(e,t,n,r,o){var a=d(e).trackingId,u=i.createRequestFinalizer(e,t,function(){return i.growingIO.dataStore.getTrackerVds(a).requestTimeout},o,o);u&&Promise.resolve().then(n).then(function(e){r(e)?u(e):u(e,!0,"".concat(o,"_response"))}).catch(function(e){return u(e,!0,o)})},this.requestFailFn=function(e){var t;if(i.retryIds[e.requestId]||(i.retryIds[e.requestId]=0),i.retryIds[e.requestId]+=1,i.retryIds[e.requestId]>i.retryLimit)return N("请求已达到重试上限,事件将丢弃: ".concat(e.requestId),"warn"),void delete i.retryIds[e.requestId];if(!(null!==(t=i.requestQueue[e.trackingId])&&void 0!==t?t:i.requestQueue[e.trackingId]=[]).some(function(t){return t.requestId===e.requestId}))var n=800*Math.pow(2,i.retryIds[e.requestId]-1),r=Math.round(n*(.8+.4*Math.random())),o=setTimeout(function(){var t,n=null!==(t=i.requestQueue[e.trackingId])&&void 0!==t?t:i.requestQueue[e.trackingId]=[];if(n.some(function(t){return t.requestId===e.requestId}))return clearTimeout(o),void(o=null);C(n)?(n.push(e),i.initiateRequest(e.trackingId)):n.push(e),clearTimeout(o),o=null},r)},this.hoardingQueue={},this.requestQueue={},this.requestLimit=3,this.retryLimit=2,this.retryIds={},this.requestingNum=0,this.throttledBatchInvoke={},this.pendingInitiates={}},Qe=function(e){var t=this;this.growingIO=e,this.identityTransactionDepth=0,this.changedIdentities=new Set,this.deviceIdentityChanged=!1,this.identityRevisions={},this.identityNotifications=[],this.runIdentityTransaction=function(e,n){t.identityTransactionDepth+=1;try{return n()}finally{t.identityTransactionDepth-=1,t.identityTransactionDepth||t.flushIdentityNotifications()}},this.getSessionSnapshot=function(e){return t._sessionId[e]},this.getIdentitySnapshot=function(e){var n,i,r;return Object.freeze({deviceId:t._uid||"",userId:null!==(n=t._userId[e])&&void 0!==n?n:"",userKey:null!==(i=t._userKey[e])&&void 0!==i?i:"",gioId:null!==(r=t._gioId[e])&&void 0!==r?r:"",sessionId:t.getSessionSnapshot(e),revision:t.identityRevisions[e]||0})},this.recordIdentityChange=function(e){e?t.changedIdentities.add(e):t.deviceIdentityChanged=!0},this.notifyIdentityField=function(e,n){t.identityNotifications.push({message:e,payload:n})},this.flushIdentityNotifications=function(){var e=new Set(t.changedIdentities);t.deviceIdentityChanged&&n(n(n([t.growingIO.trackingId],t.growingIO.dataStore.initializedTrackingIds||[],!0),Object.keys(t._sessionId),!0),Object.keys(t._userId),!0).forEach(function(t){t&&e.add(t)});var i=t.identityNotifications;t.changedIdentities.clear(),t.deviceIdentityChanged=!1,t.identityNotifications=[],Array.from(e,function(e){return t.identityRevisions[e]=(t.identityRevisions[e]||0)+1,Object.freeze({trackingId:e,identity:t.getIdentitySnapshot(e)})}).forEach(function(e){return ve(t.growingIO.emitter,"IDENTITY_CHANGED",e)}),i.forEach(function(e){var n=e.message,i=e.payload;return ve(t.growingIO.emitter,n,i)})},this._getUidKey=function(){return t.growingIO.inPlugin?"_growing_plugin_uid_":"_growing_uid_"},this.getUid=function(){var e=t.growingIO.minipInstance;return"quickapp"===t.growingIO.gioPlatform&&!1===e.identityReady?"":(t._uid||(t._uid=e.getStorageSync(t._getUidKey())),t._uid||t.setUid(H()),t._uid)},this.setUid=function(e){return t.runIdentityTransaction(t.growingIO.trackingId,function(){var n=t.growingIO.minipInstance,i=t._uid||D(function(){return n.getStorageSync(t._getUidKey())});t._uid=e,!i&&e&&(t.isNewDevice=!0,Object.keys(t._sessionId).forEach(function(e){t._newDeviceSessionIds[e]||(t._newDeviceSessionIds[e]=t._sessionId[e])})),i!==t._uid&&(D(function(){return n.setStorage(t._getUidKey(),t._uid)}),t.recordIdentityChange(),t.notifyIdentityField(Te,{newUId:e,oldUId:i}))})},this.restoreUid=function(e){return t.runIdentityTransaction(t.growingIO.trackingId,function(){var n=t._uid;t._uid=e,t.isNewDevice=!1,t._newDeviceSessionIds={},t.recordIdentityChange(),n!==e&&t.notifyIdentityField(Te,{newUId:e,oldUId:n})})},this.getSessionId=function(e){var n=t.growingIO,i=n.vdsConfig.sessionExpires,r=n.dataStore.trackersExecute;return t._sessionId[e]||t.setSessionId(e),i>-1&&(Date.now()>t._sessionExpires&&r(function(e){t.setSessionId(e)}),t._sessionExpires=Date.now()+6e4*i),t._sessionId[e]},this.setSessionId=function(e,n){var i=t._sessionId[e];n||(n=H()),t._sessionId[e]=n,t.isNewDevice&&!t._newDeviceSessionIds[e]&&(t._newDeviceSessionIds[e]=n);var r=t.growingIO.vdsConfig.sessionExpires;r>-1&&(t._sessionExpires=Date.now()+6e4*r),i!==n&&ve(t.growingIO.emitter,be,{trackingId:e,newSessionId:n,oldSessionId:i})},this.isNewDeviceInSession=function(e){if(!t.isNewDevice)return!1;var n=t.getSessionId(e);return t._newDeviceSessionIds[e]===n},this._getUserIdKey=function(e){return t.growingIO.dataStore.getStorageKey(e,"userId")},this.getUserId=function(e){var n,i=t.growingIO.minipInstance;return r(t._userId[e])&&(t._userId[e]=null!==(n=i.getStorageSync(t._getUserIdKey(e)))&&void 0!==n?n:""),t._userId[e]},this.setUserId=function(e,n){return t.runIdentityTransaction(e,function(){var i=t._userId[e];t._userId[e]=r(n)?"":n,i!==t._userId[e]&&(D(function(){return t.growingIO.minipInstance.setStorage(t._getUserIdKey(e),t._userId[e])}),t.recordIdentityChange(e),t.notifyIdentityField("USERID_UPDATE",{trackingId:e,newUserId:n,oldUserId:i})),n&&t.setGioId(e,n)})},this._getUserKeyKey=function(e){return t.growingIO.dataStore.getStorageKey(e,"userKey")},this.getUserKey=function(e){var n,i=t.growingIO.minipInstance;return r(t._userKey[e])&&(t._userKey[e]=null!==(n=i.getStorageSync(t._getUserKeyKey(e)))&&void 0!==n?n:""),t._userKey[e]},this.setUserKey=function(e,n){return t.runIdentityTransaction(e,function(){var i=t._userKey[e];t._userKey[e]=r(n)?"":n,i!==t._userKey[e]&&(D(function(){return t.growingIO.minipInstance.setStorage(t._getUserKeyKey(e),t._userKey[e])}),t.recordIdentityChange(e),t.notifyIdentityField("USERKEY_UPDATE",{trackingId:e,newUserKey:n,oldUserKey:i}))})},this._getGioIdKey=function(e){return t.growingIO.dataStore.getStorageKey(e,"gioId")},this.getGioId=function(e){var n,i=t.growingIO.minipInstance;return r(t._gioId[e])&&(t._gioId[e]=null!==(n=i.getStorageSync(t._getGioIdKey(e)))&&void 0!==n?n:""),t._gioId[e]},this.setGioId=function(e,n){return t.runIdentityTransaction(e,function(){var i=t._gioId[e];t._gioId[e]=r(n)?"":n,i!==t._gioId[e]&&(D(function(){return t.growingIO.minipInstance.setStorage(t._getGioIdKey(e),t._gioId[e])}),t.notifyIdentityField("GIOID_UPDATE",{trackingId:e,newGioId:n,oldGioId:i}))})},this.initUserInfo=function(e){return t.runIdentityTransaction(e,function(){var n,i=t.getIdentitySnapshot(e),r=t.growingIO.minipInstance,o=[t._getUidKey(),t._getUserIdKey(e),t._getUserKeyKey(e),t._getGioIdKey(e)],a=null!==(n=Z(r,o))&&void 0!==n?n:[];["_uid","_userId","_userKey","_gioId"].forEach(function(n,i){var r;"_uid"===n?t.getUid():t[n][e]=null!==(r=a[i])&&void 0!==r?r:""});var u=t.getIdentitySnapshot(e);i.deviceId===u.deviceId&&i.userId===u.userId&&i.userKey===u.userKey||t.recordIdentityChange(e)})},this.saveUserInfo=function(){var e=t.growingIO,n=e.minipInstance;(0,e.dataStore.trackersExecute)(function(e){X(n,[{key:t._getUidKey(),value:t._uid},{key:t._getUserIdKey(e),value:t._userId[e]},{key:t._getUserKeyKey(e),value:t._userKey[e]},{key:t._getGioIdKey(e),value:t._gioId[e]}])})},this._uid=void 0,this._sessionId={},this._userId={},this._userKey={},this._gioId={},this._sessionExpires=-1,this.isNewDevice=!1,this._newDeviceSessionIds={}},ze=new function(){var e,i=this;this.init=function(e){var t,n,r,o,a,u,s=null==e?void 0:e.trackingId,c=J(),l={trackingId:i.trackingId,vdsConfig:i.vdsConfig,initialized:i.gioSDKInitialized,inPlugin:i.inPlugin,canHook:i.platformConfig.canHook,subConfig:null===(t=i.subInstance)||void 0===t?void 0:t[s],globalConfig:c.vdsConfig,globalSubInstances:null===(n=c.vdsConfig)||void 0===n?void 0:n.subInstance,globalSubConfig:null===(o=null===(r=c.vdsConfig)||void 0===r?void 0:r.subInstance)||void 0===o?void 0:o[s]},g=i.dataStore.initializedTrackingIds.includes(s);try{if(i.emitter.emit("ON_SDK_INITIALIZE_BEFORE",{options:e}),N("Gio小程序SDK 初始化中...","info"),!1===(null===(a=i.platformConfig)||void 0===a?void 0:a.supported))throw Error("当前 ".concat(i.gioFramework," SDK 不支持 ").concat(i.gioPlatform||"未知"," 平台,已停止初始化!"));if(e.trackingId&&i.dataStore.initializedTrackingIds.includes(e.trackingId))throw Error("已存在实例 ".concat(e.trackingId,",请勿重复初始化!"));if(i.trackingId&&!i.plugins.gioMultipleInstances)throw Error("您正在尝试初始化另一个实例,请集成多实例插件后重试!");if(u=i.dataStore.initTrackerOptions(e),ve(i.emitter,_e,u),!i.dataStore.initTrackerHooker(u))throw Error("SDK 框架适配初始化失败,已停止采集以避免假成功");i.dataStore.initStorageInfo(s),"quickapp"!==i.gioPlatform&&i.userStore.initUserInfo(s)}catch(e){return g||i.dataStore.initializedTrackingIds.includes(s)||(i.gioSDKInitialized=!!l.initialized,i.trackingId=l.trackingId,i.vdsConfig=l.vdsConfig,i.inPlugin=l.inPlugin,i.platformConfig.canHook=l.canHook,i.subInstance&&(void 0===l.subConfig?T(i.subInstance,s):i.subInstance[s]=l.subConfig),c.vdsConfig=l.globalConfig,l.globalConfig&&(l.globalSubInstances?(void 0===l.globalSubConfig?T(l.globalSubInstances,s):l.globalSubInstances[s]=l.globalSubConfig,l.globalConfig.subInstance=l.globalSubInstances):T(l.globalConfig,"subInstance"))),N(e,"error"),!1}return i.dataStore.initializedTrackingIds.push(s),i.gioSDKInitialized=!0,ve(i.emitter,"SDK_INITIALIZED",u),D(function(){i.trackingId&&i.trackingId!==s||(c.__gio__=function(){return i})}),D(function(){return N("Gio小程序SDK 初始化完成!","success")}),i.inPlugin&&"tbp"!==i.minipInstance.platform&&D(function(){return i.dataStore.sendVisit(u.trackingId)}),i.vdsConfig.forceLogin&&D(function(){return N("forceLogin已开启,请调用 identify 方法设置 openId 以继续上报!","info")}),!0},this.handlerDistribute=function(e,t,r){var o=i.dataStore,a=o.initializedTrackingIds;if((0,o.getTrackerVds)(e)&&a.includes(e))return i[t].apply(i,n([e],r,!1));N("不存在实例:".concat(e,",请检查!"),"warn")},this.registerPlugins=function(e){i.plugins.pluginItems=n(n([],i.plugins.pluginItems,!0),e,!0),i.plugins.installAll(e)},this.getPlugins=function(){return i.plugins.pluginItems},this.getDeviceId=function(){return i.userStore.getUid()},this.getOption=function(e,t){return i.dataStore.getOption(e,t)},this.setOption=function(e,t,n){var r;return O(le).includes(t)?x(n)===(null===(r=ue[t])||void 0===r?void 0:r.type)?!!i.dataStore.setOption(e,t,n)&&(N("已修改".concat(le[t],": ").concat(n),"info"),!0):(N("参数格式不正确:".concat(n,",请检查后重试!"),"error"),!1):(N("不存在可修改的配置项:".concat(t,",请检查后重试!"),"error"),!1)},this.setPageAttributes=function(e,t){if(s(t)&&!C(t)){var n=i.dataStore.eventHooks.currentPage,r=n.getPagePath();return C(n.pageProps[e])&&(n.pageProps[e]={}),C(n.pageProps[e][r])&&(n.pageProps[e][r]={}),C(t)||k(t,function(t,i){c(n.pageProps[e][r][i])&&!c(t)||(n.pageProps[e][r][i]=t)}),!0}return U("setPageAttributes"),!1},this.clearPageAttributes=function(e,t){try{if(!C(i.dataStore.eventHooks.currentPage.pageProps[e])){var n=i.dataStore.eventHooks.currentPage,r=n.getPagePath();l(t)&&!C(t)?t.forEach(function(t){T(n.pageProps[e][r],t)}):n.pageProps[e][r]={}}}catch(e){return U("clearPageAttributes"),!1}},this.sendPage=function(e,t){i.dataStore.getTrackerVds(e).trackPage?N("仅在关闭trackPage时允许调用sendPage,请确认后修改初始化配置项!","error"):i.dataStore.sendPage(e,t)},this.identify=function(e,t){if(e===i.trackingId)if(i.vdsConfig.forceLogin){if(!ae(t))return void U("identify");var n=I(t).slice(0,1e3);i.userStore.runIdentityTransaction(e,function(){i.userStore.setUid(n),i.dataStore.setInternalOption(i.trackingId,"forceLogin",!1),i._identified=!0,i.dataStore.trackersExecute(function(e){var t=i.uploader.getHoardingQueue(e);t.forEach(function(e,i){return t[i].deviceId=n}),i.uploader.initiateRequest(e,!0)})})}else i._identified?U("identify",!1,"请勿重复调用"):U("identify",!1,"forceLogin未开启");else U("identify",!1,"子实例不允许调用identify")},this.setUserAttributes=function(e,n){var r,o,a,u;if(s(n)&&!C(n)){var c=i.dataStore,l=c.eventContextBuilder,g=c.eventInterceptor,d=c.lastVisitEvent,f=t({eventType:"LOGIN_USER_ATTRIBUTES"},l(e));f.attributes=Y(t(t({},null!==(r=f.attributes)&&void 0!==r?r:{}),K(n))),f.path||(f.path=null===(o=d[e])||void 0===o?void 0:o.path,f.query=null===(a=d[e])||void 0===a?void 0:a.query,f.title=null===(u=d[e])||void 0===u?void 0:u.title),g(f)}else U("setUserAttributes")},this.setUserId=function(e,t,n){if(ae(t)){var o=i.userStore.getGioId(e),a=I(t).slice(0,1e3);n=I(n).slice(0,1e3);var u=!r(n)&&I(n).length>0?I(n).slice(0,1e3):"";!i.dataStore.getTrackerVds(e).idMapping&&u&&(N("您设置了 userKey ,请初始化开启 idMapping!","warn"),u=""),i.userStore.runIdentityTransaction(e,function(){i.userStore.setUserId(e,a),i.userStore.setUserKey(e,u),o&&o!==a&&i.userStore.setSessionId(e)})}else U("setUserId")},this.clearUserId=function(e){i.userStore.runIdentityTransaction(e,function(){i.userStore.setUserId(e,void 0),i.userStore.setUserKey(e,void 0)})},this.setGeneralProps=function(e,t){return s(t)&&!C(t)?(C(i.dataStore.generalProps[e])&&(i.dataStore.generalProps[e]={}),k(t,function(t,n){c(i.dataStore.generalProps[e][n])&&!c(t)||(i.dataStore.generalProps[e][n]=t)}),!0):(U("setGeneralProps"),!1)},this.clearGeneralProps=function(e,t){try{C(i.dataStore.generalProps[e])||(l(t)&&!C(t)?t.forEach(function(t){T(i.dataStore.generalProps[e],t)}):i.dataStore.generalProps[e]={})}catch(e){return U("clearGeneralProps"),!1}},this.track=function(e,n,r){B(n,function(){var o,a=i.dataStore,u=a.eventContextBuilder,c=a.eventInterceptor,l=t({eventType:"CUSTOM",eventName:n},u(e));l.attributes=Y(t(t({},null!==(o=l.attributes)&&void 0!==o?o:{}),K(t({},s(r)&&!C(r)?r:{})))),i.plugins.gioMultipleInstances&&r&&r["&&sendTo"]&&(l["&&sendTo"]=r["&&sendTo"]),c(l)})},this.trackTimerStart=function(e,t){return i.dataStore.getTrackerVds(e).dataCollect?B(t,function(){var n=H();return i.dataStore.trackTimers[e]||(i.dataStore.trackTimers[e]={}),i.dataStore.trackTimers[e][n]={ended:!1,eventName:t,leng:0,start:+Date.now()},n}):(N("指定实例未开启数据采集,请检查!","error"),!1)},this.trackTimerPause=function(e,t){var n=i.dataStore.trackTimers[e];if(t&&n&&n[t]){var r=n[t];return!r.ended&&(r.start&&(r.leng=r.leng+(+Date.now()-r.start)),r.start=0,!0)}return!1},this.trackTimerResume=function(e,t){var n=i.dataStore.trackTimers[e];if(t&&n&&n[t]){var r=n[t];return!r.ended&&(0===r.start&&(r.start=+Date.now()),!0)}return!1},this.trackTimerEnd=function(e,n,r){var o,a=i.dataStore.getTrackerVds(e).dataCollect,u=i.dataStore.trackTimers[e];if(n&&u&&u[n]){var c=u[n];if(c.ended)return N("指定计时器已结束,请勿重复调用!","warn"),!1;if(a){if(0!==c.start){var l=+Date.now()-c.start;c.leng=l>0?c.leng+l:0}var g=i.dataStore,d=g.eventContextBuilder,f=g.eventInterceptor,p=t({eventType:"CUSTOM",eventName:c.eventName},d(e));return p.attributes=Y(t(t({},null!==(o=p.attributes)&&void 0!==o?o:{}),K(t(t({},s(r)&&!C(r)?r:{}),{event_duration:c.leng>864e5?0:c.leng/1e3})))),i.plugins.gioMultipleInstances&&r&&r["&&sendTo"]&&(p["&&sendTo"]=r["&&sendTo"]),f(p),c.ended=!0,c.start=0,!0}return N("指定实例未开启数据采集,计时器已停止,请检查!","error"),c.ended=!0,c.start=0,!1}return N("未查询到指定计时器,请检查!","error"),!1},this.removeTimer=function(e,t){var n=i.dataStore.trackTimers[e];return t&&n&&n[t]?(delete n[t],!0):(N("未查询到指定计时器,请检查!","error"),!1)},this.clearTrackTimer=function(e){i.dataStore.trackTimers[e]={}},this.setLocation=function(e,t,n){C(i.dataStore.locationData[e])&&(i.dataStore.locationData[e]={});var r,o=i.dataStore.locationData[e];-90>(r=t)||r>90||!function(e){return e>=-180&&180>=e}(n)||o.latitude===t&&o.longitude===n||(i.dataStore.locationData[e]={latitude:t,longitude:n})},this.clearLocation=function(e){i.dataStore.locationData[e]={}},this.updateImpression=function(){N("updateImpression 错误! 请集成半自动埋点浏览插件后重试!","error")},this.getABTest=function(e,t,n){N("获取ABTest数据错误! 请集成ABTest插件后重试!","error"),L(n,{})},this.getGioInfo=function(e){var t,n,r=i.userStore,o=r.getUid,a=r.getUserId,u=r.getUserKey,s=r.getSessionId,c=i.dataStore.getTrackerVds(e),l=c.projectId,g=c.appId,d=c.dataSourceId,f=c.dataCollect,p=c.idMapping,v=c.extraParams,h=c.ignoreFields,I=o(),m=s(e),y={gioappid:g,giocs1:a(e)||"",gioplatform:i.platformConfig.platform,gioprojectid:l,gios:m,giou:I,gionewdevice:i.userStore.isNewDeviceInSession(e)};if(y.giodatacollect=f,y.giodatasourceid=d,p&&(y.giouserkey=u(e)),C(v)||v.forEach(function(t){var n;h.includes(t)||(y["gio".concat(t)]=(null!==(n=i.dataStore.lastVisitEvent[e])&&void 0!==n?n:{})[t])}),e===i.trackingId){var S=null!==(n=null===(t=i.plugins)||void 0===t?void 0:t.gioEventAutoTracking)&&void 0!==n?n:{},w=S.circleServerUrl,P=S.circleOpen;if(w&&P){var O=te(w.split("?")[1]);O.roomId&&(y.giocircleroomid=O.roomId)}}return Re.stringify(y)},this.gioSDKInitialized=!1,this.utils=t(t(t({},q),oe),{qs:Re}),this.emitter={all:e=e||new Map,on:function(t,n){var i=e.get(t);i?i.push(n):e.set(t,[n])},off:function(t,n){var i=e.get(t);i&&(n?i.splice(i.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var i=e.get(t);i&&i.slice().map(function(e){e(n)}),(i=e.get("*"))&&i.slice().map(function(e){e(t,n)})}},this.gioPlatform="wx",this.gioFramework="native",this.sdkVersion="4.6.1";try{"quickapp"===this.gioPlatform||c(getApp)&&c(App)?this.inPlugin=!1:this.inPlugin=!0}catch(e){this.inPlugin=!0}this.inPlugin&&N("未检测到小程序实例,自动切换为插件模式!","info"),this.platformConfig=Fe,this.minipInstance=new Be(this),this.dataStore=new De(this),this.userStore=new Qe(this),this.uploader=new Ge(this),this.plugins=new He(this),this.plugins.innerPluginInit()},$e=function(){var e,n=arguments[0],i="g0",r=n;if(o(n)&&n.indexOf(".")>-1&&(i=null!==(e=n.split(".")[0])&&void 0!==e?e:"g0",r=n.split(".")[1]),o(r)&&ce.includes(r)&&ze[r]){var a=p(Array.from(arguments));if("init"===r){var u=function(e,t){var n=I(t[0]),i=I(t[1]),r=o(t[2])?t[2].trim():t[2],a=ae(r)?I(r):"",u=t[3]||{};return n&&i&&a?e.dataStore.initializedTrackingIds.some(function(t,r){var o=0===r?e.vdsConfig:e.subInstance[t];return o.projectId===n&&o.dataSourceId===i})?(N("SDK初始化失败,重复初始化,请检查初始化参数!","error"),!1):{projectId:n,dataSourceId:i,appId:a,userOptions:u}:(N('SDK初始化失败,请使用 gdp("init", "您的GrowingIO项目 accountId", "您项目的 dataSourceId", "您的小程序 AppId", options: { serverUrl: "您的数据上报地址" }); 进行初始化!',"error"),!1)}(ze,a);if(u){var s=u.projectId,c=u.dataSourceId,l=u.appId,g=u.userOptions;return ze.init(t(t({},g),{projectId:s,dataSourceId:c,appId:l,trackingId:i}))}return!1}if("registerPlugins"===r)ze.registerPlugins(a[0]);else{if(ze.gioSDKInitialized&&ze.vdsConfig)return se.includes(r)?D(function(){return ze.handlerDistribute(i,r,a)}):D(function(){return ze[r].apply(ze,a)});N("SDK未初始化!","error")}}else if(ge.includes(r))N("方法 ".concat(I(r)," 已被弃用,请移除!"),"warn");else{if("canIUse"===r)return ce.includes(arguments[1])&&!!ze[arguments[1]];N("不存在名为 ".concat(I(r)," 的方法调用!"),"error")}};J().gdp=$e,J().gioSDKVersion=ze.sdkVersion;var We=ze.dataStore.eventHooks,Je=We.growingApp,Ye=We.growingPage,Ze=We.growingComponent,Xe=We.growingBehavior;(0,We.initOriginalValue)();var et=D(function(){return null!=Je?Je:App}),nt=D(function(){return null!=Ye?Ye:Page}),it=D(function(){return null!=Ze?Ze:Component}),rt=D(function(){return null!=Xe?Xe:Behavior});export{et as GioApp,rt as GioBehavior,it as GioComponent,nt as GioPage,$e as default};