gio-miniprogram-sdk 4.4.1 → 4.4.2
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/alipay.js +1 -1
- package/dist/baidu.js +1 -1
- package/dist/bytedance.js +1 -1
- package/dist/jingdong.js +1 -1
- package/dist/kuaishou.js +1 -1
- package/dist/plugins/gioABTest.js +1 -1
- package/dist/plugins/gioCompress.js +1 -1
- package/dist/plugins/gioEventAutoTracking.js +1 -1
- package/dist/plugins/gioImpressionTracking.js +1 -1
- package/dist/plugins/gioMultipleInstances.js +1 -1
- package/dist/plugins/gioPerformance.js +1 -1
- package/dist/qq.js +1 -1
- package/dist/quickapp.js +1 -1
- package/dist/taobao.js +1 -1
- package/dist/taro.js +1 -1
- package/dist/uniapp.js +1 -1
- package/dist/wechat.js +1 -1
- package/dist/xiaohongshu.js +1 -1
- package/package.json +1 -1
- package/src/core/dataStore/eventHooks/appEffects.ts +8 -8
- package/src/core/dataStore/eventHooks/minipPage.ts +7 -20
- package/src/plugins/gioEventAutoTracking.ts +26 -4
- package/src/types/eventHooks.ts +0 -1
- package/src/utils/tools.ts +54 -15
- package/src/utils/verifiers.ts +1 -1
package/dist/taobao.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)};function t(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)}var n=function(){return n=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},n.apply(this,arguments)};function i(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 r,o=/^[a-zA-Z_][0-9a-zA-Z_]{0,100}$/,a=function(e){return["undefined","null"].includes(q(e))},u=function(e){return"string"===q(e)},s=function(e){return"number"===q(e)},c=function(e){return"boolean"===q(e)},l=function(e){return"[object Object]"==={}.toString.call(e)&&!a(e)},g=function(e){return["function","asyncfunction"].includes(q(e))},d=function(e){return Array.isArray(e)&&"array"===q(e)},p=function(e){return"date"===q(e)},f=function(e){try{return Array.from(e)[0]}catch(e){return}},v=function(e){try{var t=Array.from(e);return t[t.length-1]}catch(e){return}},h=function(e,t){return void 0===t&&(t=1),d(e)&&s(t)?e.slice(t>0?t:1,e.length):e},m=function(e,t){if(void 0===t&&(t=!1),d(e)){for(var n=0,i=[],r=0,o=e;r<o.length;r++){var a=o[r];a&&!x(a)&&(i[n++]=a),t&&0===a&&(i[n++]=a)}return i}return e},I=function(e,t){if(d(e)){var n=e.findIndex(t);return 0>n?void 0:e[n]}},y=function(e){return a(e)?"":"".concat(e)},S=function(e,t){return"string"===q(e)?e.split(t):e},w=function(e){if(u(e)){var t=S(e,"");return"".concat(f(t).toLowerCase()).concat(h(t).join(""))}return e},O=function(e,t){return u(e)||(e=y(e)),e.slice(0,t.length)===t},_={}.hasOwnProperty,P=function(e,t){return!a(e)&&_.call(e,t)},k=function(e){return l(e)?Object.keys(e):[]},b=function(e,t){k(e).forEach((function(n){return t(e[n],n)}))},T=function(e,t){var n=k(e);return!(!l(e)||!l(t)||n.length!==k(t).length||n.map((function(n,i){return l(e[n])?T(e[n],t[n]):e[n]===t[n]})).includes(!1))},E=function(e,t,n){var i=e;return l(e)?(t.split(".").forEach((function(e){i=i?i[e]:n})),i):n},C=function(e,t){if(!l(e))return!1;try{if("string"===q(t))return delete e[t];if("array"===q(t))return t.map((function(t){return delete e[t]}));"object"===q(t)&&t.constructor===RegExp&&k(e).forEach((function(n){t.test(n)&&C(e,n)}))}catch(e){return!1}},A=function(e,t,n,i){var r;void 0===t&&(t=250);var o=0;return"boolean"!==q(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))}},x=function(e){return d(e)?0===e.length:l(e)?0===k(e).length:!e},q=function(e){return{}.toString.call(e).slice(8,-1).toLowerCase()},N=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())},U=Object.freeze({__proto__:null,isNil:a,isString:u,isNaN:function(e){return"NaN"===y(Number(e))},isNumber:s,isBoolean:c,isObject:l,isRegExp:function(e){return"[object RegExp]"==={}.toString.call(e)},isFunction:g,isArray:d,isDate:p,fixed:function(e,t){return s(e)?Number(e.toFixed(s(t)?t:2)):u(e)&&"NaN"!==y(Number(e))?Number(Number(e).toFixed(s(t)?t:2)):e},head:f,last:v,drop:h,dropWhile:function(e,t){return d(e)?e.filter((function(e){return!t(e)})):e},compact:m,find:I,isEqualArray:function(e,t){return!(!d(e)||!d(t)||e.length!==t.length)&&e.every((function(e,n){return e===t[n]}))},toString:y,split:S,lowerFirst:w,upperFirst:function(e){if(u(e)){var t=S(e,"");return"".concat(f(t).toUpperCase()).concat(h(t).join(""))}return e},startsWith:O,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:_,has:P,keys:k,forEach:b,isEqual:T,get:E,unset:C,throttle:A,isEmpty:x,typeOf:q,formatDate:N}),D=function(e,t){console.log("%c[GrowingIO]:".concat(e),{info:"color: #3B82F6;",error:"color: #EF4444",warn:"color: #F59E0B",success:"color: #10B981"}[t]||"")},R=function(e,t,n){return void 0===t&&(t=!0),void 0===n&&(n="参数不合法"),D("".concat(t?"调用":"设置"," ").concat(e," 失败,").concat(n,"!"),"warn")},K=function(e){try{return e()}catch(e){return}},L=function(e,t){if(g(e))try{e(t)}catch(e){D("回调执行失败!".concat(e),"error")}},F=function(e){return u(e)?e.trim().substring(0,100):e},H=function(e,t){return u(e)&&!x(e)&&e.match(o)?t():(D("事件名格式不正确,只能包含数字、字母和下划线,且不能以数字开头,字符总长度不能超过100!","error"),!1)},B=function(e){return a(e)||k(e).forEach((function(t){g(e[t])?e[t]=K((function(){return e[t]()})):l(e[t])?C(e,t):d(e[t])||(e[t]=y(e[t]))})),e},j=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)}))},V=function(e){return e.pixelRatio?Math.round(e.screenHeight*e.pixelRatio):e.screenHeight},M=function(e){return e.pixelRatio?Math.round(e.screenWidth*e.pixelRatio):e.screenWidth},G=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)}},Q=function(e){if(u(e)){var t=e.indexOf("?");return-1!==t?[e.substring(0,t),e.substring(t+1)]:[e,""]}return["",""]},$=function(e){return u(e)?e.startsWith("/")?e:"/".concat(e):""},z=function(e){return K((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=K((function(){return xhs}))),t||(t=K((function(){return swan}))),t||(t=K((function(){return my}))),t||(t=K((function(){return tt}))),t||(t=K((function(){return qq}))),t||(t=K((function(){return ks}))),t||(t=K((function(){return jd}))),t||(t=K((function(){return wx}))),t}}))},J=function(e){return K((function(){switch(e){case"wx":return __wxConfig;case"swan":return appConfig;case"tt":return K((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}}))},W=function(e){return K((function(){switch(e){case"wx":case"qq":return __wxAppCode__;case"tt":return __allConfig__;case"ks":return __module__;case"jd":return __jdAppCode__;default:return}}))},Y=function(){var e;return!e&&K((function(){return xhs}))&&(e="xhs"),!e&&K((function(){return swan}))&&(e="swan"),!e&&K((function(){return tt}))&&(e="tt"),!e&&K((function(){return qq}))&&(e="qq"),!e&&K((function(){return my.tb}))&&(e="tb"),!e&&K((function(){return my}))&&(e="my"),!e&&K((function(){return ks}))&&(e="ks"),!e&&K((function(){return jd}))&&(e="jd"),!e&&K((function(){return wx}))&&(e="wx"),e||I(k(global),(function(e){return y(e).toLowerCase().includes("quickapp")}))&&(e="quickapp"),e},Z=function(){var e;return null!==(e=K((function(){var e;return null!==(e=K((function(){var e;return null!==(e=K((function(){return $global})))&&void 0!==e?e:global})))&&void 0!==e?e:window})))&&void 0!==e?e:globalThis},X=function(e){var t={};return l(e)&&(C(e,"&&sendTo"),b(e,(function(e,n){var i=y(n).slice(0,100);l(e)?t[i]=X(e):d(e)?(t[i]=m(e.slice(0,100),!0),t[i]=t[i].join("||").slice(0,1e3)):p(e)?t[i]=N(e):t[i]=a(e)?"":y(e).slice(0,1e3)}))),t},ee=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()}},te=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()}},ne=function(e){return k(e||{}).map((function(t){return t?"".concat(t,"=").concat(a(e[t])?"":e[t]):""})).join("&")},ie=function(e){(O(e,"?")||O(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},re=function(e){var t;return u(e)?null!==(t=K((function(){return JSON.parse(e)})))&&void 0!==t?t:{}:null!=e?e:{}},oe=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n={},i=re(t);return k(i).forEach((function(e){"gdpCircleRoomCollectUrl"!==e&&["string","number","boolean"].includes(q(i[e]))&&(n[e]=i[e])})),C(e,"gdpCircleRoomCollectUrl"),Object.assign({},n,e)},ae=Object.freeze({__proto__:null,consoleText:D,callError:R,niceTry:K,niceCallback:L,limitString:F,eventNameValidate:H,getDynamicAttributes:B,guid:j,getScreenHeight:V,getScreenWidth:M,getOS:G,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(f(S(e.version,".")));return Number.isNaN(t)?0:t}return 0},splitPath:Q,normalPath:$,isTaro3:function(e){var t=e.Current,n=e.createComponent;return!(!e||!t||n)},getPlainMinip:z,getPlainConfig:J,getPlainAppCode:W,getPlainPlatform:Y,getSubKeys:function(e){return k(e).filter((function(e){return e.indexOf("__sub")>-1&&e.indexOf("gio__")>-1})).sort()},getAppInst:function(){var e=K((function(){return getApp({allowDefault:!0})}));return e||(e=Z()),e},getGlobal:Z,limitObject:X,batchGetStorageSync:ee,batchSetStorageSync:te,qsStringify:ne,qsParse:ie,hashCode:function(e,t){void 0===t&&(t=!1);var n=0;if(x(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:re,getLaunchQuery:oe}),ue=function(e){return(u(e)&&e.length>0||s(e)&&e>0)&&!["-","null","undefined"].includes(e)},se={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},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"}},ce=["clearGeneralProps","clearPageAttributes","clearTrackTimer","clearUserId","getABTest","getGioInfo","getOption","identify","removeTimer","sendPage","sendVisit","setGeneralProps","setLocation","setOption","setPageAttributes","setUserAttributes","setUserId","track","trackTimerEnd","trackTimerPause","trackTimerResume","trackTimerStart"],le=i(i(["init","registerPlugins"],["getPlugins","getDeviceId","updateImpression"],!0),ce,!0),ge={autotrack:"无埋点",dataCollect:"数据采集",debug:"调试模式",serverUrl:"数据上报服务地址"},de=["enableDebug","setAutotrack","setDataCollect","setTrackerHost","setTrackerScheme","setConfig","collectImp","setPlatformProfile","getLocation"],pe=["deviceBrand","deviceModel","deviceType","networkState","screenHeight","screenWidth","operatingSystem"],fe=i(i([],pe,!0),["appChannel","language","platformVersion"],!1),ve={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_"},he="MINIP_LIFECYCLE",me="ON_COMMIT_REQUEST",Ie="ON_COMPOSE_AFTER",ye="ON_COMPOSE_BEFORE",Se="ON_ERROR",we="ON_INSTALL",Oe="ON_SEND_AFTER",_e="ON_SEND_BEFORE",Pe="OPTION_CHANGE",ke="OPTION_INITIALIZED",be="SDK_INITIALIZED",Te="SESSIONID_UPDATE",Ee=function(e){var t=this;this.growingIO=e,this.main=function(e,i,r){void 0===r&&(r=!0),e||(e=t.growingIO.trackingId);var o=t.growingIO,a=o.sdkVersion,u=o.platformConfig,s=o.minipInstance,c=o.userStore,l=o.dataStore,g=o.dataStore,d=g.scene,p=g.eventHooks.currentPage,f=g.generalProps,v=l.getTrackerVds(e),h=v.version,m=v.dataSourceId,I=v.appId,y=v.idMapping,S=v.ignoreFields,w=l.locationData[e],O=s.systemInfo,_=void 0===O?{}:O,P=s.network,k=void 0===P?{}:P,b=_.brand,T=_.model,E=_.platform,A=_.language,q=p.getPagePath(),N={appChannel:"scn:".concat(d||"NA"),appVersion:h,dataSourceId:m,deviceBrand:b,deviceId:c.getUid(),deviceModel:T,deviceType:G(E,u.name),domain:I,language:A,latitude:null==w?void 0:w.latitude,longitude:null==w?void 0:w.longitude,networkState:(null==k?void 0:k.networkType)||(null==k?void 0:k.type)||(null==k?void 0:k.subtype),operatingSystem:G(E,u.name),path:q,platform:u.platform,platformVersion:u.name+(_.version?" ".concat(_.version):""),query:q?p.getPageQuery():"",screenHeight:V(_),screenWidth:M(_),sdkVersion:a,sessionId:c.getSessionId(e),title:p.getPageTitle(),timestamp:Date.now(),timezoneOffset:(new Date).getTimezoneOffset(),userId:c.getUserId(e)};return y&&(N.userKey=c.getUserKey(e)),r&&!x(f[e])&&(N.attributes=n({},f[e])),x(N.attributes)||(N.attributes=X(B(n({},N.attributes)))),x(S)||S.forEach((function(e){C(N,e)})),x(i)?n(n({},N),{trackingId:e}):n(n(n({},N),i),{trackingId:e})}},Ce=function(e){var t=this;this.growingIO=e,this.enterParams={},this.main=function(e,i){var r,o,a=Date.now(),u=t.growingIO,s=u.emitter,c=u.userStore,l=u.vdsConfig,g=u.platformConfig,d=u.uploader,p=u.dataStore,f=u.minipInstance,v=u.dataStore,h=v.trackersExecute,m=v.shareOut,I=v.lastCloseTime,y=v.saveStorageInfo,S=v.setOriginalSource;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 w=g.listeners.app;switch(s.emit(ye,{event:"App ".concat(e),params:null!==(o=i[0])&&void 0!==o?o:{}}),e){case w.appLaunch:t.enterParams=n({},i[0]);break;case w.appCreate:case w.appShow:var O=t.enterParamsParse(i[0]),_=O.path,P=O.query,k=O.referralPage;!m&&l.originalSource&&_&&h((function(e){S(e,{path:_,query:P,referralPage:k})})),I?(Date.now()-I>60*l.keepAlive*1e3||p.lastScene&&p.scene!==p.lastScene)&&h((function(e){c.setSessionId(e)})):h((function(e){p.lastVisitEvent[e]={path:_,query:P,referralPage:k},t.buildVisitEvent(e,{path:_,query:P,referralPage:k})})),f.setNetworkStatusListener();break;case w.appClose:p.lastScene=p.scene,p.lastCloseTime=Date.now(),y(),c.saveUserInfo(),h((function(e){t.buildCloseEvent(e),l.forceLogin||d.initiateRequest(e,!0)}))}},this.enterParamsParse=function(e){var n;void 0===e&&(e={});var i=t.growingIO,r=i.gioPlatform,o=i.minipInstance,a=i.dataStore,u="",s="",c="";if("quickapp"!==r&&o.minip.canIUse("getEnterOptionsSync")){var l=o.minip.getEnterOptionsSync()||{},g=l.path,d=l.query,p=l.scene,f=l.referrerInfo;u=g||e.path,s=d||e.query,c=(null==f?void 0:f.appId)||(null===(n=null==e?void 0:e.referrerInfo)||void 0===n?void 0:n.appId)||"",a.scene=p||e.scene,C(d,"gdpCircleRoomCollectUrl"),s=x(null==f?void 0:f.extraData)?ne(s):ne(oe(s,f.extraData))}else g=e.path,d=e.query,f=e.referrerInfo,u=g,s=ne(d),c=(null==f?void 0:f.appId)||"",t.parseScene(e);return{path:u,query:s,referralPage:c}},this.parseScene=function(e){var n,i,r=t.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 x(e)||((null===(n=null==e?void 0:e.query)||void 0===n?void 0:n.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=t.growingIO,o=r.dataStore,a=o.getOriginalSource,u=o.eventContextBuilder,s=o.eventInterceptor,c=r.vdsConfig,l=a(e),g=(null==i?void 0:i.query)||"",d=n({eventType:"VISIT"},u(e,{}));!x(i)&&i.path&&(d.path=i.path||"",d.query="string"===q(g)?g:ne(g),i.referralPage&&(d.referralPage=i.referralPage)),c.originalSource&&!x(l)&&(d=n(n({},d),l)),s(d)},this.buildCloseEvent=function(e){var i=t.growingIO.dataStore,r=i.eventContextBuilder;(0,i.eventInterceptor)(n({eventType:"APP_CLOSED"},r(e)))}},Ae=function(){function e(e){var t=this;this.growingIO=e,this.lifeBeforeShow=!0,this.getPagePath=function(){var e,n,i,r=t.growingIO,o=r.minipInstance,a=r.inPlugin,u=r.dataStore,s=r.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===(n=u.lastPageEvent[s])||void 0===n?void 0:n.path)||(null===(i=u.lastVisitEvent[s])||void 0===i?void 0:i.path)},this.getPageQuery=function(){var e,n,i,r,o,a,u=t.growingIO,s=u.minipInstance,c=u.dataStore,l=u.trackingId,g=s.getCurrentPage(),d=s.getCurrentPath(),p=c.eventHooks.appEffects.enterParams,f=void 0===p?{}:p;if(!d)return f.path?t.qsQuery(oe(null==f?void 0:f.query,null===(i=null==f?void 0:f.referrerInfo)||void 0===i?void 0:i.extraData)):(null===(r=c.lastPageEvent[l])||void 0===r?void 0:r.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 x(v)?x(t.queryOptions[d])?d===f.path?t.qsQuery(oe(null==f?void 0:f.query,null===(n=null==f?void 0:f.referrerInfo)||void 0===n?void 0:n.extraData)):void 0:t.qsQuery(t.queryOptions[d]):(C(v,["$taroTimestamp","gdpCircleRoomCollectUrl"]),t.qsQuery(v))},this.getPageTitle=function(e){var n=t.growingIO,i=n.minipInstance,r=n.inPlugin,o=n.dataStore,a=i.getCurrentPath(),u=t.configuredTitle[a]||i.getPageTitle(i.getCurrentPage());if(r){var s=o.getTrackerVds(e||t.growingIO.trackingId);return u||"/插件".concat(s.appId).concat(a?"_"+v(a.split("/")):"")}return u},this.qsQuery=function(e){void 0===e&&(e={});var t=n({},e);return C(t,"wxShoppingListScene"),ne(t)},this.getReferralPage=function(e){var n,i,r,o=t.growingIO,a=o.minipInstance,u=o.dataStore,s=u.lastPageEvent,c=u.scene,l=u.eventHooks;return(null===(n=s[e])||void 0===n?void 0:n.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,n){void 0===n&&(n=!0);var i=t.buildShareQuery(e),r=i[0],o=i[1];return(n||P(e,"path"))&&(e.path=$(r+(o?"?".concat(o):""))),(n||P(e,"query"))&&(e.query=o),e},this.eventSetPageProps=function(e,i){var r=K((function(){return t.pageProps[e][t.getPagePath()]}));return x(r)?i.attributes:X(B(n(n({},i.attributes),r)))},this.queryOptions={},this.configuredTitle={},this.pageProps={}}return e.prototype.buildShareQuery=function(e){var t,i,r=Q(null!==(t=e.path)&&void 0!==t?t:""),o=e.path||this.getPagePath(),a={},u=P(e,"path");if(P(e,"query"))a=ie(null!==(i=e.query)&&void 0!==i?i:"")||{};else if(u)a=ie(v(r))||{};else{var s=this.growingIO.minipInstance.getCurrentPage();a=n({},s.options||this.queryOptions[s.route]||{}),m(k(a)).forEach((function(e){e.toLowerCase().startsWith("utm_")&&C(a,e)}))}return[o,ne(a)]},e}(),xe=function(e){var t=this;this.growingIO=e,this.main=function(e,i,r){var o,a,u=Date.now(),s=t.growingIO,c=s.emitter,l=s.minipInstance,d=s.plugins,p=s.vdsConfig,f=s.platformConfig,v=s.dataStore,h=v.getTrackerVds,m=v.getOriginalSource,I=v.setOriginalSource,y=v.trackersExecute,S=v.eventHooks,w=v.toggleShareOut,O=v.buildAppMessageEvent,_=v.buildTimelineEvent,P=v.buildAddFavorites,k=S.currentPage;if(!t.prevEvent[i]||Date.now()-Number(t.prevEvent[i])>=50){e||(e=l.getCurrentPage()),e.route||(e.route=l.getCurrentPath(e));var b=e.route||e.uri||e.__route__||(null===(o=null==e?void 0:e.$page)||void 0===o?void 0:o.fullPath)||"";c.emit(he,{event:"Page ".concat(i),timestamp:u,params:{page:e,args:r[0]}}),p.debug&&console.log("Page:",b,"#",i,u),t.prevEvent[i]=Date.now();var T=f.listeners.page;switch(c.emit(ye,{page:e,event:"Page ".concat(i),params:{page:e,args:r[0]}}),k.lastLifecycle=k.currentLifecycle,k.currentLifecycle=i,i){case T.pageLoad:k.queryOptions[b]=E(e,"options")||E(e,"__displayReporter.query")||E(e,"$page.query")||E(e,"$wx.__displayReporter.query")||E(e,"$taroParams")||r[0]||{},C(k.queryOptions[b],["$taroTimestamp","gdpCircleRoomCollectUrl"]);break;case T.pageShow:y((function(e){var i=m(e);x(i)||i.path!==b||I(e,n(n({},i),{title:k.getPageTitle()})),h(e).trackPage&&t.buildPageEvent(e)})),w(!1);break;case T.pageHide:case T.pageUnload:break;case T.shareChat:case T.shareApp:w(!0),y((function(e){h(e).followShare&&O(e,r)}));break;case T.shareTime:"xhsp"===l.platform&&w(!0),y((function(e){h(e).followShare&&_(e,r)}));break;case T.addFavorites:y((function(e){h(e).followShare&&P(e,r)}));break;case T.tabTap:var A=null===(a=null==d?void 0:d.gioEventAutoTracking)||void 0===a?void 0:a.buildTabClickEvent;p.autotrack&&A&&g(A)&&A(t.growingIO.trackingId,r[0])}k.lastLifecycle=k.currentLifecycle,k.currentLifecycle="".concat(i,"End"),["onHideEnd","onUnloadEnd"].includes(k.currentLifecycle)&&(k.lifeBeforeShow=!0),"onShowEnd"===k.currentLifecycle&&(k.lifeBeforeShow=!1)}},this.buildPageEvent=function(e,i){var r=t.growingIO.dataStore,o=r.eventContextBuilder,a=r.eventInterceptor,u=r.eventHooks.currentPage,s=n({eventType:"PAGE",referralPage:u.getReferralPage(e)},o(e));s.attributes=u.eventSetPageProps(e,s),!x(i)&&i.title&&(s.title=i.title),a(s)},this.prevEvent={}},qe=function(e){var t,i=this;this.growingIO=e,this.isNormalFc=function(e,t){return g(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){d(i["".concat(t,"Handlers")])&&i["".concat(t,"Handlers")].forEach((function(t){g(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="array"===q(t)?[].slice.call(t):[];return x(o)||a.push(o),i["def".concat(n,"Cbs")][r].apply(e,a),i.growingIO.emitter.emit(he,{event:"".concat(n," ").concat(r,"End"),timestamp:Date.now(),params:{instance:e,arguments:Array.from(a)}}),o},this.lifeFcEffects=function(e,t,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.shareEventTypes.includes(e)){var g=null!==(i=t.apply(this,c))&&void 0!==i?i:{};if(!o.growingIO.vdsConfig.followShare)return g;var d="promise"===q(g),p="promise"===q(g.promise),f=P(g,"_result")&&P(g,"_state");if(d||p||f){var v=function(t){void 0===t&&(t={});try{var i=n(n({},g),t),a=o.currentPage.updateShareResult(i);o.lifeFcEffectsFn(s,c,r,e,a)}catch(e){D(e,"error")}};d&&Promise.race([g,new Promise((function(e){setTimeout((function(){e({})}),3e3)}))]).then(v).catch((function(e){return D(e,"error")})),p&&Promise.race([g.promise,new Promise((function(e){setTimeout((function(){e({})}),3e3)}))]).then(v).catch((function(e){return D(e,"error")})),f&&(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,r,e,u)}else o.lifeFcEffectsFn(this,c,r,e),u=t.apply(this,c);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.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)&&(g(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){D(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];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];e.pageEffects.main(this,t,n)}}))},this.growingApp=function(e){return g(i.originalApp)?i.originalApp(i.appOverriding(e)):i.appOverriding(e)},this.growingPage=function(e){return g(i.originalPage)?i.originalPage(i.pageOverriding(e)):i.pageOverriding(e)},this.growingComponent=function(e){return g(i.originalComponent)?i.originalComponent(i.componentOverriding(e)):i.componentOverriding(e)},this.growingBehavior=function(e){return g(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&&(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&&(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&&(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&&(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(),i.originalApp=K((function(){return App||global.App})),i.originalPage=K((function(){return Page||global.Page})),i.originalComponent=K((function(){return Component||global.Component})),i.originalBehavior=K((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(),Z().GioApp=K((function(){return null!==App&&void 0!==App?App:i.originalApp})),Z().GioPage=K((function(){return null!==Page&&void 0!==Page?Page:i.originalPage})),Z().GioComponent=K((function(){return null!==Component&&void 0!==Component?Component:i.originalComponent})),Z().GioBehavior=K((function(){return null!==Behavior&&void 0!==Behavior?Behavior:i.originalBehavior}))):"quickapp"===r&&(Z().GioApp=function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];return e.appOverriding(t[0])},Z().GioPage=function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];return e.pageOverriding(t[0])},Z().GioComponent=function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];return e.pageOverriding(t[0])})};var r=null===(t=this.growingIO)||void 0===t?void 0:t.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 xe(this.growingIO),this.currentPage=new Ae(this.growingIO)},Ne=function(){function e(e){var t,r,o=this;this.growingIO=e,this.ALLOW_SETTING_KEYS=k(se),this.getStorageKey=function(e,t){var n=o.growingIO.inPlugin;return"".concat(e===o.growingIO.trackingId?"":e).concat(ve[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")),i=Number(n);(Number.isNaN(i)||i>=1e9||1>i)&&(i=1),o._gsid[e]=i,o._stid[e]=i,i!==n&&t.setStorageSync(o.getStorageKey(e,"gsid"),i)},this.saveStorageInfo=function(){var e=o.growingIO.minipInstance;o._stid=n({},o._gsid),te(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=K((function(){return JSON.parse(n.getStorageSync(o.getStorageKey(e,"originalSource")))})))&&void 0!==t?t:{}},this.getTrackerVds=function(e){return o.growingIO.trackingId===e?n({},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,i=o.growingIO,r=i.platformConfig,a=i.inPlugin,u=i.minipInstance,s=i.plugins,c=e.uniVue,l=e.taro;c||l||"quickapp"===u.platform||(r.canHook=!0),!a||["tbp","jdp"].includes(u.platform)?o.eventHooks.initEventHooks():o.eventHooks.initOriginalValue(),c&&(null===(t=null==s?void 0:s.gioUniAppAdapter)||void 0===t||t.main()),l&&(null===(n=null==s?void 0:s.gioTaroAdapter)||void 0===n||n.main())},this.initOptions=function(e){var t,i,r,a,u,s,c=e.projectId,l=e.dataSourceId,g=e.appId,p=e.trackingId,f={};return o.ALLOW_SETTING_KEYS.forEach((function(t){var n=se[t].type;(d(n)?n.includes(q(e[t])):q(e[t])===se[t].type)?"ignoreFields"===t?f.ignoreFields=e.ignoreFields.filter((function(e){return pe.includes(e)})):"extraParams"===t?f.extraParams=e.extraParams.filter((function(e){return fe.includes(e)})):(f[t]=e[t],["dataCollect","autotrack"].includes(t)&&!f[t]&&D("已关闭".concat(ge[t]),"info")):f[t]=se[t].default})),f.uploadInterval=Math.round(f.uploadInterval),(Number.isNaN(f.uploadInterval)||0>f.uploadInterval||f.uploadInterval>3e3)&&(f.uploadInterval=1e3),f.enableIdMapping&&!f.idMapping&&(f.idMapping=!0,f.idMapping||o.growingIO.userStore.setUserKey(p,"")),C(f,"enableIdMapping"),f.pluginMode&&(o.growingIO.inPlugin=!0),!isNaN(Number(f.requestTimeout))&&f.requestTimeout>0||(f.requestTimeout=5e3),(0>f.impressionScale||f.impressionScale>1)&&(f.impressionScale=0),(0>f.keepAlive||f.keepAlive>1440)&&(f.keepAlive=5),(1>f.sessionExpires||f.sessionExpires>1440)&&(f.sessionExpires=-1),n(n({},f),{projectId:c,dataSourceId:l,appId:g,trackingId:p,performance:{monitor:null===(i=null===(t=f.performance)||void 0===t?void 0:t.monitor)||void 0===i||i,exception:null===(a=null===(r=f.performance)||void 0===r?void 0:r.exception)||void 0===a||a,network:null!==(s=null===(u=f.performance)||void 0===u?void 0:u.network)&&void 0!==s&&s}})},this.setOption=function(e,t,i){var r,a,s=o.growingIO,c=s.userStore,l=s.emitter,g=o.getTrackerVds(e),d=u(t)&&o.ALLOW_SETTING_KEYS.includes(t),p=d&&typeof i===(null===(a=se[t])||void 0===a?void 0:a.type);if(d&&p){var f=n({},g);return o.updateVdsConfig(e,n(n({},g),((r={})[t]=i,r))),"dataCollect"===t&&f.dataCollect!==i&&i&&c.setSessionId(e),l.emit(Pe,{optionName:t,optionValue:i}),!0}return R("setOption > ".concat(t)),!1},this.getOption=function(e,t){var n=o.getTrackerVds(e);return t&&P(o.growingIO.vdsConfig,t)?P(n,t)?n[t]:o.growingIO.vdsConfig[t]:x(t)?n:void R("getOption > ".concat(t))},this.updateVdsConfig=function(e,t){e===o.growingIO.trackingId?(o.growingIO.vdsConfig=n(n({},o.growingIO.vdsConfig),t),Z().vdsConfig=o.growingIO.vdsConfig):(o.growingIO.subInstance[e]=n(n({},o.growingIO.subInstance[e]),t),Z().vdsConfig.subInstance[e]=o.growingIO.subInstance[e])},this.toggleShareOut=function(e){c(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 t=o.growingIO,i=t.dataStore,r=t.uploader;if(o.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={};b(e,(function(e,t){var n;if("element"===t){var i=null!==(n=f(e))&&void 0!==n?n:{};b(i,(function(e,t){x(e)&&0!==e||(a[t]=e)}))}else x(e)&&0!==e||(a[t]=e)})),o.growingIO.emitter.emit(Ie,{composedEvent:a}),r.commitRequest(n(n({},a),{requestId:j()}))}},this.eventRefactor=function(e){var t,i,r=n(n({},e),o.eventContextBuilder(e.trackingId,{path:e.path,query:e.query,timestamp:e.timestamp}));return r.attributes=n(n({},null!==(t=r.attributes)&&void 0!==t?t:{}),null!==(i=e.attributes)&&void 0!==i?i:{}),r},this.eventInterceptor=function(e){var t=o.growingIO.minipInstance,n=t.systemInfo,r=t.network;x(n)||x(r)?o.interceptEvents.push(e):x(o.interceptEvents)?o.eventConverter(e):(i(i([],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,n=e.network;t&&n&&!x(o.interceptEvents)&&(i([],o.interceptEvents,!0).forEach((function(e){o.eventConverter(o.eventRefactor(e))})),o.interceptEvents=[])},this.buildAppMessageEvent=function(e,t){var i,r,a,u=t[0];2>t.length?1===t.length&&(a=u):a=t[1];var s=o.growingIO.dataStore,c=s.eventContextBuilder,l=s.eventInterceptor,g=((null==a?void 0:a.path)||"").split("?"),d=n({eventType:"CUSTOM",eventName:"$mp_on_share"},c(e));d.attributes=X(n(n(n({},null!==(i=d.attributes)&&void 0!==i?i:{}),{$from:null==u?void 0:u.from,$target:null===(r=null==u?void 0:u.target)||void 0===r?void 0:r.id,$share_title:null==a?void 0:a.title,$share_path:f(g),$share_query:g[1]}),null==a?void 0:a.attributes)),l(d)},this.buildTimelineEvent=function(e,t){var i,r,a,u=t[0];2>t.length?1===t.length&&(a=u):a=t[1];var s=o.growingIO.dataStore,c=s.eventContextBuilder,l=s.eventInterceptor,g=((null==a?void 0:a.path)||"").split("?"),d=n({eventType:"CUSTOM",eventName:"$mp_share_timeline"},c(e));d.attributes=X(n(n(n({},null!==(i=d.attributes)&&void 0!==i?i:{}),{$target:null===(r=null==u?void 0:u.target)||void 0===r?void 0:r.id,$share_title:null==a?void 0:a.title,$share_path:f(g),$share_query:g[1]}),null==a?void 0:a.attributes)),l(d)},this.buildAddFavorites=function(e,t){var i,r,a=t[0];2>t.length?1===t.length&&(r=a):r=t[1];var u=o.growingIO.dataStore,s=u.eventContextBuilder,c=u.eventInterceptor,l=((null==r?void 0:r.path)||"").split("?"),g=n({eventType:"CUSTOM",eventName:"$mp_add_favorites"},s(e));g.attributes=X(n(n({},null!==(i=g.attributes)&&void 0!==i?i:{}),{$share_title:null==r?void 0:r.title,$share_path:f(l),$share_query:l[1]})),c(g)},this.trackersExecute=function(e){o.initializedTrackingIds.forEach((function(t){"function"===q(e)&&e(t)}))},this.initializedTrackingIds=[],this.eventContextBuilder=new Ee(this.growingIO).main,this.eventHooks=new qe(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,l=a.minipInstance;s.on(be,(function(e){var t=e.trackingId;o.initializedTrackingIds.push(t),o.initStorageInfo(t)})),s.on(me,(function(e){var t=e.eventData,n=e.trackingId;"VISIT"===t.eventType&&(o.lastVisitEvent[n]=t),"PAGE"===t.eventType&&(o.lastPageEvent[n]=t)})),g(null===(t=l.minip)||void 0===t?void 0:t.onAppHide)&&l.minip.onAppHide((function(){o.trackersExecute((function(e){var t=o.trackTimers[e];b(t,(function(e){e.start&&(e.leng=e.leng+(+Date.now()-e.start))}))}))})),g(null===(r=l.minip)||void 0===r?void 0:r.onAppShow)&&l.minip.onAppShow((function(){o.trackersExecute((function(e){var t=o.trackTimers[e];b(t,(function(e){e.start&&(e.start=+Date.now())}))}))})),s.on(Pe,(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(Te,(function(e){var t=e.oldSessionId,n=e.trackingId;if(t){var i=o.eventHooks.currentPage,r=i.getPagePath,a=i.getPageQuery,u=r(),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}(),Ue={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"]}}},De=n(n({},Ue),{pageHandlers:i(i([],Ue.pageHandlers,!0),["onInit","didMount","didUnmount"],!1),listeners:n(n({},Ue.listeners),{page:n(n({},Ue.listeners.page),{onInit:"onInit",didMount:"didMount",didUnmount:"didUnmount"})}),name:"Taobao",platform:"tbp",scnPrefix:"tbp_",hooks:n(n({},Ue.hooks),{Behavior:!1})}),Re=function(e){function n(t){var n=e.call(this,t)||this;return n.growingIO=t,n.hookSetTitle=function(){var e,t=null===(e=n.minip)||void 0===e?void 0:e.setNavigationBar,i=n;t&&Object.defineProperty(n.minip,"setNavigationBar",{writable:!0,enumerable:!0,configurable:!0,value:function(){if(i.growingIO.gioSDKInitialized){var e=i.getCurrentPath(),n=(arguments[0]||{}).title;i.growingIO.dataStore.eventHooks.currentPage.configuredTitle[e]=n}return t.apply(this,arguments)}})},n.initImpression=function(e){var t,i;null===(i=null===(t=n.growingIO.plugins)||void 0===t?void 0:t.gioImpressionTracking)||void 0===i||i.main(e,"selectAll")},n.getStorageSync=function(e){return my.getStorageSync({key:e}).data},n.setStorageSync=function(e,t){var i;null===(i=n.minip)||void 0===i||i.setStorageSync({key:e,data:t})},n.removeStorageSync=function(e){var t;null===(t=n.minip)||void 0===t||t.removeStorageSync({key:e})},n.hookSetTitle(),n}return t(n,e),n}((function(e){var t=this;this.growingIO=e,this.minip=z("tb"),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(){if(i.growingIO.gioSDKInitialized){var e=i.getCurrentPath(),t=(arguments[0]||{}).title;i.growingIO.dataStore.eventHooks.currentPage.configuredTitle[e]=t}return n.apply(this,arguments)}})},this.navigateTo=function(e){var n;return null===(n=t.minip)||void 0===n?void 0:n.navigateTo(e)},this.switchTab=function(e){var n;null===(n=t.minip)||void 0===n||n.switchTab(e)},this.navigateToMiniProgram=function(e){var n;return null===(n=t.minip)||void 0===n?void 0:n.navigateToMiniProgram(e)},this.getImageInfo=function(e){var n,i=e.src,r=e.success,o=e.fail,a=e.complete;return null===(n=t.minip)||void 0===n?void 0:n.getImageInfo({src:i,success:r,fail:o,complete:a})},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 K((function(){return v(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,i,r,o,a,s,c,l,g=Y(),p="",f=J(g);"string"===q(f)&&(f=null!==(n=K((function(){return JSON.parse(f)})))&&void 0!==n?n:{});var v,h=(null==e?void 0:e.data)||e.$data||{};if((p=u(null==h?void 0:h.gioPageTitle)?null==h?void 0:h.gioPageTitle:"")||K((function(){var t,n,i=W(g);i&&(v=i["".concat(e.route,".json")]||{},p=(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))})),!p&&f){var m=t.growingIO.dataStore.eventHooks.appEffects.enterParams;if(e.route||x(m)||(e.route=m.path||"",p=e.route?t._getTitleFromTabBar(f,e.route):""),!p&&(v=d(f.pages)?null!==(i=f.pages.find((function(t){return t.path===e.route})))&&void 0!==i?i:{}:f.page||{})){var I=v[e.route]||v["".concat(e.route,".html")]||v;p=(null==I?void 0:I.navigationBarTitleText)||(null===(r=null==I?void 0:I.window)||void 0===r?void 0:r.navigationBarTitleText)}p||(p=t._getTitleFromTabBar(f,e.route))}return p||(p=["wx","tt"].includes(g)?null===(s=null===(a=null===(o=f||global||$global)||void 0===o?void 0:o.global)||void 0===a?void 0:a.window)||void 0===s?void 0:s.navigationBarTitleText:null===(l=null===(c=f||global||$global)||void 0===c?void 0:c.window)||void 0===l?void 0:l.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 l(i)&&i.expiredAt?i.expiredAt<Date.now()?"":i.value:i},this.getStorage=function(e){return new Promise((function(n){var i;null===(i=t.minip)||void 0===i||i.getStorage({key:e,success:function(e){var t=e.data;return n(t)},fail:function(){return n("")}})}))},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.removeStorage=function(e){var n;null===(n=t.minip)||void 0===n||n.removeStorage(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(){return n(null)}})}))},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,d=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}),p=setTimeout((function(){(null==d?void 0:d.abort)&&g(null==d?void 0:d.abort)&&(null==d||d.abort()),clearTimeout(p),p=null}),(a||1e4)+10);return d},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(){return n(null)}})}))},this.getSetting=function(){return new Promise((function(e){var n;null===(n=t.minip)||void 0===n||n.getSetting({success:e,fail:e})}))},this.setNetworkStatusListener=function(){var e;null===(e=t.minip)||void 0===e||e.onNetworkStatusChange((function(e){var n=e.networkType;n&&(t.network.networkType=n)}))};var n=this.growingIO.platformConfig,i=n.platform,r=n.scnPrefix;this.platform=i,this.scnPrefix=r,this.growingIO.emitter.on(ke,(function(){t.getNetworkType().then((function(){var e;return null===(e=t.growingIO.dataStore)||void 0===e?void 0:e.eventReleaseInspector()})),t.getSystemInfo().then((function(){var e;return null===(e=t.growingIO.dataStore)||void 0===e?void 0:e.eventReleaseInspector()}))}))})),Ke=["gioPerformance"],Le=function(){function e(e){var t=this;this.growingIO=e,this.getSceneInfo=function(e,n){var i;null===(i=t.growingIO.minipInstance.minip)||void 0===i||i.getRelationAppInfo({success:function(t){return n(e,t)},fail:function(){return n(e,{})}})},this.getRelationAppInfo=function(e){var n;null===(n=t.growingIO.minipInstance.minip)||void 0===n||n.getRelationAppInfo({success:e,fail:function(){return e({})}})},this.singleInvoke=function(e){var o,a=t.growingIO,u=a.vdsConfig,s=a.emitter,c=a.uploader,l=c.getHoardingQueue(e),g=c.getRequestQueue(e);if(c.requestQueue[e]=i([],g,!0).filter((function(e){var t;return(null!==(t=c.retryIds[e.requestId])&&void 0!==t?t:0)<=c.retryLimit})),g=c.getRequestQueue(e),!r.isEmpty(i(i([],l,!0),g,!0))){var d=null!==(o=l.shift())&&void 0!==o?o:g.shift(),p=n({},d);C(p,["requestId","trackingId"]),u.debug&&console.log("[GrowingIO Debug]:",JSON.stringify(p,null,2)),s.emit(_e,{requestData:p}),t.cloudFuncInvoke(d,p)}},this.cloudFuncInvoke=function(e,n){var i,o,a=t.growingIO,u=a.vdsConfig,s=a.emitter,c=a.uploader,l=u.serverUrl,g=u.projectId,d=u.tbConfig,p=r.niceTry((function(){var e;return null!==(e=getApp())&&void 0!==e?e:$global})),f=null!==(i=d.cloud)&&void 0!==i?i:p.cloud;(null===(o=null==f?void 0:f.function)||void 0===o?void 0:o.invoke)?(c.requestingNum+=1,f.function.invoke(d.cloudFuncName,{domain:l,path:"/v3/projects/".concat(g,"/collect"),params:{stm:Date.now()},body:n},d.cloudFuncHandler).then((function(t){c.requestingNum-=1,t.success?s.emit(Oe,{result:t,requestData:n}):(c.requestFailFn(e),r.consoleText("请求失败! ".concat(JSON.stringify(t)),"error")),c.initiateRequest(e.trackingId)})).catch((function(t){c.requestingNum-=1,c.requestFailFn(e),r.consoleText("请求失败! ".concat(JSON.stringify(t)),"error"),c.initiateRequest(e.trackingId)}))):r.consoleText("请求失败!无法获取 cloud 对象,请检查 tbConfig 配置项!","error")},this.pluginVersion="__PLUGIN_VERSION__";var o=this.growingIO,a=o.utils,u=o.emitter;r=a,u.on(ke,(function(e){var t=e.inPlugin,n=e.dataStore;t&&(r.getGlobal().Component=function(){for(var e=[],t=0;arguments.length>t;t++)e[t]=arguments[t];return n.eventHooks.componentOverriding(e[0])})})),u.on(he,(function(e){var n=e.event,i=t.growingIO,o=i.dataStore,a=i.vdsConfig,u="小部件".concat(a.appId);switch(n){case"Page onInit":var s=function(e,t){var n,i=r.keys(e).map((function(t){return"".concat(t,"=").concat(e[t])})).join("&");o.scene=null!==(n=t.sceneId)&&void 0!==n?n:"",o.trackersExecute((function(e){o.sendVisit(e,{path:u,query:i,title:u})}))};t.getRelationAppInfo((function(e){return t.getSceneInfo(e,s)}));break;case"Page didMount":o.trackersExecute((function(e){o.getTrackerVds(e).trackPage&&o.sendPage(e,{path:u,title:u})}))}}))}return e.prototype.tbCloudAppInvoke=function(e,t){var n,i,o=this.growingIO,a=o.vdsConfig,u=o.emitter,s=o.uploader,c=a.serverUrl,l=a.projectId,g=a.tbConfig,d=r.niceTry((function(){var e;return null!==(e=getApp())&&void 0!==e?e:$global})),p=null!==(n=g.cloud)&&void 0!==n?n:d.cloud;if(null===(i=null==p?void 0:p.application)||void 0===i?void 0:i.httpRequest){var v=f(e).trackingId;s.requestingNum+=1,p.application.httpRequest({path:g.path,method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8"},params:{serverUrl:c,projectId:l,stm:Date.now()},body:t,exts:{cloudAppId:g.cloudAppId}}).then((function(n){s.requestingNum-=1,n.success?u.emit(Oe,{result:n,requestData:t}):(e.forEach((function(e){s.requestFailFn(e)})),r.consoleText("请求失败! ".concat(JSON.stringify(n)),"error")),s.initiateRequest(v)})).catch((function(t){s.requestingNum-=1,e.forEach((function(e){s.requestFailFn(e)})),r.consoleText("请求失败! ".concat(JSON.stringify(t)),"error"),s.initiateRequest(v)}))}else r.consoleText("请求失败!无法获取 cloud 对象,请检查 tbConfig 配置项!","error")},e}(),Fe={name:"gioTaobaoAdapter",method:Le},He=function(e){function n(t){var n=e.call(this,t)||this;return n.growingIO=t,n.pluginsContext={plugins:{gioTaobaoAdapter:Fe}},n}return t(n,e),n}((function(e){var t,n,i,r,o,a,u=this;this.growingIO=e,this.innerPluginInit=function(){var e;Ke.forEach((function(e){var t;return C(null===(t=u.pluginsContext)||void 0===t?void 0:t.plugins,e)})),k(null===(e=u.pluginsContext)||void 0===e?void 0:e.plugins).forEach((function(e){var t,n,i=null!==(n=null===(t=u.pluginsContext)||void 0===t?void 0:t.plugins[e])&&void 0!==n?n:{},r=i.name,o=i.method;I(u.pluginItems,(function(e){return e.name===r}))||u.pluginItems.push({name:w(r||e),method:o||function(e){}})})),x(u.pluginItems)||u.installAll()},this.install=function(e,t,n){var i,r,o=u.growingIO.emitter,a=t||I(u.pluginItems,(function(t){return t.name===e}));if((null===(i=u.growingIO)||void 0===i?void 0:i.plugins)[e])return D("重复加载插件 ".concat(e," 或插件重名,已跳过加载!"),"warn"),!1;if(!a)return D("插件加载失败!不存在名为 ".concat(e," 的插件!"),"error"),!1;try{return(null===(r=u.growingIO)||void 0===r?void 0:r.plugins)[e]=new a.method(u.growingIO,n),t&&(o.emit(we,e),D("加载插件 ".concat(e),"info")),!0}catch(n){return u.lifeError(t,n),D("插件【".concat(e,"】加载异常 ").concat(n),"error"),!1}},this.installAll=function(e){(e||u.pluginItems).forEach((function(t){u.install(t.name,e?t:void 0,e?null==t?void 0:t.options:void 0)&&!I(u.pluginItems,(function(e){return e.name===t.name}))&&u.pluginItems.push({name:w(t.name),method:t.method?t.method:function(){}})}))},this.uninstall=function(e){var t;C(u.pluginItems,e);var n=C(null===(t=u.growingIO)||void 0===t?void 0:t.plugins,e);return n||D("卸载插件 ".concat(e," 失败!"),"error"),n},this.uninstallAll=function(){u.pluginItems.forEach((function(e){return u.uninstall(e.name)}))},this.lifeError=function(e,t){u.growingIO.emitter.emit(Se,{plugin:e,error:t}),D("插件执行错误 ".concat(e.name," ").concat(t),"error")},this.callLifeCycle=function(e,t){u.pluginItems.forEach((function(n){var i=u.growingIO.plugins[n.name]?u.growingIO.plugins[n.name][e]:void 0;if(i&&g(i))try{i(t)}catch(e){u.lifeError(n,e)}}))},this.pluginsContext={plugins:{}},this.pluginItems=[],null===(t=this.growingIO.emitter)||void 0===t||t.on(we,(function(e){return u.callLifeCycle("onInstall",e)})),null===(n=this.growingIO.emitter)||void 0===n||n.on(Se,(function(e){return u.callLifeCycle("onError",e)})),null===(i=this.growingIO.emitter)||void 0===i||i.on(ye,(function(e){return u.callLifeCycle("onComposeBefore",e)})),null===(r=this.growingIO.emitter)||void 0===r||r.on(Ie,(function(e){return u.callLifeCycle("onComposeAfter",e)})),null===(o=this.growingIO.emitter)||void 0===o||o.on(_e,(function(e){return u.callLifeCycle("onSendBefore",e)})),null===(a=this.growingIO.emitter)||void 0===a||a.on(Oe,(function(e){return u.callLifeCycle("onSendAfter",e)}))})),Be={},je={}.hasOwnProperty;function Ve(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function Me(e){try{return encodeURIComponent(e)}catch(e){return null}}Be.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=Me(i),n=Me(n),null===i||null===n)continue;r.push(i+"="+n)}return r.length?t+r.join("&"):""},Be.parse=function(e){for(var t,n=/([^=?#&]+)=?([^&]*)/g,i={};t=n.exec(e);){var r=Ve(t[1]),o=Ve(t[2]);null===r||null===o||r in i||(i[r]=o)}return i};var Ge=function(e){var t=this;this.growingIO=e,this.generateURL=function(e){var n=t.growingIO.dataStore.getTrackerVds(e),i=n.serverUrl,r=n.projectId;return O(i,"http")?"".concat(i,"/v3/projects/").concat(r,"/collect"):"https://".concat(i,"/v3/projects/").concat(r,"/collect")},this.getHoardingQueue=function(e){var n;return null!==(n=t.hoardingQueue[e])&&void 0!==n?n:[]},this.getRequestQueue=function(e){var n;return null!==(n=t.requestQueue[e])&&void 0!==n?n:[]},this.commitRequest=function(e){var i,r,o=n({},e),u=t.growingIO,s=u.vdsConfig;u.emitter.emit(me,{eventData:e,trackingId:e.trackingId}),s.forceLogin?(a(t.hoardingQueue[e.trackingId])&&(t.hoardingQueue[e.trackingId]=[]),null===(i=t.hoardingQueue[e.trackingId])||void 0===i||i.push(o)):(a(t.requestQueue[e.trackingId])&&(t.requestQueue[e.trackingId]=[]),null===(r=t.requestQueue[e.trackingId])||void 0===r||r.push(o),t.initiateRequest(e.trackingId))},this.initiateRequest=function(e,n){var r=t.growingIO,o=r.plugins,a=r.vdsConfig,u=r.minipInstance,s=r.dataStore,c=t.getHoardingQueue(e),l=t.getRequestQueue(e),g=i(i([],c,!0),l,!0),d=function(e){var i,r;if(null===(i=null==a?void 0:a.tbConfig)||void 0===i?void 0:i.cloudFuncSend)null===(r=null==o?void 0:o.gioTaobaoAdapter)||void 0===r||r.singleInvoke(e);else if(n)t.batchInvoke(e);else{var c=t.growingIO.dataStore.getTrackerVds(e).uploadInterval;A(t.batchInvoke,c,!1,!1)(e)}g.some((function(e){return"VISIT"===e.eventType}))&&u.removeStorageSync(s.getStorageKey(e,"originalSource"))};if(g.length>0)if(t.requestingNum<t.requestLimit)d(e);else var p=setInterval((function(){t.requestingNum<t.requestLimit&&(d(e),clearInterval(p),p=void 0)}),500)},this.batchInvoke=function(e){var r=t.growingIO,o=r.vdsConfig,a=r.emitter,u=t.getHoardingQueue(e),s=t.getRequestQueue(e),c=i(i([],u,!0),s,!0);c.length>50?(c=c.slice(0,50),u.length>50?t.hoardingQueue[e]=u.slice(50):(t.requestQueue[e]=s.slice(50-u.length),t.hoardingQueue[e]=[])):(t.hoardingQueue[e]=[],t.requestQueue[e]=[]);var l=c.filter((function(e){return(t.retryIds[e.requestId]||0)<=t.retryLimit}));if(!x(l)){var g=l.map((function(e){var t=n({},e);return C(t,["requestId","trackingId"]),t}));o.debug&&console.log("[GrowingIO Debug]:",JSON.stringify(g,null,2)),a.emit(_e,{eventsQueue:l,requestData:g,trackingId:e})}},this.sendEvent=function(e,n){var r,o=f(e).trackingId,a=t.growingIO,u=a.minipInstance,s=a.dataStore,c=a.emitter,l=a.plugins,g=s.getTrackerVds(o),d=g.compress,p=g.requestTimeout;t.requestingNum+=1;var v={"content-type":"jdp"===u.platform?"application/json":"application/json;charset=UTF-8"},h=i([],n,!0),m=!!d&&(null===(r=null==l?void 0:l.gioCompress)||void 0===r?void 0:r.compressToUTF16);m&&(h=l.gioCompress.compressToUTF16(JSON.stringify(n)),v["X-Compress-Codec"]="1");var I=t.generateURL(o);u.request({url:"".concat(I,"?stm=").concat(Date.now(),"&compress=").concat(m?"1":"0"),header:v,method:"POST",data:h,timeout:p,fail:function(i){[200,204].includes(i.code)||(e.forEach((function(e){t.requestFailFn(e)})),D("请求失败!".concat(JSON.stringify(i)),"error"),c.emit("ON_SEND_ERROR",{eventsQueue:e,requestData:n,trackingId:o}))},complete:function(e){t.requestingNum-=1,c.emit(Oe,{result:e,requestData:n,trackingId:o}),t.initiateRequest(o)}})},this.requestFailFn=function(e){if(t.retryIds[e.requestId]||(t.retryIds[e.requestId]=0),t.retryIds[e.requestId]+=1,!t.requestQueue[e.trackingId].some((function(t){return t.requestId===e.requestId})))var n=setTimeout((function(){x(t.requestQueue[e.trackingId])?(t.requestQueue[e.trackingId].push(e),t.initiateRequest(e.trackingId)):t.requestQueue[e.trackingId].push(e),clearTimeout(n),n=null}),800)},this.hoardingQueue={},this.requestQueue={},this.requestLimit=3,this.retryLimit=2,this.retryIds={},this.requestingNum=0,this.growingIO.emitter.on(_e,(function(e){var n,i,r=e.eventsQueue,o=e.requestData,a=e.trackingId,u=t.growingIO,s=u.vdsConfig,c=u.plugins;a===t.growingIO.trackingId&&((null===(n=null==s?void 0:s.tbConfig)||void 0===n?void 0:n.cloudAppId)?null===(i=null==c?void 0:c.gioTaobaoAdapter)||void 0===i||i.tbCloudAppInvoke(r,o):t.sendEvent(r,o))}))},Qe=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 t._uid||(t._uid=e.getStorageSync(t._getUidKey())),t._uid||t.setUid(j()),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,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=j()),t._sessionId[e]=n;var r=t.growingIO.vdsConfig.sessionExpires;r>-1&&(t._sessionExpires=Date.now()+6e4*r),i!==n&&t.growingIO.emitter.emit(Te,{trackingId:e,newSessionId:n,oldSessionId:i})},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 i=t._userId[e];t._userId[e]=a(n)?"":n,i!==t._userId[e]&&(t.growingIO.minipInstance.setStorage(t._getUserIdKey(e),t._userId[e]),t.growingIO.emitter.emit("USERID_UPDATE",{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=t.growingIO.minipInstance;return t._userKey[e]||(t._userKey[e]=n.getStorageSync(t._getUserKeyKey(e))),t._userKey[e]},this.setUserKey=function(e,n){var i=t._userKey[e];t._userKey[e]=a(n)?"":n,i!==t._userKey[e]&&(t.growingIO.minipInstance.setStorage(t._getUserKeyKey(e),t._userKey[e]),t.growingIO.emitter.emit("USERKEY_UPDATE",{newUserKey:n,oldUserKey:i}))},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 i=t._gioId[e];t._gioId[e]=a(n)?"":n,i!==t._gioId[e]&&(t.growingIO.minipInstance.setStorage(t._getGioIdKey(e),t._gioId[e]),t.growingIO.emitter.emit("GIOID_UPDATE",{newGioId:n,oldGioId:i}))},this.initUserInfo=function(e){var n,i=t.growingIO.minipInstance,r=[t._getUidKey(),t._getUserIdKey(e),t._getUserKeyKey(e),t._getGioIdKey(e)],o=null!==(n=ee(i,r))&&void 0!==n?n:[];["_uid","_userId","_userKey","_gioId"].forEach((function(n,i){"_uid"===n?t.getUid():t[n][e]=o[i]}))},this.saveUserInfo=function(){var e=t.growingIO,n=e.minipInstance;(0,e.dataStore.trackersExecute)((function(e){te(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},$e=new function(){var e,t=this;this.init=function(e){var n;t.emitter.emit("ON_SDK_INITIALIZE_BEFORE",{options:e});try{if(D("Gio小程序SDK 初始化中...","info"),e.trackingId&&t.dataStore.initializedTrackingIds.includes(e.trackingId))throw Error("已存在实例 ".concat(e.trackingId,",请勿重复初始化!"));if(t.trackingId&&!t.plugins.gioMultipleInstances)throw Error("您正在尝试初始化另一个实例,请集成多实例插件后重试!");var i=t.dataStore.initTrackerOptions(e);return null===(n=t.emitter)||void 0===n||n.emit(ke,i),t.gioSDKInitialized=!0,t.dataStore.initTrackerHooker(i),"quickapp"!==t.gioPlatform&&t.userStore.initUserInfo(e.trackingId),t.emitter.emit(be,i),t.trackingId&&t.trackingId!==e.trackingId||(Z().__gio__=function(){return t}),D("Gio小程序SDK 初始化完成!","success"),t.inPlugin&&"tbp"!==t.minipInstance.platform&&t.dataStore.sendVisit(i.trackingId),t.vdsConfig.forceLogin&&D("forceLogin已开启,请调用 identify 方法设置 openId 以继续上报!","info"),!0}catch(e){return D(e,"error"),!1}},this.handlerDistribute=function(e,n,r){var o=t.dataStore,a=o.initializedTrackingIds;if((0,o.getTrackerVds)(e)&&a.includes(e))return t[n].apply(t,i([e],r,!1));D("不存在实例:".concat(e,",请检查!"),"warn")},this.registerPlugins=function(e){t.plugins.pluginItems=i(i([],t.plugins.pluginItems,!0),e,!0),t.plugins.installAll(e)},this.getPlugins=function(){return t.plugins.pluginItems},this.getDeviceId=function(){return t.userStore.getUid()},this.getOption=function(e,n){return t.dataStore.getOption(e,n)},this.setOption=function(e,n,i){var r;return k(ge).includes(n)?typeof i===(null===(r=se[n])||void 0===r?void 0:r.type)?(t.dataStore.setOption(e,n,i),D("已修改".concat(ge[n],": ").concat(i),"info"),!0):(D("参数格式不正确:".concat(i,",请检查后重试!"),"error"),!1):(D("不存在可修改的配置项:".concat(n,",请检查后重试!"),"error"),!1)},this.setPageAttributes=function(e,n){if(l(n)&&!x(n)){var i=t.dataStore.eventHooks.currentPage,r=i.getPagePath();return x(i.pageProps[e])&&(i.pageProps[e]={}),x(i.pageProps[e][r])&&(i.pageProps[e][r]={}),x(n)||b(n,(function(t,n){g(i.pageProps[e][r][n])&&!g(t)||(i.pageProps[e][r][n]=t)})),!0}return R("setPageAttributes"),!1},this.clearPageAttributes=function(e,n){try{if(!x(t.dataStore.eventHooks.currentPage.pageProps[e])){var i=t.dataStore.eventHooks.currentPage,r=i.getPagePath();d(n)&&!x(n)?n.forEach((function(t){C(i.pageProps[e][r],t)})):i.pageProps[e][r]={}}}catch(e){return R("clearPageAttributes"),!1}},this.sendPage=function(e,n){t.dataStore.getTrackerVds(e).trackPage?D("仅在关闭trackPage时允许调用sendPage,请确认后修改初始化配置项!","error"):t.dataStore.sendPage(e,n)},this.identify=function(e,n){if(e===t.trackingId)if(t.vdsConfig.forceLogin){if(!ue(n))return void R("identify");var i=y(n).slice(0,1e3);t.userStore.setUid(i),t.dataStore.setOption(t.trackingId,"forceLogin",!1),t._identified=!0,t.dataStore.trackersExecute((function(e){var n=t.uploader.getHoardingQueue(e);n.forEach((function(e,t){return n[t].deviceId=i})),t.uploader.initiateRequest(e,!0)}))}else t._identified?R("identify",!1,"请勿重复调用"):R("identify",!1,"forceLogin未开启");else R("identify",!1,"子实例不允许调用identify")},this.setUserAttributes=function(e,i){var r,o,a,u;if(l(i)&&!x(i)){var s=t.dataStore,c=s.eventContextBuilder,g=s.eventInterceptor,d=s.lastVisitEvent,p=n({eventType:"LOGIN_USER_ATTRIBUTES"},c(e));p.attributes=X(n(n({},null!==(r=p.attributes)&&void 0!==r?r:{}),B(i))),p.path||(p.path=null===(o=d[e])||void 0===o?void 0:o.path,p.query=null===(a=d[e])||void 0===a?void 0:a.query,p.title=null===(u=d[e])||void 0===u?void 0:u.title),g(p)}else R("setUserAttributes")},this.setUserId=function(e,n,i){if(ue(n)){var r=t.userStore.getGioId(e);n=y(n).slice(0,1e3),i=y(i).slice(0,1e3),t.userStore.setUserId(e,n);var o=!a(i)&&y(i).length>0?y(i).slice(0,1e3):"";t.userStore.setUserKey(e,o),!t.dataStore.getTrackerVds(e).idMapping&&o&&D("您设置了 userKey ,请初始化开启 idMapping!","warn"),r&&r!==n&&t.userStore.setSessionId(e)}else R("setUserId")},this.clearUserId=function(e){t.userStore.setUserId(e,void 0),t.userStore.setUserKey(e,void 0)},this.setGeneralProps=function(e,n){return l(n)&&!x(n)?(x(t.dataStore.generalProps[e])&&(t.dataStore.generalProps[e]={}),b(n,(function(n,i){g(t.dataStore.generalProps[e][i])&&!g(n)||(t.dataStore.generalProps[e][i]=n)})),!0):(R("setGeneralProps"),!1)},this.clearGeneralProps=function(e,n){try{x(t.dataStore.generalProps[e])||(d(n)&&!x(n)?n.forEach((function(n){C(t.dataStore.generalProps[e],n)})):t.dataStore.generalProps[e]={})}catch(e){return R("clearGeneralProps"),!1}},this.track=function(e,i,r){H(i,(function(){var o,a=t.dataStore,u=a.eventContextBuilder,s=a.eventInterceptor,c=n({eventType:"CUSTOM",eventName:i},u(e));c.attributes=X(n(n({},null!==(o=c.attributes)&&void 0!==o?o:{}),B(n({},l(r)&&!x(r)?r:{})))),t.plugins.gioMultipleInstances&&r&&r["&&sendTo"]&&(c["&&sendTo"]=r["&&sendTo"]),s(c)}))},this.trackTimerStart=function(e,n){return t.dataStore.getTrackerVds(e).dataCollect?H(n,(function(){var i=j();return t.dataStore.trackTimers[e]||(t.dataStore.trackTimers[e]={}),t.dataStore.trackTimers[e][i]={eventName:n,leng:0,start:+Date.now()},i})):(D("指定实例未开启数据采集,请检查!","error"),!1)},this.trackTimerPause=function(e,n){var i=t.dataStore.trackTimers[e];if(n&&i&&i[n]){var r=i[n];return r.start&&(r.leng=r.leng+(+Date.now()-r.start)),r.start=0,!0}return!1},this.trackTimerResume=function(e,n){var i=t.dataStore.trackTimers[e];if(n&&i&&i[n]){var r=i[n];return 0===r.start&&(r.start=+Date.now()),!0}return!1},this.trackTimerEnd=function(e,i,r){var o,a=t.dataStore.getTrackerVds(e).dataCollect,u=t.dataStore.trackTimers[e];if(i&&u&&u[i]){if(a){var s=u[i];if(0!==s.start){var c=+Date.now()-s.start;s.leng=c>0?s.leng+c:0}var g=t.dataStore,d=g.eventContextBuilder,p=g.eventInterceptor,f=n({eventType:"CUSTOM",eventName:s.eventName},d(e));return f.attributes=X(n(n({},null!==(o=f.attributes)&&void 0!==o?o:{}),B(n(n({},l(r)&&!x(r)?r:{}),{event_duration:s.leng>864e5?0:s.leng/1e3})))),t.plugins.gioMultipleInstances&&r&&r["&&sendTo"]&&(f["&&sendTo"]=r["&&sendTo"]),p(f),!0}return D("指定实例未开启数据采集,计时器已移除,请检查!","error"),!1}return D("未查询到指定计时器,请检查!","error"),!1},this.removeTimer=function(e,n){var i=t.dataStore.trackTimers[e];return n&&i&&i[n]?(delete i[n],!0):(D("未查询到指定计时器,请检查!","error"),!1)},this.clearTrackTimer=function(e){t.dataStore.trackTimers[e]={}},this.setLocation=function(e,n,i){x(t.dataStore.locationData[e])&&(t.dataStore.locationData[e]={});var r=t.dataStore.locationData[e],o=function(e){return e>=-180&&180>=e};o(n)&&o(i)&&(r.latitude!==n||r.longitude!==i)&&(t.dataStore.locationData[e]={latitude:n,longitude:i})},this.updateImpression=function(){D("updateImpression 错误! 请集成半自动埋点浏览插件后重试!","error")},this.getABTest=function(e,t,n){D("获取ABTest数据错误! 请集成ABTest插件后重试!","error"),L(n,{})},this.getGioInfo=function(e){var n,i,r=t.userStore,o=r.getUid,a=r.getUserId,u=r.getUserKey,s=r.getSessionId,c=t.dataStore.getTrackerVds(e),l=c.projectId,g=c.appId,d=c.dataSourceId,p=c.dataCollect,f=c.idMapping,v=c.extraParams,h=c.ignoreFields,m={gioappid:g,giocs1:a(e)||"",gioplatform:t.platformConfig.platform,gioprojectid:l,gios:s(e),giou:o()};if(m.giodatacollect=p,m.giodatasourceid=d,f&&(m.giouserkey=u(e)),x(v)||v.forEach((function(n){var i;h.includes(n)||(m["gio".concat(n)]=(null!==(i=t.dataStore.lastVisitEvent[e])&&void 0!==i?i:{})[n])})),e===t.trackingId){var I=null!==(i=null===(n=t.plugins)||void 0===n?void 0:n.gioEventAutoTracking)&&void 0!==i?i:{},y=I.circleServerUrl,S=I.circleOpen;if(y&&S){var w=ie(y.split("?")[1]);w.roomId&&(m.giocircleroomid=w.roomId)}}return Be.stringify(m)},this.utils=n(n(n({},U),ae),{qs:Be}),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="tb",this.gioFramework="native",this.sdkVersion="4.4.1";try{"quickapp"===this.gioPlatform||g(getApp)&&g(App)?this.inPlugin=!1:this.inPlugin=!0}catch(e){this.inPlugin=!0}this.inPlugin&&D("未检测到小程序实例,自动切换为插件模式!","info"),this.platformConfig=De,this.minipInstance=new Re(this),this.dataStore=new Ne(this),this.userStore=new Qe(this),this.uploader=new Ge(this),this.plugins=new He(this),this.plugins.innerPluginInit()},ze=function(){var e,t=arguments[0],i="g0",r=t;if(t.indexOf(".")>-1&&(i=null!==(e=t.split(".")[0])&&void 0!==e?e:"g0",r=t.split(".")[1]),u(r)&&le.includes(r)&&$e[r]){var o=h(Array.from(arguments));if("init"===r){var a=function(e,t){var n=y(t[0]),i=y(t[1]),r=(4===t.length?t[3]:t[2])||{};return n&&i?e.dataStore.initializedTrackingIds.some((function(t,r){var o=0===r?e.vdsConfig:e.subInstance[t];return o.projectId===n&&o.dataSourceId===i}))?(D("SDK初始化失败,重复初始化,请检查初始化参数!","error"),!1):{projectId:n,dataSourceId:i,appId:y(4===t.length?t[2]:""),userOptions:r}:(D('SDK初始化失败,请使用 gdp("init", "您的GrowingIO项目 accountId", "您项目的 dataSourceId", "您的小程序 AppId(可选)", options: { host: "您的数据上报地址host" }); 进行初始化!',"error"),!1)}($e,o);if(a){var s=a.projectId,c=a.dataSourceId,l=a.appId,g=a.userOptions;return $e.init(n(n({},g),{projectId:s,dataSourceId:c,appId:l,trackingId:i}))}return!1}if("registerPlugins"===r)$e.registerPlugins(o[0]);else{if($e.gioSDKInitialized&&$e.vdsConfig)return ce.includes(r)?K((function(){return $e.handlerDistribute(i,r,o)})):K((function(){return $e[r].apply($e,o)}));D("SDK未初始化!","error")}}else if(de.includes(r))D("方法 ".concat(y(r)," 已被弃用,请移除!"),"warn");else{if("canIUse"===r)return le.includes(arguments[1])&&!!$e[arguments[1]];D("不存在名为 ".concat(y(r)," 的方法调用!"),"error")}};Z().gdp=ze,Z().gioSDKVersion=$e.sdkVersion;var Je=$e.dataStore.eventHooks,We=Je.growingApp,Ye=Je.growingPage,Ze=Je.growingComponent,Xe=Je.growingBehavior;(0,Je.initOriginalValue)();var et=K((function(){return null!=We?We:App})),nt=K((function(){return null!=Ye?Ye:Page})),it=K((function(){return null!=Ze?Ze:Component})),rt=K((function(){return null!=Xe?Xe:Behavior}));export{et as GioApp,rt as GioBehavior,it as GioComponent,nt as GioPage,ze 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)};function t(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)}var n=function(){return n=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},n.apply(this,arguments)};function i(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 r,o=/^[a-zA-Z_][0-9a-zA-Z_]{0,100}$/,a=function(e){return["undefined","null"].includes(q(e))},u=function(e){return"string"===q(e)},s=function(e){return"number"===q(e)},c=function(e){return"boolean"===q(e)},l=function(e){return"[object Object]"==={}.toString.call(e)&&!a(e)},g=function(e){return["function","asyncfunction"].includes(q(e))},d=function(e){return Array.isArray(e)&&"array"===q(e)},p=function(e){return"date"===q(e)},f=function(e){try{return Array.from(e)[0]}catch(e){return}},v=function(e){try{var t=Array.from(e);return t[t.length-1]}catch(e){return}},h=function(e,t){return void 0===t&&(t=1),d(e)&&s(t)?e.slice(t>0?t:1,e.length):e},m=function(e,t){if(void 0===t&&(t=!1),d(e)){for(var n=0,i=[],r=0,o=e;r<o.length;r++){var a=o[r];a&&!x(a)&&(i[n++]=a),t&&0===a&&(i[n++]=a)}return i}return e},I=function(e,t){if(d(e)){var n=e.findIndex(t);return 0>n?void 0:e[n]}},y=function(e){return a(e)?"":"".concat(e)},S=function(e,t){return"string"===q(e)?e.split(t):e},w=function(e){if(u(e)){var t=S(e,"");return"".concat(f(t).toLowerCase()).concat(h(t).join(""))}return e},O=function(e,t){return u(e)||(e=y(e)),e.slice(0,t.length)===t},_={}.hasOwnProperty,P=function(e,t){return!a(e)&&_.call(e,t)},k=function(e){return l(e)?Object.keys(e):[]},b=function(e,t){k(e).forEach(function(n){return t(e[n],n)})},T=function(e,t){var n=k(e);return!(!l(e)||!l(t)||n.length!==k(t).length||n.map(function(n,i){return l(e[n])?T(e[n],t[n]):e[n]===t[n]}).includes(!1))},E=function(e,t,n){var i=e;return l(e)?(t.split(".").forEach(function(e){i=i?i[e]:n}),i):n},C=function(e,t){if(!l(e))return!1;try{if("string"===q(t))return delete e[t];if("array"===q(t))return t.map(function(t){return delete e[t]});"object"===q(t)&&t.constructor===RegExp&&k(e).forEach(function(n){t.test(n)&&C(e,n)})}catch(e){return!1}},A=function(e,t,n,i){var r;void 0===t&&(t=250);var o=0;return"boolean"!==q(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))}},x=function(e){return d(e)?0===e.length:l(e)?0===k(e).length:!e},q=function(e){return{}.toString.call(e).slice(8,-1).toLowerCase()},N=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())},U=Object.freeze({__proto__:null,isNil:a,isString:u,isNaN:function(e){return"NaN"===y(Number(e))},isNumber:s,isBoolean:c,isObject:l,isRegExp:function(e){return"[object RegExp]"==={}.toString.call(e)},isFunction:g,isArray:d,isDate:p,fixed:function(e,t){return s(e)?Number(e.toFixed(s(t)?t:2)):u(e)&&"NaN"!==y(Number(e))?Number(Number(e).toFixed(s(t)?t:2)):e},head:f,last:v,drop:h,dropWhile:function(e,t){return d(e)?e.filter(function(e){return!t(e)}):e},compact:m,find:I,isEqualArray:function(e,t){return!(!d(e)||!d(t)||e.length!==t.length)&&e.every(function(e,n){return e===t[n]})},toString:y,split:S,lowerFirst:w,upperFirst:function(e){if(u(e)){var t=S(e,"");return"".concat(f(t).toUpperCase()).concat(h(t).join(""))}return e},startsWith:O,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:_,has:P,keys:k,forEach:b,isEqual:T,get:E,unset:C,throttle:A,isEmpty:x,typeOf:q,formatDate:N}),D=function(e,t){console.log("%c[GrowingIO]:".concat(e),{info:"color: #3B82F6;",error:"color: #EF4444",warn:"color: #F59E0B",success:"color: #10B981"}[t]||"")},R=function(e,t,n){return void 0===t&&(t=!0),void 0===n&&(n="参数不合法"),D("".concat(t?"调用":"设置"," ").concat(e," 失败,").concat(n,"!"),"warn")},K=function(e){try{return e()}catch(e){return}},L=function(e,t){if(g(e))try{e(t)}catch(e){D("回调执行失败!".concat(e),"error")}},F=function(e){return u(e)?e.trim().substring(0,100):e},H=function(e,t){return u(e)&&!x(e)&&e.match(o)?t():(D("事件名格式不正确,只能包含数字、字母和下划线,且不能以数字开头,字符总长度不能超过100!","error"),!1)},j=function(e){return a(e)||k(e).forEach(function(t){g(e[t])?e[t]=K(function(){return e[t]()}):l(e[t])?C(e,t):d(e[t])||(e[t]=y(e[t]))}),e},B=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)})},V=function(e){return e.pixelRatio?Math.round(e.screenHeight*e.pixelRatio):e.screenHeight},M=function(e){return e.pixelRatio?Math.round(e.screenWidth*e.pixelRatio):e.screenWidth},G=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)}},Q=function(e){if(u(e)){var t=e.indexOf("?");return-1!==t?[e.substring(0,t),e.substring(t+1)]:[e,""]}return["",""]},$=function(e){return u(e)?e.startsWith("/")?e:"/".concat(e):""},z=function(e){return K(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=K(function(){return xhs})),t||(t=K(function(){return swan})),t||(t=K(function(){return my})),t||(t=K(function(){return tt})),t||(t=K(function(){return qq})),t||(t=K(function(){return ks})),t||(t=K(function(){return jd})),t||(t=K(function(){return wx})),t}})},J=function(e){return K(function(){switch(e){case"wx":return __wxConfig;case"swan":return appConfig;case"tt":return K(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}})},W=function(e){return K(function(){switch(e){case"wx":case"qq":return __wxAppCode__;case"tt":return __allConfig__;case"ks":return __module__;case"jd":return __jdAppCode__;default:return}})},Y=function(){var e;return!e&&K(function(){return xhs})&&(e="xhs"),!e&&K(function(){return swan})&&(e="swan"),!e&&K(function(){return tt})&&(e="tt"),!e&&K(function(){return qq})&&(e="qq"),!e&&K(function(){return my.tb})&&(e="tb"),!e&&K(function(){return my})&&(e="my"),!e&&K(function(){return ks})&&(e="ks"),!e&&K(function(){return jd})&&(e="jd"),!e&&K(function(){return wx})&&(e="wx"),e||I(k(global),function(e){return y(e).toLowerCase().includes("quickapp")})&&(e="quickapp"),e},Z=function(){var e;return null!==(e=K(function(){var e;return null!==(e=K(function(){var e;return null!==(e=K(function(){return $global}))&&void 0!==e?e:global}))&&void 0!==e?e:window}))&&void 0!==e?e:globalThis},X=function(e){var t={};return l(e)&&(C(e,"&&sendTo"),b(e,function(e,n){var i=y(n).slice(0,100);l(e)?t[i]=X(e):d(e)?(t[i]=m(e.slice(0,100),!0),t[i]=t[i].join("||").slice(0,1e3)):p(e)?t[i]=N(e):t[i]=a(e)?"":y(e).slice(0,1e3)})),t},ee=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()}},te=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()}},ne=function(e){return k(e||{}).map(function(t){return t?"".concat(t,"=").concat(a(e[t])?"":e[t]):""}).join("&")},ie=function(e){(O(e,"?")||O(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},re=["wxShoppingListScene","$taroTimestamp","gdpCircleRoomCollectUrl"],oe=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n="string"==typeof e?ie(e):e||{};function i(e,t){if("object"!=typeof e||null===e||Array.isArray(e))return e;var i={};return k(e).forEach(function(r){var o=re.some(function(e){return r.includes(e)}),a=P(n,r);if(!(o||t&&a)){var u=e[r];"string"==typeof u?re.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(t,!0))},ae=Object.freeze({__proto__:null,consoleText:D,callError:R,niceTry:K,niceCallback:L,limitString:F,eventNameValidate:H,getDynamicAttributes:j,guid:B,getScreenHeight:V,getScreenWidth:M,getOS:G,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(f(S(e.version,".")));return Number.isNaN(t)?0:t}return 0},splitPath:Q,normalPath:$,isTaro3:function(e){var t=e.Current,n=e.createComponent;return!(!e||!t||n)},getPlainMinip:z,getPlainConfig:J,getPlainAppCode:W,getPlainPlatform:Y,getSubKeys:function(e){return k(e).filter(function(e){return e.indexOf("__sub")>-1&&e.indexOf("gio__")>-1}).sort()},getAppInst:function(){var e=K(function(){return getApp({allowDefault:!0})});return e||(e=Z()),e},getGlobal:Z,limitObject:X,batchGetStorageSync:ee,batchSetStorageSync:te,qsStringify:ne,qsParse:ie,hashCode:function(e,t){void 0===t&&(t=!1);var n=0;if(x(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:function(e){var t;return u(e)?null!==(t=K(function(){return JSON.parse(e)}))&&void 0!==t?t:{}:null!=e?e:{}},getPureParams:oe}),ue=function(e){return(u(e)&&e.length>0||s(e)&&e>0)&&!["-","null","undefined"].includes(e)},se={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},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"}},ce=["clearGeneralProps","clearPageAttributes","clearTrackTimer","clearUserId","getABTest","getGioInfo","getOption","identify","removeTimer","sendPage","sendVisit","setGeneralProps","setLocation","setOption","setPageAttributes","setUserAttributes","setUserId","track","trackTimerEnd","trackTimerPause","trackTimerResume","trackTimerStart"],le=i(i(["init","registerPlugins"],["getPlugins","getDeviceId","updateImpression"],!0),ce,!0),ge={autotrack:"无埋点",dataCollect:"数据采集",debug:"调试模式",serverUrl:"数据上报服务地址"},de=["enableDebug","setAutotrack","setDataCollect","setTrackerHost","setTrackerScheme","setConfig","collectImp","setPlatformProfile","getLocation"],pe=["deviceBrand","deviceModel","deviceType","networkState","screenHeight","screenWidth","operatingSystem"],fe=i(i([],pe,!0),["appChannel","language","platformVersion"],!1),ve={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_"},he="MINIP_LIFECYCLE",me="ON_COMMIT_REQUEST",Ie="ON_COMPOSE_AFTER",ye="ON_COMPOSE_BEFORE",Se="ON_ERROR",we="ON_INSTALL",Oe="ON_SEND_AFTER",_e="ON_SEND_BEFORE",Pe="OPTION_CHANGE",ke="OPTION_INITIALIZED",be="SDK_INITIALIZED",Te="SESSIONID_UPDATE",Ee=function(e){var t=this;this.growingIO=e,this.main=function(e,i,r){void 0===r&&(r=!0),e||(e=t.growingIO.trackingId);var o=t.growingIO,a=o.sdkVersion,u=o.platformConfig,s=o.minipInstance,c=o.userStore,l=o.dataStore,g=o.dataStore,d=g.scene,p=g.eventHooks.currentPage,f=g.generalProps,v=l.getTrackerVds(e),h=v.version,m=v.dataSourceId,I=v.appId,y=v.idMapping,S=v.ignoreFields,w=l.locationData[e],O=s.systemInfo,_=void 0===O?{}:O,P=s.network,k=void 0===P?{}:P,b=_.brand,T=_.model,E=_.platform,A=_.language,q=p.getPagePath(),N={appChannel:"scn:".concat(d||"NA"),appVersion:h,dataSourceId:m,deviceBrand:b,deviceId:c.getUid(),deviceModel:T,deviceType:G(E,u.name),domain:I,language:A,latitude:null==w?void 0:w.latitude,longitude:null==w?void 0:w.longitude,networkState:(null==k?void 0:k.networkType)||(null==k?void 0:k.type)||(null==k?void 0:k.subtype),operatingSystem:G(E,u.name),path:q,platform:u.platform,platformVersion:u.name+(_.version?" ".concat(_.version):""),query:q?p.getPageQuery():"",screenHeight:V(_),screenWidth:M(_),sdkVersion:a,sessionId:c.getSessionId(e),title:p.getPageTitle(),timestamp:Date.now(),timezoneOffset:(new Date).getTimezoneOffset(),userId:c.getUserId(e)};return y&&(N.userKey=c.getUserKey(e)),r&&!x(f[e])&&(N.attributes=n({},f[e])),x(N.attributes)||(N.attributes=X(j(n({},N.attributes)))),x(S)||S.forEach(function(e){C(N,e)}),x(i)?n(n({},N),{trackingId:e}):n(n(n({},N),i),{trackingId:e})}},Ce=function(e){var t=this;this.growingIO=e,this.enterParams={},this.main=function(e,i){var r,o,a=Date.now(),u=t.growingIO,s=u.emitter,c=u.userStore,l=u.vdsConfig,g=u.platformConfig,d=u.uploader,p=u.dataStore,f=u.minipInstance,v=u.dataStore,h=v.trackersExecute,m=v.shareOut,I=v.lastCloseTime,y=v.saveStorageInfo,S=v.setOriginalSource;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 w=g.listeners.app;switch(s.emit(ye,{event:"App ".concat(e),params:null!==(o=i[0])&&void 0!==o?o:{}}),e){case w.appLaunch:t.enterParams=n({},i[0]);break;case w.appCreate:case w.appShow:var O=t.enterParamsParse(i[0]),_=O.path,P=O.query,k=O.referralPage;!m&&l.originalSource&&_&&h(function(e){S(e,{path:_,query:P,referralPage:k})}),I?(Date.now()-I>60*l.keepAlive*1e3||p.lastScene&&p.scene!==p.lastScene)&&h(function(e){c.setSessionId(e)}):h(function(e){p.lastVisitEvent[e]={path:_,query:P,referralPage:k},t.buildVisitEvent(e,{path:_,query:P,referralPage:k})}),f.setNetworkStatusListener();break;case w.appClose:p.lastScene=p.scene,p.lastCloseTime=Date.now(),y(),c.saveUserInfo(),h(function(e){t.buildCloseEvent(e),l.forceLogin||d.initiateRequest(e,!0)})}},this.enterParamsParse=function(e){var n;void 0===e&&(e={});var i=t.growingIO,r=i.gioPlatform,o=i.minipInstance,a=i.dataStore,u="",s="",c="";if("quickapp"!==r&&o.minip.canIUse("getEnterOptionsSync")){var l=o.minip.getEnterOptionsSync()||{},g=l.path,d=l.query,p=l.scene,f=l.referrerInfo||l.refererInfo;u=g||e.path,s=d||e.query,c=(null==f?void 0:f.appId)||(null===(n=null==e?void 0:e.referrerInfo)||void 0===n?void 0:n.appId)||"",a.scene=p||e.scene,C(d,"gdpCircleRoomCollectUrl"),s=ne(oe(s,(null==f?void 0:f.extraData)||{}))}else g=e.path,d=e.query,f=e.referrerInfo,u=g,s=ne(d),c=(null==f?void 0:f.appId)||"",t.parseScene(e);return{path:u,query:s,referralPage:c}},this.parseScene=function(e){var n,i,r=t.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 x(e)||((null===(n=null==e?void 0:e.query)||void 0===n?void 0:n.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=t.growingIO,o=r.dataStore,a=o.getOriginalSource,u=o.eventContextBuilder,s=o.eventInterceptor,c=r.vdsConfig,l=a(e),g=(null==i?void 0:i.query)||"",d=n({eventType:"VISIT"},u(e,{}));!x(i)&&i.path&&(d.path=i.path||"",d.query="string"===q(g)?g:ne(g),i.referralPage&&(d.referralPage=i.referralPage)),c.originalSource&&!x(l)&&(d=n(n({},d),l)),s(d)},this.buildCloseEvent=function(e){var i=t.growingIO.dataStore,r=i.eventContextBuilder;(0,i.eventInterceptor)(n({eventType:"APP_CLOSED"},r(e)))}},Ae=function(){function e(e){var t=this;this.growingIO=e,this.lifeBeforeShow=!0,this.getPagePath=function(){var e,n,i,r=t.growingIO,o=r.minipInstance,a=r.inPlugin,u=r.dataStore,s=r.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===(n=u.lastPageEvent[s])||void 0===n?void 0:n.path)||(null===(i=u.lastVisitEvent[s])||void 0===i?void 0:i.path)},this.getPageQuery=function(){var e,n,i,r,o,a,u=t.growingIO,s=u.minipInstance,c=u.dataStore,l=u.trackingId,g=s.getCurrentPage(),d=s.getCurrentPath(),p=c.eventHooks.appEffects.enterParams,f=void 0===p?{}:p;if(!d)return f.path?ne(oe(null==f?void 0:f.query,null===(i=null==f?void 0:f.referrerInfo)||void 0===i?void 0:i.extraData)):(null===(r=c.lastPageEvent[l])||void 0===r?void 0:r.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 x(v)?x(t.queryOptions[d])?d===f.path?ne(oe(null==f?void 0:f.query,null===(n=null==f?void 0:f.referrerInfo)||void 0===n?void 0:n.extraData)):void 0:ne(oe(t.queryOptions[d])):ne(oe(v))},this.getPageTitle=function(e){var n=t.growingIO,i=n.minipInstance,r=n.inPlugin,o=n.dataStore,a=i.getCurrentPath(),u=t.configuredTitle[a]||i.getPageTitle(i.getCurrentPage());if(r){var s=o.getTrackerVds(e||t.growingIO.trackingId);return u||"/插件".concat(s.appId).concat(a?"_"+v(a.split("/")):"")}return u},this.getReferralPage=function(e){var n,i,r,o=t.growingIO,a=o.minipInstance,u=o.dataStore,s=u.lastPageEvent,c=u.scene,l=u.eventHooks;return(null===(n=s[e])||void 0===n?void 0:n.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,n){void 0===n&&(n=!0);var i=t.buildShareQuery(e),r=i[0],o=i[1];return(n||P(e,"path"))&&(e.path=$(r+(o?"?".concat(o):""))),(n||P(e,"query"))&&(e.query=o),e},this.eventSetPageProps=function(e,i){var r=K(function(){return t.pageProps[e][t.getPagePath()]});return x(r)?i.attributes:X(j(n(n({},i.attributes),r)))},this.queryOptions={},this.configuredTitle={},this.pageProps={}}return e.prototype.buildShareQuery=function(e){var t,i,r=Q(null!==(t=e.path)&&void 0!==t?t:""),o=e.path||this.getPagePath(),a={},u=P(e,"path");if(P(e,"query"))a=ie(null!==(i=e.query)&&void 0!==i?i:"")||{};else if(u)a=ie(v(r))||{};else{var s=this.growingIO.minipInstance.getCurrentPage();a=n({},s.options||this.queryOptions[s.route]||{}),m(k(a)).forEach(function(e){e.toLowerCase().startsWith("utm_")&&C(a,e)})}return[o,ne(a)]},e}(),xe=function(e){var t=this;this.growingIO=e,this.main=function(e,i,r){var o,a,u=Date.now(),s=t.growingIO,c=s.emitter,l=s.minipInstance,d=s.plugins,p=s.vdsConfig,f=s.platformConfig,v=s.dataStore,h=v.getTrackerVds,m=v.getOriginalSource,I=v.setOriginalSource,y=v.trackersExecute,S=v.eventHooks,w=v.toggleShareOut,O=v.buildAppMessageEvent,_=v.buildTimelineEvent,P=v.buildAddFavorites,k=S.currentPage;if(!t.prevEvent[i]||Date.now()-Number(t.prevEvent[i])>=50){e||(e=l.getCurrentPage()),e.route||(e.route=l.getCurrentPath(e));var b=e.route||e.uri||e.__route__||(null===(o=null==e?void 0:e.$page)||void 0===o?void 0:o.fullPath)||"";c.emit(he,{event:"Page ".concat(i),timestamp:u,params:{page:e,args:r[0]}}),p.debug&&console.log("Page:",b,"#",i,u),t.prevEvent[i]=Date.now();var T=f.listeners.page;switch(c.emit(ye,{page:e,event:"Page ".concat(i),params:{page:e,args:r[0]}}),k.lastLifecycle=k.currentLifecycle,k.currentLifecycle=i,i){case T.pageLoad:k.queryOptions[b]=E(e,"options")||E(e,"__displayReporter.query")||E(e,"$page.query")||E(e,"$wx.__displayReporter.query")||E(e,"$taroParams")||r[0]||{},C(k.queryOptions[b],["$taroTimestamp","gdpCircleRoomCollectUrl"]);break;case T.pageShow:y(function(e){var i=m(e);x(i)||i.path!==b||I(e,n(n({},i),{title:k.getPageTitle()})),h(e).trackPage&&t.buildPageEvent(e)}),w(!1);break;case T.pageHide:case T.pageUnload:break;case T.shareChat:case T.shareApp:w(!0),y(function(e){h(e).followShare&&O(e,r)});break;case T.shareTime:"xhsp"===l.platform&&w(!0),y(function(e){h(e).followShare&&_(e,r)});break;case T.addFavorites:y(function(e){h(e).followShare&&P(e,r)});break;case T.tabTap:var A=null===(a=null==d?void 0:d.gioEventAutoTracking)||void 0===a?void 0:a.buildTabClickEvent;p.autotrack&&A&&g(A)&&A(t.growingIO.trackingId,r[0])}k.lastLifecycle=k.currentLifecycle,k.currentLifecycle="".concat(i,"End"),["onHideEnd","onUnloadEnd"].includes(k.currentLifecycle)&&(k.lifeBeforeShow=!0),"onShowEnd"===k.currentLifecycle&&(k.lifeBeforeShow=!1)}},this.buildPageEvent=function(e,i){var r=t.growingIO.dataStore,o=r.eventContextBuilder,a=r.eventInterceptor,u=r.eventHooks.currentPage,s=n({eventType:"PAGE",referralPage:u.getReferralPage(e)},o(e));s.attributes=u.eventSetPageProps(e,s),!x(i)&&i.title&&(s.title=i.title),a(s)},this.prevEvent={}},qe=function(e){var t,i=this;this.growingIO=e,this.isNormalFc=function(e,t){return g(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){d(i["".concat(t,"Handlers")])&&i["".concat(t,"Handlers")].forEach(function(t){g(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="array"===q(t)?[].slice.call(t):[];return x(o)||a.push(o),i["def".concat(n,"Cbs")][r].apply(e,a),i.growingIO.emitter.emit(he,{event:"".concat(n," ").concat(r,"End"),timestamp:Date.now(),params:{instance:e,arguments:Array.from(a)}}),o},this.lifeFcEffects=function(e,t,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.shareEventTypes.includes(e)){var g=null!==(i=t.apply(this,c))&&void 0!==i?i:{};if(!o.growingIO.vdsConfig.followShare)return g;var d="promise"===q(g),p="promise"===q(g.promise),f=P(g,"_result")&&P(g,"_state");if(d||p||f){var v=function(t){void 0===t&&(t={});try{var i=n(n({},g),t),a=o.currentPage.updateShareResult(i);o.lifeFcEffectsFn(s,c,r,e,a)}catch(e){D(e,"error")}};d&&Promise.race([g,new Promise(function(e){setTimeout(function(){e({})},3e3)})]).then(v).catch(function(e){return D(e,"error")}),p&&Promise.race([g.promise,new Promise(function(e){setTimeout(function(){e({})},3e3)})]).then(v).catch(function(e){return D(e,"error")}),f&&(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,r,e,u)}else o.lifeFcEffectsFn(this,c,r,e),u=t.apply(this,c);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.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)&&(g(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){D(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];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];e.pageEffects.main(this,t,n)}})},this.growingApp=function(e){return g(i.originalApp)?i.originalApp(i.appOverriding(e)):i.appOverriding(e)},this.growingPage=function(e){return g(i.originalPage)?i.originalPage(i.pageOverriding(e)):i.pageOverriding(e)},this.growingComponent=function(e){return g(i.originalComponent)?i.originalComponent(i.componentOverriding(e)):i.componentOverriding(e)},this.growingBehavior=function(e){return g(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&&(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&&(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&&(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&&(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(),i.originalApp=K(function(){return App||global.App}),i.originalPage=K(function(){return Page||global.Page}),i.originalComponent=K(function(){return Component||global.Component}),i.originalBehavior=K(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(),Z().GioApp=K(function(){return null!==App&&void 0!==App?App:i.originalApp}),Z().GioPage=K(function(){return null!==Page&&void 0!==Page?Page:i.originalPage}),Z().GioComponent=K(function(){return null!==Component&&void 0!==Component?Component:i.originalComponent}),Z().GioBehavior=K(function(){return null!==Behavior&&void 0!==Behavior?Behavior:i.originalBehavior})):"quickapp"===r&&(Z().GioApp=function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];return e.appOverriding(t[0])},Z().GioPage=function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];return e.pageOverriding(t[0])},Z().GioComponent=function(){for(var t=[],n=0;arguments.length>n;n++)t[n]=arguments[n];return e.pageOverriding(t[0])})};var r=null===(t=this.growingIO)||void 0===t?void 0:t.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 xe(this.growingIO),this.currentPage=new Ae(this.growingIO)},Ne=function(){function e(e){var t,r,o=this;this.growingIO=e,this.ALLOW_SETTING_KEYS=k(se),this.getStorageKey=function(e,t){var n=o.growingIO.inPlugin;return"".concat(e===o.growingIO.trackingId?"":e).concat(ve[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")),i=Number(n);(Number.isNaN(i)||i>=1e9||1>i)&&(i=1),o._gsid[e]=i,o._stid[e]=i,i!==n&&t.setStorageSync(o.getStorageKey(e,"gsid"),i)},this.saveStorageInfo=function(){var e=o.growingIO.minipInstance;o._stid=n({},o._gsid),te(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=K(function(){return JSON.parse(n.getStorageSync(o.getStorageKey(e,"originalSource")))}))&&void 0!==t?t:{}},this.getTrackerVds=function(e){return o.growingIO.trackingId===e?n({},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,i=o.growingIO,r=i.platformConfig,a=i.inPlugin,u=i.minipInstance,s=i.plugins,c=e.uniVue,l=e.taro;c||l||"quickapp"===u.platform||(r.canHook=!0),!a||["tbp","jdp"].includes(u.platform)?o.eventHooks.initEventHooks():o.eventHooks.initOriginalValue(),c&&(null===(t=null==s?void 0:s.gioUniAppAdapter)||void 0===t||t.main()),l&&(null===(n=null==s?void 0:s.gioTaroAdapter)||void 0===n||n.main())},this.initOptions=function(e){var t,i,r,a,u,s,c=e.projectId,l=e.dataSourceId,g=e.appId,p=e.trackingId,f={};return o.ALLOW_SETTING_KEYS.forEach(function(t){var n=se[t].type;(d(n)?n.includes(q(e[t])):q(e[t])===se[t].type)?"ignoreFields"===t?f.ignoreFields=e.ignoreFields.filter(function(e){return pe.includes(e)}):"extraParams"===t?f.extraParams=e.extraParams.filter(function(e){return fe.includes(e)}):(f[t]=e[t],["dataCollect","autotrack"].includes(t)&&!f[t]&&D("已关闭".concat(ge[t]),"info")):f[t]=se[t].default}),f.uploadInterval=Math.round(f.uploadInterval),(Number.isNaN(f.uploadInterval)||0>f.uploadInterval||f.uploadInterval>3e3)&&(f.uploadInterval=1e3),f.enableIdMapping&&!f.idMapping&&(f.idMapping=!0,f.idMapping||o.growingIO.userStore.setUserKey(p,"")),C(f,"enableIdMapping"),f.pluginMode&&(o.growingIO.inPlugin=!0),!isNaN(Number(f.requestTimeout))&&f.requestTimeout>0||(f.requestTimeout=5e3),(0>f.impressionScale||f.impressionScale>1)&&(f.impressionScale=0),(0>f.keepAlive||f.keepAlive>1440)&&(f.keepAlive=5),(1>f.sessionExpires||f.sessionExpires>1440)&&(f.sessionExpires=-1),n(n({},f),{projectId:c,dataSourceId:l,appId:g,trackingId:p,performance:{monitor:null===(i=null===(t=f.performance)||void 0===t?void 0:t.monitor)||void 0===i||i,exception:null===(a=null===(r=f.performance)||void 0===r?void 0:r.exception)||void 0===a||a,network:null!==(s=null===(u=f.performance)||void 0===u?void 0:u.network)&&void 0!==s&&s}})},this.setOption=function(e,t,i){var r,a,s=o.growingIO,c=s.userStore,l=s.emitter,g=o.getTrackerVds(e),d=u(t)&&o.ALLOW_SETTING_KEYS.includes(t),p=d&&typeof i===(null===(a=se[t])||void 0===a?void 0:a.type);if(d&&p){var f=n({},g);return o.updateVdsConfig(e,n(n({},g),((r={})[t]=i,r))),"dataCollect"===t&&f.dataCollect!==i&&i&&c.setSessionId(e),l.emit(Pe,{optionName:t,optionValue:i}),!0}return R("setOption > ".concat(t)),!1},this.getOption=function(e,t){var n=o.getTrackerVds(e);return t&&P(o.growingIO.vdsConfig,t)?P(n,t)?n[t]:o.growingIO.vdsConfig[t]:x(t)?n:void R("getOption > ".concat(t))},this.updateVdsConfig=function(e,t){e===o.growingIO.trackingId?(o.growingIO.vdsConfig=n(n({},o.growingIO.vdsConfig),t),Z().vdsConfig=o.growingIO.vdsConfig):(o.growingIO.subInstance[e]=n(n({},o.growingIO.subInstance[e]),t),Z().vdsConfig.subInstance[e]=o.growingIO.subInstance[e])},this.toggleShareOut=function(e){c(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 t=o.growingIO,i=t.dataStore,r=t.uploader;if(o.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={};b(e,function(e,t){var n;if("element"===t){var i=null!==(n=f(e))&&void 0!==n?n:{};b(i,function(e,t){x(e)&&0!==e||(a[t]=e)})}else x(e)&&0!==e||(a[t]=e)}),o.growingIO.emitter.emit(Ie,{composedEvent:a}),r.commitRequest(n(n({},a),{requestId:B()}))}},this.eventRefactor=function(e){var t,i,r=n(n({},e),o.eventContextBuilder(e.trackingId,{path:e.path,query:e.query,timestamp:e.timestamp}));return r.attributes=n(n({},null!==(t=r.attributes)&&void 0!==t?t:{}),null!==(i=e.attributes)&&void 0!==i?i:{}),r},this.eventInterceptor=function(e){var t=o.growingIO.minipInstance,n=t.systemInfo,r=t.network;x(n)||x(r)?o.interceptEvents.push(e):x(o.interceptEvents)?o.eventConverter(e):(i(i([],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,n=e.network;t&&n&&!x(o.interceptEvents)&&(i([],o.interceptEvents,!0).forEach(function(e){o.eventConverter(o.eventRefactor(e))}),o.interceptEvents=[])},this.buildAppMessageEvent=function(e,t){var i,r,a,u=t[0];2>t.length?1===t.length&&(a=u):a=t[1];var s=o.growingIO.dataStore,c=s.eventContextBuilder,l=s.eventInterceptor,g=((null==a?void 0:a.path)||"").split("?"),d=n({eventType:"CUSTOM",eventName:"$mp_on_share"},c(e));d.attributes=X(n(n(n({},null!==(i=d.attributes)&&void 0!==i?i:{}),{$from:null==u?void 0:u.from,$target:null===(r=null==u?void 0:u.target)||void 0===r?void 0:r.id,$share_title:null==a?void 0:a.title,$share_path:f(g),$share_query:g[1]}),null==a?void 0:a.attributes)),l(d)},this.buildTimelineEvent=function(e,t){var i,r,a,u=t[0];2>t.length?1===t.length&&(a=u):a=t[1];var s=o.growingIO.dataStore,c=s.eventContextBuilder,l=s.eventInterceptor,g=((null==a?void 0:a.path)||"").split("?"),d=n({eventType:"CUSTOM",eventName:"$mp_share_timeline"},c(e));d.attributes=X(n(n(n({},null!==(i=d.attributes)&&void 0!==i?i:{}),{$target:null===(r=null==u?void 0:u.target)||void 0===r?void 0:r.id,$share_title:null==a?void 0:a.title,$share_path:f(g),$share_query:g[1]}),null==a?void 0:a.attributes)),l(d)},this.buildAddFavorites=function(e,t){var i,r,a=t[0];2>t.length?1===t.length&&(r=a):r=t[1];var u=o.growingIO.dataStore,s=u.eventContextBuilder,c=u.eventInterceptor,l=((null==r?void 0:r.path)||"").split("?"),g=n({eventType:"CUSTOM",eventName:"$mp_add_favorites"},s(e));g.attributes=X(n(n({},null!==(i=g.attributes)&&void 0!==i?i:{}),{$share_title:null==r?void 0:r.title,$share_path:f(l),$share_query:l[1]})),c(g)},this.trackersExecute=function(e){o.initializedTrackingIds.forEach(function(t){"function"===q(e)&&e(t)})},this.initializedTrackingIds=[],this.eventContextBuilder=new Ee(this.growingIO).main,this.eventHooks=new qe(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,l=a.minipInstance;s.on(be,function(e){var t=e.trackingId;o.initializedTrackingIds.push(t),o.initStorageInfo(t)}),s.on(me,function(e){var t=e.eventData,n=e.trackingId;"VISIT"===t.eventType&&(o.lastVisitEvent[n]=t),"PAGE"===t.eventType&&(o.lastPageEvent[n]=t)}),g(null===(t=l.minip)||void 0===t?void 0:t.onAppHide)&&l.minip.onAppHide(function(){o.trackersExecute(function(e){var t=o.trackTimers[e];b(t,function(e){e.start&&(e.leng=e.leng+(+Date.now()-e.start))})})}),g(null===(r=l.minip)||void 0===r?void 0:r.onAppShow)&&l.minip.onAppShow(function(){o.trackersExecute(function(e){var t=o.trackTimers[e];b(t,function(e){e.start&&(e.start=+Date.now())})})}),s.on(Pe,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(Te,function(e){var t=e.oldSessionId,n=e.trackingId;if(t){var i=o.eventHooks.currentPage,r=i.getPagePath,a=i.getPageQuery,u=r(),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}(),Ue={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"]}}},De=n(n({},Ue),{pageHandlers:i(i([],Ue.pageHandlers,!0),["onInit","didMount","didUnmount"],!1),listeners:n(n({},Ue.listeners),{page:n(n({},Ue.listeners.page),{onInit:"onInit",didMount:"didMount",didUnmount:"didUnmount"})}),name:"Taobao",platform:"tbp",scnPrefix:"tbp_",hooks:n(n({},Ue.hooks),{Behavior:!1})}),Re=function(e){function n(t){var n=e.call(this,t)||this;return n.growingIO=t,n.hookSetTitle=function(){var e,t=null===(e=n.minip)||void 0===e?void 0:e.setNavigationBar,i=n;t&&Object.defineProperty(n.minip,"setNavigationBar",{writable:!0,enumerable:!0,configurable:!0,value:function(){if(i.growingIO.gioSDKInitialized){var e=i.getCurrentPath(),n=(arguments[0]||{}).title;i.growingIO.dataStore.eventHooks.currentPage.configuredTitle[e]=n}return t.apply(this,arguments)}})},n.initImpression=function(e){var t,i;null===(i=null===(t=n.growingIO.plugins)||void 0===t?void 0:t.gioImpressionTracking)||void 0===i||i.main(e,"selectAll")},n.getStorageSync=function(e){return my.getStorageSync({key:e}).data},n.setStorageSync=function(e,t){var i;null===(i=n.minip)||void 0===i||i.setStorageSync({key:e,data:t})},n.removeStorageSync=function(e){var t;null===(t=n.minip)||void 0===t||t.removeStorageSync({key:e})},n.hookSetTitle(),n}return t(n,e),n}(function(e){var t=this;this.growingIO=e,this.minip=z("tb"),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(){if(i.growingIO.gioSDKInitialized){var e=i.getCurrentPath(),t=(arguments[0]||{}).title;i.growingIO.dataStore.eventHooks.currentPage.configuredTitle[e]=t}return n.apply(this,arguments)}})},this.navigateTo=function(e){var n;return null===(n=t.minip)||void 0===n?void 0:n.navigateTo(e)},this.switchTab=function(e){var n;null===(n=t.minip)||void 0===n||n.switchTab(e)},this.navigateToMiniProgram=function(e){var n;return null===(n=t.minip)||void 0===n?void 0:n.navigateToMiniProgram(e)},this.getImageInfo=function(e){var n,i=e.src,r=e.success,o=e.fail,a=e.complete;return null===(n=t.minip)||void 0===n?void 0:n.getImageInfo({src:i,success:r,fail:o,complete:a})},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 K(function(){return v(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,i,r,o,a,s,c,l,g=Y(),p="",f=J(g);"string"===q(f)&&(f=null!==(n=K(function(){return JSON.parse(f)}))&&void 0!==n?n:{});var v,h=(null==e?void 0:e.data)||e.$data||{};if((p=u(null==h?void 0:h.gioPageTitle)?null==h?void 0:h.gioPageTitle:"")||K(function(){var t,n,i=W(g);i&&(v=i["".concat(e.route,".json")]||{},p=(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))}),!p&&f){var m=t.growingIO.dataStore.eventHooks.appEffects.enterParams;if(e.route||x(m)||(e.route=m.path||"",p=e.route?t._getTitleFromTabBar(f,e.route):""),!p&&(v=d(f.pages)?null!==(i=f.pages.find(function(t){return t.path===e.route}))&&void 0!==i?i:{}:f.page||{})){var I=v[e.route]||v["".concat(e.route,".html")]||v;p=(null==I?void 0:I.navigationBarTitleText)||(null===(r=null==I?void 0:I.window)||void 0===r?void 0:r.navigationBarTitleText)}p||(p=t._getTitleFromTabBar(f,e.route))}return p||(p=["wx","tt"].includes(g)?null===(s=null===(a=null===(o=f||global||$global)||void 0===o?void 0:o.global)||void 0===a?void 0:a.window)||void 0===s?void 0:s.navigationBarTitleText:null===(l=null===(c=f||global||$global)||void 0===c?void 0:c.window)||void 0===l?void 0:l.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 l(i)&&i.expiredAt?i.expiredAt<Date.now()?"":i.value:i},this.getStorage=function(e){return new Promise(function(n){var i;null===(i=t.minip)||void 0===i||i.getStorage({key:e,success:function(e){var t=e.data;return n(t)},fail:function(){return n("")}})})},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.removeStorage=function(e){var n;null===(n=t.minip)||void 0===n||n.removeStorage(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(){return n(null)}})})},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,d=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}),p=setTimeout(function(){(null==d?void 0:d.abort)&&g(null==d?void 0:d.abort)&&(null==d||d.abort()),clearTimeout(p),p=null},(a||1e4)+10);return d},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(){return n(null)}})})},this.getSetting=function(){return new Promise(function(e){var n;null===(n=t.minip)||void 0===n||n.getSetting({success:e,fail:e})})},this.setNetworkStatusListener=function(){var e;null===(e=t.minip)||void 0===e||e.onNetworkStatusChange(function(e){var n=e.networkType;n&&(t.network.networkType=n)})};var n=this.growingIO.platformConfig,i=n.platform,r=n.scnPrefix;this.platform=i,this.scnPrefix=r,this.growingIO.emitter.on(ke,function(){t.getNetworkType().then(function(){var e;return null===(e=t.growingIO.dataStore)||void 0===e?void 0:e.eventReleaseInspector()}),t.getSystemInfo().then(function(){var e;return null===(e=t.growingIO.dataStore)||void 0===e?void 0:e.eventReleaseInspector()})})}),Ke=["gioPerformance"],Le=function(){function e(e){var t=this;this.growingIO=e,this.getSceneInfo=function(e,n){var i;null===(i=t.growingIO.minipInstance.minip)||void 0===i||i.getRelationAppInfo({success:function(t){return n(e,t)},fail:function(){return n(e,{})}})},this.getRelationAppInfo=function(e){var n;null===(n=t.growingIO.minipInstance.minip)||void 0===n||n.getRelationAppInfo({success:e,fail:function(){return e({})}})},this.singleInvoke=function(e){var o,a=t.growingIO,u=a.vdsConfig,s=a.emitter,c=a.uploader,l=c.getHoardingQueue(e),g=c.getRequestQueue(e);if(c.requestQueue[e]=i([],g,!0).filter(function(e){var t;return(null!==(t=c.retryIds[e.requestId])&&void 0!==t?t:0)<=c.retryLimit}),g=c.getRequestQueue(e),!r.isEmpty(i(i([],l,!0),g,!0))){var d=null!==(o=l.shift())&&void 0!==o?o:g.shift(),p=n({},d);C(p,["requestId","trackingId"]),u.debug&&console.log("[GrowingIO Debug]:",JSON.stringify(p,null,2)),s.emit(_e,{requestData:p}),t.cloudFuncInvoke(d,p)}},this.cloudFuncInvoke=function(e,n){var i,o,a=t.growingIO,u=a.vdsConfig,s=a.emitter,c=a.uploader,l=u.serverUrl,g=u.projectId,d=u.tbConfig,p=r.niceTry(function(){var e;return null!==(e=getApp())&&void 0!==e?e:$global}),f=null!==(i=d.cloud)&&void 0!==i?i:p.cloud;(null===(o=null==f?void 0:f.function)||void 0===o?void 0:o.invoke)?(c.requestingNum+=1,f.function.invoke(d.cloudFuncName,{domain:l,path:"/v3/projects/".concat(g,"/collect"),params:{stm:Date.now()},body:n},d.cloudFuncHandler).then(function(t){c.requestingNum-=1,t.success?s.emit(Oe,{result:t,requestData:n}):(c.requestFailFn(e),r.consoleText("请求失败! ".concat(JSON.stringify(t)),"error")),c.initiateRequest(e.trackingId)}).catch(function(t){c.requestingNum-=1,c.requestFailFn(e),r.consoleText("请求失败! ".concat(JSON.stringify(t)),"error"),c.initiateRequest(e.trackingId)})):r.consoleText("请求失败!无法获取 cloud 对象,请检查 tbConfig 配置项!","error")},this.pluginVersion="__PLUGIN_VERSION__";var o=this.growingIO,a=o.utils,u=o.emitter;r=a,u.on(ke,function(e){var t=e.inPlugin,n=e.dataStore;t&&(r.getGlobal().Component=function(){for(var e=[],t=0;arguments.length>t;t++)e[t]=arguments[t];return n.eventHooks.componentOverriding(e[0])})}),u.on(he,function(e){var n=e.event,i=t.growingIO,o=i.dataStore,a=i.vdsConfig,u="小部件".concat(a.appId);switch(n){case"Page onInit":var s=function(e,t){var n,i=r.keys(e).map(function(t){return"".concat(t,"=").concat(e[t])}).join("&");o.scene=null!==(n=t.sceneId)&&void 0!==n?n:"",o.trackersExecute(function(e){o.sendVisit(e,{path:u,query:i,title:u})})};t.getRelationAppInfo(function(e){return t.getSceneInfo(e,s)});break;case"Page didMount":o.trackersExecute(function(e){o.getTrackerVds(e).trackPage&&o.sendPage(e,{path:u,title:u})})}})}return e.prototype.tbCloudAppInvoke=function(e,t){var n,i,o=this.growingIO,a=o.vdsConfig,u=o.emitter,s=o.uploader,c=a.serverUrl,l=a.projectId,g=a.tbConfig,d=r.niceTry(function(){var e;return null!==(e=getApp())&&void 0!==e?e:$global}),p=null!==(n=g.cloud)&&void 0!==n?n:d.cloud;if(null===(i=null==p?void 0:p.application)||void 0===i?void 0:i.httpRequest){var v=f(e).trackingId;s.requestingNum+=1,p.application.httpRequest({path:g.path,method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8"},params:{serverUrl:c,projectId:l,stm:Date.now()},body:t,exts:{cloudAppId:g.cloudAppId}}).then(function(n){s.requestingNum-=1,n.success?u.emit(Oe,{result:n,requestData:t}):(e.forEach(function(e){s.requestFailFn(e)}),r.consoleText("请求失败! ".concat(JSON.stringify(n)),"error")),s.initiateRequest(v)}).catch(function(t){s.requestingNum-=1,e.forEach(function(e){s.requestFailFn(e)}),r.consoleText("请求失败! ".concat(JSON.stringify(t)),"error"),s.initiateRequest(v)})}else r.consoleText("请求失败!无法获取 cloud 对象,请检查 tbConfig 配置项!","error")},e}(),Fe={name:"gioTaobaoAdapter",method:Le},He=function(e){function n(t){var n=e.call(this,t)||this;return n.growingIO=t,n.pluginsContext={plugins:{gioTaobaoAdapter:Fe}},n}return t(n,e),n}(function(e){var t,n,i,r,o,a,u=this;this.growingIO=e,this.innerPluginInit=function(){var e;Ke.forEach(function(e){var t;return C(null===(t=u.pluginsContext)||void 0===t?void 0:t.plugins,e)}),k(null===(e=u.pluginsContext)||void 0===e?void 0:e.plugins).forEach(function(e){var t,n,i=null!==(n=null===(t=u.pluginsContext)||void 0===t?void 0:t.plugins[e])&&void 0!==n?n:{},r=i.name,o=i.method;I(u.pluginItems,function(e){return e.name===r})||u.pluginItems.push({name:w(r||e),method:o||function(e){}})}),x(u.pluginItems)||u.installAll()},this.install=function(e,t,n){var i,r,o=u.growingIO.emitter,a=t||I(u.pluginItems,function(t){return t.name===e});if((null===(i=u.growingIO)||void 0===i?void 0:i.plugins)[e])return D("重复加载插件 ".concat(e," 或插件重名,已跳过加载!"),"warn"),!1;if(!a)return D("插件加载失败!不存在名为 ".concat(e," 的插件!"),"error"),!1;try{return(null===(r=u.growingIO)||void 0===r?void 0:r.plugins)[e]=new a.method(u.growingIO,n),t&&(o.emit(we,e),D("加载插件 ".concat(e),"info")),!0}catch(n){return u.lifeError(t,n),D("插件【".concat(e,"】加载异常 ").concat(n),"error"),!1}},this.installAll=function(e){(e||u.pluginItems).forEach(function(t){u.install(t.name,e?t:void 0,e?null==t?void 0:t.options:void 0)&&!I(u.pluginItems,function(e){return e.name===t.name})&&u.pluginItems.push({name:w(t.name),method:t.method?t.method:function(){}})})},this.uninstall=function(e){var t;C(u.pluginItems,e);var n=C(null===(t=u.growingIO)||void 0===t?void 0:t.plugins,e);return n||D("卸载插件 ".concat(e," 失败!"),"error"),n},this.uninstallAll=function(){u.pluginItems.forEach(function(e){return u.uninstall(e.name)})},this.lifeError=function(e,t){u.growingIO.emitter.emit(Se,{plugin:e,error:t}),D("插件执行错误 ".concat(e.name," ").concat(t),"error")},this.callLifeCycle=function(e,t){u.pluginItems.forEach(function(n){var i=u.growingIO.plugins[n.name]?u.growingIO.plugins[n.name][e]:void 0;if(i&&g(i))try{i(t)}catch(e){u.lifeError(n,e)}})},this.pluginsContext={plugins:{}},this.pluginItems=[],null===(t=this.growingIO.emitter)||void 0===t||t.on(we,function(e){return u.callLifeCycle("onInstall",e)}),null===(n=this.growingIO.emitter)||void 0===n||n.on(Se,function(e){return u.callLifeCycle("onError",e)}),null===(i=this.growingIO.emitter)||void 0===i||i.on(ye,function(e){return u.callLifeCycle("onComposeBefore",e)}),null===(r=this.growingIO.emitter)||void 0===r||r.on(Ie,function(e){return u.callLifeCycle("onComposeAfter",e)}),null===(o=this.growingIO.emitter)||void 0===o||o.on(_e,function(e){return u.callLifeCycle("onSendBefore",e)}),null===(a=this.growingIO.emitter)||void 0===a||a.on(Oe,function(e){return u.callLifeCycle("onSendAfter",e)})}),je={},Be={}.hasOwnProperty;function Ve(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function Me(e){try{return encodeURIComponent(e)}catch(e){return null}}je.stringify=function(e,t){t=t||"";var n,i,r=[];for(i in"string"!=typeof t&&(t="?"),e)if(Be.call(e,i)){if((n=e[i])||null!=n&&!isNaN(n)||(n=""),i=Me(i),n=Me(n),null===i||null===n)continue;r.push(i+"="+n)}return r.length?t+r.join("&"):""},je.parse=function(e){for(var t,n=/([^=?#&]+)=?([^&]*)/g,i={};t=n.exec(e);){var r=Ve(t[1]),o=Ve(t[2]);null===r||null===o||r in i||(i[r]=o)}return i};var Ge=function(e){var t=this;this.growingIO=e,this.generateURL=function(e){var n=t.growingIO.dataStore.getTrackerVds(e),i=n.serverUrl,r=n.projectId;return O(i,"http")?"".concat(i,"/v3/projects/").concat(r,"/collect"):"https://".concat(i,"/v3/projects/").concat(r,"/collect")},this.getHoardingQueue=function(e){var n;return null!==(n=t.hoardingQueue[e])&&void 0!==n?n:[]},this.getRequestQueue=function(e){var n;return null!==(n=t.requestQueue[e])&&void 0!==n?n:[]},this.commitRequest=function(e){var i,r,o=n({},e),u=t.growingIO,s=u.vdsConfig;u.emitter.emit(me,{eventData:e,trackingId:e.trackingId}),s.forceLogin?(a(t.hoardingQueue[e.trackingId])&&(t.hoardingQueue[e.trackingId]=[]),null===(i=t.hoardingQueue[e.trackingId])||void 0===i||i.push(o)):(a(t.requestQueue[e.trackingId])&&(t.requestQueue[e.trackingId]=[]),null===(r=t.requestQueue[e.trackingId])||void 0===r||r.push(o),t.initiateRequest(e.trackingId))},this.initiateRequest=function(e,n){var r=t.growingIO,o=r.plugins,a=r.vdsConfig,u=r.minipInstance,s=r.dataStore,c=t.getHoardingQueue(e),l=t.getRequestQueue(e),g=i(i([],c,!0),l,!0),d=function(e){var i,r;if(null===(i=null==a?void 0:a.tbConfig)||void 0===i?void 0:i.cloudFuncSend)null===(r=null==o?void 0:o.gioTaobaoAdapter)||void 0===r||r.singleInvoke(e);else if(n)t.batchInvoke(e);else{var c=t.growingIO.dataStore.getTrackerVds(e).uploadInterval;A(t.batchInvoke,c,!1,!1)(e)}g.some(function(e){return"VISIT"===e.eventType})&&u.removeStorageSync(s.getStorageKey(e,"originalSource"))};if(g.length>0)if(t.requestingNum<t.requestLimit)d(e);else var p=setInterval(function(){t.requestingNum<t.requestLimit&&(d(e),clearInterval(p),p=void 0)},500)},this.batchInvoke=function(e){var r=t.growingIO,o=r.vdsConfig,a=r.emitter,u=t.getHoardingQueue(e),s=t.getRequestQueue(e),c=i(i([],u,!0),s,!0);c.length>50?(c=c.slice(0,50),u.length>50?t.hoardingQueue[e]=u.slice(50):(t.requestQueue[e]=s.slice(50-u.length),t.hoardingQueue[e]=[])):(t.hoardingQueue[e]=[],t.requestQueue[e]=[]);var l=c.filter(function(e){return(t.retryIds[e.requestId]||0)<=t.retryLimit});if(!x(l)){var g=l.map(function(e){var t=n({},e);return C(t,["requestId","trackingId"]),t});o.debug&&console.log("[GrowingIO Debug]:",JSON.stringify(g,null,2)),a.emit(_e,{eventsQueue:l,requestData:g,trackingId:e})}},this.sendEvent=function(e,n){var r,o=f(e).trackingId,a=t.growingIO,u=a.minipInstance,s=a.dataStore,c=a.emitter,l=a.plugins,g=s.getTrackerVds(o),d=g.compress,p=g.requestTimeout;t.requestingNum+=1;var v={"content-type":"jdp"===u.platform?"application/json":"application/json;charset=UTF-8"},h=i([],n,!0),m=!!d&&(null===(r=null==l?void 0:l.gioCompress)||void 0===r?void 0:r.compressToUTF16);m&&(h=l.gioCompress.compressToUTF16(JSON.stringify(n)),v["X-Compress-Codec"]="1");var I=t.generateURL(o);u.request({url:"".concat(I,"?stm=").concat(Date.now(),"&compress=").concat(m?"1":"0"),header:v,method:"POST",data:h,timeout:p,fail:function(i){[200,204].includes(i.code)||(e.forEach(function(e){t.requestFailFn(e)}),D("请求失败!".concat(JSON.stringify(i)),"error"),c.emit("ON_SEND_ERROR",{eventsQueue:e,requestData:n,trackingId:o}))},complete:function(e){t.requestingNum-=1,c.emit(Oe,{result:e,requestData:n,trackingId:o}),t.initiateRequest(o)}})},this.requestFailFn=function(e){if(t.retryIds[e.requestId]||(t.retryIds[e.requestId]=0),t.retryIds[e.requestId]+=1,!t.requestQueue[e.trackingId].some(function(t){return t.requestId===e.requestId}))var n=setTimeout(function(){x(t.requestQueue[e.trackingId])?(t.requestQueue[e.trackingId].push(e),t.initiateRequest(e.trackingId)):t.requestQueue[e.trackingId].push(e),clearTimeout(n),n=null},800)},this.hoardingQueue={},this.requestQueue={},this.requestLimit=3,this.retryLimit=2,this.retryIds={},this.requestingNum=0,this.growingIO.emitter.on(_e,function(e){var n,i,r=e.eventsQueue,o=e.requestData,a=e.trackingId,u=t.growingIO,s=u.vdsConfig,c=u.plugins;a===t.growingIO.trackingId&&((null===(n=null==s?void 0:s.tbConfig)||void 0===n?void 0:n.cloudAppId)?null===(i=null==c?void 0:c.gioTaobaoAdapter)||void 0===i||i.tbCloudAppInvoke(r,o):t.sendEvent(r,o))})},Qe=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 t._uid||(t._uid=e.getStorageSync(t._getUidKey())),t._uid||t.setUid(B()),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,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=B()),t._sessionId[e]=n;var r=t.growingIO.vdsConfig.sessionExpires;r>-1&&(t._sessionExpires=Date.now()+6e4*r),i!==n&&t.growingIO.emitter.emit(Te,{trackingId:e,newSessionId:n,oldSessionId:i})},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 i=t._userId[e];t._userId[e]=a(n)?"":n,i!==t._userId[e]&&(t.growingIO.minipInstance.setStorage(t._getUserIdKey(e),t._userId[e]),t.growingIO.emitter.emit("USERID_UPDATE",{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=t.growingIO.minipInstance;return t._userKey[e]||(t._userKey[e]=n.getStorageSync(t._getUserKeyKey(e))),t._userKey[e]},this.setUserKey=function(e,n){var i=t._userKey[e];t._userKey[e]=a(n)?"":n,i!==t._userKey[e]&&(t.growingIO.minipInstance.setStorage(t._getUserKeyKey(e),t._userKey[e]),t.growingIO.emitter.emit("USERKEY_UPDATE",{newUserKey:n,oldUserKey:i}))},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 i=t._gioId[e];t._gioId[e]=a(n)?"":n,i!==t._gioId[e]&&(t.growingIO.minipInstance.setStorage(t._getGioIdKey(e),t._gioId[e]),t.growingIO.emitter.emit("GIOID_UPDATE",{newGioId:n,oldGioId:i}))},this.initUserInfo=function(e){var n,i=t.growingIO.minipInstance,r=[t._getUidKey(),t._getUserIdKey(e),t._getUserKeyKey(e),t._getGioIdKey(e)],o=null!==(n=ee(i,r))&&void 0!==n?n:[];["_uid","_userId","_userKey","_gioId"].forEach(function(n,i){"_uid"===n?t.getUid():t[n][e]=o[i]})},this.saveUserInfo=function(){var e=t.growingIO,n=e.minipInstance;(0,e.dataStore.trackersExecute)(function(e){te(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},$e=new function(){var e,t=this;this.init=function(e){var n;t.emitter.emit("ON_SDK_INITIALIZE_BEFORE",{options:e});try{if(D("Gio小程序SDK 初始化中...","info"),e.trackingId&&t.dataStore.initializedTrackingIds.includes(e.trackingId))throw Error("已存在实例 ".concat(e.trackingId,",请勿重复初始化!"));if(t.trackingId&&!t.plugins.gioMultipleInstances)throw Error("您正在尝试初始化另一个实例,请集成多实例插件后重试!");var i=t.dataStore.initTrackerOptions(e);return null===(n=t.emitter)||void 0===n||n.emit(ke,i),t.gioSDKInitialized=!0,t.dataStore.initTrackerHooker(i),"quickapp"!==t.gioPlatform&&t.userStore.initUserInfo(e.trackingId),t.emitter.emit(be,i),t.trackingId&&t.trackingId!==e.trackingId||(Z().__gio__=function(){return t}),D("Gio小程序SDK 初始化完成!","success"),t.inPlugin&&"tbp"!==t.minipInstance.platform&&t.dataStore.sendVisit(i.trackingId),t.vdsConfig.forceLogin&&D("forceLogin已开启,请调用 identify 方法设置 openId 以继续上报!","info"),!0}catch(e){return D(e,"error"),!1}},this.handlerDistribute=function(e,n,r){var o=t.dataStore,a=o.initializedTrackingIds;if((0,o.getTrackerVds)(e)&&a.includes(e))return t[n].apply(t,i([e],r,!1));D("不存在实例:".concat(e,",请检查!"),"warn")},this.registerPlugins=function(e){t.plugins.pluginItems=i(i([],t.plugins.pluginItems,!0),e,!0),t.plugins.installAll(e)},this.getPlugins=function(){return t.plugins.pluginItems},this.getDeviceId=function(){return t.userStore.getUid()},this.getOption=function(e,n){return t.dataStore.getOption(e,n)},this.setOption=function(e,n,i){var r;return k(ge).includes(n)?typeof i===(null===(r=se[n])||void 0===r?void 0:r.type)?(t.dataStore.setOption(e,n,i),D("已修改".concat(ge[n],": ").concat(i),"info"),!0):(D("参数格式不正确:".concat(i,",请检查后重试!"),"error"),!1):(D("不存在可修改的配置项:".concat(n,",请检查后重试!"),"error"),!1)},this.setPageAttributes=function(e,n){if(l(n)&&!x(n)){var i=t.dataStore.eventHooks.currentPage,r=i.getPagePath();return x(i.pageProps[e])&&(i.pageProps[e]={}),x(i.pageProps[e][r])&&(i.pageProps[e][r]={}),x(n)||b(n,function(t,n){g(i.pageProps[e][r][n])&&!g(t)||(i.pageProps[e][r][n]=t)}),!0}return R("setPageAttributes"),!1},this.clearPageAttributes=function(e,n){try{if(!x(t.dataStore.eventHooks.currentPage.pageProps[e])){var i=t.dataStore.eventHooks.currentPage,r=i.getPagePath();d(n)&&!x(n)?n.forEach(function(t){C(i.pageProps[e][r],t)}):i.pageProps[e][r]={}}}catch(e){return R("clearPageAttributes"),!1}},this.sendPage=function(e,n){t.dataStore.getTrackerVds(e).trackPage?D("仅在关闭trackPage时允许调用sendPage,请确认后修改初始化配置项!","error"):t.dataStore.sendPage(e,n)},this.identify=function(e,n){if(e===t.trackingId)if(t.vdsConfig.forceLogin){if(!ue(n))return void R("identify");var i=y(n).slice(0,1e3);t.userStore.setUid(i),t.dataStore.setOption(t.trackingId,"forceLogin",!1),t._identified=!0,t.dataStore.trackersExecute(function(e){var n=t.uploader.getHoardingQueue(e);n.forEach(function(e,t){return n[t].deviceId=i}),t.uploader.initiateRequest(e,!0)})}else t._identified?R("identify",!1,"请勿重复调用"):R("identify",!1,"forceLogin未开启");else R("identify",!1,"子实例不允许调用identify")},this.setUserAttributes=function(e,i){var r,o,a,u;if(l(i)&&!x(i)){var s=t.dataStore,c=s.eventContextBuilder,g=s.eventInterceptor,d=s.lastVisitEvent,p=n({eventType:"LOGIN_USER_ATTRIBUTES"},c(e));p.attributes=X(n(n({},null!==(r=p.attributes)&&void 0!==r?r:{}),j(i))),p.path||(p.path=null===(o=d[e])||void 0===o?void 0:o.path,p.query=null===(a=d[e])||void 0===a?void 0:a.query,p.title=null===(u=d[e])||void 0===u?void 0:u.title),g(p)}else R("setUserAttributes")},this.setUserId=function(e,n,i){if(ue(n)){var r=t.userStore.getGioId(e);n=y(n).slice(0,1e3),i=y(i).slice(0,1e3),t.userStore.setUserId(e,n);var o=!a(i)&&y(i).length>0?y(i).slice(0,1e3):"";t.userStore.setUserKey(e,o),!t.dataStore.getTrackerVds(e).idMapping&&o&&D("您设置了 userKey ,请初始化开启 idMapping!","warn"),r&&r!==n&&t.userStore.setSessionId(e)}else R("setUserId")},this.clearUserId=function(e){t.userStore.setUserId(e,void 0),t.userStore.setUserKey(e,void 0)},this.setGeneralProps=function(e,n){return l(n)&&!x(n)?(x(t.dataStore.generalProps[e])&&(t.dataStore.generalProps[e]={}),b(n,function(n,i){g(t.dataStore.generalProps[e][i])&&!g(n)||(t.dataStore.generalProps[e][i]=n)}),!0):(R("setGeneralProps"),!1)},this.clearGeneralProps=function(e,n){try{x(t.dataStore.generalProps[e])||(d(n)&&!x(n)?n.forEach(function(n){C(t.dataStore.generalProps[e],n)}):t.dataStore.generalProps[e]={})}catch(e){return R("clearGeneralProps"),!1}},this.track=function(e,i,r){H(i,function(){var o,a=t.dataStore,u=a.eventContextBuilder,s=a.eventInterceptor,c=n({eventType:"CUSTOM",eventName:i},u(e));c.attributes=X(n(n({},null!==(o=c.attributes)&&void 0!==o?o:{}),j(n({},l(r)&&!x(r)?r:{})))),t.plugins.gioMultipleInstances&&r&&r["&&sendTo"]&&(c["&&sendTo"]=r["&&sendTo"]),s(c)})},this.trackTimerStart=function(e,n){return t.dataStore.getTrackerVds(e).dataCollect?H(n,function(){var i=B();return t.dataStore.trackTimers[e]||(t.dataStore.trackTimers[e]={}),t.dataStore.trackTimers[e][i]={eventName:n,leng:0,start:+Date.now()},i}):(D("指定实例未开启数据采集,请检查!","error"),!1)},this.trackTimerPause=function(e,n){var i=t.dataStore.trackTimers[e];if(n&&i&&i[n]){var r=i[n];return r.start&&(r.leng=r.leng+(+Date.now()-r.start)),r.start=0,!0}return!1},this.trackTimerResume=function(e,n){var i=t.dataStore.trackTimers[e];if(n&&i&&i[n]){var r=i[n];return 0===r.start&&(r.start=+Date.now()),!0}return!1},this.trackTimerEnd=function(e,i,r){var o,a=t.dataStore.getTrackerVds(e).dataCollect,u=t.dataStore.trackTimers[e];if(i&&u&&u[i]){if(a){var s=u[i];if(0!==s.start){var c=+Date.now()-s.start;s.leng=c>0?s.leng+c:0}var g=t.dataStore,d=g.eventContextBuilder,p=g.eventInterceptor,f=n({eventType:"CUSTOM",eventName:s.eventName},d(e));return f.attributes=X(n(n({},null!==(o=f.attributes)&&void 0!==o?o:{}),j(n(n({},l(r)&&!x(r)?r:{}),{event_duration:s.leng>864e5?0:s.leng/1e3})))),t.plugins.gioMultipleInstances&&r&&r["&&sendTo"]&&(f["&&sendTo"]=r["&&sendTo"]),p(f),!0}return D("指定实例未开启数据采集,计时器已移除,请检查!","error"),!1}return D("未查询到指定计时器,请检查!","error"),!1},this.removeTimer=function(e,n){var i=t.dataStore.trackTimers[e];return n&&i&&i[n]?(delete i[n],!0):(D("未查询到指定计时器,请检查!","error"),!1)},this.clearTrackTimer=function(e){t.dataStore.trackTimers[e]={}},this.setLocation=function(e,n,i){x(t.dataStore.locationData[e])&&(t.dataStore.locationData[e]={});var r=t.dataStore.locationData[e],o=function(e){return e>=-180&&180>=e};o(n)&&o(i)&&(r.latitude!==n||r.longitude!==i)&&(t.dataStore.locationData[e]={latitude:n,longitude:i})},this.updateImpression=function(){D("updateImpression 错误! 请集成半自动埋点浏览插件后重试!","error")},this.getABTest=function(e,t,n){D("获取ABTest数据错误! 请集成ABTest插件后重试!","error"),L(n,{})},this.getGioInfo=function(e){var n,i,r=t.userStore,o=r.getUid,a=r.getUserId,u=r.getUserKey,s=r.getSessionId,c=t.dataStore.getTrackerVds(e),l=c.projectId,g=c.appId,d=c.dataSourceId,p=c.dataCollect,f=c.idMapping,v=c.extraParams,h=c.ignoreFields,m={gioappid:g,giocs1:a(e)||"",gioplatform:t.platformConfig.platform,gioprojectid:l,gios:s(e),giou:o()};if(m.giodatacollect=p,m.giodatasourceid=d,f&&(m.giouserkey=u(e)),x(v)||v.forEach(function(n){var i;h.includes(n)||(m["gio".concat(n)]=(null!==(i=t.dataStore.lastVisitEvent[e])&&void 0!==i?i:{})[n])}),e===t.trackingId){var I=null!==(i=null===(n=t.plugins)||void 0===n?void 0:n.gioEventAutoTracking)&&void 0!==i?i:{},y=I.circleServerUrl,S=I.circleOpen;if(y&&S){var w=ie(y.split("?")[1]);w.roomId&&(m.giocircleroomid=w.roomId)}}return je.stringify(m)},this.utils=n(n(n({},U),ae),{qs:je}),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="tb",this.gioFramework="native",this.sdkVersion="4.4.2";try{"quickapp"===this.gioPlatform||g(getApp)&&g(App)?this.inPlugin=!1:this.inPlugin=!0}catch(e){this.inPlugin=!0}this.inPlugin&&D("未检测到小程序实例,自动切换为插件模式!","info"),this.platformConfig=De,this.minipInstance=new Re(this),this.dataStore=new Ne(this),this.userStore=new Qe(this),this.uploader=new Ge(this),this.plugins=new He(this),this.plugins.innerPluginInit()},ze=function(){var e,t=arguments[0],i="g0",r=t;if(t.indexOf(".")>-1&&(i=null!==(e=t.split(".")[0])&&void 0!==e?e:"g0",r=t.split(".")[1]),u(r)&&le.includes(r)&&$e[r]){var o=h(Array.from(arguments));if("init"===r){var a=function(e,t){var n=y(t[0]),i=y(t[1]),r=(4===t.length?t[3]:t[2])||{};return n&&i?e.dataStore.initializedTrackingIds.some(function(t,r){var o=0===r?e.vdsConfig:e.subInstance[t];return o.projectId===n&&o.dataSourceId===i})?(D("SDK初始化失败,重复初始化,请检查初始化参数!","error"),!1):{projectId:n,dataSourceId:i,appId:y(4===t.length?t[2]:""),userOptions:r}:(D('SDK初始化失败,请使用 gdp("init", "您的GrowingIO项目 accountId", "您项目的 dataSourceId", "您的小程序 AppId(可选)", options: { serverUrl: "您的数据上报地址" }); 进行初始化!',"error"),!1)}($e,o);if(a){var s=a.projectId,c=a.dataSourceId,l=a.appId,g=a.userOptions;return $e.init(n(n({},g),{projectId:s,dataSourceId:c,appId:l,trackingId:i}))}return!1}if("registerPlugins"===r)$e.registerPlugins(o[0]);else{if($e.gioSDKInitialized&&$e.vdsConfig)return ce.includes(r)?K(function(){return $e.handlerDistribute(i,r,o)}):K(function(){return $e[r].apply($e,o)});D("SDK未初始化!","error")}}else if(de.includes(r))D("方法 ".concat(y(r)," 已被弃用,请移除!"),"warn");else{if("canIUse"===r)return le.includes(arguments[1])&&!!$e[arguments[1]];D("不存在名为 ".concat(y(r)," 的方法调用!"),"error")}};Z().gdp=ze,Z().gioSDKVersion=$e.sdkVersion;var Je=$e.dataStore.eventHooks,We=Je.growingApp,Ye=Je.growingPage,Ze=Je.growingComponent,Xe=Je.growingBehavior;(0,Je.initOriginalValue)();var et=K(function(){return null!=We?We:App}),nt=K(function(){return null!=Ye?Ye:Page}),it=K(function(){return null!=Ze?Ze:Component}),rt=K(function(){return null!=Xe?Xe:Behavior});export{et as GioApp,rt as GioBehavior,it as GioComponent,nt as GioPage,ze as default};
|